Modernize code: Replace deprecated function calls
This commit is contained in:
parent
3cc3d4dcc5
commit
e60fac47a2
148
api.lua
148
api.lua
@ -60,7 +60,7 @@ function object_attach(entity, player, attach_at, eye_offset)
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(player, "sit" , 30)
|
||||
end)
|
||||
entity.object:setyaw(player:get_look_yaw() - math.pi / 2)
|
||||
entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
||||
end
|
||||
|
||||
function object_detach(entity, player, offset)
|
||||
@ -69,10 +69,10 @@ function object_detach(entity, player, offset)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_animation(player, "stand" , 30)
|
||||
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
|
||||
minetest.after(0.1, function()
|
||||
player:setpos(pos)
|
||||
player:set_pos(pos)
|
||||
end)
|
||||
end
|
||||
-------------------------------------------------------------------------------
|
||||
@ -106,30 +106,30 @@ function object_drive(entity, dtime, speed, shoots, arrow, moving_anim, stand_an
|
||||
local vec_stop = {x=0,y=0,z=0}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
if ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_forward)
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_forward)
|
||||
elseif ctrl.down then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_backward)
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_backward)
|
||||
elseif not ctrl.down or ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_stop)
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_stop)
|
||||
end
|
||||
if ctrl.sneak and ctrl.LMB and shoots then
|
||||
local pos = entity.object:getpos()
|
||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||
local pos = entity.object:get_pos()
|
||||
local obj = minetest.add_entity({x=pos.x+0+dir.x*2,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||
local vec = {x=dir.x*6,y=dir.y*6,z=dir.z*6}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
obj:setyaw(yaw+math.pi/2)
|
||||
obj:setvelocity(vec)
|
||||
obj:set_yaw(yaw+math.pi/2)
|
||||
obj:set_velocity(vec)
|
||||
end
|
||||
--lib_mount animation
|
||||
local velo = entity.object:getvelocity()
|
||||
local velo = entity.object:get_velocity()
|
||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nil and mobs_redo == true then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
entity.object:set_pos(entity.object:get_pos())
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil and mobs_redo == true then
|
||||
@ -138,67 +138,63 @@ function object_drive(entity, dtime, speed, shoots, arrow, moving_anim, stand_an
|
||||
--jumping not working
|
||||
-- local jumps = jumps or false
|
||||
-- if jumps == true and ctrl.jump then
|
||||
-- local xvel = entity.object:getvelocity().x
|
||||
-- local zvel = entity.object:getvelocity().z
|
||||
-- local yvel = entity.object:getvelocity().y
|
||||
-- local vel = {x=xvel,y=10,z=zvel}
|
||||
-- entity.object:setvelocity(vel)
|
||||
-- local vel = entity.object:get_velocity()
|
||||
-- vel.y = 10
|
||||
-- entity.object:set_velocity(vel)
|
||||
-- minetest.after(1.5, function()
|
||||
-- local xvel = entity.object:getvelocity().x
|
||||
-- local zvel = entity.object:getvelocity().z
|
||||
-- local yvel = entity.object:getvelocity().y
|
||||
-- local vel = {x=xvel,y=-10,z=zvel}
|
||||
-- entity.object:setvelocity(vel)
|
||||
-- local vel = entity.object:get_velocity()
|
||||
-- vel.y = -10
|
||||
-- entity.object:set_velocity(vel)
|
||||
-- end)
|
||||
-- end
|
||||
end
|
||||
|
||||
function object_fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local velo = entity.object:getvelocity()
|
||||
local velo = entity.object:get_velocity()
|
||||
local dir = entity.driver:get_look_dir();
|
||||
local vec_forward = {x=dir.x*speed,y=dir.y*speed+2,z=dir.z*speed}
|
||||
local vec_backward = {x=-dir.x*speed,y=dir.y*speed+2,z=-dir.z*speed}
|
||||
local vec_rise = {x=velo.x,y=velo.y+0.2,z=velo.z}
|
||||
local vec_stop = {x=0,y=-0.2,z=0}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
local pos = entity.object:getpos()
|
||||
local pos = entity.object:get_pos()
|
||||
local node = minetest.get_node(pos).name
|
||||
if node == "default:water_source" or node == "default:river_water_source" or node == "default:river_water_flowing" or node == "default:water_flowing" then
|
||||
entity.object:setvelocity({x=velo.x*0.9, y=-1, z=velo.z*0.9})
|
||||
entity.object:set_velocity({x=velo.x*0.9, y=-1, z=velo.z*0.9})
|
||||
elseif ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_forward)
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_forward)
|
||||
elseif ctrl.down then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_backward)
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_backward)
|
||||
elseif ctrl.jump then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_rise)
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_rise)
|
||||
elseif not ctrl.down or ctrl.up or ctrl.jump then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_stop)
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_stop)
|
||||
end
|
||||
if ctrl.aux1 and shoots and not entity.loaded then
|
||||
local pos = entity.object:getpos()
|
||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2.5,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2.5}, arrow)
|
||||
local vec = {x=dir.x*12,y=dir.y*12,z=dir.z*12}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
entity.loaded = true
|
||||
obj:setyaw(yaw+math.pi/2)
|
||||
obj:setvelocity(vec)
|
||||
local object = obj:get_luaentity()
|
||||
object.launcher = entity.driver
|
||||
minetest.after(1, function()
|
||||
local pos = entity.object:get_pos()
|
||||
local obj = minetest.add_entity({x=pos.x+0+dir.x*2.5,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2.5}, arrow)
|
||||
local vec = vector.multiply(dir, 12)
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
entity.loaded = true
|
||||
obj:set_yaw(yaw+math.pi/2)
|
||||
obj:set_velocity(vec)
|
||||
local object = obj:get_luaentity()
|
||||
object.launcher = entity.driver
|
||||
minetest.after(1, function()
|
||||
entity.loaded = false
|
||||
end)
|
||||
end)
|
||||
end
|
||||
--lib_mount animation
|
||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nil and mobs_redo == true then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
entity.object:set_pos(entity.object:get_pos())
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil and mobs_redo == true then
|
||||
@ -248,7 +244,7 @@ function lib_mount.attach(entity, player, attach_at, eye_offset)
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(player, "sit" , 30)
|
||||
end)
|
||||
entity.object:setyaw(player:get_look_yaw() - math.pi / 2)
|
||||
entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
||||
end
|
||||
|
||||
function lib_mount.detach(entity, player, offset)
|
||||
@ -257,18 +253,18 @@ function lib_mount.detach(entity, player, offset)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_animation(player, "stand" , 30)
|
||||
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
|
||||
minetest.after(0.1, function()
|
||||
player:setpos(pos)
|
||||
player:set_pos(pos)
|
||||
end)
|
||||
end
|
||||
|
||||
function lib_mount.drive(entity, dtime, moving_anim, stand_anim, can_fly)
|
||||
entity.v = get_v(entity.object:getvelocity()) * get_sign(entity.v)
|
||||
entity.v = get_v(entity.object:get_velocity()) * get_sign(entity.v)
|
||||
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local yaw = entity.object:getyaw()
|
||||
local yaw = entity.object:get_yaw()
|
||||
if ctrl.up then
|
||||
entity.v = entity.v + 0.1
|
||||
elseif ctrl.down then
|
||||
@ -276,24 +272,24 @@ function lib_mount.drive(entity, dtime, moving_anim, stand_anim, can_fly)
|
||||
end
|
||||
if ctrl.left then
|
||||
if entity.v < 0 then
|
||||
entity.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
entity.object:set_yaw(yaw - (1 + dtime) * 0.03)
|
||||
else
|
||||
entity.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
entity.object:set_yaw(yaw + (1 + dtime) * 0.03)
|
||||
end
|
||||
elseif ctrl.right then
|
||||
if entity.v < 0 then
|
||||
entity.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
entity.object:set_yaw(yaw + (1 + dtime) * 0.03)
|
||||
else
|
||||
entity.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
entity.object:set_yaw(yaw - (1 + dtime) * 0.03)
|
||||
end
|
||||
end
|
||||
|
||||
local velo = entity.object:getvelocity()
|
||||
local velo = entity.object:get_velocity()
|
||||
if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nil and mobs_redo == true then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
entity.object:set_pos(entity.object:get_pos())
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil and mobs_redo == true then
|
||||
@ -302,7 +298,7 @@ function lib_mount.drive(entity, dtime, moving_anim, stand_anim, can_fly)
|
||||
local s = get_sign(entity.v)
|
||||
entity.v = entity.v - 0.02 * s
|
||||
if s ~= get_sign(entity.v) then
|
||||
entity.object:setvelocity({x = 0, y = 0, z = 0})
|
||||
entity.object:set_velocity({x = 0, y = 0, z = 0})
|
||||
entity.v = 0
|
||||
return
|
||||
end
|
||||
@ -310,7 +306,7 @@ function lib_mount.drive(entity, dtime, moving_anim, stand_anim, can_fly)
|
||||
entity.v = 5 * get_sign(entity.v)
|
||||
end
|
||||
|
||||
local p = entity.object:getpos()
|
||||
local p = entity.object:get_pos()
|
||||
p.y = p.y - 0.5
|
||||
local new_velo = {x = 0, y = 0, z = 0}
|
||||
local new_acce = {x = 0, y = 0, z = 0}
|
||||
@ -322,13 +318,13 @@ function lib_mount.drive(entity, dtime, moving_anim, stand_anim, can_fly)
|
||||
else
|
||||
new_acce = {x = 0, y = -9.8, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(),
|
||||
entity.object:getvelocity().y)
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
new_velo = get_velocity(entity.v, entity.object:get_yaw(),
|
||||
entity.object:get_velocity().y)
|
||||
entity.object:set_pos(entity.object:get_pos())
|
||||
else
|
||||
p.y = p.y + 1
|
||||
if is_group(p, "crumbly") then
|
||||
local y = entity.object:getvelocity().y
|
||||
local y = entity.object:get_velocity().y
|
||||
if y >= 5 then
|
||||
y = 5
|
||||
elseif y < 0 then
|
||||
@ -336,25 +332,25 @@ function lib_mount.drive(entity, dtime, moving_anim, stand_anim, can_fly)
|
||||
else
|
||||
new_acce = {x = 0, y = 5, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(), y)
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
new_velo = get_velocity(entity.v, entity.object:get_yaw(), y)
|
||||
entity.object:set_pos(entity.object:get_pos())
|
||||
else
|
||||
new_acce = {x = 0, y = 0, z = 0}
|
||||
if math.abs(entity.object:getvelocity().y) < 1 then
|
||||
local pos = entity.object:getpos()
|
||||
if math.abs(entity.object:get_velocity().y) < 1 then
|
||||
local pos = entity.object:get_pos()
|
||||
pos.y = math.floor(pos.y) + 0.5
|
||||
entity.object:setpos(pos)
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(), 0)
|
||||
entity.object:set_pos(pos)
|
||||
new_velo = get_velocity(entity.v, entity.object:get_yaw(), 0)
|
||||
else
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(),
|
||||
entity.object:getvelocity().y)
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
new_velo = get_velocity(entity.v, entity.object:get_yaw(),
|
||||
entity.object:get_velocity().y)
|
||||
entity.object:set_pos(entity.object:get_pos())
|
||||
end
|
||||
end
|
||||
end
|
||||
if can_fly and can_fly == true and ctrl.jump then
|
||||
new_velo.y = new_velo.y + 0.75
|
||||
end
|
||||
entity.object:setvelocity(new_velo)
|
||||
entity.object:setacceleration(new_acce)
|
||||
entity.object:set_velocity(new_velo)
|
||||
entity.object:set_acceleration(new_acce)
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ minetest.register_entity(fname, {
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
@ -28,22 +28,22 @@ minetest.register_entity(fname, {
|
||||
for dz=0,1 do
|
||||
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
local n = minetest.get_node(p).name
|
||||
if n ~= fname and n ~="default:dirt_with_grass" and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then
|
||||
if minetest.registered_nodes[n].groups.flammable --[[or math.random(1, 100) <= 1]] then
|
||||
minetest.env:set_node(t, {name=replace_node})
|
||||
minetest.set_node(t, {name=replace_node})
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
if ice and n == "default:water_source" then
|
||||
minetest.env:set_node(t, {name="default:ice"})
|
||||
minetest.set_node(t, {name="default:ice"})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local apos = self.object:getpos()
|
||||
local apos = self.object:get_pos()
|
||||
local part = minetest.add_particlespawner(
|
||||
6, --amount
|
||||
0.3, --time
|
||||
|
@ -22,9 +22,9 @@ dmobs.dragon.ride = function(self, clicker)
|
||||
object_detach(self, clicker, {x=1, y=0, z=1})
|
||||
|
||||
if inv:room_for_item("main", "mobs:saddle") then
|
||||
inv:add_item("main", "mobs:saddle")
|
||||
inv:add_item("main", "mobs:saddle")
|
||||
else
|
||||
minetest.add_item(clicker.getpos(), "mobs:saddle")
|
||||
minetest.add_item(clicker:get_pos(), "mobs:saddle")
|
||||
end
|
||||
|
||||
elseif not self.driver then
|
||||
|
@ -59,7 +59,7 @@ mobs:register_mob("dmobs:waterdragon", {
|
||||
self.hydra = true -- flip switch so this part is done only once
|
||||
|
||||
-- get head position and define a few temp variables
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
local obj, obj2, ent
|
||||
|
||||
-- add body and make it follow head
|
||||
|
@ -2,11 +2,13 @@
|
||||
--butterflies
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"flowers:flower_rose", "flowers:flower_tulip", "flowers:flower_dandelion_yellow", "flowers:flower_viola", "flowers:flower_dandelion_white", "flowers:flower_geranium"},
|
||||
nodenames = {"flowers:flower_rose", "flowers:flower_tulip",
|
||||
"flowers:flower_dandelion_yellow", "flowers:flower_viola",
|
||||
"flowers:flower_dandelion_white", "flowers:flower_geranium"},
|
||||
interval = 10.0,
|
||||
chance = 10,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_entity({x=pos.x,y=pos.y+0.3,z=pos.z}, "dmobs:butterfly")
|
||||
minetest.add_entity({x=pos.x,y=pos.y+0.3,z=pos.z}, "dmobs:butterfly")
|
||||
end
|
||||
})
|
||||
|
||||
@ -20,18 +22,18 @@ minetest.register_entity("dmobs:butterfly", {
|
||||
num = math.random(1,4)
|
||||
self.object:set_properties({textures = {"dmobs_butterfly"..num..".png",},})
|
||||
self.object:set_animation({x=1, y=10}, 20, 0)
|
||||
self.object:setyaw(math.pi+num)
|
||||
self.object:set_yaw(math.pi+num)
|
||||
minetest.after(10, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
end,
|
||||
on_step = function(self)
|
||||
local pos = self.object:getpos()
|
||||
local vec = self.object:getvelocity()
|
||||
local pos = self.object:get_pos()
|
||||
local vec = self.object:get_velocity()
|
||||
local num = math.random(-math.pi, math.pi)
|
||||
self.object:setyaw(math.pi+num)
|
||||
self.object:setvelocity({x=-math.sin(12*pos.y), y=math.cos(12*pos.x), z=-math.sin(12*pos.y)})
|
||||
self.object:setacceleration({x=-math.sin(6*vec.y), y=math.cos(6*vec.x), z=-math.sin(6*vec.y)})
|
||||
self.object:set_yaw(math.pi+num)
|
||||
self.object:set_velocity({x=-math.sin(12*pos.y), y=math.cos(12*pos.x), z=-math.sin(12*pos.y)})
|
||||
self.object:set_acceleration({x=-math.sin(6*vec.y), y=math.cos(6*vec.x), z=-math.sin(6*vec.y)})
|
||||
end,
|
||||
collisionbox = {0,0,0,0,0.1,0},
|
||||
})
|
||||
|
@ -44,8 +44,8 @@ mobs:register_mob("dmobs:nyan", {
|
||||
|
||||
},
|
||||
do_custom = function(self)
|
||||
local apos = self.object:getpos()
|
||||
local vec = self.object:getvelocity()
|
||||
local apos = self.object:get_pos()
|
||||
local vec = self.object:get_velocity()
|
||||
local part = minetest.add_particlespawner(
|
||||
5, --amount
|
||||
0.3, --time
|
||||
|
@ -81,8 +81,8 @@ mobs:register_mob("dmobs:wasp_leader", {
|
||||
},
|
||||
do_custom = function(self)
|
||||
if math.random(1, 500) >= 500 then
|
||||
local pos = self.object:getpos()
|
||||
minetest.env:add_entity(pos, "dmobs:wasp")
|
||||
local pos = self.object:get_pos()
|
||||
minetest.add_entity(pos, "dmobs:wasp")
|
||||
end
|
||||
end,
|
||||
replace_rate = 700,
|
||||
|
22
nodes.lua
22
nodes.lua
@ -7,10 +7,10 @@ minetest.register_node("dmobs:hive", {
|
||||
tiles = {"dmobs_hive.png"},
|
||||
groups = {crumbly=1, oddly_breakable_by_hand=1, falling_node=1, flammable=1},
|
||||
on_destruct = function(pos, oldnode)
|
||||
minetest.env:add_entity(pos, "dmobs:wasp")
|
||||
minetest.env:add_entity(pos, "dmobs:wasp")
|
||||
minetest.env:add_entity(pos, "dmobs:wasp")
|
||||
minetest.env:add_entity(pos, "dmobs:wasp")
|
||||
minetest.add_entity(pos, "dmobs:wasp")
|
||||
minetest.add_entity(pos, "dmobs:wasp")
|
||||
minetest.add_entity(pos, "dmobs:wasp")
|
||||
minetest.add_entity(pos, "dmobs:wasp")
|
||||
end,
|
||||
})
|
||||
|
||||
@ -21,14 +21,14 @@ minetest.register_node("dmobs:golemstone", {
|
||||
tiles = {"dmobs_golem_stone.png",},
|
||||
groups = {cracky=1},
|
||||
on_construct = function(pos, node, _)
|
||||
local node1 = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local node2 = minetest.env:get_node({x=pos.x, y=pos.y-2, z=pos.z}).name
|
||||
local node3 = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
|
||||
local node1 = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local node2 = minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name
|
||||
local node3 = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
|
||||
if node1 == "default:stone" and node2 == "default:stone" and node3 == "air" then
|
||||
minetest.env:add_entity(pos, "dmobs:golem_friendly")
|
||||
minetest.env:remove_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
minetest.env:remove_node({x=pos.x, y=pos.y-2, z=pos.z})
|
||||
minetest.env:remove_node({x=pos.x, y=pos.y, z=pos.z})
|
||||
minetest.add_entity(pos, "dmobs:golem_friendly")
|
||||
minetest.remove_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
minetest.remove_node({x=pos.x, y=pos.y-2, z=pos.z})
|
||||
minetest.remove_node({x=pos.x, y=pos.y, z=pos.z})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user