Reactiveness update part 1: Removed click delays from most objects, keeping them on for attacks and breaking windows/grilles.

Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
Mloc-Argent
2013-07-25 18:30:24 +01:00
parent f357d0c421
commit 9d2e107005
14 changed files with 50 additions and 39 deletions

View File

@@ -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) 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 if(!usr) return
// TODO DOOHL: Intergrate params to new proc. Saved for another time because var/valid_place is a fucking brainfuck // 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 (in_range)
if ( !animal.restrained() ) if ( !animal.restrained() )
attack_animal(animal) attack_animal(animal)*/
/atom/DblClick(location, control, params) //TODO: DEFERRED: REWRITE /atom/DblClick(location, control, params) //TODO: DEFERRED: REWRITE
if(!usr) return 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 ------- // ------- ( CAN USE ITEM OR HAS 1 SECOND USE DELAY ) AND NOT CLICKING ON SCREEN -------
if (usr.next_move < world.time) if (usr.last_click + usr.click_delay < world.time)
usr.prev_move = usr.next_move usr.last_click = world.time
usr.next_move = world.time + 10 usr.click_delay = 0
else else
// ------- ALREADY USED ONE ITEM WITH USE DELAY IN THE PREVIOUS SECOND ------- // ------- ALREADY USED ONE ITEM WITH USE DELAY IN THE PREVIOUS SECOND -------
return return
@@ -1109,10 +1109,9 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
// ------- ITEM INACESSIBLE OR CLICKING ON SCREEN ------- // ------- ITEM INACESSIBLE OR CLICKING ON SCREEN -------
if (istype(src, /obj/screen)) if (istype(src, /obj/screen))
// ------- IT'S THE HUD YOU'RE CLICKING ON ------- // ------- IT'S THE HUD YOU'RE CLICKING ON -------
usr.prev_move = usr.next_move usr.delay_click(2)
usr:lastDblClick = world.time + 2 if (usr.last_click + usr.click_delay < world.time)
if (usr.next_move < world.time) usr.last_click = world.time
usr.next_move = world.time + 2
else else
return return
@@ -1144,7 +1143,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
src.hand_al(usr, usr.hand) src.hand_al(usr, usr.hand)
else else
// ------- YOU ARE CLICKING ON AN OBJECT THAT'S INACCESSIBLE TO YOU AND IS NOT YOUR HUD ------- // ------- 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" && world.time >= usr.next_move) if((LASER in usr:mutations) && usr:a_intent == "hurt" && usr.last_click + usr.click_delay < world.time)
// ------- YOU HAVE THE LASER MUTATION, YOUR INTENT SET TO HURT AND IT'S BEEN MORE THAN A DECISECOND SINCE YOU LAS TATTACKED ------- // ------- 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) var/turf/T = get_turf(usr)
@@ -1169,7 +1168,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
spawn( 1 ) spawn( 1 )
A.process() A.process()
usr.next_move = world.time + 6 usr.delay_click(6)
return return
/atom/proc/ShiftClick(var/mob/M as mob) /atom/proc/ShiftClick(var/mob/M as mob)

View File

@@ -131,8 +131,7 @@
else else
if(isliving(src.loc)) if(isliving(src.loc))
return return
user.lastDblClick = world.time + 2 user.delay_click(2)
user.next_move = world.time + 2
src.pickup(user) src.pickup(user)
add_fingerprint(user) add_fingerprint(user)
user.put_in_active_hand(src) user.put_in_active_hand(src)
@@ -166,8 +165,7 @@
if(istype(src.loc, /mob/living)) if(istype(src.loc, /mob/living))
return return
src.pickup(user) src.pickup(user)
user.lastDblClick = world.time + 2 user.delay_click(2)
user.next_move = world.time + 2
user.put_in_active_hand(src) user.put_in_active_hand(src)
return return
@@ -229,6 +227,8 @@
log_attack("<font color='red'>[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(src.damtype)])</font>" ) log_attack("<font color='red'>[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(src.damtype)])</font>" )
msg_admin_attack("ATTACK: [user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])") //BS12 EDIT ALG 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 //spawn(1800) // this wont work right
// M.lastattacker = null // M.lastattacker = null
///////////////////////// /////////////////////////

View File

@@ -14,7 +14,6 @@
m_amt = 90 m_amt = 90
attack_verb = list("slammed", "whacked", "bashed", "thunked", "battered", "bludgeoned", "thrashed") attack_verb = list("slammed", "whacked", "bashed", "thunked", "battered", "bludgeoned", "thrashed")
var/max_water = 50 var/max_water = 50
var/last_use = 1.0
var/safety = 1 var/safety = 1
var/sprite_name = "fire_extinguisher" var/sprite_name = "fire_extinguisher"
@@ -67,11 +66,6 @@
usr << "\red \The [src] is empty." usr << "\red \The [src] is empty."
return return
if (world.time < src.last_use + 20)
return
src.last_use = world.time
playsound(src.loc, 'sound/effects/extinguish.ogg', 75, 1, -3) playsound(src.loc, 'sound/effects/extinguish.ogg', 75, 1, -3)
var/direction = get_dir(src,target) var/direction = get_dir(src,target)

View File

@@ -35,6 +35,7 @@
user.visible_message("<span class='warning'>[user] kicks [src].</span>", \ user.visible_message("<span class='warning'>[user] kicks [src].</span>", \
"<span class='warning'>You kick [src].</span>", \ "<span class='warning'>You kick [src].</span>", \
"You hear twisting metal.") "You hear twisting metal.")
user.delay_click(10)
if(shock(user, 70)) if(shock(user, 70))
return return
@@ -51,6 +52,7 @@
user.visible_message("<span class='warning'>[user] mangles [src].</span>", \ user.visible_message("<span class='warning'>[user] mangles [src].</span>", \
"<span class='warning'>You mangle [src].</span>", \ "<span class='warning'>You mangle [src].</span>", \
"You hear twisting metal.") "You hear twisting metal.")
user.delay_click(10)
if(!shock(user, 70)) if(!shock(user, 70))
health -= 5 health -= 5
@@ -64,6 +66,7 @@
user.visible_message("<span class='warning'>[user] smashes against [src].</span>", \ user.visible_message("<span class='warning'>[user] smashes against [src].</span>", \
"<span class='warning'>You smash against [src].</span>", \ "<span class='warning'>You smash against [src].</span>", \
"You hear twisting metal.") "You hear twisting metal.")
user.delay_click(10)
health -= rand(2,3) health -= rand(2,3)
healthcheck() healthcheck()
@@ -76,6 +79,7 @@
M.visible_message("<span class='warning'>[M] smashes against [src].</span>", \ M.visible_message("<span class='warning'>[M] smashes against [src].</span>", \
"<span class='warning'>You smash against [src].</span>", \ "<span class='warning'>You smash against [src].</span>", \
"You hear twisting metal.") "You hear twisting metal.")
M.delay_click(10)
health -= M.melee_damage_upper health -= M.melee_damage_upper
healthcheck() healthcheck()
@@ -160,8 +164,10 @@
else if(istype(W, /obj/item/weapon/shard)) else if(istype(W, /obj/item/weapon/shard))
health -= W.force * 0.1 health -= W.force * 0.1
user.delay_click(10)
else if(!shock(user, 70)) else if(!shock(user, 70))
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
user.delay_click(10)
switch(W.damtype) switch(W.damtype)
if("fire") if("fire")
health -= W.force health -= W.force

View File

@@ -104,16 +104,19 @@
new /obj/item/weapon/shard(loc) new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc) if(reinf) new /obj/item/stack/rods(loc)
del(src) del(src)
usr.delay_click(10)
else if (usr.a_intent == "hurt") else if (usr.a_intent == "hurt")
playsound(src.loc, 'glassknock.ogg', 80, 1) playsound(src.loc, 'glassknock.ogg', 80, 1)
usr.visible_message("\red [usr.name] bangs against the [src.name]!", \ usr.visible_message("\red [usr.name] bangs against the [src.name]!", \
"\red You bang against the [src.name]!", \ "\red You bang against the [src.name]!", \
"You hear a banging sound.") "You hear a banging sound.")
usr.delay_click(5)
else else
playsound(src.loc, 'glassknock.ogg', 80, 1) playsound(src.loc, 'glassknock.ogg', 80, 1)
usr.visible_message("[usr.name] knocks on the [src.name].", \ usr.visible_message("[usr.name] knocks on the [src.name].", \
"You knock on the [src.name].", \ "You knock on the [src.name].", \
"You hear a knocking sound.") "You hear a knocking sound.")
usr.delay_click(5)
return return
@@ -128,9 +131,11 @@
new /obj/item/weapon/shard(loc) new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc) if(reinf) new /obj/item/stack/rods(loc)
del(src) del(src)
user.delay_click(10)
else //for nicer text~ else //for nicer text~
user.visible_message("<span class='danger'>[user] smashes into [src]!</span>") user.visible_message("<span class='danger'>[user] smashes into [src]!</span>")
playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1) playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
user.delay_click(10)
/obj/structure/window/attack_alien(mob/user as mob) /obj/structure/window/attack_alien(mob/user as mob)
@@ -158,6 +163,7 @@
var/mob/living/M = G.affecting var/mob/living/M = G.affecting
var/state = G.state var/state = G.state
del(W) //gotta delete it here because if window breaks, it won't get deleted del(W) //gotta delete it here because if window breaks, it won't get deleted
user.delay_click(10)
switch (state) switch (state)
if(1) if(1)
M.apply_damage(7) M.apply_damage(7)
@@ -197,6 +203,7 @@
else else
if(W.damtype == BRUTE || W.damtype == BURN) if(W.damtype == BRUTE || W.damtype == BURN)
hit(W.force) hit(W.force)
user.delay_click(10)
if(health <= 7) if(health <= 7)
anchored = 0 anchored = 0
update_nearby_icons() update_nearby_icons()

View File

@@ -62,7 +62,7 @@
*/ */
/client/proc/fix_next_move() /client/proc/fix_next_move()
set category = "Debug" /* set category = "Debug"
set name = "Unfreeze Everyone" set name = "Unfreeze Everyone"
var/largest_move_time = 0 var/largest_move_time = 0
var/largest_click_time = 0 var/largest_click_time = 0
@@ -90,6 +90,7 @@
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("[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) 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! feedback_add_details("admin_verb","UFE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
*/
return return
/client/proc/radio_report() /client/proc/radio_report()

View File

@@ -1114,9 +1114,9 @@ mob/living/carbon/human/yank_out_object()
set desc = "Remove an embedded item at the cost of bleeding and pain." set desc = "Remove an embedded item at the cost of bleeding and pain."
set src in view(1) set src in view(1)
if(!isliving(usr) || usr.next_move > world.time) if(!isliving(usr) || usr.last_click + usr.click_delay < world.time)
return return
usr.next_move = world.time + 20 usr.delay_click(20)
if(usr.stat == 1) if(usr.stat == 1)
usr << "You are unconcious and cannot do that!" usr << "You are unconcious and cannot do that!"

View File

@@ -33,7 +33,7 @@
if(hud_used) del(hud_used) //remove the hud objects if(hud_used) del(hud_used) //remove the hud objects
hud_used = new /datum/hud(src) hud_used = new /datum/hud(src)
next_move = 1 last_click = world.time
sight |= SEE_SELF sight |= SEE_SELF
..() ..()

View File

@@ -900,9 +900,9 @@ mob/verb/yank_out_object()
set desc = "Remove an embedded item at the cost of bleeding and pain." set desc = "Remove an embedded item at the cost of bleeding and pain."
set src in view(1) set src in view(1)
if(!isliving(usr) || usr.next_move > world.time) if(!isliving(usr) || usr.last_click + usr.click_delay < world.time)
return return
usr.next_move = world.time + 20 usr.delay_click(20)
if(usr.stat == 1) if(usr.stat == 1)
usr << "You are unconcious and cannot do that!" usr << "You are unconcious and cannot do that!"

View File

@@ -54,8 +54,8 @@
var/sdisabilities = 0 //Carbon var/sdisabilities = 0 //Carbon
var/disabilities = 0 //Carbon var/disabilities = 0 //Carbon
var/atom/movable/pulling = null var/atom/movable/pulling = null
var/next_move = null var/last_click = null
var/prev_move = null var/click_delay = 0
var/monkeyizing = null //Carbon var/monkeyizing = null //Carbon
var/other = 0.0 var/other = 0.0
var/hand = null var/hand = null

View File

@@ -128,7 +128,7 @@
return return
if(killing) if(killing)
return return
if (assailant.next_move > world.time) if (assailant.last_click + assailant.click_delay < world.time)
return return
if ((!( assailant.canmove ) || assailant.lying)) if ((!( assailant.canmove ) || assailant.lying))
//SN src = null //SN src = null
@@ -140,7 +140,7 @@
if (!( killing )) if (!( killing ))
assailant.visible_message("\red [assailant] has temporarily tightened \his grip on [affecting]!") assailant.visible_message("\red [assailant] has temporarily tightened \his grip on [affecting]!")
//Foreach goto(97) //Foreach goto(97)
assailant.next_move = world.time + 10 assailant.delay_click(10)
//affecting.stunned = max(2, affecting.stunned) //affecting.stunned = max(2, affecting.stunned)
//affecting.paralysis = max(1, affecting.paralysis) //affecting.paralysis = max(1, affecting.paralysis)
affecting.losebreath = min(affecting.losebreath + 1, 3) affecting.losebreath = min(affecting.losebreath + 1, 3)
@@ -235,7 +235,7 @@
assailant.attack_log += text("\[[time_stamp()]\] <font color='red'>Strangled (kill intent) [affecting.name] ([affecting.ckey])</font>") assailant.attack_log += text("\[[time_stamp()]\] <font color='red'>Strangled (kill intent) [affecting.name] ([affecting.ckey])</font>")
log_attack("<font color='red'>[assailant.name] ([assailant.ckey]) Strangled (kill intent) [affecting.name] ([affecting.ckey])</font>") log_attack("<font color='red'>[assailant.name] ([assailant.ckey]) Strangled (kill intent) [affecting.name] ([affecting.ckey])</font>")
assailant.next_move = world.time + 10 assailant.delay_click(10)
affecting.losebreath += 1 affecting.losebreath += 1
else else
assailant.visible_message("\red [assailant] was unable to tighten \his grip on [affecting]'s neck!") assailant.visible_message("\red [assailant] was unable to tighten \his grip on [affecting]'s neck!")

View File

@@ -454,3 +454,7 @@ var/list/intents = list("help","disarm","grab","hurt")
hud_used.action_intent.icon_state = "harm" hud_used.action_intent.icon_state = "harm"
else else
hud_used.action_intent.icon_state = "help" 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

View File

@@ -600,9 +600,9 @@
set name = "Resist" set name = "Resist"
set category = "IC" set category = "IC"
if(!isliving(usr) || usr.next_move > world.time) if(!isliving(usr) || usr.last_click + usr.click_delay < world.time)
return return
usr.next_move = world.time + 20 usr.delay_click(20)
var/mob/living/L = usr var/mob/living/L = usr
@@ -639,7 +639,7 @@
if(iscarbon(L)) if(iscarbon(L))
var/mob/living/carbon/C = L var/mob/living/carbon/C = L
if( C.handcuffed ) if( C.handcuffed )
C.next_move = world.time + 100 C.delay_click(100)
C.last_special = 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)" 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)) for(var/mob/O in viewers(L))
@@ -673,7 +673,7 @@
// breakout_time++ //Harder to get out of welded lockers than locked lockers // breakout_time++ //Harder to get out of welded lockers than locked lockers
//okay, so the closet is either welded or locked... resist!!! //okay, so the closet is either welded or locked... resist!!!
usr.next_move = world.time + 100 usr.delay_click(100)
L.last_special = 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)" 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)) for(var/mob/O in viewers(usr.loc))
@@ -726,7 +726,7 @@
else if(iscarbon(L)) else if(iscarbon(L))
var/mob/living/carbon/CM = L var/mob/living/carbon/CM = L
if(CM.handcuffed && CM.canmove && (CM.last_special <= world.time)) if(CM.handcuffed && CM.canmove && (CM.last_special <= world.time))
CM.next_move = world.time + 100 CM.delay_click(100)
CM.last_special = 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. 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)" usr << "\red You attempt to break your handcuffs. (This will take around 5 seconds and you need to stand still)"
@@ -764,7 +764,7 @@
CM.handcuffed = null CM.handcuffed = null
CM.update_inv_handcuffed() CM.update_inv_handcuffed()
else if(CM.legcuffed && CM.canmove && (CM.last_special <= world.time)) else if(CM.legcuffed && CM.canmove && (CM.last_special <= world.time))
CM.next_move = world.time + 100 CM.delay_click(100)
CM.last_special = 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. 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)" usr << "\red You attempt to break your legcuffs. (This will take around 5 seconds and you need to stand still)"

View File

@@ -131,7 +131,7 @@
in_chamber.loc = get_turf(user) in_chamber.loc = get_turf(user)
in_chamber.starting = get_turf(user) in_chamber.starting = get_turf(user)
in_chamber.shot_from = src in_chamber.shot_from = src
user.next_move = world.time + 4 usr.delay_click(4)
in_chamber.silenced = silenced in_chamber.silenced = silenced
in_chamber.current = curloc in_chamber.current = curloc
in_chamber.yo = targloc.y - curloc.y in_chamber.yo = targloc.y - curloc.y