#48 Localize add_entity

This commit is contained in:
kay27 2021-12-10 03:55:45 +04:00
parent 06b482b309
commit d9cec19d62
1 changed files with 4 additions and 3 deletions

View File

@ -19,6 +19,7 @@ local set_node = minetest.set_node
local sound_play = minetest.sound_play local sound_play = minetest.sound_play
local add_particlespawner = minetest.add_particlespawner local add_particlespawner = minetest.add_particlespawner
local after = minetest.after local after = minetest.after
local add_entity = minetest.add_entity
local get_objects_inside_radius = minetest.get_objects_inside_radius local get_objects_inside_radius = minetest.get_objects_inside_radius
local get_item_group = minetest.get_item_group local get_item_group = minetest.get_item_group
@ -206,18 +207,18 @@ lightning.register_on_strike(function(pos, pos2, objects)
if get_node(pos2).name == "air" then if get_node(pos2).name == "air" then
-- Low chance for a lightning to spawn skeleton horse + skeletons -- Low chance for a lightning to spawn skeleton horse + skeletons
if skeleton_lightning then if skeleton_lightning then
minetest.add_entity(pos2, "mobs_mc:skeleton_horse") add_entity(pos2, "mobs_mc:skeleton_horse")
local angle, posadd local angle, posadd
angle = math.random(0, math.pi*2) angle = math.random(0, math.pi*2)
for i=1,3 do for i=1,3 do
posadd = { x=math.cos(angle),y=0,z=math.sin(angle) } posadd = { x=math.cos(angle),y=0,z=math.sin(angle) }
posadd = vector.normalize(posadd) posadd = vector.normalize(posadd)
local mob = minetest.add_entity(vector.add(pos2, posadd), "mobs_mc:skeleton") local mob = add_entity(vector.add(pos2, posadd), "mobs_mc:skeleton")
if mob then if mob then
mob:set_yaw(angle-math.pi/2) mob:set_yaw(angle-math.pi/2)
angle = angle + (math.pi*2) / 3
end end
angle = angle + (math.pi*2) / 3
end end
-- Cause a fire -- Cause a fire