Fix: crash from get_player_information
This commit is contained in:
parent
c388c1ca5d
commit
7f54d85a06
6
api.lua
6
api.lua
@ -223,7 +223,10 @@ 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)
|
||||||
|
|
||||||
|
if info then
|
||||||
|
local player_lag = info.avg_jitter * 1000000
|
||||||
local timeframe = get_us_time() - player_lag
|
local timeframe = get_us_time() - player_lag
|
||||||
|
|
||||||
local count = #hitdata
|
local count = #hitdata
|
||||||
@ -243,6 +246,7 @@ function pvp_revamped.restore_hits(hitdata, name, user)
|
|||||||
|
|
||||||
return hitdata
|
return hitdata
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local restore_hits = pvp_revamped.restore_hits
|
local restore_hits = pvp_revamped.restore_hits
|
||||||
|
@ -36,7 +36,10 @@ 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)
|
||||||
|
|
||||||
|
if info then
|
||||||
|
local player_lag = info.avg_jitter * 1000000
|
||||||
local player = get_player_by_name(k)
|
local player = get_player_by_name(k)
|
||||||
local time = get_us_time()
|
local time = get_us_time()
|
||||||
local pp_data = player_persistent_data[k]
|
local pp_data = player_persistent_data[k]
|
||||||
@ -315,6 +318,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
player_data[k] = nil
|
player_data[k] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Reset or add the check item iterater.
|
-- Reset or add the check item iterater.
|
||||||
if check_item then
|
if check_item then
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user