From 28c435134b185e51cb12ee905b8c1f51712594a1 Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sun, 26 May 2019 04:52:05 +0200 Subject: [PATCH 1/8] stunbaton emp & status tweaks --- code/game/objects/items/stunbaton.dm | 55 +++++++++++++++++++--------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index c0e81a7949..86cccb56f8 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -13,11 +13,12 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 50, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80) var/stunforce = 140 - var/status = 0 + var/status = FALSE var/obj/item/stock_parts/cell/cell var/hitcost = 1000 var/throw_hit_chance = 35 var/preload_cell_type //if not empty the baton starts with this type of cell + var/emped_timer = 0 /obj/item/melee/baton/get_cell() return cell @@ -45,16 +46,30 @@ preload_cell_type = /obj/item/stock_parts/cell/high /obj/item/melee/baton/proc/deductcharge(chrgdeductamt) - if(cell) - //Note this value returned is significant, as it will determine - //if a stun is applied or not - . = cell.use(chrgdeductamt) - if(status && cell.charge < hitcost) - //we're below minimum, turn off - status = 0 - update_icon() - playsound(loc, "sparks", 75, 1, -1) + if(!cell) + switch_status(FALSE, TRUE) + return FALSE + //Note this value returned is significant, as it will determine + //if a stun is applied or not + . = cell.use(chrgdeductamt) + if(status && cell.charge < hitcost) + //we're below minimum, turn off + switch_status(FALSE) +/obj/item/melee/baton/proc/switch_status(new_status = FALSE, silent = FALSE) + if(status == new_status) + return + status = new_status + update_icon() + if(!silent) + playsound(loc, "sparks", 75, 1, -1) + if(status) + START_PROCESSING(SSobj, src) + else + STOP_PROCESSING(SSobj, src) + +/obj/item/melee/baton/process() + deductcharge(10) /obj/item/melee/baton/update_icon() if(status) @@ -92,23 +107,23 @@ cell.forceMove(get_turf(src)) cell = null to_chat(user, "You remove the cell from [src].") - status = 0 - update_icon() + switch_status(FALSE, TRUE) else return ..() /obj/item/melee/baton/attack_self(mob/user) if(cell && cell.charge > hitcost) - status = !status - to_chat(user, "[src] is now [status ? "on" : "off"].") - playsound(loc, "sparks", 75, 1, -1) + if(emped_timer > world.time) + to_chat(user, "[src] briefly flickers as you try to turn it on, looks like it's momentarily out of service.") + else + switch_status(!status) + to_chat(user, "[src] is now [status ? "on" : "off"].") else - status = 0 + switch_status(FALSE, TRUE) if(!cell) to_chat(user, "[src] does not have a power source!") else to_chat(user, "[src] is out of charge.") - update_icon() add_fingerprint(user) /obj/item/melee/baton/attack(mob/M, mob/living/carbon/human/user) @@ -185,7 +200,13 @@ /obj/item/melee/baton/emp_act(severity) . = ..() if (!(. & EMP_PROTECT_SELF)) + switch_status(FALSE) deductcharge(1000 / severity) + var/downtime = 4 SECONDS / severity + if(emped_timer > world.time) + emped_timer += downtime * 0.5 + else + emped_timer = world.time + downtime //Makeshift stun baton. Replacement for stun gloves. /obj/item/melee/baton/cattleprod From e61942cba9b14b57bcb23e73d0708d9fd831a9ad Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sun, 26 May 2019 05:18:07 +0200 Subject: [PATCH 2/8] it will approx take 18-19 minutes now. --- code/game/objects/items/stunbaton.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 86cccb56f8..45f6106559 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -69,7 +69,7 @@ STOP_PROCESSING(SSobj, src) /obj/item/melee/baton/process() - deductcharge(10) + deductcharge(18 * hitcost * 0.001) /obj/item/melee/baton/update_icon() if(status) From 9b2ab8fc2a82fb14eb34e229230f35d50f9e9b06 Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sun, 26 May 2019 05:21:17 +0200 Subject: [PATCH 3/8] 21 minutes sounds, I don't really wanna overly punish. --- code/game/objects/items/stunbaton.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 45f6106559..39f77f0bfb 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -69,7 +69,7 @@ STOP_PROCESSING(SSobj, src) /obj/item/melee/baton/process() - deductcharge(18 * hitcost * 0.001) + deductcharge(15 * hitcost * 0.001) /obj/item/melee/baton/update_icon() if(status) From 7289d8a9991bfcf7317b95c54d9bdedcf75c059e Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sun, 26 May 2019 06:31:25 +0200 Subject: [PATCH 4/8] tweaking. --- code/game/objects/items/stunbaton.dm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 39f77f0bfb..3386b54145 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -45,14 +45,14 @@ /obj/item/melee/baton/loaded //this one starts with a cell pre-installed. preload_cell_type = /obj/item/stock_parts/cell/high -/obj/item/melee/baton/proc/deductcharge(chrgdeductamt) +/obj/item/melee/baton/proc/deductcharge(chrgdeductamt, chargecheck = TRUE) if(!cell) switch_status(FALSE, TRUE) return FALSE //Note this value returned is significant, as it will determine //if a stun is applied or not . = cell.use(chrgdeductamt) - if(status && cell.charge < hitcost) + if(status && (!. || (chargecheck && cell.charge < hitcost))) //we're below minimum, turn off switch_status(FALSE) @@ -69,7 +69,7 @@ STOP_PROCESSING(SSobj, src) /obj/item/melee/baton/process() - deductcharge(15 * hitcost * 0.001) + deductcharge(hitcost * 0.004, FALSE) /obj/item/melee/baton/update_icon() if(status) @@ -168,17 +168,21 @@ var/mob/living/carbon/human/H = L if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that playsound(L, 'sound/weapons/genhit.ogg', 50, 1) - return 0 + return FALSE + var/stunpwr = stunforce if(iscyborg(loc)) var/mob/living/silicon/robot/R = loc - if(!R || !R.cell || !R.cell.use(hitcost)) - return 0 + if(!istype(R) || !R.cell || !R.cell.use(hitcost)) + return FALSE else - if(!deductcharge(hitcost)) - return 0 + var/stuncharge = cell.charge + if(!deductcharge(hitcost, FALSE)) + stunpwr *= round(stuncharge/hitcost) + if(stunpwr < stunforce * 0.2) + return FALSE - L.Knockdown(stunforce) - L.adjustStaminaLoss(stunforce*0.1, affected_zone = (istype(user) ? user.zone_selected : BODY_ZONE_CHEST))//CIT CHANGE - makes stunbatons deal extra staminaloss. Todo: make this also deal pain when pain gets implemented. + L.Knockdown(stunpwr) + L.adjustStaminaLoss(stunpwr*0.1, affected_zone = (istype(user) ? user.zone_selected : BODY_ZONE_CHEST))//CIT CHANGE - makes stunbatons deal extra staminaloss. Todo: make this also deal pain when pain gets implemented. L.apply_effect(EFFECT_STUTTER, stunforce) SEND_SIGNAL(L, COMSIG_LIVING_MINOR_SHOCK) if(user) @@ -195,14 +199,14 @@ H.forcesay(GLOB.hit_appends) - return 1 + return TRUE /obj/item/melee/baton/emp_act(severity) . = ..() if (!(. & EMP_PROTECT_SELF)) switch_status(FALSE) deductcharge(1000 / severity) - var/downtime = 4 SECONDS / severity + var/downtime = 5 SECONDS / severity if(emped_timer > world.time) emped_timer += downtime * 0.5 else From 288f97dd1389af7a23ceeb110115289d27825143 Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sun, 26 May 2019 06:38:04 +0200 Subject: [PATCH 5/8] further tweaking. --- code/game/objects/items/stunbaton.dm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 3386b54145..9260b1bc6f 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -1,3 +1,5 @@ +#define STUNBATON_CHARGE_LENIENCY 0.3 + /obj/item/melee/baton name = "stunbaton" desc = "A stun baton for incapacitating people with." @@ -112,9 +114,9 @@ return ..() /obj/item/melee/baton/attack_self(mob/user) - if(cell && cell.charge > hitcost) + if(cell && cell.charge > hitcost * STUNBATON_CHARGE_LENIENCY) if(emped_timer > world.time) - to_chat(user, "[src] briefly flickers as you try to turn it on, looks like it's momentarily out of service.") + to_chat(user, "[src] briefly flickers as you fail to turn it on, looks like it's momentarily out of service.") else switch_status(!status) to_chat(user, "[src] is now [status ? "on" : "off"].") @@ -178,7 +180,7 @@ var/stuncharge = cell.charge if(!deductcharge(hitcost, FALSE)) stunpwr *= round(stuncharge/hitcost) - if(stunpwr < stunforce * 0.2) + if(stunpwr < stunforce * STUNBATON_CHARGE_LENIENCY) return FALSE L.Knockdown(stunpwr) From cfa53d53f16b71b752be206de39b7c004c1838d3 Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sun, 26 May 2019 06:49:58 +0200 Subject: [PATCH 6/8] updating old teleprods. --- code/game/objects/items/stunbaton.dm | 13 +++++++---- code/game/objects/items/teleprod.dm | 34 ++++++++++++---------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 9260b1bc6f..df59b924fe 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -130,10 +130,7 @@ /obj/item/melee/baton/attack(mob/M, mob/living/carbon/human/user) if(status && user.has_trait(TRAIT_CLUMSY) && prob(50)) - user.visible_message("[user] accidentally hits [user.p_them()]self with [src]!", \ - "You accidentally hit yourself with [src]!") - user.Knockdown(stunforce*3) - deductcharge(hitcost) + clowning_around(user) return if(user.getStaminaLoss() >= STAMINA_SOFTCRIT)//CIT CHANGE - makes it impossible to baton in stamina softcrit @@ -203,6 +200,12 @@ return TRUE +/obj/item/melee/baton/proc/clowning_around(mob/living/user) + user.visible_message("[user] accidentally hits [user.p_them()]self with [src]!", \ + "You accidentally hit yourself with [src]!") + user.Knockdown(stunforce*3) + deductcharge(hitcost) + /obj/item/melee/baton/emp_act(severity) . = ..() if (!(. & EMP_PROTECT_SELF)) @@ -238,3 +241,5 @@ /obj/item/melee/baton/cattleprod/baton_stun() if(sparkler.activate()) ..() + +#undef STUNBATON_CHARGE_LENIENCY diff --git a/code/game/objects/items/teleprod.dm b/code/game/objects/items/teleprod.dm index fd9972f427..c514e5e926 100644 --- a/code/game/objects/items/teleprod.dm +++ b/code/game/objects/items/teleprod.dm @@ -6,27 +6,23 @@ item_state = "teleprod" slot_flags = null -/obj/item/melee/baton/cattleprod/teleprod/attack(mob/living/carbon/M, mob/living/carbon/user)//handles making things teleport when hit - ..() - if(status && user.has_trait(TRAIT_CLUMSY) && prob(50)) - user.visible_message("[user] accidentally hits [user.p_them()]self with [src]!", \ - "You accidentally hit yourself with [src]!") - if(do_teleport(user, get_turf(user), 50))//honk honk - SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK) - user.Knockdown(stunforce*3) - deductcharge(hitcost) - else - SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK) - user.Knockdown(stunforce*3) - deductcharge(hitcost/4) +/obj/item/melee/baton/cattleprod/teleprod/baton_stun(mob/living/carbon/M, mob/living/carbon/user)//handles making things teleport when hit + . = ..() + if(!. || !istype(M) || M.anchored) return else - if(status) - if(!istype(M) && M.anchored) - return . - else - SEND_SIGNAL(M, COMSIG_LIVING_MINOR_SHOCK) - do_teleport(M, get_turf(M), 15) + SEND_SIGNAL(M, COMSIG_LIVING_MINOR_SHOCK) + do_teleport(M, get_turf(M), 15) + +/obj/item/melee/baton/cattleprod/teleprod/clowning_around(mob/living/user) + user.visible_message("[user] accidentally hits [user.p_them()]self with [src]!", \ + "You accidentally hit yourself with [src]!") + SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK) + user.Knockdown(stunforce*3) + if(do_teleport(user, get_turf(user), 50)) + deductcharge(hitcost) + else + deductcharge(hitcost * 0.25) /obj/item/melee/baton/cattleprod/attackby(obj/item/I, mob/user, params)//handles sticking a crystal onto a stunprod to make a teleprod if(istype(I, /obj/item/stack/ore/bluespace_crystal)) From a47a7b31ba465169a726e156bbd507a0484290ab Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sun, 26 May 2019 06:56:02 +0200 Subject: [PATCH 7/8] more leniency. --- code/game/objects/items/stunbaton.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index df59b924fe..5a9f3c34e8 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -54,7 +54,7 @@ //Note this value returned is significant, as it will determine //if a stun is applied or not . = cell.use(chrgdeductamt) - if(status && (!. || (chargecheck && cell.charge < hitcost))) + if(status && (!. || (chargecheck && cell.charge < hitcost * STUNBATON_CHARGE_LENIENCY))) //we're below minimum, turn off switch_status(FALSE) From 37aa491fa5cc9409b874434fed4ea027910e21b2 Mon Sep 17 00:00:00 2001 From: Ghommie Date: Mon, 27 May 2019 02:30:03 +0200 Subject: [PATCH 8/8] removes emp downtime, Kev's request. --- code/game/objects/items/stunbaton.dm | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 5a9f3c34e8..5265f555da 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -20,7 +20,6 @@ var/hitcost = 1000 var/throw_hit_chance = 35 var/preload_cell_type //if not empty the baton starts with this type of cell - var/emped_timer = 0 /obj/item/melee/baton/get_cell() return cell @@ -115,11 +114,8 @@ /obj/item/melee/baton/attack_self(mob/user) if(cell && cell.charge > hitcost * STUNBATON_CHARGE_LENIENCY) - if(emped_timer > world.time) - to_chat(user, "[src] briefly flickers as you fail to turn it on, looks like it's momentarily out of service.") - else - switch_status(!status) - to_chat(user, "[src] is now [status ? "on" : "off"].") + switch_status(!status) + to_chat(user, "[src] is now [status ? "on" : "off"].") else switch_status(FALSE, TRUE) if(!cell) @@ -211,11 +207,6 @@ if (!(. & EMP_PROTECT_SELF)) switch_status(FALSE) deductcharge(1000 / severity) - var/downtime = 5 SECONDS / severity - if(emped_timer > world.time) - emped_timer += downtime * 0.5 - else - emped_timer = world.time + downtime //Makeshift stun baton. Replacement for stun gloves. /obj/item/melee/baton/cattleprod