From 71bdaa16987e15d84c36faf658abb767f03d1052 Mon Sep 17 00:00:00 2001 From: Mloc-Argent Date: Tue, 13 Aug 2013 13:10:09 +0100 Subject: [PATCH] Fully reverts clickdelay change. It was immensely buggy with certain mobs, and server lag all but negated the benefits. Signed-off-by: Mloc-Argent --- code/game/atoms.dm | 21 ++++++++++--------- code/game/gamemodes/events/biomass.dm | 3 --- code/game/objects/items.dm | 8 +++---- code/game/objects/items/weapons/RCD.dm | 2 -- .../objects/items/weapons/extinguisher.dm | 6 ++++++ code/game/objects/structures/grille.dm | 6 ------ code/game/objects/structures/window.dm | 7 ------- code/modules/admin/verbs/diagnostics.dm | 3 +-- code/modules/mob/living/carbon/carbon.dm | 6 ------ code/modules/mob/living/carbon/human/human.dm | 4 ++-- .../living/carbon/human/human_attackhand.dm | 2 -- .../mob/living/carbon/monkey/monkey.dm | 2 -- code/modules/mob/login.dm | 2 +- code/modules/mob/mob.dm | 7 +++---- code/modules/mob/mob_defines.dm | 4 ++-- code/modules/mob/mob_grab.dm | 8 +++---- code/modules/mob/mob_helpers.dm | 4 ---- code/modules/mob/screen.dm | 12 +++++------ code/modules/projectiles/gun.dm | 2 +- 19 files changed, 40 insertions(+), 69 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index d160e662e84..784ba44c188 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -490,7 +490,7 @@ its easier to just keep the beam vertical. var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblClickNew() proc is being tested) -/*/atom/proc/DblClickNew() +/atom/proc/DblClickNew() if(!usr) return // TODO DOOHL: Intergrate params to new proc. Saved for another time because var/valid_place is a fucking brainfuck @@ -792,7 +792,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl if (in_range) if ( !animal.restrained() ) - attack_animal(animal)*/ + attack_animal(animal) /atom/DblClick(location, control, params) //TODO: DEFERRED: REWRITE if(!usr) return @@ -943,9 +943,9 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl // ------- ( CAN USE ITEM OR HAS 1 SECOND USE DELAY ) AND NOT CLICKING ON SCREEN ------- - if (usr.last_click + usr.click_delay < world.time) - usr.last_click = world.time - usr.click_delay = 0 + if (usr.next_move < world.time) + usr.prev_move = usr.next_move + usr.next_move = world.time + 10 else // ------- ALREADY USED ONE ITEM WITH USE DELAY IN THE PREVIOUS SECOND ------- return @@ -1109,9 +1109,10 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl // ------- ITEM INACESSIBLE OR CLICKING ON SCREEN ------- if (istype(src, /obj/screen)) // ------- IT'S THE HUD YOU'RE CLICKING ON ------- - usr.delay_click(2) - if (usr.last_click + usr.click_delay < world.time) - usr.last_click = world.time + usr.prev_move = usr.next_move + usr:lastDblClick = world.time + 2 + if (usr.next_move < world.time) + usr.next_move = world.time + 2 else return @@ -1143,7 +1144,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl src.hand_al(usr, usr.hand) else // ------- YOU ARE CLICKING ON AN OBJECT THAT'S INACCESSIBLE TO YOU AND IS NOT YOUR HUD ------- - if((LASER in usr:mutations) && usr:a_intent == "hurt" && usr.last_click + usr.click_delay < world.time) + if((LASER in usr:mutations) && usr:a_intent == "hurt" && world.time >= usr.next_move) // ------- YOU HAVE THE LASER MUTATION, YOUR INTENT SET TO HURT AND IT'S BEEN MORE THAN A DECISECOND SINCE YOU LAS TATTACKED ------- var/turf/T = get_turf(usr) @@ -1168,7 +1169,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl spawn( 1 ) A.process() - usr.delay_click(6) + usr.next_move = world.time + 6 return /atom/proc/ShiftClick(var/mob/M as mob) diff --git a/code/game/gamemodes/events/biomass.dm b/code/game/gamemodes/events/biomass.dm index 7bc6cf92568..d1508221f7c 100644 --- a/code/game/gamemodes/events/biomass.dm +++ b/code/game/gamemodes/events/biomass.dm @@ -22,9 +22,6 @@ /obj/effect/biomass/attackby(obj/item/weapon/W as obj, mob/user as mob) if (!W || !user || !W.type) return - - user.delay_click(10) - switch(W.type) if(/obj/item/weapon/circular_saw) del src if(/obj/item/weapon/kitchen/utensil/knife) del src diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 281c23f0fd0..c55684eb197 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -131,7 +131,8 @@ else if(isliving(src.loc)) return - user.delay_click(2) + user.lastDblClick = world.time + 2 + user.next_move = world.time + 2 src.pickup(user) add_fingerprint(user) user.put_in_active_hand(src) @@ -165,7 +166,8 @@ if(istype(src.loc, /mob/living)) return src.pickup(user) - user.delay_click(2) + user.lastDblClick = world.time + 2 + user.next_move = world.time + 2 user.put_in_active_hand(src) return @@ -227,8 +229,6 @@ log_attack("[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(src.damtype)])" ) msg_admin_attack("ATTACK: [user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])") //BS12 EDIT ALG - user.delay_click(10) - //spawn(1800) // this wont work right // M.lastattacker = null ///////////////////////// diff --git a/code/game/objects/items/weapons/RCD.dm b/code/game/objects/items/weapons/RCD.dm index 6308189d8c2..a80a892af6f 100644 --- a/code/game/objects/items/weapons/RCD.dm +++ b/code/game/objects/items/weapons/RCD.dm @@ -86,8 +86,6 @@ RCD if(!(istype(A, /turf) || istype(A, /obj/machinery/door/airlock))) return 0 - user.delay_click(10) - switch(mode) if(1) if(istype(A, /turf/space)) diff --git a/code/game/objects/items/weapons/extinguisher.dm b/code/game/objects/items/weapons/extinguisher.dm index 6a26f70e1f5..77cf343de21 100644 --- a/code/game/objects/items/weapons/extinguisher.dm +++ b/code/game/objects/items/weapons/extinguisher.dm @@ -14,6 +14,7 @@ m_amt = 90 attack_verb = list("slammed", "whacked", "bashed", "thunked", "battered", "bludgeoned", "thrashed") var/max_water = 50 + var/last_use = 1.0 var/safety = 1 var/sprite_name = "fire_extinguisher" @@ -66,6 +67,11 @@ usr << "\red \The [src] is empty." return + if (world.time < src.last_use + 20) + return + + src.last_use = world.time + playsound(src.loc, 'sound/effects/extinguish.ogg', 75, 1, -3) var/direction = get_dir(src,target) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 48c51cdacff..c2514a11241 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -35,7 +35,6 @@ user.visible_message("[user] kicks [src].", \ "You kick [src].", \ "You hear twisting metal.") - user.delay_click(10) if(shock(user, 70)) return @@ -52,7 +51,6 @@ user.visible_message("[user] mangles [src].", \ "You mangle [src].", \ "You hear twisting metal.") - user.delay_click(10) if(!shock(user, 70)) health -= 5 @@ -66,7 +64,6 @@ user.visible_message("[user] smashes against [src].", \ "You smash against [src].", \ "You hear twisting metal.") - user.delay_click(10) health -= rand(2,3) healthcheck() @@ -79,7 +76,6 @@ M.visible_message("[M] smashes against [src].", \ "You smash against [src].", \ "You hear twisting metal.") - M.delay_click(10) health -= M.melee_damage_upper healthcheck() @@ -164,10 +160,8 @@ else if(istype(W, /obj/item/weapon/shard)) health -= W.force * 0.1 - user.delay_click(10) else if(!shock(user, 70)) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) - user.delay_click(10) switch(W.damtype) if("fire") health -= W.force diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 65fefec03c7..28791229725 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -104,19 +104,16 @@ new /obj/item/weapon/shard(loc) if(reinf) new /obj/item/stack/rods(loc) del(src) - usr.delay_click(10) else if (usr.a_intent == "hurt") playsound(src.loc, 'glassknock.ogg', 80, 1) usr.visible_message("\red [usr.name] bangs against the [src.name]!", \ "\red You bang against the [src.name]!", \ "You hear a banging sound.") - usr.delay_click(5) else playsound(src.loc, 'glassknock.ogg', 80, 1) usr.visible_message("[usr.name] knocks on the [src.name].", \ "You knock on the [src.name].", \ "You hear a knocking sound.") - usr.delay_click(5) return @@ -131,11 +128,9 @@ new /obj/item/weapon/shard(loc) if(reinf) new /obj/item/stack/rods(loc) del(src) - user.delay_click(10) else //for nicer text~ user.visible_message("[user] smashes into [src]!") playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1) - user.delay_click(10) /obj/structure/window/attack_alien(mob/user as mob) @@ -163,7 +158,6 @@ var/mob/living/M = G.affecting var/state = G.state del(W) //gotta delete it here because if window breaks, it won't get deleted - user.delay_click(10) switch (state) if(1) M.apply_damage(7) @@ -203,7 +197,6 @@ else if(W.damtype == BRUTE || W.damtype == BURN) hit(W.force) - user.delay_click(10) if(health <= 7) anchored = 0 update_nearby_icons() diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index dad75f8219a..1e328970fd8 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -62,7 +62,7 @@ */ /client/proc/fix_next_move() -/* set category = "Debug" + set category = "Debug" set name = "Unfreeze Everyone" var/largest_move_time = 0 var/largest_click_time = 0 @@ -90,7 +90,6 @@ message_admins("[key_name_admin(largest_click_mob)] had the largest click delay with [largest_click_time] frames / [largest_click_time/10] seconds!", 1) message_admins("world.time = [world.time]", 1) feedback_add_details("admin_verb","UFE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - */ return /client/proc/radio_report() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 2347ca6b23c..061f06fe7d8 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -49,11 +49,7 @@ . = ..() /mob/living/carbon/attack_hand(mob/M as mob) - if(!istype(M, /mob/living/carbon)) return - - M.delay_click(10) - if (hasorgans(M)) var/datum/organ/external/temp = M:organs_by_name["r_hand"] if (M.hand) @@ -80,8 +76,6 @@ /mob/living/carbon/attack_paw(mob/M as mob) if(!istype(M, /mob/living/carbon)) return - M.delay_click(10) - for(var/datum/disease/D in viruses) if(D.spread_by_touch()) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 89427c501e8..8c41ec8c9a3 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1121,9 +1121,9 @@ mob/living/carbon/human/yank_out_object() set desc = "Remove an embedded item at the cost of bleeding and pain." set src in view(1) - if(!isliving(usr) || usr.last_click + usr.click_delay > world.time) + if(!isliving(usr) || usr.next_move > world.time) return - usr.delay_click(20) + usr.next_move = world.time + 20 if(usr.stat == 1) usr << "You are unconcious and cannot do that!" diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 0c6b8172a28..cb161b9d944 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -12,8 +12,6 @@ ..() - M.delay_click(10) - if((M != src) && check_shields(0, M.name)) visible_message("\red [M] attempted to touch [src]!") return 0 diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index add85c9d034..a073dfa10d5 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -217,8 +217,6 @@ M << "No attacking people at spawn, you jackass." return - M.delay_click(10) - if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) var/obj/item/clothing/gloves/G = M.gloves if(G.cell) diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index be1fb566b7a..1c3498802d1 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -33,7 +33,7 @@ if(hud_used) del(hud_used) //remove the hud objects hud_used = new /datum/hud(src) - last_click = world.time + next_move = 1 sight |= SEE_SELF ..() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 9801ea9f6c5..08aad3d7ad6 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -83,7 +83,6 @@ //This is awful /mob/attackby(obj/item/weapon/W as obj, mob/user as mob) - user.delay_click(10) //Holding a balloon will shield you from an item that is_sharp() ... cause that makes sense if (user.intent != "harm") if (istype(src.l_hand,/obj/item/latexballon) && src.l_hand:air_contents && is_sharp(W)) @@ -906,9 +905,9 @@ mob/verb/yank_out_object() set desc = "Remove an embedded item at the cost of bleeding and pain." set src in view(1) - if(!isliving(usr) || usr.last_click + usr.click_delay > world.time) + if(!isliving(usr) || usr.next_move > world.time) return - usr.delay_click(20) + usr.next_move = world.time + 20 if(usr.stat == 1) usr << "You are unconcious and cannot do that!" @@ -961,4 +960,4 @@ mob/verb/yank_out_object() pinned -= O if(!pinned.len) anchored = 0 - return 1 + return 1 diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 6cbd091c0c1..b82f6736bbe 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -54,8 +54,8 @@ var/sdisabilities = 0 //Carbon var/disabilities = 0 //Carbon var/atom/movable/pulling = null - var/last_click = null - var/click_delay = 0 + var/next_move = null + var/prev_move = null var/monkeyizing = null //Carbon var/other = 0.0 var/hand = null diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index 07a07500083..5363c05a116 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -128,7 +128,7 @@ return if(killing) return - if (assailant.last_click + assailant.click_delay > world.time) + if (assailant.next_move > world.time) return if ((!( assailant.canmove ) || assailant.lying)) //SN src = null @@ -140,7 +140,7 @@ if (!( killing )) assailant.visible_message("\red [assailant] has temporarily tightened \his grip on [affecting]!") //Foreach goto(97) - assailant.delay_click(10) + assailant.next_move = world.time + 10 //affecting.stunned = max(2, affecting.stunned) //affecting.paralysis = max(1, affecting.paralysis) affecting.losebreath = min(affecting.losebreath + 1, 3) @@ -162,8 +162,6 @@ if(killing) return - assailant.delay_click(10) - switch(S.id) if(1.0) if (state < 2) @@ -237,7 +235,7 @@ assailant.attack_log += text("\[[time_stamp()]\] Strangled (kill intent) [affecting.name] ([affecting.ckey])") log_attack("[assailant.name] ([assailant.ckey]) Strangled (kill intent) [affecting.name] ([affecting.ckey])") - assailant.delay_click(10) + assailant.next_move = world.time + 10 affecting.losebreath += 1 else assailant.visible_message("\red [assailant] was unable to tighten \his grip on [affecting]'s neck!") diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 981d03962e7..29b2bfeac3c 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -454,7 +454,3 @@ var/list/intents = list("help","disarm","grab","hurt") hud_used.action_intent.icon_state = "harm" else hud_used.action_intent.icon_state = "help" - -/mob/proc/delay_click(var/delay) - src.click_delay = max(src.click_delay, delay) - return src.click_delay diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index 441a0d961fe..5742b95cb2d 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -600,9 +600,9 @@ set name = "Resist" set category = "IC" - if(!isliving(usr) || usr.last_click + usr.click_delay > world.time) + if(!isliving(usr) || usr.next_move > world.time) return - usr.delay_click(20) + usr.next_move = world.time + 20 var/mob/living/L = usr @@ -670,7 +670,7 @@ if(iscarbon(L)) var/mob/living/carbon/C = L if( C.handcuffed ) - C.delay_click(100) + C.next_move = world.time + 100 C.last_special = world.time + 100 C << "\red You attempt to unbuckle yourself. (This will take around 2 minutes and you need to stand still)" for(var/mob/O in viewers(L)) @@ -704,7 +704,7 @@ // breakout_time++ //Harder to get out of welded lockers than locked lockers //okay, so the closet is either welded or locked... resist!!! - usr.delay_click(100) + usr.next_move = world.time + 100 L.last_special = world.time + 100 L << "\red You lean on the back of \the [C] and start pushing the door open. (this will take about [breakout_time] minutes)" for(var/mob/O in viewers(usr.loc)) @@ -757,7 +757,7 @@ else if(iscarbon(L)) var/mob/living/carbon/CM = L if(CM.handcuffed && CM.canmove && (CM.last_special <= world.time)) - CM.delay_click(100) + CM.next_move = world.time + 100 CM.last_special = world.time + 100 if(isalienadult(CM) || (HULK in usr.mutations))//Don't want to do a lot of logic gating here. usr << "\red You attempt to break your handcuffs. (This will take around 5 seconds and you need to stand still)" @@ -795,7 +795,7 @@ CM.handcuffed = null CM.update_inv_handcuffed() else if(CM.legcuffed && CM.canmove && (CM.last_special <= world.time)) - CM.delay_click(100) + CM.next_move = world.time + 100 CM.last_special = world.time + 100 if(isalienadult(CM) || (HULK in usr.mutations))//Don't want to do a lot of logic gating here. usr << "\red You attempt to break your legcuffs. (This will take around 5 seconds and you need to stand still)" diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 7eabd7e59c2..35af50877cb 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -131,7 +131,7 @@ in_chamber.loc = get_turf(user) in_chamber.starting = get_turf(user) in_chamber.shot_from = src - usr.delay_click(4) + user.next_move = world.time + 4 in_chamber.silenced = silenced in_chamber.current = curloc in_chamber.yo = targloc.y - curloc.y