Skip to content

Commit 79e2c3f

Browse files
committed
buttons can bypass changes to their holdtime/toggle state updates if hidden
and add more details to logic gates-based events' tutorial entries to clarify how to use uids
1 parent 5ad9bec commit 79e2c3f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lua/pac3/core/client/part_pool.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,9 @@ end
675675
function pac.UpdateButtonEvents(ply, key, down)
676676
local button_events = ply.pac_part_cache_button_events or {}
677677
for _,part in pairs(button_events) do
678+
if part:GetProperty("ignore_if_hidden") then
679+
if part:IsHidden() then continue end
680+
end
678681
if key ~= string.Split(part.Arguments, "@@")[1]:lower() then continue end
679682
part.pac_broadcasted_buttons_holduntil = part.pac_broadcasted_buttons_holduntil or {}
680683
part.toggleimpulsekey = part.toggleimpulsekey or {}

lua/pac3/core/client/parts/event.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,7 +2736,7 @@ PART.OldEvents = {
27362736

27372737
or_gate = {
27382738
operator_type = "none", preferred_operator = "find simple",
2739-
tutorial_explanation = "combines multiple events into an OR gate, the event will activate as soon as one of the events listed is activated (taking inverts into account)",
2739+
tutorial_explanation = "combines multiple events into an OR gate, the event will activate as soon as one of the events listed is activated (taking inverts into account).\n\nuids is a list (separated by semicolons) of part identifiers (UniqueIDs or names)\n\nAn easy way to gather them is to use bulk select (ctrl+click) and to right click back on the or_gate",
27402740
arguments = {{uids = "string"}, {ignore_inverts = "boolean"}},
27412741
userdata = {{default = "", enums = function(part)
27422742
local output = {}
@@ -2772,7 +2772,7 @@ PART.OldEvents = {
27722772
},
27732773
xor_gate = {
27742774
operator_type = "none", preferred_operator = "find simple",
2775-
tutorial_explanation = "combines multiple events into an XOR gate, the event will activate if one (and only one) of the two events is activated (taking inverts into account)",
2775+
tutorial_explanation = "combines multiple events into an XOR gate, the event will activate if one (and only one) of the two events is activated (taking inverts into account).\n\nuid1 and uid2 are part identifiers (UniqueID or names) for events",
27762776
arguments = {{uid1 = "string"},{uid2 = "string"}},
27772777
userdata = {
27782778
{default = "", enums = function(part)
@@ -2816,7 +2816,7 @@ PART.OldEvents = {
28162816
},
28172817
and_gate = {
28182818
operator_type = "none", preferred_operator = "find simple",
2819-
tutorial_explanation = "combines multiple events into an AND gate, the event will activate when all the events listed are activated (taking inverts into account)",
2819+
tutorial_explanation = "combines multiple events into an AND gate, the event will activate when all the events listed are activated (taking inverts into account)\n\nuids is a list (separated by semicolons) of part identifiers (UniqueIDs or names)\n\nAn easy way to gather them is to use bulk select (ctrl+click) and to right click back on the and_gate",
28202820
arguments = {{uids = "string"}, {ignore_inverts = "boolean"}},
28212821
userdata = {{default = "", enums = function(part)
28222822
local output = {}
@@ -2965,7 +2965,7 @@ do
29652965

29662966
PART.OldEvents.button = {
29672967
operator_type = "none",
2968-
arguments = {{button = "string"}, {holdtime = "number"}, {toggle = "boolean"}},
2968+
arguments = {{button = "string"}, {holdtime = "number"}, {toggle = "boolean"}, {ignore_if_hidden = "boolean"}},
29692969
userdata = {{enums = function()
29702970
return enums
29712971
end, default = "mouse_left"}, {default = 0}, {default = false}},
@@ -2988,7 +2988,7 @@ do
29882988

29892989
return self:GetOperator() .. " \"" .. button .. "\"" .. " in (" .. active .. ")"
29902990
end,
2991-
callback = function(self, ent, button, holdtime, toggle)
2991+
callback = function(self, ent, button, holdtime, toggle, ignore_if_hidden)
29922992
self.holdtime = holdtime or 0
29932993
local toggle = toggle or false
29942994
self.togglestate = self.togglestate or false

0 commit comments

Comments
 (0)