Skip to content

Commit

Permalink
Added Win Score Event (TTT-2#1733)
Browse files Browse the repository at this point in the history
Added win score to finish event with parameter for amount of score in
role base and LANG entries

I felt like it was weird that no score was gained for winning,
especially for roles that cant gain score as quickly in other ways. This
adds an event for that where score amount can also be configured for
every role.
  • Loading branch information
MrXonte authored and Histalek committed Jan 31, 2025
1 parent 6c817b0 commit d7de58a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- Added support for "toggle_zoom" binds to trigger the radio commands menu (by @TW1STaL1CKY)
- Added option to use right click to enable/disable roles in the role layering menu (by @TimGoll)
- Added option to enable team name next to role name on the HUD (by @milkwxter)
- Added score event for winning with configurable role parameter (by @MrXonte)

### Fixed

Expand Down
5 changes: 4 additions & 1 deletion lua/terrortown/entities/roles/ttt_role_base/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ ROLE.score = {
-- round ended with nobody winning, usually a negative number.
timelimitMultiplier = 0,

-- The amount of points gained by killing yourself. Should be a
-- The amount of score points gained by killing yourself. Should be a
-- negative number for most roles.
suicideMultiplier = -1,

-- The amount of score points gained when your team wins.
winMultiplier = 3,
}

ROLE.karma = {
Expand Down
1 change: 1 addition & 0 deletions lua/terrortown/events/finish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function EVENT:CalculateScore()
score_timelimit = wintype == WIN_TIMELIMIT and math.ceil(
otherAlivePlayers * roleData.score.timelimitMultiplier
) or 0,
score_win = wintype == team and roleData.score.winMultiplier,
})
end
end
Expand Down
2 changes: 2 additions & 0 deletions lua/terrortown/lang/de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1170,13 +1170,15 @@ L.tooltip_karma_gained = "Karmaänderungen für diese Runde:"
L.tooltip_score_gained = "Punkteänderungen für diese Runde:"
L.tooltip_roles_time = "Rollenwechsel für diese Runde:"

L.tooltip_finish_score_win = "Gewinner: {score}"
L.tooltip_finish_score_alive_teammates = "Lebende Teammitglieder: {score}"
L.tooltip_finish_score_alive_all = "Lebende Spieler: {score}"
L.tooltip_finish_score_timelimit = "Zeit vorbei: {score}"
L.tooltip_finish_score_dead_enemies = "Tote Gegner: {score}"
L.tooltip_kill_score = "Mord: {score}"
L.tooltip_bodyfound_score = "Leichenfund: {score}"

L.finish_score_win = "Gewinner:"
L.finish_score_alive_teammates = "Lebende Teammitglieder:"
L.finish_score_alive_all = "Lebende Spieler:"
L.finish_score_timelimit = "Zeit vorbei:"
Expand Down
2 changes: 2 additions & 0 deletions lua/terrortown/lang/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1170,13 +1170,15 @@ L.tooltip_karma_gained = "Karma changes for this round:"
L.tooltip_score_gained = "Score changes for this round:"
L.tooltip_roles_time = "Role changes for this round:"

L.tooltip_finish_score_win = "Win: {score}"
L.tooltip_finish_score_alive_teammates = "Alive teammates: {score}"
L.tooltip_finish_score_alive_all = "Alive players: {score}"
L.tooltip_finish_score_timelimit = "Time is up: {score}"
L.tooltip_finish_score_dead_enemies = "Dead enemies: {score}"
L.tooltip_kill_score = "Kill: {score}"
L.tooltip_bodyfound_score = "Body found: {score}"

L.finish_score_win = "Win:"
L.finish_score_alive_teammates = "Alive teammates:"
L.finish_score_alive_all = "Alive players:"
L.finish_score_timelimit = "Time is up:"
Expand Down

0 comments on commit d7de58a

Please sign in to comment.