1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2024-12-29 16:00:16 +01:00

update abms and fix snowball entity, thanks to crabman77

This commit is contained in:
HybridDog 2015-12-30 10:31:23 +01:00
parent 0e52c53452
commit d8d79655af
2 changed files with 45 additions and 37 deletions

View File

@ -1,16 +1,3 @@
--Backwards Compatability.
minetest.register_abm({
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
interval = 1,
chance = 1,
action = function(pos, node)
minetest.add_node(pos, {name="default:snow"})
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
end,
})
-- Added to change dirt_with_snow to dirt if covered with blocks that don't let light through (sunlight_propagates) or have a light paramtype and liquidtype combination. ~ LazyJ, 2014_03_08 -- Added to change dirt_with_snow to dirt if covered with blocks that don't let light through (sunlight_propagates) or have a light paramtype and liquidtype combination. ~ LazyJ, 2014_03_08
minetest.register_abm({ minetest.register_abm({
@ -108,7 +95,9 @@ minetest.register_abm({
interval = 20, interval = 20,
chance = 4, chance = 4,
action = function(pos, node) action = function(pos, node)
if node.param2 > 0 then if node.param2 == 0 then
return
end
for l = 0,1 do for l = 0,1 do
for i = -1,1,2 do for i = -1,1,2 do
for _,p in pairs({ for _,p in pairs({
@ -127,8 +116,8 @@ minetest.register_abm({
if math.random(8) == 8 then if math.random(8) == 8 then
minetest.add_node(pos, {name="default:water_source"}) minetest.add_node(pos, {name="default:water_source"})
else else
minetest.add_node(pos, {name="default:ice", param2 = 0}) node.param2 = 0
end minetest.add_node(pos, node)
end end
end, end,
}) })
@ -141,6 +130,7 @@ minetest.register_abm({
neighbors = {"snow:moss"}, neighbors = {"snow:moss"},
interval = 20, interval = 20,
chance = 6, chance = 6,
catch_up = false,
action = function(pos, node) action = function(pos, node)
node.name = "default:mossycobble" node.name = "default:mossycobble"
minetest.add_node(pos, node) minetest.add_node(pos, node)
@ -206,3 +196,17 @@ minetest.register_abm({
--end --end
end end
}) })
--Backwards Compatability.
minetest.register_abm({
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
interval = 1,
chance = 1,
action = function(pos, node)
minetest.add_node(pos, {name="default:snow"})
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
end,
})

View File

@ -124,6 +124,7 @@ function snow_snowball_ENTITY.on_step(self, dtime)
if self.timer > 600 then if self.timer > 600 then
-- 10 minutes are too long for a snowball to fly somewhere -- 10 minutes are too long for a snowball to fly somewhere
self.object:remove() self.object:remove()
return
end end
if self.physical then if self.physical then
@ -164,12 +165,15 @@ function snow_snowball_ENTITY.on_step(self, dtime)
for _,v in pairs(minetest.get_objects_inside_radius(pos, 1.73)) do for _,v in pairs(minetest.get_objects_inside_radius(pos, 1.73)) do
if v ~= self.object then if v ~= self.object then
local entity_name = v:get_entity_name() local entity_name = v:get_entity_name()
if entity_name ~= "__builtin:item" if entity_name ~= "snow:snowball_entity"
and entity_name ~= "__builtin:item" and entity_name ~= "__builtin:item"
and entity_name ~= "snow:snowball_entity" then and entity_name ~= "gauges:hp_bar" then
if self.thrower then v:punch(
v:punch(minetest.get_player_by_name(self.thrower), 1, {full_punch_interval=1, damage_groups = {fleshy=1}}) (self.thrower and minetest.get_player_by_name(self.thrower))
end or self.object,
1,
{full_punch_interval=1, damage_groups = {fleshy=1}}
)
spawn_falling_node(pos, {name = "default:snow"}) spawn_falling_node(pos, {name = "default:snow"})
self.object:remove() self.object:remove()
return return