From ccae5781c542ff905f3996bb2bfbf4d590259a79 Mon Sep 17 00:00:00 2001 From: Aranclanos Date: Sun, 3 Aug 2014 22:14:56 -0300 Subject: [PATCH] added two defines CLICK_CD_RANGE and CLICK_CD_MELEE (4 and 8), replaced all changeNext_move() procs to use these two defines. Added melee click cooldown for paper spam on cameras. --- code/__DEFINES/misc.dm | 5 +++++ code/_onclick/click.dm | 8 ++++---- code/_onclick/item_attack.dm | 2 +- code/game/gamemodes/blob/theblob.dm | 4 ++-- code/game/machinery/bots/bots.dm | 6 +++--- code/game/machinery/camera/camera.dm | 1 + code/game/machinery/doors/windowdoor.dm | 4 ++-- code/game/machinery/portable_turret.dm | 4 ++-- code/game/machinery/turrets.dm | 8 ++++---- code/game/mecha/mecha.dm | 4 ++-- code/game/objects/effects/aliens.dm | 6 +++--- .../structures/crates_lockers/closets/fireaxe.dm | 2 +- code/game/objects/structures/displaycase.dm | 4 ++-- code/game/objects/structures/grille.dm | 10 +++++----- code/game/objects/structures/lamarr_cage.dm | 4 ++-- code/game/objects/structures/window.dm | 6 +++--- code/game/turfs/simulated/walls.dm | 8 ++++---- code/modules/events/spacevine.dm | 2 +- code/modules/mob/living/simple_animal/simple_animal.dm | 2 +- code/modules/projectiles/firing.dm | 2 +- code/modules/reagents/reagent_containers/spray.dm | 4 ++-- 21 files changed, 51 insertions(+), 45 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 33edf53016b..25c256322ef 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -30,3 +30,8 @@ #define MINERAL_MATERIAL_AMOUNT 2000 //The amount of materials you get from a sheet of mineral like iron/diamond/glass etc + + +#define CLICK_CD_MELEE 8 +#define CLICK_CD_RANGE 4 +//click cooldowns, in tenths of a second \ No newline at end of file diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 5193efd9561..c67817e6463 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -102,7 +102,7 @@ W.afterattack(A,src,1,params) // 1 indicates adjacency else if(ismob(A)) - changeNext_move(8) + changeNext_move(CLICK_CD_MELEE) UnarmedAttack(A) return @@ -119,7 +119,7 @@ W.afterattack(A,src,1,params) // 1: clicking something Adjacent else if(ismob(A)) - changeNext_move(8) + changeNext_move(CLICK_CD_MELEE) UnarmedAttack(A, 1) return else // non-adjacent click @@ -150,7 +150,7 @@ */ /mob/proc/UnarmedAttack(var/atom/A, var/proximity_flag) if(ismob(A)) - changeNext_move(8) + changeNext_move(CLICK_CD_MELEE) return /* @@ -261,7 +261,7 @@ return /mob/living/LaserEyes(atom/A) - changeNext_move(4) + changeNext_move(CLICK_CD_RANGE) var/turf/T = get_turf(src) var/turf/U = get_turf(A) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 85586389473..5eccb4b2435 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -11,7 +11,7 @@ visible_message("[src] has been hit by [user] with [W].") /mob/living/attackby(obj/item/I, mob/user) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) I.attack(src, user) /mob/living/proc/attacked_by(var/obj/item/I, var/mob/living/user, var/def_zone) diff --git a/code/game/gamemodes/blob/theblob.dm b/code/game/gamemodes/blob/theblob.dm index 433ed32f59b..d4f0d21229e 100644 --- a/code/game/gamemodes/blob/theblob.dm +++ b/code/game/gamemodes/blob/theblob.dm @@ -150,7 +150,7 @@ /obj/effect/blob/attackby(var/obj/item/weapon/W, var/mob/user) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) playsound(src.loc, 'sound/effects/attackblob.ogg', 50, 1) src.visible_message("The [src.name] has been attacked with \the [W][(user ? " by [user]" : "")]!") var/damage = 0 @@ -167,7 +167,7 @@ return /obj/effect/blob/attack_animal(mob/living/simple_animal/M as mob) - M.changeNext_move(8) + M.changeNext_move(CLICK_CD_MELEE) playsound(src.loc, 'sound/effects/attackblob.ogg', 50, 1) src.visible_message("The [src.name] has been attacked by \the [M]!") var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index 92fda838452..e4fb0e881eb 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -53,7 +53,7 @@ return /obj/machinery/bot/attack_alien(var/mob/living/carbon/alien/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) src.health -= rand(15,30)*brute_dam_coeff src.visible_message("\red [user] has slashed [src]!") playsound(src.loc, 'sound/weapons/slice.ogg', 25, 1, -1) @@ -64,7 +64,7 @@ /obj/machinery/bot/attack_animal(var/mob/living/simple_animal/M as mob) if(M.melee_damage_upper == 0) return - M.changeNext_move(8) + M.changeNext_move(CLICK_CD_MELEE) src.health -= M.melee_damage_upper src.visible_message("\red [M] has [M.attacktext] [src]!") add_logs(M, src, "attacked", admin=0) @@ -93,7 +93,7 @@ Emag(user) else if(hasvar(W,"force") && hasvar(W,"damtype")) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) switch(W.damtype) if("fire") src.health -= W.force * fire_dam_coeff diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 8d5385d11f7..b58fc889a64 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -190,6 +190,7 @@ itemname = P.name info = P.notehtml U << "You hold \the [itemname] up to the camera ..." + U.changeNext_move(CLICK_CD_MELEE) for(var/mob/O in player_list) if(istype(O, /mob/living/silicon/ai)) var/mob/living/silicon/ai/AI = O diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 3ed5b14d2ed..e8ff575bf40 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -194,7 +194,7 @@ /obj/machinery/door/window/proc/attack_generic(mob/user as mob, damage = 0) if(src.operating) return - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) user.visible_message("[user] smashes against the [src.name].", \ "[user] smashes against the [src.name].") @@ -263,7 +263,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.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) var/aforce = I.force playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) visible_message("\The [src] has been hit by [user] with [I].") diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index e52421b06be..11d49aef2bf 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -300,7 +300,7 @@ else //if the turret was attacked with the intention of harming it: - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) health -= I.force * 0.5 if(health <= 0) die() @@ -985,7 +985,7 @@ Status: []
"}, user << "Access denied." else - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) Parent_Turret.health -= I.force * 0.5 if(Parent_Turret.health <= 0) Parent_Turret.die() diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index e4e7e0f86df..52a91647851 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -276,7 +276,7 @@ /obj/machinery/turret/attackby(obj/item/weapon/W, mob/user)//I can't believe no one added this before/N ..() - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) playsound(src.loc, 'sound/weapons/smash.ogg', 60, 1) src.spark_system.start() src.health -= W.force * 0.5 @@ -410,7 +410,7 @@ /obj/machinery/turret/attack_animal(mob/living/simple_animal/M as mob) - M.changeNext_move(8) + M.changeNext_move(CLICK_CD_MELEE) if(M.melee_damage_upper == 0) return if(!(stat & BROKEN)) visible_message("\red [M] [M.attacktext] [src]!") @@ -427,7 +427,7 @@ /obj/machinery/turret/attack_alien(mob/living/carbon/alien/humanoid/M as mob) - M.changeNext_move(8) + M.changeNext_move(CLICK_CD_MELEE) if(!(stat & BROKEN)) playsound(src.loc, 'sound/weapons/slash.ogg', 25, 1, -1) visible_message("\red [] has slashed at []!", M, src) @@ -548,7 +548,7 @@ /obj/machinery/gun_turret/attack_alien(mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) user.visible_message("[user] slashes at [src]", "You slash at [src]") take_damage(15) return diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 115333657e9..f3909abc787 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -465,7 +465,7 @@ qdel(src) /obj/mecha/attack_hand(mob/user as mob) - user.changeNext_move(8) // Ugh. Ideally we shouldn't be setting cooldowns outside of click code. + user.changeNext_move(CLICK_CD_MELEE) // Ugh. Ideally we shouldn't be setting cooldowns outside of click code. src.log_message("Attack by hand/paw. Attacker - [user].",1) if ((HULK in user.mutations) && !prob(src.deflect_chance)) @@ -633,7 +633,7 @@ return /obj/mecha/proc/dynattackby(obj/item/weapon/W as obj, mob/user as mob) - user.changeNext_move(8) // Ugh. Ideally we shouldn't be setting cooldowns outside of click code. + user.changeNext_move(CLICK_CD_MELEE) // Ugh. Ideally we shouldn't be setting cooldowns outside of click code. src.log_message("Attacked by [W]. Attacker - [user]") if(prob(src.deflect_chance)) diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index 0a8c349bba0..3a12acdd6ca 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -111,7 +111,7 @@ /obj/structure/alien/resin/attack_alien(mob/user) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if(islarva(user)) return user.visible_message("[user] claws at the resin!") @@ -123,7 +123,7 @@ /obj/structure/alien/resin/attackby(obj/item/I, mob/user) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) health -= I.force playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) healthcheck() @@ -198,7 +198,7 @@ /obj/structure/alien/weeds/attackby(obj/item/I, mob/user) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if(I.attack_verb.len) visible_message("[src] has been [pick(I.attack_verb)] with [I] by [user].") else diff --git a/code/game/objects/structures/crates_lockers/closets/fireaxe.dm b/code/game/objects/structures/crates_lockers/closets/fireaxe.dm index e3ff42f2913..b285494aeaf 100644 --- a/code/game/objects/structures/crates_lockers/closets/fireaxe.dm +++ b/code/game/objects/structures/crates_lockers/closets/fireaxe.dm @@ -31,7 +31,7 @@ update_icon() return else if(istype(O, /obj/item/weapon)) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) var/obj/item/weapon/W = O if(src.smashed || src.localopened) if(localopened) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index a7752c65025..e0c403006d5 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -66,7 +66,7 @@ /obj/structure/displaycase/attackby(obj/item/weapon/W as obj, mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) src.health -= W.force src.healthcheck() ..() @@ -76,7 +76,7 @@ return src.attack_hand(user) /obj/structure/displaycase/attack_hand(mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if (src.destroyed && src.occupied) new /obj/item/weapon/gun/energy/laser/captain( src.loc ) user << "\b You deactivate the hover field built into the case." diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index b698c96d705..a526f7ec191 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -26,7 +26,7 @@ attack_hand(user) /obj/structure/grille/attack_hand(mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) user.visible_message("[user] hits [src].", \ "You hit [src].", \ @@ -42,7 +42,7 @@ /obj/structure/grille/attack_alien(mob/user as mob) if(istype(user, /mob/living/carbon/alien/larva)) return - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) user.visible_message("[user] mangles [src].", \ "You mangle [src].", \ @@ -54,7 +54,7 @@ return /obj/structure/grille/attack_slime(mob/living/carbon/slime/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if(!user.is_adult) return playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) @@ -67,7 +67,7 @@ return /obj/structure/grille/attack_animal(var/mob/living/simple_animal/M as mob) - M.changeNext_move(8) + M.changeNext_move(CLICK_CD_MELEE) if(M.melee_damage_upper == 0) return playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) @@ -100,7 +100,7 @@ return /obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) add_fingerprint(user) if(istype(W, /obj/item/weapon/wirecutters)) if(!shock(user, 100)) diff --git a/code/game/objects/structures/lamarr_cage.dm b/code/game/objects/structures/lamarr_cage.dm index 28e4bf516de..94e4b829939 100644 --- a/code/game/objects/structures/lamarr_cage.dm +++ b/code/game/objects/structures/lamarr_cage.dm @@ -61,7 +61,7 @@ /obj/structure/lamarr/attackby(obj/item/weapon/W as obj, mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) src.health -= W.force src.healthcheck() ..() @@ -71,7 +71,7 @@ return src.attack_hand(user) /obj/structure/lamarr/attack_hand(mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if (src.destroyed) return else diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 817a9a24e24..a3fb7fc1776 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -109,7 +109,7 @@ R.add_fingerprint(user) qdel(src) else - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) user.visible_message("[user] knocks on [src].") add_fingerprint(user) playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1) @@ -122,7 +122,7 @@ /obj/structure/window/proc/attack_generic(mob/user as mob, damage = 0) //used by attack_alien, attack_animal, and attack_slime if(!can_be_reached(user)) return - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) health -= damage if(health <= 0) user.visible_message("[user] smashes through [src]!") @@ -191,7 +191,7 @@ qdel(src) else if(I.damtype == BRUTE || I.damtype == BURN) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) hit(I.force) if(health <= 7) anchored = 0 diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index a9c26d6f3a4..540c9d2d88f 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -93,7 +93,7 @@ dismantle_wall() /turf/simulated/wall/attack_paw(mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if ((HULK in user.mutations)) if (prob(hardness)) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) @@ -109,7 +109,7 @@ return src.attack_hand(user) /turf/simulated/wall/attack_animal(var/mob/living/simple_animal/M) - M.changeNext_move(8) + M.changeNext_move(CLICK_CD_MELEE) if(M.environment_smash >= 2) if(istype(src, /turf/simulated/wall/r_wall)) if(M.environment_smash == 3) @@ -125,7 +125,7 @@ return /turf/simulated/wall/attack_hand(mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if (HULK in user.mutations) if (prob(hardness)) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) @@ -145,7 +145,7 @@ return /turf/simulated/wall/attackby(obj/item/weapon/W as obj, mob/user as mob) - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if (!(istype(user, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey") user << "You don't have the dexterity to do this!" return diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index db8ccd61136..6bf3499c193 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -248,7 +248,7 @@ /obj/effect/spacevine/attackby(obj/item/weapon/W as obj, mob/user as mob) if (!W || !user || !W.type) return - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) var/override = 0 diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 61b6bf36934..ee89070f77a 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -398,7 +398,7 @@ if(istype(O, /obj/item/weapon/kitchenknife) || istype(O, /obj/item/weapon/butch)) harvest() else - user.changeNext_move(8) + user.changeNext_move(CLICK_CD_MELEE) if(O.force) if(O.force >= force_threshold) var/damage = O.force diff --git a/code/modules/projectiles/firing.dm b/code/modules/projectiles/firing.dm index 4e056555929..cbad4b8404f 100644 --- a/code/modules/projectiles/firing.dm +++ b/code/modules/projectiles/firing.dm @@ -10,7 +10,7 @@ return 0 if(i > 1) newshot() - user.changeNext_move(4) + user.changeNext_move(CLICK_CD_RANGE) update_icon() return 1 diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 03d610af63f..92109b168f7 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -57,7 +57,7 @@ qdel(D) playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6) - user.changeNext_move(4) + user.changeNext_move(CLICK_CD_RANGE) if(reagents.has_reagent("sacid")) message_admins("[key_name_admin(user)] fired sulphuric acid from \a [src].") @@ -217,7 +217,7 @@ qdel(D) playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6) - user.changeNext_move(4) + user.changeNext_move(CLICK_CD_RANGE) if(reagents.has_reagent("sacid")) message_admins("[key_name_admin(user)] fired sulphuric acid from a chem sprayer.")