diff --git a/api/internal.lua b/api/internal.lua index 6b3113c..09ecc5a 100644 --- a/api/internal.lua +++ b/api/internal.lua @@ -138,7 +138,11 @@ local function cast_for_collisions(self) local props = ref:get_properties() -- TODO collision with source should be an optional parameter -- TODO non-physical entities should also be an optional parameter (use arrows to pick up remote items!) - if ref ~= self._source_obj and ref ~= obj and props.physical and props.collide_with_objects then + if + ref ~= self._source_obj + and ref ~= obj + and (minetest.is_player(ref) or (props.physical and props.collide_with_objects)) + then return handle_object_collision(self, pointed_thing) end elseif pointed_thing.type == "node" then diff --git a/api/math.lua b/api/math.lua index 339b333..dc46bea 100644 --- a/api/math.lua +++ b/api/math.lua @@ -115,6 +115,7 @@ function ballistics.ballistic_cast(def) local pos = assert(def.pos, "must specify a starting position") local objects = futil.coalesce(def.objects, true) local objects_physical = futil.coalesce(def.objects_physical, true) + local objects_player = futil.coalesce(def.objects_player, true) local objects_collide_with_objects = futil.coalesce(def.objects_collide_with_objects, true) local liquids = futil.coalesce(def.liquids, true) local nodes_walkable = futil.coalesce(def.walkable, true) @@ -135,8 +136,11 @@ function ballistics.ballistic_cast(def) elseif pointed_thing.type == "object" then local props = pointed_thing.ref:get_properties() if - ((not objects_physical) or props.physical) - and ((not objects_collide_with_objects) or props.collide_with_objects) + ( + not objects_physical + or props.physical + or (objects_player and minetest.is_player(pointed_thing.ref)) + ) and ((not objects_collide_with_objects) or props.collide_with_objects) then return pointed_thing end