From 7685e6bef931962ec631d7e3c25bbad59b1caf9b Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sun, 6 May 2012 17:56:28 +0100 Subject: [PATCH] TG: 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) Revision: r3503 Author: VivianFoxfoot --- code/datums/configuration.dm | 6 +- code/modules/admin/verbs/ticklag.dm | 7 ++ .../mob/living/carbon/human/human_movement.dm | 3 +- code/modules/mob/living/carbon/human/life.dm | 48 +++++++++--- code/modules/mob/mob.dm | 73 ++++++++++++++++++- code/modules/mob/mob_defines.dm | 4 + code/modules/mob/mob_movement.dm | 19 ++++- config/config.txt | 7 +- 8 files changed, 149 insertions(+), 18 deletions(-) diff --git a/code/datums/configuration.dm b/code/datums/configuration.dm index ca79489d257..fd0bdb9d05a 100644 --- a/code/datums/configuration.dm +++ b/code/datums/configuration.dm @@ -33,6 +33,7 @@ var/allow_Metadata = 0 // Metadata is supported. var/popup_admin_pm = 0 //adminPMs to non-admins show in a pop-up 'reply' window when set to 1. var/Ticklag = 0.9 + var/Tickcomp = 0 var/list/mode_names = list() var/list/modes = list() // allowed modes @@ -300,6 +301,9 @@ if("ticklag") Ticklag = text2num(value) + if("tickcomp") + Tickcomp = 1 + if("require_heads_alive") config.require_heads_alive = value @@ -384,7 +388,7 @@ sqllogging = 1 else diary << "Unknown setting in configuration: '[name]'" -/* +/* //Don't touch this, we don't use it. DMTG /datum/configuration/proc/loadforumsql(filename) // -- TLE var/text = file2text(filename) diff --git a/code/modules/admin/verbs/ticklag.dm b/code/modules/admin/verbs/ticklag.dm index 8e370606110..933513c2a0c 100644 --- a/code/modules/admin/verbs/ticklag.dm +++ b/code/modules/admin/verbs/ticklag.dm @@ -16,6 +16,13 @@ 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 diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index b4f169fb0b4..214cd66d73a 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -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)) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 236d21b6fcc..b746b3e5182 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -457,10 +457,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 || (mutations & mNobreath)) @@ -964,7 +971,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 @@ -978,6 +985,22 @@ 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() @@ -1388,7 +1411,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) @@ -1436,14 +1469,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 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 90f333f4bf3..ca195daf554 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1086,53 +1086,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() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 06c4c9cd50a..9dc5bf406c8 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -290,3 +290,7 @@ the mob is also allowed to move without any sort of restriction. For instance, i var/being_strangled = 0 var/datum/preferences/storedpreferences = null + + var/geaslist = list() + + diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 2d4dcd96cb1..55c052db4b2 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -208,6 +208,14 @@ move_delay += mob.movement_delay() move_delay += mob.grav_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 @@ -343,7 +351,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)) @@ -389,7 +398,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))) @@ -405,7 +417,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) diff --git a/config/config.txt b/config/config.txt index 0fc6f68b5e2..2f20a535549 100644 --- a/config/config.txt +++ b/config/config.txt @@ -152,4 +152,9 @@ GUEST_JOBBAN 1 ##What address should banned people appeal ther ban at? Remember to escape the characters, if needed! # APPEAL_ADDRESS -->APPEAL ADDRESS HERE<-- ##Defines the ticklag for the world. 0.9 is the normal one, 0.5 is smoother. -TICKLAG 0.9 \ No newline at end of file +TICKLAG 0.9 + +## Defines if Tick Compensation is used. It results in a minor slowdown of movement of all mobs, but attempts to result in a level movement speed across all ticks. Recommended if tickrate is lowered. +TICKCOMP 0 + +