mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
http://code.google.com/p/tgstation13/issues/detail?id=440 ◘The problem: People being able to move while resting/lying ◘What caused it: When a user decided to press "rest", a single variable, resting, was switched from 0 to 1. Through life.dm procs, when the handle_regular_status() proc saw the mob resting && his weakness being 0 or less, it would just give him 2 seconds of being-weak, through Weaken(2). Later on, the proc called update_canmove() to see if the guy had the ability to move due to weakness but also due to reagents/drugs/sleep etc. At every tick, this proc also reduced mob.weakness by 1. The chain that led to the problem was: ○User decides to rest ○resting is set to 1, handle_regular_status_updates() runs ○Proc sees that the user's resting var == 1. Does mob.weakness = 2 ○Proc handles weakness. mob.weakness -= 1. It is now 1. ○update_canmove() is blind to resting, though sees that there's weakness. Sets canmove to 0 ○Proc runs again the following second ○Proc sees user is resting. ○mob.weakness <= 0 fails, since it's 1 from the last run. Weakness stays at 1. ○Proc handles weakness, mob.weakness-=1. It is now 0. ○update_canmove() now sees that there's no weakness, and sets canmove to 1, even though the user is still resting & lying ○For a second, the user is able to roll around on his lying butt ○Proc runs again, giving Weaken(2) and disables movement again, and the circle repeats. ◘How it got fixed: Made update_canmove() not blind to resting. I don't like this solution, as resting still equals weakening and there's wasted processing, albeit miniscule. I will try to work on something better. ◘Sleep can now go over 1 again, some dumb shit did not realise this and led to sleep being weak as hell. You can now put people to permanent sleep through anaesthetic gasses and toxins. Deciding to sleep will put you out for 20. Deciding to faint will put you out for 10. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3442 316c924e-a436-60f5-8080-3fe189b3f50e