mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-01-23 09:11:27 +01:00
Ensure the bobber remains after it collides with something solid
This commit is contained in:
parent
9df4a57945
commit
5009d403c1
@ -175,6 +175,7 @@ local fish = function(itemstack, player, pointed_thing)
|
|||||||
ent = objs[n]:get_luaentity()
|
ent = objs[n]:get_luaentity()
|
||||||
if ent and ent._owner == player_name and ent.objtype=="fishing" then
|
if ent and ent._owner == player_name and ent.objtype=="fishing" then
|
||||||
noent = false
|
noent = false
|
||||||
|
mcl_util.remove_entity(ent)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -319,6 +320,7 @@ vl_projectile.register("mcl_fishing:flying_bobber_entity", {
|
|||||||
on_activate = mcl_throwing.on_activate,
|
on_activate = mcl_throwing.on_activate,
|
||||||
|
|
||||||
_vl_projectile = {
|
_vl_projectile = {
|
||||||
|
survive_collision = true,
|
||||||
behaviors = {
|
behaviors = {
|
||||||
vl_projectile.collides_with_solids,
|
vl_projectile.collides_with_solids,
|
||||||
},
|
},
|
||||||
@ -326,8 +328,6 @@ vl_projectile.register("mcl_fishing:flying_bobber_entity", {
|
|||||||
on_collide_with_solid = function(self, pos, node)
|
on_collide_with_solid = function(self, pos, node)
|
||||||
local player = self._owner
|
local player = self._owner
|
||||||
|
|
||||||
mcl_util.remove_entity(self)
|
|
||||||
|
|
||||||
-- Make sure the player field is valid for when we create the floating bobber
|
-- Make sure the player field is valid for when we create the floating bobber
|
||||||
if not player then return end
|
if not player then return end
|
||||||
|
|
||||||
@ -338,6 +338,11 @@ vl_projectile.register("mcl_fishing:flying_bobber_entity", {
|
|||||||
local ent = core.add_entity(pos, "mcl_fishing:bobber_entity"):get_luaentity()
|
local ent = core.add_entity(pos, "mcl_fishing:bobber_entity"):get_luaentity()
|
||||||
ent.player = player
|
ent.player = player
|
||||||
ent.child = true
|
ent.child = true
|
||||||
|
mcl_util.remove_entity(self)
|
||||||
|
else
|
||||||
|
local obj = self.object
|
||||||
|
obj:set_velocity(vector.zero())
|
||||||
|
obj:set_acceleration(vector.zero())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user