Replace deprecated functions

This commit is contained in:
Wuzzy 2019-03-06 04:38:57 +01:00
parent b31a717410
commit 2f74aea6f5
29 changed files with 159 additions and 159 deletions

View file

@ -310,7 +310,7 @@ function mesecon.mvps_move_objects(pos, dir, nodestack)
local nn = minetest.get_node(np)
if not ((not minetest.registered_nodes[nn.name])
or minetest.registered_nodes[nn.name].walkable) then
obj:setpos(np)
obj:set_pos(np)
end
end
end

View file

@ -41,7 +41,7 @@ mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damag
end
obj:set_velocity({x=dir.x*power, y=dir.y*power, z=dir.z*power})
obj:set_acceleration({x=0, y=-GRAVITY, z=0})
obj:setyaw(yaw-math.pi/2)
obj:set_yaw(yaw-math.pi/2)
local le = obj:get_luaentity()
le._shooter = shooter
le._damage = damage

View file

@ -35,10 +35,10 @@ minetest.register_entity("mcl_end:ender_eye", {
else
-- 80% to drop as an item
local pos = self.object:get_pos()
local v = self.object:getvelocity()
local v = self.object:get_velocity()
self.object:remove()
local item = minetest.add_item(pos, "mcl_end:ender_eye")
item:setvelocity(v)
item:set_velocity(v)
return
end
elseif self._age >= 2 then
@ -46,8 +46,8 @@ minetest.register_entity("mcl_end:ender_eye", {
self._phase = 1
-- Stop the eye and wait for another second.
-- The vertical speed changes are just eye candy.
self.object:setacceleration({x=0, y=-3, z=0})
self.object:setvelocity({x=0, y=self.object:getvelocity().y*0.2, z=0})
self.object:set_acceleration({x=0, y=-3, z=0})
self.object:set_velocity({x=0, y=self.object:get_velocity().y*0.2, z=0})
end
else
-- Fly normally and generate particles
@ -126,7 +126,7 @@ minetest.register_craftitem("mcl_end:ender_eye", {
local velocity = 4
-- Stronghold is close: Fly directly to stronghold and take Y into account.
dir = vector.normalize(vector.direction(origin, closest_stronghold.pos))
obj:setvelocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity})
obj:set_velocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity})
else
local velocity = 12
-- Don't care about Y if stronghold is still far away.
@ -134,8 +134,8 @@ minetest.register_craftitem("mcl_end:ender_eye", {
local o = {x=origin.x, y=0, z=origin.z}
local s = {x=closest_stronghold.pos.x, y=0, z=closest_stronghold.pos.z}
dir = vector.normalize(vector.direction(o, s))
obj:setacceleration({x=dir.x*-3, y=4, z=dir.z*-3})
obj:setvelocity({x=dir.x*velocity, y=3, z=dir.z*velocity})
obj:set_acceleration({x=dir.x*-3, y=4, z=dir.z*-3})
obj:set_velocity({x=dir.x*velocity, y=3, z=dir.z*velocity})
end
@ -150,4 +150,4 @@ minetest.register_craft({
type = "shapeless",
output = "mcl_end:ender_eye",
recipe = {"mcl_mobitems:blaze_powder", "mcl_throwing:ender_pearl"},
})
})

View file

@ -46,7 +46,7 @@ minetest.register_craftitem("mcl_fire:fire_charge", {
local ent = fireball:get_luaentity()
ent._shot_from_dispenser = true
local v = ent.velocity or 1
fireball:setvelocity(vector.multiply(dropdir, v))
fireball:set_velocity(vector.multiply(dropdir, v))
ent.switch = 1
stack:take_item()
end,

View file

@ -77,7 +77,7 @@ local update_item_entity = function(pos, node)
lua:_update_texture()
if node.name == "mcl_itemframes:item_frame" then
local yaw = math.pi*2 - node.param2 * math.pi/2
e:setyaw(yaw)
e:set_yaw(yaw)
end
end
end

View file

@ -338,8 +338,8 @@ doll_def.on_activate = function(self, staticdata, dtime_s)
mob = default_mob
end
set_doll_properties(self.object, mob)
self.object:setvelocity({x=0, y=0, z=0})
self.object:setacceleration({x=0, y=0, z=0})
self.object:set_velocity({x=0, y=0, z=0})
self.object:set_acceleration({x=0, y=0, z=0})
self.object:set_armor_groups({immortal=1})
end

View file

@ -197,7 +197,7 @@ local function find_nether_target_y(target_x, target_z)
local air = 4
for y = start_y, math.max(mcl_vars.mg_lava_nether_max + 1), -1 do
local nval_cave = nobj_cave:get3d({x = target_x, y = y, z = target_z})
local nval_cave = nobj_cave:get_3d({x = target_x, y = y, z = target_z})
if nval_cave > TCAVE then -- Cavern
air = air + 1

View file

@ -223,7 +223,7 @@ local update_sign = function(pos, fields, sender)
text_entity:get_luaentity()._signnodename = nn
text_entity:set_properties({textures={generate_texture(create_lines(text), nn)}})
text_entity:setyaw(sign_info.yaw)
text_entity:set_yaw(sign_info.yaw)
end
local show_formspec = function(player, pos)
@ -359,7 +359,7 @@ minetest.register_node("mcl_signs:wall_sign", {
x = place_pos.x + sign_info.delta.x,
y = place_pos.y + sign_info.delta.y,
z = place_pos.z + sign_info.delta.z}, "mcl_signs:text")
text_entity:setyaw(sign_info.yaw)
text_entity:set_yaw(sign_info.yaw)
text_entity:get_luaentity()._signnodename = nodeitem:get_name()
minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos})

View file

@ -28,8 +28,8 @@ mcl_throwing.throw = function(throw_item, pos, dir, velocity)
local itemstring = ItemStack(throw_item):get_name()
local obj = minetest.add_entity(pos, entity_mapping[itemstring])
obj:setvelocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity})
obj:setacceleration({x=dir.x*-3, y=-GRAVITY, z=dir.z*-3})
obj:set_velocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity})
obj:set_acceleration({x=dir.x*-3, y=-GRAVITY, z=dir.z*-3})
return obj
end
@ -208,7 +208,7 @@ local pearl_on_step = function(self, dtime)
-- First determine good teleport position
local dir = {x=0, y=0, z=0}
local v = self.object:getvelocity()
local v = self.object:get_velocity()
if walkable then
local vc = table.copy(v) -- vector for calculating
-- Node is walkable, we have to find a place somewhere outside of that node
@ -261,7 +261,7 @@ local pearl_on_step = function(self, dtime)
local oldpos = player:get_pos()
-- Teleport and hurt player
player:setpos(telepos)
player:set_pos(telepos)
player:set_hp(player:get_hp() - 5)
-- 5% chance to spawn endermite at the player's origin

View file

@ -10,7 +10,7 @@ end
local function activate_if_tnt(nname, np, tnt_np, tntr)
if nname == "mcl_tnt:tnt" then
local e = spawn_tnt(np, nname)
e:setvelocity({x=(np.x - tnt_np.x)*5+(tntr / 4), y=(np.y - tnt_np.y)*5+(tntr / 3), z=(np.z - tnt_np.z)*5+(tntr / 4)})
e:set_velocity({x=(np.x - tnt_np.x)*5+(tntr / 4), y=(np.y - tnt_np.y)*5+(tntr / 3), z=(np.z - tnt_np.z)*5+(tntr / 4)})
end
end
@ -18,13 +18,13 @@ local function do_tnt_physics(tnt_np,tntr)
local objs = minetest.get_objects_inside_radius(tnt_np, tntr)
for k, obj in pairs(objs) do
local ent = obj:get_luaentity()
local v = obj:getvelocity()
local v = obj:get_velocity()
local p = obj:get_pos()
if ent and ent.name == "mcl_tnt:tnt" then
obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 2) + v.x, y=(p.y - tnt_np.y) + tntr + v.y, z=(p.z - tnt_np.z) + (tntr / 2) + v.z})
obj:set_velocity({x=(p.x - tnt_np.x) + (tntr / 2) + v.x, y=(p.y - tnt_np.y) + tntr + v.y, z=(p.z - tnt_np.z) + (tntr / 2) + v.z})
else
if v ~= nil then
obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 4) + v.x, y=(p.y - tnt_np.y) + (tntr / 2) + v.y, z=(p.z - tnt_np.z) + (tntr / 4) + v.z})
obj:set_velocity({x=(p.x - tnt_np.x) + (tntr / 4) + v.x, y=(p.y - tnt_np.y) + (tntr / 2) + v.y, z=(p.z - tnt_np.z) + (tntr / 4) + v.z})
else
local dist = math.max(1, vector.distance(tnt_np, p))
local damage = (4 / dist) * tntr
@ -100,9 +100,9 @@ function TNT:on_activate(staticdata)
local phi = math.random(0, 65535) / 65535 * 2*math.pi
local hdir_x = math.cos(phi) * 0.02
local hdir_z = math.sin(phi) * 0.02
self.object:setvelocity({x=hdir_x, y=2, z=hdir_z})
self.object:setacceleration({x=0, y=-10, z=0})
self.object:settexturemod("^mcl_tnt_blink.png")
self.object:set_velocity({x=hdir_x, y=2, z=hdir_z})
self.object:set_acceleration({x=0, y=-10, z=0})
self.object:set_texture_mod("^mcl_tnt_blink.png")
end
local function add_effects(pos, radius, drops)
@ -170,9 +170,9 @@ function TNT:on_step(dtime)
if self.blinktimer > 0.25 then
self.blinktimer = self.blinktimer - 0.25
if self.blinkstatus then
self.object:settexturemod("")
self.object:set_texture_mod("")
else
self.object:settexturemod("^mcl_tnt_blink.png")
self.object:set_texture_mod("^mcl_tnt_blink.png")
end
self.blinkstatus = not self.blinkstatus
end

View file

@ -433,7 +433,7 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
armor.drop_armor = function(pos, stack)
local obj = minetest.add_item(pos, stack)
if obj then
obj:setvelocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)})
obj:set_velocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)})
end
end
minetest.register_on_dieplayer(function(player)

View file

@ -63,7 +63,7 @@ local function update_entity(pos)
yaw = math.pi / 2
end
end
object:setyaw(yaw)
object:set_yaw(yaw)
object:set_properties({textures={texture}})
end
end