From 169a2bedfe447bb6c91e48cc102e07b24b945572 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Sun, 31 Jan 2021 04:09:30 +0300 Subject: [PATCH] Resonator rework (#56293) Co-authored-by: Mothblocks <35135081+Jared-Fogle@users.noreply.github.com> --- code/modules/mining/equipment/resonator.dm | 79 ++++++++++++++++------ code/modules/movespeed/modifiers/mobs.dm | 3 + 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/code/modules/mining/equipment/resonator.dm b/code/modules/mining/equipment/resonator.dm index 6845b42387d..1e89d112eb8 100644 --- a/code/modules/mining/equipment/resonator.dm +++ b/code/modules/mining/equipment/resonator.dm @@ -1,4 +1,9 @@ +#define RESONATOR_MODE_AUTO 1 +#define RESONATOR_MODE_MANUAL 2 +#define RESONATOR_MODE_MATRIX 3 + /**********************Resonator**********************/ + /obj/item/resonator name = "resonator" icon = 'icons/obj/mining.dmi' @@ -6,30 +11,24 @@ inhand_icon_state = "resonator" lefthand_file = 'icons/mob/inhands/equipment/mining_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi' - desc = "A handheld device that creates small fields of energy that resonate until they detonate, crushing rock. It does increased damage in low pressure." + desc = "A handheld device that creates small fields of energy that resonate until they detonate, crushing rock. It does increased damage in low pressure. It has two modes: Automatic and manual detonation." w_class = WEIGHT_CLASS_NORMAL force = 15 throwforce = 10 - var/burst_time = 30 + + var/mode = RESONATOR_MODE_AUTO + /// How efficient it is in manual mode. Yes, we lower the damage cuz it's gonna be used for mobhunt + var/quick_burst_mod = 0.8 var/fieldlimit = 4 var/list/fields = list() - var/quick_burst_mod = 0.8 - -/obj/item/resonator/upgraded - name = "upgraded resonator" - desc = "An upgraded version of the resonator that can produce more fields at once, as well as having no damage penalty for bursting a resonance field early." - icon_state = "resonator_u" - inhand_icon_state = "resonator_u" - fieldlimit = 6 - quick_burst_mod = 1 /obj/item/resonator/attack_self(mob/user) - if(burst_time == 50) - burst_time = 30 - to_chat(user, "You set the resonator's fields to detonate after 3 seconds.") + if(mode == RESONATOR_MODE_AUTO) + to_chat(user, "You set the resonator's fields to detonate only after you hit one with it.") + mode = RESONATOR_MODE_MANUAL else - burst_time = 50 - to_chat(user, "You set the resonator's fields to detonate after 5 seconds.") + to_chat(user, "You set the resonator's fields to automatically detonate after 2 seconds.") + mode = RESONATOR_MODE_AUTO /obj/item/resonator/proc/CreateResonance(target, mob/user) var/turf/T = get_turf(target) @@ -39,7 +38,7 @@ R.burst() return if(LAZYLEN(fields) < fieldlimit) - new /obj/effect/temp_visual/resonance(T, user, src, burst_time) + new /obj/effect/temp_visual/resonance(T, user, src, mode) user.changeNext_move(CLICK_CD_MELEE) /obj/item/resonator/pre_attack(atom/target, mob/user, params) @@ -53,22 +52,29 @@ desc = "A resonating field that significantly damages anything inside of it when the field eventually ruptures. More damaging in low pressure environments." icon_state = "shield1" layer = ABOVE_ALL_MOB_LAYER - duration = 50 + duration = 60 SECONDS var/resonance_damage = 20 var/damage_multiplier = 1 var/creator var/obj/item/resonator/res + var/rupturing = FALSE //So it won't recurse -/obj/effect/temp_visual/resonance/Initialize(mapload, set_creator, set_resonator, set_duration) - duration = set_duration +/obj/effect/temp_visual/resonance/Initialize(mapload, set_creator, set_resonator, mode) + if(mode == RESONATOR_MODE_AUTO) + duration = 2 SECONDS + if(mode == RESONATOR_MODE_MATRIX) + icon_state = "shield2" + name = "resonance matrix" + RegisterSignal(src, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED), .proc/burst) . = ..() creator = set_creator res = set_resonator if(res) res.fields += src playsound(src,'sound/weapons/resonator_fire.ogg',50,TRUE) - transform = matrix()*0.75 - animate(src, transform = matrix()*1.5, time = duration) + if(mode == RESONATOR_MODE_AUTO) + transform = matrix()*0.75 + animate(src, transform = matrix()*1.5, time = duration) deltimer(timerid) timerid = addtimer(CALLBACK(src, .proc/burst), duration, TIMER_STOPPABLE) @@ -91,6 +97,7 @@ resonance_damage *= damage_multiplier /obj/effect/temp_visual/resonance/proc/burst() + rupturing = TRUE var/turf/T = get_turf(src) new /obj/effect/temp_visual/resonance_crush(T) if(ismineralturf(T)) @@ -103,6 +110,11 @@ log_combat(creator, L, "used a resonator field on", "resonator") to_chat(L, "[src] ruptured with you in it!") L.apply_damage(resonance_damage, BRUTE) + L.add_movespeed_modifier(/datum/movespeed_modifier/resonance) + addtimer(CALLBACK(L, /mob/proc/remove_movespeed_modifier, /datum/movespeed_modifier/resonance), 10 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE) + for(var/obj/effect/temp_visual/resonance/field in range(1, src)) + if(field != src && !field.rupturing) + field.burst() qdel(src) /obj/effect/temp_visual/resonance_crush @@ -114,3 +126,26 @@ . = ..() transform = matrix()*1.5 animate(src, transform = matrix()*0.1, alpha = 50, time = 4) + +/obj/item/resonator/upgraded + name = "upgraded resonator" + desc = "An upgraded version of the resonator that can produce more fields at once, as well as having no damage penalty for bursting a resonance field early. It also allows you to set 'Resonance matrixes', that detonate after someone(or something) walks over it." + icon_state = "resonator_u" + inhand_icon_state = "resonator_u" + fieldlimit = 6 + quick_burst_mod = 1 + +/obj/item/resonator/upgraded/attack_self(mob/user) + if(mode == RESONATOR_MODE_AUTO) + to_chat(user, "You set the resonator's fields to detonate only after you hit one with it.") + mode = RESONATOR_MODE_MANUAL + else if(mode == RESONATOR_MODE_MANUAL) + to_chat(user, "You set the resonator's fields to work as matrix traps.") + mode = RESONATOR_MODE_MATRIX + else + to_chat(user, "You set the resonator's fields to automatically detonate after 2 seconds.") + mode = RESONATOR_MODE_AUTO + +#undef RESONATOR_MODE_AUTO +#undef RESONATOR_MODE_MANUAL +#undef RESONATOR_MODE_MATRIX diff --git a/code/modules/movespeed/modifiers/mobs.dm b/code/modules/movespeed/modifiers/mobs.dm index 577d296f45a..eb0e05fae55 100644 --- a/code/modules/movespeed/modifiers/mobs.dm +++ b/code/modules/movespeed/modifiers/mobs.dm @@ -16,6 +16,9 @@ /datum/movespeed_modifier/slaughter multiplicative_slowdown = -1 +/datum/movespeed_modifier/resonance + multiplicative_slowdown = 0.75 + /datum/movespeed_modifier/damage_slowdown blacklisted_movetypes = FLOATING|FLYING variable = TRUE