Adds tickcomp, an attempt to make mob movement speeds level across all tickrates. Works pretty well.

Adds a (disabled) framework for making people drop where they're stunned without waiting for the next tick
Shuffles sleeping and resting, making them cause effects of their own rather than just relying on 2 ticks of paralysis or whatever.
You now stand up before being able to move again (called in canmove)
Reduces slip chance from 50 to 0 when knocked out (more in line with the comments in the code, and it just makes more sense)


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3503 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
VivianFoxfoot@gmail.com
2012-04-25 17:48:50 +00:00
parent 0d14417a07
commit 6f81fcb844
8 changed files with 148 additions and 31 deletions
+9
View File
@@ -16,7 +16,16 @@
message_admins("[key_name(src)] has modified world.tick_lag to [newtick]", 0)
world.tick_lag = newtick
feedback_add_details("admin_verb","TICKLAG") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
switch(alert("Enable Tick Compensation?","Tick Comp is currently: [config.Tickcomp]","Yes","No"))
if("Yes")
config.Tickcomp = 1
else
config.Tickcomp = 0
return
src << "\red Error: ticklag(): Invalid world.ticklag value. No changes made."
return
@@ -19,7 +19,8 @@
/mob/living/carbon/human/Process_Spaceslipping(var/prob_slip = 5)
//If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such.
if(stat) prob_slip += 50
if(stat)
prob_slip = 0 // Changing this to zero to make it line up with the comment, and also, make more sense.
//Do we have magboots or such on if so no slip
if(istype(shoes, /obj/item/clothing/shoes/magboots) && (shoes.flags & NOSLIP))
+37 -24
View File
@@ -330,10 +330,17 @@
return null
update_canmove()
if(paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath))
if(sleeping || paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath))
canmove = 0
else
lying = 0
canmove = 1
/* for(var/obj/effect/stop/S in geaslist)
if(S.victim == src)
geaslist -= S
del(S)
*/
handle_breath(datum/gas_mixture/breath)
if(nodamage)
@@ -714,17 +721,6 @@
if(getOxyLoss() > 50) Paralyse(3)
if(sleeping)
adjustHalLoss(-5)
if(paralysis <= 0)
Paralyse(2)
if (prob(10) && health && !hal_crit) spawn(0) emote("snore")
sleeping--
if(resting)
if(weakened <= 0)
Weaken(2)
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
else if(health < config.health_threshold_crit)
@@ -740,7 +736,7 @@
if (silent)
silent--
if (paralysis || stunned || weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc.
if (resting || sleeping || paralysis || stunned || weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc.
if (stunned > 0)
AdjustStunned(-1)
stat = 0
@@ -749,12 +745,26 @@
lying = 1
stat = 0
if (paralysis > 0)
if(sleeping > 0)
handle_dreams()
AdjustParalysis(-1)
blinded = 1
lying = 1
stat = 1
if (sleeping > 0)
handle_dreams()
adjustHalLoss(-5)
blinded = 1
lying = 1
stat = 1
if (prob(10) && health && !hal_crit)
spawn(0)
emote("snore")
sleeping--
if(resting)
lying = 1
stat = 0
var/h = hand
hand = 0
drop_item()
@@ -1111,7 +1121,17 @@
if(!M.nodamage)
M.adjustBruteLoss(5)
nutrition += 10
/* One day.
if(nutrition <= 100)
if (prob (1))
src << "\red Your stomach rumbles."
if(nutrition <= 50)
if (prob (25))
bruteloss++
if (prob (5))
src << "You feel very weak."
weakened += rand(2, 3)
*/
handle_changeling()
if (mind)
if (mind.special_role == "Changeling" && changeling)
@@ -1122,14 +1142,7 @@
/*
// Commented out so hunger system won't be such shock
// Damage and effect from not eating
if(nutrition <= 50)
if (prob (0.1))
src << "\red Your stomach rumbles."
if (prob (10))
bruteloss++
if (prob (5))
src << "You feel very weak."
weakened += rand(2, 3)
*/
/*
snippets
+72 -1
View File
@@ -990,53 +990,124 @@ note dizziness decrements automatically in the mob's Life() proc.
/mob/proc/IsAdvancedToolUser()//This might need a rename but it should replace the can this mob use things check
return 0
/mob/proc/createGeas()
/*
var/obj/effect/stop/S
for(var/obj/effect/stop/temp in loc)
if(temp.victim == src)
S = temp
if(!S)
S = new /obj/effect/stop
S.victim = src
S.loc = src.loc
geaslist += S
*/
return
/mob/proc/Stun(amount)
if(canstun)
stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun
if(stunned)
createGeas()
else
if(istype(src, /mob/living/carbon/alien)) // add some movement delay
var/mob/living/carbon/alien/Alien = src
Alien.move_delay_add = min(Alien.move_delay_add + round(amount / 5), 10) // a maximum delay of 10
Alien.move_delay_add = min(Alien.move_delay_add + round(amount / 2), 10) // a maximum delay of 10
return
/mob/proc/SetStunned(amount) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned"
if(canstun)
stunned = max(amount,0)
if(stunned)
createGeas()
return
/mob/proc/AdjustStunned(amount)
if(canstun)
stunned = max(stunned + amount,0)
if(stunned)
createGeas()
return
/mob/proc/Weaken(amount)
if(canweaken)
weakened = max(max(weakened,amount),0)
if(weakened)
createGeas()
return
/mob/proc/SetWeakened(amount)
if(canweaken)
weakened = max(amount,0)
if(weakened)
createGeas()
return
/mob/proc/AdjustWeakened(amount)
if(canweaken)
weakened = max(weakened + amount,0)
if(weakened)
createGeas()
return
/mob/proc/Paralyse(amount)
paralysis = max(max(paralysis,amount),0)
if(paralysis)
createGeas()
return
/mob/proc/SetParalysis(amount)
paralysis = max(amount,0)
return
if(paralysis)
createGeas()
/mob/proc/AdjustParalysis(amount)
paralysis = max(paralysis + amount,0)
if(paralysis)
createGeas()
return
/mob/proc/Sleeping(amount)
sleeping = max(max(sleeping,amount),0)
if(sleeping)
createGeas()
return
/mob/proc/SetSleeping(amount)
sleeping = max(amount,0)
return
if(sleeping)
createGeas()
/mob/proc/AdjustSleeping(amount)
sleeping = max(sleeping + amount,0)
if(sleeping)
createGeas()
return
/mob/proc/Resting(amount)
resting = max(max(resting,amount),0)
if(resting)
createGeas()
return
/mob/proc/SetResting(amount)
resting = max(amount,0)
return
if(resting)
createGeas()
/mob/proc/AdjustResting(amount)
resting = max(resting + amount,0)
if(resting)
createGeas()
return
// ++++ROCKDTBEN++++ MOB PROCS -- Ask me before touching
/mob/proc/getBruteLoss()
+3 -1
View File
@@ -271,4 +271,6 @@ the mob is also allowed to move without any sort of restriction. For instance, i
var/digitalcamo = 0 // Can they be tracked by the AI?
var/datum/preferences/storedpreferences = null
var/datum/preferences/storedpreferences = null
var/geaslist = list()
+17 -3
View File
@@ -186,6 +186,7 @@
return 0
move_delay = world.time//set move delay
switch(mob.m_intent)
if("run")
if(mob.drowsyness > 0)
@@ -199,6 +200,14 @@
move_delay += 7
move_delay += mob.movement_delay()
if(config.Tickcomp)
move_delay -= 1.3
var/tickcomp = ((1/(world.tick_lag))*1.3)
move_delay = move_delay + tickcomp
//We are now going to move
moving = 1
//Something with pulling things
@@ -334,7 +343,8 @@
///Return 1 for movement 0 for none
/mob/proc/Process_Spacemove(var/check_drift = 0)
//First check to see if we can do things
if(restrained()) return 0
if(restrained())
return 0
/*
if(istype(src,/mob/living/carbon))
@@ -380,7 +390,10 @@
break
//Nothing to push off of so end here
if(!dense_object) return 0
if(!dense_object)
return 0
//Check to see if we slipped
if(prob(Process_Spaceslipping(5)))
@@ -396,7 +409,8 @@
/mob/proc/Process_Spaceslipping(var/prob_slip = 5)
//Setup slipage
//If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such.
if(stat) prob_slip += 50
if(stat)
prob_slip = 0 // Changing this to zero to make it line up with the comment.
prob_slip = round(prob_slip)
return(prob_slip)