Merge branch '5_fix' into master_revival
This commit is contained in:
commit
22c653afc7
@ -69,7 +69,7 @@ if minetest.settings:get_bool("ambiance_enable") == true then
|
||||
local player_positions = {}
|
||||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
local name = player:get_player_name()
|
||||
|
||||
for soundname, sound in pairs(ambiance.sounds) do
|
||||
|
@ -50,7 +50,7 @@ local function put_player_in_bed(player)
|
||||
end
|
||||
|
||||
player:set_look_horizontal(bed.userdata[name].spawn_yaw)
|
||||
player:setpos(bed.userdata[name].spawn_pos)
|
||||
player:set_pos(bed.userdata[name].spawn_pos)
|
||||
|
||||
player_effects.apply_effect(player, "inbed")
|
||||
|
||||
@ -75,7 +75,7 @@ local function take_player_from_bed(player)
|
||||
|
||||
local name = player:get_player_name()
|
||||
|
||||
player:setpos(bed.userdata[name].spawn_pos)
|
||||
player:set_pos(bed.userdata[name].spawn_pos)
|
||||
|
||||
player_effects.remove_effect(player, "inbed")
|
||||
|
||||
@ -212,8 +212,8 @@ local function on_globalstep(dtime)
|
||||
|
||||
sleeping_players = sleeping_players + 1
|
||||
|
||||
if vector.distance(player:getpos(), data.spawn_pos) > 2 then
|
||||
player:moveto(data.spawn_pos)
|
||||
if vector.distance(player:get_pos(), data.spawn_pos) > 2 then
|
||||
player:move_to(data.spawn_pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -87,8 +87,8 @@ minetest.register_entity(
|
||||
self.itemstring = staticdata
|
||||
end
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
self.object:setvelocity({x=0, y=2, z=0})
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.object:set_velocity({x=0, y=2, z=0})
|
||||
self.object:set_acceleration({x=0, y=-10, z=0})
|
||||
self:set_item(self.itemstring)
|
||||
end,
|
||||
|
||||
@ -102,11 +102,11 @@ minetest.register_entity(
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
local p = self.object:getpos()
|
||||
local p = self.object:get_pos()
|
||||
|
||||
local name = minetest.get_node(p).name
|
||||
if minetest.registered_nodes[name].damage_per_second > 0 or name == "maptools:igniter" then
|
||||
minetest.sound_play("builtin_item_lava", {pos = self.object:getpos(), gain = 0.45})
|
||||
minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.45})
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
@ -116,8 +116,8 @@ minetest.register_entity(
|
||||
-- If node is not registered or node is walkably solid:
|
||||
if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable then
|
||||
if self.physical_state then
|
||||
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.physical_state = false
|
||||
self.object:set_properties(
|
||||
{
|
||||
@ -126,8 +126,8 @@ minetest.register_entity(
|
||||
end
|
||||
else
|
||||
if not self.physical_state then
|
||||
self.object:setvelocity({x=0,y=0,z=0})
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.object:set_velocity({x=0,y=0,z=0})
|
||||
self.object:set_acceleration({x=0, y=-10, z=0})
|
||||
self.physical_state = true
|
||||
self.object:set_properties(
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ local function on_player_receive_fields(player, form_name, fields)
|
||||
|
||||
|
||||
if fields.quit then
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
|
||||
for i = 1, inv:get_size("craft_in") do
|
||||
local itemstack = inv:get_stack("craft_in", i)
|
||||
|
@ -168,7 +168,7 @@ minetest.register_craftitem(
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
@ -210,7 +210,7 @@ minetest.register_craftitem(
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
@ -252,7 +252,7 @@ minetest.register_craftitem(
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
@ -294,7 +294,7 @@ minetest.register_craftitem(
|
||||
if inv:room_for_item("main", {name="default:bucket_water"}) then
|
||||
inv:add_item("main", "default:bucket_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_water")
|
||||
end
|
||||
@ -308,7 +308,7 @@ minetest.register_craftitem(
|
||||
if inv:room_for_item("main", {name="default:bucket_river_water"}) then
|
||||
inv:add_item("main", "default:bucket_river_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_river_water")
|
||||
end
|
||||
@ -322,7 +322,7 @@ minetest.register_craftitem(
|
||||
if inv:room_for_item("main", {name="default:bucket_swamp_water"}) then
|
||||
inv:add_item("main", "default:bucket_swamp_water")
|
||||
else
|
||||
local pos = user:getpos()
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_swamp_water")
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ local function step(dtime)
|
||||
local player_positions = {}
|
||||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local player_pos=player:getpos()
|
||||
local player_pos=player:get_pos()
|
||||
local head_pos = player_pos
|
||||
local name=player:get_player_name()
|
||||
|
||||
@ -23,10 +23,10 @@ local function step(dtime)
|
||||
"Don't go past 30000m in any direction!"
|
||||
))
|
||||
|
||||
player:setpos(player_lastpos[name])
|
||||
player:set_pos(player_lastpos[name])
|
||||
end
|
||||
|
||||
player_lastpos[name] = player:getpos()
|
||||
player_lastpos[name] = player:get_pos()
|
||||
|
||||
if player:get_hp() < player_health[name] then
|
||||
minetest.sound_play(
|
||||
@ -117,7 +117,7 @@ local function on_joinplayer(player)
|
||||
|
||||
player_health[name] = player:get_hp()
|
||||
|
||||
player_lastpos[name] = player:getpos()
|
||||
player_lastpos[name] = player:get_pos()
|
||||
|
||||
-- Uncomment to enable player-on-player collisions
|
||||
-- player:set_properties({physical = true})
|
||||
|
@ -14,7 +14,7 @@ function drop_items_on_die.register_listname(listname)
|
||||
end
|
||||
|
||||
local function on_die(player)
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
|
||||
local inv = player:get_inventory()
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
gold = {}
|
||||
|
||||
gold.pr = PseudoRandom(minetest.get_mapgen_params().seed+8732)
|
||||
local mapseed = minetest.get_mapgen_setting("seed")
|
||||
gold.pr = PseudoRandom(mapseed+8732)
|
||||
|
||||
gold.trades = {}
|
||||
gold.trade_names = {}
|
||||
|
@ -67,7 +67,7 @@ function headbars.attach_hpbar(to)
|
||||
if not enable_damage then return end
|
||||
if not enable_headbars then return end
|
||||
|
||||
local pos = to:getpos()
|
||||
local pos = to:get_pos()
|
||||
local bar = minetest.add_entity(pos, "headbars:hpbar")
|
||||
|
||||
if bar == nil then return end
|
||||
|
@ -195,7 +195,7 @@ local function on_item_eat(hpdata, replace_with_item, itemstack,
|
||||
hunger.userdata[name].saturation = math.min(100, hunger.userdata[name].saturation
|
||||
+ saturation)
|
||||
|
||||
local headpos = player:getpos()
|
||||
local headpos = player:get_pos()
|
||||
|
||||
headpos.y = headpos.y + 1
|
||||
minetest.sound_play("hunger_eat", {pos = headpos, max_hear_distance = 8})
|
||||
@ -297,7 +297,7 @@ local function on_globalstep(dtime)
|
||||
player:set_hp(hp - 1)
|
||||
hunger.userdata[name].hunger = 0
|
||||
|
||||
local pos_sound = player:getpos()
|
||||
local pos_sound = player:get_pos()
|
||||
minetest.chat_send_player(
|
||||
name, minetest.colorize("#f00", "You are hungry."))
|
||||
end
|
||||
@ -322,7 +322,7 @@ end
|
||||
|
||||
local function fake_on_item_eat(hpdata, replace_with_item, itemstack,
|
||||
player, pointed_thing)
|
||||
local headpos = player:getpos()
|
||||
local headpos = player:get_pos()
|
||||
headpos.y = headpos.y + 1
|
||||
minetest.sound_play(
|
||||
"hunger_eat",
|
||||
|
@ -26,7 +26,7 @@ function item_drop.drop_item(pos, itemstack)
|
||||
z = -z
|
||||
end
|
||||
|
||||
drop:setvelocity({x = 1 / x, y = drop:getvelocity().y, z = 1 / z})
|
||||
drop:set_velocity({x = 1 / x, y = drop:get_velocity().y, z = 1 / z})
|
||||
end
|
||||
end
|
||||
|
||||
@ -38,7 +38,7 @@ minetest.register_globalstep(
|
||||
function(dtime)
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
local inv = player:get_inventory()
|
||||
|
||||
local in_radius = minetest.get_objects_inside_radius(pos, 6.0)
|
||||
@ -50,7 +50,7 @@ minetest.register_globalstep(
|
||||
|
||||
pos1.y = pos1.y + 0.2
|
||||
|
||||
local pos2 = object:getpos()
|
||||
local pos2 = object:get_pos()
|
||||
|
||||
local vec = {
|
||||
x = pos1.x - pos2.x,
|
||||
@ -69,7 +69,7 @@ minetest.register_globalstep(
|
||||
vec.y = vec.y*3
|
||||
vec.z = vec.z*3
|
||||
|
||||
object:setvelocity(vec)
|
||||
object:set_velocity(vec)
|
||||
|
||||
object:get_luaentity().physical_state = false
|
||||
|
||||
@ -100,7 +100,7 @@ minetest.register_globalstep(
|
||||
end
|
||||
end
|
||||
else
|
||||
object:setvelocity({x = 0, y = object:getvelocity().y, z = 0})
|
||||
object:set_velocity({x = 0, y = object:get_velocity().y, z = 0})
|
||||
|
||||
object:get_luaentity().physical_state = true
|
||||
|
||||
@ -133,7 +133,7 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||
if math.random(1,2) == 1 then
|
||||
z = -z
|
||||
end
|
||||
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
|
||||
obj:set_velocity({x=1/x, y=obj:get_velocity().y, z=1/z})
|
||||
|
||||
-- FIXME this doesnt work for deactiveted objects
|
||||
if minetest.settings:get("remove_items") and tonumber(minetest.settings:get("remove_items")) then
|
||||
|
@ -22,7 +22,7 @@ local function on_globalstep(dtime)
|
||||
timer = 0
|
||||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
|
||||
util.nodefunc(
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ function mobs:register_mob(name, def)
|
||||
end
|
||||
end,
|
||||
do_attack = function(self, player, dist)
|
||||
if is_too_near_spawn(self.object:getpos()) then return end
|
||||
if is_too_near_spawn(self.object:get_pos()) then return end
|
||||
|
||||
if self.state ~= "attack" then
|
||||
if math.random(0,100) < 90
|
||||
@ -167,11 +167,11 @@ function mobs:register_mob(name, def)
|
||||
self.rotate = math.rad(90)
|
||||
end
|
||||
|
||||
local tmpyaw = self.object:getyaw()
|
||||
local tmpyaw = self.object:get_yaw()
|
||||
local yaw = self.rotate
|
||||
|
||||
if tmpyaw ~= tmpyaw then -- It's a nan value
|
||||
minetest.log("warning", "[mod:mobs] object:getyaw() nan shim used")
|
||||
minetest.log("warning", "[mod:mobs] object:get_yaw() nan shim used")
|
||||
else
|
||||
yaw = yaw + tmpyaw
|
||||
end
|
||||
@ -179,15 +179,15 @@ function mobs:register_mob(name, def)
|
||||
local x = math.sin(yaw) * -v
|
||||
local z = math.cos(yaw) * v
|
||||
|
||||
self.object:setvelocity({x = x, y = self.object:getvelocity().y, z = z})
|
||||
self.object:set_velocity({x = x, y = self.object:get_velocity().y, z = z})
|
||||
end,
|
||||
get_velocity = function(self)
|
||||
local v = self.object:getvelocity()
|
||||
local v = self.object:get_velocity()
|
||||
return (v.x ^ 2 + v.z ^ 2) ^ (0.5)
|
||||
end,
|
||||
in_fov = function(self,pos)
|
||||
-- checks if POS is in self's FOV
|
||||
local yaw = self.object:getyaw() + self.rotate
|
||||
local yaw = self.object:get_yaw() + self.rotate
|
||||
local vx = math.sin(yaw)
|
||||
local vz = math.cos(yaw)
|
||||
local ds = math.sqrt(vx ^ 2 + vz ^ 2)
|
||||
@ -274,7 +274,7 @@ function mobs:register_mob(name, def)
|
||||
if self.lifetimer <= 0
|
||||
and self.state ~= "attack" then
|
||||
minetest.log("action","lifetimer expired, removed "..self.name)
|
||||
effect(self.object:getpos(), 15, "tnt_smoke.png")
|
||||
effect(self.object:get_pos(), 15, "tnt_smoke.png")
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
@ -284,10 +284,10 @@ function mobs:register_mob(name, def)
|
||||
if self.replace_rate
|
||||
and self.child == false
|
||||
and math.random(1, self.replace_rate) == 1 then
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
pos.y = pos.y + self.replace_offset
|
||||
-- print ("replace node = ".. minetest.get_node(pos).name, pos.y)
|
||||
if self.replace_what and self.object:getvelocity().y == 0 and #minetest.find_nodes_in_area(pos, pos, self.replace_what) > 0 then
|
||||
if self.replace_what and self.object:get_velocity().y == 0 and #minetest.find_nodes_in_area(pos, pos, self.replace_what) > 0 then
|
||||
--and self.state == "stand" then
|
||||
if self.on_replace ~= nil then
|
||||
self.on_replace(self, pos)
|
||||
@ -301,14 +301,14 @@ function mobs:register_mob(name, def)
|
||||
|
||||
if not self.fly then
|
||||
-- floating in water (or falling)
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
local nod = minetest.get_node_or_nil(pos)
|
||||
if nod then nod = nod.name else nod = "default:dirt" end
|
||||
local nodef = minetest.registered_nodes[nod]
|
||||
|
||||
local v = self.object:getvelocity()
|
||||
local v = self.object:get_velocity()
|
||||
if v.y > 0.1 then
|
||||
self.object:setacceleration({
|
||||
self.object:set_acceleration({
|
||||
x = 0,
|
||||
y= self.fall_speed,
|
||||
z = 0
|
||||
@ -316,7 +316,7 @@ function mobs:register_mob(name, def)
|
||||
end
|
||||
if nodef.groups.water then
|
||||
if self.floats == 1 then
|
||||
self.object:setacceleration(
|
||||
self.object:set_acceleration(
|
||||
{
|
||||
x = 0,
|
||||
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
||||
@ -324,7 +324,7 @@ function mobs:register_mob(name, def)
|
||||
})
|
||||
end
|
||||
else
|
||||
self.object:setacceleration(
|
||||
self.object:set_acceleration(
|
||||
{
|
||||
x = 0,
|
||||
y = self.fall_speed,
|
||||
@ -333,14 +333,14 @@ function mobs:register_mob(name, def)
|
||||
|
||||
-- fall damage
|
||||
if self.fall_damage == 1
|
||||
and self.object:getvelocity().y == 0 then
|
||||
local d = (self.old_y or 0) - self.object:getpos().y
|
||||
and self.object:get_velocity().y == 0 then
|
||||
local d = (self.old_y or 0) - self.object:get_pos().y
|
||||
if d > 5 then
|
||||
self.object:set_hp(self.object:get_hp() - math.floor(d - 5))
|
||||
effect(self.object:getpos(), 5, "tnt_smoke.png")
|
||||
effect(self.object:get_pos(), 5, "tnt_smoke.png")
|
||||
check_for_death(self)
|
||||
end
|
||||
self.old_y = self.object:getpos().y
|
||||
self.old_y = self.object:get_pos().y
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -375,7 +375,7 @@ function mobs:register_mob(name, def)
|
||||
|
||||
local do_env_damage = function(self)
|
||||
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
local tod = minetest.get_timeofday()
|
||||
|
||||
-- daylight above ground
|
||||
@ -420,7 +420,7 @@ function mobs:register_mob(name, def)
|
||||
|
||||
self.jumptimer = (self.jumptimer or 0) + 1
|
||||
if self.jumptimer < 3 then
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
pos.y = (pos.y + self.collisionbox[2]) - 0.2
|
||||
local nod = minetest.get_node(pos)
|
||||
--print ("standing on:", nod.name, pos.y)
|
||||
@ -446,11 +446,11 @@ function mobs:register_mob(name, def)
|
||||
and def.walkable
|
||||
and not nod.name:find("fence"))
|
||||
or self.walk_chance == 0 then
|
||||
local v = self.object:getvelocity()
|
||||
local v = self.object:get_velocity()
|
||||
v.y = self.jump_height + 1
|
||||
v.x = v.x * 2.2
|
||||
v.z = v.z * 2.2
|
||||
self.object:setvelocity(v)
|
||||
self.object:set_velocity(v)
|
||||
if self.sounds.jump then
|
||||
minetest.sound_play(
|
||||
self.sounds.jump,
|
||||
@ -482,7 +482,7 @@ function mobs:register_mob(name, def)
|
||||
and damage_enabled
|
||||
and self.state ~= "attack" then
|
||||
|
||||
local s = self.object:getpos()
|
||||
local s = self.object:get_pos()
|
||||
local p, sp, dist
|
||||
local player = nil
|
||||
local type = nil
|
||||
@ -505,8 +505,8 @@ function mobs:register_mob(name, def)
|
||||
|
||||
if type == "player"
|
||||
or type == "npc" then
|
||||
s = self.object:getpos()
|
||||
p = player:getpos()
|
||||
s = self.object:get_pos()
|
||||
p = player:get_pos()
|
||||
sp = s
|
||||
p.y = p.y + 1
|
||||
sp.y = sp.y + 1 -- aim higher to make looking up hills more realistic
|
||||
@ -535,14 +535,14 @@ function mobs:register_mob(name, def)
|
||||
if self.type == "npc"
|
||||
and self.attacks_monsters
|
||||
and self.state ~= "attack" then
|
||||
local s = self.object:getpos()
|
||||
local s = self.object:get_pos()
|
||||
local obj = nil
|
||||
for _, oir in pairs(minetest.get_objects_inside_radius(s,self.view_range)) do
|
||||
obj = oir:get_luaentity()
|
||||
if obj
|
||||
and obj.type == "monster" then
|
||||
-- attack monster
|
||||
p = obj.object:getpos()
|
||||
p = obj.object:get_pos()
|
||||
dist = ((p.x - s.x) ^ 2 + (p.y - s.y) ^ 2 + (p.z - s.z) ^ 2) ^ 0.5
|
||||
if dist < min_dist then
|
||||
min_dist = dist
|
||||
@ -585,7 +585,7 @@ function mobs:register_mob(name, def)
|
||||
-- if animal is horny, find another same animal who is horny and mate
|
||||
if self.horny == true
|
||||
and self.hornytimer <= 40 then
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
effect({x = pos.x, y = pos.y + 0.5, z = pos.z}, 4, "heart.png")
|
||||
local ents = minetest.get_objects_inside_radius(pos, self.view_range)
|
||||
local num = 0
|
||||
@ -658,8 +658,8 @@ function mobs:register_mob(name, def)
|
||||
if (self.follow ~= "" or self.order == "follow") and not self.following and self.state ~= "attack" then
|
||||
local s, p, dist
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
s = self.object:getpos()
|
||||
p = player:getpos()
|
||||
s = self.object:get_pos()
|
||||
p = player:get_pos()
|
||||
dist = ((p.x - s.x) ^ 2 + (p.y - s.y) ^ 2 + (p.z - s.z) ^ 2) ^ 0.5
|
||||
if dist < self.view_range then
|
||||
self.following = player
|
||||
@ -694,14 +694,14 @@ function mobs:register_mob(name, def)
|
||||
|
||||
-- follow player or mob
|
||||
if self.following then
|
||||
local s = self.object:getpos()
|
||||
local s = self.object:get_pos()
|
||||
local p
|
||||
|
||||
if self.following.is_player
|
||||
and self.following:is_player() then
|
||||
p = self.following:getpos()
|
||||
p = self.following:get_pos()
|
||||
elseif self.following.object then
|
||||
p = self.following.object:getpos()
|
||||
p = self.following.object:get_pos()
|
||||
end
|
||||
|
||||
if p then
|
||||
@ -714,11 +714,11 @@ function mobs:register_mob(name, def)
|
||||
if p.x > s.x then
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
self.object:set_yaw(yaw)
|
||||
|
||||
-- anyone but standing npc's can move along
|
||||
if dist > 2 and self.order ~= "stand" then
|
||||
if (self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0) or (self.object:getvelocity().y == 0 and self.jump_chance > 0) then
|
||||
if (self.jump and self.get_velocity(self) <= 0.5 and self.object:get_velocity().y == 0) or (self.object:get_velocity().y == 0 and self.jump_chance > 0) then
|
||||
self.direction = {
|
||||
x = math.sin(yaw) * -1,
|
||||
y = -20,
|
||||
@ -746,15 +746,15 @@ function mobs:register_mob(name, def)
|
||||
if math.random(1, 4) == 1 then
|
||||
-- if there is a player nearby look at them
|
||||
local lp = nil
|
||||
local s = self.object:getpos()
|
||||
local s = self.object:get_pos()
|
||||
|
||||
if self.type == "npc" then
|
||||
local o = minetest.get_objects_inside_radius(self.object:getpos(), 3)
|
||||
local o = minetest.get_objects_inside_radius(self.object:get_pos(), 3)
|
||||
|
||||
local yaw = 0
|
||||
for _,o in ipairs(o) do
|
||||
if o:is_player() then
|
||||
lp = o:getpos()
|
||||
lp = o:get_pos()
|
||||
break
|
||||
end
|
||||
end
|
||||
@ -767,9 +767,9 @@ function mobs:register_mob(name, def)
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
else
|
||||
yaw = self.object:getyaw() + ((math.random(0, 360) - 180) / 180 * math.pi)
|
||||
yaw = self.object:get_yaw() + ((math.random(0, 360) - 180) / 180 * math.pi)
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
self.object:set_yaw(yaw)
|
||||
end
|
||||
|
||||
self.set_velocity(self, 0)
|
||||
@ -797,7 +797,7 @@ function mobs:register_mob(name, def)
|
||||
end
|
||||
|
||||
elseif self.state == "walk" then
|
||||
local s = self.object:getpos()
|
||||
local s = self.object:get_pos()
|
||||
local lp = minetest.find_node_near(s, 1, {"group:water"})
|
||||
|
||||
-- water swimmers cannot move out of water
|
||||
@ -815,13 +815,13 @@ function mobs:register_mob(name, def)
|
||||
if lp.x > s.x then
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
self.object:set_yaw(yaw)
|
||||
|
||||
-- otherwise randomly turn
|
||||
elseif math.random(1, 100) <= 30 then
|
||||
self.object:setyaw(self.object:getyaw() + ((math.random(0, 360) - 180) / 180 * math.pi))
|
||||
self.object:set_yaw(self.object:get_yaw() + ((math.random(0, 360) - 180) / 180 * math.pi))
|
||||
end
|
||||
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||
if self.jump and self.get_velocity(self) <= 0.5 and self.object:get_velocity().y == 0 then
|
||||
self.direction = {
|
||||
x = math.sin(yaw) * -1,
|
||||
y = -20,
|
||||
@ -848,8 +848,8 @@ function mobs:register_mob(name, def)
|
||||
self.blinktimer = 0
|
||||
return
|
||||
end
|
||||
local s = self.object:getpos()
|
||||
local p = self.attack.player:getpos()
|
||||
local s = self.object:get_pos()
|
||||
local p = self.attack.player:get_pos()
|
||||
local dist = ((p.x - s.x) ^ 2 + (p.y - s.y) ^ 2 + (p.z - s.z) ^ 2) ^ 0.5
|
||||
if dist > self.view_range or self.attack.player:get_hp() <= 0 then
|
||||
self.state = "stand"
|
||||
@ -870,7 +870,7 @@ function mobs:register_mob(name, def)
|
||||
if p.x > s.x then
|
||||
yaw = yaw+math.pi
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
self.object:set_yaw(yaw)
|
||||
if self.attack.dist > 3 then
|
||||
if not self.v_start then
|
||||
self.v_start = true
|
||||
@ -880,10 +880,10 @@ function mobs:register_mob(name, def)
|
||||
else
|
||||
self.timer = 0
|
||||
self.blinktimer = 0
|
||||
if self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||
local v = self.object:getvelocity()
|
||||
if self.get_velocity(self) <= 0.5 and self.object:get_velocity().y == 0 then
|
||||
local v = self.object:get_velocity()
|
||||
v.y = 5
|
||||
self.object:setvelocity(v)
|
||||
self.object:set_velocity(v)
|
||||
end
|
||||
self.set_velocity(self, self.run_velocity)
|
||||
end
|
||||
@ -902,7 +902,7 @@ function mobs:register_mob(name, def)
|
||||
self.blinkstatus = not self.blinkstatus
|
||||
end
|
||||
if self.timer > 3 then
|
||||
local pos = vector.round(self.object:getpos())
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
entity_physics(pos, 3) -- hurt player/mobs caught in blast area
|
||||
if minetest.find_node_near(pos, 1, {"group:water"}) or minetest.is_protected(pos, "") then
|
||||
self.object:remove()
|
||||
@ -928,14 +928,14 @@ function mobs:register_mob(name, def)
|
||||
|
||||
elseif self.state == "attack"
|
||||
and self.attack_type == "dogfight" then
|
||||
if not self.attack.player or not self.attack.player:getpos() then
|
||||
if not self.attack.player or not self.attack.player:get_pos() then
|
||||
print("stop attacking")
|
||||
self.state = "stand"
|
||||
self:set_animation("stand")
|
||||
return
|
||||
end
|
||||
local s = self.object:getpos()
|
||||
local p = self.attack.player:getpos()
|
||||
local s = self.object:get_pos()
|
||||
local p = self.attack.player:get_pos()
|
||||
local dist = ((p.x - s.x) ^ 2 + (p.y - s.y) ^ 2 + (p.z - s.z) ^ 2) ^ 0.5
|
||||
|
||||
-- fly bit modified from BlockMens creatures mod
|
||||
@ -947,17 +947,17 @@ function mobs:register_mob(name, def)
|
||||
local me_y = math.floor(p1.y)
|
||||
local p2 = p
|
||||
local p_y = math.floor(p2.y + 1)
|
||||
local v = self.object:getvelocity()
|
||||
local v = self.object:get_velocity()
|
||||
if nod
|
||||
and nod.name == self.fly_in then
|
||||
if me_y < p_y then
|
||||
self.object:setvelocity({
|
||||
self.object:set_velocity({
|
||||
x = v.x,
|
||||
y = 1 * self.walk_velocity,
|
||||
z = v.z
|
||||
})
|
||||
elseif me_y > p_y then
|
||||
self.object:setvelocity({
|
||||
self.object:set_velocity({
|
||||
x = v.x,
|
||||
y = -1 * self.walk_velocity,
|
||||
z = v.z
|
||||
@ -965,13 +965,13 @@ function mobs:register_mob(name, def)
|
||||
end
|
||||
else
|
||||
if me_y < p_y then
|
||||
self.object:setvelocity({
|
||||
self.object:set_velocity({
|
||||
x = v.x,
|
||||
y = 0.01,
|
||||
z = v.z
|
||||
})
|
||||
elseif me_y > p_y then
|
||||
self.object:setvelocity({
|
||||
self.object:set_velocity({
|
||||
x = v.x,
|
||||
y = -0.01,
|
||||
z = v.z
|
||||
@ -997,11 +997,11 @@ function mobs:register_mob(name, def)
|
||||
if p.x > s.x then
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
self.object:set_yaw(yaw)
|
||||
-- attack distance is 2 + half of mob width so the bigger mobs can attack (like slimes)
|
||||
if self.attack.dist > ((-self.collisionbox[1] + self.collisionbox[4]) / 2) + 2 then
|
||||
-- jump attack
|
||||
if (self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0) or (self.object:getvelocity().y == 0 and self.jump_chance > 0) then
|
||||
if (self.jump and self.get_velocity(self) <= 0.5 and self.object:get_velocity().y == 0) or (self.object:get_velocity().y == 0 and self.jump_chance > 0) then
|
||||
self.direction = {
|
||||
x = math.sin(yaw) * -1,
|
||||
y = -20,
|
||||
@ -1047,8 +1047,8 @@ function mobs:register_mob(name, def)
|
||||
elseif self.state == "attack"
|
||||
and self.attack_type == "shoot" then
|
||||
|
||||
local s = self.object:getpos()
|
||||
local p = self.attack.player:getpos()
|
||||
local s = self.object:get_pos()
|
||||
local p = self.attack.player:get_pos()
|
||||
if not p then
|
||||
self.state = "stand"
|
||||
return
|
||||
@ -1070,7 +1070,7 @@ function mobs:register_mob(name, def)
|
||||
if p.x > s.x then
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
self.object:setyaw(yaw)
|
||||
self.object:set_yaw(yaw)
|
||||
self.set_velocity(self, 0)
|
||||
|
||||
if self.shoot_interval and self.timer > self.shoot_interval and math.random(1, 100) <= 60 then
|
||||
@ -1087,7 +1087,7 @@ function mobs:register_mob(name, def)
|
||||
})
|
||||
end
|
||||
|
||||
local p = self.object:getpos()
|
||||
local p = self.object:get_pos()
|
||||
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
||||
local obj = minetest.add_entity(p, self.arrow)
|
||||
local amount = (vec.x ^ 2 + vec.y ^ 2 + vec.z ^ 2) ^ 0.5
|
||||
@ -1096,7 +1096,7 @@ function mobs:register_mob(name, def)
|
||||
vec.x = vec.x *v / amount
|
||||
vec.y = vec.y *v / amount
|
||||
vec.z = vec.z *v / amount
|
||||
obj:setvelocity(vec)
|
||||
obj:set_velocity(vec)
|
||||
end
|
||||
end
|
||||
end,
|
||||
@ -1172,8 +1172,8 @@ function mobs:register_mob(name, def)
|
||||
self.state = "stand"
|
||||
self.order = "stand"
|
||||
self.following = nil
|
||||
self.old_y = self.object:getpos().y
|
||||
self.object:setyaw(math.random(1, 360) / 180 * math.pi)
|
||||
self.old_y = self.object:get_pos().y
|
||||
self.object:set_yaw(math.random(1, 360) / 180 * math.pi)
|
||||
self.sounds.distance = (self.sounds.distance or 10)
|
||||
self.textures = textures
|
||||
self.mesh = mesh
|
||||
@ -1241,7 +1241,7 @@ function mobs:register_mob(name, def)
|
||||
|
||||
-- blood_particles
|
||||
if self.blood_amount > 0 then
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) / 3
|
||||
if enable_blood then
|
||||
effect(pos, self.blood_amount, self.blood_texture)
|
||||
@ -1254,14 +1254,14 @@ function mobs:register_mob(name, def)
|
||||
if self.knock_back > 0 then
|
||||
local kb = self.knock_back
|
||||
local r = self.recovery_time
|
||||
local v = self.object:getvelocity()
|
||||
local v = self.object:get_velocity()
|
||||
if tflp < tool_capabilities.full_punch_interval then
|
||||
if kb > 0 then
|
||||
kb = kb * ( tflp / tool_capabilities.full_punch_interval )
|
||||
end
|
||||
r = r * ( tflp / tool_capabilities.full_punch_interval )
|
||||
end
|
||||
self.object:setvelocity({x = dir.x * kb,y = 0,z = dir.z * kb})
|
||||
self.object:set_velocity({x = dir.x * kb,y = 0,z = dir.z * kb})
|
||||
self.pause_timer = r
|
||||
end
|
||||
|
||||
@ -1273,7 +1273,7 @@ function mobs:register_mob(name, def)
|
||||
end
|
||||
-- alert others to the attack
|
||||
local obj = nil
|
||||
for _, oir in pairs(minetest.get_objects_inside_radius(hitter:getpos(), 5)) do
|
||||
for _, oir in pairs(minetest.get_objects_inside_radius(hitter:get_pos(), 5)) do
|
||||
obj = oir:get_luaentity()
|
||||
if obj then
|
||||
if obj.group_attack == true
|
||||
@ -1396,14 +1396,14 @@ function check_for_death(self, hitter)
|
||||
end
|
||||
return false
|
||||
end
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
self.object:remove()
|
||||
local obj = nil
|
||||
for _,drop in ipairs(self.drops) do
|
||||
if math.random(1, drop.chance) == 1 then
|
||||
obj = minetest.add_item(pos, ItemStack(drop.name.." "..math.random(drop.min, drop.max)))
|
||||
if obj then
|
||||
obj:setvelocity(
|
||||
obj:set_velocity(
|
||||
{
|
||||
x = math.random(-1, 1),
|
||||
y = 5,
|
||||
@ -1444,11 +1444,11 @@ function entity_physics(pos, radius)
|
||||
local objs = minetest.get_objects_inside_radius(pos, radius)
|
||||
local obj_pos, obj_vel, dist
|
||||
for _, obj in pairs(objs) do
|
||||
obj_pos = obj:getpos()
|
||||
obj_vel = obj:getvelocity()
|
||||
obj_pos = obj:get_pos()
|
||||
obj_vel = obj:get_velocity()
|
||||
dist = math.max(1, vector.distance(pos, obj_pos))
|
||||
if obj_vel ~= nil then
|
||||
obj:setvelocity(calc_velocity(pos, obj_pos, obj_vel, radius * 10))
|
||||
obj:set_velocity(calc_velocity(pos, obj_pos, obj_vel, radius * 10))
|
||||
end
|
||||
local damage = (4 / dist) * radius
|
||||
obj:set_hp(obj:get_hp() - damage)
|
||||
@ -1477,8 +1477,8 @@ function mobs:register_arrow(name, def)
|
||||
if self.timer > 150 then self.object:remove() return end
|
||||
|
||||
local engage = 10 - (self.velocity / 2) -- clear entity before arrow becomes active
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node_or_nil(self.object:getpos())
|
||||
local pos = self.object:get_pos()
|
||||
local node = minetest.get_node_or_nil(self.object:get_pos())
|
||||
if node then node = node.name else node = "air" end
|
||||
|
||||
if self.hit_node
|
||||
|
@ -94,11 +94,11 @@ mobs:register_mob(
|
||||
if itemname == "default:shears" then
|
||||
if self.gotten == false and self.child == false then
|
||||
self.gotten = true -- shaved
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
pos.y = pos.y + 0.5
|
||||
local obj = minetest.add_item(pos, ItemStack("mobs:wool"))
|
||||
if obj then
|
||||
obj:setvelocity(
|
||||
obj:set_velocity(
|
||||
{
|
||||
x = math.random(-1,1),
|
||||
y = 5,
|
||||
|
@ -68,7 +68,7 @@ function nav.show_map(player)
|
||||
|
||||
if not open_formspecs[name] then return end
|
||||
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
|
||||
local form = default.ui.get_page("default:default")
|
||||
|
||||
@ -131,7 +131,7 @@ local function on_joinplayer(player)
|
||||
1.0,
|
||||
function()
|
||||
nav.add_waypoint(
|
||||
player:getpos(),
|
||||
player:get_pos(),
|
||||
"player_" .. name,
|
||||
name,
|
||||
true,
|
||||
@ -174,7 +174,7 @@ local function on_globalstep(dtime)
|
||||
for wptname, wpt in pairs(nav.waypoints) do
|
||||
if wpt.type == "player" then
|
||||
if players[wpt.label] ~= nil and minetest.get_player_by_name(wpt.label) ~= nil then
|
||||
nav.relocate_waypoint(wptname, players[wpt.label]:getpos())
|
||||
nav.relocate_waypoint(wptname, players[wpt.label]:get_pos())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ minetest.register_craftitem(
|
||||
on_use = function(itemstack, player, pointed_thing)
|
||||
local name = player:get_player_name()
|
||||
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
|
||||
local on = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
|
||||
@ -38,7 +38,7 @@ minetest.register_craftitem(
|
||||
|
||||
local ent = minetest.add_entity(pos, "parachute:entity")
|
||||
|
||||
ent:setvelocity(
|
||||
ent:set_velocity(
|
||||
{
|
||||
x = 0,
|
||||
y = math.min(0, player:get_player_velocity().y),
|
||||
@ -47,7 +47,7 @@ minetest.register_craftitem(
|
||||
|
||||
player:set_attach(ent, "", {x = 0, y = -8, z = 0}, {x = 0, y = 0, z = 0})
|
||||
|
||||
ent:setyaw(player:get_look_horizontal())
|
||||
ent:set_yaw(player:get_look_horizontal())
|
||||
|
||||
ent = ent:get_luaentity()
|
||||
ent.attached = name
|
||||
@ -75,13 +75,13 @@ minetest.register_entity(
|
||||
automatic_face_movement_dir = -90,
|
||||
attached = nil,
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
|
||||
if self.attached ~= nil then
|
||||
local player = minetest.get_player_by_name(self.attached)
|
||||
|
||||
local vel = self.object:getvelocity()
|
||||
local vel = self.object:get_velocity()
|
||||
|
||||
local accel = {x = 0, y = 0, z = 0}
|
||||
|
||||
@ -94,7 +94,7 @@ minetest.register_entity(
|
||||
if lookyaw >= (math.pi * 2) then
|
||||
lookyaw = lookyaw - (math.pi * 2)
|
||||
end
|
||||
-- self.object:setyaw(lookyaw)
|
||||
-- self.object:set_yaw(lookyaw)
|
||||
|
||||
local s = math.sin(lookyaw)
|
||||
local c = math.cos(lookyaw)
|
||||
@ -124,7 +124,7 @@ minetest.register_entity(
|
||||
|
||||
accel.y = accel.y + air_physics(vel.y) * 0.25
|
||||
|
||||
self.object:setacceleration(accel)
|
||||
self.object:set_acceleration(accel)
|
||||
|
||||
if under.name ~= "air" then
|
||||
default.player_attached[self.attached] = false
|
||||
|
@ -50,8 +50,8 @@ local function eject_drops(drops, pos, radius)
|
||||
local obj = minetest.add_item(drop_pos, item)
|
||||
if obj then
|
||||
obj:get_luaentity().collect = true
|
||||
obj:setacceleration({x=0, y=-10, z=0})
|
||||
obj:setvelocity({x=math.random(-3, 3), y=10,
|
||||
obj:set_acceleration({x=0, y=-10, z=0})
|
||||
obj:set_velocity({x=math.random(-3, 3), y=10,
|
||||
z=math.random(-3, 3)})
|
||||
end
|
||||
count = count - max
|
||||
@ -117,12 +117,12 @@ local function entity_physics(pos, radius)
|
||||
|
||||
local objs = minetest.get_objects_inside_radius(pos, radius)
|
||||
for _, obj in pairs(objs) do
|
||||
local obj_pos = obj:getpos()
|
||||
local obj_vel = obj:getvelocity()
|
||||
local obj_pos = obj:get_pos()
|
||||
local obj_vel = obj:get_velocity()
|
||||
local dist = math.max(1, vector.distance(pos, obj_pos))
|
||||
|
||||
if obj_vel ~= nil then
|
||||
obj:setvelocity(calc_velocity(pos, obj_pos,
|
||||
obj:set_velocity(calc_velocity(pos, obj_pos,
|
||||
obj_vel, radius * 10))
|
||||
end
|
||||
|
||||
|
@ -65,7 +65,7 @@ if minetest.settings:get_bool("fixlight_command_enable") then
|
||||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
pos.x = math.floor(pos.x + 0.5)
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
pos.z = math.floor(pos.z + 0.5)
|
||||
|
@ -11,7 +11,8 @@ village.max_size = 6 -- Max chunk gen iterations
|
||||
-- Closest distance a village will spawn from another village
|
||||
village.min_spawn_dist = 512
|
||||
|
||||
village.pr = PseudoRandom(minetest.get_mapgen_params().seed)
|
||||
local mapseed = minetest.get_mapgen_setting("seed")
|
||||
village.pr = PseudoRandom(mapseed)
|
||||
|
||||
dofile(minetest.get_modpath("village") .. "/names.lua")
|
||||
dofile(minetest.get_modpath("village") .. "/generate.lua")
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
local spawn_pos = minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 0, z = 0}
|
||||
local spawn_radius = minetest.settings:get("static_spawn_radius") or 256
|
||||
local mapseed = minetest.get_mapgen_setting("seed")
|
||||
|
||||
-- Nodes
|
||||
|
||||
@ -30,7 +31,7 @@ minetest.register_node(
|
||||
on_construct = function(pos)
|
||||
minetest.remove_node(pos)
|
||||
|
||||
local pr = PseudoRandom(minetest.get_mapgen_params().seed
|
||||
local pr = PseudoRandom(mapseed
|
||||
+ pos.x + pos.y + pos.z)
|
||||
|
||||
village.spawn_village(pos, pr)
|
||||
@ -73,10 +74,10 @@ minetest.register_lbm(
|
||||
return
|
||||
end
|
||||
|
||||
local pr = PseudoRandom(minetest.get_mapgen_params().seed
|
||||
local pr = PseudoRandom(mapseed
|
||||
+ pos.x + pos.y + pos.z)
|
||||
|
||||
if ((minetest.get_mapgen_params().seed + pos.x + pos.y + pos.z) % 30) == 1 then
|
||||
if ((mapseed + pos.x + pos.y + pos.z) % 30) == 1 then
|
||||
local nearest = village.get_nearest_village(pos)
|
||||
|
||||
if nearest.dist > village.min_spawn_dist then
|
||||
|
@ -14,7 +14,8 @@ end
|
||||
local snow_enable = minetest.settings:get_bool("weather_snow_enable") or false
|
||||
|
||||
local weather_soundspec=nil
|
||||
local weather_pr=PseudoRandom(minetest.get_mapgen_params().seed + 2387)
|
||||
local mapseed = minetest.get_mapgen_setting("seed")
|
||||
local weather_pr=PseudoRandom(mapseed + 2387)
|
||||
|
||||
local sound_min_height = -20 -- Below -20m you can't hear weather
|
||||
|
||||
@ -27,7 +28,7 @@ local function play_sound()
|
||||
|
||||
if weather.weather == "storm" then
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
if player:getpos().y > sound_min_height then
|
||||
if player:get_pos().y > sound_min_height then
|
||||
weather_soundspec = minetest.sound_play(
|
||||
{
|
||||
name = "weather_storm",
|
||||
@ -41,7 +42,7 @@ local function play_sound()
|
||||
return
|
||||
elseif weather.weather == "snowstorm" then
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
if player:getpos().y > sound_min_height then
|
||||
if player:get_pos().y > sound_min_height then
|
||||
weather_soundspec = minetest.sound_play(
|
||||
{
|
||||
name = "weather_snowstorm",
|
||||
@ -130,12 +131,12 @@ minetest.register_globalstep(
|
||||
player:override_day_night_ratio(nil)
|
||||
end
|
||||
|
||||
local p=player:getpos()
|
||||
local p=player:get_pos()
|
||||
|
||||
if weather.weather == "storm" then
|
||||
if minetest.get_node_light({x=p.x, y=p.y+15, z=p.z}, 0.5) == 15 then
|
||||
local minpos = addvec(player:getpos(), {x = -15, y = 15, z = -15})
|
||||
local maxpos = addvec(player:getpos(), {x = 15, y = 10, z = 15})
|
||||
local minpos = addvec(player:get_pos(), {x = -15, y = 15, z = -15})
|
||||
local maxpos = addvec(player:get_pos(), {x = 15, y = 10, z = 15})
|
||||
minetest.add_particlespawner(
|
||||
{
|
||||
amount = 30,
|
||||
@ -166,8 +167,8 @@ minetest.register_globalstep(
|
||||
end
|
||||
|
||||
if minetest.get_node_light({x=p.x, y=p.y+15, z=p.z}, 0.5) == 15 then
|
||||
local minpos = addvec(player:getpos(), {x = -30, y = 20, z = -30})
|
||||
local maxpos = addvec(player:getpos(), {x = 30, y = 15, z = 30})
|
||||
local minpos = addvec(player:get_pos(), {x = -30, y = 20, z = -30})
|
||||
local maxpos = addvec(player:get_pos(), {x = 30, y = 15, z = 30})
|
||||
local vel = {x = 16.0, y = -8, z = 13.0}
|
||||
local acc = {x = -16.0, y = -8, z = -13.0}
|
||||
minetest.add_particlespawner(
|
||||
|
@ -50,7 +50,7 @@ minetest.register_entity(
|
||||
|
||||
local function attach_wielditem(player)
|
||||
local name = player:get_player_name()
|
||||
local pos = player:getpos()
|
||||
local pos = player:get_pos()
|
||||
|
||||
wielditem[name] = minetest.add_entity(pos, "wielditem:wielditem")
|
||||
wielditem[name]:set_attach(player, "right_arm", {x = -1.5, y = 5.7, z = 2.5}, {x = 90, y = -45, z = 270})
|
||||
|
Loading…
Reference in New Issue
Block a user