-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtrigger_trigger.lua
More file actions
205 lines (190 loc) · 5.28 KB
/
Copy pathtrigger_trigger.lua
File metadata and controls
205 lines (190 loc) · 5.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
local enums = require "consts.celeste_enums"
local activationTypes = {
["Flag (Default)"] = "Flag",
["Dashing"] = "Dashing",
["Dash Count"] = "DashCount",
["Deaths In Room"] = "DeathsInRoom",
["Deaths In Level"] = "DeathsInLevel",
["Holdable Grabbed"] = "GrabHoldable",
["Horizontal Speed"] = "SpeedX",
["Vertical Speed"] = "SpeedY",
["Jumping"] = "Jumping",
["Crouching"] = "Crouching",
["Time Since Player Moved"] = "TimeSinceMovement",
["Holdable Entered"] = "OnHoldableEnter",
["On Entity Touch"] = "OnEntityCollide",
["Core Mode"] = "CoreMode",
["On Interaction"] = "OnInteraction",
["Touched Solid"] = "OnSolid",
["Entity Entered"] = "OnEntityEnter",
["On Input"] = "OnInput",
["Grounded"] = "OnGrounded",
["Player State"] = "OnPlayerState",
}
local comparisonTypes = {
"LessThan",
"EqualTo",
"GreaterThan"
}
local inputTypes = {
"Left",
"Right",
"Up",
"Down",
"Jump",
"Dash",
"Grab",
"Interact",
"CrouchDash",
"Any",
}
local triggerTrigger = {}
triggerTrigger.name = "vitellary/triggertrigger"
triggerTrigger.nodeLimits = {1, -1}
triggerTrigger.nodeLineRenderType = "fan"
triggerTrigger.fieldInformation = {
activationType = {
editable = false,
options = activationTypes
},
comparisonType = {
editable = false,
options = comparisonTypes
},
inputType = {
editable = false,
options = inputTypes
},
coreMode = {
editable = false,
options = enums.core_modes
},
playerState = {
fieldType = "integer",
}
}
function triggerTrigger.ignoredFields(entity)
local ignored = {
"_id",
"_name",
"comparisonType",
"absoluteValue",
"talkBubbleX",
"talkBubbleY",
"flag",
"deaths",
"dashCount",
"requiredSpeed",
"timeToWait",
"coreMode",
"entityTypeToCollide",
"collideCount",
"solidType",
"entityType",
"inputType",
"holdInput",
"excludeTalkers",
"onlyIfSafe",
"playerState",
"includeCoyote",
"includeWallJump",
"resetAfterJump",
}
local function doNotIgnore(value)
for i = #ignored, 1, -1 do
if ignored[i] == value then
table.remove(ignored, i)
return
end
end
end
local atype = entity.activationType or "Flag"
local iscomparison = false
if atype == "Flag" then
doNotIgnore("flag")
elseif atype == "DashCount" then
doNotIgnore("dashCount")
iscomparison = true
elseif atype == "DeathsInRoom" or atype == "DeathsInLevel" then
doNotIgnore("deaths")
iscomparison = true
elseif atype == "SpeedX" or atype == "SpeedY" then
doNotIgnore("requiredSpeed")
iscomparison = true
elseif atype == "TimeSinceMovement" then
doNotIgnore("timeToWait")
iscomparison = true
elseif atype == "CoreMode" then
doNotIgnore("coreMode")
elseif atype == "OnEntityCollide" then
doNotIgnore("entityType")
doNotIgnore("collideCount")
iscomparison = true
elseif atype == "OnInteraction" then
doNotIgnore("talkBubbleX")
doNotIgnore("talkBubbleY")
elseif atype == "OnSolid" then
doNotIgnore("solidType")
elseif atype == "OnEntityEnter" then
doNotIgnore("entityType")
elseif atype == "OnInput" then
doNotIgnore("inputType")
doNotIgnore("holdInput")
if entity.inputType == "Interact" then
doNotIgnore("excludeTalkers")
end
elseif atype == "OnGrounded" then
doNotIgnore("onlyIfSafe")
doNotIgnore("includeCoyote")
elseif atype == "Jumping" then
doNotIgnore("includeWallJump")
doNotIgnore("resetAfterJump")
elseif atype == "OnPlayerState" then
doNotIgnore("playerState")
end
if iscomparison then
doNotIgnore("comparisonType")
doNotIgnore("absoluteValue")
end
return ignored
end
triggerTrigger.placements = {}
for _, mode in pairs(activationTypes) do
local placement = {
name = string.lower(mode),
data = {
oneUse = false,
flag = "",
invertCondition = false,
delay = 0.0,
activateOnTransition = false,
randomize = false,
matchPosition = true,
activationType = mode,
comparisonType = "EqualTo",
deaths = 0,
dashCount = 0,
requiredSpeed = 0.0,
absoluteValue = false,
timeToWait = 0.0,
coreMode = "None",
entityTypeToCollide = "Celeste.Strawberry",
talkBubbleX = 0,
talkBubbleY = 0,
onlyOnEnter = false,
collideCount = 1,
solidType = "",
entityType = "",
inputType = "Grab",
holdInput = false,
excludeTalkers = false,
onlyIfSafe = false,
playerState = 0,
includeCoyote = false,
includeWallJump = true,
resetAfterJump = false,
}
}
table.insert(triggerTrigger.placements, placement)
end
return triggerTrigger