mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-07-02 16:30:42 +02:00
Optimize code and modernize API calls
* Remove is_connected() and use minetest counterpart * Less calls to minetest.get_connected_players() * Deprecated: get_player_velocity * Luacheck: unused assignements * Luacheck: unused variable * Luacheck: already declared variable --------- Co-authored-by: mazes 80 <>
This commit is contained in:
@ -43,7 +43,7 @@ local function check_hit(player, ray)
|
||||
)
|
||||
origin = vector.add(origin, windpos)
|
||||
end
|
||||
local ray = minetest.raycast(origin, ppos)
|
||||
ray = minetest.raycast(origin, ppos)
|
||||
local obj = ray:next()
|
||||
-- found nothing
|
||||
if obj == nil then return false end
|
||||
|
@ -165,7 +165,7 @@ local function parse_config(player, particles)
|
||||
|
||||
-- correct spawn coordinates to adjust for player movement
|
||||
if config.adjust_for_velocity then
|
||||
local velocity = player:get_player_velocity()
|
||||
local velocity = player:get_velocity()
|
||||
config.minpos = vector.add(config.minpos, velocity)
|
||||
config.maxpos = vector.add(config.maxpos, velocity)
|
||||
end
|
||||
@ -212,4 +212,4 @@ local function handle_effect(player_data)
|
||||
end
|
||||
|
||||
climate_api.register_effect(EFFECT_NAME, handle_effect, "tick")
|
||||
climate_api.set_effect_cycle(EFFECT_NAME, CYCLE_LENGTH)
|
||||
climate_api.set_effect_cycle(EFFECT_NAME, CYCLE_LENGTH)
|
||||
|
Reference in New Issue
Block a user