-
Notifications
You must be signed in to change notification settings - Fork 2
/
handle_pvp_functions.lua
52 lines (47 loc) · 2.08 KB
/
handle_pvp_functions.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
function handle_pvp(aI, vI)
if gGlobalSyncTable.gamemode == TAG then
tag_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == FREEZE_TAG then
freeze_tag_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == INFECTION then
infection_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == HOT_POTATO then
hot_potato_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == JUGGERNAUT then
juggernaut_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == ASSASSINS then
assassins_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == SARDINES then
sardines_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == HUNT then
hunt_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == DEATHMATCH then
deathmatch_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == TERMINATOR then
terminator_handle_pvp(aI, vI)
elseif gGlobalSyncTable.gamemode == ODDBALL then
oddball_handle_pvp(aI, vI)
end
end
-- handle projectile pvp
---@param aI integer
---@param vI integer
---@param o Object|nil
function handle_projectile_pvp(aI, vI, o)
-- don't allow spectators to attack players, vice versa
if gPlayerSyncTable[aI].state == SPECTATOR or gPlayerSyncTable[aI].state == SPECTATOR then return end
-- if friendly fire isn't enabled, check runners and taggers
if not friendly_fire_enabled() then
-- check if 2 runners are trying to attack eachother
if gPlayerSyncTable[vI].state == RUNNER and gPlayerSyncTable[aI].state == RUNNER then return end
-- check if 2 taggers are trying to attack eachother
if gPlayerSyncTable[vI].state == TAGGER and gPlayerSyncTable[aI].state == TAGGER
and gGlobalSyncTable.gamemode ~= ASSASSINS and gGlobalSyncTable.gamemode ~= DEATHMATCH then return end
end
-- if we get this far, make mario take kb if o is specified, and if mario's invinc timer is 0
if gPlayerSyncTable[vI].invincTimer <= 0
and o ~= nil then
take_damage_and_knock_back(gMarioStates[vI], o)
end
handle_pvp(aI, vI)
end