-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathz-moveset.lua
148 lines (132 loc) · 6.33 KB
/
z-moveset.lua
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
if incompatibleClient then return 0 end
local function find_character_number(index)
if index == nil then index = 0 end
for i = 1, #characterTable do
if characterTable[i].saveName == gCSPlayers[index].saveName then
return i
end
end
return 1
end
local function mario_update(m)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_MARIO_UPDATE
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
end
hook_event(HOOK_MARIO_UPDATE, mario_update)
local function before_mario_update(m)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_BEFORE_MARIO_UPDATE
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
end
hook_event(HOOK_BEFORE_MARIO_UPDATE, before_mario_update)
local function before_phys_step(m, stepType)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_BEFORE_PHYS_STEP
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, stepType)
end
hook_event(HOOK_BEFORE_PHYS_STEP, before_phys_step)
local function allow_pvp_attack(attacker, victim, int)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_PVP_ATTACK
local attackerMoveset = characterMovesets[find_character_number(attacker.playerIndex)]
local victimMoveset = characterMovesets[find_character_number(victim.playerIndex)]
if (attackerMoveset ~= nil and attackerMoveset[hook] ~= nil) then
attackerMoveset[hook](attacker, victim, int)
end
if (victimMoveset ~= nil and victimMoveset[hook] ~= nil) then
victimMoveset[hook](attacker, victim, int)
end
end
hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp_attack)
local function on_pvp_attack(attacker, victim, int)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_PVP_ATTACK
local attackerMoveset = characterMovesets[find_character_number(attacker.playerIndex)]
local victimMoveset = characterMovesets[find_character_number(victim.playerIndex)]
if (attackerMoveset ~= nil and attackerMoveset[hook] ~= nil) then
attackerMoveset[hook](attacker, victim, int)
end
if (victimMoveset ~= nil and victimMoveset[hook] ~= nil) then
victimMoveset[hook](attacker, victim, int)
end
end
hook_event(HOOK_ON_PVP_ATTACK, on_pvp_attack)
local function on_interact(m, o, intType, intValue)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_INTERACT
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, o, intType, intValue)
end
hook_event(HOOK_ON_INTERACT, on_interact)
local function allow_interact(m, o, intType)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_INTERACT
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, o, intType)
end
hook_event(HOOK_ALLOW_INTERACT, allow_interact)
local function on_set_mario_action(m)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_SET_MARIO_ACTION
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
end
hook_event(HOOK_ON_SET_MARIO_ACTION, on_set_mario_action)
local function before_set_mario_action(m, nextAct)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_BEFORE_SET_MARIO_ACTION
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, nextAct)
end
hook_event(HOOK_BEFORE_SET_MARIO_ACTION, before_set_mario_action)
local function on_death(m)
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_BEFORE_SET_MARIO_ACTION
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
end
hook_event(HOOK_ON_DEATH, on_death)
local function hud_render()
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_HUD_RENDER
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
end
hook_event(HOOK_ON_HUD_RENDER, hud_render)
local function hud_render_behind()
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_HUD_RENDER_BEHIND
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
end
hook_event(HOOK_ON_HUD_RENDER_BEHIND, hud_render_behind)
local function level_init()
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_LEVEL_INIT
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
end
hook_event(HOOK_ON_LEVEL_INIT, level_init)
local function sync_valid()
if stopMovesets or optionTable[optionTableRef.localMoveset].toggle == 0 then return end
local hook = HOOK_ON_SYNC_VALID
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
end
hook_event(HOOK_ON_SYNC_VALID, sync_valid)