ID:160645
 
So, i have some effects in my game that "push you back". I currently use step() to step you in M's direction, but it seems to reset your inactivity(which i don't want). Is there any way i can prevent that from hapening?
I guess changing there loc but it wouldn't look liek they are being pushed and im not sure but i think that might change the inactivity.
In response to A.T.H.K
Well, i think that step() calls the Move() Proc, which isn't a good thing for 1 reason.

mob
Move()
if(AFK)
AFK = 0
world << "[src] has returned from being AFK"
overlays -= 'AFK.dmi'
client.show_verb_panel = 1
immortal = 0
return

#include <deadron/eventloop>



mob
base_EventCycle(world_time)
if( !(client) )return
if(isplayer)
SaveP()
var/a = 5 * 600
if(client.inactivity > a && !(AFK) )
AFK=1
immortal = 1
world << "[src] has gone AFK."
overlays += 'AFK.dmi'
client.show_verb_panel=0
if(client.inactivity > a && AFK)
src << "You are currently AFK. Please press an arrow key to Reset your AFK status to 0"
src << output(null,"Exam")


BaseCamp
GameController
cycle_delay = 3000


step seems to call the move proc, which in end makes my guy return from being AFK and that makes him vulnerable to attacks. I guess i'll have to add a check to see if they're AFK or not.
In response to Axerob
Why wouldn't step() call Move()? It's kind of obvious that it would.
In response to Axerob
But it should call atom/movable.Move(), which is an object function, not that of the client. client.inactivity will remain unaffected, so if you designed your AFK system right, you'd be in good shape.

step() calling Move() is a very good thing. Set up your system to use client.Move() instead, or just stick with client.inactivity.
You shouldn't have players being effected by anything or attacked while afk.
You can prevent your AFK system from resetting players by overriding client/Move() in favor of mob/Move(). The former is only called when the player initiates movement; the latter can be called anytime the player is forced to move.

I'm also assuming you're setting loc directly in a lot of cases. This should be avoided: you should always call mob.Move(turf) instead of setting the loc variable directly as the former will check if the player can actually move to that position. If the player can't, Move() will return 0 and you can perform other actions.

mob/verb/teleport(var/x as num, var/y as num, var/z as num)
var/turf/T = locate(x, y, z)
if(!T)
usr << "The specified location does not exist!"
else if(!Move(T))
usr << "You were unable to move to the requested location."
else
usr << "You teleport to [x],[y],[z]!"


Also if you are pushing a player back more than one tile, it may be beneficial to directly use mob.Move() to set the player back by multiple tiles at once. (after performing your own calculations of course to see if it's possible to do this; if you don't do this obstacles could prevent your 'push' command from working)
In response to Bakasensei
bad call mate, what if a player called AFK in a fight? Theyd be using your idea to protect themselves
In response to Lugia319
I don't think Axerob is stupid enough to allow players be in AFK mode while they are fighting.
In response to Jemai1
i know, but its a verb, so you could turn it on if you wanted to eh?
In response to Lugia319
Not really... if you look good enough you'll notice you can only go AFK if you got 5 * 600 ticks, therefore, you need to wait at least 5 minutes to go AFK. By then, if you wouldn't produce any activity and get attacked the whole time, you should be pretty much dead.
In response to Lugia319
Never ever forget if().
mob
var
AFK
in_a_fight
verb
AFK()
if(!AFK&&in_a_fight)
usr << "Lugia319, you're in a fight. You can't go AFK. :\"
else
AFK = !AFK
//toggle AFK
In response to Jemai1
There isn't a verb to go AFK, using deadron's eventcycle, i check to see if your inactivity is greater than 5 minutes, then you go afk.

But yeah, i just did this.

if(!AFK)move(src,M.dir)