mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Gives changeNextMove() a better name, default define
This commit is contained in:
@@ -79,6 +79,9 @@
|
||||
#define APPEARANCE_ALL_HAIR (APPEARANCE_HAIR|APPEARANCE_HAIR_COLOR|APPEARANCE_FACIAL_HAIR|APPEARANCE_FACIAL_HAIR_COLOR)
|
||||
#define APPEARANCE_ALL 511
|
||||
|
||||
// Click cooldown
|
||||
#define DEFAULT_ATTACK_COOLDOWN 8 //Default timeout for aggressive actions
|
||||
|
||||
|
||||
#define MIN_SUPPLIED_LAW_NUMBER 15
|
||||
#define MAX_SUPPLIED_LAW_NUMBER 50
|
||||
@@ -78,7 +78,7 @@
|
||||
return M.click_action(A, src)
|
||||
|
||||
if(restrained())
|
||||
changeNextMove(10)
|
||||
setClickCooldown(10)
|
||||
RestrainedClickOn(A)
|
||||
return
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
W.afterattack(A, src, 1, params) // 1 indicates adjacency
|
||||
else
|
||||
if(ismob(A)) // No instant mob attacking
|
||||
changeNextMove(8)
|
||||
setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
UnarmedAttack(A, 1)
|
||||
return
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
W.afterattack(A, src, 1, params) // 1: clicking something Adjacent
|
||||
else
|
||||
if(ismob(A)) // No instant mob attacking
|
||||
changeNextMove(8)
|
||||
setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
UnarmedAttack(A, 1)
|
||||
return
|
||||
else // non-adjacent click
|
||||
@@ -137,8 +137,8 @@
|
||||
|
||||
return
|
||||
|
||||
/mob/proc/changeNextMove(var/num)
|
||||
next_move = world.time + num
|
||||
/mob/proc/setClickCooldown(var/timeout)
|
||||
next_move = max(world.time + timeout, next_move)
|
||||
|
||||
/mob/proc/canClick()
|
||||
if(config.no_click_cooldown || next_move <= world.time)
|
||||
@@ -285,7 +285,7 @@
|
||||
return
|
||||
|
||||
/mob/living/LaserEyes(atom/A)
|
||||
changeNextMove(4)
|
||||
setClickCooldown(4)
|
||||
var/turf/T = get_turf(src)
|
||||
var/turf/U = get_turf(A)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
|
||||
|
||||
/mob/living/attackby(obj/item/I, mob/user)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(istype(I) && ismob(user))
|
||||
I.attack(src, user)
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
build_click(src, client.buildmode, params, A)
|
||||
return
|
||||
if(!canClick()) return
|
||||
changeNextMove(4)
|
||||
setClickCooldown(4)
|
||||
// You are responsible for checking config.ghost_interaction when you override this function
|
||||
// Not all of them require checking, see below
|
||||
A.attack_ghost(src)
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
if(istype(rig) && rig.selected_module)
|
||||
rig.selected_module.engage(A)
|
||||
if(ismob(A)) // No instant mob attacking - though modules have their own cooldowns
|
||||
changeNextMove(8)
|
||||
setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
|
||||
|
||||
attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
playsound(src.loc, 'sound/effects/attackblob.ogg', 50, 1)
|
||||
src.visible_message("<span class='danger'>The [src.name] has been attacked with \the [W][(user ? " by [user]." : ".")]</span>")
|
||||
var/damage = 0
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
src.bugged = 1
|
||||
|
||||
else if(W.damtype == BRUTE || W.damtype == BURN) //bashing cameras
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if (W.force >= src.toughness)
|
||||
user.do_attack_animation(src)
|
||||
visible_message("<span class='warning'><b>[src] has been [pick(W.attack_verb)] with [W] by [user]!</b></span>")
|
||||
|
||||
@@ -97,7 +97,7 @@ for reference:
|
||||
return
|
||||
return
|
||||
else
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
switch(W.damtype)
|
||||
if("fire")
|
||||
src.health -= W.force * 1
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
//psa to whoever coded this, there are plenty of objects that need to call attack() on doors without bludgeoning them.
|
||||
if(src.density && istype(I, /obj/item/weapon) && user.a_intent == I_HURT && !istype(I, /obj/item/weapon/card))
|
||||
var/obj/item/weapon/W = I
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(W.damtype == BRUTE || W.damtype == BURN)
|
||||
user.do_attack_animation(src)
|
||||
if(W.force < min_force)
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
|
||||
//If it's a weapon, smash windoor. Unless it's an id card, agent card, ect.. then ignore it (Cards really shouldnt damage a door anyway)
|
||||
if(src.density && istype(I, /obj/item/weapon) && !istype(I, /obj/item/weapon/card))
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
var/aforce = I.force
|
||||
playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1)
|
||||
visible_message("<span class='danger'>[src] was hit by [I].</span>")
|
||||
|
||||
@@ -322,7 +322,7 @@
|
||||
|
||||
else
|
||||
//if the turret was attacked with the intention of harming it:
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
take_damage(I.force * 0.5)
|
||||
if(I.force * 0.5 > 1) //if the force of impact dealt at least 1 damage, the turret gets pissed off
|
||||
if(!attacked && !emagged)
|
||||
|
||||
@@ -505,7 +505,7 @@
|
||||
return
|
||||
|
||||
/obj/mecha/attack_hand(mob/user as mob)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
src.log_message("Attack by hand/paw. Attacker - [user].",1)
|
||||
|
||||
if(istype(user,/mob/living/carbon/human))
|
||||
@@ -665,7 +665,7 @@
|
||||
return
|
||||
|
||||
/obj/mecha/proc/dynattackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
src.log_message("Attacked by [W]. Attacker - [user]")
|
||||
if(prob(src.deflect_chance))
|
||||
user << "<span class='danger'>\The [W] bounces off [src.name].</span>"
|
||||
@@ -1685,7 +1685,7 @@
|
||||
|
||||
/obj/mecha/attack_generic(var/mob/user, var/damage, var/attack_message)
|
||||
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(!damage)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
return
|
||||
|
||||
/obj/effect/alien/resin/attack_hand()
|
||||
usr.changeNextMove(8)
|
||||
usr.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if (HULK in usr.mutations)
|
||||
usr << "<span class='notice'>You easily destroy the [name].</span>"
|
||||
for(var/mob/O in oviewers(src))
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
/obj/effect/alien/resin/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
var/aforce = W.force
|
||||
health = max(0, health - aforce)
|
||||
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
|
||||
@@ -233,7 +233,7 @@ Alien plants should do something if theres a lot of poison
|
||||
return
|
||||
|
||||
/obj/effect/alien/weeds/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(W.attack_verb.len)
|
||||
visible_message("<span class='danger'>\The [src] have been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]</span>")
|
||||
else
|
||||
|
||||
@@ -349,7 +349,7 @@
|
||||
if(!escapee.canClick())
|
||||
return
|
||||
|
||||
escapee.changeNextMove(100)
|
||||
escapee.setClickCooldown(100)
|
||||
|
||||
//okay, so the closet is either welded or locked... resist!!!
|
||||
escapee << "<span class='warning'>You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)</span>"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
/obj/structure/grille/attack_hand(mob/user as mob)
|
||||
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
|
||||
user.do_attack_animation(src)
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
//window placing end
|
||||
|
||||
else if(!(W.flags & CONDUCT) || !shock(user, 70))
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.do_attack_animation(src)
|
||||
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
|
||||
switch(W.damtype)
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1)
|
||||
|
||||
/obj/structure/window/attack_hand(mob/user as mob)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(HULK in user.mutations)
|
||||
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!"))
|
||||
user.visible_message("<span class='danger'>[user] smashes through [src]!</span>")
|
||||
@@ -199,7 +199,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/window/attack_generic(var/mob/user, var/damage)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(!damage)
|
||||
return
|
||||
if(damage >= 10)
|
||||
@@ -269,7 +269,7 @@
|
||||
new glasstype(loc)
|
||||
qdel(src)
|
||||
else
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(W.damtype == BRUTE || W.damtype == BURN)
|
||||
user.do_attack_animation(src)
|
||||
hit(W.force)
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
radiate()
|
||||
add_fingerprint(user)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
var/rotting = (locate(/obj/effect/overlay/wallrot) in src)
|
||||
if (HULK in user.mutations)
|
||||
if (rotting || !prob(material.hardness))
|
||||
@@ -70,7 +70,7 @@
|
||||
/turf/simulated/wall/attack_generic(var/mob/user, var/damage, var/attack_message, var/wallbreaker)
|
||||
|
||||
radiate()
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
var/rotting = (locate(/obj/effect/overlay/wallrot) in src)
|
||||
if(!damage || !wallbreaker)
|
||||
try_touch(user, rotting)
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
/turf/simulated/wall/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if (!user.)
|
||||
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
|
||||
return
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
|
||||
/obj/effect/plant/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
plant_controller.add_plant(src)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/weapon/scalpel))
|
||||
|
||||
@@ -545,7 +545,7 @@
|
||||
A.hydrotray_type = src.type
|
||||
qdel(src)
|
||||
else if(O.force && seed)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.visible_message("<span class='danger'>\The [seed.display_name] has been attacked by [user] with \the [O]!</span>")
|
||||
if(!dead)
|
||||
health -= O.force
|
||||
|
||||
@@ -1308,7 +1308,7 @@
|
||||
if(!isliving(usr) || !usr.canClick())
|
||||
return
|
||||
|
||||
usr.changeNextMove(20)
|
||||
usr.setClickCooldown(20)
|
||||
|
||||
if(usr.stat > 0)
|
||||
usr << "You are unconcious and cannot do that!"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
//These two lines represent a significant buff to grabs...
|
||||
if(!canClick()) return
|
||||
changeNextMove(100)
|
||||
setClickCooldown(100)
|
||||
|
||||
if(can_break_cuffs()) //Don't want to do a lot of logic gating here.
|
||||
break_handcuffs()
|
||||
@@ -65,7 +65,7 @@
|
||||
if(!canClick())
|
||||
return
|
||||
|
||||
changeNextMove(100)
|
||||
setClickCooldown(100)
|
||||
|
||||
if(can_break_cuffs()) //Don't want to do a lot of logic gating here.
|
||||
break_legcuffs()
|
||||
@@ -153,7 +153,7 @@
|
||||
if(!canClick())
|
||||
return
|
||||
|
||||
changeNextMove(100)
|
||||
setClickCooldown(100)
|
||||
if(!buckled) return
|
||||
|
||||
if(!restrained())
|
||||
|
||||
@@ -575,7 +575,7 @@ default behaviour is:
|
||||
set category = "IC"
|
||||
|
||||
if(can_resist())
|
||||
changeNextMove(20)
|
||||
setClickCooldown(20)
|
||||
process_resist()
|
||||
|
||||
/mob/living/proc/can_resist()
|
||||
|
||||
@@ -290,7 +290,7 @@
|
||||
|
||||
//TODO: refactor mob attackby(), attacked_by(), and friends.
|
||||
/mob/living/simple_animal/proc/attacked_with_item(var/obj/item/O, var/mob/user)
|
||||
user.changeNextMove(8)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(!O.force)
|
||||
visible_message("<span class='notice'>[user] gently taps [src] with \the [O].</span>")
|
||||
return
|
||||
|
||||
@@ -843,7 +843,7 @@ mob/proc/yank_out_object()
|
||||
|
||||
if(!isliving(usr) || !usr.canClick())
|
||||
return
|
||||
usr.changeNextMove(20)
|
||||
usr.setClickCooldown(20)
|
||||
|
||||
if(usr.stat == 1)
|
||||
usr << "You are unconcious and cannot do that!"
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
assailant.attack_log += "\[[time_stamp()]\] <font color='red'>Strangled (kill intent) [affecting.name] ([affecting.ckey])</font>"
|
||||
msg_admin_attack("[key_name(assailant)] strangled (kill intent) [key_name(affecting)]")
|
||||
|
||||
affecting.changeNextMove(10)
|
||||
affecting.setClickCooldown(10)
|
||||
affecting.losebreath += 1
|
||||
affecting.set_dir(WEST)
|
||||
adjust_position()
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
var/_move_delay = firemode.move_delay
|
||||
|
||||
var/shoot_time = (_burst - 1)*_burst_delay
|
||||
user.changeNextMove(shoot_time)
|
||||
user.setClickCooldown(shoot_time)
|
||||
if(user.client) user.client.move_delay = world.time + shoot_time //no moving while shooting either
|
||||
next_fire_time = world.time + shoot_time
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
update_held_icon()
|
||||
|
||||
//update timing
|
||||
user.changeNextMove(4)
|
||||
user.setClickCooldown(4)
|
||||
if(user.client) user.client.move_delay = world.time + _move_delay
|
||||
next_fire_time = world.time + _fire_delay
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6)
|
||||
|
||||
user.changeNextMove(4)
|
||||
user.setClickCooldown(4)
|
||||
|
||||
if(reagents.has_reagent("sacid"))
|
||||
message_admins("[key_name_admin(user)] fired sulphuric acid from \a [src].")
|
||||
|
||||
Reference in New Issue
Block a user