Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel

## Unreleased

### Added

- Added momentary_rot_button to targetID (by @MrXonte)

## [v0.14.6b](https://github.com/TTT-2/TTT2/tree/v0.14.6b) (2026-04-06)

### Added
Expand Down
10 changes: 9 additions & 1 deletion gamemodes/terrortown/gamemode/shared/sh_entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ function entmeta:IsRotatingButton()
return button.IsClass(self, "func_rot_button")
end

---
-- Returns true if this entity is a momentary rotating button (lever).
-- @return boolean Returns true if momentary rotating button
-- @realm shared
function entmeta:IsMomentaryRotatingButton()
return button.IsClass(self, "momentary_rot_button")
end

---
-- Returns true if the entity is any type of button.
-- @return boolean Returns true if button
-- @realm shared
function entmeta:IsButton()
return self:IsDefaultButton() or self:IsRotatingButton()
return self:IsDefaultButton() or self:IsRotatingButton() or self:IsMomentaryRotatingButton()
end
2 changes: 2 additions & 0 deletions lua/terrortown/lang/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2356,9 +2356,11 @@ L.label_roles_derandomize_min_weight = "Derandomization minimum weight"
-- 2024-08-17
L.name_button_default = "Button"
L.name_button_rotating = "Lever"
L.name_button_momentary_rotating = "Wheel"

L.button_default = "Press [{usekey}] to trigger"
L.button_rotating = "Press [{usekey}] to flip"
L.button_momentary_rotating = "Press [{usekey}] to rotate"

L.undefined_key = "???"

Expand Down
1 change: 1 addition & 0 deletions lua/ttt2/libraries/buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ button = {}
local validButtons = {
"func_button",
"func_rot_button",
"momentary_rot_button",
}

if SERVER then
Expand Down
5 changes: 5 additions & 0 deletions lua/ttt2/libraries/targetid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,11 @@ function targetid.HUDDrawTargetIDButtons(tData)
tData:SetTitle(TryT("name_button_rotating"))
tData:SetSubtitle(ParT("button_rotating", key_params))
end

if ent:IsMomentaryRotatingButton() then
tData:SetTitle(TryT("name_button_momentary_rotating"))
tData:SetSubtitle(ParT("button_momentary_rotating", key_params))
end
end

---
Expand Down
Loading