diff --git a/mods/arena/arena-player.lua b/mods/arena/arena-player.lua index 9ace5ce9f..b508a3233 100644 --- a/mods/arena/arena-player.lua +++ b/mods/arena/arena-player.lua @@ -108,41 +108,46 @@ function mario_local_hammer_check(m) local m2 = gMarioStates[i] local np2 = gNetworkPlayers[i] local s2 = gPlayerSyncTable[i] - 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) - if dist <= 165 then - local yOffset = 100 - if m2.action == ACT_JUMP_KICK then - yOffset = yOffset + 100 - end + 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) + if dist <= 165 then + local yOffset = 100 + if m2.action == ACT_JUMP_KICK then + yOffset = yOffset + 100 + end - local vel = { - x = m.pos.x - m2.pos.x, - y = (m.pos.y + yOffset) - m2.pos.y, - z = m.pos.z - m2.pos.z, - } - vec3f_normalize(vel) - vec3f_mul(vel, 75 + 70 * (1 - mario_health_float(m))) + local vel = { + x = m.pos.x - m2.pos.x, + y = (m.pos.y + yOffset) - m2.pos.y, + z = m.pos.z - m2.pos.z, + } + vec3f_normalize(vel) + vec3f_mul(vel, 75 + 70 * (1 - mario_health_float(m))) - set_mario_action(m, ACT_BACKWARD_AIR_KB, 0) - m.invincTimer = 30 - m.knockbackTimer = 10 - m.vel.x = vel.x - m.vel.y = vel.y - m.vel.z = vel.z - m.faceAngle.y = atan2s(vel.z, vel.x) + 0x8000 - s2.ammo = s2.ammo - 1 + network_player_local_restore_lag_state() + set_mario_action(m, ACT_BACKWARD_AIR_KB, 0) + m.invincTimer = 30 + m.knockbackTimer = 10 + m.vel.x = vel.x + m.vel.y = vel.y + m.vel.z = vel.z + m.faceAngle.y = atan2s(vel.z, vel.x) + 0x8000 + s2.ammo = s2.ammo - 1 - send_arena_hammer_hit(np.globalIndex, np2.globalIndex) - e.lastDamagedByGlobal = np2.globalIndex + send_arena_hammer_hit(np.globalIndex, np2.globalIndex) + e.lastDamagedByGlobal = np2.globalIndex - if m2.action == ACT_PUNCHING or m2.action == ACT_MOVE_PUNCHING or m2.action == ACT_GROUND_POUND then - m.hurtCounter = 12 - else - m.hurtCounter = 8 + if m2.action == ACT_PUNCHING or m2.action == ACT_MOVE_PUNCHING or m2.action == ACT_GROUND_POUND then + m.hurtCounter = 12 + else + m.hurtCounter = 8 + end end end + network_player_local_restore_lag_state() end end diff --git a/mods/arena/arena-proj-bobomb.lua b/mods/arena/arena-proj-bobomb.lua index a8b484e3f..28a9c24cf 100644 --- a/mods/arena/arena-proj-bobomb.lua +++ b/mods/arena/arena-proj-bobomb.lua @@ -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) diff --git a/mods/arena/arena-proj-cannon-ball.lua b/mods/arena/arena-proj-cannon-ball.lua index 060c0a33f..371d838fb 100644 --- a/mods/arena/arena-proj-cannon-ball.lua +++ b/mods/arena/arena-proj-cannon-ball.lua @@ -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)