set hidden = 1
world << "Throwing Snowball at [M.name]..."
var/obj/SNOWBALL/S = new
S.s_target = M
icon = 'items_obj.dmi'
icon_state = "SBALL"
density = 0
layer = M_LAYER+10
mouse_opacity = 0
world << "SNOWBALL CREATED!"
world << "SNOWBALL TIMEOUT!"
world << "NO TARGET!"
world << "Target [s_target.name]"
world << "Crossing [O.name]!"
if(O == s_target)
world << "Hit Target!"
src.icon_state = "SBALL_HIT"
spawn(30) del src
So I'm trying to make a simple little snowball toy function in my game, but I'm not used to making a proc like this.
It's suppose to spawn the snowball object infront of the user, have it travel to the target, change its icon state to an animation of the snowball falling apart, and then delete itself.
What I'm seeing in my game from the above code though is...
The snowball spawns where its suppose to.
It travels to the target correctly.
The snowball reaches the target but just hovers over them and doesn't trigger the Cross() proc.
With the above code and the outputs provided, the only output I get is...
Throwing Snowball at TARGET_NAME...
until the timeout function triggers and deletes it.
I've also noticed that if I run this more than once, the 2 snowballs dont seem to be able to pass each other despite having density = 0. Likewise, if I set my own density to 0, I'm unable to walk through them.
So I feel like I'm definitely doing something wrong with this proc here. Anyone happen to have any idea what?