mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 08:36:00 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
169 lines
5.1 KiB
Plaintext
169 lines
5.1 KiB
Plaintext
|
|
|
|
/obj/machinery/field/containment
|
|
name = "containment field"
|
|
desc = "An energy field."
|
|
icon = 'icons/obj/machines/engine/singularity.dmi'
|
|
icon_state = "Contain_F"
|
|
density = FALSE
|
|
move_resist = INFINITY
|
|
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
|
use_power = NO_POWER_USE
|
|
interaction_flags_atom = NONE
|
|
interaction_flags_machine = NONE
|
|
can_atmos_pass = ATMOS_PASS_NO
|
|
light_range = 4
|
|
layer = ABOVE_OBJ_LAYER
|
|
explosion_block = INFINITY
|
|
///First of the generators producing the containment field
|
|
var/obj/machinery/field/generator/field_gen_1 = null
|
|
///Second of the generators producing the containment field
|
|
var/obj/machinery/field/generator/field_gen_2 = null
|
|
|
|
/obj/machinery/field/containment/Initialize(mapload)
|
|
AddElement(/datum/element/blocks_explosives)
|
|
. = ..()
|
|
air_update_turf(TRUE, TRUE)
|
|
RegisterSignal(src, COMSIG_ATOM_SINGULARITY_TRY_MOVE, PROC_REF(block_singularity))
|
|
var/static/list/loc_connections = list(
|
|
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
|
|
)
|
|
AddElement(/datum/element/connect_loc, loc_connections)
|
|
AddElement(/datum/element/give_turf_traits, string_list(list(TRAIT_CONTAINMENT_FIELD)))
|
|
|
|
/obj/machinery/field/containment/Destroy()
|
|
if(field_gen_1)
|
|
field_gen_1.fields -= src
|
|
field_gen_1 = null
|
|
if(field_gen_2)
|
|
field_gen_2.fields -= src
|
|
field_gen_2 = null
|
|
can_atmos_pass = ATMOS_PASS_YES
|
|
air_update_turf(TRUE, FALSE)
|
|
return ..()
|
|
|
|
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
|
/obj/machinery/field/containment/attack_hand(mob/user, list/modifiers)
|
|
if(get_dist(src, user) > 1)
|
|
return FALSE
|
|
else
|
|
yeet_shock(user)
|
|
return TRUE
|
|
|
|
/obj/machinery/field/containment/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers)
|
|
yeet_shock(user)
|
|
return TRUE
|
|
|
|
/obj/machinery/field/containment/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
|
switch(damage_type)
|
|
if(BURN)
|
|
playsound(loc, 'sound/effects/empulse.ogg', 75, TRUE)
|
|
if(BRUTE)
|
|
playsound(loc, 'sound/effects/empulse.ogg', 75, TRUE)
|
|
|
|
/obj/machinery/field/containment/blob_act(obj/structure/blob/B)
|
|
return FALSE
|
|
|
|
/obj/machinery/field/containment/ex_act(severity, target)
|
|
return FALSE
|
|
|
|
/obj/machinery/field/containment/attack_animal(mob/living/simple_animal/user, list/modifiers)
|
|
if(!field_gen_1 || !field_gen_2)
|
|
qdel(src)
|
|
return
|
|
if(ismegafauna(user))
|
|
user.visible_message(span_warning("[user] glows fiercely as the containment field flickers out!"))
|
|
field_gen_1.calc_power(INFINITY) //rip that 'containment' field
|
|
user.adjustHealth(-user.obj_damage)
|
|
else
|
|
return ..()
|
|
|
|
/obj/machinery/field/containment/proc/on_entered(datum/source, atom/movable/considered_atom)
|
|
SIGNAL_HANDLER
|
|
if(isliving(considered_atom))
|
|
var/mob/living/living_moving_through_field = considered_atom
|
|
if(!living_moving_through_field.incorporeal_move)
|
|
yeet_shock(considered_atom)
|
|
|
|
if(ismachinery(considered_atom) || isstructure(considered_atom) || ismecha(considered_atom))
|
|
bump_field(considered_atom)
|
|
|
|
/obj/machinery/field/containment/proc/set_master(master1,master2)
|
|
if(!master1 || !master2)
|
|
return FALSE
|
|
field_gen_1 = master1
|
|
field_gen_2 = master2
|
|
return TRUE
|
|
|
|
/obj/machinery/field/containment/proc/block_singularity()
|
|
SIGNAL_HANDLER
|
|
|
|
return SINGULARITY_TRY_MOVE_BLOCK
|
|
|
|
/obj/machinery/field/containment/yeet_shock(mob/living/user)
|
|
if(!field_gen_1 || !field_gen_2)
|
|
qdel(src)
|
|
return FALSE
|
|
..()
|
|
|
|
/obj/machinery/field/containment/Move()
|
|
qdel(src)
|
|
return FALSE
|
|
|
|
|
|
// Abstract Field Class
|
|
// Used for overriding certain procs
|
|
|
|
/obj/machinery/field
|
|
///Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
|
|
var/has_shocked = FALSE
|
|
|
|
/obj/machinery/field/Bumped(atom/movable/mover)
|
|
if(has_shocked)
|
|
return
|
|
if(isliving(mover))
|
|
yeet_shock(mover)
|
|
return
|
|
if(ismachinery(mover) || isstructure(mover) || isvehicle(mover))
|
|
bump_field(mover)
|
|
return
|
|
|
|
|
|
/obj/machinery/field/CanAllowThrough(atom/movable/mover, border_dir)
|
|
. = ..()
|
|
if(has_shocked || isliving(mover) || ismachinery(mover) || isstructure(mover) || ismecha(mover))
|
|
return FALSE
|
|
|
|
/obj/machinery/field/proc/yeet_shock(mob/living/user)
|
|
var/shock_damage = min(rand(30,40),rand(30,40))
|
|
|
|
if(iscarbon(user))
|
|
user.Paralyze(10 SECONDS)
|
|
user.electrocute_act(shock_damage, src, 1)
|
|
|
|
else if(issilicon(user))
|
|
if(prob(20))
|
|
user.Stun(40)
|
|
user.take_overall_damage(burn = shock_damage)
|
|
user.visible_message(span_danger("[user.name] is shocked by \the [src]!"), \
|
|
span_userdanger("Energy pulse detected, system damaged!"), \
|
|
span_hear("You hear an electrical crack."))
|
|
|
|
user.updatehealth()
|
|
bump_field(user)
|
|
|
|
/obj/machinery/field/proc/clear_shock()
|
|
has_shocked = FALSE
|
|
|
|
/obj/machinery/field/proc/bump_field(atom/movable/considered_atom as mob|obj)
|
|
if(has_shocked)
|
|
return FALSE
|
|
has_shocked = TRUE
|
|
do_sparks(5, TRUE, considered_atom.loc)
|
|
var/atom/target = get_edge_target_turf(considered_atom, get_dir(src, get_step_away(considered_atom, src)))
|
|
if(isliving(considered_atom))
|
|
to_chat(considered_atom, span_userdanger("The field repels you with tremendous force!"))
|
|
playsound(src, 'sound/effects/gravhit.ogg', 50, TRUE)
|
|
considered_atom.throw_at(target, 200, 4)
|
|
addtimer(CALLBACK(src, PROC_REF(clear_shock)), 0.5 SECONDS)
|