Skip to content
Merged
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
39 changes: 36 additions & 3 deletions lua/pac3/core/client/parts/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

local BUILDER, PART = pac.PartTemplate("base")

PART.ClassName = "event"

Check warning on line 14 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'single quoted strings' and 'double quoted strings'

PART.ThinkTime = 0
PART.AlwaysThink = true
PART.Icon = 'icon16/clock.png'

Check warning on line 18 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'single quoted strings' and 'double quoted strings'

PART.ImplementsDoubleClickSpecified = true

Expand All @@ -31,7 +31,7 @@

return output
end, description = "The type of condition used to determine whether to hide or show parts.\nCommon events are button, command, timer, timerx, is_on_ground, health_lost, is_touching"})
BUILDER:GetSet("Operator", "find simple", {enums = function(part) local tbl = {} for i,v in ipairs(part.Operators) do tbl[v] = v end return tbl end, description = "How the event will compare its source data with your reference value. PAC will try automatically pick an appropriate operator based on the event.\n\nfind and find simple searches for a keyword match (applies to text only).\nequal looks for an exact match (applies for text and numbers)\nabove, below etc are number comparators and should be self-explanatory.\nmaybe does a coin flip ignoring everything"})

Check warning on line 34 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Space after comma"

Style: Please add a space after the comma
BUILDER:GetSet("Arguments", "", {hidden = false, description = "The internal text representation of the event's arguments, how it gets saved.\nThe dynamic fields access that very same thing, but a text field is useful to review and copy all the arguments at once."})
BUILDER:GetSet("Invert", true, {description = "invert: show when condition is met\nuninverted: hide when condition is met"})
BUILDER:GetSet("RootOwner", true)
Expand All @@ -44,7 +44,7 @@

PART.Tutorials = {}

local registered_command_event_series = {}

Check warning on line 47 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: registered_command_event_series
local event_series_bounds = {}

function PART:OnDoubleClickSpecified()
Expand All @@ -55,7 +55,7 @@
end

if self.Event == "command" then
local cmd, time, hide = self:GetParsedArgumentsForObject(self.Events.command)

Check warning on line 58 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: hide
if time == 0 then --toggling mode
pac.LocalPlayer.pac_command_events[cmd] = pac.LocalPlayer.pac_command_events[cmd] or {name = cmd, time = pac.RealTime, on = 0}
----MORE PAC JANK?? SOMETIMES, THE 2 NOTATION DOESN'T CHANGE THE STATE YET
Expand All @@ -77,16 +77,16 @@
end
end

function PART:register_command_event(str,b)

Check warning on line 80 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Space after comma"

Style: Please add a space after the comma
local ply = self:GetPlayerOwner()

local event = str
local flush = b

local num = tonumber(string.sub(event, string.find(event,"[%d]+$") or 0))

Check warning on line 86 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Space after comma"

Style: Please add a space after the comma

if string.find(event,"[%d]+$") then

Check warning on line 88 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Space after comma"

Style: Please add a space after the comma
event = string.gsub(event,"[%d]+$","")

Check warning on line 89 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Space after comma"

Style: Please add a space after the comma

Check warning on line 89 in lua/pac3/core/client/parts/event.lua

View workflow job for this annotation

GitHub Actions / lint

"Space after comma"

Style: Please add a space after the comma
end
ply.pac_command_event_sequencebases = ply.pac_command_event_sequencebases or {}

Expand Down Expand Up @@ -384,7 +384,6 @@
end
self.ExtraHermites_Property = "MultipleTargetParts"
end

end

local function get_default(typ)
Expand Down Expand Up @@ -2884,8 +2883,42 @@
end
return true
end,
}
},

is_no_draw = {
operator_type = "none",
tutorial = "activates when the current entity is flagged with nodraw",
callback = function(self, ent)
return ent:GetNoDraw()
end,
},

viewer_steamid = {
operator_type = "string", preferred_operator = "equal",
tutorial = "activates when the local player has the steamID specified",
arguments = {{find = "string"}, {include_owner = "boolean"}},
callback = function(self, ent, find, include_owner)
if include_owner then
find = find .. ";" .. self:GetOwner():SteamID()
end

return self:StringOperator(pac.LocalPlayer:SteamID(), find)
end,
nice = function(self, ent, find, include_owner)
local count = #string.Split(find, ";")

local idSumm
if count == 0 or find == "" then
idSumm = (include_owner and "owner id" or "\"\"")
elseif count == 1 then
idSumm = string.format("\"%s\"%s", find, include_owner and " + owner id" or "")
else
idSumm = string.format("1 of %d entries%s", count, include_owner and " + owner id" or "")
end

return string.format("steamid: [%s %s]", self.Operator, idSumm)
end
},
}


Expand Down Expand Up @@ -4732,7 +4765,7 @@
if cached_part then
tbl[i][cached_part.UniqueID] = value
end

end
end
--PrintTable(tbl)
Expand Down
Loading