Make some global vars local
This commit is contained in:
parent
bbd1e97314
commit
74439d6f54
@ -123,7 +123,7 @@ minetest.register_node(
|
||||
end,
|
||||
})
|
||||
|
||||
function swap_node(pos, name)
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
|
@ -1358,7 +1358,7 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
|
||||
end
|
||||
|
||||
-- particle effects
|
||||
function effect(pos, amount, texture, max_size)
|
||||
local function effect(pos, amount, texture, max_size)
|
||||
minetest.add_particlespawner(
|
||||
{
|
||||
amount = amount,
|
||||
@ -1378,7 +1378,7 @@ function effect(pos, amount, texture, max_size)
|
||||
end
|
||||
|
||||
-- on mob death drop items
|
||||
function check_for_death(self, hitter)
|
||||
local function check_for_death(self, hitter)
|
||||
local hp = self.object:get_hp()
|
||||
if hp > 0 then
|
||||
self.health = hp
|
||||
@ -1423,7 +1423,7 @@ function check_for_death(self, hitter)
|
||||
end
|
||||
|
||||
-- from TNT mod
|
||||
function calc_velocity(pos1, pos2, old_vel, power)
|
||||
local function calc_velocity(pos1, pos2, old_vel, power)
|
||||
local vel = vector.direction(pos1, pos2)
|
||||
vel = vector.normalize(vel)
|
||||
vel = vector.multiply(vel, power)
|
||||
@ -1435,7 +1435,7 @@ function calc_velocity(pos1, pos2, old_vel, power)
|
||||
end
|
||||
|
||||
-- modified from TNT mod
|
||||
function entity_physics(pos, radius)
|
||||
local function entity_physics(pos, radius)
|
||||
radius = radius * 2
|
||||
local objs = minetest.get_objects_inside_radius(pos, radius)
|
||||
local obj_pos, obj_vel, dist
|
||||
|
@ -120,7 +120,7 @@ if minetest.settings:get_bool("music_enable") then
|
||||
groups = {oddly_breakable_by_hand = 3}
|
||||
})
|
||||
|
||||
function step(dtime)
|
||||
local function step(dtime)
|
||||
for dp, _ in pairs(music.players) do
|
||||
music.players[dp]["timer"] = music.players[dp]["timer"] + dtime
|
||||
|
||||
|
@ -7,7 +7,7 @@ local S = minetest.get_translator("nav")
|
||||
local wield_image_0 = "nav_compass_inventory_0.png"
|
||||
local wield_image_1 = "nav_compass_inventory_1.png"
|
||||
|
||||
function on_globalstep(dtime)
|
||||
local function on_globalstep(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
local S = minetest.get_translator("parachute")
|
||||
|
||||
function air_physics(v)
|
||||
local function air_physics(v)
|
||||
local m = 80 -- Weight of player, kg
|
||||
local g = -9.81 -- Earth Acceleration, m/s^2
|
||||
local cw = 1.25 -- Drag coefficient
|
||||
|
@ -61,7 +61,7 @@ local function play_sound()
|
||||
minetest.after(3, play_sound)
|
||||
end
|
||||
|
||||
function setweather_type(type)
|
||||
local function setweather_type(type)
|
||||
local valid = false
|
||||
for i = 1, #weather.types do
|
||||
if weather.types[i] == type then
|
||||
|
Loading…
Reference in New Issue
Block a user