Syntax / Format:
flick(icon or state, atom, override)
if override == 1
flick to this icon_state animation right away, regardless of what is happening
if override == 0
flick to this icon_state animation only if we are not currently playing the requested icon_state animation
Example:
The following example will keep trying to flick m into the attack icon_state as fast as world.tick_lag
turf/wall
density = 1
Enter(mob/m)
if(ismob(m))
flick("attack", m) //we will never actually see this animation as long as the mob keeps trying to enter the wall
return ..()
The following example is a work around:
mob/var/tmp/flicked = ""
turf/wall
density = 1
Enter(mob/m)
if(ismob(m))
if(!m.flicked)
m.flicked = "attack"
flick("attack", m)
spawn(8) if(m) m.flicked = ""//wait the length of the animation and then reset flick... have to check if m is still connected and alive though
return ..()
This requires an extra variable to keep track of on every single mob you'd want to have this type of functionality.
Requested functionality:
turf/wall
density = 1
Enter(mob/m)
if(ismob(m))
flick("attack", m, 0) // optional argument indicates we do not want to override the animation if it is already in "attack" icon_state
return ..()
Thanks for reading and considering.