Désactive le lancé de boule de neige si le mod snow est detecté

Le mod snow implémente déjà cette fonctionnalité et de bien meilleure manière
This commit is contained in:
sys4-fr 2018-11-07 20:49:17 +01:00
parent 2dfcf120c1
commit 5abfe9569c
2 changed files with 28 additions and 27 deletions

View File

@ -2,3 +2,4 @@ default
mobs mobs
maptools? maptools?
zombie? zombie?
snow?

View File

@ -79,12 +79,12 @@ mobs:register_arrow("pmobs:snowball", {
}) })
-- snowball throwing item -- snowball throwing item
if not minetest.get_modpath("snow") then
local snowball_GRAVITY=9
local snowball_VELOCITY=19
local snowball_GRAVITY=9 -- shoot snowball
local snowball_VELOCITY=19 local mobs_shoot_snowball=function (item, player, pointed_thing)
-- shoot snowball
local mobs_shoot_snowball=function (item, player, pointed_thing)
local playerpos=player:getpos() local playerpos=player:getpos()
local obj=minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "pmobs:snowball") local obj=minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "pmobs:snowball")
local dir=player:get_look_dir() local dir=player:get_look_dir()
@ -93,10 +93,10 @@ local mobs_shoot_snowball=function (item, player, pointed_thing)
obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3}) obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3})
item:take_item() item:take_item()
return item return item
end end
-- override default snow to shoot snowballs -- override default snow to shoot snowballs
minetest.override_item("default:snow", { minetest.override_item("default:snow", {
--Disable placement prediction for snow. --Disable placement prediction for snow.
node_placement_prediction = "", node_placement_prediction = "",
@ -107,6 +107,6 @@ minetest.override_item("default:snow", {
end, end,
on_use = mobs_shoot_snowball on_use = mobs_shoot_snowball
}) })
end
mobs:alias_mob("mobs:yeti", "pmobs:yeti") mobs:alias_mob("mobs:yeti", "pmobs:yeti")