mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 11:36:24 +01:00
better resonator (spreading) (#65297)
adds some documentation to resonators adds spreading to resonators, where the field has a chance (that lowers each spread) to spawn more fields. the spreading idea did come from yogstation, but I changed how it decides to spread
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
#define RESONATOR_MODE_AUTO 1
|
||||
#define RESONATOR_MODE_MANUAL 2
|
||||
#define RESONATOR_MODE_MATRIX 3
|
||||
|
||||
/**********************Resonator**********************/
|
||||
|
||||
/obj/item/resonator
|
||||
@@ -16,11 +12,16 @@
|
||||
force = 15
|
||||
throwforce = 10
|
||||
|
||||
/// the mode of the resonator; has three modes: auto (1), manual (2), and matrix (3)
|
||||
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
|
||||
/// the number of fields the resonator is allowed to have at once
|
||||
var/fieldlimit = 4
|
||||
/// the list of currently active fields from this resonator
|
||||
var/list/fields = list()
|
||||
/// the number that is added to the failure_prob, which is the probability of whether it will spread or not
|
||||
var/adding_failure = 50
|
||||
|
||||
/obj/item/resonator/attack_self(mob/user)
|
||||
if(mode == RESONATOR_MODE_AUTO)
|
||||
@@ -30,20 +31,20 @@
|
||||
to_chat(user, span_info("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)
|
||||
var/obj/effect/temp_visual/resonance/R = locate(/obj/effect/temp_visual/resonance) in T
|
||||
if(R)
|
||||
R.damage_multiplier = quick_burst_mod
|
||||
R.burst()
|
||||
/obj/item/resonator/proc/create_resonance(target, mob/user)
|
||||
var/turf/target_turf = get_turf(target)
|
||||
var/obj/effect/temp_visual/resonance/resonance_field = locate(/obj/effect/temp_visual/resonance) in target_turf
|
||||
if(resonance_field)
|
||||
resonance_field.damage_multiplier = quick_burst_mod
|
||||
resonance_field.burst()
|
||||
return
|
||||
if(LAZYLEN(fields) < fieldlimit)
|
||||
new /obj/effect/temp_visual/resonance(T, user, src, mode)
|
||||
new /obj/effect/temp_visual/resonance(target_turf, user, src, mode, adding_failure)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
|
||||
/obj/item/resonator/pre_attack(atom/target, mob/user, params)
|
||||
if(check_allowed_items(target, 1))
|
||||
CreateResonance(target, user)
|
||||
if(check_allowed_items(target, TRUE))
|
||||
create_resonance(target, user)
|
||||
. = ..()
|
||||
|
||||
//resonance field, crushes rock, damages mobs
|
||||
@@ -54,13 +55,22 @@
|
||||
layer = ABOVE_ALL_MOB_LAYER
|
||||
plane = ABOVE_GAME_PLANE
|
||||
duration = 60 SECONDS
|
||||
/// the amount of damage living beings will take whilst inside the field during its burst
|
||||
var/resonance_damage = 20
|
||||
/// the modifier to resonance_damage; affected by the quick_burst_mod from the resonator
|
||||
var/damage_multiplier = 1
|
||||
/// the parent creator (user) of this field
|
||||
var/creator
|
||||
var/obj/item/resonator/res
|
||||
var/rupturing = FALSE //So it won't recurse
|
||||
/// the parent resonator of this field
|
||||
var/obj/item/resonator/parent_resonator
|
||||
/// whether the field is rupturing currently or not (to prevent recursion)
|
||||
var/rupturing = FALSE
|
||||
/// the probability that the field will not be able to spread
|
||||
var/failure_prob = 0
|
||||
/// the number that is added to the failure_prob. Will default to 50
|
||||
var/adding_failure
|
||||
|
||||
/obj/effect/temp_visual/resonance/Initialize(mapload, set_creator, set_resonator, mode)
|
||||
/obj/effect/temp_visual/resonance/Initialize(mapload, set_creator, set_resonator, mode, set_failure = 50)
|
||||
if(mode == RESONATOR_MODE_AUTO)
|
||||
duration = 2 SECONDS
|
||||
if(mode == RESONATOR_MODE_MATRIX)
|
||||
@@ -73,9 +83,10 @@
|
||||
AddElement(/datum/element/connect_loc, loc_connections)
|
||||
. = ..()
|
||||
creator = set_creator
|
||||
res = set_resonator
|
||||
if(res)
|
||||
res.fields += src
|
||||
parent_resonator = set_resonator
|
||||
if(parent_resonator)
|
||||
parent_resonator.fields += src
|
||||
adding_failure = set_failure
|
||||
playsound(src,'sound/weapons/resonator_fire.ogg',50,TRUE)
|
||||
if(mode == RESONATOR_MODE_AUTO)
|
||||
transform = matrix()*0.75
|
||||
@@ -84,9 +95,9 @@
|
||||
timerid = addtimer(CALLBACK(src, .proc/burst), duration, TIMER_STOPPABLE)
|
||||
|
||||
/obj/effect/temp_visual/resonance/Destroy()
|
||||
if(res)
|
||||
res.fields -= src
|
||||
res = null
|
||||
if(parent_resonator)
|
||||
parent_resonator.fields -= src
|
||||
parent_resonator = null
|
||||
creator = null
|
||||
. = ..()
|
||||
|
||||
@@ -104,23 +115,30 @@
|
||||
/obj/effect/temp_visual/resonance/proc/burst()
|
||||
SIGNAL_HANDLER
|
||||
rupturing = TRUE
|
||||
var/turf/T = get_turf(src)
|
||||
new /obj/effect/temp_visual/resonance_crush(T)
|
||||
if(ismineralturf(T))
|
||||
var/turf/closed/mineral/M = T
|
||||
M.gets_drilled(creator)
|
||||
check_pressure(T)
|
||||
playsound(T,'sound/weapons/resonator_blast.ogg',50,TRUE)
|
||||
for(var/mob/living/L in T)
|
||||
var/turf/src_turf = get_turf(src)
|
||||
new /obj/effect/temp_visual/resonance_crush(src_turf)
|
||||
if(ismineralturf(src_turf))
|
||||
var/turf/closed/mineral/mineral_turf = src_turf
|
||||
mineral_turf.gets_drilled(creator)
|
||||
check_pressure(src_turf)
|
||||
playsound(src_turf, 'sound/weapons/resonator_blast.ogg', 50, TRUE)
|
||||
for(var/mob/living/attacked_living in src_turf)
|
||||
if(creator)
|
||||
log_combat(creator, L, "used a resonator field on", "resonator")
|
||||
to_chat(L, span_userdanger("[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()
|
||||
log_combat(creator, attacked_living, "used a resonator field on", "resonator")
|
||||
to_chat(attacked_living, span_userdanger("[src] ruptured with you in it!"))
|
||||
attacked_living.apply_damage(resonance_damage, BRUTE)
|
||||
attacked_living.add_movespeed_modifier(/datum/movespeed_modifier/resonance)
|
||||
addtimer(CALLBACK(attacked_living, /mob/proc/remove_movespeed_modifier, /datum/movespeed_modifier/resonance), 10 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE)
|
||||
for(var/obj/effect/temp_visual/resonance/field in orange(1, src))
|
||||
if(field.rupturing)
|
||||
continue
|
||||
field.burst()
|
||||
if(!prob(failure_prob) && parent_resonator)
|
||||
for(var/turf/closed/mineral/mineral_spread in orange(1, src))
|
||||
if(locate(/obj/effect/temp_visual/resonance) in mineral_spread)
|
||||
continue
|
||||
var/obj/effect/temp_visual/resonance/new_field = new(mineral_spread, creator, parent_resonator, parent_resonator.mode)
|
||||
new_field.failure_prob = failure_prob + adding_failure
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/temp_visual/resonance_crush
|
||||
@@ -131,8 +149,8 @@
|
||||
|
||||
/obj/effect/temp_visual/resonance_crush/Initialize(mapload)
|
||||
. = ..()
|
||||
transform = matrix()*1.5
|
||||
animate(src, transform = matrix()*0.1, alpha = 50, time = 4)
|
||||
transform = matrix() * 1.5
|
||||
animate(src, transform = matrix() * 0.1, alpha = 50, time = 4)
|
||||
|
||||
/obj/item/resonator/upgraded
|
||||
name = "upgraded resonator"
|
||||
@@ -141,6 +159,7 @@
|
||||
inhand_icon_state = "resonator_u"
|
||||
fieldlimit = 6
|
||||
quick_burst_mod = 1
|
||||
adding_failure = 30
|
||||
|
||||
/obj/item/resonator/upgraded/attack_self(mob/user)
|
||||
if(mode == RESONATOR_MODE_AUTO)
|
||||
@@ -152,7 +171,3 @@
|
||||
else
|
||||
to_chat(user, span_info("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
|
||||
|
||||
Reference in New Issue
Block a user