Fix: crash from get_player_information
parent
c388c1ca5d
commit
7f54d85a06
30
api.lua
30
api.lua
|
@ -223,25 +223,29 @@ end
|
||||||
|
|
||||||
function pvp_revamped.restore_hits(hitdata, name, user)
|
function pvp_revamped.restore_hits(hitdata, name, user)
|
||||||
if hitdata then
|
if hitdata then
|
||||||
local player_lag = get_player_information(name).avg_jitter * 1000000
|
local info = get_player_information(name)
|
||||||
local timeframe = get_us_time() - player_lag
|
|
||||||
|
if info then
|
||||||
|
local player_lag = info.avg_jitter * 1000000
|
||||||
|
local timeframe = get_us_time() - player_lag
|
||||||
|
|
||||||
local count = #hitdata
|
local count = #hitdata
|
||||||
|
|
||||||
for i = count, 1, -1 do
|
for i = count, 1, -1 do
|
||||||
local hd = hitdata[i]
|
local hd = hitdata[i]
|
||||||
|
|
||||||
if hd.time >= timeframe then
|
|
||||||
user:set_hp(user:get_hp() + hd.damage)
|
|
||||||
|
|
||||||
hitdata[i] = hitdata[count]
|
if hd.time >= timeframe then
|
||||||
hitdata[count] = nil
|
user:set_hp(user:get_hp() + hd.damage)
|
||||||
|
|
||||||
|
hitdata[i] = hitdata[count]
|
||||||
|
hitdata[count] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
count = count - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
count = count - 1
|
return hitdata
|
||||||
end
|
end
|
||||||
|
|
||||||
return hitdata
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
486
globalstep.lua
486
globalstep.lua
|
@ -36,283 +36,287 @@ minetest.register_globalstep(function(dtime)
|
||||||
local check_item = check_item_iterate >= check_item_time
|
local check_item = check_item_iterate >= check_item_time
|
||||||
|
|
||||||
for k, v in pairs(player_data) do
|
for k, v in pairs(player_data) do
|
||||||
local player_lag = get_player_information(k).avg_jitter * 1000000
|
local info = get_player_information(k)
|
||||||
local player = get_player_by_name(k)
|
|
||||||
local time = get_us_time()
|
|
||||||
local pp_data = player_persistent_data[k]
|
|
||||||
local active
|
|
||||||
|
|
||||||
if v.block and v.aim then
|
if info then
|
||||||
-- Check if the player is holding down the place key.
|
local player_lag = info.avg_jitter * 1000000
|
||||||
if floor(player:get_player_control_bits() / 256) % 2 == 1 then
|
local player = get_player_by_name(k)
|
||||||
-- Update the block time.
|
local time = get_us_time()
|
||||||
v.block.time = time
|
local pp_data = player_persistent_data[k]
|
||||||
end
|
local active
|
||||||
|
|
||||||
local block = v.block
|
if v.block and v.aim then
|
||||||
local aim = v.aim
|
-- Check if the player is holding down the place key.
|
||||||
-- Hand aims forward.
|
if floor(player:get_player_control_bits() / 256) % 2 == 1 then
|
||||||
player:set_bone_position(aim.bone, aim.position, aim.rotation)
|
-- Update the block time.
|
||||||
|
v.block.time = time
|
||||||
-- Remove the block table if it's past duration.
|
end
|
||||||
-- Or if the guard item is not selected.
|
|
||||||
if block.time + block.duration + player_lag < time or
|
|
||||||
(check_item and player:get_wielded_item():get_name() ~= block.name) then
|
|
||||||
-- Revert the damage texture modifier.
|
|
||||||
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
|
||||||
|
|
||||||
clear_blockdata(v.block, player, k)
|
local block = v.block
|
||||||
end
|
local aim = v.aim
|
||||||
|
-- Hand aims forward.
|
||||||
active = true
|
player:set_bone_position(aim.bone, aim.position, aim.rotation)
|
||||||
elseif not v.block and v.aim then
|
|
||||||
local aim = v.aim
|
|
||||||
-- Drop hand.
|
|
||||||
player:set_bone_position(aim.bone, aim.position, new(-180, 0, 0))
|
|
||||||
|
|
||||||
v.aim = nil
|
|
||||||
active = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.shield and v.entity then
|
|
||||||
-- Check if the player is holding down the place key.
|
|
||||||
if floor(player:get_player_control_bits() / 256) % 2 == 1 then
|
|
||||||
-- Update the shield time.
|
|
||||||
v.shield.time = time
|
|
||||||
end
|
|
||||||
|
|
||||||
local shield = v.shield
|
|
||||||
|
|
||||||
-- Remove the shield table if it's past duration.
|
|
||||||
if shield.time + shield.duration + player_lag < time or
|
|
||||||
(check_item and not shield.armor_inv and player:get_wielded_item():get_name() ~= shield.name) then
|
|
||||||
-- Revert the damage texture modifier.
|
|
||||||
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
|
||||||
|
|
||||||
clear_shielddata(v.shield, player, k)
|
-- Remove the block table if it's past duration.
|
||||||
|
-- Or if the guard item is not selected.
|
||||||
|
if block.time + block.duration + player_lag < time or
|
||||||
|
(check_item and player:get_wielded_item():get_name() ~= block.name) then
|
||||||
|
-- Revert the damage texture modifier.
|
||||||
|
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
||||||
|
|
||||||
|
clear_blockdata(v.block, player, k)
|
||||||
|
end
|
||||||
|
|
||||||
|
active = true
|
||||||
|
elseif not v.block and v.aim then
|
||||||
|
local aim = v.aim
|
||||||
|
-- Drop hand.
|
||||||
|
player:set_bone_position(aim.bone, aim.position, new(-180, 0, 0))
|
||||||
|
|
||||||
|
v.aim = nil
|
||||||
|
active = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local entity = v.entity
|
if v.shield and v.entity then
|
||||||
-- Point arm forward.
|
-- Check if the player is holding down the place key.
|
||||||
player:set_bone_position(entity.bone, entity.position, entity.rotation)
|
if floor(player:get_player_control_bits() / 256) % 2 == 1 then
|
||||||
|
-- Update the shield time.
|
||||||
|
v.shield.time = time
|
||||||
|
end
|
||||||
|
|
||||||
active = true
|
local shield = v.shield
|
||||||
elseif not v.shield and v.entity then
|
|
||||||
local entity = v.entity
|
|
||||||
-- Drop arms.
|
|
||||||
player:set_bone_position(entity.bone, entity.position, new(-180, 0, 0))
|
|
||||||
|
|
||||||
v.entity.object:remove()
|
-- Remove the shield table if it's past duration.
|
||||||
v.entity = nil
|
if shield.time + shield.duration + player_lag < time or
|
||||||
active = true
|
(check_item and not shield.armor_inv and player:get_wielded_item():get_name() ~= shield.name) then
|
||||||
end
|
-- Revert the damage texture modifier.
|
||||||
|
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
||||||
|
|
||||||
|
clear_shielddata(v.shield, player, k)
|
||||||
|
end
|
||||||
|
|
||||||
if v.throw then
|
local entity = v.entity
|
||||||
local control_bits = player:get_player_control_bits()
|
-- Point arm forward.
|
||||||
local throw_data = v.throw
|
player:set_bone_position(entity.bone, entity.position, entity.rotation)
|
||||||
local tool_capabilities = throw_data.tool_capabilities
|
|
||||||
local full_throw = throw_data.time + tool_capabilities.full_throw
|
active = true
|
||||||
|
elseif not v.shield and v.entity then
|
||||||
-- If neither dig or place is down then throw the item.
|
local entity = v.entity
|
||||||
if (floor(control_bits / 128) % 2 ~= 1 and
|
-- Drop arms.
|
||||||
floor(control_bits / 256) % 2 ~= 1 and
|
player:set_bone_position(entity.bone, entity.position, new(-180, 0, 0))
|
||||||
floor(control_bits / 512) % 2 ~= 1 and
|
|
||||||
floor(control_bits / 32) % 2 ~= 1) or
|
v.entity.object:remove()
|
||||||
pp_data.active_dodges or
|
v.entity = nil
|
||||||
pp_data.active_barrel_rolls then
|
active = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if v.throw then
|
||||||
|
local control_bits = player:get_player_control_bits()
|
||||||
|
local throw_data = v.throw
|
||||||
|
local tool_capabilities = throw_data.tool_capabilities
|
||||||
|
local full_throw = throw_data.time + tool_capabilities.full_throw
|
||||||
|
|
||||||
local pos = player:get_pos()
|
-- If neither dig or place is down then throw the item.
|
||||||
|
if (floor(control_bits / 128) % 2 ~= 1 and
|
||||||
|
floor(control_bits / 256) % 2 ~= 1 and
|
||||||
|
floor(control_bits / 512) % 2 ~= 1 and
|
||||||
|
floor(control_bits / 32) % 2 ~= 1) or
|
||||||
|
pp_data.active_dodges or
|
||||||
|
pp_data.active_barrel_rolls then
|
||||||
|
|
||||||
|
local pos = player:get_pos()
|
||||||
|
|
||||||
pos.y = pos.y + player:get_properties().eye_height
|
pos.y = pos.y + player:get_properties().eye_height
|
||||||
|
|
||||||
local obj = add_entity(pos, "pvp_revamped:projectile")
|
local obj = add_entity(pos, "pvp_revamped:projectile")
|
||||||
|
|
||||||
if obj then
|
if obj then
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
|
|
||||||
if ent then
|
if ent then
|
||||||
local throw_style = pp_data.throw_style
|
local throw_style = pp_data.throw_style
|
||||||
local throw_speed = tool_capabilities.throw_speed
|
local throw_speed = tool_capabilities.throw_speed
|
||||||
local damage = tool_capabilities.damage_groups.fleshy
|
local damage = tool_capabilities.damage_groups.fleshy
|
||||||
local projectile_gravity = tool_capabilities.projectile_gravity or projectile_gravity
|
local projectile_gravity = tool_capabilities.projectile_gravity or projectile_gravity
|
||||||
local gravity = projectile_gravity
|
local gravity = projectile_gravity
|
||||||
local projectile_dmg_mul = tool_capabilities.projectile_dmg_mul or projectile_dmg_mul
|
local projectile_dmg_mul = tool_capabilities.projectile_dmg_mul or projectile_dmg_mul
|
||||||
local projectile_spinning_gravity_mul = tool_capabilities.projectile_spinning_gravity_mul or projectile_spinning_gravity_mul
|
local projectile_spinning_gravity_mul = tool_capabilities.projectile_spinning_gravity_mul or projectile_spinning_gravity_mul
|
||||||
local projectile_dip_gravity_mul = tool_capabilities.projectile_dip_gravity_mul or projectile_dip_gravity_mul
|
local projectile_dip_gravity_mul = tool_capabilities.projectile_dip_gravity_mul or projectile_dip_gravity_mul
|
||||||
local spin
|
local spin
|
||||||
|
|
||||||
if not throw_data.ready then
|
if not throw_data.ready then
|
||||||
local projectile_half_throw_mul = tool_capabilities.projectile_half_throw_mul or projectile_half_throw_mul
|
local projectile_half_throw_mul = tool_capabilities.projectile_half_throw_mul or projectile_half_throw_mul
|
||||||
local re = (full_throw - time) * projectile_half_throw_mul
|
local re = (full_throw - time) * projectile_half_throw_mul
|
||||||
|
|
||||||
if re > 0.5 then
|
if re > 0.5 then
|
||||||
damage = damage - re
|
damage = damage - re
|
||||||
throw_speed = throw_speed - re
|
throw_speed = throw_speed - re
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if throw_style == projectile_throw_style_spinning then
|
if throw_style == projectile_throw_style_spinning then
|
||||||
spin = throw_speed
|
spin = throw_speed
|
||||||
gravity = gravity * projectile_spinning_gravity_mul
|
gravity = gravity * projectile_spinning_gravity_mul
|
||||||
elseif throw_style == projectile_throw_style_dip then
|
elseif throw_style == projectile_throw_style_dip then
|
||||||
gravity = gravity * projectile_dip_gravity_mul
|
gravity = gravity * projectile_dip_gravity_mul
|
||||||
|
end
|
||||||
|
|
||||||
|
ent:set_item(k, throw_data.item)
|
||||||
|
ent:throw(player, throw_speed, {x = 0, y = gravity, z = 0}, max(damage * projectile_dmg_mul, 1), throw_style, spin)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
ent:set_item(k, throw_data.item)
|
|
||||||
ent:throw(player, throw_speed, {x = 0, y = gravity, z = 0}, max(damage * projectile_dmg_mul, 1), throw_style, spin)
|
-- Remove throwing hud.
|
||||||
|
remove_text_center(player, "pvp_revamped:throw_item")
|
||||||
|
|
||||||
|
v.throw = nil
|
||||||
|
elseif not throw_data.ready and full_throw < time + player_lag then
|
||||||
|
-- To prevent changing the hud repeatedly.
|
||||||
|
v.throw.ready = true
|
||||||
|
|
||||||
|
create_hud_text_center(player, "pvp_revamped:throw_item", "READY")
|
||||||
|
end
|
||||||
|
|
||||||
|
active = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if v.immobilize then
|
||||||
|
local immobilize = v.immobilize
|
||||||
|
|
||||||
|
-- Check if the immobilize duration expired.
|
||||||
|
if immobilize.time + immobilize.value + player_lag < time then
|
||||||
|
-- Restore the player's physics.
|
||||||
|
get_player_by_name(k):set_physics_override({speed = 1, jump = 1})
|
||||||
|
v.immobilize = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
active = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if v.barrel_roll then
|
||||||
|
local active_barrel_rolls = nil
|
||||||
|
|
||||||
|
-- Process the player's barrel_roll table cooldown.
|
||||||
|
for j, l in pairs(v.barrel_roll) do
|
||||||
|
-- Find if it's aerial or not.
|
||||||
|
if j > 4 and l.time + barrel_roll_aerial_cooldown + player_lag < time then
|
||||||
|
v.barrel_roll[j] = nil
|
||||||
|
elseif j < 5 and l.time + barrel_roll_cooldown + player_lag < time then
|
||||||
|
v.barrel_roll[j] = nil
|
||||||
|
elseif l.time + barrel_roll_duration + player_lag > time then
|
||||||
|
local re_x, re_z = rotate_point(player:get_look_horizontal(), l.x, l.z)
|
||||||
|
|
||||||
|
player:add_player_velocity({x = re_x, y = 0, z = re_z})
|
||||||
|
active_barrel_rolls = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove throwing hud.
|
if not active_barrel_rolls and player:get_properties().damage_texture_modifier == "" then
|
||||||
remove_text_center(player, "pvp_revamped:throw_item")
|
-- Revert the damage texture modifier.
|
||||||
|
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
||||||
v.throw = nil
|
|
||||||
elseif not throw_data.ready and full_throw < time + player_lag then
|
|
||||||
-- To prevent changing the hud repeatedly.
|
|
||||||
v.throw.ready = true
|
|
||||||
|
|
||||||
create_hud_text_center(player, "pvp_revamped:throw_item", "READY")
|
|
||||||
end
|
|
||||||
|
|
||||||
active = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.immobilize then
|
|
||||||
local immobilize = v.immobilize
|
|
||||||
|
|
||||||
-- Check if the immobilize duration expired.
|
|
||||||
if immobilize.time + immobilize.value + player_lag < time then
|
|
||||||
-- Restore the player's physics.
|
|
||||||
get_player_by_name(k):set_physics_override({speed = 1, jump = 1})
|
|
||||||
v.immobilize = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
active = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.barrel_roll then
|
|
||||||
local active_barrel_rolls = nil
|
|
||||||
|
|
||||||
-- Process the player's barrel_roll table cooldown.
|
|
||||||
for j, l in pairs(v.barrel_roll) do
|
|
||||||
-- Find if it's aerial or not.
|
|
||||||
if j > 4 and l.time + barrel_roll_aerial_cooldown + player_lag < time then
|
|
||||||
v.barrel_roll[j] = nil
|
|
||||||
elseif j < 5 and l.time + barrel_roll_cooldown + player_lag < time then
|
|
||||||
v.barrel_roll[j] = nil
|
|
||||||
elseif l.time + barrel_roll_duration + player_lag > time then
|
|
||||||
local re_x, re_z = rotate_point(player:get_look_horizontal(), l.x, l.z)
|
|
||||||
|
|
||||||
player:add_player_velocity({x = re_x, y = 0, z = re_z})
|
|
||||||
active_barrel_rolls = true
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if not active_barrel_rolls and player:get_properties().damage_texture_modifier == "" then
|
-- Store the barrel_roll amount for later use.
|
||||||
-- Revert the damage texture modifier.
|
player_persistent_data[k].active_barrel_rolls = active_barrel_rolls
|
||||||
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Store the barrel_roll amount for later use.
|
-- If this table contains no more barrel_rolls remove it.
|
||||||
player_persistent_data[k].active_barrel_rolls = active_barrel_rolls
|
if maxn(v.barrel_roll) < 1 then
|
||||||
|
v.barrel_roll = nil
|
||||||
-- If this table contains no more barrel_rolls remove it.
|
|
||||||
if maxn(v.barrel_roll) < 1 then
|
|
||||||
v.barrel_roll = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove un-used barrel roll text.
|
|
||||||
if not active_barrel_rolls then
|
|
||||||
remove_text_center(player, "pvp_revamped:barrel_roll")
|
|
||||||
end
|
|
||||||
|
|
||||||
active = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.dodge then
|
|
||||||
local active_dodges = nil
|
|
||||||
|
|
||||||
-- Process the player's dodge table cooldown.
|
|
||||||
for j, l in pairs(v.dodge) do
|
|
||||||
-- Find if it's aerial or not.
|
|
||||||
if j > 4 and l + dodge_aerial_cooldown + player_lag < time then
|
|
||||||
v.dodge[j] = nil
|
|
||||||
elseif j < 5 and l + dodge_cooldown + player_lag < time then
|
|
||||||
v.dodge[j] = nil
|
|
||||||
elseif l + dodge_duration + player_lag > time then
|
|
||||||
active_dodges = true
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if not active_dodges and player:get_properties().damage_texture_modifier == "" then
|
-- Remove un-used barrel roll text.
|
||||||
-- Revert the damage texture modifier.
|
if not active_barrel_rolls then
|
||||||
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
remove_text_center(player, "pvp_revamped:barrel_roll")
|
||||||
end
|
|
||||||
|
|
||||||
-- Store the dodge amount for later use.
|
|
||||||
player_persistent_data[k].active_dodges = active_dodges
|
|
||||||
|
|
||||||
-- If this table contains no more dodges remove it.
|
|
||||||
if maxn(v.dodge) < 1 then
|
|
||||||
v.dodge = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove un-used dodge text.
|
|
||||||
if not active_dodges then
|
|
||||||
remove_text_center(player, "pvp_revamped:dodge")
|
|
||||||
end
|
|
||||||
|
|
||||||
active = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.dash then
|
|
||||||
-- Process the player's dash table cooldown.
|
|
||||||
for j, l in pairs(v.dash) do
|
|
||||||
-- Find if it's aerial or not.
|
|
||||||
if j > 4 and l + dash_aerial_cooldown + player_lag < time then
|
|
||||||
v.dash[j] = nil
|
|
||||||
elseif j < 5 and l + dash_cooldown + player_lag < time then
|
|
||||||
v.dash[j] = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
active = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If this table contains no more dashes remove it.
|
if v.dodge then
|
||||||
if maxn(v.dash) < 1 then
|
local active_dodges = nil
|
||||||
v.dash = nil
|
|
||||||
end
|
-- Process the player's dodge table cooldown.
|
||||||
|
for j, l in pairs(v.dodge) do
|
||||||
active = true
|
-- Find if it's aerial or not.
|
||||||
end
|
if j > 4 and l + dodge_aerial_cooldown + player_lag < time then
|
||||||
|
v.dodge[j] = nil
|
||||||
if v.hit then
|
elseif j < 5 and l + dodge_cooldown + player_lag < time then
|
||||||
local hit_data = v.hit
|
v.dodge[j] = nil
|
||||||
local count = #hit_data
|
elseif l + dodge_duration + player_lag > time then
|
||||||
|
active_dodges = true
|
||||||
for i = count, 1, -1 do
|
end
|
||||||
local data = hit_data[i]
|
|
||||||
|
|
||||||
if data.time + clash_duration + player_lag < time then
|
|
||||||
hit_data[i] = hit_data[count]
|
|
||||||
hit_data[count] = nil
|
|
||||||
|
|
||||||
count = count - 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not active_dodges and player:get_properties().damage_texture_modifier == "" then
|
||||||
|
-- Revert the damage texture modifier.
|
||||||
|
player:set_properties{damage_texture_modifier = pp_data.damage_texture_modifier}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Store the dodge amount for later use.
|
||||||
|
player_persistent_data[k].active_dodges = active_dodges
|
||||||
|
|
||||||
|
-- If this table contains no more dodges remove it.
|
||||||
|
if maxn(v.dodge) < 1 then
|
||||||
|
v.dodge = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove un-used dodge text.
|
||||||
|
if not active_dodges then
|
||||||
|
remove_text_center(player, "pvp_revamped:dodge")
|
||||||
|
end
|
||||||
|
|
||||||
|
active = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If this table contains no more hits remove it.
|
if v.dash then
|
||||||
if maxn(hit_data) < 1 then
|
-- Process the player's dash table cooldown.
|
||||||
v.hit = nil
|
for j, l in pairs(v.dash) do
|
||||||
|
-- Find if it's aerial or not.
|
||||||
|
if j > 4 and l + dash_aerial_cooldown + player_lag < time then
|
||||||
|
v.dash[j] = nil
|
||||||
|
elseif j < 5 and l + dash_cooldown + player_lag < time then
|
||||||
|
v.dash[j] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If this table contains no more dashes remove it.
|
||||||
|
if maxn(v.dash) < 1 then
|
||||||
|
v.dash = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
active = true
|
||||||
end
|
end
|
||||||
|
|
||||||
active = true
|
if v.hit then
|
||||||
end
|
local hit_data = v.hit
|
||||||
|
local count = #hit_data
|
||||||
|
|
||||||
if not active then
|
for i = count, 1, -1 do
|
||||||
-- Just in case there is still guard pool stuff on screen.
|
local data = hit_data[i]
|
||||||
remove_text_center(player, "pvp_revamped:block_pool")
|
|
||||||
remove_text_center(player, "pvp_revamped:shield_pool")
|
|
||||||
|
|
||||||
player_data[k] = nil
|
if data.time + clash_duration + player_lag < time then
|
||||||
|
hit_data[i] = hit_data[count]
|
||||||
|
hit_data[count] = nil
|
||||||
|
|
||||||
|
count = count - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If this table contains no more hits remove it.
|
||||||
|
if maxn(hit_data) < 1 then
|
||||||
|
v.hit = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
active = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if not active then
|
||||||
|
-- Just in case there is still guard pool stuff on screen.
|
||||||
|
remove_text_center(player, "pvp_revamped:block_pool")
|
||||||
|
remove_text_center(player, "pvp_revamped:shield_pool")
|
||||||
|
|
||||||
|
player_data[k] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
local get_player_information = minetest.get_player_information
|
|
||||||
local projectile_full_throw_mul = pvp_revamped.config.projectile_full_throw_mul
|
local projectile_full_throw_mul = pvp_revamped.config.projectile_full_throw_mul
|
||||||
local projectile_speed_mul = pvp_revamped.config.projectile_speed_mul
|
local projectile_speed_mul = pvp_revamped.config.projectile_speed_mul
|
||||||
local spam_damage = pvp_revamped.config.spam_damage
|
local spam_damage = pvp_revamped.config.spam_damage
|
||||||
|
|
15
punch.lua
15
punch.lua
|
@ -130,7 +130,12 @@ local function punch(player, hitter, time_from_last_punch, tool_capabilities, di
|
||||||
range = item.range
|
range = item.range
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_lag = get_player_information(name).avg_jitter
|
local info = get_player_information(name)
|
||||||
|
local player_lag = 0
|
||||||
|
|
||||||
|
if info then
|
||||||
|
player_lag = info.avg_jitter
|
||||||
|
end
|
||||||
|
|
||||||
-- Get whether this is a full punch.
|
-- Get whether this is a full punch.
|
||||||
if tool_capabilities and time_from_last_punch >= tool_capabilities.full_punch_interval - player_lag then
|
if tool_capabilities and time_from_last_punch >= tool_capabilities.full_punch_interval - player_lag then
|
||||||
|
@ -663,7 +668,13 @@ local function punch(player, hitter, time_from_last_punch, tool_capabilities, di
|
||||||
end
|
end
|
||||||
|
|
||||||
if hitter_hitdata then
|
if hitter_hitdata then
|
||||||
player_lag = get_player_information(hitter_name).avg_jitter * 1000000
|
info = get_player_information(hitter_name)
|
||||||
|
player_lag = 0
|
||||||
|
|
||||||
|
if info then
|
||||||
|
player_lag = info.avg_jitter * 1000000
|
||||||
|
end
|
||||||
|
|
||||||
local count = #hitter_hitdata
|
local count = #hitter_hitdata
|
||||||
|
|
||||||
for i = count, 1, -1 do
|
for i = count, 1, -1 do
|
||||||
|
|
Loading…
Reference in New Issue