mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Added lag compensation to Arena
This commit is contained in:
parent
01b2cc2997
commit
37862cf6d5
3 changed files with 49 additions and 31 deletions
|
|
@ -108,6 +108,8 @@ function mario_local_hammer_check(m)
|
|||
local m2 = gMarioStates[i]
|
||||
local np2 = gNetworkPlayers[i]
|
||||
local s2 = gPlayerSyncTable[i]
|
||||
if passes_pvp_interaction_checks(m2, m) ~= 0 then
|
||||
network_player_local_set_lag_state(np2)
|
||||
if s2.item == ITEM_HAMMER and mario_hammer_is_attack(m2.action) and passes_pvp_interaction_checks(m2, m) ~= 0 and global_index_hurts_mario_state(np2.globalIndex, m) then
|
||||
local pos = mario_hammer_position(m2)
|
||||
local dist = vec3f_dist(pos, m.pos)
|
||||
|
|
@ -125,6 +127,7 @@ function mario_local_hammer_check(m)
|
|||
vec3f_normalize(vel)
|
||||
vec3f_mul(vel, 75 + 70 * (1 - mario_health_float(m)))
|
||||
|
||||
network_player_local_restore_lag_state()
|
||||
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0)
|
||||
m.invincTimer = 30
|
||||
m.knockbackTimer = 10
|
||||
|
|
@ -144,6 +147,8 @@ function mario_local_hammer_check(m)
|
|||
end
|
||||
end
|
||||
end
|
||||
network_player_local_restore_lag_state()
|
||||
end
|
||||
end
|
||||
|
||||
m.knockbackTimer = savedKb
|
||||
|
|
|
|||
|
|
@ -16,9 +16,15 @@ function bhv_arena_bobomb_init(obj)
|
|||
end
|
||||
|
||||
function bhv_arena_bobomb_intersects_player(obj, m, pos, radius)
|
||||
local ownerNp = network_player_from_global_index(obj.oArenaBobombGlobalOwner)
|
||||
network_player_local_set_lag_state(ownerNp)
|
||||
|
||||
local mPos1 = { x = m.pos.x, y = m.pos.y + 50, z = m.pos.z }
|
||||
local mPos2 = { x = m.pos.x, y = m.pos.y + 150, z = m.pos.z }
|
||||
return (vec3f_dist(pos, mPos1) < radius or vec3f_dist(pos, mPos2) < radius)
|
||||
local ret = (vec3f_dist(pos, mPos1) < radius or vec3f_dist(pos, mPos2) < radius)
|
||||
|
||||
network_player_local_restore_lag_state()
|
||||
return ret
|
||||
end
|
||||
|
||||
function bhv_arena_bobomb_expode(obj)
|
||||
|
|
|
|||
|
|
@ -18,11 +18,18 @@ function bhv_arena_cannon_ball_init(obj)
|
|||
end
|
||||
|
||||
function bhv_arena_cannon_ball_intersects_local(obj, pos)
|
||||
|
||||
local ownerNp = network_player_from_global_index(obj.oArenaBobombGlobalOwner)
|
||||
network_player_local_set_lag_state(ownerNp)
|
||||
|
||||
local m = gMarioStates[0]
|
||||
local mPos1 = { x = m.pos.x, y = m.pos.y + 50, z = m.pos.z }
|
||||
local mPos2 = { x = m.pos.x, y = m.pos.y + 150, z = m.pos.z }
|
||||
local radius = clamp(obj.oArenaCannonBallSize * 250, 75, 250)
|
||||
return (vec3f_dist(pos, mPos1) < radius or vec3f_dist(pos, mPos2) < radius)
|
||||
local ret = (vec3f_dist(pos, mPos1) < radius or vec3f_dist(pos, mPos2) < radius)
|
||||
|
||||
network_player_local_restore_lag_state()
|
||||
return ret
|
||||
end
|
||||
|
||||
function bhv_arena_cannon_ball_loop(obj)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue