author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 15 Jan 2019 01:47:07 +0100 | |
changeset 14615 | 825fe522f4f1 |
parent 14252 | 74bf2d906097 |
child 14626 | 153c12b9051b |
permissions | -rw-r--r-- |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
1 |
local animPos, lastx, lasty, jumpTypes, jumpTimes, moveDirs, jumpStarted |
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
2 |
local moveTime = 0 |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
3 |
local backJumped, jTimer, awTime, globalWait, stageEvents, seNum, curEvent |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
4 |
local needToDecrease |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
5 |
local AnimList, AnimListNum |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
6 |
local FunctionList, FunctionListNum |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
7 |
local skipFuncList |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
8 |
local skipping |
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
9 |
local baseInputMask = 0xFFFFFFFF |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
10 |
local extraInputMask = baseInputMask |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
11 |
--------------------------------Animation--------------------------------- |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
12 |
--------------------------(In-game cinematics)---------------------------- |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
13 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
14 |
function AddSkipFunction(anim, func, args) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
15 |
skipFuncList[anim] = {sfunc = func, sargs = args} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
16 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
17 |
|
7263
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
18 |
function RemoveSkipFunction(anim) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
19 |
skipFuncList[anim] = nil |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
20 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
21 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
22 |
function SetAnimSkip(bool) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
23 |
skipping = bool |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
24 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
25 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
26 |
function AnimInProgress() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
27 |
return AnimListNum ~= 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
28 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
29 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
30 |
function SkipAnimation(anim) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
31 |
if skipFuncList[anim] == nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
32 |
return |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
33 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
34 |
skipFuncList[anim].sfunc(unpack(skipFuncList[anim].sargs)) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
35 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
36 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
37 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
38 |
function AddFunction(element) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
39 |
table.insert(FunctionList, element) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
40 |
FunctionListNum = FunctionListNum + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
41 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
42 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
43 |
function RemoveFunction() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
44 |
table.remove(FunctionList, 1) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
45 |
FunctionListNum = FunctionListNum - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
46 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
47 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
48 |
function ExecuteAfterAnimations() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
49 |
if FunctionListNum == 0 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
50 |
return |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
51 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
52 |
FunctionList[1].func(unpack(FunctionList[1].args)) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
53 |
RemoveFunction() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
54 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
55 |
|
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
56 |
local function updateInputMask() |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
57 |
SetInputMask(band(baseInputMask, extraInputMask)) |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
58 |
end |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
59 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
60 |
local function startCinemaLock() |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
61 |
SetCinematicMode(true) |
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
62 |
baseInputMask = bnot(gmAnimate+gmAttack+gmDown+gmHJump+gmLeft+gmLJump+gmRight+gmSlot+gmSwitch+gmTimer+gmUp+gmWeapon) |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
63 |
updateInputMask() |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
64 |
end |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
65 |
|
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
66 |
local function stopCinemaLock() |
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
67 |
baseInputMask = 0xFFFFFFFF |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
68 |
updateInputMask() |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
69 |
SetCinematicMode(false) |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
70 |
end |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
71 |
|
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
72 |
function AnimSetInputMask(newExtraInputMask) |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
73 |
extraInputMask = newExtraInputMask |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
74 |
updateInputMask() |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
75 |
end |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
76 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
77 |
function AnimInit(startAnimating) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
78 |
lastx = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
79 |
lasty = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
80 |
jumpTypes = {long = gmLJump, high = gmHJump, back = gmHJump} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
81 |
jumpTimes = {long = 500, high = 500, back = 300, backback = 500} |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
82 |
moveDirs = {Right = gmRight, Left = gmLeft} |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
83 |
jumpStarted = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
84 |
backJumped = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
85 |
jTimer = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
86 |
awTime = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
87 |
globalWait = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
88 |
stageEvents = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
89 |
seNum = 0 |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
90 |
curEvent = 0 |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
91 |
needToDecrease = 0 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
92 |
AnimList = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
93 |
AnimListNum = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
94 |
FunctionList = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
95 |
FunctionListNum = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
96 |
skipping = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
97 |
skipFuncList = {} |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
98 |
animPos = 1 |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
99 |
if startAnimating then |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
100 |
startCinemaLock() |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
101 |
end |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
102 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
103 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
104 |
function AnimSwitchHog(gear) |
7255
93cf6b3b89be
Fixed a visual gear in Mission 5
belphegorr <szabibibi@gmail.com>
parents:
7245
diff
changeset
|
105 |
--SetGearMessage(gear, 0) |
93cf6b3b89be
Fixed a visual gear in Mission 5
belphegorr <szabibibi@gmail.com>
parents:
7245
diff
changeset
|
106 |
--SetState(gear, 0) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
107 |
SwitchHog(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
108 |
FollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
109 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
110 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
111 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
112 |
function AnimGiveState(gear, state) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
113 |
SetState(gear, state) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
114 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
115 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
116 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
117 |
function AnimRemoveState(gear, state) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
118 |
SetState(gear, band(GetState(gear), bnot(state))) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
119 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
120 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
121 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
122 |
function AnimGearWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
123 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
124 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
125 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
126 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
127 |
function AnimUnWait() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
128 |
if globalWait > 0 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
129 |
globalWait = globalWait - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
130 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
131 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
132 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
133 |
function AnimWait(gear, time) -- gear is for compatibility with Animate |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
134 |
globalWait = globalWait + time |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
135 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
136 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
137 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
138 |
function AnimWaitLeft() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
139 |
return globalWait |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
140 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
141 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
142 |
function AnimSay(gear, text, manner, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
143 |
HogSay(gear, text, manner, 2) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
144 |
if time ~= nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
145 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
146 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
147 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
148 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
149 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
150 |
function AnimSound(gear, sound, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
151 |
PlaySound(sound, gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
152 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
153 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
154 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
155 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
156 |
function AnimTurn(gear, dir) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
157 |
if dir == "Right" then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
158 |
HogTurnLeft(gear, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
159 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
160 |
HogTurnLeft(gear, true) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
161 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
162 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
163 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
164 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
165 |
function AnimFollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
166 |
FollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
167 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
168 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
169 |
|
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
170 |
function AnimMove(gear, dir, posx, posy, maxMoveTime) |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
171 |
local dirr = moveDirs[dir] |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
172 |
SetGearMessage(gear, dirr) |
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
173 |
moveTime = moveTime + 1 |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
174 |
if (maxMoveTime and moveTime > maxMoveTime) then |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
175 |
SetGearMessage(gear, 0) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
176 |
SetGearPosition(gear, posx, posy) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
177 |
lastx = GetX(gear) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
178 |
lasty = GetY(gear) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
179 |
moveTime = 0 |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
180 |
return true |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
181 |
elseif GetX(gear) == posx or GetY(gear) == posy then |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
182 |
SetGearMessage(gear, 0) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
183 |
lastx = GetX(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
184 |
lasty = GetY(gear) |
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
185 |
moveTime = 0 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
186 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
187 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
188 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
189 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
190 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
191 |
function AnimJump(gear, jumpType) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
192 |
if jumpStarted == false then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
193 |
lastx = GetX(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
194 |
lasty = GetY(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
195 |
backJumped = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
196 |
jumpStarted = true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
197 |
SetGearMessage(gear, jumpTypes[jumpType]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
198 |
AnimGearWait(gear, jumpTimes[jumpType]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
199 |
elseif jumpType == "back" and backJumped == false then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
200 |
backJumped = true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
201 |
SetGearMessage(gear, jumpTypes[jumpType]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
202 |
AnimGearWait(gear, jumpTimes["backback"]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
203 |
else |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
204 |
local curx = GetX(gear) |
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
205 |
local cury = GetY(gear) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
206 |
if curx == lastx and cury == lasty then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
207 |
jumpStarted = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
208 |
backJumped = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
209 |
AnimGearWait(gear, 100) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
210 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
211 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
212 |
lastx = curx |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
213 |
lasty = cury |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
214 |
AnimGearWait(gear, 100) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
215 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
216 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
217 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
218 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
219 |
|
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
220 |
function AnimSetGearPosition(gear, destX, destY, fall) |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
221 |
SetGearPosition(gear, destX, destY) |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
222 |
if fall ~= false then |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
223 |
SetGearVelocity(gear, 0, 10) |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
224 |
end |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
225 |
return true |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
226 |
end |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
227 |
|
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
228 |
function AnimDisappear(gear, destX, destY) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
229 |
AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
230 |
AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
231 |
AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
232 |
AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false) |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
233 |
PlaySound(sndExplosion) |
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
234 |
AnimSetGearPosition(gear, destX, destY) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
235 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
236 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
237 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
238 |
function AnimOutOfNowhere(gear, destX, destY) |
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
239 |
AnimSetGearPosition(gear, destX, destY) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
240 |
AddVisualGear(destX, destY, vgtBigExplosion, 0, false) |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
241 |
PlaySound(sndExplosion) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
242 |
AnimGearWait(gear, 50) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
243 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
244 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
245 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
246 |
function AnimTeleportGear(gear, destX, destY) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
247 |
AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
248 |
AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
249 |
AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
250 |
AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false) |
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
251 |
AnimSetGearPosition(gear, destX, destY) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
252 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
253 |
PlaySound(sndExplosion) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
254 |
FollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
255 |
AnimGearWait(gear, 50) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
256 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
257 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
258 |
|
13684
739fd039daaa
Animate: Remove follow arg from AnimVisualGear
Wuzzy <Wuzzy2@mail.ru>
parents:
13032
diff
changeset
|
259 |
function AnimVisualGear(gear, x, y, vgType, state, critical) |
739fd039daaa
Animate: Remove follow arg from AnimVisualGear
Wuzzy <Wuzzy2@mail.ru>
parents:
13032
diff
changeset
|
260 |
AddVisualGear(x, y, vgType, state, critical) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
261 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
262 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
263 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
264 |
function AnimCaption(gear, text, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
265 |
AddCaption(text) |
7213
fce7de71742f
Fixed some bugs with Mission 2 and Animate.lua.
belphegorr <szabibibi@gmail.com>
parents:
7205
diff
changeset
|
266 |
if time == nil then |
fce7de71742f
Fixed some bugs with Mission 2 and Animate.lua.
belphegorr <szabibibi@gmail.com>
parents:
7205
diff
changeset
|
267 |
return true |
fce7de71742f
Fixed some bugs with Mission 2 and Animate.lua.
belphegorr <szabibibi@gmail.com>
parents:
7205
diff
changeset
|
268 |
end |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
269 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
270 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
271 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
272 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
273 |
function AnimCustomFunction(gear, func, args) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
274 |
if args == nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
275 |
args = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
276 |
end |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
277 |
local retval = func(unpack(args)) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
278 |
if retval == false then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
279 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
280 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
281 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
282 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
283 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
284 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
285 |
function AnimInsertStepNext(step) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
286 |
table.insert(AnimList[1], animPos + 1, step) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
287 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
288 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
289 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
290 |
function AnimShowMission(gear, caption, subcaption, text, icon, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
291 |
ShowMission(caption, subcaption, text, icon, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
292 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
293 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
294 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
295 |
function RemoveAnim() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
296 |
table.remove(AnimList, 1) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
297 |
AnimListNum = AnimListNum - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
298 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
299 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
300 |
function AddAnim(animation) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
301 |
table.insert(AnimList, animation) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
302 |
AnimListNum = AnimListNum + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
303 |
if AnimListNum == 1 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
304 |
skipping = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
305 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
306 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
307 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
308 |
function ShowAnimation() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
309 |
if AnimListNum == 0 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
310 |
skipping = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
311 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
312 |
else |
13752
110d6c1e817f
Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
313 |
SetTurnTimeLeft(MAX_TURN_TIME) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
314 |
if Animate(AnimList[1]) == true then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
315 |
RemoveAnim() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
316 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
317 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
318 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
319 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
320 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
321 |
function Animate(steps) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
322 |
if skipping == true then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
323 |
animPos = 1 |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
324 |
stopCinemaLock() |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
325 |
SkipAnimation(steps) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
326 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
327 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
328 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
329 |
if globalWait ~= 0 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
330 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
331 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
332 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
333 |
if steps[animPos] == nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
334 |
animPos = 1 |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
335 |
stopCinemaLock() |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
336 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
337 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
338 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
339 |
if steps[animPos].args[1] ~= CurrentHedgehog and steps[animPos].func ~= AnimWait |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
340 |
and (steps[animPos].swh == nil or steps[animPos].swh == true) then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
341 |
AnimSwitchHog(steps[animPos].args[1]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
342 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
343 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
344 |
startCinemaLock() |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
345 |
local retVal = steps[animPos].func(unpack(steps[animPos].args)) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
346 |
if (retVal ~= false) then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
347 |
animPos = animPos + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
348 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
349 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
350 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
351 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
352 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
353 |
------------------------------Event Handling------------------------------ |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
354 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
355 |
function AddEvent(condFunc, condArgs, doFunc, doArgs, evType) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
356 |
seNum = seNum + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
357 |
stageEvents[seNum] = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
358 |
stageEvents[seNum].cFunc = condFunc |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
359 |
stageEvents[seNum].cArgs = condArgs |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
360 |
stageEvents[seNum].dFunc = doFunc |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
361 |
stageEvents[seNum].dArgs = doArgs |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
362 |
stageEvents[seNum].evType = evType |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
363 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
364 |
|
7263
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
365 |
function AddNewEvent(condFunc, condArgs, doFunc, doArgs, evType) |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
366 |
local i |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
367 |
for i = 1, seNum do |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
368 |
if stageEvents[i].cFunc == condFunc and stageEvents[i].cArgs == condArgs and |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
369 |
stageEvents[i].dFunc == doFunc and stageEvents[i].dArgs == doArgs and |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
370 |
stageEvents[seNum].evType == evType then |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
371 |
return |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
372 |
end |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
373 |
end |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
374 |
AddEvent(condFunc, condArgs, doFunc, doArgs, evType) |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
375 |
end |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
376 |
|
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
377 |
function RemoveEvent(evNum) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
378 |
if stageEvents[evNum] ~= nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
379 |
seNum = seNum - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
380 |
table.remove(stageEvents, evNum) |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
381 |
if evNum < curEvent then |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
382 |
return true |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
383 |
end |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
384 |
end |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
385 |
if evNum < curEvent then |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
386 |
needToDecrease = needToDecrease + 1 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
387 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
388 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
389 |
|
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
390 |
function RemoveEventFunc(cFunc, cArgs) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
391 |
local i = 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
392 |
while i <= seNum do |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
393 |
if stageEvents[i].cFunc == cFunc and (cArgs == nil or cArgs == stageEvents[i].cArgs) then |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
394 |
RemoveEvent(i) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
395 |
i = i - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
396 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
397 |
i = i + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
398 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
399 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
400 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
401 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
402 |
function CheckEvents() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
403 |
local i = 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
404 |
while i <= seNum do |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
405 |
curEvent = i |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
406 |
if stageEvents[i].cFunc(unpack(stageEvents[i].cArgs)) then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
407 |
stageEvents[i].dFunc(unpack(stageEvents[i].dArgs)) |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
408 |
if needToDecrease > 0 then |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
409 |
i = i - needToDecrease |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
410 |
needToDecrease = 0 |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
411 |
end |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
412 |
if stageEvents[i].evType ~= 1 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
413 |
RemoveEvent(i) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
414 |
i = i - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
415 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
416 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
417 |
i = i + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
418 |
end |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
419 |
curEvent = 0 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
420 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
421 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
422 |
-------------------------------------Misc--------------------------------- |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
423 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
424 |
function StoppedGear(gear) |
13032
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
425 |
-- GetHealth returns nil if gear does not exist |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
426 |
if not GetHealth(gear) then |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
427 |
-- We consider the gear to be “stopped” if it has been destroyed |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
428 |
return true |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
429 |
end |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
430 |
local dx,dy = GetGearVelocity(gear) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
431 |
return math.abs(dx) <= 1 and math.abs(dy) <= 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
432 |
end |