mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-18 14:12:20 +00:00
* Adds linter defines to repo. * Uncomments linter defines already in the code. * Resolves unreachable code linter errors. * Nukes decade+ old syndie specops code except for computer since that's mapped in????? * Resolves procs has no parent linter error. * Proc signature fixes * Bad comments * "In" danger * Type safety * Implied nested list abuse * Top level ..() usage * Sleepy coder typos * Invalid kwargs calls * Pointless returns * Linter hacks (see full message) Byond doesn't care and it has no effect but linter doesn't like var/proc for holding references to procs, despite that it's valid byond code. Also, the linter seems to have serious issues figuring out relative proc names. This commit is a sort of take-it-or-leave-it thing. It's not required, it just cuts down on warnings, but this code is valid DM code. * WHATEVER THIS IS * Trick dreamchecker linter into ignoring this file's sins in it's weird use of vars * Fix list decoration syntax - Its a list, not list of lists - To declare that a var is a list you can `var/list/blah = list()` syntax or the `var/blah[0]` syntax. Both do exactly the same thing. But if you do `var/list/blah[0]` that is just like doing `var/list/list/blah = list()` * Hopefully stops the ai holder subtype folder from going quantum and sometimes changes capitalization over time, and incidentally causing 20+ linter errors. * Fixes unwrapped negated object in list linter error. * Resolves colon-like list accessing linter error. * Turns linter on in linter config. * Fixes closet indentation properly and cleans up suit storage unit switch. Co-authored-by: Aronai Sieyes <arokha@arokha.com> Co-authored-by: Leshana <Leshana@users.noreply.github.com>
86 lines
2.2 KiB
Plaintext
86 lines
2.2 KiB
Plaintext
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
|
|
|
/obj/machinery/containment_field
|
|
name = "Containment Field"
|
|
desc = "An energy field."
|
|
icon = 'icons/obj/singularity.dmi'
|
|
icon_state = "Contain_F"
|
|
anchored = 1
|
|
density = 0
|
|
unacidable = 1
|
|
use_power = USE_POWER_OFF
|
|
light_range = 4
|
|
var/obj/machinery/field_generator/FG1 = null
|
|
var/obj/machinery/field_generator/FG2 = null
|
|
var/list/shockdirs
|
|
var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
|
|
|
|
/obj/machinery/containment_field/Initialize()
|
|
. = ..()
|
|
shockdirs = list(turn(dir,90),turn(dir,-90))
|
|
sense_proximity(callback = /atom/proc/HasProximity)
|
|
|
|
/obj/machinery/containment_field/set_dir(new_dir)
|
|
. = ..()
|
|
if(.)
|
|
shockdirs = list(turn(dir,90),turn(dir,-90))
|
|
|
|
/obj/machinery/containment_field/Destroy()
|
|
unsense_proximity(callback = /atom/proc/HasProximity)
|
|
if(FG1 && !FG1.clean_up)
|
|
FG1.cleanup()
|
|
if(FG2 && !FG2.clean_up)
|
|
FG2.cleanup()
|
|
. = ..()
|
|
|
|
/obj/machinery/containment_field/attack_hand(mob/user as mob)
|
|
if(get_dist(src, user) > 1)
|
|
return 0
|
|
else
|
|
shock(user)
|
|
return 1
|
|
|
|
|
|
/obj/machinery/containment_field/ex_act(severity)
|
|
return 0
|
|
|
|
/obj/machinery/containment_field/Crossed(mob/living/L)
|
|
if(!istype(L) || L.incorporeal_move)
|
|
return
|
|
shock(L)
|
|
|
|
/obj/machinery/containment_field/HasProximity(turf/T, atom/movable/AM, old_loc)
|
|
if(!istype(AM, /mob/living) || AM:incorporeal_move)
|
|
return 0
|
|
if(!(get_dir(src,AM) in shockdirs))
|
|
return 0
|
|
if(issilicon(AM) ? prob(40) : prob(50))
|
|
shock(AM)
|
|
return 1
|
|
return 0
|
|
|
|
/obj/machinery/containment_field/shock(mob/living/user as mob)
|
|
if(hasShocked)
|
|
return 0
|
|
if(!FG1 || !FG2)
|
|
qdel(src)
|
|
return 0
|
|
if(isliving(user))
|
|
hasShocked = 1
|
|
var/shock_damage = min(rand(30,40),rand(30,40))
|
|
user.electrocute_act(shock_damage, src, 1, BP_TORSO)
|
|
|
|
var/atom/target = get_edge_target_turf(user, get_dir(src, get_step_away(user, src)))
|
|
user.throw_at(target, 200, 4)
|
|
|
|
sleep(20)
|
|
|
|
hasShocked = 0
|
|
|
|
/obj/machinery/containment_field/proc/set_master(var/master1,var/master2)
|
|
if(!master1 || !master2)
|
|
return 0
|
|
FG1 = master1
|
|
FG2 = master2
|
|
return 1
|