diff --git a/.gitignore b/.gitignore index e76c9f6db1d..648359d0a36 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,9 @@ /config/* !config/**/*/ +# ignore cfg, an internal BYOND folder +/cfg/* + #ignore other, specific files and folers *.before data/ diff --git a/_build_dependencies.sh b/_build_dependencies.sh index 24a33ed3644..e78949dc81e 100644 --- a/_build_dependencies.sh +++ b/_build_dependencies.sh @@ -1,6 +1,6 @@ # This file has all the information on what versions of libraries are thrown into the code # For dreamchecker -export SPACEMANDMM_TAG=suite-1.2 +export SPACEMANDMM_TAG=suite-1.4 # For NanoUI export NODE_VERSION=9 # For the scripts in tools @@ -8,4 +8,4 @@ export PHP_VERSION=5.6 # Byond Major export BYOND_MAJOR=513 # Byond Minor -export BYOND_MINOR=1505 +export BYOND_MINOR=1514 diff --git a/_maps/map_files/Delta/delta.dmm b/_maps/map_files/Delta/delta.dmm index 171e1ffde1a..54ad9d08447 100644 --- a/_maps/map_files/Delta/delta.dmm +++ b/_maps/map_files/Delta/delta.dmm @@ -24058,29 +24058,17 @@ pressure_checks_default = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "aUm" = ( /obj/machinery/camera{ c_tag = "Atmospherics Air Tank"; network = list("SS13","Engineering") }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "aUn" = ( -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "aUo" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply, @@ -25034,31 +25022,19 @@ frequency = 1441; id_tag = "air_sensor" }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "aVT" = ( /obj/machinery/portable_atmospherics/canister/air{ anchored = 1 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "aVU" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "aVV" = ( /obj/structure/table/wood, @@ -25824,24 +25800,14 @@ /turf/simulated/floor/plating, /area/security/prison) "aXa" = ( -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "aXb" = ( /obj/machinery/camera{ c_tag = "Atmospherics CO2 Tank"; network = list("SS13","Engineering") }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "aXc" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -25860,12 +25826,7 @@ pressure_checks_default = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "aXd" = ( /obj/structure/grille, @@ -26062,11 +26023,7 @@ frequency = 1441; id = "air_in" }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "aXy" = ( /obj/structure/cable{ @@ -26589,35 +26546,20 @@ /obj/machinery/light/small{ dir = 8 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "aYv" = ( /obj/machinery/portable_atmospherics/canister/carbon_dioxide{ anchored = 1 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "aYw" = ( /obj/machinery/air_sensor{ frequency = 1441; id_tag = "co2_sensor" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "aYx" = ( /obj/structure/window/reinforced{ @@ -27718,12 +27660,7 @@ frequency = 1441; id = "co2_in" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "bah" = ( /obj/structure/grille, @@ -27932,29 +27869,17 @@ pressure_checks_default = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "baA" = ( /obj/machinery/camera{ c_tag = "Atmospherics Oxygen Tank"; network = list("SS13","Engineering") }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "baB" = ( -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "baC" = ( /obj/effect/decal/cleanable/dirt, @@ -28759,31 +28684,19 @@ frequency = 1441; id_tag = "o2_sensor" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "bbZ" = ( /obj/machinery/portable_atmospherics/canister/oxygen{ anchored = 1 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "bca" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "bcb" = ( /obj/effect/decal/cleanable/dirt, @@ -29370,26 +29283,14 @@ }, /area/shuttle/pod_3) "bdk" = ( -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bdl" = ( /obj/machinery/camera{ c_tag = "Atmospherics Toxins Tank"; network = list("SS13","Engineering") }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bdm" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -29408,13 +29309,7 @@ pressure_checks_default = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bdn" = ( /obj/structure/window/reinforced{ @@ -29502,11 +29397,7 @@ frequency = 1441; id = "o2_in" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "bdw" = ( /obj/structure/reagent_dispensers/watertank, @@ -30166,38 +30057,20 @@ /obj/machinery/light/small{ dir = 8 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "beF" = ( /obj/machinery/portable_atmospherics/canister/toxins{ anchored = 1 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "beG" = ( /obj/machinery/air_sensor{ frequency = 1441; id_tag = "tox_sensor" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "beH" = ( /obj/structure/window/reinforced{ @@ -30872,13 +30745,7 @@ frequency = 1441; id = "tox_in" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bgb" = ( /obj/structure/window/reinforced, @@ -30999,29 +30866,17 @@ pressure_checks_default = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bgl" = ( /obj/machinery/camera{ c_tag = "Atmospherics Nitrogen Tank"; network = list("SS13","Engineering") }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bgm" = ( -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bgn" = ( /turf/simulated/floor/plasteel{ @@ -31594,31 +31449,19 @@ frequency = 1441; id_tag = "n2_sensor" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bht" = ( /obj/machinery/portable_atmospherics/canister/nitrogen{ anchored = 1 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bhu" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bhv" = ( /obj/structure/reagent_dispensers/watertank, @@ -32533,11 +32376,7 @@ frequency = 1441; id = "n2_in" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bjc" = ( /obj/structure/closet/crate, @@ -112194,17 +112033,6 @@ /obj/effect/decal/warning_stripes/west, /turf/simulated/floor/plasteel, /area/shuttle/escape) -"dTU" = ( -/obj/docking_port/stationary{ - dir = 8; - dwidth = 3; - height = 5; - id = "sit_scimaint"; - name = "Cyberiad Science Maint"; - width = 11 - }, -/turf/space, -/area/space/nearstation) "dTV" = ( /obj/machinery/power/solar{ name = "Aft Starboard Solar Panel" @@ -170544,7 +170372,7 @@ aaa aaa aaa aaa -dTU +aaa aaa aaa aaa diff --git a/_maps/map_files/MetaStation/MetaStation.v41A.II.dmm b/_maps/map_files/MetaStation/MetaStation.v41A.II.dmm index 773ff5cb937..bcb253857e7 100644 --- a/_maps/map_files/MetaStation/MetaStation.v41A.II.dmm +++ b/_maps/map_files/MetaStation/MetaStation.v41A.II.dmm @@ -55399,9 +55399,7 @@ /turf/simulated/floor/engine/n20, /area/atmos) "bRk" = ( -/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller{ - valve_open = 1 - }, +/obj/machinery/portable_atmospherics/canister/sleeping_agent, /turf/simulated/floor/engine/n20, /area/atmos) "bRl" = ( @@ -57907,35 +57905,17 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bVV" = ( -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bVW" = ( /obj/effect/landmark{ name = "xeno_spawn"; pixel_x = -1 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bVY" = ( /obj/structure/window/reinforced{ @@ -58797,35 +58777,17 @@ frequency = 1441; id_tag = "tox_sensor" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bXA" = ( /obj/machinery/portable_atmospherics/canister/toxins, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bXB" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bXH" = ( /obj/structure/cable/yellow{ @@ -59451,13 +59413,7 @@ id = "tox_in"; pixel_y = 1 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bYP" = ( /obj/item/storage/belt/utility, @@ -59976,13 +59932,7 @@ dir = 8; network = list("SS13") }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "bZP" = ( /turf/simulated/wall, @@ -60850,20 +60800,10 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "cbl" = ( -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "cbm" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -61344,32 +61284,17 @@ frequency = 1441; id_tag = "co2_sensor" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "cci" = ( /obj/machinery/portable_atmospherics/canister/carbon_dioxide, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "ccj" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "ccl" = ( /obj/effect/landmark{ @@ -62198,12 +62123,7 @@ id = "co2_in"; pixel_y = 1 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "cdA" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ @@ -62396,12 +62316,7 @@ dir = 8; network = list("SS13") }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "cdT" = ( /turf/simulated/wall, @@ -69133,22 +69048,14 @@ frequency = 1441; id = "n2_in" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "cpi" = ( /obj/machinery/air_sensor{ frequency = 1441; id_tag = "n2_sensor" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "cpj" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -69162,11 +69069,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "cpk" = ( /obj/machinery/atmospherics/unary/outlet_injector/on{ @@ -69174,22 +69077,14 @@ frequency = 1441; id = "o2_in" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "cpl" = ( /obj/machinery/air_sensor{ frequency = 1441; id_tag = "o2_sensor" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "cpm" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -69203,11 +69098,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "cpn" = ( /obj/machinery/atmospherics/unary/outlet_injector/on{ @@ -69215,11 +69106,7 @@ frequency = 1443; id = "air_in" }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "cpo" = ( /obj/machinery/air_sensor{ @@ -69227,11 +69114,7 @@ id_tag = "air_sensor"; output = 7 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "cpp" = ( /obj/machinery/atmospherics/unary/vent_pump/high_volume{ @@ -69245,11 +69128,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "cpq" = ( /obj/machinery/atmospherics/binary/pump{ @@ -70140,19 +70019,11 @@ name = "\improper Secure Lab" }) "cqK" = ( -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "cqL" = ( /obj/machinery/portable_atmospherics/canister/nitrogen, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "cqM" = ( /obj/machinery/door_control{ @@ -70163,19 +70034,11 @@ /turf/simulated/floor/engine, /area/toxins/explab) "cqN" = ( -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "cqO" = ( /obj/machinery/portable_atmospherics/canister/oxygen, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "cqP" = ( /obj/structure/cable{ @@ -70190,19 +70053,11 @@ name = "xeno_spawn"; pixel_x = -1 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "cqR" = ( /obj/machinery/portable_atmospherics/canister/air, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "cqS" = ( /obj/machinery/camera{ @@ -70210,11 +70065,7 @@ dir = 8; network = list("SS13") }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "cqT" = ( /obj/machinery/atmospherics/unary/outlet_injector/on{ @@ -70418,11 +70269,7 @@ dir = 8; network = list("SS13") }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "crm" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ @@ -70487,11 +70334,7 @@ dir = 8; network = list("SS13") }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "crr" = ( /turf/simulated/floor/plasteel{ @@ -71112,34 +70955,18 @@ /area/space/nearstation) "csq" = ( /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "csr" = ( /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "css" = ( -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "cst" = ( /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "csu" = ( /obj/item/stack/rods{ diff --git a/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm b/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm index e99384893a1..835da590501 100644 --- a/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm +++ b/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm @@ -857,21 +857,13 @@ frequency = 1442; id_tag = "syndie_lavaland_n2_sensor" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/ruin/unpowered/syndicate_lava_base/engineering) "bt" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/ruin/unpowered/syndicate_lava_base/engineering) "bu" = ( /obj/machinery/atmospherics/unary/vent_pump/siphon/on{ @@ -880,11 +872,7 @@ id_tag = "syndie_lavaland_n2_out"; name = "nitrogen out" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/ruin/unpowered/syndicate_lava_base/engineering) "bv" = ( /obj/effect/turf_decal/stripes/line{ @@ -1243,32 +1231,20 @@ /area/ruin/unpowered/syndicate_lava_base/main) "cg" = ( /obj/machinery/portable_atmospherics/canister/nitrogen, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/ruin/unpowered/syndicate_lava_base/engineering) "ch" = ( /obj/machinery/air_sensor{ frequency = 1442; id_tag = "syndie_lavaland_o2_sensor" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/ruin/unpowered/syndicate_lava_base/engineering) "ci" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/ruin/unpowered/syndicate_lava_base/engineering) "cj" = ( /obj/machinery/atmospherics/unary/vent_pump/siphon/on{ @@ -1277,19 +1253,11 @@ id_tag = "syndie_lavaland_o2_out"; name = "oxygen out" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/ruin/unpowered/syndicate_lava_base/engineering) "ck" = ( /obj/machinery/portable_atmospherics/canister/oxygen, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/ruin/unpowered/syndicate_lava_base/engineering) "cl" = ( /obj/machinery/atmospherics/unary/vent_pump/siphon/on{ @@ -1298,46 +1266,22 @@ id_tag = "syndie_lavaland_tox_out"; name = "toxin out" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/ruin/unpowered/syndicate_lava_base/engineering) "cm" = ( /obj/machinery/air_sensor{ frequency = 1442; id_tag = "syndie_lavaland_tox_sensor" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/ruin/unpowered/syndicate_lava_base/engineering) "cn" = ( /obj/machinery/portable_atmospherics/canister/toxins, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/ruin/unpowered/syndicate_lava_base/engineering) "co" = ( /obj/machinery/light/small, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/ruin/unpowered/syndicate_lava_base/engineering) "cp" = ( /obj/structure/cable{ diff --git a/_maps/map_files/RandomRuins/SpaceRuins/deepstorage.dmm b/_maps/map_files/RandomRuins/SpaceRuins/deepstorage.dmm index 392592e56a5..8bb87d2026e 100644 --- a/_maps/map_files/RandomRuins/SpaceRuins/deepstorage.dmm +++ b/_maps/map_files/RandomRuins/SpaceRuins/deepstorage.dmm @@ -591,10 +591,6 @@ }, /turf/simulated/floor/light, /area/ruin/unpowered) -"bq" = ( -/obj/machinery/blackbox_recorder, -/turf/simulated/floor/plasteel, -/area/ruin/unpowered) "br" = ( /obj/structure/cable{ icon_state = "0-4"; @@ -2575,8 +2571,8 @@ ac bg bj ac -bq bx +ar bG bO bU diff --git a/_maps/map_files/RandomRuins/SpaceRuins/oldstation.dmm b/_maps/map_files/RandomRuins/SpaceRuins/oldstation.dmm index 58eae91a94f..6562103334e 100644 --- a/_maps/map_files/RandomRuins/SpaceRuins/oldstation.dmm +++ b/_maps/map_files/RandomRuins/SpaceRuins/oldstation.dmm @@ -510,10 +510,10 @@ /area/template_noop) "bu" = ( /turf/simulated/wall/rust, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bv" = ( /turf/simulated/wall, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bw" = ( /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, @@ -615,7 +615,7 @@ "bM" = ( /obj/effect/spawner/window/reinforced, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bN" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/blood/old, @@ -623,16 +623,16 @@ /obj/effect/decal/cleanable/cobweb, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bO" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bP" = ( /obj/structure/sign/poster/official/science, /turf/simulated/wall/rust, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bQ" = ( /turf/simulated/wall/rust, /area/ruin/space/ancientstation/hivebot) @@ -647,7 +647,7 @@ "bS" = ( /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bT" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/closet/crate, @@ -662,7 +662,7 @@ /obj/item/bonesetter, /obj/item/stack/medical/bruise_pack/advanced, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "bU" = ( /obj/machinery/door/airlock/command, /turf/simulated/floor/plasteel/airless, @@ -764,7 +764,7 @@ }, /obj/effect/decal/cleanable/dirt, /obj/machinery/door/airlock/command{ - name = "Delta Station Access" + name = "Theta Station Access" }, /turf/simulated/floor/plasteel, /area/ruin/space/ancientstation/powered) @@ -779,7 +779,7 @@ /obj/effect/spawner/window/reinforced, /obj/structure/transit_tube, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ck" = ( /obj/structure/lattice/catwalk, /turf/simulated/floor/plating/airless, @@ -789,19 +789,19 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cm" = ( /obj/effect/decal/cleanable/dirt, /obj/item/stack/medical/bruise_pack, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cn" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/door/airlock/command, /obj/structure/barricade/wooden, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "co" = ( /obj/effect/decal/cleanable/blood/oil, /mob/living/simple_animal/hostile/hivebot, @@ -818,7 +818,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cq" = ( /obj/structure/cable{ d1 = 4; @@ -830,7 +830,7 @@ /obj/machinery/door/airlock/science, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cr" = ( /obj/structure/cable{ d1 = 1; @@ -840,14 +840,14 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cs" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/door/firedoor, /obj/machinery/door/airlock/science, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ct" = ( /obj/item/twohanded/required/kirbyplants{ icon_state = "plant-dead" @@ -855,12 +855,12 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cu" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/door/airlock/maintenance_hatch, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cv" = ( /obj/effect/decal/cleanable/blood/oil, /obj/effect/decal/remains/robot{ @@ -964,7 +964,7 @@ /obj/item/pickaxe, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cJ" = ( /obj/machinery/light{ icon_state = "tube1"; @@ -973,7 +973,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cK" = ( /obj/effect/decal/remains/robot{ icon_state = "gib5" @@ -998,7 +998,7 @@ /obj/machinery/door/airlock/science, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cN" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -1006,7 +1006,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cO" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -1015,7 +1015,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cP" = ( /obj/effect/decal/cleanable/blood/oil, /mob/living/simple_animal/hostile/hivebot/strong, @@ -1033,7 +1033,7 @@ /obj/item/tank/plasma/full, /obj/item/tank/plasma/full, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "cR" = ( /obj/structure/table, /obj/item/storage/firstaid/ancient, @@ -1065,7 +1065,7 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/power/apc{ dir = 1; - name = "Delta Prototype Lab APC"; + name = "Thete Prototype Lab APC"; pixel_y = 24; report_power_alarm = 0; start_charge = 0 @@ -1165,7 +1165,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "di" = ( /obj/machinery/atmospherics/pipe/manifold/hidden/supply{ dir = 4 @@ -1173,7 +1173,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "dj" = ( /turf/simulated/wall/rust, /area/ruin/space/ancientstation/rnd) @@ -1206,7 +1206,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "dp" = ( /obj/machinery/power/solar, /obj/structure/cable/yellow{ @@ -1227,7 +1227,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "dr" = ( /obj/item/roller, /obj/effect/decal/cleanable/dirt, @@ -1314,7 +1314,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "dD" = ( /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel{ @@ -1344,7 +1344,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "dI" = ( /obj/machinery/door/airlock/medical/glass{ name = "Medical Bay" @@ -1368,7 +1368,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot/strong, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "dL" = ( /obj/structure/table, /obj/effect/decal/cleanable/dirt, @@ -1514,7 +1514,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "eb" = ( /obj/machinery/light{ dir = 8 @@ -1575,7 +1575,7 @@ pixel_x = 28 }, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ei" = ( /obj/item/circuitboard/sleeper, /obj/effect/decal/cleanable/dirt, @@ -1695,13 +1695,13 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ew" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ex" = ( /obj/machinery/firealarm{ dir = 4; @@ -1719,12 +1719,12 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ez" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/power/emitter, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "eA" = ( /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel/airless{ @@ -1888,7 +1888,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "eT" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/r_n_d/protolathe, @@ -1926,7 +1926,7 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/field/generator, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "eY" = ( /obj/structure/cable/yellow{ d1 = 1; @@ -2009,7 +2009,7 @@ /obj/item/apc_electronics, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fj" = ( /obj/structure/cable{ d1 = 1; @@ -2035,12 +2035,12 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fl" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fm" = ( /obj/machinery/light{ dir = 8 @@ -2079,7 +2079,7 @@ "fq" = ( /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fr" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 6 @@ -2134,7 +2134,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fx" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 6 @@ -2143,7 +2143,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fy" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -2152,7 +2152,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fz" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -2162,7 +2162,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "fA" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -2519,7 +2519,7 @@ icon_state = "4-8" }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ga" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -2531,7 +2531,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gb" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -2548,7 +2548,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gc" = ( /mob/living/simple_animal/hostile/carp, /turf/template_noop, @@ -2574,7 +2574,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ge" = ( /obj/structure/table, /obj/structure/cable{ @@ -2724,14 +2724,14 @@ /obj/item/trash/plate, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gx" = ( /obj/structure/chair{ dir = 8 }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gy" = ( /obj/effect/spawner/window/reinforced, /turf/simulated/floor/plating, @@ -2746,7 +2746,7 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/power/rad_collector, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gB" = ( /obj/item/solar_assembly, /turf/simulated/floor/plating/airless, @@ -2816,7 +2816,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gK" = ( /obj/machinery/processor, /obj/effect/decal/cleanable/dirt, @@ -2860,13 +2860,13 @@ /obj/machinery/door/firedoor, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gP" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply, /obj/machinery/door/firedoor, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gQ" = ( /obj/structure/cable{ d1 = 1; @@ -2906,7 +2906,7 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/door/firedoor, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gU" = ( /obj/machinery/light{ icon_state = "tube1"; @@ -2915,7 +2915,7 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/door/firedoor, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gV" = ( /obj/structure/cable{ d1 = 1; @@ -2932,7 +2932,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot/strong, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "gX" = ( /obj/machinery/computer{ desc = "A computer long since rendered non-functional due to lack of maintenance. Spitting out error messages."; @@ -3035,7 +3035,7 @@ }, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "hk" = ( /obj/structure/table, /obj/effect/decal/cleanable/dirt, @@ -3072,7 +3072,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot/strong, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ho" = ( /obj/machinery/light/small{ dir = 8 @@ -3145,7 +3145,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "hu" = ( /obj/structure/table, /obj/effect/decal/cleanable/dirt, @@ -3265,7 +3265,7 @@ req_one_access_txt = "271" }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "hF" = ( /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel{ @@ -3414,14 +3414,14 @@ icon = 'icons/obj/machines/particle_accelerator3.dmi' }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "hV" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/particle_accelerator/particle_emitter/right{ icon = 'icons/obj/machines/particle_accelerator3.dmi' }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "hW" = ( /obj/machinery/light/small{ dir = 8 @@ -3508,13 +3508,13 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/power/apc{ dir = 1; - name = "Delta Main Corridor APC"; + name = "Theta Main Corridor APC"; pixel_y = 24; report_power_alarm = 0; start_charge = 0 }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ie" = ( /obj/machinery/atmospherics/unary/vent_pump/on{ dir = 4 @@ -3529,14 +3529,14 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "if" = ( /obj/machinery/atmospherics/pipe/manifold/hidden/supply{ dir = 4 }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ig" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/chair{ @@ -3602,7 +3602,7 @@ pixel_x = 28 }, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "in" = ( /turf/simulated/floor/plating/airless, /area/ruin/space/ancientstation/atmo) @@ -3676,7 +3676,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ix" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply, /obj/effect/decal/cleanable/dirt, @@ -3690,19 +3690,19 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iz" = ( /obj/machinery/atmospherics/unary/vent_pump{ dir = 8 }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iA" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/recharge_station, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iB" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -3821,7 +3821,7 @@ id_tag = "ancient" }, /obj/machinery/door/airlock/command{ - name = "Delta Station Access" + name = "Theta Station Access" }, /turf/simulated/floor/plasteel, /area/ruin/space/ancientstation/powered) @@ -3856,7 +3856,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iS" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -3865,14 +3865,14 @@ /obj/machinery/door/firedoor, /obj/machinery/door/airlock/science, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iT" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iU" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -3880,7 +3880,7 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/door/firedoor, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iV" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -3891,7 +3891,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iW" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -3921,7 +3921,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iY" = ( /obj/machinery/light/small{ dir = 4 @@ -3931,7 +3931,7 @@ /obj/item/flash, /obj/item/flash, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "iZ" = ( /obj/structure/closet/crate/radiation, /obj/item/stack/sheet/mineral/uranium{ @@ -4005,7 +4005,7 @@ icon_state = "plant-dead" }, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "ji" = ( /obj/structure/cable{ d1 = 4; @@ -4014,7 +4014,7 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "jj" = ( /obj/structure/cable{ d1 = 4; @@ -4025,7 +4025,7 @@ /obj/machinery/door/firedoor, /obj/machinery/door/airlock/science, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "jk" = ( /obj/structure/cable{ d1 = 4; @@ -4035,7 +4035,7 @@ /obj/effect/decal/cleanable/dirt, /obj/machinery/door/firedoor, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "jl" = ( /obj/structure/cable{ d1 = 2; @@ -4044,27 +4044,27 @@ }, /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "jm" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/particle_accelerator/particle_emitter/center{ icon = 'icons/obj/machines/particle_accelerator3.dmi' }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "jn" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/door/firedoor, /obj/machinery/door/airlock/science, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "jo" = ( /obj/effect/decal/cleanable/dirt, /obj/item/twohanded/required/kirbyplants{ icon_state = "plant-dead" }, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "jp" = ( /obj/structure/cable{ d1 = 1; @@ -4241,7 +4241,7 @@ }, /obj/machinery/power/apc{ dir = 4; - name = "Delta RnD APC"; + name = "Theta RnD APC"; pixel_x = 24; report_power_alarm = 0; start_charge = 0 @@ -4726,7 +4726,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kN" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply, /obj/machinery/door/firedoor, @@ -4734,14 +4734,14 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kO" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, /obj/machinery/door/firedoor, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kP" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, @@ -4757,39 +4757,39 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kR" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply, /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kS" = ( /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kT" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/particle_accelerator/particle_emitter/left{ icon = 'icons/obj/machines/particle_accelerator3.dmi' }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kU" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/particle_accelerator/fuel_chamber{ icon = 'icons/obj/machines/particle_accelerator3.dmi' }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kV" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/particle_accelerator/end_cap{ icon = 'icons/obj/machines/particle_accelerator3.dmi' }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kW" = ( /obj/structure/table, /obj/effect/decal/cleanable/dirt, @@ -4813,7 +4813,7 @@ icon = 'icons/obj/machines/particle_accelerator3.dmi' }, /turf/simulated/floor/plating, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "kZ" = ( /obj/structure/lattice/catwalk, /turf/simulated/floor/plating, @@ -4860,13 +4860,13 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "le" = ( /obj/machinery/atmospherics/pipe/manifold4w/hidden/supply, /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "lf" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -4878,7 +4878,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "lg" = ( /obj/structure/cable{ d1 = 4; @@ -4888,7 +4888,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "lh" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/firealarm{ @@ -4897,7 +4897,7 @@ }, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "li" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply, /obj/effect/decal/cleanable/dirt, @@ -5151,7 +5151,7 @@ /obj/effect/decal/cleanable/dirt, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "lE" = ( /obj/machinery/light/small{ dir = 4 @@ -5207,7 +5207,7 @@ }, /mob/living/simple_animal/hostile/hivebot, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) "lL" = ( /obj/structure/rack, /obj/item/clothing/suit/armor/vest/old, @@ -5240,7 +5240,7 @@ /obj/effect/decal/cleanable/dirt, /obj/effect/decal/warning_stripes/arrow, /turf/simulated/floor/plasteel, -/area/ruin/space/ancientstation/deltacorridor) +/area/ruin/space/ancientstation/thetacorridor) (1,1,1) = {" aa diff --git a/_maps/map_files/RandomZLevels/evil_santa.dmm b/_maps/map_files/RandomZLevels/evil_santa.dmm index ff5d4df54b9..0a92eaa1b29 100644 --- a/_maps/map_files/RandomZLevels/evil_santa.dmm +++ b/_maps/map_files/RandomZLevels/evil_santa.dmm @@ -650,7 +650,7 @@ /area/awaymission/challenge/start) "bT" = ( /obj/structure/dispenser/oxygen{ - oxygentanks = 9 + starting_oxygen_tanks = 9 }, /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, /turf/simulated/floor/plasteel, diff --git a/_maps/map_files/RandomZLevels/moonoutpost19.dmm b/_maps/map_files/RandomZLevels/moonoutpost19.dmm index affcac8c979..26ff48b4d88 100644 --- a/_maps/map_files/RandomZLevels/moonoutpost19.dmm +++ b/_maps/map_files/RandomZLevels/moonoutpost19.dmm @@ -2432,7 +2432,7 @@ }) "dy" = ( /obj/structure/dispenser/oxygen{ - oxygentanks = 9 + starting_oxygen_tanks = 9 }, /obj/machinery/light/small{ active_power_usage = 0; diff --git a/_maps/map_files/RandomZLevels/terrorspiders.dmm b/_maps/map_files/RandomZLevels/terrorspiders.dmm index 8f1b576b0a2..70597a56927 100644 --- a/_maps/map_files/RandomZLevels/terrorspiders.dmm +++ b/_maps/map_files/RandomZLevels/terrorspiders.dmm @@ -7904,11 +7904,7 @@ /area/awaymission/UO71/centralhall) "pu" = ( /obj/machinery/portable_atmospherics/canister/air, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaymission/UO71/eng) "pv" = ( /obj/machinery/air_sensor{ @@ -7916,11 +7912,7 @@ id_tag = "UO71_air_sensor"; output = 7 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaymission/UO71/eng) "pw" = ( /obj/structure/cable{ @@ -8172,11 +8164,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaymission/UO71/eng) "pQ" = ( /obj/machinery/atmospherics/unary/outlet_injector/on{ @@ -8184,11 +8172,7 @@ frequency = 1443; id = "UO71_air_in" }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaymission/UO71/eng) "pR" = ( /obj/machinery/atmospherics/pipe/simple/visible/cyan, @@ -11446,11 +11430,7 @@ frequency = 1441; id = "UO71_n2_in" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaymission/UO71/eng) "vF" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -11464,11 +11444,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaymission/UO71/eng) "vG" = ( /obj/machinery/atmospherics/unary/outlet_injector/on{ @@ -11476,11 +11452,7 @@ frequency = 1441; id = "UO71_o2_in" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/awaymission/UO71/eng) "vH" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -11494,11 +11466,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/awaymission/UO71/eng) "vI" = ( /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ @@ -11821,19 +11789,11 @@ id_tag = "UO71_n2_sensor" }, /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaymission/UO71/eng) "wm" = ( /obj/machinery/portable_atmospherics/canister/nitrogen, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaymission/UO71/eng) "wn" = ( /obj/machinery/air_sensor{ @@ -11841,19 +11801,11 @@ id_tag = "UO71_o2_sensor" }, /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/awaymission/UO71/eng) "wo" = ( /obj/machinery/portable_atmospherics/canister/oxygen, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/awaymission/UO71/eng) "wp" = ( /obj/effect/decal/warning_stripes/yellow/partial{ diff --git a/_maps/map_files/RandomZLevels/undergroundoutpost45.dmm b/_maps/map_files/RandomZLevels/undergroundoutpost45.dmm index 7d863b771b0..0e1347d3d3e 100644 --- a/_maps/map_files/RandomZLevels/undergroundoutpost45.dmm +++ b/_maps/map_files/RandomZLevels/undergroundoutpost45.dmm @@ -10200,11 +10200,7 @@ }) "pa" = ( /obj/machinery/portable_atmospherics/canister/air, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -10215,11 +10211,7 @@ id_tag = "UO45_air_sensor"; output = 7 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -10612,11 +10604,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -10627,11 +10615,7 @@ frequency = 1443; id = "UO45_air_in" }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -14650,11 +14634,7 @@ frequency = 1441; id = "UO45_n2_in" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -14671,11 +14651,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -14686,11 +14662,7 @@ frequency = 1441; id = "UO45_o2_in" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 10000 - }, +/turf/simulated/floor/engine/o2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -14707,11 +14679,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 10000 - }, +/turf/simulated/floor/engine/o2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -15040,22 +15008,14 @@ id_tag = "UO45_n2_sensor" }, /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" }) "vF" = ( /obj/machinery/portable_atmospherics/canister/nitrogen, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 10000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" @@ -15066,22 +15026,14 @@ id_tag = "UO45_o2_sensor" }, /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 10000 - }, +/turf/simulated/floor/engine/o2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" }) "vH" = ( /obj/machinery/portable_atmospherics/canister/oxygen, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 10000 - }, +/turf/simulated/floor/engine/o2, /area/awaycontent/a3{ has_gravity = 1; name = "UO45 Engineering" diff --git a/_maps/map_files/cyberiad/cyberiad.dmm b/_maps/map_files/cyberiad/cyberiad.dmm index 36dbb929ff9..b38fa266cfb 100644 --- a/_maps/map_files/cyberiad/cyberiad.dmm +++ b/_maps/map_files/cyberiad/cyberiad.dmm @@ -29501,11 +29501,7 @@ /obj/machinery/portable_atmospherics/canister/nitrogen{ anchored = 1 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "bbN" = ( /obj/effect/decal/warning_stripes/northeast, @@ -29517,11 +29513,7 @@ /obj/machinery/portable_atmospherics/canister/oxygen{ anchored = 1 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "bbP" = ( /obj/effect/decal/warning_stripes/north, @@ -30507,11 +30499,7 @@ /obj/machinery/portable_atmospherics/canister/air{ anchored = 1 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "bdH" = ( /obj/effect/landmark/start{ @@ -59016,12 +59004,7 @@ icon_state = "intact"; dir = 6 }, -/turf/simulated/floor/bluegrid{ - name = "Server Base"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/bluegrid/telecomms/server, /area/toxins/server_coldroom) "ccU" = ( /obj/effect/spawner/window/reinforced, @@ -59058,13 +59041,7 @@ pixel_x = 0; pixel_y = 24 }, -/turf/simulated/floor/bluegrid{ - icon_state = "dark"; - name = "Server Walkway"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/plasteel/dark/telecomms, /area/toxins/server_coldroom) "ccW" = ( /obj/machinery/camera{ @@ -59085,9 +59062,7 @@ pixel_x = 0; pixel_y = 24 }, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "ccX" = ( /obj/structure/cable{ @@ -59154,7 +59129,7 @@ /area/engine/gravitygenerator) "cdb" = ( /obj/machinery/atmospherics/unary/cold_sink/freezer{ - current_temperature = 73; + current_temperature = 80; dir = 2; on = 1 }, @@ -59163,9 +59138,7 @@ name = "station intercom (General)"; pixel_y = 25 }, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "cdc" = ( /obj/structure/cable{ @@ -59941,13 +59914,7 @@ dir = 8 }, /obj/machinery/atmospherics/pipe/simple/heat_exchanging, -/turf/simulated/floor/bluegrid{ - icon_state = "dark"; - name = "Server Walkway"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/plasteel/dark/telecomms, /area/toxins/server_coldroom) "ceA" = ( /obj/machinery/atmospherics/unary/vent_pump/on, @@ -60024,12 +59991,7 @@ dir = 4 }, /obj/machinery/atmospherics/unary/vent_pump/on, -/turf/simulated/floor/bluegrid{ - name = "Server Base"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/bluegrid/telecomms/server, /area/toxins/server_coldroom) "ceJ" = ( /obj/structure/cable{ @@ -60049,9 +60011,7 @@ }, /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, /obj/machinery/atmospherics/pipe/simple/hidden/supply, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "ceK" = ( /obj/effect/decal/cleanable/dirt, @@ -60908,12 +60868,7 @@ icon_state = "intact"; dir = 5 }, -/turf/simulated/floor/bluegrid{ - name = "Server Base"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/bluegrid/telecomms/server, /area/toxins/server_coldroom) "cgd" = ( /obj/effect/spawner/window/reinforced, @@ -60940,15 +60895,11 @@ /obj/machinery/light_switch{ pixel_y = -23 }, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "cgg" = ( /obj/machinery/computer/message_monitor, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "cgh" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ @@ -61323,13 +61274,7 @@ dir = 5; level = 1 }, -/turf/simulated/floor/bluegrid{ - icon_state = "dark"; - name = "Server Walkway"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/plasteel/dark/telecomms, /area/toxins/server_coldroom) "cgU" = ( /obj/effect/spawner/window/reinforced, @@ -61417,9 +61362,7 @@ /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 }, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "chb" = ( /obj/machinery/atmospherics/pipe/simple/heat_exchanging{ @@ -61431,13 +61374,7 @@ /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 }, -/turf/simulated/floor/bluegrid{ - icon_state = "dark"; - name = "Server Walkway"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/plasteel/dark/telecomms, /area/toxins/server_coldroom) "chc" = ( /turf/simulated/wall, @@ -61646,9 +61583,7 @@ initialize_directions = 11; level = 1 }, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "chw" = ( /obj/machinery/firealarm{ @@ -61669,9 +61604,7 @@ scrub_N2O = 1; scrub_Toxins = 1 }, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "chx" = ( /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, @@ -63057,12 +62990,7 @@ /obj/machinery/atmospherics/pipe/simple/heat_exchanging{ dir = 4 }, -/turf/simulated/floor/bluegrid{ - name = "Server Base"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/bluegrid/telecomms/server, /area/toxins/server_coldroom) "cjI" = ( /obj/machinery/camera{ @@ -63095,13 +63023,7 @@ scrub_N2O = 1; scrub_Toxins = 1 }, -/turf/simulated/floor/bluegrid{ - icon_state = "dark"; - name = "Server Walkway"; - nitrogen = 250; - oxygen = 0; - temperature = 0 - }, +/turf/simulated/floor/plasteel/dark/telecomms, /area/toxins/server_coldroom) "cjK" = ( /obj/machinery/alarm{ @@ -63112,9 +63034,7 @@ /obj/machinery/atmospherics/unary/vent_pump/on{ dir = 1 }, -/turf/simulated/floor/plasteel{ - icon_state = "dark" - }, +/turf/simulated/floor/plasteel/dark, /area/toxins/server) "cjL" = ( /obj/effect/decal/cleanable/dirt, @@ -77463,10 +77383,7 @@ }, /area/engine/chiefs_office) "cIf" = ( -/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller{ - valve_open = 0; - volume = 1e+006 - }, +/obj/machinery/portable_atmospherics/canister/sleeping_agent, /turf/simulated/floor/engine/n20, /area/atmos) "cIg" = ( @@ -79581,13 +79498,7 @@ /area/maintenance/asmaint) "cLV" = ( /obj/machinery/portable_atmospherics/canister/toxins, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "cLW" = ( /obj/structure/cable{ @@ -82407,12 +82318,7 @@ /area/engine/engineering) "cRi" = ( /obj/machinery/portable_atmospherics/canister/carbon_dioxide, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "cRj" = ( /obj/machinery/atmospherics/binary/pump{ @@ -88005,13 +87911,7 @@ /turf/space, /area/space/nearstation) "dbb" = ( -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "dbc" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -88026,13 +87926,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "dbd" = ( /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ @@ -88452,13 +88346,7 @@ frequency = 1441; id_tag = "tox_sensor" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "dbT" = ( /obj/structure/lattice, @@ -88485,13 +88373,7 @@ /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "dbX" = ( /obj/structure/lattice, @@ -88922,13 +88804,7 @@ on = 1; pixel_y = 1 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 0; - name = "plasma floor"; - nitrogen = 0; - oxygen = 0; - toxins = 70000 - }, +/turf/simulated/floor/engine/plasma, /area/atmos) "dcU" = ( /obj/machinery/door/airlock/external{ @@ -89605,12 +89481,7 @@ /turf/space, /area/space/nearstation) "dem" = ( -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "den" = ( /obj/machinery/atmospherics/unary/vent_pump{ @@ -89625,12 +89496,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "deo" = ( /obj/machinery/door/airlock/maintenance, @@ -89987,23 +89853,13 @@ frequency = 1441; id_tag = "co2_sensor" }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "deY" = ( /obj/machinery/light/small{ dir = 4 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "deZ" = ( /obj/machinery/power/smes{ @@ -90406,12 +90262,7 @@ on = 1; pixel_y = 1 }, -/turf/simulated/floor/engine{ - carbon_dioxide = 50000; - name = "co2 floor"; - nitrogen = 0; - oxygen = 0 - }, +/turf/simulated/floor/engine/co2, /area/atmos) "dfP" = ( /obj/structure/table, @@ -92547,11 +92398,7 @@ frequency = 1441; id_tag = "n2_sensor" }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "dki" = ( /obj/machinery/atmospherics/unary/outlet_injector{ @@ -92561,11 +92408,7 @@ id = "n2_in"; on = 1 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "dkj" = ( /obj/effect/spawner/window/reinforced, @@ -92584,11 +92427,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "dkl" = ( /obj/item/radio/intercom{ @@ -92636,11 +92475,7 @@ frequency = 1441; id_tag = "o2_sensor" }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "dkq" = ( /obj/machinery/atmospherics/unary/outlet_injector{ @@ -92650,11 +92485,7 @@ id = "o2_in"; on = 1 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "dkr" = ( /obj/machinery/portable_atmospherics/canister, @@ -92674,11 +92505,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "dkt" = ( /obj/structure/disposalpipe/segment, @@ -92691,11 +92518,7 @@ id_tag = "air_sensor"; output = 7 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "dkv" = ( /mob/living/simple_animal/mouse, @@ -92709,11 +92532,7 @@ id = "o2_in"; on = 1 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "dkx" = ( /obj/machinery/atmospherics/unary/vent_pump/high_volume{ @@ -92727,11 +92546,7 @@ pressure_checks = 2; pump_direction = 0 }, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "dky" = ( /obj/machinery/camera{ @@ -92897,11 +92712,7 @@ /turf/simulated/floor/carpet, /area/crew_quarters/bar) "dkO" = ( -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "dkP" = ( /obj/machinery/atmospherics/unary/portables_connector{ @@ -92939,11 +92750,7 @@ /turf/simulated/floor/plating, /area/maintenance/asmaint) "dkT" = ( -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "dkU" = ( /obj/effect/decal/warning_stripes/west, @@ -92974,11 +92781,7 @@ name = "\improper AI Satellite Atmospherics" }) "dkV" = ( -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "dkW" = ( /obj/machinery/door/firedoor, @@ -93328,27 +93131,15 @@ /area/turret_protected/aisat_interior) "dlv" = ( /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "n2 floor"; - nitrogen = 100000; - oxygen = 0 - }, +/turf/simulated/floor/engine/n2, /area/atmos) "dlw" = ( /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "o2 floor"; - nitrogen = 0; - oxygen = 100000 - }, +/turf/simulated/floor/engine/o2, /area/atmos) "dlx" = ( /obj/machinery/light/small, -/turf/simulated/floor/engine{ - name = "air floor"; - nitrogen = 10580; - oxygen = 2644 - }, +/turf/simulated/floor/engine/air, /area/atmos) "dly" = ( /obj/structure/cable{ diff --git a/_maps/map_files/cyberiad/z2.dmm b/_maps/map_files/cyberiad/z2.dmm index 7abe416f576..a6d9fd22a18 100644 --- a/_maps/map_files/cyberiad/z2.dmm +++ b/_maps/map_files/cyberiad/z2.dmm @@ -8419,12 +8419,6 @@ icon_state = "gcircuit" }, /area/centcom/control) -"ux" = ( -/obj/machinery/blackbox_recorder, -/turf/unsimulated/floor{ - icon_state = "gcircuit" - }, -/area/centcom/control) "uy" = ( /obj/machinery/computer/card/centcom, /turf/unsimulated/floor{ @@ -37334,7 +37328,7 @@ nD tR ud su -ux +uv tR tR tR diff --git a/_maps/map_files/generic/tcommsat-blown.dmm b/_maps/map_files/generic/tcommsat-blown.dmm index ee06423a8be..e31ba89348a 100644 --- a/_maps/map_files/generic/tcommsat-blown.dmm +++ b/_maps/map_files/generic/tcommsat-blown.dmm @@ -119,10 +119,6 @@ /obj/structure/lattice, /turf/space, /area/space/nearstation) -"be" = ( -/obj/item/trash/cheesie, -/turf/space, -/area/space/nearstation) "bj" = ( /turf/simulated/floor/plating/airless, /area/space/nearstation) @@ -957,6 +953,17 @@ }, /turf/simulated/floor/plating/airless, /area/AIsattele) +"ji" = ( +/obj/docking_port/stationary{ + dir = 8; + dwidth = 10; + height = 35; + id = "whiteship_away"; + name = "Deep Space"; + width = 21 + }, +/turf/space, +/area/space) "yn" = ( /turf/space, /area/space/nearstation) @@ -8721,7 +8728,7 @@ aa aa aa aa -be +aa aa aa aa @@ -17223,7 +17230,7 @@ aa aa aa aa -aa +ji aa aa aa diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 507142c0892..002b3ecc691 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -343,3 +343,7 @@ GLOBAL_DATUM_INIT(pipe_icon_manager, /datum/pipe_icon_manager, new()) /obj/machinery/atmospherics/update_remote_sight(mob/user) user.sight |= (SEE_TURFS|BLIND) . = ..() + +//Used for certain children of obj/machinery/atmospherics to not show pipe vision when mob is inside it. +/obj/machinery/atmospherics/proc/can_see_pipes() + return TRUE diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index c0ed34ef206..43b3c382c95 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -26,7 +26,6 @@ var/frequency = ATMOS_VENTSCRUB var/id_tag = null var/datum/radio_frequency/radio_connection - var/advcontrol = 0//does this device listen to the AAC settagwhitelist = list("id_tag") @@ -75,7 +74,7 @@ /obj/machinery/atmospherics/binary/dp_vent_pump/update_icon(var/safety = 0) ..() - + if(!check_icon_cache()) return @@ -192,7 +191,7 @@ return 1 /obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol)) + if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) return 0 if(signal.data["power"] != null) on = text2num(signal.data["power"]) @@ -256,14 +255,5 @@ "} - -/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O) - . = ..() - if(.) - return . - if("toggleadvcontrol" in href_list) - advcontrol = !advcontrol - return TRUE diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index 87c7c6426c1..7e7a6e9eb49 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -177,7 +177,7 @@ pressure = text2num(pressure) . = TRUE if(.) - target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE) + target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos") update_icon() diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 7e02f89c5e2..550fd140d1d 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -232,7 +232,7 @@ Thus, the two variables affect pump operation are set in New(): pressure = text2num(pressure) . = TRUE if(.) - target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE) + target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos") update_icon() diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index 8741acb47bf..804d25cfa1b 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -228,7 +228,7 @@ Thus, the two variables affect pump operation are set in New(): rate = text2num(rate) . = TRUE if(.) - transfer_rate = Clamp(rate, 0, MAX_TRANSFER_RATE) + transfer_rate = clamp(rate, 0, MAX_TRANSFER_RATE) investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", "atmos") update_icon() diff --git a/code/ATMOSPHERICS/components/omni_devices/filter.dm b/code/ATMOSPHERICS/components/omni_devices/filter.dm index 83d60b1c292..0803d34e522 100644 --- a/code/ATMOSPHERICS/components/omni_devices/filter.dm +++ b/code/ATMOSPHERICS/components/omni_devices/filter.dm @@ -89,12 +89,12 @@ if(ATM_P) filtered_out.toxins = removed.toxins removed.toxins = 0 + + filtered_out.agent_b = removed.agent_b + removed.agent_b = 0 if(ATM_N2O) - if(removed.trace_gases.len>0) - for(var/datum/gas/sleeping_agent/trace_gas in removed.trace_gases) - if(istype(trace_gas)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas + filtered_out.sleeping_agent = removed.sleeping_agent + removed.sleeping_agent = 0 else filtered_out = null diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index 84e212598c8..64fb308c2db 100755 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -150,11 +150,8 @@ Filter types: filtered_out.toxins = removed.toxins removed.toxins = 0 - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas + filtered_out.agent_b = removed.agent_b + removed.agent_b = 0 if(1) //removing O2 filtered_out.oxygen = removed.oxygen @@ -169,12 +166,8 @@ Filter types: removed.carbon_dioxide = 0 if(4)//removing N2O - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/sleeping_agent)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - + filtered_out.sleeping_agent = removed.sleeping_agent + removed.sleeping_agent = 0 else filtered_out = null @@ -244,7 +237,7 @@ Filter types: pressure = text2num(pressure) . = TRUE if(.) - target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE) + target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos") if(href_list["filter"]) filter_type = text2num(href_list["filter"]) diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index 6128c1afa33..be4bf969009 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -202,7 +202,7 @@ pressure = text2num(pressure) . = TRUE if(.) - target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE) + target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos") if(href_list["node1"]) var/value = text2num(href_list["node1"]) diff --git a/code/ATMOSPHERICS/components/unary_devices/tank.dm b/code/ATMOSPHERICS/components/unary_devices/tank.dm index 11a752b9030..1cfb4d18eb1 100644 --- a/code/ATMOSPHERICS/components/unary_devices/tank.dm +++ b/code/ATMOSPHERICS/components/unary_devices/tank.dm @@ -92,10 +92,7 @@ air_contents.volume = volume air_contents.temperature = T20C - var/datum/gas/sleeping_agent/trace_gas = new - trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) - - air_contents.trace_gases += trace_gas + air_contents.sleeping_agent = (25 * ONE_ATMOSPHERE) * (air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature) /obj/machinery/atmospherics/unary/tank/oxygen_agent_b name = "Unidentified Gas Tank" @@ -108,6 +105,4 @@ air_contents.volume = volume air_contents.temperature = T20C - var/datum/gas/oxygen_agent_b/trace_gas = new - trace_gas.moles = (50 * ONE_ATMOSPHERE) * (air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature) - air_contents.trace_gases += trace_gas + air_contents.agent_b = (50 * ONE_ATMOSPHERE) * (air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature) diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index afdca1d19ce..66ffca0aef5 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -43,7 +43,6 @@ var/frequency = ATMOS_VENTSCRUB var/datum/radio_frequency/radio_connection Mtoollink = 1 - var/advcontrol = 0//does this device listen to the AAC var/radio_filter_out var/radio_filter_in @@ -250,7 +249,7 @@ if(stat & (NOPOWER|BROKEN)) return //log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])") - if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol)) + if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) return 0 if(signal.data["purge"] != null) @@ -425,15 +424,10 @@ "} /obj/machinery/atmospherics/unary/vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O) - if("toggleadvcontrol" in href_list) - advcontrol = !advcontrol - return TRUE - if("set_id" in href_list) var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, src.id_tag) as null|text), 1, MAX_MESSAGE_LEN) if(!newid) diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm index d9aff36688b..ed06dd68ce6 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -18,7 +18,6 @@ var/id_tag = null var/frequency = ATMOS_VENTSCRUB var/datum/radio_frequency/radio_connection - var/advcontrol = 0//does this device listen to the AAC? var/list/turf/simulated/adjacent_turfs = list() @@ -226,7 +225,7 @@ var/datum/gas_mixture/environment = tile.return_air() if(scrubbing) - if((scrub_O2 && environment.oxygen>0.001) || (scrub_N2 && environment.nitrogen>0.001) || (scrub_CO2 && environment.carbon_dioxide>0.001) || (scrub_Toxins && environment.toxins>0.001) || (environment.trace_gases.len>0)) + if((scrub_O2 && environment.oxygen>0.001) || (scrub_N2 && environment.nitrogen>0.001) || (scrub_CO2 && environment.carbon_dioxide>0.001) || (scrub_Toxins && environment.toxins>0.001) || (environment.sleeping_agent) || (environment.agent_b)) var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles() //Take a gas sample @@ -250,14 +249,13 @@ filtered_out.carbon_dioxide = removed.carbon_dioxide removed.carbon_dioxide = 0 - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas + if(removed.agent_b) + filtered_out.agent_b = removed.agent_b + removed.agent_b = 0 + + if(scrub_N2O) + filtered_out.sleeping_agent = removed.sleeping_agent + removed.sleeping_agent = 0 //Remix the resulting gases air_contents.merge(filtered_out) @@ -286,7 +284,7 @@ /obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal) if(stat & (NOPOWER|BROKEN)) return - if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol)) + if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) return 0 if(signal.data["power"] != null) @@ -354,15 +352,10 @@ "} /obj/machinery/atmospherics/unary/vent_scrubber/multitool_topic(var/mob/user, var/list/href_list, var/obj/O) - if("toggleadvcontrol" in href_list) - advcontrol = !advcontrol - return TRUE - if("set_id" in href_list) var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, src:id_tag) as null|text),1,MAX_MESSAGE_LEN) if(!newid) diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm index 2cf3edfb275..ff9fb9a4ab1 100644 --- a/code/ATMOSPHERICS/datum_pipeline.dm +++ b/code/ATMOSPHERICS/datum_pipeline.dm @@ -127,20 +127,15 @@ GLOBAL_VAR_INIT(pipenetwarnings, 10) member.air_temporary = new member.air_temporary.volume = member.volume - member.air_temporary.oxygen = air.oxygen*member.volume/air.volume - member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume - member.air_temporary.toxins = air.toxins*member.volume/air.volume - member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume + member.air_temporary.oxygen = air.oxygen * member.volume / air.volume + member.air_temporary.nitrogen = air.nitrogen * member.volume / air.volume + member.air_temporary.toxins = air.toxins * member.volume / air.volume + member.air_temporary.carbon_dioxide = air.carbon_dioxide * member.volume / air.volume + member.air_temporary.sleeping_agent = air.sleeping_agent * member.volume / air.volume + member.air_temporary.agent_b = air.agent_b * member.volume / air.volume member.air_temporary.temperature = air.temperature - if(air.trace_gases.len) - for(var/datum/gas/trace_gas in air.trace_gases) - var/datum/gas/corresponding = new trace_gas.type() - member.air_temporary.trace_gases += corresponding - - corresponding.moles = trace_gas.moles*member.volume/air.volume - /datum/pipeline/proc/temperature_interact(turf/target, share_volume, thermal_conductivity) var/total_heat_capacity = air.heat_capacity() var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume) @@ -228,7 +223,8 @@ GLOBAL_VAR_INIT(pipenetwarnings, 10) var/total_nitrogen = 0 var/total_toxins = 0 var/total_carbon_dioxide = 0 - var/list/total_trace_gases = list() + var/total_sleeping_agent = 0 + var/total_agent_b = 0 for(var/datum/gas_mixture/G in GL) total_volume += G.volume @@ -239,15 +235,8 @@ GLOBAL_VAR_INIT(pipenetwarnings, 10) total_nitrogen += G.nitrogen total_toxins += G.toxins total_carbon_dioxide += G.carbon_dioxide - - if(G.trace_gases.len) - for(var/datum/gas/trace_gas in G.trace_gases) - var/datum/gas/corresponding = locate(trace_gas.type) in total_trace_gases - if(!corresponding) - corresponding = new trace_gas.type() - total_trace_gases += corresponding - - corresponding.moles += trace_gas.moles + total_sleeping_agent += G.sleeping_agent + total_agent_b += G.agent_b if(total_volume > 0) @@ -259,18 +248,11 @@ GLOBAL_VAR_INIT(pipenetwarnings, 10) //Update individual gas_mixtures by volume ratio for(var/datum/gas_mixture/G in GL) - G.oxygen = total_oxygen*G.volume/total_volume - G.nitrogen = total_nitrogen*G.volume/total_volume - G.toxins = total_toxins*G.volume/total_volume - G.carbon_dioxide = total_carbon_dioxide*G.volume/total_volume + G.oxygen = total_oxygen * G.volume / total_volume + G.nitrogen = total_nitrogen * G.volume / total_volume + G.toxins = total_toxins * G.volume / total_volume + G.carbon_dioxide = total_carbon_dioxide * G.volume / total_volume + G.sleeping_agent = total_sleeping_agent * G.volume / total_volume + G.agent_b = total_agent_b * G.volume / total_volume G.temperature = temperature - - if(total_trace_gases.len) - for(var/datum/gas/trace_gas in total_trace_gases) - var/datum/gas/corresponding = locate(trace_gas.type) in G.trace_gases - if(!corresponding) - corresponding = new trace_gas.type() - G.trace_gases += corresponding - - corresponding.moles = trace_gas.moles*G.volume/total_volume diff --git a/code/LINDA/LINDA_system.dm b/code/LINDA/LINDA_system.dm index c5bc65d3bf7..3c8633c2b91 100644 --- a/code/LINDA/LINDA_system.dm +++ b/code/LINDA/LINDA_system.dm @@ -142,7 +142,7 @@ turf/CanPass(atom/movable/mover, turf/target, height=1.5) return T.atmos_spawn_air(text, amount) -/turf/simulated/proc/atmos_spawn_air(var/flag, var/amount) +/turf/simulated/proc/atmos_spawn_air(flag, amount) if(!text || !amount || !air) return @@ -156,17 +156,21 @@ turf/CanPass(atom/movable/mover, turf/target, height=1.5) if(flag & LINDA_SPAWN_TOXINS) G.toxins += amount + if(flag & LINDA_SPAWN_OXYGEN) G.oxygen += amount + if(flag & LINDA_SPAWN_CO2) G.carbon_dioxide += amount + if(flag & LINDA_SPAWN_NITROGEN) G.nitrogen += amount if(flag & LINDA_SPAWN_N2O) - var/datum/gas/sleeping_agent/T = new - T.moles += amount - G.trace_gases += T + G.sleeping_agent += amount + + if(flag & LINDA_SPAWN_AGENT_B) + G.agent_b += amount if(flag & LINDA_SPAWN_AIR) G.oxygen += MOLES_O2STANDARD * amount diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm index 72f77d2440f..c39226f37e6 100644 --- a/code/LINDA/LINDA_turf_tile.dm +++ b/code/LINDA/LINDA_turf_tile.dm @@ -19,20 +19,24 @@ GM.carbon_dioxide = carbon_dioxide GM.nitrogen = nitrogen GM.toxins = toxins + GM.sleeping_agent = sleeping_agent + GM.agent_b = agent_b GM.temperature = temperature return GM -/turf/remove_air(amount as num) +/turf/remove_air(amount) var/datum/gas_mixture/GM = new - var/sum = oxygen + carbon_dioxide + nitrogen + toxins - if(sum>0) - GM.oxygen = (oxygen/sum)*amount - GM.carbon_dioxide = (carbon_dioxide/sum)*amount - GM.nitrogen = (nitrogen/sum)*amount - GM.toxins = (toxins/sum)*amount + var/sum = oxygen + carbon_dioxide + nitrogen + toxins + sleeping_agent + agent_b + if(sum > 0) + GM.oxygen = (oxygen / sum) * amount + GM.carbon_dioxide = (carbon_dioxide / sum) * amount + GM.nitrogen = (nitrogen / sum) * amount + GM.toxins = (toxins / sum) * amount + GM.sleeping_agent = (sleeping_agent / sum) * amount + GM.agent_b = (agent_b / sum) * amount GM.temperature = temperature @@ -53,7 +57,7 @@ var/temperature_archived //USED ONLY FOR SOLIDS - var/atmos_overlay_type = "" //current active overlay + var/atmos_overlay_type = null //current active overlay /turf/simulated/New() ..() @@ -64,6 +68,8 @@ air.carbon_dioxide = carbon_dioxide air.nitrogen = nitrogen air.toxins = toxins + air.sleeping_agent = sleeping_agent + air.agent_b = agent_b air.temperature = temperature @@ -100,7 +106,7 @@ else return ..() -/turf/simulated/remove_air(amount as num) +/turf/simulated/remove_air(amount) if(air) var/datum/gas_mixture/removed = null @@ -155,7 +161,7 @@ var/turf/enemy_tile = get_step(src, direction) - if(istype(enemy_tile,/turf/simulated)) + if(istype(enemy_tile, /turf/simulated)) var/turf/simulated/enemy_simulated = enemy_tile if(current_cycle > enemy_simulated.current_cycle) @@ -211,7 +217,13 @@ if(planet_atmos) //share our air with the "atmosphere" "above" the turf var/datum/gas_mixture/G = new - G.copy_from_turf(src) + G.oxygen = oxygen + G.carbon_dioxide = carbon_dioxide + G.nitrogen = nitrogen + G.toxins = toxins + G.sleeping_agent = sleeping_agent + G.agent_b = agent_b + G.temperature = initial(temperature) // Temperature is modified at runtime; we only care about the turf's initial temperature G.archive() if(!air.compare(G)) if(!excited_group) @@ -271,8 +283,7 @@ if(air.toxins > MOLES_PLASMA_VISIBLE) return "plasma" - var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in air.trace_gases - if(sleeping_agent && (sleeping_agent.moles > 1)) + if(air.sleeping_agent > 1) return "sleeping_agent" return null @@ -340,7 +351,7 @@ reset_cooldowns() /datum/excited_group/proc/merge_groups(var/datum/excited_group/E) - if(turf_list.len > E.turf_list.len) + if(length(turf_list) > length(E.turf_list)) SSair.excited_groups -= E for(var/turf/simulated/T in E.turf_list) T.excited_group = src @@ -358,32 +369,26 @@ /datum/excited_group/proc/self_breakdown() var/datum/gas_mixture/A = new - var/datum/gas/sleeping_agent/S = new - A.trace_gases += S - for(var/turf/simulated/T in turf_list) - A.oxygen += T.air.oxygen - A.carbon_dioxide+= T.air.carbon_dioxide - A.nitrogen += T.air.nitrogen - A.toxins += T.air.toxins - if(T.air.trace_gases.len) - for(var/datum/gas/N in T.air.trace_gases) - S.moles += N.moles + var/list/cached_turf_list = turf_list // cache for super speed - for(var/turf/simulated/T in turf_list) - T.air.oxygen = A.oxygen/turf_list.len - T.air.carbon_dioxide= A.carbon_dioxide/turf_list.len - T.air.nitrogen = A.nitrogen/turf_list.len - T.air.toxins = A.toxins/turf_list.len + for(var/turf/simulated/T in cached_turf_list) + A.oxygen += T.air.oxygen + A.carbon_dioxide += T.air.carbon_dioxide + A.nitrogen += T.air.nitrogen + A.toxins += T.air.toxins + A.sleeping_agent += T.air.sleeping_agent + A.agent_b += T.air.agent_b - if(S.moles > 0) - if(T.air.trace_gases.len) - for(var/datum/gas/G in T.air.trace_gases) - G.moles = S.moles/turf_list.len - else - var/datum/gas/sleeping_agent/G = new - G.moles = S.moles/turf_list.len - T.air.trace_gases += G + var/turflen = length(cached_turf_list) + + for(var/turf/simulated/T in cached_turf_list) + T.air.oxygen = A.oxygen / turflen + T.air.carbon_dioxide = A.carbon_dioxide / turflen + T.air.nitrogen = A.nitrogen / turflen + T.air.toxins = A.toxins / turflen + T.air.sleeping_agent = A.sleeping_agent / turflen + T.air.agent_b = A.agent_b / turflen T.update_visuals() diff --git a/code/__DEFINES/MC.dm b/code/__DEFINES/MC.dm index cbcf2c1dd90..e2068cecb89 100644 --- a/code/__DEFINES/MC.dm +++ b/code/__DEFINES/MC.dm @@ -32,17 +32,16 @@ // (Requires a MC restart to change) #define SS_NO_FIRE 2 -//subsystem only runs on spare cpu (after all non-background subsystems have ran that tick) -// SS_BACKGROUND has its own priority bracket +/** Subsystem only runs on spare cpu (after all non-background subsystems have ran that tick) */ +/// SS_BACKGROUND has its own priority bracket, this overrides SS_TICKER's priority bump #define SS_BACKGROUND 4 //subsystem does not tick check, and should not run unless there is enough time (or its running behind (unless background)) #define SS_NO_TICK_CHECK 8 //Treat wait as a tick count, not DS, run every wait ticks. -// (also forces it to run first in the tick, above even SS_NO_TICK_CHECK subsystems) +/// (also forces it to run first in the tick (unless SS_BACKGROUND)) // (implies all runlevels because of how it works) -// (overrides SS_BACKGROUND) // This is designed for basically anything that works as a mini-mc (like SStimer) #define SS_TICKER 16 diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm deleted file mode 100644 index c9691c195b8..00000000000 --- a/code/__DEFINES/components.dm +++ /dev/null @@ -1,291 +0,0 @@ -#define SEND_SIGNAL(target, sigtype, arguments...) ( !target.comp_lookup || !target.comp_lookup[sigtype] ? NONE : target._SendSignal(sigtype, list(target, ##arguments)) ) - -#define SEND_GLOBAL_SIGNAL(sigtype, arguments...) ( SEND_SIGNAL(SSdcs, sigtype, ##arguments) ) - -//shorthand -#define GET_COMPONENT_FROM(varname, path, target) var##path/##varname = ##target.GetComponent(##path) -#define GET_COMPONENT(varname, path) GET_COMPONENT_FROM(varname, path, src) - -#define COMPONENT_INCOMPATIBLE 1 - -// How multiple components of the exact same type are handled in the same datum - -#define COMPONENT_DUPE_HIGHLANDER 0 //old component is deleted (default) -#define COMPONENT_DUPE_ALLOWED 1 //duplicates allowed -#define COMPONENT_DUPE_UNIQUE 2 //new component is deleted -#define COMPONENT_DUPE_UNIQUE_PASSARGS 4 //old component is given the initialization args of the new - -// All signals. Format: -// When the signal is called: (signal arguments) -// All signals send the source datum of the signal as the first argument - -// global signals -// These are signals which can be listened to by any component on any parent -// start global signals with "!", this used to be necessary but now it's just a formatting choice -#define COMSIG_GLOB_NEW_Z "!new_z" //from base of datum/controller/subsystem/mapping/proc/add_new_zlevel(): (list/args) -#define COMSIG_GLOB_VAR_EDIT "!var_edit" //called after a successful var edit somewhere in the world: (list/args) -#define COMSIG_GLOB_MOB_CREATED "!mob_created" //mob was created somewhere : (mob) -#define COMSIG_GLOB_MOB_DEATH "!mob_death" //mob died somewhere : (mob , gibbed) - -////////////////////////////////////////////////////////////////// - -// /datum signals -#define COMSIG_COMPONENT_ADDED "component_added" //when a component is added to a datum: (/datum/component) -#define COMSIG_COMPONENT_REMOVING "component_removing" //before a component is removed from a datum because of RemoveComponent: (/datum/component) -#define COMSIG_PARENT_PREQDELETED "parent_preqdeleted" //before a datum's Destroy() is called: (force), returning a nonzero value will cancel the qdel operation -#define COMSIG_PARENT_QDELETING "parent_qdeleting" //just before a datum's Destroy() is called: (force), at this point none of the other components chose to interrupt qdel and Destroy will be called -#define COMSIG_TOPIC "handle_topic" //generic topic handler (usr, href_list) - -// /atom signals -#define COMSIG_PARENT_ATTACKBY "atom_attackby" //from base of atom/attackby(): (/obj/item, /mob/living, params) - #define COMPONENT_NO_AFTERATTACK 1 //Return this in response if you don't want afterattack to be called -#define COMSIG_ATOM_HULK_ATTACK "hulk_attack" //from base of atom/attack_hulk(): (/mob/living/carbon/human) -#define COMSIG_PARENT_EXAMINE "atom_examine" //from base of atom/examine(): (/mob, result) -#define COMSIG_ATOM_GET_EXAMINE_NAME "atom_examine_name" //from base of atom/get_examine_name(): (/mob, list/overrides) - //Positions for overrides list - #define EXAMINE_POSITION_ARTICLE 1 - #define EXAMINE_POSITION_BEFORE 2 - //End positions - #define COMPONENT_EXNAME_CHANGED 1 -#define COMSIG_ATOM_ENTERED "atom_entered" //from base of atom/Entered(): (atom/movable/entering, /atom) -#define COMSIG_ATOM_EXITED "atom_exited" //from base of atom/Exited(): (atom/movable/exiting, atom/newloc) -#define COMSIG_ATOM_EXIT "atom_exit" //from base of atom/Exit(): (/atom/movable/exiting, /atom/newloc) - #define COMPONENT_ATOM_BLOCK_EXIT 1 -#define COMSIG_ATOM_EX_ACT "atom_ex_act" //from base of atom/ex_act(): (severity, target) -#define COMSIG_ATOM_EMP_ACT "atom_emp_act" //from base of atom/emp_act(): (severity) -#define COMSIG_ATOM_FIRE_ACT "atom_fire_act" //from base of atom/fire_act(): (exposed_temperature, exposed_volume) -#define COMSIG_ATOM_BULLET_ACT "atom_bullet_act" //from base of atom/bullet_act(): (/obj/item/projectile, def_zone) -#define COMSIG_ATOM_BLOB_ACT "atom_blob_act" //from base of atom/blob_act(): (/obj/structure/blob) -#define COMSIG_ATOM_ACID_ACT "atom_acid_act" //from base of atom/acid_act(): (acidpwr, acid_volume) -#define COMSIG_ATOM_EMAG_ACT "atom_emag_act" //from base of atom/emag_act(): () -#define COMSIG_ATOM_RAD_ACT "atom_rad_act" //from base of atom/rad_act(intensity) -#define COMSIG_ATOM_NARSIE_ACT "atom_narsie_act" //from base of atom/narsie_act(): () -#define COMSIG_ATOM_RATVAR_ACT "atom_ratvar_act" //from base of atom/ratvar_act(): () -#define COMSIG_ATOM_RCD_ACT "atom_rcd_act" //from base of atom/rcd_act(): (/mob, /obj/item/construction/rcd, passed_mode) -#define COMSIG_ATOM_SING_PULL "atom_sing_pull" //from base of atom/singularity_pull(): (S, current_size) -#define COMSIG_ATOM_SET_LIGHT "atom_set_light" //from base of atom/set_light(): (l_range, l_power, l_color) -#define COMSIG_ATOM_DIR_CHANGE "atom_dir_change" //from base of atom/setDir(): (old_dir, new_dir) -#define COMSIG_ATOM_CONTENTS_DEL "atom_contents_del" //from base of atom/handle_atom_del(): (atom/deleted) -#define COMSIG_ATOM_HAS_GRAVITY "atom_has_gravity" //from base of atom/has_gravity(): (turf/location, list/forced_gravities) -#define COMSIG_ATOM_RAD_PROBE "atom_rad_probe" //from proc/get_rad_contents(): () - #define COMPONENT_BLOCK_RADIATION 1 -#define COMSIG_ATOM_RAD_CONTAMINATING "atom_rad_contam" //from base of datum/radiation_wave/radiate(): (strength) - #define COMPONENT_BLOCK_CONTAMINATION 1 -#define COMSIG_ATOM_RAD_WAVE_PASSING "atom_rad_wave_pass" //from base of datum/radiation_wave/check_obstructions(): (datum/radiation_wave, width) - #define COMPONENT_RAD_WAVE_HANDLED 1 -#define COMSIG_ATOM_CANREACH "atom_can_reach" //from internal loop in atom/movable/proc/CanReach(): (list/next) - #define COMPONENT_BLOCK_REACH 1 -#define COMSIG_ATOM_SCREWDRIVER_ACT "atom_screwdriver_act" //from base of atom/screwdriver_act(): (mob/living/user, obj/item/I) -///////////////// -#define COMSIG_ATOM_ATTACK_GHOST "atom_attack_ghost" //from base of atom/attack_ghost(): (mob/dead/observer/ghost) -#define COMSIG_ATOM_ATTACK_HAND "atom_attack_hand" //from base of atom/attack_hand(): (mob/user) -#define COMSIG_ATOM_ATTACK_PAW "atom_attack_paw" //from base of atom/attack_paw(): (mob/user) - #define COMPONENT_NO_ATTACK_HAND 1 //works on all 3. -///////////////// - -#define COMSIG_ENTER_AREA "enter_area" //from base of area/Entered(): (/area) -#define COMSIG_EXIT_AREA "exit_area" //from base of area/Exited(): (/area) - -#define COMSIG_CLICK "atom_click" //from base of atom/Click(): (location, control, params, mob/user) -#define COMSIG_CLICK_SHIFT "shift_click" //from base of atom/ShiftClick(): (/mob) -#define COMSIG_CLICK_CTRL "ctrl_click" //from base of atom/CtrlClickOn(): (/mob) -#define COMSIG_CLICK_ALT "alt_click" //from base of atom/AltClick(): (/mob) -#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click" //from base of atom/CtrlShiftClick(/mob) -#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto" //from base of atom/MouseDrop(): (/atom/over, /mob/user) - #define COMPONENT_NO_MOUSEDROP 1 -#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" //from base of atom/MouseDrop_T: (/atom/from, /mob/user) - -// /area signals -#define COMSIG_AREA_ENTERED "area_entered" //from base of area/Entered(): (atom/movable/M) -#define COMSIG_AREA_EXITED "area_exited" //from base of area/Exited(): (atom/movable/M) - -// /turf signals -#define COMSIG_TURF_CHANGE "turf_change" //from base of turf/ChangeTurf(): (path, list/new_baseturfs, flags, list/transferring_comps) -#define COMSIG_TURF_HAS_GRAVITY "turf_has_gravity" //from base of atom/has_gravity(): (atom/asker, list/forced_gravities) - -// /atom/movable signals -#define COMSIG_MOVABLE_MOVED "movable_moved" //from base of atom/movable/Moved(): (/atom, dir) -#define COMSIG_MOVABLE_CROSS "movable_cross" //from base of atom/movable/Cross(): (/atom/movable) -#define COMSIG_MOVABLE_CROSSED "movable_crossed" //from base of atom/movable/Crossed(): (/atom/movable) -#define COMSIG_CROSSED_MOVABLE "crossed_movable" //when we cross over something (calling Crossed() on that atom) -#define COMSIG_MOVABLE_UNCROSSED "movable_uncrossed" //from base of atom/movable/Uncrossed(): (/atom/movable) -#define COMSIG_MOVABLE_UNCROSS "movable_uncross" //from base of atom/movable/Uncross(): (/atom/movable) - #define COMPONENT_MOVABLE_BLOCK_UNCROSS 1 -#define COMSIG_MOVABLE_BUMP "movable_bump" //from base of atom/movable/Bump(): (/atom) -#define COMSIG_MOVABLE_IMPACT "movable_impact" //from base of atom/movable/throw_impact(): (/atom/hit_atom, /datum/thrownthing/throwingdatum) -#define COMSIG_MOVABLE_IMPACT_ZONE "item_impact_zone" //from base of mob/living/hitby(): (mob/living/target, hit_zone) -#define COMSIG_MOVABLE_BUCKLE "buckle" //from base of atom/movable/buckle_mob(): (mob, force) -#define COMSIG_MOVABLE_UNBUCKLE "unbuckle" //from base of atom/movable/unbuckle_mob(): (mob, force) -#define COMSIG_MOVABLE_PRE_THROW "movable_pre_throw" //from base of atom/movable/throw_at(): (list/args) - #define COMPONENT_CANCEL_THROW 1 -#define COMSIG_MOVABLE_POST_THROW "movable_post_throw" //from base of atom/movable/throw_at(): (datum/thrownthing, spin) -#define COMSIG_MOVABLE_Z_CHANGED "movable_ztransit" //from base of atom/movable/onTransitZ(): (old_z, new_z) -#define COMSIG_MOVABLE_HEAR "movable_hear" //from base of atom/movable/Hear(): (message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode) -#define COMSIG_MOVABLE_DISPOSING "movable_disposing" //called when the movable is added to a disposal holder object for disposal movement: (obj/structure/disposalholder/holder, obj/machinery/disposal/source) - -// /mob signals -#define COMSIG_MOB_DEATH "mob_death" //from base of mob/death(): (gibbed) -#define COMSIG_MOB_CLICKON "mob_clickon" //from base of mob/clickon(): (atom/A, params) - #define COMSIG_MOB_CANCEL_CLICKON 1 -#define COMSIG_MOB_ALLOWED "mob_allowed" //from base of obj/allowed(mob/M): (/obj) returns bool, if TRUE the mob has id access to the obj -#define COMSIG_MOB_RECEIVE_MAGIC "mob_receive_magic" //from base of mob/anti_magic_check(): (magic, holy, protection_sources) - #define COMPONENT_BLOCK_MAGIC 1 -#define COMSIG_MOB_HUD_CREATED "mob_hud_created" //from base of mob/create_mob_hud(): () -#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand" //from base of -#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack" //from base of /obj/item/attack(): (mob/M, mob/user) -#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack" //from base of obj/item/afterattack(): (atom/target, mob/user, proximity_flag, click_parameters) -#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" //from base of mob/RangedAttack(): (atom/A, params) -#define COMSIG_MOB_THROW "mob_throw" //from base of /mob/throw_item(): (atom/target) -#define COMSIG_MOB_UPDATE_SIGHT "mob_update_sight" //from base of /mob/update_sight(): () - -// /mob/living signals -#define COMSIG_LIVING_RESIST "living_resist" //from base of mob/living/resist() (/mob/living) -#define COMSIG_LIVING_IGNITED "living_ignite" //from base of mob/living/IgniteMob() (/mob/living) -#define COMSIG_LIVING_EXTINGUISHED "living_extinguished" //from base of mob/living/ExtinguishMob() (/mob/living) -#define COMSIG_LIVING_ELECTROCUTE_ACT "living_electrocute_act" //from base of mob/living/electrocute_act(): (shock_damage) -#define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" //sent by stuff like stunbatons and tasers: () - -//ALL OF THESE DO NOT TAKE INTO ACCOUNT WHETHER AMOUNT IS 0 OR LOWER AND ARE SENT REGARDLESS! -#define COMSIG_LIVING_STATUS_STUN "living_stun" //from base of mob/living/Stun() (amount, update, ignore) -#define COMSIG_LIVING_STATUS_KNOCKDOWN "living_knockdown" //from base of mob/living/Knockdown() (amount, update, ignore) -#define COMSIG_LIVING_STATUS_PARALYZE "living_paralyze" //from base of mob/living/Paralyze() (amount, update, ignore) -#define COMSIG_LIVING_STATUS_IMMOBILIZE "living_immobilize" //from base of mob/living/Immobilize() (amount, update, ignore) -#define COMSIG_LIVING_STATUS_UNCONSCIOUS "living_unconscious" //from base of mob/living/Unconscious() (amount, update, ignore) -#define COMSIG_LIVING_STATUS_SLEEP "living_sleeping" //from base of mob/living/Sleeping() (amount, update, ignore) - #define COMPONENT_NO_STUN 1 //For all of them - -// /mob/living/carbon signals -#define COMSIG_CARBON_SOUNDBANG "carbon_soundbang" //from base of mob/living/carbon/soundbang_act(): (list(intensity)) - -// /mob/living/simple_animal/hostile signals -#define COMSIG_HOSTILE_ATTACKINGTARGET "hostile_attackingtarget" - #define COMPONENT_HOSTILE_NO_ATTACK 1 - -// /obj signals -#define COMSIG_OBJ_DECONSTRUCT "obj_deconstruct" //from base of obj/deconstruct(): (disassembled) -#define COMSIG_OBJ_SETANCHORED "obj_setanchored" //called in /obj/structure/setAnchored(): (value) -#define COMSIG_OBJ_UPDATE_ICON "obj_update_icon" //called in /obj/update_icon() - - -// /obj/item signals -#define COMSIG_ITEM_ATTACK "item_attack" //from base of obj/item/attack(): (/mob/living/target, /mob/living/user) -#define COMSIG_ITEM_ATTACK_SELF "item_attack_self" //from base of obj/item/attack_self(): (/mob) - #define COMPONENT_NO_INTERACT 1 -#define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj" //from base of obj/item/attack_obj(): (/obj, /mob) - #define COMPONENT_NO_ATTACK_OBJ 1 -#define COMSIG_ITEM_PRE_ATTACK "item_pre_attack" //from base of obj/item/pre_attack(): (atom/target, mob/user, params) - #define COMPONENT_NO_ATTACK 1 -#define COMSIG_ITEM_AFTERATTACK "item_afterattack" //from base of obj/item/afterattack(): (atom/target, mob/user, params) -#define COMSIG_ITEM_EQUIPPED "item_equip" //from base of obj/item/equipped(): (/mob/equipper, slot) -#define COMSIG_ITEM_DROPPED "item_drop" //from base of obj/item/dropped(): (mob/user) -#define COMSIG_ITEM_PICKUP "item_pickup" //from base of obj/item/pickup(): (/mob/taker) -#define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone" //from base of mob/living/carbon/attacked_by(): (mob/living/carbon/target, mob/living/user, hit_zone) -#define COMSIG_ITEM_IMBUE_SOUL "item_imbue_soul" //return a truthy value to prevent ensouling, checked in /obj/effect/proc_holder/spell/targeted/lichdom/cast(): (mob/user) -#define COMSIG_ITEM_HIT_REACT "item_hit_react" //from base of obj/item/hit_reaction(): (list/args) - -// /obj/item/clothing signals -#define COMSIG_SHOES_STEP_ACTION "shoes_step_action" //from base of obj/item/clothing/shoes/proc/step_action(): () - -// /obj/item/implant signals -#define COMSIG_IMPLANT_ACTIVATED "implant_activated" //from base of /obj/item/implant/proc/activate(): () -#define COMSIG_IMPLANT_IMPLANTING "implant_implanting" //from base of /obj/item/implant/proc/implant(): (list/args) - #define COMPONENT_STOP_IMPLANTING 1 -#define COMSIG_IMPLANT_OTHER "implant_other" //called on already installed implants when a new one is being added in /obj/item/implant/proc/implant(): (list/args, obj/item/implant/new_implant) - //#define COMPONENT_STOP_IMPLANTING 1 //The name makes sense for both - #define COMPONENT_DELETE_NEW_IMPLANT 2 - #define COMPONENT_DELETE_OLD_IMPLANT 4 -#define COMSIG_IMPLANT_EXISTING_UPLINK "implant_uplink_exists" //called on implants being implanted into someone with an uplink implant: (datum/component/uplink) - //This uses all return values of COMSIG_IMPLANT_OTHER - -// /obj/item/pda signals -#define COMSIG_PDA_CHANGE_RINGTONE "pda_change_ringtone" //called on pda when the user changes the ringtone: (mob/living/user, new_ringtone) - #define COMPONENT_STOP_RINGTONE_CHANGE 1 - -// /obj/item/radio signals -#define COMSIG_RADIO_NEW_FREQUENCY "radio_new_frequency" //called from base of /obj/item/radio/proc/set_frequency(): (list/args) - -// /obj/item/pen signals -#define COMSIG_PEN_ROTATED "pen_rotated" //called after rotation in /obj/item/pen/attack_self(): (rotation, mob/living/carbon/user) - - -// /mob/living/carbon/human signals -#define COMSIG_HUMAN_MELEE_UNARMED_ATTACK "human_melee_unarmed_attack" //from mob/living/carbon/human/UnarmedAttack(): (atom/target) -#define COMSIG_HUMAN_MELEE_UNARMED_ATTACKBY "human_melee_unarmed_attackby" //from mob/living/carbon/human/UnarmedAttack(): (mob/living/carbon/human/attacker) -#define COMSIG_HUMAN_DISARM_HIT "human_disarm_hit" //Hit by successful disarm attack (mob/living/carbon/human/attacker,zone_targeted) - -// /datum/species signals -#define COMSIG_SPECIES_GAIN "species_gain" //from datum/species/on_species_gain(): (datum/species/new_species, datum/species/old_species) -#define COMSIG_SPECIES_LOSS "species_loss" //from datum/species/on_species_loss(): (datum/species/lost_species) - -/*******Component Specific Signals*******/ -//Janitor -#define COMSIG_TURF_IS_WET "check_turf_wet" //(): Returns bitflags of wet values. -#define COMSIG_TURF_MAKE_DRY "make_turf_try" //(max_strength, immediate, duration_decrease = INFINITY): Returns bool. -#define COMSIG_COMPONENT_CLEAN_ACT "clean_act" //called on an object to clean it of cleanables. Usualy with soap: (num/strength) - -//Food -#define COMSIG_FOOD_EATEN "food_eaten" //from base of obj/item/reagent_containers/food/snacks/attack(): (mob/living/eater, mob/feeder) - -//Mood -#define COMSIG_ADD_MOOD_EVENT "add_mood" //Called when you send a mood event from anywhere in the code. -#define COMSIG_CLEAR_MOOD_EVENT "clear_mood" //Called when you clear a mood event from anywhere in the code. - -//NTnet -#define COMSIG_COMPONENT_NTNET_RECEIVE "ntnet_receive" //called on an object by its NTNET connection component on receive. (sending_id(number), sending_netname(text), data(datum/netdata)) - -//Nanites -#define COMSIG_HAS_NANITES "has_nanites" //() returns TRUE if nanites are found -#define COMSIG_NANITE_GET_PROGRAMS "nanite_get_programs" //(list/nanite_programs) - makes the input list a copy the nanites' program list -#define COMSIG_NANITE_SET_VOLUME "nanite_set_volume" //(amount) Sets current nanite volume to the given amount -#define COMSIG_NANITE_ADJUST_VOLUME "nanite_adjust" //(amount) Adjusts nanite volume by the given amount -#define COMSIG_NANITE_SET_MAX_VOLUME "nanite_set_max_volume" //(amount) Sets maximum nanite volume to the given amount -#define COMSIG_NANITE_SET_CLOUD "nanite_set_cloud" //(amount(0-100)) Sets cloud ID to the given amount -#define COMSIG_NANITE_SET_SAFETY "nanite_set_safety" //(amount) Sets safety threshold to the given amount -#define COMSIG_NANITE_SET_REGEN "nanite_set_regen" //(amount) Sets regeneration rate to the given amount -#define COMSIG_NANITE_SIGNAL "nanite_signal" //(code(1-9999)) Called when sending a nanite signal to a mob. -#define COMSIG_NANITE_SCAN "nanite_scan" //(mob/user, full_scan) - sends to chat a scan of the nanites to the user, returns TRUE if nanites are detected -#define COMSIG_NANITE_UI_DATA "nanite_ui_data" //(list/data, scan_level) - adds nanite data to the given data list - made for ui_data procs -#define COMSIG_NANITE_ADD_PROGRAM "nanite_add_program" //(datum/nanite_program/new_program, datum/nanite_program/source_program) Called when adding a program to a nanite component - #define COMPONENT_PROGRAM_INSTALLED 1 //Installation successful - #define COMPONENT_PROGRAM_NOT_INSTALLED 2 //Installation failed, but there are still nanites -#define COMSIG_NANITE_SYNC "nanite_sync" //(datum/component/nanites, full_overwrite, copy_activation) Called to sync the target's nanites to a given nanite component - -// /datum/component/storage signals -#define COMSIG_CONTAINS_STORAGE "is_storage" //() - returns bool. -#define COMSIG_TRY_STORAGE_INSERT "storage_try_insert" //(obj/item/inserting, mob/user, silent, force) - returns bool -#define COMSIG_TRY_STORAGE_SHOW "storage_show_to" //(mob/show_to, force) - returns bool. -#define COMSIG_TRY_STORAGE_HIDE_FROM "storage_hide_from" //(mob/hide_from) - returns bool -#define COMSIG_TRY_STORAGE_HIDE_ALL "storage_hide_all" //returns bool -#define COMSIG_TRY_STORAGE_SET_LOCKSTATE "storage_lock_set_state" //(newstate) -#define COMSIG_IS_STORAGE_LOCKED "storage_get_lockstate" //() - returns bool. MUST CHECK IF STORAGE IS THERE FIRST! -#define COMSIG_TRY_STORAGE_TAKE_TYPE "storage_take_type" //(type, atom/destination, amount = INFINITY, check_adjacent, force, mob/user, list/inserted) - returns bool - type can be a list of types. -#define COMSIG_TRY_STORAGE_FILL_TYPE "storage_fill_type" //(type, amount = INFINITY, force = FALSE) //don't fuck this up. Force will ignore max_items, and amount is normally clamped to max_items. -#define COMSIG_TRY_STORAGE_TAKE "storage_take_obj" //(obj, new_loc, force = FALSE) - returns bool -#define COMSIG_TRY_STORAGE_QUICK_EMPTY "storage_quick_empty" //(loc) - returns bool - if loc is null it will dump at parent location. -#define COMSIG_TRY_STORAGE_RETURN_INVENTORY "storage_return_inventory" //(list/list_to_inject_results_into, recursively_search_inside_storages = TRUE) -#define COMSIG_TRY_STORAGE_CAN_INSERT "storage_can_equip" //(obj/item/insertion_candidate, mob/user, silent) - returns bool - -// /datum/action signals -#define COMSIG_ACTION_TRIGGER "action_trigger" //from base of datum/action/proc/Trigger(): (datum/action) - #define COMPONENT_ACTION_BLOCK_TRIGGER 1 - -/*******Non-Signal Component Related Defines*******/ - -//Redirection component init flags -#define REDIRECT_TRANSFER_WITH_TURF 1 - -//Arch -#define ARCH_PROB "probability" //Probability for each item -#define ARCH_MAXDROP "max_drop_amount" //each item's max drop amount - -//Ouch my toes! -#define CALTROP_BYPASS_SHOES 1 -#define CALTROP_IGNORE_WALKERS 2 - -//Xenobio hotkeys -#define COMSIG_XENO_SLIME_CLICK_CTRL "xeno_slime_click_ctrl" //from slime CtrlClickOn(): (/mob) -#define COMSIG_XENO_SLIME_CLICK_ALT "xeno_slime_click_alt" //from slime AltClickOn(): (/mob) -#define COMSIG_XENO_SLIME_CLICK_SHIFT "xeno_slime_click_shift" //from slime ShiftClickOn(): (/mob) -#define COMSIG_XENO_TURF_CLICK_SHIFT "xeno_turf_click_shift" //from turf ShiftClickOn(): (/mob) -#define COMSIG_XENO_TURF_CLICK_CTRL "xeno_turf_click_alt" //from turf AltClickOn(): (/mob) -#define COMSIG_XENO_MONKEY_CLICK_CTRL "xeno_monkey_click_ctrl" //from monkey CtrlClickOn(): (/mob) diff --git a/code/__DEFINES/dcs/flags.dm b/code/__DEFINES/dcs/flags.dm new file mode 100644 index 00000000000..128c9f19387 --- /dev/null +++ b/code/__DEFINES/dcs/flags.dm @@ -0,0 +1,41 @@ +/// Return this from `/datum/component/Initialize` or `datum/component/OnTransfer` to have the component be deleted if it's applied to an incorrect type. +/// `parent` must not be modified if this is to be returned. +/// This will be noted in the runtime logs +#define COMPONENT_INCOMPATIBLE 1 +/// Returned in PostTransfer to prevent transfer, similar to `COMPONENT_INCOMPATIBLE` +#define COMPONENT_NOTRANSFER 2 + +/// Return value to cancel attaching +#define ELEMENT_INCOMPATIBLE 1 + +// /datum/element flags +/// Causes the detach proc to be called when the host object is being deleted +#define ELEMENT_DETACH (1 << 0) +/** + * Only elements created with the same arguments given after `id_arg_index` share an element instance + * The arguments are the same when the text and number values are the same and all other values have the same ref + */ +#define ELEMENT_BESPOKE (1 << 1) + +// How multiple components of the exact same type are handled in the same datum +/// old component is deleted (default) +#define COMPONENT_DUPE_HIGHLANDER 0 +/// duplicates allowed +#define COMPONENT_DUPE_ALLOWED 1 +/// new component is deleted +#define COMPONENT_DUPE_UNIQUE 2 +/// old component is given the initialization args of the new +#define COMPONENT_DUPE_UNIQUE_PASSARGS 4 +/// each component of the same type is consulted as to whether the duplicate should be allowed +#define COMPONENT_DUPE_SELECTIVE 5 + +//Redirection component init flags +#define REDIRECT_TRANSFER_WITH_TURF 1 + +//Arch +#define ARCH_PROB "probability" //Probability for each item +#define ARCH_MAXDROP "max_drop_amount" //each item's max drop amount + +//Ouch my toes! +#define CALTROP_BYPASS_SHOES 1 +#define CALTROP_IGNORE_WALKERS 2 diff --git a/code/__DEFINES/dcs/helpers.dm b/code/__DEFINES/dcs/helpers.dm new file mode 100644 index 00000000000..144e94f1fe0 --- /dev/null +++ b/code/__DEFINES/dcs/helpers.dm @@ -0,0 +1,15 @@ +/// Used to trigger signals and call procs registered for that signal +/// The datum hosting the signal is automaticaly added as the first argument +/// Returns a bitfield gathered from all registered procs +/// Arguments given here are packaged in a list and given to _SendSignal +#define SEND_SIGNAL(target, sigtype, arguments...) ( !target.comp_lookup || !target.comp_lookup[sigtype] ? NONE : target._SendSignal(sigtype, list(target, ##arguments)) ) + +#define SEND_GLOBAL_SIGNAL(sigtype, arguments...) ( SEND_SIGNAL(SSdcs, sigtype, ##arguments) ) + +/// A wrapper for _AddElement that allows us to pretend we're using normal named arguments +#define AddElement(arguments...) _AddElement(list(##arguments)) +/// A wrapper for _RemoveElement that allows us to pretend we're using normal named arguments +#define RemoveElement(arguments...) _RemoveElement(list(##arguments)) + +/// A wrapper for _AddComponent that allows us to pretend we're using normal named arguments +#define AddComponent(arguments...) _AddComponent(list(##arguments)) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm new file mode 100644 index 00000000000..10aa1718dda --- /dev/null +++ b/code/__DEFINES/dcs/signals.dm @@ -0,0 +1,728 @@ +// All signals. Format: +// When the signal is called: (signal arguments) +// All signals send the source datum of the signal as the first argument + +// global signals +// These are signals which can be listened to by any component on any parent +// start global signals with "!", this used to be necessary but now it's just a formatting choice + +///from base of datum/controller/subsystem/mapping/proc/add_new_zlevel(): (list/args) +#define COMSIG_GLOB_NEW_Z "!new_z" +/// called after a successful var edit somewhere in the world: (list/args) +#define COMSIG_GLOB_VAR_EDIT "!var_edit" +/// called after an explosion happened : (epicenter, devastation_range, heavy_impact_range, light_impact_range, took, orig_dev_range, orig_heavy_range, orig_light_range) +#define COMSIG_GLOB_EXPLOSION "!explosion" +/// mob was created somewhere : (mob) +#define COMSIG_GLOB_MOB_CREATED "!mob_created" +/// mob died somewhere : (mob , gibbed) +#define COMSIG_GLOB_MOB_DEATH "!mob_death" +/// global living say plug - use sparingly: (mob/speaker , message) +#define COMSIG_GLOB_LIVING_SAY_SPECIAL "!say_special" +/// called by datum/cinematic/play() : (datum/cinematic/new_cinematic) +#define COMSIG_GLOB_PLAY_CINEMATIC "!play_cinematic" + #define COMPONENT_GLOB_BLOCK_CINEMATIC (1<<0) +/// ingame button pressed (/obj/machinery/button/button) +#define COMSIG_GLOB_BUTTON_PRESSED "!button_pressed" + +/// signals from globally accessible objects + +///from SSsun when the sun changes position : (azimuth) +#define COMSIG_SUN_MOVED "sun_moved" + +////////////////////////////////////////////////////////////////// + +// /datum signals +/// when a component is added to a datum: (/datum/component) +#define COMSIG_COMPONENT_ADDED "component_added" +/// before a component is removed from a datum because of RemoveComponent: (/datum/component) +#define COMSIG_COMPONENT_REMOVING "component_removing" +/// before a datum's Destroy() is called: (force), returning a nonzero value will cancel the qdel operation +#define COMSIG_PARENT_PREQDELETED "parent_preqdeleted" +/// just before a datum's Destroy() is called: (force), at this point none of the other components chose to interrupt qdel and Destroy will be called +#define COMSIG_PARENT_QDELETING "parent_qdeleting" +/// generic topic handler (usr, href_list) +#define COMSIG_TOPIC "handle_topic" + +/// fires on the target datum when an element is attached to it (/datum/element) +#define COMSIG_ELEMENT_ATTACH "element_attach" +/// fires on the target datum when an element is attached to it (/datum/element) +#define COMSIG_ELEMENT_DETACH "element_detach" + +// /atom signals +///from base of atom/proc/Initialize(): sent any time a new atom is created +#define COMSIG_ATOM_CREATED "atom_created" +//from SSatoms InitAtom - Only if the atom was not deleted or failed initialization +#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE "atom_init_success" +///from base of atom/attackby(): (/obj/item, /mob/living, params) +#define COMSIG_PARENT_ATTACKBY "atom_attackby" +///Return this in response if you don't want afterattack to be called + #define COMPONENT_NO_AFTERATTACK (1<<0) +///from base of atom/attack_hulk(): (/mob/living/carbon/human) +#define COMSIG_ATOM_HULK_ATTACK "hulk_attack" +///from base of atom/animal_attack(): (/mob/user) +#define COMSIG_ATOM_ATTACK_ANIMAL "attack_animal" +///from base of atom/examine(): (/mob) +#define COMSIG_PARENT_EXAMINE "atom_examine" +///from base of atom/get_examine_name(): (/mob, list/overrides) +#define COMSIG_ATOM_GET_EXAMINE_NAME "atom_examine_name" + //Positions for overrides list + #define EXAMINE_POSITION_ARTICLE (1<<0) + #define EXAMINE_POSITION_BEFORE (1<<1) + //End positions + #define COMPONENT_EXNAME_CHANGED (1<<0) +///from base of atom/update_icon(): () +#define COMSIG_ATOM_UPDATE_ICON "atom_update_icon" + #define COMSIG_ATOM_NO_UPDATE_ICON_STATE (1<<0) + #define COMSIG_ATOM_NO_UPDATE_OVERLAYS (1<<1) +///from base of atom/update_overlays(): (list/new_overlays) +#define COMSIG_ATOM_UPDATE_OVERLAYS "atom_update_overlays" +///from base of atom/update_icon(): (signalOut, did_anything) +#define COMSIG_ATOM_UPDATED_ICON "atom_updated_icon" +///from base of atom/Entered(): (atom/movable/entering, /atom) +#define COMSIG_ATOM_ENTERED "atom_entered" +///from base of atom/Exit(): (/atom/movable/exiting, /atom/newloc) +#define COMSIG_ATOM_EXIT "atom_exit" + #define COMPONENT_ATOM_BLOCK_EXIT (1<<0) +///from base of atom/Exited(): (atom/movable/exiting, atom/newloc) +#define COMSIG_ATOM_EXITED "atom_exited" +///from base of atom/Bumped(): (/atom/movable) +#define COMSIG_ATOM_BUMPED "atom_bumped" +///from base of atom/ex_act(): (severity, target) +#define COMSIG_ATOM_EX_ACT "atom_ex_act" +///from base of atom/emp_act(): (severity) +#define COMSIG_ATOM_EMP_ACT "atom_emp_act" +///from base of atom/fire_act(): (exposed_temperature, exposed_volume) +#define COMSIG_ATOM_FIRE_ACT "atom_fire_act" +///from base of atom/bullet_act(): (/obj/projectile, def_zone) +#define COMSIG_ATOM_BULLET_ACT "atom_bullet_act" +///from base of atom/blob_act(): (/obj/structure/blob) +#define COMSIG_ATOM_BLOB_ACT "atom_blob_act" +///from base of atom/acid_act(): (acidpwr, acid_volume) +#define COMSIG_ATOM_ACID_ACT "atom_acid_act" +///from base of atom/emag_act(): (/mob/user) +#define COMSIG_ATOM_EMAG_ACT "atom_emag_act" +///from base of atom/rad_act(intensity) +#define COMSIG_ATOM_RAD_ACT "atom_rad_act" +///from base of atom/narsie_act(): () +#define COMSIG_ATOM_NARSIE_ACT "atom_narsie_act" +///from base of atom/rcd_act(): (/mob, /obj/item/construction/rcd, passed_mode) +#define COMSIG_ATOM_RCD_ACT "atom_rcd_act" +///from base of atom/singularity_pull(): (S, current_size) +#define COMSIG_ATOM_SING_PULL "atom_sing_pull" +///from obj/machinery/bsa/full/proc/fire(): () +#define COMSIG_ATOM_BSA_BEAM "atom_bsa_beam_pass" + #define COMSIG_ATOM_BLOCKS_BSA_BEAM (1<<0) +///from base of atom/set_light(): (l_range, l_power, l_color) +#define COMSIG_ATOM_SET_LIGHT "atom_set_light" +///from base of atom/setDir(): (old_dir, new_dir) +#define COMSIG_ATOM_DIR_CHANGE "atom_dir_change" +///from base of atom/handle_atom_del(): (atom/deleted) +#define COMSIG_ATOM_CONTENTS_DEL "atom_contents_del" +///from base of atom/has_gravity(): (turf/location, list/forced_gravities) +#define COMSIG_ATOM_HAS_GRAVITY "atom_has_gravity" +///from proc/get_rad_contents(): () +#define COMSIG_ATOM_RAD_PROBE "atom_rad_probe" + #define COMPONENT_BLOCK_RADIATION (1<<0) +///from base of datum/radiation_wave/radiate(): (strength) +#define COMSIG_ATOM_RAD_CONTAMINATING "atom_rad_contam" + #define COMPONENT_BLOCK_CONTAMINATION (1<<0) +///from base of datum/radiation_wave/check_obstructions(): (datum/radiation_wave, width) +#define COMSIG_ATOM_RAD_WAVE_PASSING "atom_rad_wave_pass" + #define COMPONENT_RAD_WAVE_HANDLED (1<<0) +///from internal loop in atom/movable/proc/CanReach(): (list/next) +#define COMSIG_ATOM_CANREACH "atom_can_reach" + #define COMPONENT_BLOCK_REACH (1<<0) +///from base of atom/screwdriver_act(): (mob/living/user, obj/item/I) +#define COMSIG_ATOM_SCREWDRIVER_ACT "atom_screwdriver_act" +///from base of atom/wrench_act(): (mob/living/user, obj/item/I) +#define COMSIG_ATOM_WRENCH_ACT "atom_wrench_act" +///from base of atom/multitool_act(): (mob/living/user, obj/item/I) +#define COMSIG_ATOM_MULTITOOL_ACT "atom_multitool_act" +///from base of atom/welder_act(): (mob/living/user, obj/item/I) +#define COMSIG_ATOM_WELDER_ACT "atom_welder_act" +///from base of atom/wirecutter_act(): (mob/living/user, obj/item/I) +#define COMSIG_ATOM_WIRECUTTER_ACT "atom_wirecutter_act" +///from base of atom/crowbar_act(): (mob/living/user, obj/item/I) +#define COMSIG_ATOM_CROWBAR_ACT "atom_crowbar_act" +///from base of atom/analyser_act(): (mob/living/user, obj/item/I) +#define COMSIG_ATOM_ANALYSER_ACT "atom_analyser_act" + #define COMPONENT_BLOCK_TOOL_ATTACK (1<<0) +///called when teleporting into a protected turf: (channel, turf/origin) +#define COMSIG_ATOM_INTERCEPT_TELEPORT "intercept_teleport" + #define COMPONENT_BLOCK_TELEPORT (1<<0) +///called when an atom is added to the hearers on get_hearers_in_view(): (list/processing_list, list/hearers) +#define COMSIG_ATOM_HEARER_IN_VIEW "atom_hearer_in_view" +///called when an atom starts orbiting another atom: (atom) +#define COMSIG_ATOM_ORBIT_BEGIN "atom_orbit_begin" +///called when an atom stops orbiting another atom: (atom) +#define COMSIG_ATOM_ORBIT_STOP "atom_orbit_stop" +///////////////// +///from base of atom/attack_ghost(): (mob/dead/observer/ghost) +#define COMSIG_ATOM_ATTACK_GHOST "atom_attack_ghost" +///from base of atom/attack_hand(): (mob/user) +#define COMSIG_ATOM_ATTACK_HAND "atom_attack_hand" +///from base of atom/attack_paw(): (mob/user) +#define COMSIG_ATOM_ATTACK_PAW "atom_attack_paw" + #define COMPONENT_NO_ATTACK_HAND (1<<0) //works on all 3. +//This signal return value bitflags can be found in __DEFINES/misc.dm + +///called for each movable in a turf contents on /turf/zImpact(): (atom/movable/A, levels) +#define COMSIG_ATOM_INTERCEPT_Z_FALL "movable_intercept_z_impact" +///called on a movable (NOT living) when someone starts pulling it (atom/movable/puller, state, force) +#define COMSIG_ATOM_START_PULL "movable_start_pull" +///called on /living when someone starts pulling it (atom/movable/puller, state, force) +#define COMSIG_LIVING_START_PULL "living_start_pull" + +///////////////// + +///from base of area/Entered(): (/area) +#define COMSIG_ENTER_AREA "enter_area" +///from base of area/Exited(): (/area) +#define COMSIG_EXIT_AREA "exit_area" +///from base of atom/Click(): (location, control, params, mob/user) +#define COMSIG_CLICK "atom_click" +///from base of atom/ShiftClick(): (/mob) +#define COMSIG_CLICK_SHIFT "shift_click" + #define COMPONENT_ALLOW_EXAMINATE (1<<0) //Allows the user to examinate regardless of client.eye. +///from base of atom/CtrlClickOn(): (/mob) +#define COMSIG_CLICK_CTRL "ctrl_click" +///from base of atom/AltClick(): (/mob) +#define COMSIG_CLICK_ALT "alt_click" +///from base of atom/CtrlShiftClick(/mob) +#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click" +///from base of atom/MouseDrop(): (/atom/over, /mob/user) +#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto" + #define COMPONENT_NO_MOUSEDROP (1<<0) +///from base of atom/MouseDrop_T: (/atom/from, /mob/user) +#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" + +// /area signals + +///from base of area/Entered(): (atom/movable/M) +#define COMSIG_AREA_ENTERED "area_entered" +///from base of area/Exited(): (atom/movable/M) +#define COMSIG_AREA_EXITED "area_exited" + +// /turf signals + +///from base of turf/ChangeTurf(): (path, list/new_baseturfs, flags, list/transferring_comps) +#define COMSIG_TURF_CHANGE "turf_change" +///from base of atom/has_gravity(): (atom/asker, list/forced_gravities) +#define COMSIG_TURF_HAS_GRAVITY "turf_has_gravity" +///from base of turf/New(): (turf/source, direction) +#define COMSIG_TURF_MULTIZ_NEW "turf_multiz_new" + +// /atom/movable signals + +///from base of atom/movable/Moved(): (/atom) +#define COMSIG_MOVABLE_PRE_MOVE "movable_pre_move" + #define COMPONENT_MOVABLE_BLOCK_PRE_MOVE (1<<0) +///from base of atom/movable/Moved(): (/atom, dir) +#define COMSIG_MOVABLE_MOVED "movable_moved" +///from base of atom/movable/Cross(): (/atom/movable) +#define COMSIG_MOVABLE_CROSS "movable_cross" +///from base of atom/movable/Crossed(): (/atom/movable) +#define COMSIG_MOVABLE_CROSSED "movable_crossed" +///when we cross over something (calling Crossed() on that atom) +#define COMSIG_CROSSED_MOVABLE "crossed_movable" +///from base of atom/movable/Uncross(): (/atom/movable) +#define COMSIG_MOVABLE_UNCROSS "movable_uncross" + #define COMPONENT_MOVABLE_BLOCK_UNCROSS (1<<0) +///from base of atom/movable/Uncrossed(): (/atom/movable) +#define COMSIG_MOVABLE_UNCROSSED "movable_uncrossed" +///from base of atom/movable/Bump(): (/atom) +#define COMSIG_MOVABLE_BUMP "movable_bump" +///from base of atom/movable/throw_impact(): (/atom/hit_atom, /datum/thrownthing/throwingdatum) +#define COMSIG_MOVABLE_IMPACT "movable_impact" + #define COMPONENT_MOVABLE_IMPACT_FLIP_HITPUSH (1<<0) //if true, flip if the impact will push what it hits + #define COMPONENT_MOVABLE_IMPACT_NEVERMIND (1<<1) //return true if you destroyed whatever it was you're impacting and there won't be anything for hitby() to run on +///from base of mob/living/hitby(): (mob/living/target, hit_zone) +#define COMSIG_MOVABLE_IMPACT_ZONE "item_impact_zone" +///from base of atom/movable/buckle_mob(): (mob, force) +#define COMSIG_MOVABLE_BUCKLE "buckle" +///from base of atom/movable/unbuckle_mob(): (mob, force) +#define COMSIG_MOVABLE_UNBUCKLE "unbuckle" +///from base of atom/movable/throw_at(): (list/args) +#define COMSIG_MOVABLE_PRE_THROW "movable_pre_throw" + #define COMPONENT_CANCEL_THROW (1<<0) +///from base of atom/movable/throw_at(): (datum/thrownthing, spin) +#define COMSIG_MOVABLE_POST_THROW "movable_post_throw" +///from base of atom/movable/onTransitZ(): (old_z, new_z) +#define COMSIG_MOVABLE_Z_CHANGED "movable_ztransit" +///called when the movable is placed in an unaccessible area, used for stationloving: () +#define COMSIG_MOVABLE_SECLUDED_LOCATION "movable_secluded" +///from base of atom/movable/Hear(): (proc args list(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)) +#define COMSIG_MOVABLE_HEAR "movable_hear" + #define HEARING_MESSAGE 1 + #define HEARING_SPEAKER 2 +// #define HEARING_LANGUAGE 3 + #define HEARING_RAW_MESSAGE 4 + /* #define HEARING_RADIO_FREQ 5 + #define HEARING_SPANS 6 + #define HEARING_MESSAGE_MODE 7 */ + +///called when the movable is added to a disposal holder object for disposal movement: (obj/structure/disposalholder/holder, obj/machinery/disposal/source) +#define COMSIG_MOVABLE_DISPOSING "movable_disposing" + +// /mob signals + +///from base of /mob/Login(): () +#define COMSIG_MOB_LOGIN "mob_login" +///from base of /mob/Logout(): () +#define COMSIG_MOB_LOGOUT "mob_logout" +///from base of mob/death(): (gibbed) +#define COMSIG_MOB_DEATH "mob_death" +///from base of mob/set_stat(): (new_stat) +#define COMSIG_MOB_STATCHANGE "mob_statchange" +///from base of mob/clickon(): (atom/A, params) +#define COMSIG_MOB_CLICKON "mob_clickon" +///from base of mob/MiddleClickOn(): (atom/A) +#define COMSIG_MOB_MIDDLECLICKON "mob_middleclickon" +///from base of mob/AltClickOn(): (atom/A) +#define COMSIG_MOB_ALTCLICKON "mob_altclickon" + #define COMSIG_MOB_CANCEL_CLICKON (1<<0) + +///from base of obj/allowed(mob/M): (/obj) returns bool, if TRUE the mob has id access to the obj +#define COMSIG_MOB_ALLOWED "mob_allowed" +///from base of mob/anti_magic_check(): (mob/user, magic, holy, tinfoil, chargecost, self, protection_sources) +#define COMSIG_MOB_RECEIVE_MAGIC "mob_receive_magic" + #define COMPONENT_BLOCK_MAGIC (1<<0) +///from base of mob/create_mob_hud(): () +#define COMSIG_MOB_HUD_CREATED "mob_hud_created" +///from base of atom/attack_hand(): (mob/user) +#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand" +///from base of /obj/item/attack(): (mob/M, mob/user) +#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack" + #define COMPONENT_ITEM_NO_ATTACK (1<<0) +///from base of /mob/living/proc/apply_damage(): (damage, damagetype, def_zone) +#define COMSIG_MOB_APPLY_DAMGE "mob_apply_damage" +///from base of obj/item/afterattack(): (atom/target, mob/user, proximity_flag, click_parameters) +#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack" +///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, proxiumity_flag, click_parameters) +#define COMSIG_MOB_ITEM_ATTACK_QDELETED "mob_item_attack_qdeleted" +///from base of mob/RangedAttack(): (atom/A, params) +#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" +///from base of /mob/throw_item(): (atom/target) +#define COMSIG_MOB_THROW "mob_throw" +///from base of /mob/verb/examinate(): (atom/target) +#define COMSIG_MOB_EXAMINATE "mob_examinate" +///from base of /mob/update_sight(): () +#define COMSIG_MOB_UPDATE_SIGHT "mob_update_sight" +////from /mob/living/say(): () +#define COMSIG_MOB_SAY "mob_say" + #define COMPONENT_UPPERCASE_SPEECH (1<<0) + // used to access COMSIG_MOB_SAY argslist + #define SPEECH_MESSAGE 1 + // #define SPEECH_BUBBLE_TYPE 2 + #define SPEECH_SPANS 3 + /* #define SPEECH_SANITIZE 4 + #define SPEECH_LANGUAGE 5 + #define SPEECH_IGNORE_SPAM 6 + #define SPEECH_FORCED 7 */ + +///from /mob/say_dead(): (mob/speaker, message) +#define COMSIG_MOB_DEADSAY "mob_deadsay" + #define MOB_DEADSAY_SIGNAL_INTERCEPT (1<<0) +///from /mob/living/emote(): () +#define COMSIG_MOB_EMOTE "mob_emote" +///from base of mob/swap_hand(): (obj/item) +#define COMSIG_MOB_SWAP_HANDS "mob_swap_hands" + #define COMPONENT_BLOCK_SWAP (1<<0) + +// /mob/living signals + +///from base of mob/living/resist() (/mob/living) +#define COMSIG_LIVING_RESIST "living_resist" +///from base of mob/living/IgniteMob() (/mob/living) +#define COMSIG_LIVING_IGNITED "living_ignite" +///from base of mob/living/ExtinguishMob() (/mob/living) +#define COMSIG_LIVING_EXTINGUISHED "living_extinguished" +///from base of mob/living/electrocute_act(): (shock_damage, source, siemens_coeff, flags) +#define COMSIG_LIVING_ELECTROCUTE_ACT "living_electrocute_act" +///sent when items with siemen coeff. of 0 block a shock: (power_source, source, siemens_coeff, dist_check) +#define COMSIG_LIVING_SHOCK_PREVENTED "living_shock_prevented" +///sent by stuff like stunbatons and tasers: () +#define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" +///from base of mob/living/revive() (full_heal, admin_revive) +#define COMSIG_LIVING_REVIVE "living_revive" +///from base of /mob/living/regenerate_limbs(): (noheal, excluded_limbs) +#define COMSIG_LIVING_REGENERATE_LIMBS "living_regen_limbs" +///from base of /obj/item/bodypart/proc/attach_limb(): (new_limb, special) allows you to fail limb attachment +#define COMSIG_LIVING_ATTACH_LIMB "living_attach_limb" + #define COMPONENT_NO_ATTACH (1<<0) +///sent from borg recharge stations: (amount, repairs) +#define COMSIG_PROCESS_BORGCHARGER_OCCUPANT "living_charge" +///sent when a mob/login() finishes: (client) +#define COMSIG_MOB_CLIENT_LOGIN "comsig_mob_client_login" +///sent from borg mobs to itself, for tools to catch an upcoming destroy() due to safe decon (rather than detonation) +#define COMSIG_BORG_SAFE_DECONSTRUCT "borg_safe_decon" + +//ALL OF THESE DO NOT TAKE INTO ACCOUNT WHETHER AMOUNT IS 0 OR LOWER AND ARE SENT REGARDLESS! + +///from base of mob/living/Stun() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_STUN "living_stun" +///from base of mob/living/Knockdown() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_KNOCKDOWN "living_knockdown" +///from base of mob/living/Paralyze() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_PARALYZE "living_paralyze" +///from base of mob/living/Immobilize() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_IMMOBILIZE "living_immobilize" +///from base of mob/living/Unconscious() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_UNCONSCIOUS "living_unconscious" +///from base of mob/living/Sleeping() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_SLEEP "living_sleeping" + #define COMPONENT_NO_STUN (1<<0) //For all of them +///from base of /mob/living/can_track(): (mob/user) +#define COMSIG_LIVING_CAN_TRACK "mob_cantrack" + #define COMPONENT_CANT_TRACK (1<<0) + +// /mob/living/carbon signals + +///from base of mob/living/carbon/soundbang_act(): (list(intensity)) +#define COMSIG_CARBON_SOUNDBANG "carbon_soundbang" +///from /item/organ/proc/Insert() (/obj/item/organ/) +#define COMSIG_CARBON_GAIN_ORGAN "carbon_gain_organ" +///from /item/organ/proc/Remove() (/obj/item/organ/) +#define COMSIG_CARBON_LOSE_ORGAN "carbon_lose_organ" +///from /mob/living/carbon/doUnEquip(obj/item/I, force, newloc, no_move, invdrop, silent) +#define COMSIG_CARBON_EQUIP_HAT "carbon_equip_hat" +///from /mob/living/carbon/doUnEquip(obj/item/I, force, newloc, no_move, invdrop, silent) +#define COMSIG_CARBON_UNEQUIP_HAT "carbon_unequip_hat" +///defined twice, in carbon and human's topics, fired when interacting with a valid embedded_object to pull it out (mob/living/carbon/target, /obj/item, /obj/item/bodypart/L) +#define COMSIG_CARBON_EMBED_RIP "item_embed_start_rip" +///called when removing a given item from a mob, from mob/living/carbon/remove_embedded_object(mob/living/carbon/target, /obj/item) +#define COMSIG_CARBON_EMBED_REMOVAL "item_embed_remove_safe" + +// /mob/living/simple_animal/hostile signals +#define COMSIG_HOSTILE_ATTACKINGTARGET "hostile_attackingtarget" + #define COMPONENT_HOSTILE_NO_ATTACK (1<<0) + +// /obj signals + +///from base of obj/deconstruct(): (disassembled) +#define COMSIG_OBJ_DECONSTRUCT "obj_deconstruct" +///called in /obj/structure/setAnchored(): (value) +#define COMSIG_OBJ_SETANCHORED "obj_setanchored" +///from base of code/game/machinery +#define COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH "obj_default_unfasten_wrench" +///from base of /turf/proc/levelupdate(). (intact) true to hide and false to unhide +#define COMSIG_OBJ_HIDE "obj_hide" +///called in /obj/update_icon() +#define COMSIG_OBJ_UPDATE_ICON "obj_update_icon" + +// /obj/machinery signals + +///from /obj/machinery/obj_break(damage_flag): (damage_flag) +#define COMSIG_MACHINERY_BROKEN "machinery_broken" +///from base power_change() when power is lost +#define COMSIG_MACHINERY_POWER_LOST "machinery_power_lost" +///from base power_change() when power is restored +#define COMSIG_MACHINERY_POWER_RESTORED "machinery_power_restored" + +// /obj/item signals + +///from base of obj/item/attack(): (/mob/living/target, /mob/living/user) +#define COMSIG_ITEM_ATTACK "item_attack" +///from base of obj/item/attack_self(): (/mob) +#define COMSIG_ITEM_ATTACK_SELF "item_attack_self" + #define COMPONENT_NO_INTERACT (1<<0) +///from base of obj/item/attack_obj(): (/obj, /mob) +#define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj" + #define COMPONENT_NO_ATTACK_OBJ (1<<0) +///from base of obj/item/pre_attack(): (atom/target, mob/user, params) +#define COMSIG_ITEM_PRE_ATTACK "item_pre_attack" + #define COMPONENT_NO_ATTACK (1<<0) +///from base of obj/item/afterattack(): (atom/target, mob/user, params) +#define COMSIG_ITEM_AFTERATTACK "item_afterattack" +///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, params) +#define COMSIG_ITEM_ATTACK_QDELETED "item_attack_qdeleted" +///from base of obj/item/equipped(): (/mob/equipper, slot) +#define COMSIG_ITEM_EQUIPPED "item_equip" +///from base of obj/item/dropped(): (mob/user) +#define COMSIG_ITEM_DROPPED "item_drop" +///from base of obj/item/pickup(): (/mob/taker) +#define COMSIG_ITEM_PICKUP "item_pickup" +///from base of mob/living/carbon/attacked_by(): (mob/living/carbon/target, mob/living/user, hit_zone) +#define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone" +///return a truthy value to prevent ensouling, checked in /obj/effect/proc_holder/spell/targeted/lichdom/cast(): (mob/user) +#define COMSIG_ITEM_IMBUE_SOUL "item_imbue_soul" +///called before marking an object for retrieval, checked in /obj/effect/proc_holder/spell/targeted/summonitem/cast() : (mob/user) +#define COMSIG_ITEM_MARK_RETRIEVAL "item_mark_retrieval" + #define COMPONENT_BLOCK_MARK_RETRIEVAL (1<<0) +///from base of obj/item/hit_reaction(): (list/args) +#define COMSIG_ITEM_HIT_REACT "item_hit_react" +///called on item when crossed by something (): (/atom/movable, mob/living/crossed) +#define COMSIG_ITEM_WEARERCROSSED "wearer_crossed" +///called on item when microwaved (): (obj/machinery/microwave/M) +#define COMSIG_ITEM_MICROWAVE_ACT "microwave_act" +///from base of item/sharpener/attackby(): (amount, max) +#define COMSIG_ITEM_SHARPEN_ACT "sharpen_act" + #define COMPONENT_BLOCK_SHARPEN_APPLIED (1<<0) + #define COMPONENT_BLOCK_SHARPEN_BLOCKED (1<<1) + #define COMPONENT_BLOCK_SHARPEN_ALREADY (1<<2) + #define COMPONENT_BLOCK_SHARPEN_MAXED (1<<3) +///from base of [/obj/item/proc/tool_check_callback]: (mob/living/user) +#define COMSIG_TOOL_IN_USE "tool_in_use" +///from base of [/obj/item/proc/tool_start_check]: (mob/living/user) +#define COMSIG_TOOL_START_USE "tool_start_use" +///from [/obj/item/proc/disableEmbedding]: +#define COMSIG_ITEM_DISABLE_EMBED "item_disable_embed" +///from [/obj/effect/mine/proc/triggermine]: +#define COMSIG_MINE_TRIGGERED "minegoboom" + +// /obj/item signals for economy +///called when an item is sold by the exports subsystem +#define COMSIG_ITEM_SOLD "item_sold" +///called when a wrapped up structure is opened by hand +#define COMSIG_STRUCTURE_UNWRAPPED "structure_unwrapped" +#define COMSIG_ITEM_UNWRAPPED "item_unwrapped" +///called when a wrapped up item is opened by hand + #define COMSIG_ITEM_SPLIT_VALUE (1<<0) +///called when getting the item's exact ratio for cargo's profit. +#define COMSIG_ITEM_SPLIT_PROFIT "item_split_profits" +///called when getting the item's exact ratio for cargo's profit, without selling the item. +#define COMSIG_ITEM_SPLIT_PROFIT_DRY "item_split_profits_dry" + +// /obj/item/clothing signals + +///from base of obj/item/clothing/shoes/proc/step_action(): () +#define COMSIG_SHOES_STEP_ACTION "shoes_step_action" +///from base of /obj/item/clothing/suit/space/proc/toggle_spacesuit(): (obj/item/clothing/suit/space/suit) +#define COMSIG_SUIT_SPACE_TOGGLE "suit_space_toggle" + +// /obj/item/implant signals +///from base of /obj/item/implant/proc/activate(): () +#define COMSIG_IMPLANT_ACTIVATED "implant_activated" +///from base of /obj/item/implant/proc/implant(): (list/args) +#define COMSIG_IMPLANT_IMPLANTING "implant_implanting" + #define COMPONENT_STOP_IMPLANTING (1<<0) +///called on already installed implants when a new one is being added in /obj/item/implant/proc/implant(): (list/args, obj/item/implant/new_implant) +#define COMSIG_IMPLANT_OTHER "implant_other" + //#define COMPONENT_STOP_IMPLANTING (1<<0) //The name makes sense for both + #define COMPONENT_DELETE_NEW_IMPLANT (1<<1) + #define COMPONENT_DELETE_OLD_IMPLANT (1<<2) +///called on implants being implanted into someone with an uplink implant: (datum/component/uplink) +#define COMSIG_IMPLANT_EXISTING_UPLINK "implant_uplink_exists" + //This uses all return values of COMSIG_IMPLANT_OTHER + +// /obj/item/pda signals + +///called on pda when the user changes the ringtone: (mob/living/user, new_ringtone) +#define COMSIG_PDA_CHANGE_RINGTONE "pda_change_ringtone" + #define COMPONENT_STOP_RINGTONE_CHANGE (1<<0) +#define COMSIG_PDA_CHECK_DETONATE "pda_check_detonate" + #define COMPONENT_PDA_NO_DETONATE (1<<0) + +// /obj/item/radio signals + +///called from base of /obj/item/radio/proc/set_frequency(): (list/args) +#define COMSIG_RADIO_NEW_FREQUENCY "radio_new_frequency" + +// /obj/item/pen signals + +///called after rotation in /obj/item/pen/attack_self(): (rotation, mob/living/carbon/user) +#define COMSIG_PEN_ROTATED "pen_rotated" + +// /obj/item/gun signals + +///called in /obj/item/gun/process_fire (user, target, params, zone_override) +#define COMSIG_MOB_FIRED_GUN "mob_fired_gun" + +// /obj/item/grenade signals + +///called in /obj/item/gun/process_fire (user, target, params, zone_override) +#define COMSIG_GRENADE_PRIME "grenade_prime" +///called in /obj/item/gun/process_fire (user, target, params, zone_override) +#define COMSIG_GRENADE_ARMED "grenade_armed" + +// /obj/projectile signals (sent to the firer) + +///from base of /obj/projectile/proc/on_hit(): (atom/movable/firer, atom/target, Angle) +#define COMSIG_PROJECTILE_SELF_ON_HIT "projectile_self_on_hit" +///from base of /obj/projectile/proc/on_hit(): (atom/movable/firer, atom/target, Angle) +#define COMSIG_PROJECTILE_ON_HIT "projectile_on_hit" +///from base of /obj/projectile/proc/fire(): (obj/projectile, atom/original_target) +#define COMSIG_PROJECTILE_BEFORE_FIRE "projectile_before_fire" +///from the base of /obj/projectile/proc/fire(): () +#define COMSIG_PROJECTILE_FIRE "projectile_fire" +///sent to targets during the process_hit proc of projectiles +#define COMSIG_PROJECTILE_PREHIT "com_proj_prehit" +///sent to targets during the process_hit proc of projectiles +#define COMSIG_PROJECTILE_RANGE_OUT "projectile_range_out" +///sent when trying to force an embed (mainly for projectiles, only used in the embed element) +#define COMSIG_EMBED_TRY_FORCE "item_try_embed" + +///sent to targets during the process_hit proc of projectiles +#define COMSIG_PELLET_CLOUD_INIT "pellet_cloud_init" + +// /obj/mecha signals + +///sent from mecha action buttons to the mecha they're linked to +#define COMSIG_MECHA_ACTION_ACTIVATE "mecha_action_activate" + +// /mob/living/carbon/human signals + +///from mob/living/carbon/human/UnarmedAttack(): (atom/target, proximity) +#define COMSIG_HUMAN_EARLY_UNARMED_ATTACK "human_early_unarmed_attack" +///from mob/living/carbon/human/UnarmedAttack(): (atom/target, proximity) +#define COMSIG_HUMAN_MELEE_UNARMED_ATTACK "human_melee_unarmed_attack" +///from mob/living/carbon/human/UnarmedAttack(): (mob/living/carbon/human/attacker) +#define COMSIG_HUMAN_MELEE_UNARMED_ATTACKBY "human_melee_unarmed_attackby" +///Hit by successful disarm attack (mob/living/carbon/human/attacker,zone_targeted) +#define COMSIG_HUMAN_DISARM_HIT "human_disarm_hit" +///Whenever EquipRanked is called, called after job is set +#define COMSIG_JOB_RECEIVED "job_received" + +// /datum/species signals + +///from datum/species/on_species_gain(): (datum/species/new_species, datum/species/old_species) +#define COMSIG_SPECIES_GAIN "species_gain" +///from datum/species/on_species_loss(): (datum/species/lost_species) +#define COMSIG_SPECIES_LOSS "species_loss" + +// /datum/song signals + +///sent to the instrument when a song starts playing +#define COMSIG_SONG_START "song_start" +///sent to the instrument when a song stops playing +#define COMSIG_SONG_END "song_end" + +/*******Component Specific Signals*******/ +//Janitor + +///(): Returns bitflags of wet values. +#define COMSIG_TURF_IS_WET "check_turf_wet" +///(max_strength, immediate, duration_decrease = INFINITY): Returns bool. +#define COMSIG_TURF_MAKE_DRY "make_turf_try" +///called on an object to clean it of cleanables. Usualy with soap: (num/strength) +#define COMSIG_COMPONENT_CLEAN_ACT "clean_act" + +//Creamed + +///called when you wash your face at a sink: (num/strength) +#define COMSIG_COMPONENT_CLEAN_FACE_ACT "clean_face_act" + +//Food + +///from base of obj/item/reagent_containers/food/snacks/attack(): (mob/living/eater, mob/feeder) +#define COMSIG_FOOD_EATEN "food_eaten" + +//Gibs + +///from base of /obj/effect/decal/cleanable/blood/gibs/streak(): (list/directions, list/diseases) +#define COMSIG_GIBS_STREAK "gibs_streak" + +//Mood + +///called when you send a mood event from anywhere in the code. +#define COMSIG_ADD_MOOD_EVENT "add_mood" +///Mood event that only RnD members listen for +#define COMSIG_ADD_MOOD_EVENT_RND "RND_add_mood" +///called when you clear a mood event from anywhere in the code. +#define COMSIG_CLEAR_MOOD_EVENT "clear_mood" + +//NTnet + +///called on an object by its NTNET connection component on receive. (sending_id(number), sending_netname(text), data(datum/netdata)) +#define COMSIG_COMPONENT_NTNET_RECEIVE "ntnet_receive" + +//Nanites + +///() returns TRUE if nanites are found +#define COMSIG_HAS_NANITES "has_nanites" +///() returns TRUE if nanites have stealth +#define COMSIG_NANITE_IS_STEALTHY "nanite_is_stealthy" +///() deletes the nanite component +#define COMSIG_NANITE_DELETE "nanite_delete" +///(list/nanite_programs) - makes the input list a copy the nanites' program list +#define COMSIG_NANITE_GET_PROGRAMS "nanite_get_programs" +///(amount) Returns nanite amount +#define COMSIG_NANITE_GET_VOLUME "nanite_get_volume" +///(amount) Sets current nanite volume to the given amount +#define COMSIG_NANITE_SET_VOLUME "nanite_set_volume" +///(amount) Adjusts nanite volume by the given amount +#define COMSIG_NANITE_ADJUST_VOLUME "nanite_adjust" +///(amount) Sets maximum nanite volume to the given amount +#define COMSIG_NANITE_SET_MAX_VOLUME "nanite_set_max_volume" +///(amount(0-100)) Sets cloud ID to the given amount +#define COMSIG_NANITE_SET_CLOUD "nanite_set_cloud" +///(method) Modify cloud sync status. Method can be toggle, enable or disable +#define COMSIG_NANITE_SET_CLOUD_SYNC "nanite_set_cloud_sync" +///(amount) Sets safety threshold to the given amount +#define COMSIG_NANITE_SET_SAFETY "nanite_set_safety" +///(amount) Sets regeneration rate to the given amount +#define COMSIG_NANITE_SET_REGEN "nanite_set_regen" +///(code(1-9999)) Called when sending a nanite signal to a mob. +#define COMSIG_NANITE_SIGNAL "nanite_signal" +///(comm_code(1-9999), comm_message) Called when sending a nanite comm signal to a mob. +#define COMSIG_NANITE_COMM_SIGNAL "nanite_comm_signal" +///(mob/user, full_scan) - sends to chat a scan of the nanites to the user, returns TRUE if nanites are detected +#define COMSIG_NANITE_SCAN "nanite_scan" +///(list/data, scan_level) - adds nanite data to the given data list - made for ui_data procs +#define COMSIG_NANITE_UI_DATA "nanite_ui_data" +///(datum/nanite_program/new_program, datum/nanite_program/source_program) Called when adding a program to a nanite component +#define COMSIG_NANITE_ADD_PROGRAM "nanite_add_program" + ///Installation successful + #define COMPONENT_PROGRAM_INSTALLED (1<<0) + ///Installation failed, but there are still nanites + #define COMPONENT_PROGRAM_NOT_INSTALLED (1<<1) +///(datum/component/nanites, full_overwrite, copy_activation) Called to sync the target's nanites to a given nanite component +#define COMSIG_NANITE_SYNC "nanite_sync" + +// /datum/component/storage signals + +///() - returns bool. +#define COMSIG_CONTAINS_STORAGE "is_storage" +///(obj/item/inserting, mob/user, silent, force) - returns bool +#define COMSIG_TRY_STORAGE_INSERT "storage_try_insert" +///(mob/show_to, force) - returns bool. +#define COMSIG_TRY_STORAGE_SHOW "storage_show_to" +///(mob/hide_from) - returns bool +#define COMSIG_TRY_STORAGE_HIDE_FROM "storage_hide_from" +///returns bool +#define COMSIG_TRY_STORAGE_HIDE_ALL "storage_hide_all" +///(newstate) +#define COMSIG_TRY_STORAGE_SET_LOCKSTATE "storage_lock_set_state" +///() - returns bool. MUST CHECK IF STORAGE IS THERE FIRST! +#define COMSIG_IS_STORAGE_LOCKED "storage_get_lockstate" +///(type, atom/destination, amount = INFINITY, check_adjacent, force, mob/user, list/inserted) - returns bool - type can be a list of types. +#define COMSIG_TRY_STORAGE_TAKE_TYPE "storage_take_type" +///(type, amount = INFINITY, force = FALSE). Force will ignore max_items, and amount is normally clamped to max_items. +#define COMSIG_TRY_STORAGE_FILL_TYPE "storage_fill_type" +///(obj, new_loc, force = FALSE) - returns bool +#define COMSIG_TRY_STORAGE_TAKE "storage_take_obj" +///(loc) - returns bool - if loc is null it will dump at parent location. +#define COMSIG_TRY_STORAGE_QUICK_EMPTY "storage_quick_empty" +///(list/list_to_inject_results_into, recursively_search_inside_storages = TRUE) +#define COMSIG_TRY_STORAGE_RETURN_INVENTORY "storage_return_inventory" +///(obj/item/insertion_candidate, mob/user, silent) - returns bool +#define COMSIG_TRY_STORAGE_CAN_INSERT "storage_can_equip" + +// /datum/component/two_handed signals + +///from base of datum/component/two_handed/proc/wield(mob/living/carbon/user): (/mob/user) +#define COMSIG_TWOHANDED_WIELD "twohanded_wield" + #define COMPONENT_TWOHANDED_BLOCK_WIELD (1<<0) +///from base of datum/component/two_handed/proc/unwield(mob/living/carbon/user): (/mob/user) +#define COMSIG_TWOHANDED_UNWIELD "twohanded_unwield" + +// /datum/action signals + +///from base of datum/action/proc/Trigger(): (datum/action) +#define COMSIG_ACTION_TRIGGER "action_trigger" + #define COMPONENT_ACTION_BLOCK_TRIGGER (1<<0) + +//Xenobio hotkeys + +///from slime CtrlClickOn(): (/mob) +#define COMSIG_XENO_SLIME_CLICK_CTRL "xeno_slime_click_ctrl" +///from slime AltClickOn(): (/mob) +#define COMSIG_XENO_SLIME_CLICK_ALT "xeno_slime_click_alt" +///from slime ShiftClickOn(): (/mob) +#define COMSIG_XENO_SLIME_CLICK_SHIFT "xeno_slime_click_shift" +///from turf ShiftClickOn(): (/mob) +#define COMSIG_XENO_TURF_CLICK_SHIFT "xeno_turf_click_shift" +///from turf AltClickOn(): (/mob) +#define COMSIG_XENO_TURF_CLICK_CTRL "xeno_turf_click_alt" +///from monkey CtrlClickOn(): (/mob) +#define COMSIG_XENO_MONKEY_CLICK_CTRL "xeno_monkey_click_ctrl" diff --git a/code/__DEFINES/genetics.dm b/code/__DEFINES/genetics.dm index 4ac05376e9d..58571e8b1ca 100644 --- a/code/__DEFINES/genetics.dm +++ b/code/__DEFINES/genetics.dm @@ -24,78 +24,61 @@ /////////////////////////////////////// // MUTATIONS /////////////////////////////////////// + // Generic mutations: -#define TK 1 -#define COLDRES 2 -#define XRAY 3 -#define HULK 4 -#define CLUMSY 5 -#define FAT 6 -#define HUSK 7 -#define NOCLONE 8 - -// Extra powers: -#define LASER 9 // harm intent - click anywhere to shoot lasers from eyes - -//species mutation -#define WINGDINGS 10 // Ayy lmao - -//2spooky -#define SKELETON 29 -#define PLANT 30 - -// Other Mutations: -#define BREATHLESS 100 // no breathing -#define REMOTE_VIEW 101 // remote viewing -#define REGEN 102 // health regen -#define RUN 103 // no slowdown -#define REMOTE_TALK 104 // remote talking -#define MORPH 105 // changing appearance -#define HEATRES 106 // heat resistance -#define HALLUCINATE 107 // hallucinations -#define FINGERPRINTS 108 // no fingerprints -#define NO_SHOCK 109 // insulated hands -#define DWARF 110 // table climbing - -// Goon muts -#define OBESITY 200 // Decreased metabolism -// 201 undefined -#define STRONG 202 // (Nothing) -#define SOBER 203 // Increased alcohol metabolism -#define PSY_RESIST 204 // Block remoteview -// 205 undefined -#define EMPATH 206 //Read minds -#define COMIC 207 //Comic Sans - -// /vg/ muts -#define LOUD 208 // CAUSES INTENSE YELLING -#define DIZZY 210 // Trippy. - -#define LISP 300 -#define RADIOACTIVE 301 -#define CHAV 302 -#define SWEDISH 303 -#define SCRAMBLED 304 -#define HORNS 305 -#define IMMOLATE 306 -#define CLOAK 307 -#define CHAMELEON 308 -#define CRYO 309 -#define EATER 310 - -#define JUMPY 400 -#define POLYMORPH 401 - +#define TK "telekenesis" +#define COLDRES "cold_resistance" +#define XRAY "xray" +#define HULK "hulk" +#define CLUMSY "clumsy" +#define FAT "fat" +#define HUSK "husk" +#define NOCLONE "noclone" +#define LASER "eyelaser" // harm intent - click anywhere to shoot lasers from eyes +#define WINGDINGS "wingdings" // Ayy lmao +#define SKELETON "skeleton" +#define BREATHLESS "breathless" // no breathing +#define REMOTE_VIEW "remove_view" // remote viewing +#define REGEN "regeneration" // health regen +#define RUN "increased_run" // no slowdown +#define REMOTE_TALK "remote_talk" // remote talking +#define MORPH "morph" // changing appearance +#define HEATRES "heat_resistance" // heat resistance +#define HALLUCINATE "hallucinate" // hallucinations +#define FINGERPRINTS "no_prints" // no fingerprints +#define NO_SHOCK "no_shock" // insulated hands +#define DWARF "dwarf" // table climbing +#define OBESITY "obesity" // Decreased metabolism +#define STRONG "strong" // (Nothing) +#define SOBER "sober" // Increased alcohol metabolism +#define PSY_RESIST "psy_resist" // Block remoteview +#define EMPATH "empathy" //Read minds +#define COMIC "comic_sans" //Comic Sans +#define LOUD "loudness" // CAUSES INTENSE YELLING +#define DIZZY "dizzy" // Trippy. +#define LISP "lisp" +#define RADIOACTIVE "radioactive" +#define CHAV "chav" +#define SWEDISH "swedish" +#define SCRAMBLED "scrambled" +#define HORNS "horns" +#define IMMOLATE "immolate" +#define CLOAK "cloak" +#define CHAMELEON "chameleon" +#define CRYO "cryokinesis" +#define EATER "matter_eater" +#define JUMPY "jumpy" +#define POLYMORPH "polymorph" //disabilities -#define NEARSIGHTED 1 -#define EPILEPSY 2 -#define COUGHING 4 -#define TOURETTES 8 -#define NERVOUS 16 -#define BLIND 32 -#define COLOURBLIND 64 -#define MUTE 128 -#define DEAF 256 +#define NEARSIGHTED "nearsighted" +#define EPILEPSY "epilepsy" +#define COUGHING "coughing" +#define TOURETTES "tourettes" +#define NERVOUS "nervous" +#define BLINDNESS "blind" +#define COLOURBLIND "colorblind" +#define MUTE "mute" +#define DEAF "deaf" //Nutrition levels for humans. No idea where else to put it #define NUTRITION_LEVEL_FAT 600 diff --git a/code/__DEFINES/inventory.dm b/code/__DEFINES/inventory.dm index cec707b8196..23ac017f1ec 100644 --- a/code/__DEFINES/inventory.dm +++ b/code/__DEFINES/inventory.dm @@ -5,6 +5,3 @@ #define WEIGHT_CLASS_BULKY 4 //Items that can be weilded or equipped but not stored in an inventory, ex: Defibrillator, Backpack, Space Suits #define WEIGHT_CLASS_HUGE 5 //Usually represents objects that require two hands to operate, ex: Shotgun, Two Handed Melee Weapons #define WEIGHT_CLASS_GIGANTIC 6 //Essentially means it cannot be picked up or placed in an inventory, ex: Mech Parts, Safe - -#define TV_TRIP "trip" -#define TV_SLIP "slip" diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 671897b612d..b52d08c1d23 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -1,6 +1,5 @@ // Atoms -#define isatom(A) istype(A, /atom) -#define ismovableatom(A) istype(A, /atom/movable) +#define isatom(A) (isloc(A)) // Mobs #define ismegafauna(A) istype(A, /mob/living/simple_animal/hostile/megafauna) diff --git a/code/__DEFINES/job.dm b/code/__DEFINES/job.dm index d72628e2cb7..349d1b246be 100644 --- a/code/__DEFINES/job.dm +++ b/code/__DEFINES/job.dm @@ -51,7 +51,7 @@ #define JOB_CLOWN (1<<11) #define JOB_MIME (1<<12) #define JOB_CIVILIAN (1<<13) - +#define JOB_EXPLORER (1<<14) #define JOBCAT_KARMA (1<<3) diff --git a/code/__DEFINES/math.dm b/code/__DEFINES/math.dm index 2f2968561da..433d1c55b56 100644 --- a/code/__DEFINES/math.dm +++ b/code/__DEFINES/math.dm @@ -1,59 +1,238 @@ +#define NUM_E 2.71828183 + #define PI 3.1415 -#define SPEED_OF_LIGHT 3e8 //not exact but hey! -#define SPEED_OF_LIGHT_SQ 9e+16 #define INFINITY 1e31 //closer than enough -#define Clamp(x, y, z) ((x) <= (y) ? (y) : ((x) >= (z) ? (z) : (x))) -#define CLAMP01(x) (Clamp((x), 0, 1)) - -// Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive -#define WRAP(val, min, max) ( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ) - -#define SIMPLE_SIGN(X) ((X) < 0 ? -1 : 1) -#define SIGN(X) ((X) ? SIMPLE_SIGN(X) : 0) -#define hypotenuse(Ax, Ay, Bx, By) (sqrt(((Ax) - (Bx))**2 + ((Ay) - (By))**2)) -#define Ceiling(x) (-round(-(x))) -#define Tan(x) (sin(x) / cos(x)) -#define Cot(x) (1 / Tan(x)) -#define Csc(x) (1 / sin(x)) -#define Sec(x) (1 / cos(x)) -#define Floor(x) (round(x)) -#define Inverse(x) (1 / (x)) -#define IsEven(x) ((x) % 2 == 0) -#define IsOdd(x) ((x) % 2 == 1) -#define IsInRange(val, min, max) ((min) <= (val) && (val) <= (max)) -#define IsInteger(x) (Floor(x) == (x)) -#define IsMultiple(x, y) ((x) % (y) == 0) -#define Lcm(a, b) (abs(a) / Gcd((a), (b)) * abs(b)) -#define Root(n, x) ((x) ** (1 / (n))) -#define ToDegrees(radians) ((radians) * 57.2957795) // 180 / Pi -#define ToRadians(degrees) ((degrees) * 0.0174532925) // Pi / 180 - #define SHORT_REAL_LIMIT 16777216 -// Real modulus that handles decimals -#define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) ) - - //"fancy" math for calculating time in ms from tick_usage percentage and the length of ticks //percent_of_tick_used * (ticklag * 100(to convert to ms)) / 100(percent ratio) //collapsed to percent_of_tick_used * tick_lag #define TICK_DELTA_TO_MS(percent_of_tick_used) ((percent_of_tick_used) * world.tick_lag) #define TICK_USAGE_TO_MS(starting_tickusage) (TICK_DELTA_TO_MS(TICK_USAGE_REAL - starting_tickusage)) +#define PERCENT(val) (round((val)*100, 0.1)) +#define CLAMP01(x) (clamp(x, 0, 1)) + //time of day but automatically adjusts to the server going into the next day within the same round. //for when you need a reliable time number that doesn't depend on byond time. #define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK)) #define MIDNIGHT_ROLLOVER_CHECK ( GLOB.rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : GLOB.midnight_rollovers ) +#define SIMPLE_SIGN(X) ((X) < 0 ? -1 : 1) + +#define SIGN(x) ( (x)!=0 ? (x) / abs(x) : 0 ) + #define CEILING(x, y) ( -round(-(x) / (y)) * (y) ) // round() acts like floor(x, 1) by default but can't handle other values #define FLOOR(x, y) ( round((x) / (y)) * (y) ) +// Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive +#define WRAP(val, min, max) clamp(( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ),min,max) + +// Real modulus that handles decimals +#define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) ) + +// Cotangent +#define COT(x) (1 / tan(x)) + +// Secant +#define SEC(x) (1 / cos(x)) + +// Cosecant +#define CSC(x) (1 / sin(x)) + +#define ATAN2(x, y) ( !(x) && !(y) ? 0 : (y) >= 0 ? arccos((x) / sqrt((x)*(x) + (y)*(y))) : -arccos((x) / sqrt((x)*(x) + (y)*(y))) ) + +#define HYPOTENUSE(Ax, Ay, Bx, By) (sqrt(((Ax) - (Bx))**2 + ((Ay) - (By))**2)) + +// Greatest Common Divisor - Euclid's algorithm +/proc/Gcd(a, b) + return b ? Gcd(b, (a) % (b)) : a + +// Least Common Multiple +#define Lcm(a, b) (abs(a) / Gcd(a, b) * abs(b)) + +#define INVERSE(x) ( 1/(x) ) + +// Used for calculating the radioactive strength falloff +#define INVERSE_SQUARE(initial_strength,cur_distance,initial_distance) ( (initial_strength)*((initial_distance)**2/(cur_distance)**2) ) + +#define ISABOUTEQUAL(a, b, deviation) (deviation ? abs((a) - (b)) <= deviation : abs((a) - (b)) <= 0.1) + +#define ISEVEN(x) (x % 2 == 0) + +#define ISODD(x) (x % 2 != 0) + +// Returns true if val is from min to max, inclusive. +#define ISINRANGE(val, min, max) (min <= val && val <= max) + +// Same as above, exclusive. +#define ISINRANGE_EX(val, min, max) (min < val && val < max) + +#define ISINTEGER(x) (round(x) == x) + +#define ISMULTIPLE(x, y) ((x) % (y) == 0) + +// Performs a linear interpolation between a and b. +// Note that amount=0 returns a, amount=1 returns b, and +// amount=0.5 returns the mean of a and b. +#define LERP(a, b, amount) ( amount ? ((a) + ((b) - (a)) * (amount)) : a ) + +// Returns the nth root of x. +#define ROOT(n, x) ((x) ** (1 / (n))) + +// The quadratic formula. Returns a list with the solutions, or an empty list +// if they are imaginary. +/proc/SolveQuadratic(a, b, c) + ASSERT(a) + . = list() + var/d = b*b - 4 * a * c + var/bottom = 2 * a + if(d < 0) + return + var/root = sqrt(d) + . += (-b + root) / bottom + if(!d) + return + . += (-b - root) / bottom + +#define TODEGREES(radians) ((radians) * 57.2957795) + +#define TORADIANS(degrees) ((degrees) * 0.0174532925) + +/// Gets shift x that would be required the bitflag (1< dec? -dec : inc + +//A logarithm that converts an integer to a number scaled between 0 and 1. +//Currently, this is used for hydroponics-produce sprite transforming, but could be useful for other transform functions. +#define TRANSFORM_USING_VARIABLE(input, max) ( sin((90*(input))/(max))**2 ) + +//converts a uniform distributed random number into a normal distributed one +//since this method produces two random numbers, one is saved for subsequent calls +//(making the cost negligble for every second call) +//This will return +/- decimals, situated about mean with standard deviation stddev +//68% chance that the number is within 1stddev +//95% chance that the number is within 2stddev +//98% chance that the number is within 3stddev...etc +#define ACCURACY 10000 +/proc/gaussian(mean, stddev) + var/static/gaussian_next + var/R1;var/R2;var/working + if(gaussian_next != null) + R1 = gaussian_next + gaussian_next = null + else + do + R1 = rand(-ACCURACY,ACCURACY)/ACCURACY + R2 = rand(-ACCURACY,ACCURACY)/ACCURACY + working = R1*R1 + R2*R2 + while(working >= 1 || working==0) + working = sqrt(-2 * log(working) / working) + R1 *= working + gaussian_next = R2 * working + return (mean + stddev * R1) +#undef ACCURACY + +/proc/get_turf_in_angle(angle, turf/starting, increments) + var/pixel_x = 0 + var/pixel_y = 0 + for(var/i in 1 to increments) + pixel_x += sin(angle)+16*sin(angle)*2 + pixel_y += cos(angle)+16*cos(angle)*2 + var/new_x = starting.x + var/new_y = starting.y + while(pixel_x > 16) + pixel_x -= 32 + new_x++ + while(pixel_x < -16) + pixel_x += 32 + new_x-- + while(pixel_y > 16) + pixel_y -= 32 + new_y++ + while(pixel_y < -16) + pixel_y += 32 + new_y-- + new_x = clamp(new_x, 0, world.maxx) + new_y = clamp(new_y, 0, world.maxy) + return locate(new_x, new_y, starting.z) + +// Returns a list where [1] is all x values and [2] is all y values that overlap between the given pair of rectangles +/proc/get_overlap(x1, y1, x2, y2, x3, y3, x4, y4) + var/list/region_x1 = list() + var/list/region_y1 = list() + var/list/region_x2 = list() + var/list/region_y2 = list() + + // These loops create loops filled with x/y values that the boundaries inhabit + // ex: list(5, 6, 7, 8, 9) + for(var/i in min(x1, x2) to max(x1, x2)) + region_x1["[i]"] = TRUE + for(var/i in min(y1, y2) to max(y1, y2)) + region_y1["[i]"] = TRUE + for(var/i in min(x3, x4) to max(x3, x4)) + region_x2["[i]"] = TRUE + for(var/i in min(y3, y4) to max(y3, y4)) + region_y2["[i]"] = TRUE + + return list(region_x1 & region_x2, region_y1 & region_y2) + +#define EXP_DISTRIBUTION(desired_mean) ( -(1/(1/desired_mean)) * log(rand(1, 1000) * 0.001) ) + +#define LORENTZ_DISTRIBUTION(x, s) ( s*tan(TODEGREES(PI*(rand()-0.5))) + x ) +#define LORENTZ_CUMULATIVE_DISTRIBUTION(x, y, s) ( (1/PI)*TORADIANS(arctan((x-y)/s)) + 1/2 ) + +#define RULE_OF_THREE(a, b, x) ((a*x)/b) +// ) + +/proc/RaiseToPower(num, power) + if(!power) + return 1 + return (power-- > 1 ? num * RaiseToPower(num, power) : num) + +// oof, what a mouthful +// Used in status_procs' "adjust" to let them modify a status effect by a given +// amount, without inadverdently increasing it in the wrong direction +/proc/directional_bounded_sum(orig_val, modifier, bound_lower, bound_upper) + var/new_val = orig_val + modifier + if(modifier > 0) + if(new_val > bound_upper) + new_val = max(orig_val, bound_upper) + else if(modifier < 0) + if(new_val < bound_lower) + new_val = min(orig_val, bound_lower) + return new_val + +// sqrt, but if you give it a negative number, you get 0 instead of a runtime +/proc/sqrtor0(num) + if(num < 0) + return 0 + return sqrt(num) + +/proc/round_down(num) + if(round(num) != num) + return round(num--) + else + return num diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index cf27ec09143..ad5e5df7583 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -431,7 +431,6 @@ #define LINDA_SPAWN_OXYGEN 8 #define LINDA_SPAWN_CO2 16 #define LINDA_SPAWN_NITROGEN 32 - #define LINDA_SPAWN_N2O 64 - +#define LINDA_SPAWN_AGENT_B 128 #define LINDA_SPAWN_AIR 256 diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 2217271a2e7..ffb636b42ed 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -183,9 +183,6 @@ /proc/get_mobs_in_radio_ranges(var/list/obj/item/radio/radios) - - set background = 1 - . = list() // Returns a list of mobs who can hear any of the radios given in @radios var/list/speaker_coverage = list() @@ -408,7 +405,7 @@ /proc/alone_in_area(var/area/the_area, var/mob/must_be_alone, var/check_type = /mob/living/carbon) var/area/our_area = get_area(the_area) - for(var/C in GLOB.living_mob_list) + for(var/C in GLOB.alive_mob_list) if(!istype(C, check_type)) continue if(C == must_be_alone) diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index dc256a93478..caa8291b4bb 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -61,7 +61,7 @@ var/adjacencies = 0 var/atom/movable/AM - if(ismovableatom(A)) + if(ismovable(A)) AM = A if(AM.can_be_unanchored && !AM.anchored) return 0 diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 4e11dbf4140..ef0f47b2f9c 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -580,7 +580,7 @@ world var/B = RGB[2] var/Y = (0.2126 * R) + (0.7152 * G) + (0.0722 * B) - return Clamp((Y * 0.01), 0, 1) //Returns the brightness of a color in decimal percentage format. Can multiply light_power by this to receive 100% brightness or a lower brightness. Not a higher brightness. + return clamp((Y * 0.01), 0, 1) //Returns the brightness of a color in decimal percentage format. Can multiply light_power by this to receive 100% brightness or a lower brightness. Not a higher brightness. /proc/HueToAngle(hue) // normalize hsv in case anything is screwy @@ -899,9 +899,9 @@ The _flatIcons list is a cache for generated icon files. if(!value) return color var/list/RGB = ReadRGB(color) - RGB[1] = Clamp(RGB[1]+value,0,255) - RGB[2] = Clamp(RGB[2]+value,0,255) - RGB[3] = Clamp(RGB[3]+value,0,255) + RGB[1] = clamp(RGB[1]+value,0,255) + RGB[2] = clamp(RGB[2]+value,0,255) + RGB[3] = clamp(RGB[3]+value,0,255) return rgb(RGB[1],RGB[2],RGB[3]) /proc/sort_atoms_by_layer(var/list/atoms) diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index 7d1b8ee6ebc..f9b9850bd2d 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -690,6 +690,8 @@ proc/dd_sortedObjectList(list/incoming) // LAZYING PT 2: THE LAZENING #define LAZYREINITLIST(L) LAZYCLEARLIST(L); LAZYINITLIST(L); +// Lazying Episode 3 +#define LAZYSET(L, K, V) LAZYINITLIST(L); L[K] = V; //same, but returns nothing and acts on list in place /proc/shuffle_inplace(list/L) diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm deleted file mode 100644 index 76d422e3d82..00000000000 --- a/code/__HELPERS/maths.dm +++ /dev/null @@ -1,143 +0,0 @@ -// Credits to Nickr5 for the useful procs I've taken from his library resource. - -#define MATH_E 2.71828183 -#define SQRT2 1.41421356 - -/proc/Atan2(x, y) - if(!x && !y) return 0 - var/a = arccos(x / sqrt(x*x + y*y)) - return y >= 0 ? a : -a - -// Greatest Common Divisor - Euclid's algorithm -/proc/Gcd(a, b) - return b ? Gcd(b, a % b) : a - -/proc/IsAboutEqual(a, b, deviation = 0.1) - return abs(a - b) <= deviation - -// Performs a linear interpolation between a and b. -// Note that amount=0 returns a, amount=1 returns b, and -// amount=0.5 returns the mean of a and b. -/proc/Lerp(a, b, amount = 0.5) - return a + (b - a) * amount - -/proc/Mean(...) - var/values = 0 - var/sum = 0 - for(var/val in args) - values++ - sum += val - return sum / values - -// The quadratic formula. Returns a list with the solutions, or an empty list -// if they are imaginary. -/proc/SolveQuadratic(a, b, c) - ASSERT(a) - . = list() - var/d = b*b - 4 * a * c - var/bottom = 2 * a - if(d < 0) return - var/root = sqrt(d) - . += (-b + root) / bottom - if(!d) return - . += (-b - root) / bottom - -// Will filter out extra rotations and negative rotations -// E.g: 540 becomes 180. -180 becomes 180. -/proc/SimplifyDegrees(degrees) - degrees = degrees % 360 - if(degrees < 0) - degrees += 360 - return degrees - -// min is inclusive, max is exclusive -/proc/Wrap(val, min, max) - var/d = max - min - var/t = Floor((val - min) / d) - return val - (t * d) - -//A logarithm that converts an integer to a number scaled between 0 and 1 (can be tweaked to be higher). -//Currently, this is used for hydroponics-produce sprite transforming, but could be useful for other transform functions. -/proc/TransformUsingVariable(input, inputmaximum, scaling_modifier = 0) - - var/inputToDegrees = (input/inputmaximum)*180 //Converting from a 0 -> 100 scale to a 0 -> 180 scale. The 0 -> 180 scale corresponds to degrees - var/size_factor = ((-cos(inputToDegrees) +1) /2) //returns a value from 0 to 1 - - return size_factor + scaling_modifier //scale mod of 0 results in a number from 0 to 1. A scale modifier of +0.5 returns 0.5 to 1.5 - //world<< "Transform multiplier of [src] is [size_factor + scaling_modifer]" - -/proc/RaiseToPower(num, power) - if(!power) return 1 - return (power-- > 1 ? num * RaiseToPower(num, power) : num) - -//converts a uniform distributed random number into a normal distributed one -//since this method produces two random numbers, one is saved for subsequent calls -//(making the cost negligble for every second call) -//This will return +/- decimals, situated about mean with standard deviation stddev -//68% chance that the number is within 1stddev -//95% chance that the number is within 2stddev -//98% chance that the number is within 3stddev...etc -GLOBAL_VAR(gaussian_next) -#define ACCURACY 10000 -/proc/gaussian(mean, stddev) - var/R1;var/R2;var/working - if(GLOB.gaussian_next != null) - R1 = GLOB.gaussian_next - GLOB.gaussian_next = null - else - do - R1 = rand(-ACCURACY,ACCURACY)/ACCURACY - R2 = rand(-ACCURACY,ACCURACY)/ACCURACY - working = R1*R1 + R2*R2 - while(working >= 1 || working==0) - working = sqrt(-2 * log(working) / working) - R1 *= working - GLOB.gaussian_next = R2 * working - return (mean + stddev * R1) -#undef ACCURACY - - - -// oof, what a mouthful -// Used in status_procs' "adjust" to let them modify a status effect by a given -// amount, without inadverdently increasing it in the wrong direction -/proc/directional_bounded_sum(orig_val, modifier, bound_lower, bound_upper) - var/new_val = orig_val + modifier - if(modifier > 0) - if(new_val > bound_upper) - new_val = max(orig_val, bound_upper) - else if(modifier < 0) - if(new_val < bound_lower) - new_val = min(orig_val, bound_lower) - return new_val - -// sqrt, but if you give it a negative number, you get 0 instead of a runtime -/proc/sqrtor0(num) - if(num < 0) - return 0 - return sqrt(num) - -/proc/round_down(num) - if(round(num) != num) - return round(num--) - else return num - -// Returns a list where [1] is all x values and [2] is all y values that overlap between the given pair of rectangles -/proc/get_overlap(x1, y1, x2, y2, x3, y3, x4, y4) - var/list/region_x1 = list() - var/list/region_y1 = list() - var/list/region_x2 = list() - var/list/region_y2 = list() - - // These loops create loops filled with x/y values that the boundaries inhabit - // ex: list(5, 6, 7, 8, 9) - for(var/i in min(x1, x2) to max(x1, x2)) - region_x1["[i]"] = TRUE - for(var/i in min(y1, y2) to max(y1, y2)) - region_y1["[i]"] = TRUE - for(var/i in min(x3, x4) to max(x3, x4)) - region_x2["[i]"] = TRUE - for(var/i in min(y3, y4) to max(y3, y4)) - region_y2["[i]"] = TRUE - - return list(region_x1 & region_x2, region_y1 & region_y2) diff --git a/code/__HELPERS/traits.dm b/code/__HELPERS/traits.dm index ee6c5d10fe0..352a6fa3680 100644 --- a/code/__HELPERS/traits.dm +++ b/code/__HELPERS/traits.dm @@ -65,6 +65,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_WATERBREATH "waterbreathing" #define TRAIT_BLOODCRAWL "bloodcrawl" #define TRAIT_BLOODCRAWL_EAT "bloodcrawl_eat" +#define TRAIT_JESTER "jester" // common trait sources #define ROUNDSTART_TRAIT "roundstart" //cannot be removed without admin intervention diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index a8066f62a37..a022851e45f 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -25,11 +25,9 @@ if(!( istext(HTMLstring) )) CRASH("Given non-text argument!") - return else if(length(HTMLstring) != 7) CRASH("Given non-HTML argument!") - return var/textr = copytext(HTMLstring, 2, 4) var/textg = copytext(HTMLstring, 4, 6) var/textb = copytext(HTMLstring, 6, 8) @@ -46,7 +44,6 @@ if(length(textb) < 2) textr = text("0[]", textb) return text("#[][][]", textr, textg, textb) - return //Returns the middle-most value /proc/dd_range(var/low, var/high, var/num) @@ -320,7 +317,7 @@ Turf and target are seperate in case you want to teleport some distance from a t //When a borg is activated, it can choose which AI it wants to be slaved to /proc/active_ais() . = list() - for(var/mob/living/silicon/ai/A in GLOB.living_mob_list) + for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list) if(A.stat == DEAD) continue if(A.control_disabled == 1) @@ -437,16 +434,6 @@ Turf and target are seperate in case you want to teleport some distance from a t return "[round((powerused * 0.000001), 0.001)] MW" return "[round((powerused * 0.000000001), 0.0001)] GW" -//E = MC^2 -/proc/convert2energy(var/M) - var/E = M*(SPEED_OF_LIGHT_SQ) - return E - -//M = E/C^2 -/proc/convert2mass(var/E) - var/M = E/(SPEED_OF_LIGHT_SQ) - return M - //Forces a variable to be posative /proc/modulus(var/M) if(M >= 0) @@ -540,21 +527,6 @@ Returns 1 if the chain up to the area contains the given typepath /proc/between(var/low, var/middle, var/high) return max(min(middle, high), low) - - -#if DM_VERSION > 513 -#warn 513 is definitely stable now, remove this -#endif -#if DM_VERSION < 513 -/proc/arctan(x) - var/y=arcsin(x/sqrt(1+x*x)) - return y -/proc/islist(list/list) - if(istype(list)) - return 1 - return 0 -#endif - //returns random gauss number proc/GaussRand(var/sigma) var/x,y,rsq @@ -1520,7 +1492,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) //orbit() can run without it (swap orbiting for A) //but then you can never stop it and that's just silly. /atom/movable/var/atom/orbiting = null - +/atom/movable/var/cached_transform = null //A: atom to orbit //radius: range to orbit at, radius of the circle formed by orbiting //clockwise: whether you orbit clockwise or anti clockwise @@ -1538,6 +1510,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) orbiting = A var/matrix/initial_transform = matrix(transform) + cached_transform = initial_transform var/lastloc = loc //Head first! @@ -1555,8 +1528,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) SpinAnimation(rotation_speed, -1, clockwise, rotation_segments) - //we stack the orbits up client side, so we can assign this back to normal server side without it breaking the orbit - transform = initial_transform while(orbiting && orbiting == A && A.loc) var/targetloc = get_turf(A) if(!lockinorbit && loc != lastloc && loc != targetloc) @@ -1570,12 +1541,14 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) if(orbiting == A) //make sure we haven't started orbiting something else. orbiting = null - SpinAnimation(0,0) + SpinAnimation(0, 0) + transform = cached_transform /atom/movable/proc/stop_orbit() orbiting = null + transform = cached_transform //Centers an image. //Requires: @@ -2035,6 +2008,10 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) tX = splittext(tX[1], ":") tX = tX[1] var/list/actual_view = getviewsize(C ? C.view : world.view) - tX = Clamp(origin.x + text2num(tX) - round(actual_view[1] / 2) - 1, 1, world.maxx) - tY = Clamp(origin.y + text2num(tY) - round(actual_view[2] / 2) - 1, 1, world.maxy) + tX = clamp(origin.x + text2num(tX) - round(actual_view[1] / 2) - 1, 1, world.maxx) + tY = clamp(origin.y + text2num(tY) - round(actual_view[2] / 2) - 1, 1, world.maxy) return locate(tX, tY, tZ) + +/proc/CallAsync(datum/source, proctype, list/arguments) + set waitfor = FALSE + return call(source, proctype)(arglist(arguments)) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 536ea01cc96..c966514d64e 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -11,8 +11,6 @@ #define IS_MODE_COMPILED(MODE) (ispath(text2path("/datum/game_mode/"+(MODE)))) -#define BACKGROUND_ENABLED 0 // The default value for all uses of set background. Set background can cause gradual lag and is recommended you only turn this on if necessary. - //Don't set this very much higher then 1024 unless you like inviting people in to dos your server with message spam #define MAX_MESSAGE_LEN 1024 #define MAX_PAPER_MESSAGE_LEN 3072 @@ -20,11 +18,13 @@ #define MAX_BOOK_MESSAGE_LEN 9216 #define MAX_NAME_LEN 50 //diona names can get loooooooong -// Version check, terminates compilation if someone is using a version of BYOND that's too old -#if DM_VERSION < 510 -#error OUTDATED VERSION ERROR - \ -Due to BYOND features used in this codebase, you must update to version 510 or later to compile. \ -This may require updating to a beta release. +//Update this whenever you need to take advantage of more recent byond features +#define MIN_COMPILER_VERSION 513 +#define MIN_COMPILER_BUILD 1514 +#if DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD +//Don't forget to update this part +#error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update. +#error You need version 513.1514 or higher #endif // Macros that must exist before world.dm diff --git a/code/_globalvars/lists/mobs.dm b/code/_globalvars/lists/mobs.dm index b6fcae25061..17444f66207 100644 --- a/code/_globalvars/lists/mobs.dm +++ b/code/_globalvars/lists/mobs.dm @@ -3,30 +3,33 @@ GLOBAL_LIST_EMPTY(all_species) GLOBAL_LIST_EMPTY(all_languages) GLOBAL_LIST_EMPTY(language_keys) // Table of say codes for all languages GLOBAL_LIST_EMPTY(all_superheroes) -GLOBAL_LIST_INIT(whitelisted_species, list()) +GLOBAL_LIST_EMPTY(whitelisted_species) -GLOBAL_LIST_INIT(clients, list()) //list of all clients -GLOBAL_LIST_INIT(admins, list()) //list of all clients whom are admins -GLOBAL_LIST_INIT(deadmins, list()) //list of all clients who have used the de-admin verb. -GLOBAL_LIST_INIT(directory, list()) //list of all ckeys with associated client -GLOBAL_LIST_INIT(stealthminID, list()) //reference list with IDs that store ckeys, for stealthmins +GLOBAL_LIST_EMPTY(clients) //list of all clients +GLOBAL_LIST_EMPTY(admins) //list of all clients whom are admins +GLOBAL_LIST_EMPTY(deadmins) //list of all clients who have used the de-admin verb. +GLOBAL_LIST_EMPTY(directory) //list of all ckeys with associated client +GLOBAL_LIST_EMPTY(stealthminID) //reference list with IDs that store ckeys, for stealthmins //Since it didn't really belong in any other category, I'm putting this here //This is for procs to replace all the goddamn 'in world's that are chilling around the code -GLOBAL_LIST_INIT(player_list, list()) //List of all mobs **with clients attached**. Excludes /mob/new_player -GLOBAL_LIST_INIT(mob_list, list()) //List of all mobs, including clientless -GLOBAL_LIST_INIT(silicon_mob_list, list()) //List of all silicon mobs, including clientless -GLOBAL_LIST_INIT(spirits, list()) //List of all the spirits, including Masks -GLOBAL_LIST_INIT(living_mob_list, list()) //List of all alive mobs, including clientless. Excludes /mob/new_player -GLOBAL_LIST_INIT(dead_mob_list, list()) //List of all dead mobs, including clientless. Excludes /mob/new_player -GLOBAL_LIST_INIT(respawnable_list, list()) //List of all mobs, dead or in mindless creatures that still be respawned. -GLOBAL_LIST_INIT(non_respawnable_keys, list()) //List of ckeys that are excluded from respawning for remainder of round. +GLOBAL_LIST_EMPTY(player_list) //List of all mobs **with clients attached**. Excludes /mob/new_player +GLOBAL_LIST_EMPTY(mob_list) //List of all mobs, including clientless +GLOBAL_LIST_EMPTY(silicon_mob_list) //List of all silicon mobs, including clientless +GLOBAL_LIST_EMPTY(mob_living_list) //all instances of /mob/living and subtypes +GLOBAL_LIST_EMPTY(carbon_list) //all instances of /mob/living/carbon and subtypes, notably does not contain simple animals +GLOBAL_LIST_EMPTY(human_list) //all instances of /mob/living/carbon/human and subtypes +GLOBAL_LIST_EMPTY(spirits) //List of all the spirits, including Masks +GLOBAL_LIST_EMPTY(alive_mob_list) //List of all alive mobs, including clientless. Excludes /mob/new_player +GLOBAL_LIST_EMPTY(dead_mob_list) //List of all dead mobs, including clientless. Excludes /mob/new_player +GLOBAL_LIST_EMPTY(respawnable_list) //List of all mobs, dead or in mindless creatures that still be respawned. +GLOBAL_LIST_EMPTY(non_respawnable_keys) //List of ckeys that are excluded from respawning for remainder of round. GLOBAL_LIST_INIT(simple_animals, list(list(), list(), list(), list())) //One for each AI_* status define, List of all simple animals, including clientless -GLOBAL_LIST_INIT(bots_list, list()) //List of all bots(beepsky, medibots,etc) +GLOBAL_LIST_EMPTY(bots_list) //List of all bots(beepsky, medibots,etc) -GLOBAL_LIST_INIT(med_hud_users, list()) -GLOBAL_LIST_INIT(sec_hud_users, list()) -GLOBAL_LIST_INIT(antag_hud_users, list()) -GLOBAL_LIST_INIT(surgeries_list, list()) -GLOBAL_LIST_INIT(hear_radio_list, list()) //Mobs that hear the radio even if there's no client +GLOBAL_LIST_EMPTY(med_hud_users) +GLOBAL_LIST_EMPTY(sec_hud_users) +GLOBAL_LIST_EMPTY(antag_hud_users) +GLOBAL_LIST_EMPTY(surgeries_list) +GLOBAL_LIST_EMPTY(hear_radio_list) //Mobs that hear the radio even if there's no client diff --git a/code/_globalvars/mapping.dm b/code/_globalvars/mapping.dm index 5ea100f1718..e43062a18b7 100644 --- a/code/_globalvars/mapping.dm +++ b/code/_globalvars/mapping.dm @@ -3,8 +3,9 @@ #define Z_SOUTH 3 #define Z_WEST 4 -GLOBAL_LIST_INIT(cardinal, list( NORTH, SOUTH, EAST, WEST )) +GLOBAL_LIST_INIT(cardinal, list(NORTH, SOUTH, EAST, WEST)) GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) +GLOBAL_LIST_INIT(alldirs2, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST, NORTH, SOUTH, EAST, WEST)) GLOBAL_LIST_INIT(diagonals, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) // This must exist early on or shit breaks bad diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 20e50bb3054..d840f64bb4a 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -134,9 +134,9 @@ if(W == A) W.attack_self(src) if(hand) - update_inv_l_hand(0) + update_inv_l_hand() else - update_inv_r_hand(0) + update_inv_r_hand() return // operate three levels deep here (item in backpack in src; item in box in backpack in src, not any deeper) @@ -258,6 +258,9 @@ Makes the mob face the direction of the clicked thing */ /mob/proc/MiddleShiftClickOn(atom/A) + return + +/mob/living/MiddleShiftClickOn(atom/A) if(incapacitated()) return var/face_dir = get_cardinal_dir(src, A) @@ -273,6 +276,9 @@ Makes the mob constantly face the object (until it's out of sight) */ /mob/proc/MiddleShiftControlClickOn(atom/A) + return + +/mob/living/MiddleShiftControlClickOn(atom/A) var/face_uid = A.UID() if(forced_look == face_uid || A == src) forced_look = null diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index d49c0ee59eb..a93e65c762b 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -19,9 +19,8 @@ if(!category) return - var/obj/screen/alert/alert - if(alerts[category]) - alert = alerts[category] + var/obj/screen/alert/alert = LAZYACCESS(alerts, category) + if(alert) if(alert.override_alerts) return 0 if(new_master && new_master != alert.master) @@ -57,7 +56,7 @@ alert.icon_state = "[initial(alert.icon_state)][severity]" alert.severity = severity - alerts[category] = alert + LAZYSET(alerts, category, alert) // This also creates the list if it doesn't exist if(client && hud_used) hud_used.reorganize_alerts() alert.transform = matrix(32, 6, MATRIX_TRANSLATE) @@ -72,7 +71,7 @@ // Proc to clear an existing alert. /mob/proc/clear_alert(category, clear_override = FALSE) - var/obj/screen/alert/alert = alerts[category] + var/obj/screen/alert/alert = LAZYACCESS(alerts, category) if(!alert) return 0 if(alert.override_alerts && !clear_override) @@ -585,12 +584,14 @@ so as to remain in compliance with the most up-to-date laws." // Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there /datum/hud/proc/reorganize_alerts() var/list/alerts = mymob.alerts + if(!alerts) + return FALSE var/icon_pref if(!hud_shown) - for(var/i = 1, i <= alerts.len, i++) + for(var/i in 1 to alerts.len) mymob.client.screen -= alerts[alerts[i]] - return 1 - for(var/i = 1, i <= alerts.len, i++) + return TRUE + for(var/i in 1 to alerts.len) var/obj/screen/alert/alert = alerts[alerts[i]] if(alert.icon_state == "template") if(!icon_pref) @@ -611,10 +612,10 @@ so as to remain in compliance with the most up-to-date laws." . = "" alert.screen_loc = . mymob.client.screen |= alert - return 1 + return TRUE /mob - var/list/alerts = list() // contains /obj/screen/alert only // On /mob so clientless mobs will throw alerts properly + var/list/alerts // lazy list. contains /obj/screen/alert only // On /mob so clientless mobs will throw alerts properly /obj/screen/alert/Click(location, control, params) if(!usr || !usr.client) diff --git a/code/_onclick/hud/other_mobs.dm b/code/_onclick/hud/other_mobs.dm index f03d436bcaf..8f243dfcdc1 100644 --- a/code/_onclick/hud/other_mobs.dm +++ b/code/_onclick/hud/other_mobs.dm @@ -3,6 +3,10 @@ /datum/hud/simple_animal/New(mob/user) ..() + + mymob.healths = new /obj/screen/healths() + infodisplay += mymob.healths + var/obj/screen/using using = new /obj/screen/act_intent/simple_animal() using.icon_state = mymob.a_intent diff --git a/code/_onclick/hud/parallax.dm b/code/_onclick/hud/parallax.dm index 68847cbd97d..d5fb5cad4fa 100644 --- a/code/_onclick/hud/parallax.dm +++ b/code/_onclick/hud/parallax.dm @@ -246,7 +246,7 @@ if(!view) view = world.view var/list/new_overlays = list() - var/count = Ceiling(view/(480/world.icon_size))+1 + var/count = CEILING(view/(480/world.icon_size), 1)+1 for(var/x in -count to count) for(var/y in -count to count) if(x == 0 && y == 0) diff --git a/code/_onclick/hud/picture_in_picture.dm b/code/_onclick/hud/picture_in_picture.dm index 872659d714b..eda0cc5640d 100644 --- a/code/_onclick/hud/picture_in_picture.dm +++ b/code/_onclick/hud/picture_in_picture.dm @@ -102,8 +102,8 @@ overlays += standard_background /obj/screen/movable/pic_in_pic/proc/set_view_size(width, height, do_refresh = TRUE) - width = Clamp(width, 0, max_dimensions) - height = Clamp(height, 0, max_dimensions) + width = clamp(width, 0, max_dimensions) + height = clamp(height, 0, max_dimensions) src.width = width src.height = height diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index 14080274617..f048c3c393d 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -201,7 +201,7 @@ if(!R.robot_modules_background) return - var/display_rows = Ceiling(R.module.modules.len / 8) + var/display_rows = CEILING(R.module.modules.len / 8, 1) R.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7" R.client.screen += R.robot_modules_background diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index c0f5cfd5f3b..1423720f8f6 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -371,15 +371,15 @@ return 1 if(istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech return 1 - + if(hud?.mymob && slot_id) var/obj/item/inv_item = hud.mymob.get_item_by_slot(slot_id) if(inv_item) return inv_item.Click(location, control, params) if(usr.attack_ui(slot_id)) - usr.update_inv_l_hand(0) - usr.update_inv_r_hand(0) + usr.update_inv_l_hand() + usr.update_inv_r_hand() return 1 /obj/screen/inventory/hand diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index e27002cf118..6f38814758a 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -135,9 +135,9 @@ /obj/item/proc/get_clamped_volume() if(w_class) if(force) - return Clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100 + return clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100 else - return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100 + return clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100 /mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area) if(I.discrete) diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 460bc0193f6..80a9651f6ea 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -15,7 +15,6 @@ // Otherwise jump else - following = null forceMove(get_turf(A)) update_parallax_contents() diff --git a/code/controllers/globals.dm b/code/controllers/globals.dm index 5a520b547e1..691f19201f6 100644 --- a/code/controllers/globals.dm +++ b/code/controllers/globals.dm @@ -14,7 +14,7 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars) var/datum/controller/exclude_these = new gvars_datum_in_built_vars = exclude_these.vars + list("gvars_datum_protected_varlist", "gvars_datum_in_built_vars", "gvars_datum_init_order") - qdel(exclude_these) + QDEL_IN(exclude_these, 0) //signal logging isn't ready Initialize() diff --git a/code/controllers/master.dm b/code/controllers/master.dm index fea79c2f7a5..b8c3cdbf1e2 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -451,14 +451,15 @@ GLOBAL_REAL(Master, /datum/controller/master) = new // in those cases, so we just let them run) if(queue_node_flags & SS_NO_TICK_CHECK) if(queue_node.tick_usage > TICK_LIMIT_RUNNING - TICK_USAGE && ran_non_ticker) - queue_node.queued_priority += queue_priority_count * 0.1 - queue_priority_count -= queue_node_priority - queue_priority_count += queue_node.queued_priority - current_tick_budget -= queue_node_priority - queue_node = queue_node.queue_next + if(!(queue_node_flags & SS_BACKGROUND)) + queue_node.queued_priority += queue_priority_count * 0.1 + queue_priority_count -= queue_node_priority + queue_priority_count += queue_node.queued_priority + current_tick_budget -= queue_node_priority + queue_node = queue_node.queue_next continue - if((queue_node_flags & SS_BACKGROUND) && !bg_calc) + if(!bg_calc && (queue_node_flags & SS_BACKGROUND)) current_tick_budget = queue_priority_count_bg bg_calc = TRUE @@ -511,7 +512,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new queue_node.paused_ticks = 0 queue_node.paused_tick_usage = 0 - if(queue_node_flags & SS_BACKGROUND) //update our running total + if(bg_calc) //update our running total queue_priority_count_bg -= queue_node_priority else queue_priority_count -= queue_node_priority diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 4a125003389..03e54df61c5 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -1,7 +1,7 @@ /datum/controller/subsystem // Metadata; you should define these. - name = "fire coderbus" //name of the subsystem + name = "fire codertrain" //name of the subsystem var/init_order = INIT_ORDER_DEFAULT //order of initialization. Higher numbers are initialized first, lower numbers later. Use defines in __DEFINES/subsystems.dm for easy understanding of order. var/wait = 20 //time to wait (in deciseconds) between each call to fire(). Must be a positive integer. var/priority = FIRE_PRIORITY_DEFAULT //When mutiple subsystems need to run in the same tick, higher priority subsystems will run first and be given a higher share of the tick before MC_TICK_CHECK triggers a sleep @@ -89,7 +89,7 @@ queue_node_flags = queue_node.flags if(queue_node_flags & SS_TICKER) - if(!(SS_flags & SS_TICKER)) + if((SS_flags & (SS_TICKER|SS_BACKGROUND)) != SS_TICKER) continue if(queue_node_priority < SS_priority) break diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm index 9122e6a16c6..037b9a2bd0a 100644 --- a/code/controllers/subsystem/afk.dm +++ b/code/controllers/subsystem/afk.dm @@ -1,5 +1,6 @@ -#define AFK_WARNED 1 -#define AFK_CRYOD 2 +#define AFK_WARNED 1 +#define AFK_CRYOD 2 +#define AFK_ADMINS_WARNED 3 SUBSYSTEM_DEF(afk) name = "AFK Watcher" @@ -7,24 +8,28 @@ SUBSYSTEM_DEF(afk) flags = SS_BACKGROUND offline_implications = "Players will no longer be marked as AFK. No immediate action is needed." var/list/afk_players = list() // Associative list. ckey as key and AFK state as value + var/list/non_cryo_antags /datum/controller/subsystem/afk/Initialize() - if(config.warn_afk_minimum <= 0 || config.auto_cryo_afk <= 0 || config.auto_despawn_afk <= 0) - flags |= SS_NO_FIRE + if(config.warn_afk_minimum <= 0 || config.auto_cryo_afk <= 0 || config.auto_despawn_afk <= 0) + flags |= SS_NO_FIRE + else + non_cryo_antags = list(SPECIAL_ROLE_ABDUCTOR_AGENT, SPECIAL_ROLE_ABDUCTOR_SCIENTIST, \ + SPECIAL_ROLE_SHADOWLING, SPECIAL_ROLE_WIZARD, SPECIAL_ROLE_WIZARD_APPRENTICE, SPECIAL_ROLE_NUKEOPS) + return ..() /datum/controller/subsystem/afk/fire() var/list/toRemove = list() - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) - if(!H.ckey) // Useless non ckey creatures + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) + if(!H?.ckey) // Useless non ckey creatures continue var/turf/T // Only players and players with the AFK watch enabled - // No dead, unconcious, restrained, people without jobs, people on other Z levels than the station or antags + // No dead, unconcious, restrained, people without jobs or people on other Z levels than the station if(!H.client || !H.client.prefs.afk_watch || !H.mind || \ - H.stat || H.restrained() || !H.job || H.mind.special_role || \ - !is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization + H.stat || H.restrained() || !H.job || !is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization if(afk_players[H.ckey]) toRemove += H.ckey continue @@ -45,19 +50,26 @@ SUBSYSTEM_DEF(afk) if(A.fast_despawn) toRemove += H.ckey warn(H, "You are have been despawned after being AFK for [mins_afk] minutes. You have been despawned instantly due to you being in a secure area.") - msg_admins(H, mins_afk, T, "forcefully despawned", "AFK in a fast despawn area") + log_afk_action(H, mins_afk, T, "despawned", "AFK in a fast despawn area") force_cryo_human(H) - else if(cryo_ssd(H)) - afk_players[H.ckey] = AFK_CRYOD - msg_admins(H, mins_afk, T, "put into cryostorage") - warn(H, "You are AFK for [mins_afk] minutes and have been moved to cryostorage. After being AFK for [config.auto_despawn_afk] total minutes you will be fully despawned. Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.") + else + if(!(H.mind.special_role in non_cryo_antags)) + if(cryo_ssd(H)) + H.create_log(MISC_LOG, "Put into cryostorage by the AFK subsystem") + afk_players[H.ckey] = AFK_CRYOD + log_afk_action(H, mins_afk, T, "put into cryostorage") + warn(H, "You are AFK for [mins_afk] minutes and have been moved to cryostorage. \ + After being AFK for another [config.auto_despawn_afk] minutes you will be fully despawned. \ + Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.") + else + message_admins("[key_name_admin(H)] at ([get_area(T).name] [ADMIN_JMP(T)]) is AFK for [mins_afk] and can't be automatically cryod due to it's antag status: ([H.mind.special_role]).") + afk_players[H.ckey] = AFK_ADMINS_WARNED - else if(mins_afk >= config.auto_despawn_afk) - var/obj/machinery/cryopod/P = H.loc - msg_admins(H, mins_afk, T, "forcefully despawned") + else if(afk_players[H.ckey] != AFK_ADMINS_WARNED && mins_afk >= config.auto_despawn_afk) + log_afk_action(H, mins_afk, T, "despawned") warn(H, "You are have been despawned after being AFK for [mins_afk] minutes.") toRemove += H.ckey - P.despawn_occupant() + force_cryo_human(H) removeFromWatchList(toRemove) @@ -67,9 +79,8 @@ SUBSYSTEM_DEF(afk) if(H.client) window_flash(H.client) -/datum/controller/subsystem/afk/proc/msg_admins(mob/living/carbon/human/H, mins_afk, turf/location, action, info) +/datum/controller/subsystem/afk/proc/log_afk_action(mob/living/carbon/human/H, mins_afk, turf/location, action, info) log_admin("[key_name(H)] has been [action] by the AFK Watcher subsystem after being AFK for [mins_afk] minutes.[info ? " Extra info:" + info : ""]") - message_admins("[key_name_admin(H)] at ([get_area(location).name] [ADMIN_JMP(location)]) has been [action] by the AFK Watcher subsystem after being AFK for [mins_afk] minutes.[info ? " Extra info:" + info : ""]") /datum/controller/subsystem/afk/proc/removeFromWatchList(list/toRemove) for(var/C in toRemove) @@ -80,3 +91,4 @@ SUBSYSTEM_DEF(afk) #undef AFK_WARNED #undef AFK_CRYOD +#undef AFK_ADMINS_WARNED diff --git a/code/controllers/subsystem/dcs.dm b/code/controllers/subsystem/dcs.dm new file mode 100644 index 00000000000..09dea24071f --- /dev/null +++ b/code/controllers/subsystem/dcs.dm @@ -0,0 +1,53 @@ +PROCESSING_SUBSYSTEM_DEF(dcs) + name = "Datum Component System" + flags = SS_NO_INIT + + var/list/elements_by_type = list() + +/datum/controller/subsystem/processing/dcs/Recover() + comp_lookup = SSdcs.comp_lookup + +/datum/controller/subsystem/processing/dcs/proc/GetElement(list/arguments) + var/datum/element/eletype = arguments[1] + var/element_id = eletype + + if(!ispath(eletype, /datum/element)) + CRASH("Attempted to instantiate [eletype] as a /datum/element") + + if(initial(eletype.element_flags) & ELEMENT_BESPOKE) + element_id = GetIdFromArguments(arguments) + + . = elements_by_type[element_id] + if(.) + return + . = elements_by_type[element_id] = new eletype + +/**** + * Generates an id for bespoke elements when given the argument list + * Generating the id here is a bit complex because we need to support named arguments + * Named arguments can appear in any order and we need them to appear after ordered arguments + * We assume that no one will pass in a named argument with a value of null + **/ +/datum/controller/subsystem/processing/dcs/proc/GetIdFromArguments(list/arguments) + var/datum/element/eletype = arguments[1] + var/list/fullid = list("[eletype]") + var/list/named_arguments = list() + for(var/i in initial(eletype.id_arg_index) to length(arguments)) + var/key = arguments[i] + var/value + if(istext(key)) + value = arguments[key] + if(!(istext(key) || isnum(key))) + key = "\ref[key]" + key = "[key]" // Key is stringified so numbers dont break things + if(!isnull(value)) + if(!(istext(value) || isnum(value))) + value = "\ref[value]" + named_arguments["[key]"] = value + else + fullid += "[key]" + + if(length(named_arguments)) + named_arguments = sortList(named_arguments) + fullid += named_arguments + return list2params(fullid) diff --git a/code/controllers/subsystem/input.dm b/code/controllers/subsystem/input.dm index 9dd6fce1554..ecbf1471993 100644 --- a/code/controllers/subsystem/input.dm +++ b/code/controllers/subsystem/input.dm @@ -121,3 +121,8 @@ SUBSYSTEM_DEF(input) for(var/i in 1 to clients.len) var/client/C = clients[i] C.keyLoop() + +/datum/controller/subsystem/input/Recover() + macro_sets = SSinput.macro_sets + movement_keys = SSinput.movement_keys + alt_movement_keys = SSinput.alt_movement_keys diff --git a/code/controllers/subsystem/jobs.dm b/code/controllers/subsystem/jobs.dm index 1d6fd410f9b..ef89317d0f5 100644 --- a/code/controllers/subsystem/jobs.dm +++ b/code/controllers/subsystem/jobs.dm @@ -497,13 +497,14 @@ SUBSYSTEM_DEF(jobs) job.after_spawn(H) //Gives glasses to the vision impaired - if(H.disabilities & DISABILITY_FLAG_NEARSIGHTED) + if(NEARSIGHTED in H.mutations) var/equipped = H.equip_to_slot_or_del(new /obj/item/clothing/glasses/regular(H), slot_glasses) if(equipped != 1) var/obj/item/clothing/glasses/G = H.glasses if(istype(G) && !G.prescription) - G.prescription = 1 + G.prescription = TRUE G.name = "prescription [G.name]" + H.update_nearsighted_effects() return H diff --git a/code/controllers/subsystem/lighting.dm b/code/controllers/subsystem/lighting.dm index 3fc92a3346a..6761e9647d9 100644 --- a/code/controllers/subsystem/lighting.dm +++ b/code/controllers/subsystem/lighting.dm @@ -1,16 +1,15 @@ -GLOBAL_LIST_EMPTY(lighting_update_lights) // List of lighting sources queued for update. -GLOBAL_LIST_EMPTY(lighting_update_corners) // List of lighting corners queued for update. -GLOBAL_LIST_EMPTY(lighting_update_objects) // List of lighting objects queued for update. - SUBSYSTEM_DEF(lighting) name = "Lighting" wait = 2 init_order = INIT_ORDER_LIGHTING flags = SS_TICKER offline_implications = "Lighting will no longer update. Shuttle call recommended." + var/static/list/sources_queue = list() // List of lighting sources queued for update. + var/static/list/corners_queue = list() // List of lighting corners queued for update. + var/static/list/objects_queue = list() // List of lighting objects queued for update. /datum/controller/subsystem/lighting/stat_entry() - ..("L:[GLOB.lighting_update_lights.len]|C:[GLOB.lighting_update_corners.len]|O:[GLOB.lighting_update_objects.len]") + ..("L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]") /datum/controller/subsystem/lighting/Initialize(timeofday) if(!initialized) @@ -31,9 +30,10 @@ SUBSYSTEM_DEF(lighting) MC_SPLIT_TICK_INIT(3) if(!init_tick_checks) MC_SPLIT_TICK + var/list/queue = sources_queue var/i = 0 - for(i in 1 to GLOB.lighting_update_lights.len) - var/datum/light_source/L = GLOB.lighting_update_lights[i] + for(i in 1 to length(queue)) + var/datum/light_source/L = queue[i] L.update_corners() @@ -44,14 +44,15 @@ SUBSYSTEM_DEF(lighting) else if(MC_TICK_CHECK) break if(i) - GLOB.lighting_update_lights.Cut(1, i+1) + queue.Cut(1, i + 1) i = 0 if(!init_tick_checks) MC_SPLIT_TICK - for (i in 1 to GLOB.lighting_update_corners.len) - var/datum/lighting_corner/C = GLOB.lighting_update_corners[i] + queue = corners_queue + for(i in 1 to length(queue)) + var/datum/lighting_corner/C = queue[i] C.update_objects() C.needs_update = FALSE @@ -60,15 +61,16 @@ SUBSYSTEM_DEF(lighting) else if(MC_TICK_CHECK) break if(i) - GLOB.lighting_update_corners.Cut(1, i+1) + queue.Cut(1, i + 1) i = 0 if(!init_tick_checks) MC_SPLIT_TICK - for (i in 1 to GLOB.lighting_update_objects.len) - var/atom/movable/lighting_object/O = GLOB.lighting_update_objects[i] + queue = objects_queue + for(i in 1 to length(queue)) + var/atom/movable/lighting_object/O = queue[i] if(QDELETED(O)) continue @@ -80,7 +82,7 @@ SUBSYSTEM_DEF(lighting) else if(MC_TICK_CHECK) break if(i) - GLOB.lighting_update_objects.Cut(1, i+1) + queue.Cut(1, i + 1) /datum/controller/subsystem/lighting/Recover() diff --git a/code/controllers/subsystem/mobs.dm b/code/controllers/subsystem/mobs.dm index 8345822ca80..9445dd2717a 100644 --- a/code/controllers/subsystem/mobs.dm +++ b/code/controllers/subsystem/mobs.dm @@ -11,7 +11,7 @@ SUBSYSTEM_DEF(mobs) var/static/list/cubemonkeys = list() /datum/controller/subsystem/mobs/stat_entry() - ..("P:[GLOB.mob_list.len]") + ..("P:[GLOB.mob_living_list.len]") /datum/controller/subsystem/mobs/Initialize(start_timeofday) clients_by_zlevel = new /list(world.maxz,0) @@ -21,17 +21,17 @@ SUBSYSTEM_DEF(mobs) /datum/controller/subsystem/mobs/fire(resumed = 0) var/seconds = wait * 0.1 if(!resumed) - src.currentrun = GLOB.mob_list.Copy() + src.currentrun = GLOB.mob_living_list.Copy() //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun var/times_fired = src.times_fired while(currentrun.len) - var/mob/M = currentrun[currentrun.len] + var/mob/living/L = currentrun[currentrun.len] currentrun.len-- - if(M) - M.Life(seconds, times_fired) + if(L) + L.Life(seconds, times_fired) else - GLOB.mob_list.Remove(M) + GLOB.mob_living_list.Remove(L) if(MC_TICK_CHECK) return diff --git a/code/controllers/subsystem/statistics.dm b/code/controllers/subsystem/statistics.dm new file mode 100644 index 00000000000..3a0bf7e51e2 --- /dev/null +++ b/code/controllers/subsystem/statistics.dm @@ -0,0 +1,28 @@ +SUBSYSTEM_DEF(statistics) + name = "Statistics" + wait = 6000 // 10 minute delay between fires + runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME // Only count time actually ingame to avoid logging pre-round dips + offline_implications = "Player count and admin count statistics will no longer be logged to the database. No immediate action is needed." + + +/datum/controller/subsystem/statistics/Initialize(start_timeofday) + if(!config.sql_enabled) + flags |= SS_NO_FIRE // Disable firing if SQL is disabled + return ..() + +/datum/controller/subsystem/statistics/fire(resumed = 0) + sql_poll_players() + +/datum/controller/subsystem/statistics/proc/sql_poll_players() + if(!config.sql_enabled) + return + var/playercount = GLOB.clients.len + var/admincount = GLOB.admins.len + if(!GLOB.dbcon.IsConnected()) + log_game("SQL ERROR during player polling. Failed to connect.") + else + var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss") + var/DBQuery/query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time) VALUES ([playercount], [admincount], '[sqltime]')") + if(!query.Execute()) + var/err = query.ErrorMsg() + log_game("SQL ERROR during playercount polling. Error: \[[err]\]\n") diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 7fa61252fef..99e20ed6794 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -29,7 +29,7 @@ SUBSYSTEM_DEF(ticker) var/pregame_timeleft // This is used for calculations var/delay_end = 0 //if set to nonzero, the round will not restart on it's own var/triai = 0//Global holder for Triumvirate - var/initialtpass = 0 //holder for inital autotransfer vote timer + var/next_autotransfer = 0 //holder for inital autotransfer vote timer var/obj/screen/cinematic = null //used for station explosion cinematic var/round_end_announced = 0 // Spam Prevention. Announce round end only once. var/ticker_going = TRUE // This used to be in the unused globals, but it turns out its actually used in a load of places. Its now a ticker var because its related to round stuff, -aa @@ -90,6 +90,11 @@ SUBSYSTEM_DEF(ticker) delay_end = 0 // reset this in case round start was delayed mode.process() mode.process_job_tasks() + + if(world.time > next_autotransfer) + SSvote.autotransfer() + next_autotransfer = world.time + config.vote_autotransfer_interval + var/game_finished = SSshuttle.emergency.mode >= SHUTTLE_ENDGAME || mode.station_was_nuked if(config.continuous_rounds) mode.check_finished() // some modes contain var-changing code in here, so call even if we don't uses result @@ -111,19 +116,6 @@ SUBSYSTEM_DEF(ticker) else world.Reboot("Round ended.", "end_proper", "proper completion") - -/datum/controller/subsystem/ticker/proc/votetimer() - var/timerbuffer = 0 - if(initialtpass == 0) - timerbuffer = config.vote_autotransfer_initial - else - timerbuffer = config.vote_autotransfer_interval - spawn(timerbuffer) - SSvote.autotransfer() - initialtpass = 1 - votetimer() - - /datum/controller/subsystem/ticker/proc/setup() cultdat = setupcult() //Create and announce mode @@ -288,11 +280,8 @@ SUBSYSTEM_DEF(ticker) auto_toggle_ooc(0) // Turn it off round_start_time = world.time - if(config.sql_enabled) - spawn(3000) - statistic_cycle() // Polls population totals regularly and stores them in an SQL DB - - votetimer() + // Sets the auto shuttle vote to happen after the config duration + next_autotransfer = world.time + config.vote_autotransfer_initial for(var/mob/new_player/N in GLOB.mob_list) if(N.client) diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index 7bb6a496274..53d77e8fad6 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -160,7 +160,7 @@ SUBSYSTEM_DEF(timer) if(timer.timeToRun < head_offset) bucket_resolution = null //force bucket recreation - CRASH("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") + stack_trace("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") if(timer.callBack && !timer.spent) timer.callBack.InvokeAsync() @@ -172,7 +172,7 @@ SUBSYSTEM_DEF(timer) if(timer.timeToRun < head_offset + TICKS2DS(practical_offset-1)) bucket_resolution = null //force bucket recreation - CRASH("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") + stack_trace("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") if(timer.callBack && !timer.spent) timer.callBack.InvokeAsync() spent += timer diff --git a/code/controllers/subsystem/weather.dm b/code/controllers/subsystem/weather.dm index 7b08bd3ca48..30186f80ad1 100644 --- a/code/controllers/subsystem/weather.dm +++ b/code/controllers/subsystem/weather.dm @@ -20,7 +20,7 @@ SUBSYSTEM_DEF(weather) var/datum/weather/W = V if(W.aesthetic || W.stage != MAIN_STAGE) continue - for(var/i in GLOB.living_mob_list) + for(var/i in GLOB.mob_living_list) var/mob/living/L = i if(W.can_weather_act(L)) W.weather_act(L) @@ -57,7 +57,6 @@ SUBSYSTEM_DEF(weather) break if(!ispath(weather_datum_type, /datum/weather)) CRASH("run_weather called with invalid weather_datum_type: [weather_datum_type || "null"]") - return if(isnull(z_levels)) z_levels = levels_by_trait(initial(weather_datum_type.target_trait)) @@ -65,7 +64,6 @@ SUBSYSTEM_DEF(weather) z_levels = list(z_levels) else if(!islist(z_levels)) CRASH("run_weather called with invalid z_levels: [z_levels || "null"]") - return var/datum/weather/W = new weather_datum_type(z_levels) W.telegraph() diff --git a/code/datums/action.dm b/code/datums/action.dm index b7af84e9ddf..c1802da47c1 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -339,7 +339,7 @@ /datum/action/item_action/remove_tape/Trigger(attack_self = FALSE) if(..()) - GET_COMPONENT_FROM(DT, /datum/component/ducttape, target) + var/datum/component/ducttape/DT = target.GetComponent(/datum/component/ducttape) DT.remove_tape(target, usr) /datum/action/item_action/toggle_jetpack diff --git a/code/datums/armor.dm b/code/datums/armor.dm new file mode 100644 index 00000000000..4d519827e5a --- /dev/null +++ b/code/datums/armor.dm @@ -0,0 +1,66 @@ +#define ARMORID "armor-[melee]-[bullet]-[laser]-[energy]-[bomb]-[bio]-[rad]-[fire]-[acid]" + +/proc/getArmor(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0) + . = locate(ARMORID) + if (!.) + . = new /datum/armor(melee, bullet, laser, energy, bomb, bio, rad, fire, acid) + +/datum/armor + var/melee + var/bullet + var/laser + var/energy + var/bomb + var/bio + var/rad + var/fire + var/acid + +/datum/armor/New(melee_value = 0, bullet_value = 0, laser_value = 0, energy_value = 0, bomb_value = 0, bio_value = 0, rad_value = 0, fire_value = 0, acid_value = 0) + melee = melee_value + bullet = bullet_value + laser = laser_value + energy = energy_value + bomb = bomb_value + bio = bio_value + rad = rad_value + fire = fire_value + acid = acid_value + tag = ARMORID + +/datum/armor/proc/modifyRating(melee_value = 0, bullet_value = 0, laser_value = 0, energy_value = 0, bomb_value = 0, bio_value = 0, rad_value = 0, fire_value = 0, acid_value = 0) + return getArmor(melee + melee_value, bullet + bullet_value, laser + laser_value, energy + energy_value, bomb + bomb_value, bio + bio_value, rad + rad_value, fire + fire_value, acid + acid_value) + +/datum/armor/proc/modifyAllRatings(modifier = 0) + return getArmor(melee + modifier, bullet + modifier, laser + modifier, energy + modifier, bomb + modifier, bio + modifier, rad + modifier, fire + modifier, acid + modifier) + +/datum/armor/proc/setRating(melee_value, bullet_value, laser_value, energy_value, bomb_value, bio_value, rad_value, fire_value, acid_value) + return getArmor((isnull(melee_value) ? melee : melee_value),\ + (isnull(bullet_value) ? bullet : bullet_value),\ + (isnull(laser_value) ? laser : laser_value),\ + (isnull(energy_value) ? energy : energy_value),\ + (isnull(bomb_value) ? bomb : bomb_value),\ + (isnull(bio_value) ? bio : bio_value),\ + (isnull(rad_value) ? rad : rad_value),\ + (isnull(fire_value) ? fire : fire_value),\ + (isnull(acid_value) ? acid : acid_value)) + +/datum/armor/proc/getRating(rating) + return vars[rating] + +/datum/armor/proc/getList() + return list("melee" = melee, "bullet" = bullet, "laser" = laser, "energy" = energy, "bomb" = bomb, "bio" = bio, "rad" = rad, "fire" = fire, "acid" = acid) + +/datum/armor/proc/attachArmor(datum/armor/AA) + return getArmor(melee + AA.melee, bullet + AA.bullet, laser + AA.laser, energy + AA.energy, bomb + AA.bomb, bio + AA.bio, rad + AA.rad, fire + AA.fire, acid + AA.acid) + +/datum/armor/proc/detachArmor(datum/armor/AA) + return getArmor(melee - AA.melee, bullet - AA.bullet, laser - AA.laser, energy - AA.energy, bomb - AA.bomb, bio - AA.bio, rad - AA.rad, fire - AA.fire, acid - AA.acid) + +/datum/armor/vv_edit_var(var_name, var_value) + if (var_name == NAMEOF(src, tag)) + return FALSE + . = ..() + tag = ARMORID // update tag in case armor values were edited + +#undef ARMORID diff --git a/code/datums/beam.dm b/code/datums/beam.dm index 86f816662c0..19935bda130 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -99,11 +99,11 @@ //Position the effect so the beam is one continous line var/a if(abs(Pixel_x)>32) - a = Pixel_x > 0 ? round(Pixel_x/32) : Ceiling(Pixel_x/32) + a = Pixel_x > 0 ? round(Pixel_x/32) : CEILING(Pixel_x/32, 1) X.x += a Pixel_x %= 32 if(abs(Pixel_y)>32) - a = Pixel_y > 0 ? round(Pixel_y/32) : Ceiling(Pixel_y/32) + a = Pixel_y > 0 ? round(Pixel_y/32) : CEILING(Pixel_y/32, 1) X.y += a Pixel_y %= 32 diff --git a/code/datums/cache/crew.dm b/code/datums/cache/crew.dm index 21ec5ebcc79..f92bab9cf7a 100644 --- a/code/datums/cache/crew.dm +++ b/code/datums/cache/crew.dm @@ -4,7 +4,7 @@ GLOBAL_DATUM_INIT(crew_repository, /datum/repository/crew, new()) cache_data = list() ..() -/datum/repository/crew/proc/health_data(var/turf/T) +/datum/repository/crew/proc/health_data(turf/T) var/list/crewmembers = list() if(!T) return crewmembers @@ -18,50 +18,40 @@ GLOBAL_DATUM_INIT(crew_repository, /datum/repository/crew, new()) if(world.time < cache_entry.timestamp) return cache_entry.data - var/tracked = scan() - for(var/obj/item/clothing/under/C in tracked) + for(var/thing in GLOB.human_list) + var/mob/living/carbon/human/H = thing + var/obj/item/clothing/under/C = H.w_uniform + if(!C || C.sensor_mode == SUIT_SENSOR_OFF || !C.has_sensor) + continue var/turf/pos = get_turf(C) - if((C) && (C.has_sensor) && (pos) && (T && pos.z == T.z) && (C.sensor_mode != SUIT_SENSOR_OFF)) - if(istype(C.loc, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = C.loc - if(H.w_uniform != C) - continue + if(!T || pos.z != T.z) + continue + var/list/crewmemberData = list("dead"=0, "oxy"=-1, "tox"=-1, "fire"=-1, "brute"=-1, "area"="", "x"=-1, "y"=-1, "ref" = "\ref[H]") - var/list/crewmemberData = list("dead"=0, "oxy"=-1, "tox"=-1, "fire"=-1, "brute"=-1, "area"="", "x"=-1, "y"=-1, "ref" = "\ref[H]") + crewmemberData["sensor_type"] = C.sensor_mode + crewmemberData["name"] = H.get_authentification_name(if_no_id="Unknown") + crewmemberData["rank"] = H.get_authentification_rank(if_no_id="Unknown", if_no_job="No Job") + crewmemberData["assignment"] = H.get_assignment(if_no_id="Unknown", if_no_job="No Job") - crewmemberData["sensor_type"] = C.sensor_mode - crewmemberData["name"] = H.get_authentification_name(if_no_id="Unknown") - crewmemberData["rank"] = H.get_authentification_rank(if_no_id="Unknown", if_no_job="No Job") - crewmemberData["assignment"] = H.get_assignment(if_no_id="Unknown", if_no_job="No Job") + if(C.sensor_mode >= SUIT_SENSOR_BINARY) + crewmemberData["dead"] = H.stat > UNCONSCIOUS - if(C.sensor_mode >= SUIT_SENSOR_BINARY) - crewmemberData["dead"] = H.stat > UNCONSCIOUS + if(C.sensor_mode >= SUIT_SENSOR_VITAL) + crewmemberData["oxy"] = round(H.getOxyLoss(), 1) + crewmemberData["tox"] = round(H.getToxLoss(), 1) + crewmemberData["fire"] = round(H.getFireLoss(), 1) + crewmemberData["brute"] = round(H.getBruteLoss(), 1) - if(C.sensor_mode >= SUIT_SENSOR_VITAL) - crewmemberData["oxy"] = round(H.getOxyLoss(), 1) - crewmemberData["tox"] = round(H.getToxLoss(), 1) - crewmemberData["fire"] = round(H.getFireLoss(), 1) - crewmemberData["brute"] = round(H.getBruteLoss(), 1) + if(C.sensor_mode >= SUIT_SENSOR_TRACKING) + var/area/A = get_area(H) + crewmemberData["area"] = sanitize(A.name) + crewmemberData["x"] = pos.x + crewmemberData["y"] = pos.y - if(C.sensor_mode >= SUIT_SENSOR_TRACKING) - var/area/A = get_area(H) - crewmemberData["area"] = sanitize(A.name) - crewmemberData["x"] = pos.x - crewmemberData["y"] = pos.y - - crewmembers[++crewmembers.len] = crewmemberData + crewmembers[++crewmembers.len] = crewmemberData crewmembers = sortByKey(crewmembers, "name") cache_entry.timestamp = world.time + 5 SECONDS cache_entry.data = crewmembers return crewmembers - -/datum/repository/crew/proc/scan() - var/list/tracked = list() - for(var/mob/living/carbon/human/H in GLOB.mob_list) - if(istype(H.w_uniform, /obj/item/clothing/under)) - var/obj/item/clothing/under/C = H.w_uniform - if(C.has_sensor) - tracked |= C - return tracked diff --git a/code/datums/components/README.md b/code/datums/components/README.md index 9d06a255dd7..03f7d3a5875 100644 --- a/code/datums/components/README.md +++ b/code/datums/components/README.md @@ -2,134 +2,8 @@ ## Concept -Loosely adapted from /vg/. This is an entity component system for adding behaviours to datums when inheritance doesn't quite cut it. By using signals and events instead of direct inheritance, you can inject behaviours without hacky overloads. It requires a different method of thinking, but is not hard to use correctly. If a behaviour can have application across more than one thing. Make it generic, make it a component. Atom/mob/obj event? Give it a signal, and forward it's arguments with a `SEND_SIGNAL` call. Now every component that want's to can also know about this happening. +Loosely adapted from /vg/. This is an entity component system for adding behaviours to datums when inheritance doesn't quite cut it. By using signals and events instead of direct inheritance, you can inject behaviours without hacky overloads. It requires a different method of thinking, but is not hard to use correctly. If a behaviour can have application across more than one thing. Make it generic, make it a component. Atom/mob/obj event? Give it a signal, and forward it's arguments with a `SendSignal()` call. Now every component that want's to can also know about this happening. -### In the code +See [this thread](https://tgstation13.org/phpBB/viewtopic.php?f=5&t=22674) for an introduction to the system as a whole. -#### Slippery things - -At the time of this writing, every object that is slippery overrides atom/Crossed does some checks, then slips the mob. Instead of all those Crossed overrides they could add a slippery component to all these objects. And have the checks in one proc that is run by the Crossed event - -#### Powercells - -A lot of objects have powercells. The `get_cell()` proc was added to give generic access to the cell var if it had one. This is just a specific use case of `GetComponent()` - -#### Radios - -The radio object as it is should not exist, given that more things use the _concept_ of radios rather than the object itself. The actual function of the radio can exist in a component which all the things that use it (Request consoles, actual radios, the SM shard) can add to themselves. - -#### Standos - -Stands have a lot of procs which mimic mob procs. Rather than inserting hooks for all these procs in overrides, the same can be accomplished with signals - -## API - -### Defines - -1. `COMPONENT_INCOMPATIBLE` Return this from `/datum/component/Initialize` or `datum/component/OnTransfer` to have the component be deleted if it's applied to an incorrect type. `parent` must not be modified if this is to be returned. This will be noted in the runtime logs - -### Vars - -1. `/datum/var/list/datum_components` (private) - * Lazy associated list of type -> component/list of components. -1. `/datum/var/list/comp_lookup` (private) - * Lazy associated list of signal -> registree/list of registrees -1. `/datum/var/list/signal_procs` (private) - * Associated lazy list of signals -> `/datum/callback`s that will be run when the parent datum receives that signal -1. `/datum/var/signal_enabled` (protected, boolean) - * If the datum is signal enabled. If not, it will not react to signals - * `FALSE` by default, set to `TRUE` when a signal is registered -1. `/datum/component/var/dupe_mode` (protected, enum) - * How duplicate component types are handled when added to the datum. - * `COMPONENT_DUPE_HIGHLANDER` (default): Old component will be deleted, new component will first have `/datum/component/proc/InheritComponent(datum/component/old, FALSE)` on it - * `COMPONENT_DUPE_ALLOWED`: The components will be treated as separate, `GetComponent()` will return the first added - * `COMPONENT_DUPE_UNIQUE`: New component will be deleted, old component will first have `/datum/component/proc/InheritComponent(datum/component/new, TRUE)` on it - * `COMPONENT_DUPE_UNIQUE_PASSARGS`: New component will never exist and instead its initialization arguments will be passed on to the old component. -1. `/datum/component/var/dupe_type` (protected, type) - * Definition of a duplicate component type - * `null` means exact match on `type` (default) - * Any other type means that and all subtypes -1. `/datum/component/var/datum/parent` (protected, read-only) - * The datum this component belongs to - * Never `null` in child procs -1. `report_signal_origin` (protected, boolean) - * If `TRUE`, will invoke the callback when signalled with the signal type as the first argument. - * `FALSE` by default. - -### Procs - -1. `/datum/proc/GetComponent(component_type(type)) -> datum/component?` (public, final) - * Returns a reference to a component of component_type if it exists in the datum, null otherwise -1. `/datum/proc/GetComponents(component_type(type)) -> list` (public, final) - * Returns a list of references to all components of component_type that exist in the datum -1. `/datum/proc/GetExactComponent(component_type(type)) -> datum/component?` (public, final) - * Returns a reference to a component whose type MATCHES component_type if that component exists in the datum, null otherwise -1. `GET_COMPONENT(varname, component_type)` OR `GET_COMPONENT_FROM(varname, component_type, src)` - * Shorthand for `var/component_type/varname = src.GetComponent(component_type)` -1. `SEND_SIGNAL(target, sigtype, ...)` (public, final) - * Use to send signals to target datum - * Extra arguments are to be specified in the signal definition - * Returns a bitflag with signal specific information assembled from all activated components - * Arguments are packaged in a list and handed off to _SendSignal() -1. `/datum/proc/AddComponent(component_type(type), ...) -> datum/component` (public, final) - * Creates an instance of `component_type` in the datum and passes `...` to its `Initialize()` call - * Sends the `COMSIG_COMPONENT_ADDED` signal to the datum - * All components a datum owns are deleted with the datum - * Returns the component that was created. Or the old component in a dupe situation where `COMPONENT_DUPE_UNIQUE` was set - * If this tries to add an component to an incompatible type, the component will be deleted and the result will be `null`. This is very unperformant, try not to do it - * Properly handles duplicate situations based on the `dupe_mode` var -1. `/datum/proc/LoadComponent(component_type(type), ...) -> datum/component` (public, final) - * Equivalent to calling `GetComponent(component_type)` where, if the result would be `null`, returns `AddComponent(component_type, ...)` instead -1. `/datum/proc/ComponentActivated(datum/component/C)` (abstract, async) - * Called on a component's `parent` after a signal received causes it to activate. `src` is the parameter - * Will only be called if a component's callback returns `TRUE` -1. `/datum/proc/TakeComponent(datum/component/C)` (public, final) - * Properly transfers ownership of a component from one datum to another - * Signals `COMSIG_COMPONENT_REMOVING` on the parent - * Called on the datum you want to own the component with another datum's component -1. `/datum/proc/_SendSignal(signal, list/arguments)` (private, final) - * Handles most of the actual signaling procedure - * Will runtime if used on datums with an empty component list -1. `/datum/proc/RegisterSignal(datum/target, signal(string/list of strings), proc_ref(type), override(boolean))` (protected, final) - * If signal is a list it will be as if RegisterSignal was called for each of the entries with the same following arguments - * Makes the datum listen for the specified `signal` on it's `parent` datum. - * When that signal is received `proc_ref` will be called on the component, along with associated arguments - * Example proc ref: `.proc/OnEvent` - * If a previous registration is overwritten by the call, a runtime occurs. Setting `override` to TRUE prevents this - * These callbacks run asyncronously - * Returning `TRUE` from these callbacks will trigger a `TRUE` return from the `SendSignal()` that initiated it -1. `/datum/component/New(datum/parent, ...)` (private, final) - * Runs internal setup for the component - * Extra arguments are passed to `Initialize()` -1. `/datum/component/Initialize(...)` (abstract, no-sleep) - * Called by `New()` with the same argments excluding `parent` - * Component does not exist in `parent`'s `datum_components` list yet, although `parent` is set and may be used - * Signals will not be received while this function is running - * Component may be deleted after this function completes without being attached - * Do not call `qdel(src)` from this function -1. `/datum/component/Destroy(force(bool), silent(bool))` (virtual, no-sleep) - * Sends the `COMSIG_COMPONENT_REMOVING` signal to the parent datum if the `parent` isn't being qdeleted - * Properly removes the component from `parent` and cleans up references - * Setting `force` makes it not check for and remove the component from the parent - * Setting `silent` deletes the component without sending a `COMSIG_COMPONENT_REMOVING` signal -1. `/datum/component/proc/InheritComponent(datum/component/C, i_am_original(boolean))` (abstract, no-sleep) - * Called on a component when a component of the same type was added to the same parent - * See `/datum/component/var/dupe_mode` - * `C`'s type will always be the same of the called component -1. `/datum/component/proc/AfterComponentActivated()` (abstract, async) - * Called on a component that was activated after it's `parent`'s `ComponentActivated()` is called -1. `/datum/component/proc/OnTransfer(datum/new_parent)` (abstract, no-sleep) - * Called before `new_parent` is assigned to `parent` in `TakeComponent()` - * Allows the component to react to ownership transfers -1. `/datum/component/proc/_RemoveFromParent()` (private, final) - * Clears `parent` and removes the component from it's component list -1. `/datum/component/proc/_JoinParent` (private, final) - * Tries to add the component to it's `parent`s `datum_components` list -1. `/datum/component/proc/RegisterWithParent` (abstract, no-sleep) - * Used to register the signals that should be on the `parent` object - * Use this if you plan on the component transfering between parents -1. `/datum/component/proc/UnregisterFromParent` (abstract, no-sleep) - * Counterpart to `RegisterWithParent()` - * Used to unregister the signals that should only be on the `parent` object - -### See/Define signals and their arguments in __DEFINES\components.dm +### See/Define signals and their arguments in [__DEFINES\dcs\signals.dm](../../__DEFINES/dcs/signals.dm) diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index e733ca78d2b..f895b8d81b1 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -1,21 +1,87 @@ +/** + * # Component + * + * The component datum + * + * A component should be a single standalone unit + * of functionality, that works by receiving signals from it's parent + * object to provide some single functionality (i.e a slippery component) + * that makes the object it's attached to cause people to slip over. + * Useful when you want shared behaviour independent of type inheritance + */ /datum/component + /** + * Defines how duplicate existing components are handled when added to a datum + * + * See [COMPONENT_DUPE_*][COMPONENT_DUPE_ALLOWED] definitions for available options + */ var/dupe_mode = COMPONENT_DUPE_HIGHLANDER + + /** + * The type to check for duplication + * + * `null` means exact match on `type` (default) + * + * Any other type means that and all subtypes + */ var/dupe_type + + /// The datum this components belongs to var/datum/parent - //only set to true if you are able to properly transfer this component - //At a minimum RegisterWithParent and UnregisterFromParent should be used - //Make sure you also implement PostTransfer for any post transfer handling + + /** + * Only set to true if you are able to properly transfer this component + * + * At a minimum [RegisterWithParent][/datum/component/proc/RegisterWithParent] and [UnregisterFromParent][/datum/component/proc/UnregisterFromParent] should be used + * + * Make sure you also implement [PostTransfer][/datum/component/proc/PostTransfer] for any post transfer handling + */ var/can_transfer = FALSE -/datum/component/New(datum/P, ...) - parent = P - var/list/arguments = args.Copy(2) +/** + * Create a new component. + * + * Additional arguments are passed to [Initialize()][/datum/component/proc/Initialize] + * + * Arguments: + * * datum/P the parent datum this component reacts to signals from + */ +/datum/component/New(list/raw_args) + parent = raw_args[1] + var/list/arguments = raw_args.Copy(2) if(Initialize(arglist(arguments)) == COMPONENT_INCOMPATIBLE) + stack_trace("Incompatible [type] assigned to a [parent.type]! args: [json_encode(arguments)]") qdel(src, TRUE, TRUE) - CRASH("Incompatible [type] assigned to a [P.type]! args: [json_encode(arguments)]") + return - _JoinParent(P) + _JoinParent(parent) +/** + * Called during component creation with the same arguments as in new excluding parent. + * + * Do not call `qdel(src)` from this function, `return COMPONENT_INCOMPATIBLE` instead + */ +/datum/component/proc/Initialize(...) + return + +/** + * Properly removes the component from `parent` and cleans up references + * + * Arguments: + * * force - makes it not check for and remove the component from the parent + * * silent - deletes the component without sending a [COMSIG_COMPONENT_REMOVING] signal + */ +/datum/component/Destroy(force=FALSE, silent=FALSE) + if(!force && parent) + _RemoveFromParent() + if(!silent) + SEND_SIGNAL(parent, COMSIG_COMPONENT_REMOVING, src) + parent = null + return ..() + +/** + * Internal proc to handle behaviour of components when joining a parent + */ /datum/component/proc/_JoinParent() var/datum/P = parent //lazy init the parent's dc list @@ -51,21 +117,9 @@ RegisterWithParent() -// If you want/expect to be moving the component around between parents, use this to register on the parent for signals -/datum/component/proc/RegisterWithParent() - return - -/datum/component/proc/Initialize(...) - return - -/datum/component/Destroy(force=FALSE, silent=FALSE) - if(!force && parent) - _RemoveFromParent() - if(!silent) - SEND_SIGNAL(parent, COMSIG_COMPONENT_REMOVING, src) - parent = null - return ..() - +/** + * Internal proc to handle behaviour when being removed from a parent + */ /datum/component/proc/_RemoveFromParent() var/datum/P = parent var/list/dc = P.datum_components @@ -84,10 +138,41 @@ UnregisterFromParent() +/** + * Register the component with the parent object + * + * Use this proc to register with your parent object + * + * Overridable proc that's called when added to a new parent + */ +/datum/component/proc/RegisterWithParent() + return + +/** + * Unregister from our parent object + * + * Use this proc to unregister from your parent object + * + * Overridable proc that's called when removed from a parent + * * + */ /datum/component/proc/UnregisterFromParent() return -/datum/proc/RegisterSignal(datum/target, sig_type_or_types, proc_or_callback, override = FALSE) +/** + * Register to listen for a signal from the passed in target + * + * This sets up a listening relationship such that when the target object emits a signal + * the source datum this proc is called upon, will recieve a callback to the given proctype + * Return values from procs registered must be a bitfield + * + * Arguments: + * * datum/target The target to listen for signals from + * * sig_type_or_types Either a string signal name, or a list of signal names (strings) + * * proctype The proc to call back when the signal is emitted + * * override If a previous registration exists you must explicitly set this + */ +/datum/proc/RegisterSignal(datum/target, sig_type_or_types, proctype, override = FALSE) if(QDELETED(src) || QDELETED(target)) return @@ -100,15 +185,12 @@ if(!lookup) target.comp_lookup = lookup = list() - if(!istype(proc_or_callback, /datum/callback)) //if it wasnt a callback before, it is now - proc_or_callback = CALLBACK(src, proc_or_callback) - var/list/sig_types = islist(sig_type_or_types) ? sig_type_or_types : list(sig_type_or_types) for(var/sig_type in sig_types) if(!override && procs[target][sig_type]) stack_trace("[sig_type] overridden. Use override = TRUE to suppress this warning") - procs[target][sig_type] = proc_or_callback + procs[target][sig_type] = proctype if(!lookup[sig_type]) // Nothing has registered here yet lookup[sig_type] = src @@ -122,6 +204,17 @@ signal_enabled = TRUE +/** + * Stop listening to a given signal from target + * + * Breaks the relationship between target and source datum, removing the callback when the signal fires + * + * Doesn't care if a registration exists or not + * + * Arguments: + * * datum/target Datum to stop listening to signals from + * * sig_typeor_types Signal string key or list of signal keys to stop listening to specifically + */ /datum/proc/UnregisterSignal(datum/target, sig_type_or_types) var/list/lookup = target.comp_lookup if(!signal_procs || !signal_procs[target] || !lookup) @@ -129,6 +222,8 @@ if(!islist(sig_type_or_types)) sig_type_or_types = list(sig_type_or_types) for(var/sig in sig_type_or_types) + if(!signal_procs[target][sig]) + continue switch(length(lookup[sig])) if(2) lookup[sig] = (lookup[sig]-src)[1] @@ -151,41 +246,96 @@ if(!signal_procs[target].len) signal_procs -= target +/** + * Called on a component when a component of the same type was added to the same parent + * + * See [/datum/component/var/dupe_mode] + * + * `C`'s type will always be the same of the called component + */ /datum/component/proc/InheritComponent(datum/component/C, i_am_original) return + +/** + * Called on a component when a component of the same type was added to the same parent with [COMPONENT_DUPE_SELECTIVE] + * + * See [/datum/component/var/dupe_mode] + * + * `C`'s type will always be the same of the called component + * + * return TRUE if you are absorbing the component, otherwise FALSE if you are fine having it exist as a duplicate component + */ +/datum/component/proc/CheckDupeComponent(datum/component/C, ...) + return + + +/** + * Callback Just before this component is transferred + * + * Use this to do any special cleanup you might need to do before being deregged from an object + */ /datum/component/proc/PreTransfer() return +/** + * Callback Just after a component is transferred + * + * Use this to do any special setup you need to do after being moved to a new object + * + * Do not call `qdel(src)` from this function, `return COMPONENT_INCOMPATIBLE` instead + */ /datum/component/proc/PostTransfer() return COMPONENT_INCOMPATIBLE //Do not support transfer by default as you must properly support it +/** + * Internal proc to create a list of our type and all parent types + */ /datum/component/proc/_GetInverseTypeList(our_type = type) //we can do this one simple trick var/current_type = parent_type . = list(our_type, current_type) //and since most components are root level + 1, this won't even have to run - while(current_type != /datum/component) + while (current_type != /datum/component) current_type = type2parent(current_type) . += current_type +/** + * Internal proc to handle most all of the signaling procedure + * + * Will runtime if used on datums with an empty component list + * + * Use the [SEND_SIGNAL] define instead + */ /datum/proc/_SendSignal(sigtype, list/arguments) var/target = comp_lookup[sigtype] if(!length(target)) var/datum/C = target if(!C.signal_enabled) return NONE - var/datum/callback/CB = C.signal_procs[src][sigtype] - return CB.InvokeAsync(arglist(arguments)) + var/proctype = C.signal_procs[src][sigtype] + return NONE | CallAsync(C, proctype, arguments) . = NONE for(var/I in target) var/datum/C = I if(!C.signal_enabled) continue - var/datum/callback/CB = C.signal_procs[src][sigtype] - . |= CB.InvokeAsync(arglist(arguments)) + var/proctype = C.signal_procs[src][sigtype] + . |= CallAsync(C, proctype, arguments) -/datum/proc/GetComponent(c_type) +// The type arg is casted so initial works, you shouldn't be passing a real instance into this +/** + * Return any component assigned to this datum of the given type + * + * This will throw an error if it's possible to have more than one component of that type on the parent + * + * Arguments: + * * datum/component/c_type The typepath of the component you want to get a reference to + */ +/datum/proc/GetComponent(datum/component/c_type) + RETURN_TYPE(c_type) + if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED || initial(c_type.dupe_mode) == COMPONENT_DUPE_SELECTIVE) + stack_trace("GetComponent was called to get a component of which multiple copies could be on an object. This can easily break and should be changed. Type: \[[c_type]\]") var/list/dc = datum_components if(!dc) return null @@ -193,7 +343,19 @@ if(length(.)) return .[1] -/datum/proc/GetExactComponent(c_type) +// The type arg is casted so initial works, you shouldn't be passing a real instance into this +/** + * Return any component assigned to this datum of the exact given type + * + * This will throw an error if it's possible to have more than one component of that type on the parent + * + * Arguments: + * * datum/component/c_type The typepath of the component you want to get a reference to + */ +/datum/proc/GetExactComponent(datum/component/c_type) + RETURN_TYPE(c_type) + if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED || initial(c_type.dupe_mode) == COMPONENT_DUPE_SELECTIVE) + stack_trace("GetComponent was called to get a component of which multiple copies could be on an object. This can easily break and should be changed. Type: \[[c_type]\]") var/list/dc = datum_components if(!dc) return null @@ -205,6 +367,12 @@ return C return null +/** + * Get all components of a given type that are attached to this datum + * + * Arguments: + * * c_type The component type path + */ /datum/proc/GetComponents(c_type) var/list/dc = datum_components if(!dc) @@ -213,7 +381,19 @@ if(!length(.)) return list(.) -/datum/proc/AddComponent(new_type, ...) +/** + * Creates an instance of `new_type` in the datum and attaches to it as parent + * + * Sends the [COMSIG_COMPONENT_ADDED] signal to the datum + * + * Returns the component that was created. Or the old component in a dupe situation where [COMPONENT_DUPE_UNIQUE] was set + * + * If this tries to add a component to an incompatible type, the component will be deleted and the result will be `null`. This is very unperformant, try not to do it + * + * Properly handles duplicate situations based on the `dupe_mode` var + */ +/datum/proc/_AddComponent(list/raw_args) + var/new_type = raw_args[1] var/datum/component/nt = new_type var/dm = initial(nt.dupe_mode) var/dt = initial(nt.dupe_type) @@ -228,7 +408,7 @@ new_comp = nt nt = new_comp.type - args[1] = src + raw_args[1] = src if(dm != COMPONENT_DUPE_ALLOWED) if(!dt) @@ -239,37 +419,62 @@ switch(dm) if(COMPONENT_DUPE_UNIQUE) if(!new_comp) - new_comp = new nt(arglist(args)) + new_comp = new nt(raw_args) if(!QDELETED(new_comp)) old_comp.InheritComponent(new_comp, TRUE) QDEL_NULL(new_comp) if(COMPONENT_DUPE_HIGHLANDER) if(!new_comp) - new_comp = new nt(arglist(args)) + new_comp = new nt(raw_args) if(!QDELETED(new_comp)) new_comp.InheritComponent(old_comp, FALSE) QDEL_NULL(old_comp) if(COMPONENT_DUPE_UNIQUE_PASSARGS) if(!new_comp) - var/list/arguments = args.Copy(2) - old_comp.InheritComponent(null, TRUE, arguments) + var/list/arguments = raw_args.Copy(2) + arguments.Insert(1, null, TRUE) + old_comp.InheritComponent(arglist(arguments)) else old_comp.InheritComponent(new_comp, TRUE) + if(COMPONENT_DUPE_SELECTIVE) + var/list/arguments = raw_args.Copy() + arguments[1] = new_comp + var/make_new_component = TRUE + for(var/i in GetComponents(new_type)) + var/datum/component/C = i + if(C.CheckDupeComponent(arglist(arguments))) + make_new_component = FALSE + QDEL_NULL(new_comp) + break + if(!new_comp && make_new_component) + new_comp = new nt(raw_args) else if(!new_comp) - new_comp = new nt(arglist(args)) // There's a valid dupe mode but there's no old component, act like normal + new_comp = new nt(raw_args) // There's a valid dupe mode but there's no old component, act like normal else if(!new_comp) - new_comp = new nt(arglist(args)) // Dupes are allowed, act like normal + new_comp = new nt(raw_args) // Dupes are allowed, act like normal if(!old_comp && !QDELETED(new_comp)) // Nothing related to duplicate components happened and the new component is healthy SEND_SIGNAL(src, COMSIG_COMPONENT_ADDED, new_comp) return new_comp return old_comp +/** + * Get existing component of type, or create it and return a reference to it + * + * Use this if the item needs to exist at the time of this call, but may not have been created before now + * + * Arguments: + * * component_type The typepath of the component to create or return + * * ... additional arguments to be passed when creating the component if it does not exist + */ /datum/proc/LoadComponent(component_type, ...) . = GetComponent(component_type) if(!.) - return AddComponent(arglist(args)) + return _AddComponent(args) +/** + * Removes the component from parent, ends up with a null parent + */ /datum/component/proc/RemoveComponent() if(!parent) return @@ -279,6 +484,14 @@ parent = null SEND_SIGNAL(old_parent, COMSIG_COMPONENT_REMOVING, src) +/** + * Transfer this component to another parent + * + * Component is taken from source datum + * + * Arguments: + * * datum/component/target Target datum to transfer to + */ /datum/proc/TakeComponent(datum/component/target) if(!target || target.parent == src) return @@ -295,6 +508,14 @@ if(target == AddComponent(target)) target._JoinParent() +/** + * Transfer all components to target + * + * All components from source datum are taken + * + * Arguments: + * * /datum/target the target to move the components to + */ /datum/proc/TransferComponents(datum/target) var/list/dc = datum_components if(!dc) @@ -309,5 +530,8 @@ if(C.can_transfer) target.TakeComponent(comps) +/** + * Return the object that is the host of any UI's that this component has + */ /datum/component/nano_host() return parent diff --git a/code/datums/components/decal.dm b/code/datums/components/decal.dm index 6a0f686b13a..876cf0c0507 100644 --- a/code/datums/components/decal.dm +++ b/code/datums/components/decal.dm @@ -7,7 +7,7 @@ var/first_dir // This only stores the dir arg from init -/datum/component/decal/Initialize(_icon, _icon_state, _dir, _cleanable=CLEAN_GOD, _color, _layer=TURF_LAYER, _description, _alpha=255) +/datum/component/decal/Initialize(_icon, _icon_state, _dir, _cleanable = CLEAN_GOD, _color, _layer = TURF_LAYER, _description, _alpha = 255) if(!isatom(parent) || !generate_appearance(_icon, _icon_state, _dir, _layer, _color, _alpha)) return COMPONENT_INCOMPATIBLE first_dir = _dir diff --git a/code/datums/components/edit_complainer.dm b/code/datums/components/edit_complainer.dm new file mode 100644 index 00000000000..7910515cb45 --- /dev/null +++ b/code/datums/components/edit_complainer.dm @@ -0,0 +1,23 @@ +// This is just a bit of fun while making an example for global signal +/datum/component/edit_complainer + var/list/say_lines + +/datum/component/edit_complainer/Initialize(list/text) + if(!ismovable(parent)) + return COMPONENT_INCOMPATIBLE + + var/static/list/default_lines = list( + "CentComm's profligacy frays another thread.", + "Another tug at the weave.", + "Who knows when the stresses will finally shatter the form?", + "Even now a light shines through the cracks.", + "CentComm once more twists knowledge beyond its authority.", + "There is an uncertain air in the mansus.", + ) + say_lines = text || default_lines + + RegisterSignal(SSdcs, COMSIG_GLOB_VAR_EDIT, .proc/var_edit_react) + +/datum/component/edit_complainer/proc/var_edit_react(datum/source, list/arguments) + var/atom/movable/master = parent + master.atom_say(pick(say_lines)) diff --git a/code/datums/components/jestosterone.dm b/code/datums/components/jestosterone.dm deleted file mode 100644 index f37f1f03efb..00000000000 --- a/code/datums/components/jestosterone.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/component/jestosterone - var/mind_type //Is the affected mob a clown / mime? - -/datum/component/jestosterone/Initialize(mind_type_arg) - mind_type = mind_type_arg diff --git a/code/datums/components/label.dm b/code/datums/components/label.dm index 26cb99c7e3c..c6d0c595ebb 100644 --- a/code/datums/components/label.dm +++ b/code/datums/components/label.dm @@ -32,12 +32,12 @@ This proc will fire after the parent is hit by a hand labeler which is trying to apply another label. Since the parent already has a label, it will remove the old one from the parent's name, and apply the new one. */ -/datum/component/label/InheritComponent(datum/component/label/new_comp , i_am_original, list/arguments) +/datum/component/label/InheritComponent(datum/component/label/new_comp , i_am_original, _label_name) remove_label() if(new_comp) label_name = new_comp.label_name else - label_name = arguments[1] + label_name = _label_name apply_label() /** diff --git a/code/datums/components/slippery.dm b/code/datums/components/slippery.dm new file mode 100644 index 00000000000..88e51209afb --- /dev/null +++ b/code/datums/components/slippery.dm @@ -0,0 +1,56 @@ +/** + * # Slip Component + * + * This is a component that can be applied to any movable atom (mob or obj). + * + * While the atom has this component, any human mob that walks over it will have a chance to slip. + * Duration, tiles moved, and so on, depend on what variables are passed in when the component is added. + * + */ +/datum/component/slippery + /// Text that gets displayed in the slip proc, i.e. "user slips on [description]" + var/description + /// The amount of stun to apply after slip. + var/stun + /// The amount of weaken to apply after slip. + var/weaken + /// The chance that walking over the parent will slip you. + var/slip_chance + /// The amount of tiles someone will be moved after slip. + var/slip_tiles + /// TRUE If this slip can be avoided by walking. + var/walking_is_safe + /// FALSE if you want no slip shoes to make you immune to the slip + var/slip_always + /// The verb that players will see when someone slips on the parent. In the form of "You [slip_verb]ped on". + var/slip_verb + +/datum/component/slippery/Initialize(_description, _stun = 0, _weaken = 0, _slip_chance = 100, _slip_tiles = 0, _walking_is_safe = TRUE, _slip_always = FALSE, _slip_verb = "slip") + if(!isatom(parent)) + return COMPONENT_INCOMPATIBLE + + description = _description + stun = max(0, _stun) + weaken = max(0, _weaken) + slip_chance = max(0, _slip_chance) + slip_tiles = max(0, _slip_tiles) + walking_is_safe = _walking_is_safe + slip_always = _slip_always + slip_verb = _slip_verb + +/datum/component/slippery/RegisterWithParent() + RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED), .proc/Slip) + +/datum/component/slippery/UnregisterFromParent() + UnregisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED)) + +/** + Called whenever the parent recieves either the `MOVABLE_CROSSED` signal or the `ATOM_ENTERED` signal. + + Calls the `victim`'s `slip()` proc with the component's variables as arguments. + Additionally calls the parent's `after_slip()` proc on the `victim`. +*/ +/datum/component/slippery/proc/Slip(datum/source, mob/living/carbon/human/victim) + if(istype(victim) && prob(slip_chance) && victim.slip(description, stun, weaken, slip_tiles, walking_is_safe, slip_always, slip_verb)) + var/atom/movable/owner = parent + owner.after_slip(victim) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index 818e78e8d2e..4c55ad2ad82 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -16,7 +16,7 @@ if(!isatom(parent)) return COMPONENT_INCOMPATIBLE RegisterSignal(parent, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_BLOB_ACT, COMSIG_ATOM_HULK_ATTACK, COMSIG_PARENT_ATTACKBY), .proc/play_squeak) - if(ismovableatom(parent)) + if(ismovable(parent)) RegisterSignal(parent, list(COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_IMPACT), .proc/play_squeak) RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/play_squeak_crossed) RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react) diff --git a/code/datums/components/swarming.dm b/code/datums/components/swarming.dm new file mode 100644 index 00000000000..16ddc66280e --- /dev/null +++ b/code/datums/components/swarming.dm @@ -0,0 +1,55 @@ +/datum/component/swarming + var/offset_x = 0 + var/offset_y = 0 + var/is_swarming = FALSE + var/list/swarm_members = list() + +/datum/component/swarming/Initialize(max_x = 24, max_y = 24) + if(!ismovable(parent)) + return COMPONENT_INCOMPATIBLE + offset_x = rand(-max_x, max_x) + offset_y = rand(-max_y, max_y) + + RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/join_swarm) + RegisterSignal(parent, COMSIG_MOVABLE_UNCROSSED, .proc/leave_swarm) + +/datum/component/swarming/Destroy() + for(var/other in swarm_members) + var/datum/component/swarming/other_swarm = other + other_swarm.swarm_members -= src + if(!other_swarm.swarm_members.len) + other_swarm.unswarm() + swarm_members = null + return ..() + +/datum/component/swarming/proc/join_swarm(datum/source, atom/movable/AM) + var/datum/component/swarming/other_swarm = AM.GetComponent(/datum/component/swarming) + if(!other_swarm) + return + swarm() + swarm_members |= other_swarm + other_swarm.swarm() + other_swarm.swarm_members |= src + +/datum/component/swarming/proc/leave_swarm(datum/source, atom/movable/AM) + var/datum/component/swarming/other_swarm = AM.GetComponent(/datum/component/swarming) + if(!other_swarm || !(other_swarm in swarm_members)) + return + swarm_members -= other_swarm + if(!swarm_members.len) + unswarm() + other_swarm.swarm_members -= src + if(!other_swarm.swarm_members.len) + other_swarm.unswarm() + +/datum/component/swarming/proc/swarm() + var/atom/movable/owner = parent + if(!is_swarming) + is_swarming = TRUE + animate(owner, pixel_x = owner.pixel_x + offset_x, pixel_y = owner.pixel_y + offset_y, time = 2) + +/datum/component/swarming/proc/unswarm() + var/atom/movable/owner = parent + if(is_swarming) + animate(owner, pixel_x = owner.pixel_x - offset_x, pixel_y = owner.pixel_y - offset_y, time = 2) + is_swarming = FALSE diff --git a/code/datums/components/waddling.dm b/code/datums/components/waddling.dm deleted file mode 100644 index a1f538e4dd7..00000000000 --- a/code/datums/components/waddling.dm +++ /dev/null @@ -1,15 +0,0 @@ -/datum/component/waddling - dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS - -/datum/component/waddling/Initialize() - if(!isliving(parent)) - return COMPONENT_INCOMPATIBLE - RegisterSignal(parent, list(COMSIG_MOVABLE_MOVED), .proc/Waddle) - -/datum/component/waddling/proc/Waddle() - var/mob/living/L = parent - if(L.incapacitated() || L.lying) - return - animate(L, pixel_z = 4, time = 0) - animate(pixel_z = 0, transform = turn(matrix(), pick(-12, 0, 12)), time=2) - animate(pixel_z = 0, transform = matrix(), time = 0) diff --git a/code/datums/diseases/_MobProcs.dm b/code/datums/diseases/_MobProcs.dm index 63fa3af0605..81312cdfcc4 100644 --- a/code/datums/diseases/_MobProcs.dm +++ b/code/datums/diseases/_MobProcs.dm @@ -126,11 +126,19 @@ AddDisease(D) +/** + * Forces the mob to contract a virus. If the mob can have viruses. Ignores clothing and other protection + * Returns TRUE if it succeeds. False if it doesn't + * + * Arguments: + * * D - the disease the mob will try to contract + */ //Same as ContractDisease, except never overidden clothes checks /mob/proc/ForceContractDisease(datum/disease/D) if(!CanContractDisease(D)) - return 0 + return FALSE AddDisease(D) + return TRUE /mob/living/carbon/human/CanContractDisease(datum/disease/D) diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index 5464bd9f012..34c41c581f2 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -171,7 +171,6 @@ GLOBAL_LIST_INIT(advance_cures, list( if(!symptoms || !symptoms.len) CRASH("We did not have any symptoms before generating properties.") - return var/list/properties = list("resistance" = 1, "stealth" = 0, "stage_rate" = 1, "transmittable" = 1, "severity" = 0) @@ -196,9 +195,9 @@ GLOBAL_LIST_INIT(advance_cures, list( visibility_flags = HIDDEN_SCANNER|HIDDEN_PANDEMIC // The more symptoms we have, the less transmittable it is but some symptoms can make up for it. - SetSpread(Clamp(2 ** (properties["transmittable"] - symptoms.len), BLOOD, AIRBORNE)) - permeability_mod = max(Ceiling(0.4 * properties["transmittable"]), 1) - cure_chance = 15 - Clamp(properties["resistance"], -5, 5) // can be between 10 and 20 + SetSpread(clamp(2 ** (properties["transmittable"] - symptoms.len), BLOOD, AIRBORNE)) + permeability_mod = max(CEILING(0.4 * properties["transmittable"], 1), 1) + cure_chance = 15 - clamp(properties["resistance"], -5, 5) // can be between 10 and 20 stage_prob = max(properties["stage_rate"], 2) SetSeverity(properties["severity"]) GenerateCure(properties) @@ -245,7 +244,7 @@ GLOBAL_LIST_INIT(advance_cures, list( // Will generate a random cure, the less resistance the symptoms have, the harder the cure. /datum/disease/advance/proc/GenerateCure(list/properties = list()) if(properties && properties.len) - var/res = Clamp(properties["resistance"] - (symptoms.len / 2), 1, GLOB.advance_cures.len) + var/res = clamp(properties["resistance"] - (symptoms.len / 2), 1, GLOB.advance_cures.len) // to_chat(world, "Res = [res]") cures = list(GLOB.advance_cures[res]) @@ -396,7 +395,7 @@ GLOBAL_LIST_INIT(advance_cures, list( for(var/datum/disease/advance/AD in GLOB.active_diseases) AD.Refresh() - for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list)) + for(var/mob/living/carbon/human/H in shuffle(GLOB.alive_mob_list)) if(!is_station_level(H.z)) continue if(!H.HasDisease(D)) diff --git a/code/datums/diseases/advance/symptoms/deafness.dm b/code/datums/diseases/advance/symptoms/deafness.dm index 1a9bba6961e..a3111478b26 100644 --- a/code/datums/diseases/advance/symptoms/deafness.dm +++ b/code/datums/diseases/advance/symptoms/deafness.dm @@ -33,7 +33,7 @@ Bonus if(3, 4) to_chat(M, "[pick("You hear a ringing in your ear.", "Your ears pop.")]") if(5) - if(!(M.disabilities & DEAF)) + if(!(DEAF in M.mutations)) to_chat(M, "Your ears pop and begin ringing loudly!") M.BecomeDeaf() spawn(200) diff --git a/code/datums/diseases/advance/symptoms/skin.dm b/code/datums/diseases/advance/symptoms/skin.dm index aa5a3494584..a3346dce800 100644 --- a/code/datums/diseases/advance/symptoms/skin.dm +++ b/code/datums/diseases/advance/symptoms/skin.dm @@ -35,7 +35,7 @@ BONUS switch(A.stage) if(5) H.s_tone = -85 - H.update_body(0) + H.update_body() else H.visible_message("[H] looks a bit pale...", "Your skin suddenly appears lighter...") @@ -79,7 +79,7 @@ BONUS switch(A.stage) if(5) H.s_tone = 85 - H.update_body(0) + H.update_body() else H.visible_message("[H] looks a bit dark...", "Your skin suddenly appears darker...") diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm new file mode 100644 index 00000000000..46a295f90be --- /dev/null +++ b/code/datums/elements/_element.dm @@ -0,0 +1,55 @@ +/** + * A holder for simple behaviour that can be attached to many different types + * + * Only one element of each type is instanced during game init. + * Otherwise acts basically like a lightweight component. + */ +/datum/element + /// Option flags for element behaviour + var/element_flags = NONE + /** + * The index of the first attach argument to consider for duplicate elements + * + * Is only used when flags contains [ELEMENT_BESPOKE] + * + * This is infinity so you must explicitly set this + */ + var/id_arg_index = INFINITY + +/// Activates the functionality defined by the element on the given target datum +/datum/element/proc/Attach(datum/target) + SHOULD_CALL_PARENT(1) + if(type == /datum/element) + return ELEMENT_INCOMPATIBLE + SEND_SIGNAL(target, COMSIG_ELEMENT_ATTACH, src) + if(element_flags & ELEMENT_DETACH) + RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/Detach, override = TRUE) + +/// Deactivates the functionality defines by the element on the given datum +/datum/element/proc/Detach(datum/source, force) + SEND_SIGNAL(source, COMSIG_ELEMENT_DETACH, src) + SHOULD_CALL_PARENT(1) + UnregisterSignal(source, COMSIG_PARENT_QDELETING) + +/datum/element/Destroy(force) + if(!force) + return QDEL_HINT_LETMELIVE + SSdcs.elements_by_type -= type + return ..() + +//DATUM PROCS + +/// Finds the singleton for the element type given and attaches it to src +/datum/proc/_AddElement(list/arguments) + var/datum/element/ele = SSdcs.GetElement(arguments) + arguments[1] = src + if(ele.Attach(arglist(arguments)) == ELEMENT_INCOMPATIBLE) + CRASH("Incompatible [arguments[1]] assigned to a [type]! args: [json_encode(args)]") + +/** + * Finds the singleton for the element type given and detaches it from src + * You only need additional arguments beyond the type if you're using [ELEMENT_BESPOKE] + */ +/datum/proc/_RemoveElement(list/arguments) + var/datum/element/ele = SSdcs.GetElement(arguments) + ele.Detach(src) diff --git a/code/datums/elements/waddling.dm b/code/datums/elements/waddling.dm new file mode 100644 index 00000000000..e8870653941 --- /dev/null +++ b/code/datums/elements/waddling.dm @@ -0,0 +1,25 @@ +/datum/element/waddling + +/datum/element/waddling/Attach(datum/target) + . = ..() + if(!ismovable(target)) + return ELEMENT_INCOMPATIBLE + if(isliving(target)) + RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/LivingWaddle) + else + RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/Waddle) + +/datum/element/waddling/Detach(datum/source, force) + . = ..() + UnregisterSignal(source, COMSIG_MOVABLE_MOVED) + +/datum/element/waddling/proc/LivingWaddle(mob/living/target) + if(target.incapacitated() || target.lying) + return + Waddle(target) + +/datum/element/waddling/proc/Waddle(atom/movable/target) + animate(target, pixel_z = 4, time = 0) + var/prev_trans = matrix(target.transform) + animate(pixel_z = 0, transform = turn(target.transform, pick(-12, 0, 12)), time = 2) + animate(pixel_z = 0, transform = prev_trans, time = 0) diff --git a/code/datums/gas_mixture.dm b/code/datums/gas_mixture.dm index 63b70b512ee..91bebcdad39 100644 --- a/code/datums/gas_mixture.dm +++ b/code/datums/gas_mixture.dm @@ -7,33 +7,22 @@ What are the archived variables for? #define SPECIFIC_HEAT_TOXIN 200 #define SPECIFIC_HEAT_AIR 20 #define SPECIFIC_HEAT_CDO 30 -#define HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) \ - (carbon_dioxide*SPECIFIC_HEAT_CDO + (oxygen+nitrogen)*SPECIFIC_HEAT_AIR + toxins*SPECIFIC_HEAT_TOXIN) +#define SPECIFIC_HEAT_N2O 40 +#define SPECIFIC_HEAT_AGENT_B 300 + +#define HEAT_CAPACITY_CALCULATION(oxygen, carbon_dioxide, nitrogen, toxins, sleeping_agent, agent_b) \ + (carbon_dioxide * SPECIFIC_HEAT_CDO + (oxygen + nitrogen) * SPECIFIC_HEAT_AIR + toxins * SPECIFIC_HEAT_TOXIN + sleeping_agent * SPECIFIC_HEAT_N2O + agent_b * SPECIFIC_HEAT_AGENT_B) #define MINIMUM_HEAT_CAPACITY 0.0003 -#define QUANTIZE(variable) (round(variable,0.0001)) - -/datum/gas - var/moles = 0 - var/specific_heat = 0 - - var/moles_archived = 0 - -/datum/gas/sleeping_agent - specific_heat = 40 - -/datum/gas/oxygen_agent_b - specific_heat = 300 - -/datum/gas/volatile_fuel - specific_heat = 30 - +#define QUANTIZE(variable) (round(variable, 0.0001)) /datum/gas_mixture var/oxygen = 0 var/carbon_dioxide = 0 var/nitrogen = 0 var/toxins = 0 + var/sleeping_agent = 0 + var/agent_b = 0 var/volume = CELL_VOLUME @@ -41,13 +30,12 @@ What are the archived variables for? var/last_share - var/list/datum/gas/trace_gases = list() - - var/tmp/oxygen_archived var/tmp/carbon_dioxide_archived var/tmp/nitrogen_archived var/tmp/toxins_archived + var/tmp/sleeping_agent_archived + var/tmp/agent_b_archived var/tmp/temperature_archived @@ -55,35 +43,24 @@ What are the archived variables for? //PV=nRT - related procedures /datum/gas_mixture/proc/heat_capacity() - var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) - - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - heat_capacity += trace_gas.moles*trace_gas.specific_heat - return heat_capacity + return HEAT_CAPACITY_CALCULATION(oxygen, carbon_dioxide, nitrogen, toxins, sleeping_agent, agent_b) /datum/gas_mixture/proc/heat_capacity_archived() - var/heat_capacity_archived = HEAT_CAPACITY_CALCULATION(oxygen_archived,carbon_dioxide_archived,nitrogen_archived,toxins_archived) - - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat - return heat_capacity_archived + return HEAT_CAPACITY_CALCULATION(oxygen_archived, carbon_dioxide_archived, nitrogen_archived, toxins_archived, sleeping_agent_archived, agent_b_archived) /datum/gas_mixture/proc/total_moles() - var/moles = oxygen + carbon_dioxide + nitrogen + toxins - - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - moles += trace_gas.moles + var/moles = oxygen + carbon_dioxide + nitrogen + toxins + sleeping_agent + agent_b return moles +/datum/gas_mixture/proc/total_trace_moles() + var/moles = sleeping_agent + agent_b + return moles /datum/gas_mixture/proc/return_pressure() - if(volume>0) - return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume + if(volume > 0) + return total_moles() * R_IDEAL_GAS_EQUATION * temperature / volume return 0 @@ -96,7 +73,7 @@ What are the archived variables for? /datum/gas_mixture/proc/thermal_energy() - return temperature*heat_capacity() + return temperature * heat_capacity() //Procedures used for very specific events @@ -105,28 +82,23 @@ What are the archived variables for? /datum/gas_mixture/proc/react(atom/dump_location) var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network) - if(trace_gases.len > 0) - if(temperature > 900) - if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) - var/datum/gas/oxygen_agent_b/trace_gas = locate(/datum/gas/oxygen_agent_b/) in trace_gases - if(trace_gas) - var/reaction_rate = min(carbon_dioxide*0.75, toxins*0.25, trace_gas.moles*0.05) + if(agent_b && temperature > 900) + if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) + var/reaction_rate = min(carbon_dioxide * 0.75, toxins * 0.25, agent_b * 0.05) - carbon_dioxide -= reaction_rate - oxygen += reaction_rate + carbon_dioxide -= reaction_rate + oxygen += reaction_rate - trace_gas.moles -= reaction_rate*0.05 + agent_b -= reaction_rate * 0.05 - temperature += (reaction_rate*20000)/heat_capacity() + temperature += (reaction_rate * 20000) / heat_capacity() - reacting = 1 + reacting = 1 fuel_burnt = 0 if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) -// to_chat(world, "pre [temperature], [oxygen], [toxins]") if(fire() > 0) reacting = 1 -// to_chat(world, "post [temperature], [oxygen], [toxins]") return reacting @@ -134,24 +106,6 @@ What are the archived variables for? var/energy_released = 0 var/old_heat_capacity = heat_capacity() - var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel/) in trace_gases - if(fuel_store) //General volatile gas burn - var/burned_fuel = 0 - - if(oxygen < fuel_store.moles) - burned_fuel = oxygen - fuel_store.moles -= burned_fuel - oxygen = 0 - else - burned_fuel = fuel_store.moles - oxygen -= fuel_store.moles - trace_gases -= fuel_store - fuel_store = null - - energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel - carbon_dioxide += burned_fuel - fuel_burnt += burned_fuel - //Handle plasma burning if(toxins > MINIMUM_HEAT_CAPACITY) var/plasma_burn_rate = 0 @@ -161,13 +115,13 @@ What are the archived variables for? if(temperature > PLASMA_UPPER_TEMPERATURE) temperature_scale = 1 else - temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) + temperature_scale = (temperature - PLASMA_MINIMUM_BURN_TEMPERATURE) / (PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) if(temperature_scale > 0) oxygen_burn_rate = OXYGEN_BURN_RATE_BASE - temperature_scale - if(oxygen > toxins*PLASMA_OXYGEN_FULLBURN) - plasma_burn_rate = (toxins*temperature_scale)/PLASMA_BURN_RATE_DELTA + if(oxygen > toxins * PLASMA_OXYGEN_FULLBURN) + plasma_burn_rate = (toxins * temperature_scale) / PLASMA_BURN_RATE_DELTA else - plasma_burn_rate = (temperature_scale*(oxygen/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA + plasma_burn_rate = (temperature_scale * (oxygen / PLASMA_OXYGEN_FULLBURN)) / PLASMA_BURN_RATE_DELTA if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY) toxins -= plasma_burn_rate oxygen -= plasma_burn_rate*oxygen_burn_rate @@ -175,12 +129,12 @@ What are the archived variables for? energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate) - fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate) + fuel_burnt += (plasma_burn_rate) * (1 + oxygen_burn_rate) if(energy_released > 0) var/new_heat_capacity = heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity + temperature = (temperature * old_heat_capacity + energy_released) / new_heat_capacity return fuel_burnt @@ -231,10 +185,8 @@ What are the archived variables for? carbon_dioxide_archived = carbon_dioxide nitrogen_archived = nitrogen toxins_archived = toxins - - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - trace_gas.moles_archived = trace_gas.moles + sleeping_agent_archived = sleeping_agent + agent_b_archived = agent_b temperature_archived = temperature @@ -244,55 +196,45 @@ What are the archived variables for? if(!giver) return 0 - if(abs(temperature-giver.temperature)>MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + if(abs(temperature - giver.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/self_heat_capacity = heat_capacity() var/giver_heat_capacity = giver.heat_capacity() var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity if(combined_heat_capacity != 0) - temperature = (giver.temperature*giver_heat_capacity + temperature*self_heat_capacity)/combined_heat_capacity + temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity oxygen += giver.oxygen carbon_dioxide += giver.carbon_dioxide nitrogen += giver.nitrogen toxins += giver.toxins - - for(var/gas in giver.trace_gases) - var/datum/gas/trace_gas = gas - var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if(!corresponding) - corresponding = new trace_gas.type() - trace_gases += corresponding - corresponding.moles += trace_gas.moles + sleeping_agent += giver.sleeping_agent + agent_b += giver.agent_b return 1 /datum/gas_mixture/remove(amount) var/sum = total_moles() - amount = min(amount,sum) //Can not take more air than tile has! + amount = min(amount, sum) //Can not take more air than tile has! if(amount <= 0) return null var/datum/gas_mixture/removed = new - removed.oxygen = QUANTIZE((oxygen/sum)*amount) - removed.nitrogen = QUANTIZE((nitrogen/sum)*amount) - removed.carbon_dioxide = QUANTIZE((carbon_dioxide/sum)*amount) - removed.toxins = QUANTIZE((toxins/sum)*amount) + removed.oxygen = QUANTIZE((oxygen / sum) * amount) + removed.nitrogen = QUANTIZE((nitrogen/ sum) * amount) + removed.carbon_dioxide = QUANTIZE((carbon_dioxide / sum) * amount) + removed.toxins = QUANTIZE((toxins / sum) * amount) + removed.sleeping_agent = QUANTIZE((sleeping_agent / sum) * amount) + removed.agent_b = QUANTIZE((agent_b / sum) * amount) oxygen -= removed.oxygen nitrogen -= removed.nitrogen carbon_dioxide -= removed.carbon_dioxide toxins -= removed.toxins - - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - var/datum/gas/corresponding = new trace_gas.type() - removed.trace_gases += corresponding - - corresponding.moles = (trace_gas.moles/sum)*amount - trace_gas.moles -= corresponding.moles + sleeping_agent -= removed.sleeping_agent + agent_b -= removed.agent_b removed.temperature = temperature @@ -307,23 +249,19 @@ What are the archived variables for? var/datum/gas_mixture/removed = new - removed.oxygen = QUANTIZE(oxygen*ratio) - removed.nitrogen = QUANTIZE(nitrogen*ratio) - removed.carbon_dioxide = QUANTIZE(carbon_dioxide*ratio) - removed.toxins = QUANTIZE(toxins*ratio) + removed.oxygen = QUANTIZE(oxygen * ratio) + removed.nitrogen = QUANTIZE(nitrogen * ratio) + removed.carbon_dioxide = QUANTIZE(carbon_dioxide * ratio) + removed.toxins = QUANTIZE(toxins * ratio) + removed.sleeping_agent = QUANTIZE(sleeping_agent * ratio) + removed.agent_b = QUANTIZE(agent_b * ratio) oxygen -= removed.oxygen nitrogen -= removed.nitrogen carbon_dioxide -= removed.carbon_dioxide toxins -= removed.toxins - - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - var/datum/gas/corresponding = new trace_gas.type() - removed.trace_gases += corresponding - - corresponding.moles = trace_gas.moles*ratio - trace_gas.moles -= corresponding.moles + sleeping_agent -= removed.sleeping_agent + agent_b -= removed.agent_b removed.temperature = temperature @@ -334,14 +272,8 @@ What are the archived variables for? carbon_dioxide = sample.carbon_dioxide nitrogen = sample.nitrogen toxins = sample.toxins - - trace_gases.len=null - for(var/gas in sample.trace_gases) - var/datum/gas/trace_gas = gas - var/datum/gas/corresponding = new trace_gas.type() - trace_gases += corresponding - - corresponding.moles = trace_gas.moles + sleeping_agent = sample.sleeping_agent + agent_b = sample.agent_b temperature = sample.temperature @@ -352,6 +284,8 @@ What are the archived variables for? carbon_dioxide = model.carbon_dioxide nitrogen = model.nitrogen toxins = model.toxins + sleeping_agent = model.sleeping_agent + agent_b = model.agent_b //acounts for changes in temperature var/turf/model_parent = model.parent_type @@ -361,26 +295,25 @@ What are the archived variables for? return 1 /datum/gas_mixture/check_turf(turf/model, atmos_adjacent_turfs = 4) - var/delta_oxygen = (oxygen_archived - model.oxygen)/(atmos_adjacent_turfs+1) - var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide)/(atmos_adjacent_turfs+1) - var/delta_nitrogen = (nitrogen_archived - model.nitrogen)/(atmos_adjacent_turfs+1) - var/delta_toxins = (toxins_archived - model.toxins)/(atmos_adjacent_turfs+1) + var/delta_oxygen = (oxygen_archived - model.oxygen) / (atmos_adjacent_turfs + 1) + var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide) / (atmos_adjacent_turfs + 1) + var/delta_nitrogen = (nitrogen_archived - model.nitrogen) / (atmos_adjacent_turfs + 1) + var/delta_toxins = (toxins_archived - model.toxins) / (atmos_adjacent_turfs + 1) + var/delta_sleeping_agent = (sleeping_agent_archived - model.sleeping_agent) / (atmos_adjacent_turfs + 1) + var/delta_agent_b = (agent_b_archived - model.agent_b) / (atmos_adjacent_turfs + 1) var/delta_temperature = (temperature_archived - model.temperature) - if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) + if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_sleeping_agent) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_sleeping_agent) >= sleeping_agent_archived * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_agent_b) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_agent_b) >= agent_b_archived * MINIMUM_AIR_RATIO_TO_SUSPEND))) return 0 if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) return 0 - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) - return 0 - return 1 /datum/gas_mixture/proc/check_turf_total(turf/model) //I want this proc to die a painful death @@ -388,30 +321,32 @@ What are the archived variables for? var/delta_carbon_dioxide = (carbon_dioxide - model.carbon_dioxide) var/delta_nitrogen = (nitrogen - model.nitrogen) var/delta_toxins = (toxins - model.toxins) + var/delta_sleeping_agent = (sleeping_agent - model.sleeping_agent) + var/delta_agent_b = (agent_b - model.agent_b) var/delta_temperature = (temperature - model.temperature) - if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins*MINIMUM_AIR_RATIO_TO_SUSPEND))) + if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_sleeping_agent) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_sleeping_agent) >= sleeping_agent * MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_agent_b) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_agent_b) >= agent_b * MINIMUM_AIR_RATIO_TO_SUSPEND))) return 0 if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) return 0 - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - if(trace_gas.moles > MINIMUM_AIR_TO_SUSPEND*4) - return 0 - return 1 /datum/gas_mixture/share(datum/gas_mixture/sharer, atmos_adjacent_turfs = 4) - if(!sharer) return 0 - var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived)/(atmos_adjacent_turfs+1) - var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived)/(atmos_adjacent_turfs+1) - var/delta_nitrogen = QUANTIZE(nitrogen_archived - sharer.nitrogen_archived)/(atmos_adjacent_turfs+1) - var/delta_toxins = QUANTIZE(toxins_archived - sharer.toxins_archived)/(atmos_adjacent_turfs+1) + if(!sharer) + return 0 + var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived) / (atmos_adjacent_turfs + 1) + var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived) / (atmos_adjacent_turfs + 1) + var/delta_nitrogen = QUANTIZE(nitrogen_archived - sharer.nitrogen_archived) / (atmos_adjacent_turfs + 1) + var/delta_toxins = QUANTIZE(toxins_archived - sharer.toxins_archived) / (atmos_adjacent_turfs + 1) + var/delta_sleeping_agent = QUANTIZE(sleeping_agent_archived - sharer.sleeping_agent_archived) / (atmos_adjacent_turfs + 1) + var/delta_agent_b = QUANTIZE(agent_b_archived - sharer.agent_b_archived) / (atmos_adjacent_turfs + 1) var/delta_temperature = (temperature_archived - sharer.temperature_archived) @@ -423,28 +358,42 @@ What are the archived variables for? if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/delta_air = delta_oxygen+delta_nitrogen + var/delta_air = delta_oxygen + delta_nitrogen if(delta_air) - var/air_heat_capacity = SPECIFIC_HEAT_AIR*delta_air + var/air_heat_capacity = SPECIFIC_HEAT_AIR * delta_air if(delta_air > 0) heat_capacity_self_to_sharer += air_heat_capacity else heat_capacity_sharer_to_self -= air_heat_capacity if(delta_carbon_dioxide) - var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO*delta_carbon_dioxide + var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO * delta_carbon_dioxide if(delta_carbon_dioxide > 0) heat_capacity_self_to_sharer += carbon_dioxide_heat_capacity else heat_capacity_sharer_to_self -= carbon_dioxide_heat_capacity if(delta_toxins) - var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN*delta_toxins + var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN * delta_toxins if(delta_toxins > 0) heat_capacity_self_to_sharer += toxins_heat_capacity else heat_capacity_sharer_to_self -= toxins_heat_capacity + if(delta_sleeping_agent) + var/sleeping_agent_heat_capacity = SPECIFIC_HEAT_N2O * delta_sleeping_agent + if(delta_sleeping_agent > 0) + heat_capacity_self_to_sharer += sleeping_agent_heat_capacity + else + heat_capacity_sharer_to_self -= sleeping_agent_heat_capacity + + if(delta_agent_b) + var/agent_b_heat_capacity = SPECIFIC_HEAT_AGENT_B * delta_agent_b + if(delta_agent_b > 0) + heat_capacity_self_to_sharer += agent_b_heat_capacity + else + heat_capacity_sharer_to_self -= agent_b_heat_capacity + old_self_heat_capacity = heat_capacity() old_sharer_heat_capacity = sharer.heat_capacity() @@ -460,83 +409,40 @@ What are the archived variables for? toxins -= delta_toxins sharer.toxins += delta_toxins - var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) - last_share = abs(delta_oxygen) + abs(delta_carbon_dioxide) + abs(delta_nitrogen) + abs(delta_toxins) + sleeping_agent -= delta_sleeping_agent + sharer.sleeping_agent += delta_sleeping_agent - var/list/trace_types_considered = list() + agent_b -= delta_agent_b + sharer.agent_b += delta_agent_b - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - var/datum/gas/corresponding = locate(trace_gas.type) in sharer.trace_gases - var/delta = 0 - - if(corresponding) - delta = QUANTIZE(trace_gas.moles_archived - corresponding.moles_archived)/(atmos_adjacent_turfs+1) - else - corresponding = new trace_gas.type() - sharer.trace_gases += corresponding - - delta = trace_gas.moles_archived/(atmos_adjacent_turfs+1) - - trace_gas.moles -= delta - corresponding.moles += delta - - if(delta) - var/individual_heat_capacity = trace_gas.specific_heat*delta - if(delta > 0) - heat_capacity_self_to_sharer += individual_heat_capacity - else - heat_capacity_sharer_to_self -= individual_heat_capacity - - moved_moles += delta - last_share += abs(delta) - - trace_types_considered += trace_gas.type - - for(var/gas in sharer.trace_gases) - var/datum/gas/trace_gas = gas - if(trace_gas.type in trace_types_considered) - continue - var/datum/gas/corresponding - var/delta = 0 - corresponding = new trace_gas.type() - trace_gases += corresponding - - delta = trace_gas.moles_archived/5 - - trace_gas.moles -= delta - corresponding.moles += delta - - //Guaranteed transfer from sharer to self - var/individual_heat_capacity = trace_gas.specific_heat*delta - heat_capacity_sharer_to_self += individual_heat_capacity - - moved_moles += -delta - last_share += abs(delta) + var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins + delta_sleeping_agent + delta_agent_b) + last_share = abs(delta_oxygen) + abs(delta_carbon_dioxide) + abs(delta_nitrogen) + abs(delta_toxins) + abs(delta_sleeping_agent) + abs(delta_agent_b) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/new_self_heat_capacity = old_self_heat_capacity + heat_capacity_sharer_to_self - heat_capacity_self_to_sharer var/new_sharer_heat_capacity = old_sharer_heat_capacity + heat_capacity_self_to_sharer - heat_capacity_sharer_to_self if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY) - temperature = (old_self_heat_capacity*temperature - heat_capacity_self_to_sharer*temperature_archived + heat_capacity_sharer_to_self*sharer.temperature_archived)/new_self_heat_capacity + temperature = (old_self_heat_capacity * temperature - heat_capacity_self_to_sharer * temperature_archived + heat_capacity_sharer_to_self * sharer.temperature_archived) / new_self_heat_capacity if(new_sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) - sharer.temperature = (old_sharer_heat_capacity*sharer.temperature-heat_capacity_sharer_to_self*sharer.temperature_archived + heat_capacity_self_to_sharer*temperature_archived)/new_sharer_heat_capacity + sharer.temperature = (old_sharer_heat_capacity * sharer.temperature - heat_capacity_sharer_to_self * sharer.temperature_archived + heat_capacity_self_to_sharer * temperature_archived) / new_sharer_heat_capacity if(abs(old_sharer_heat_capacity) > MINIMUM_HEAT_CAPACITY) - if(abs(new_sharer_heat_capacity/old_sharer_heat_capacity - 1) < 0.10) // <10% change in sharer heat capacity + if(abs(new_sharer_heat_capacity / old_sharer_heat_capacity - 1) < 0.10) // <10% change in sharer heat capacity temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT) if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) - var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - sharer.temperature_archived*(sharer.total_moles() - moved_moles) - return delta_pressure*R_IDEAL_GAS_EQUATION/volume + var/delta_pressure = temperature_archived * (total_moles() + moved_moles) - sharer.temperature_archived * (sharer.total_moles() - moved_moles) + return delta_pressure * R_IDEAL_GAS_EQUATION / volume /datum/gas_mixture/mimic(turf/model, atmos_adjacent_turfs = 4) - var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen)/(atmos_adjacent_turfs+1) - var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide)/(atmos_adjacent_turfs+1) - var/delta_nitrogen = QUANTIZE(nitrogen_archived - model.nitrogen)/(atmos_adjacent_turfs+1) - var/delta_toxins = QUANTIZE(toxins_archived - model.toxins)/(atmos_adjacent_turfs+1) + var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen) / (atmos_adjacent_turfs + 1) + var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide) / (atmos_adjacent_turfs + 1) + var/delta_nitrogen = QUANTIZE(nitrogen_archived - model.nitrogen) / (atmos_adjacent_turfs + 1) + var/delta_toxins = QUANTIZE(toxins_archived - model.toxins) / (atmos_adjacent_turfs + 1) + var/delta_sleeping_agent = QUANTIZE(sleeping_agent_archived - model.sleeping_agent) / (atmos_adjacent_turfs + 1) + var/delta_agent_b = QUANTIZE(agent_b_archived - model.agent_b) / (atmos_adjacent_turfs + 1) var/delta_temperature = (temperature_archived - model.temperature) @@ -546,57 +452,54 @@ What are the archived variables for? if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/delta_air = delta_oxygen+delta_nitrogen + var/delta_air = delta_oxygen + delta_nitrogen if(delta_air) - var/air_heat_capacity = SPECIFIC_HEAT_AIR*delta_air - heat_transferred -= air_heat_capacity*model.temperature + var/air_heat_capacity = SPECIFIC_HEAT_AIR * delta_air + heat_transferred -= air_heat_capacity * model.temperature heat_capacity_transferred -= air_heat_capacity if(delta_carbon_dioxide) - var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO*delta_carbon_dioxide - heat_transferred -= carbon_dioxide_heat_capacity*model.temperature + var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO * delta_carbon_dioxide + heat_transferred -= carbon_dioxide_heat_capacity * model.temperature heat_capacity_transferred -= carbon_dioxide_heat_capacity if(delta_toxins) - var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN*delta_toxins - heat_transferred -= toxins_heat_capacity*model.temperature + var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN * delta_toxins + heat_transferred -= toxins_heat_capacity * model.temperature heat_capacity_transferred -= toxins_heat_capacity + if(delta_sleeping_agent) + var/sleeping_agent_heat_capacity = SPECIFIC_HEAT_N2O * delta_sleeping_agent + heat_transferred -= sleeping_agent_heat_capacity * model.temperature + heat_capacity_transferred -= sleeping_agent_heat_capacity + + if(delta_agent_b) + var/agent_b_heat_capacity = SPECIFIC_HEAT_AGENT_B * delta_agent_b + heat_transferred -= agent_b_heat_capacity * model.temperature + heat_capacity_transferred -= agent_b_heat_capacity + old_self_heat_capacity = heat_capacity() oxygen -= delta_oxygen carbon_dioxide -= delta_carbon_dioxide nitrogen -= delta_nitrogen toxins -= delta_toxins + sleeping_agent -= delta_sleeping_agent + agent_b -= delta_agent_b - var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) - last_share = abs(delta_oxygen) + abs(delta_carbon_dioxide) + abs(delta_nitrogen) + abs(delta_toxins) - - if(trace_gases.len) - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - var/delta = 0 - - delta = trace_gas.moles_archived/(atmos_adjacent_turfs+1) - - trace_gas.moles -= delta - - var/heat_cap_transferred = delta*trace_gas.specific_heat - heat_transferred += heat_cap_transferred*temperature_archived - heat_capacity_transferred += heat_cap_transferred - moved_moles += delta - moved_moles += abs(delta) + var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins + delta_sleeping_agent + delta_agent_b) + last_share = abs(delta_oxygen) + abs(delta_carbon_dioxide) + abs(delta_nitrogen) + abs(delta_toxins) + abs(delta_sleeping_agent) + abs(delta_agent_b) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY) - temperature = (old_self_heat_capacity*temperature - heat_capacity_transferred*temperature_archived)/new_self_heat_capacity + temperature = (old_self_heat_capacity * temperature - heat_capacity_transferred * temperature_archived) / new_self_heat_capacity temperature_mimic(model, model.thermal_conductivity) if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) - var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - model.temperature*(model.oxygen+model.carbon_dioxide+model.nitrogen+model.toxins) - return delta_pressure*R_IDEAL_GAS_EQUATION/volume + var/delta_pressure = temperature_archived * (total_moles() + moved_moles) - model.temperature * (model.oxygen + model.carbon_dioxide + model.nitrogen + model.toxins + model.sleeping_agent + model.agent_b) + return delta_pressure * R_IDEAL_GAS_EQUATION / volume else return 0 @@ -608,11 +511,11 @@ What are the archived variables for? var/sharer_heat_capacity = sharer.heat_capacity_archived() if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*sharer_heat_capacity/(self_heat_capacity+sharer_heat_capacity)) + var/heat = conduction_coefficient*delta_temperature * \ + (self_heat_capacity * sharer_heat_capacity / (self_heat_capacity + sharer_heat_capacity)) - temperature -= heat/self_heat_capacity - sharer.temperature += heat/sharer_heat_capacity + temperature -= heat / self_heat_capacity + sharer.temperature += heat / sharer_heat_capacity /datum/gas_mixture/temperature_mimic(turf/model, conduction_coefficient) var/delta_temperature = (temperature - model.temperature) @@ -620,10 +523,10 @@ What are the archived variables for? var/self_heat_capacity = heat_capacity() if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*model.heat_capacity/(self_heat_capacity+model.heat_capacity)) + var/heat = conduction_coefficient * delta_temperature * \ + (self_heat_capacity * model.heat_capacity / (self_heat_capacity + model.heat_capacity)) - temperature -= heat/self_heat_capacity + temperature -= heat / self_heat_capacity /datum/gas_mixture/temperature_turf_share(turf/simulated/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature) @@ -631,52 +534,36 @@ What are the archived variables for? var/self_heat_capacity = heat_capacity() if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*sharer.heat_capacity/(self_heat_capacity+sharer.heat_capacity)) + var/heat = conduction_coefficient * delta_temperature * \ + (self_heat_capacity * sharer.heat_capacity / (self_heat_capacity + sharer.heat_capacity)) - temperature -= heat/self_heat_capacity - sharer.temperature += heat/sharer.heat_capacity + temperature -= heat / self_heat_capacity + sharer.temperature += heat / sharer.heat_capacity /datum/gas_mixture/compare(datum/gas_mixture/sample) - if((abs(oxygen-sample.oxygen) > MINIMUM_AIR_TO_SUSPEND) && \ - ((oxygen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen) || (oxygen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen))) + if((abs(oxygen - sample.oxygen) > MINIMUM_AIR_TO_SUSPEND) && \ + ((oxygen < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.oxygen) || (oxygen > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.oxygen))) return 0 - if((abs(nitrogen-sample.nitrogen) > MINIMUM_AIR_TO_SUSPEND) && \ - ((nitrogen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.nitrogen) || (nitrogen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.nitrogen))) + if((abs(nitrogen - sample.nitrogen) > MINIMUM_AIR_TO_SUSPEND) && \ + ((nitrogen < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.nitrogen) || (nitrogen > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.nitrogen))) return 0 - if((abs(carbon_dioxide-sample.carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && \ - ((carbon_dioxide < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.carbon_dioxide) || (carbon_dioxide > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.carbon_dioxide))) + if((abs(carbon_dioxide - sample.carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && \ + ((carbon_dioxide < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.carbon_dioxide) || (carbon_dioxide > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.carbon_dioxide))) return 0 - if((abs(toxins-sample.toxins) > MINIMUM_AIR_TO_SUSPEND) && \ - ((toxins < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins) || (toxins > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins))) + if((abs(toxins - sample.toxins) > MINIMUM_AIR_TO_SUSPEND) && \ + ((toxins < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.toxins) || (toxins > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.toxins))) + return 0 + if((abs(sleeping_agent - sample.sleeping_agent) > MINIMUM_AIR_TO_SUSPEND) && \ + ((sleeping_agent < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.sleeping_agent) || (sleeping_agent > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.sleeping_agent))) + return 0 + if((abs(agent_b - sample.agent_b) > MINIMUM_AIR_TO_SUSPEND) && \ + ((agent_b < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.agent_b) || (agent_b > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.agent_b))) return 0 if(total_moles() > MINIMUM_AIR_TO_SUSPEND) - if((abs(temperature-sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \ - ((temperature < (1-MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || (temperature > (1+MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature))) + if((abs(temperature - sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \ + ((temperature < (1 - MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND) * sample.temperature) || (temperature > (1 + MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND) * sample.temperature))) return 0 - - for(var/gas in sample.trace_gases) - var/datum/gas/trace_gas = gas - if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND) - var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if(corresponding) - if((abs(trace_gas.moles - corresponding.moles) > MINIMUM_AIR_TO_SUSPEND) && \ - ((corresponding.moles < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*trace_gas.moles) || (corresponding.moles > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*trace_gas.moles))) - return 0 - else - return 0 - - for(var/gas in trace_gases) - var/datum/gas/trace_gas = gas - if(trace_gas.moles > MINIMUM_AIR_TO_SUSPEND) - var/datum/gas/corresponding = locate(trace_gas.type) in sample.trace_gases - if(corresponding) - if((abs(trace_gas.moles - corresponding.moles) > MINIMUM_AIR_TO_SUSPEND) && \ - ((trace_gas.moles < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*corresponding.moles) || (trace_gas.moles > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*corresponding.moles))) - return 0 - else - return 0 return 1 @@ -691,12 +578,12 @@ What are the archived variables for? //Does handle trace gases! /datum/gas_mixture/proc/get_breath_partial_pressure(gas_pressure) - return (gas_pressure*R_IDEAL_GAS_EQUATION*temperature)/BREATH_VOLUME + return (gas_pressure * R_IDEAL_GAS_EQUATION * temperature) / BREATH_VOLUME //Reverse of the above /datum/gas_mixture/proc/get_true_breath_pressure(breath_pp) - return (breath_pp*BREATH_VOLUME)/(R_IDEAL_GAS_EQUATION*temperature) + return (breath_pp * BREATH_VOLUME) / (R_IDEAL_GAS_EQUATION * temperature) //Mathematical proofs: /* diff --git a/code/datums/helper_datums/global_iterator.dm b/code/datums/helper_datums/global_iterator.dm deleted file mode 100644 index 214045941b5..00000000000 --- a/code/datums/helper_datums/global_iterator.dm +++ /dev/null @@ -1,152 +0,0 @@ -/* -README: - -The global_iterator datum is supposed to provide a simple and robust way to -create some constantly "looping" processes with ability to stop and restart them at will. -Generally, the only thing you want to play with (meaning, redefine) is the process() proc. -It must contain all the things you want done. - -Control functions: - new - used to create datum. First argument (optional) - var list(to use in process() proc) as list, - second (optional) - autostart control. - If autostart == TRUE, the loop will be started immediately after datum creation. - - start(list/arguments) - starts the loop. Takes arguments(optional) as a list, which is then used - by process() proc. Returns null if datum already active, 1 if loop started succesfully and 0 if there's - an error in supplied arguments (not list or empty list). - - stop() - stops the loop. Returns null if datum is already inactive and 1 on success. - - set_delay(new_delay) - sets the delay between iterations. Pretty selfexplanatory. - Returns 0 on error(new_delay is not numerical), 1 otherwise. - - set_process_args(list/arguments) - passes the supplied arguments to the process() proc. - - active() - Returns 1 if datum is active, 0 otherwise. - - toggle() - toggles datum state. Returns new datum state (see active()). - -Misc functions: - - get_last_exec_time() - Returns the time of last iteration. - - get_last_exec_time_as_text() - Returns the time of last iteration as text - - -Control vars: - - delay - delay between iterations - - check_for_null - if equals TRUE, on each iteration the supplied arguments will be checked for nulls. - If some varible equals null (and null only), the loop is stopped. - Usefull, if some var unexpectedly becomes null - due to object deletion, for example. - Of course, you can also check the variables inside process() proc to prevent runtime errors. - -Data storage vars: - - result - stores the value returned by process() proc -*/ - -/datum/global_iterator - var/control_switch = 0 - var/delay = 10 - var/list/arg_list = new - var/last_exec = null - var/check_for_null = 1 - var/forbid_garbage = 0 - var/result - var/state = 0 - -/datum/global_iterator/New(list/arguments=null,autostart=1) - delay = delay>0?(delay):1 - if(forbid_garbage) //prevents garbage collection with tag != null - tag = "\ref[src]" - set_process_args(arguments) - if(autostart) - start() - return - -/datum/global_iterator/proc/main() - state = 1 - while(src && control_switch) - last_exec = world.timeofday - if(check_for_null && has_null_args()) - stop() - return 0 - result = process(arglist(arg_list)) - for(var/sleep_time=delay;sleep_time>0;sleep_time--) //uhh, this is ugly. But I see no other way to terminate sleeping proc. Such disgrace. - if(!control_switch) - return 0 - sleep(1) - return 0 - -/datum/global_iterator/proc/start(list/arguments=null) - if(active()) - return - if(arguments) - if(!set_process_args(arguments)) - return 0 - if(!state_check()) //the main loop is sleeping, wait for it to terminate. - return - control_switch = 1 - spawn() - state = main() - return 1 - -/datum/global_iterator/proc/stop() - if(!active()) - return - control_switch = 0 - spawn(-1) //report termination error but don't wait for state_check(). - state_check() - return 1 - -/datum/global_iterator/proc/state_check() - var/lag = 0 - while(state) - sleep(1) - if(++lag>10) - CRASH("The global_iterator loop \ref[src] failed to terminate in designated timeframe. This may be caused by server lagging.") - return 1 - -/datum/global_iterator/process() - return - -/datum/global_iterator/proc/active() - return control_switch - -/datum/global_iterator/proc/has_null_args() - if(null in arg_list) - return 1 - return 0 - - -/datum/global_iterator/proc/set_delay(new_delay) - if(isnum(new_delay)) - delay = max(1, round(new_delay)) - return 1 - else - return 0 - -/datum/global_iterator/proc/get_last_exec_time() - return (last_exec||0) - -/datum/global_iterator/proc/get_last_exec_time_as_text() - return (time2text(last_exec)||"Wasn't executed yet") - -/datum/global_iterator/proc/set_process_args(list/arguments) - if(arguments && istype(arguments, /list) && arguments.len) - arg_list = arguments - return 1 - else -// to_chat(world, "Invalid arguments supplied for [src.type], ref = \ref[src]") - return 0 - -/datum/global_iterator/proc/toggle_null_checks() - check_for_null = !check_for_null - return check_for_null - -/datum/global_iterator/proc/toggle() - if(!stop()) - start() - return active() diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 9bba49f2678..4e20d2a675e 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -211,7 +211,7 @@ var/datum/gas_mixture/A = F.air // Can most things breathe? - if(A.trace_gases.len) + if(A.sleeping_agent) continue if(A.oxygen < 16) continue diff --git a/code/datums/holocall.dm b/code/datums/holocall.dm index b8684072c3f..369c01cce42 100644 --- a/code/datums/holocall.dm +++ b/code/datums/holocall.dm @@ -148,7 +148,6 @@ eye.eye_user = user eye.name = "Camera Eye ([user.name])" user.remote_control = eye - user.remote_view = 1 user.reset_perspective(eye) eye.setLoc(get_turf(H)) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 83e69bdf5b1..7d3a73abf24 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1688,7 +1688,7 @@ if(H.w_uniform) jumpsuit = H.w_uniform jumpsuit.color = team_color - H.update_inv_w_uniform(0,0) + H.update_inv_w_uniform() add_attack_logs(missionary, current, "Converted to a zealot for [convert_duration/600] minutes") addtimer(CALLBACK(src, .proc/remove_zealot, jumpsuit), convert_duration) //deconverts after the timer expires @@ -1705,7 +1705,7 @@ jumpsuit.color = initial(jumpsuit.color) //reset the jumpsuit no matter where our mind is if(ishuman(current)) //but only try updating us if we are still a human type since it is a human proc var/mob/living/carbon/human/H = current - H.update_inv_w_uniform(0,0) + H.update_inv_w_uniform() to_chat(current, "You seem to have forgotten the events of the past 10 minutes or so, and your head aches a bit as if someone beat it savagely with a stick.") to_chat(current, "This means you don't remember who you were working for or what you were doing.") diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm index dae85c1726f..4a812b40e4e 100644 --- a/code/datums/progressbar.dm +++ b/code/datums/progressbar.dm @@ -39,7 +39,7 @@ if(user.client) user.client.images += bar - progress = Clamp(progress, 0, goal) + progress = clamp(progress, 0, goal) bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]" if(!shown) user.client.images += bar diff --git a/code/datums/spell.dm b/code/datums/spell.dm index 6b114971258..3855dbcfac3 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -237,10 +237,10 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) if(action) action.UpdateButtonIcon() -/obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells +/obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr, make_attack_logs = TRUE) //if recharge is started is important for the trigger spells before_cast(targets) invocation() - if(user && user.ckey) + if(user && user.ckey && make_attack_logs) add_attack_logs(user, targets, "cast the spell [name]", ATKLOG_ALL) spawn(0) if(charge_type == "recharge" && recharge) diff --git a/code/datums/spells/cluwne.dm b/code/datums/spells/cluwne.dm index 91df261e9c2..19a12055fef 100644 --- a/code/datums/spells/cluwne.dm +++ b/code/datums/spells/cluwne.dm @@ -36,10 +36,10 @@ unEquip(gloves, 1) if(!istype(wear_mask, /obj/item/clothing/mask/cursedclown)) //Infinite loops otherwise unEquip(wear_mask, 1) - equip_to_slot_if_possible(new /obj/item/clothing/under/cursedclown, slot_w_uniform, 1, 1, 1) - equip_to_slot_if_possible(new /obj/item/clothing/gloves/cursedclown, slot_gloves, 1, 1, 1) - equip_to_slot_if_possible(new /obj/item/clothing/mask/cursedclown, slot_wear_mask, 1, 1, 1) - equip_to_slot_if_possible(new /obj/item/clothing/shoes/cursedclown, slot_shoes, 1, 1, 1) + equip_to_slot_if_possible(new /obj/item/clothing/under/cursedclown, slot_w_uniform, TRUE, TRUE) + equip_to_slot_if_possible(new /obj/item/clothing/gloves/cursedclown, slot_gloves, TRUE, TRUE) + equip_to_slot_if_possible(new /obj/item/clothing/mask/cursedclown, slot_wear_mask, TRUE, TRUE) + equip_to_slot_if_possible(new /obj/item/clothing/shoes/cursedclown, slot_shoes, TRUE, TRUE) /mob/living/carbon/human/proc/makeAntiCluwne() to_chat(src, "You don't feel very funny.") @@ -83,5 +83,5 @@ unEquip(gloves, 1) qdel(G) - equip_to_slot_if_possible(new /obj/item/clothing/under/lawyer/black, slot_w_uniform, 1, 1, 1) - equip_to_slot_if_possible(new /obj/item/clothing/shoes/black, slot_shoes, 1, 1, 1) + equip_to_slot_if_possible(new /obj/item/clothing/under/lawyer/black, slot_w_uniform, TRUE, TRUE) + equip_to_slot_if_possible(new /obj/item/clothing/shoes/black, slot_shoes, TRUE, TRUE) diff --git a/code/datums/spells/devil.dm b/code/datums/spells/devil.dm index 12e2a44a8c1..27b2fcb8851 100644 --- a/code/datums/spells/devil.dm +++ b/code/datums/spells/devil.dm @@ -142,7 +142,6 @@ return 0 fakefire() forceMove(get_turf(src)) - reset_perspective() visible_message("[src] appears in a firey blaze!") playsound(get_turf(src), 'sound/misc/exit_blood.ogg', 100, 1, -1) spawn(15) diff --git a/code/datums/spells/genetic.dm b/code/datums/spells/genetic.dm index 3c2f997e461..d95c6212486 100644 --- a/code/datums/spells/genetic.dm +++ b/code/datums/spells/genetic.dm @@ -2,7 +2,6 @@ name = "Genetic" desc = "This spell inflicts a set of mutations and disabilities upon the target." - var/disabilities = 0 //bits var/list/mutations = list() //mutation strings var/duration = 100 //deciseconds /* @@ -20,16 +19,12 @@ for(var/mob/living/target in targets) for(var/x in mutations) target.mutations.Add(x) - /* if(x == HULK && ishuman(target)) - target:hulk_time=world.time + duration */ - target.disabilities |= disabilities target.update_mutations() //update target's mutation overlays var/mob/living/carbon/human/H = target if(ishuman(target)) H.update_body() spawn(duration) target.mutations.Remove(mutations) - target.disabilities &= ~disabilities target.update_mutations() if(ishuman(target)) H.update_body() diff --git a/code/datums/spells/horsemask.dm b/code/datums/spells/horsemask.dm index 2c000a0d232..0140fbdf951 100644 --- a/code/datums/spells/horsemask.dm +++ b/code/datums/spells/horsemask.dm @@ -43,6 +43,6 @@ "Your face burns up, and shortly after the fire you realise you have the face of a horse!") if(!target.unEquip(target.wear_mask)) qdel(target.wear_mask) - target.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1) + target.equip_to_slot_if_possible(magichead, slot_wear_mask, TRUE, TRUE) target.flash_eyes() diff --git a/code/datums/spells/knock.dm b/code/datums/spells/knock.dm index dc2efcc1e91..88f5eec9474 100644 --- a/code/datums/spells/knock.dm +++ b/code/datums/spells/knock.dm @@ -13,6 +13,11 @@ action_icon_state = "knock" sound = 'sound/magic/knock.ogg' +// Knock doesn't need to generate an attack log for every turf, set `make_attack_logs` to FALSE and just create a custom one. +/obj/effect/proc_holder/spell/aoe_turf/knock/perform(list/targets, recharge, mob/user) + add_attack_logs(user, user, "cast the spell [name]", ATKLOG_ALL) + return ..(targets, recharge, user, make_attack_logs = FALSE) + /obj/effect/proc_holder/spell/aoe_turf/knock/cast(list/targets, mob/user = usr) for(var/turf/T in targets) for(var/obj/machinery/door/door in T.contents) @@ -30,8 +35,6 @@ SC.locked = 0 C.open() - return - /obj/effect/proc_holder/spell/aoe_turf/knock/greater name = "Greater Knock" desc = "On first cast, will remove access restrictions on all airlocks on the station, and announce this spell's use to the station. On any further cast, will open all doors in sight. Cannot be refunded once bought!" diff --git a/code/datums/spells/summonitem.dm b/code/datums/spells/summonitem.dm index c3301f4d6ab..2a8e1d94526 100644 --- a/code/datums/spells/summonitem.dm +++ b/code/datums/spells/summonitem.dm @@ -104,12 +104,12 @@ if(target.hand) //left active hand - if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_l_hand, 0, 1, 1)) - if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_r_hand, 0, 1, 1)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_l_hand, FALSE, TRUE)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_r_hand, FALSE, TRUE)) butterfingers = 1 else //right active hand - if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_r_hand, 0, 1, 1)) - if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_l_hand, 0, 1, 1)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_r_hand, FALSE, TRUE)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_l_hand, FALSE, TRUE)) butterfingers = 1 if(butterfingers) item_to_retrieve.loc = target.loc diff --git a/code/datums/spells/touch_attacks.dm b/code/datums/spells/touch_attacks.dm index d656bccac4a..c242a1aa52f 100644 --- a/code/datums/spells/touch_attacks.dm +++ b/code/datums/spells/touch_attacks.dm @@ -27,12 +27,12 @@ var/hand_handled = 1 attached_hand = new hand_path(src) if(user.hand) //left active hand - if(!user.equip_to_slot_if_possible(attached_hand, slot_l_hand, 0, 1, 1)) - if(!user.equip_to_slot_if_possible(attached_hand, slot_r_hand, 0, 1, 1)) + if(!user.equip_to_slot_if_possible(attached_hand, slot_l_hand, FALSE, TRUE)) + if(!user.equip_to_slot_if_possible(attached_hand, slot_r_hand, FALSE, TRUE)) hand_handled = 0 else //right active hand - if(!user.equip_to_slot_if_possible(attached_hand, slot_r_hand, 0, 1, 1)) - if(!user.equip_to_slot_if_possible(attached_hand, slot_l_hand, 0, 1, 1)) + if(!user.equip_to_slot_if_possible(attached_hand, slot_r_hand, FALSE, TRUE)) + if(!user.equip_to_slot_if_possible(attached_hand, slot_l_hand, FALSE, TRUE)) hand_handled = 0 if(!hand_handled) qdel(attached_hand) diff --git a/code/datums/spells/wizard.dm b/code/datums/spells/wizard.dm index cf7e6fa3217..94383f1b1e2 100644 --- a/code/datums/spells/wizard.dm +++ b/code/datums/spells/wizard.dm @@ -304,7 +304,7 @@ sound = 'sound/magic/blind.ogg' /obj/effect/proc_holder/spell/targeted/genetic/blind - disabilities = BLIND + mutations = list(BLINDNESS) duration = 300 sound = 'sound/magic/blind.ogg' @@ -423,7 +423,7 @@ M.Weaken(stun_amt) to_chat(M, "You're thrown back by a mystical force!") spawn(0) - AM.throw_at(throwtarget, ((Clamp((maxthrow - (Clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1)//So stuff gets tossed around at the same time. + AM.throw_at(throwtarget, ((clamp((maxthrow - (clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1)//So stuff gets tossed around at the same time. /obj/effect/proc_holder/spell/targeted/sacred_flame name = "Sacred Flame" diff --git a/code/datums/status_effects/status_effect.dm b/code/datums/status_effects/status_effect.dm index 74abf104465..2580b1c9935 100644 --- a/code/datums/status_effects/status_effect.dm +++ b/code/datums/status_effects/status_effect.dm @@ -5,7 +5,7 @@ /datum/status_effect var/id = "effect" //Used for screen alerts. var/duration = -1 //How long the status effect lasts in DECISECONDS. Enter -1 for an effect that never ends unless removed through some means. - var/tick_interval = 10 //How many deciseconds between ticks, approximately. Leave at 10 for every second. + var/tick_interval = 10 //How many deciseconds between ticks, approximately. Leave at 10 for every second. Setting this to -1 will stop processing if duration is also unlimited. var/mob/living/owner //The mob affected by the status effect. var/status_type = STATUS_EFFECT_UNIQUE //How many of the effect can be on one mob, and what happens when you try to add another var/on_remove_on_mob_delete = FALSE //if we call on_remove() when the mob is deleted @@ -31,7 +31,8 @@ var/obj/screen/alert/status_effect/A = owner.throw_alert(id, alert_type) A.attached_effect = src //so the alert can reference us, if it needs to linked_alert = A //so we can reference the alert, if we need to - START_PROCESSING(SSfastprocess, src) + if(duration > 0 || initial(tick_interval) > 0) //don't process if we don't care + START_PROCESSING(SSfastprocess, src) return TRUE /datum/status_effect/Destroy() diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 1a407f2ec50..09c874ce8a8 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -31,7 +31,6 @@ GLOBAL_LIST_INIT(wireColours, list("red", "blue", "green", "black", "orange", "b src.holder = holder if(!istype(holder, holder_type)) CRASH("Our holder is null/the wrong type!") - return // Generate new wires if(random) @@ -87,7 +86,7 @@ GLOBAL_LIST_INIT(wireColours, list("red", "blue", "green", "black", "orange", "b if(ishuman(user)) var/mob/living/carbon/human/H = user var/obj/item/organ/internal/eyes/eyes = H.get_int_organ(/obj/item/organ/internal/eyes) - if(eyes && H.disabilities & COLOURBLIND) + if(eyes && (COLOURBLIND in H.mutations)) replace_colours = eyes.replace_colours diff --git a/code/defines/procs/statistics.dm b/code/defines/procs/statistics.dm index e6e111880fb..094e4f9ca2b 100644 --- a/code/defines/procs/statistics.dm +++ b/code/defines/procs/statistics.dm @@ -1,35 +1,3 @@ -/proc/sql_poll_players() - if(!config.sql_enabled) - return - var/playercount = 0 - for(var/mob/M in GLOB.player_list) - if(M.client) - playercount += 1 - establish_db_connection() - if(!GLOB.dbcon.IsConnected()) - log_game("SQL ERROR during player polling. Failed to connect.") - else - var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss") - var/DBQuery/query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, time) VALUES ([playercount], '[sqltime]')") - if(!query.Execute()) - var/err = query.ErrorMsg() - log_game("SQL ERROR during player polling. Error : \[[err]\]\n") - - -/proc/sql_poll_admins() - if(!config.sql_enabled) - return - var/admincount = GLOB.admins.len - establish_db_connection() - if(!GLOB.dbcon.IsConnected()) - log_game("SQL ERROR during admin polling. Failed to connect.") - else - var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss") - var/DBQuery/query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (admincount, time) VALUES ([admincount], '[sqltime]')") - if(!query.Execute()) - var/err = query.ErrorMsg() - log_game("SQL ERROR during admin polling. Error : \[[err]\]\n") - /proc/sql_report_round_start() // TODO if(!config.sql_enabled) @@ -110,15 +78,6 @@ var/err = query.ErrorMsg() log_game("SQL ERROR during death reporting. Error : \[[err]\]\n") -/proc/statistic_cycle() - if(!config.sql_enabled) - return - while(1) - sql_poll_players() - sleep(600) - sql_poll_admins() - sleep(6000) //Poll every ten minutes - //This proc is used for feedback. It is executed at round end. /proc/sql_commit_feedback() if(!GLOB.blackbox) diff --git a/code/game/area/areas/depot-areas.dm b/code/game/area/areas/depot-areas.dm index 7a7c934df35..48760540c78 100644 --- a/code/game/area/areas/depot-areas.dm +++ b/code/game/area/areas/depot-areas.dm @@ -216,7 +216,8 @@ if(!silent) announce_here("Depot Code BLUE", reason) var/list/possible_bot_spawns = list() - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "syndi_depot_bot") possible_bot_spawns |= L if(possible_bot_spawns.len) @@ -248,7 +249,8 @@ comms_online = TRUE if(comms_online) spawn(0) - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(prob(50)) if(L.name == "syndi_depot_backup") var/mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/space/S = new /mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/space(get_turf(L)) @@ -344,7 +346,8 @@ /area/syndicate_depot/core/proc/shields_up() if(shield_list.len) return - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "syndi_depot_shield") var/obj/machinery/shieldwall/syndicate/S = new /obj/machinery/shieldwall/syndicate(L.loc) shield_list += S.UID() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 1cb0ee3baad..5d3c6d688ac 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -14,21 +14,17 @@ var/germ_level = GERM_LEVEL_AMBIENT // The higher the germ level, the more germ on the atom. var/simulated = TRUE //filter for actions - used by lighting overlays var/atom_say_verb = "says" - var/dont_save = 0 // For atoms that are temporary by necessity - like lighting overlays - + var/dont_save = FALSE // For atoms that are temporary by necessity - like lighting overlays ///Chemistry. var/container_type = NONE var/datum/reagents/reagents = null //This atom's HUD (med/sec, etc) images. Associative list. - var/list/image/hud_list = list() + var/list/image/hud_list //HUD images that this atom can provide. var/list/hud_possible - ///Chemistry. - - //Value used to increment ex_act() if reactionary_explosions is on var/explosion_block = 0 @@ -38,9 +34,9 @@ //Detective Work, used for allowing a given atom to leave its fibers on stuff. Allowed by default var/can_leave_fibers = TRUE - var/allow_spin = 1 //Set this to 1 for a _target_ that is being thrown at; if an atom has this set to 1 then atoms thrown AT it will not spin; currently used for the singularity. -Fox + var/allow_spin = TRUE //Set this to 1 for a _target_ that is being thrown at; if an atom has this set to 1 then atoms thrown AT it will not spin; currently used for the singularity. -Fox - var/admin_spawned = 0 //was this spawned by an admin? used for stat tracking stuff. + var/admin_spawned = FALSE //was this spawned by an admin? used for stat tracking stuff. var/initialized = FALSE @@ -67,7 +63,6 @@ // we were deleted return - //Called after New if the map is being loaded. mapload = TRUE //Called from base of New if the map is not being loaded. mapload = FALSE //This base must be called or derivatives must set initialized to TRUE @@ -101,7 +96,6 @@ return INITIALIZE_HINT_NORMAL - //called if Initialize returns INITIALIZE_HINT_LATELOAD /atom/proc/LateInitialize() return @@ -114,34 +108,34 @@ return /atom/proc/onCentcom() + . = FALSE var/turf/T = get_turf(src) if(!T) - return 0 + return if(!is_admin_level(T.z))//if not, don't bother - return 0 + return //check for centcomm shuttles for(var/centcom_shuttle in list("emergency", "pod1", "pod2", "pod3", "pod4", "ferry")) var/obj/docking_port/mobile/M = SSshuttle.getShuttle(centcom_shuttle) if(T in M.areaInstance) - return 1 + return TRUE //finally check for centcom itself - return istype(T.loc,/area/centcom) + return istype(T.loc, /area/centcom) /atom/proc/onSyndieBase() + . = FALSE var/turf/T = get_turf(src) if(!T) - return 0 + return if(!is_admin_level(T.z))//if not, don't bother - return 0 + return if(istype(T.loc, /area/shuttle/syndicate_elite) || istype(T.loc, /area/syndicate_mothership)) - return 1 - - return 0 + return TRUE /atom/Destroy() if(alternate_appearances) @@ -164,6 +158,34 @@ SEND_SIGNAL(src, COMSIG_ATOM_DIR_CHANGE, dir, newdir) dir = newdir +/* + Sets the atom's pixel locations based on the atom's `dir` variable, and what pixel offset arguments are passed into it + If no arguments are supplied, `pixel_x` or `pixel_y` will be set to 0 + Used primarily for when players attach mountable frames to walls (APC frame, fire alarm frame, etc.) +*/ +/atom/proc/set_pixel_offsets_from_dir(pixel_north = 0, pixel_south = 0, pixel_east = 0, pixel_west = 0) + switch(dir) + if(NORTH) + pixel_y = pixel_north + if(SOUTH) + pixel_y = pixel_south + if(EAST) + pixel_x = pixel_east + if(WEST) + pixel_x = pixel_west + if(NORTHEAST) + pixel_y = pixel_north + pixel_x = pixel_east + if(NORTHWEST) + pixel_y = pixel_north + pixel_x = pixel_west + if(SOUTHEAST) + pixel_y = pixel_south + pixel_x = pixel_east + if(SOUTHWEST) + pixel_y = pixel_south + pixel_x = pixel_west + ///Handle melee attack by a mech /atom/proc/mech_melee_attack(obj/mecha/M) return @@ -202,9 +224,7 @@ else return null -/atom/proc/check_eye(user as mob) - if(istype(user, /mob/living/silicon/ai)) // WHYYYY - return 1 +/atom/proc/check_eye(mob/user) return /atom/proc/on_reagent_change() @@ -219,11 +239,11 @@ /// Is this atom injectable into other atoms /atom/proc/is_injectable(mob/user, allowmobs = TRUE) - return reagents && (container_type & (INJECTABLE | REFILLABLE)) + return reagents && (container_type & (INJECTABLE|REFILLABLE)) /// Can we draw from this atom with an injectable atom /atom/proc/is_drawable(mob/user, allowmobs = TRUE) - return reagents && (container_type & (DRAWABLE | DRAINABLE)) + return reagents && (container_type & (DRAWABLE|DRAINABLE)) /// Can this atoms reagents be refilled /atom/proc/is_refillable() @@ -234,12 +254,12 @@ return reagents && (container_type & DRAINABLE) /atom/proc/CheckExit() - return 1 + return TRUE /atom/proc/HasProximity(atom/movable/AM as mob|obj) return -/atom/proc/emp_act(var/severity) +/atom/proc/emp_act(severity) return /atom/proc/bullet_act(obj/item/projectile/P, def_zone) @@ -249,13 +269,13 @@ /atom/proc/in_contents_of(container)//can take class or object instance as argument if(ispath(container)) if(istype(src.loc, container)) - return 1 + return TRUE else if(src in container) - return 1 - return + return TRUE + return FALSE /* - * atom/proc/search_contents_for(path,list/filter_path=null) + * atom/proc/search_contents_for(path, list/filter_path = null) * Recursevly searches all atom contens (including contents contents and so on). * * ARGS: path - search atom contents for atoms of this type @@ -264,7 +284,7 @@ * RETURNS: list of found atoms */ -/atom/proc/search_contents_for(path,list/filter_path=null) +/atom/proc/search_contents_for(path, list/filter_path = null) var/list/found = list() for(var/atom/A in src) if(istype(A, path)) @@ -276,7 +296,7 @@ if(!pass) continue if(A.contents.len) - found += A.search_contents_for(path,filter_path) + found += A.search_contents_for(path, filter_path) return found @@ -397,43 +417,58 @@ /atom/proc/get_spooked() return -/atom/proc/add_hiddenprint(mob/living/M as mob) - if(isnull(M)) return - if(isnull(M.key)) return +/** + Base proc, intended to be overriden. + + This should only be called from one place: inside the slippery component. + Called after a human mob slips on this atom. + + If you want the person who slipped to have something special done to them, put it here. +*/ +/atom/proc/after_slip(mob/living/carbon/human/H) + return + +/atom/proc/add_hiddenprint(mob/living/M) + if(isnull(M)) + return + if(isnull(M.key)) + return if(ishuman(M)) var/mob/living/carbon/human/H = M if(!istype(H.dna, /datum/dna)) - return 0 + return FALSE if(H.gloves) if(fingerprintslast != H.ckey) //Add the list if it does not exist. if(!fingerprintshidden) fingerprintshidden = list() - fingerprintshidden += text("\[[time_stamp()]\] (Wearing gloves). Real name: [], Key: []",H.real_name, H.key) + fingerprintshidden += text("\[[time_stamp()]\] (Wearing gloves). Real name: [], Key: []", H.real_name, H.key) fingerprintslast = H.ckey - return 0 + return FALSE if(!fingerprints) if(fingerprintslast != H.ckey) //Add the list if it does not exist. if(!fingerprintshidden) fingerprintshidden = list() - fingerprintshidden += text("\[[time_stamp()]\] Real name: [], Key: []",H.real_name, H.key) + fingerprintshidden += text("\[[time_stamp()]\] Real name: [], Key: []", H.real_name, H.key) fingerprintslast = H.ckey - return 1 + return TRUE else if(fingerprintslast != M.ckey) //Add the list if it does not exist. if(!fingerprintshidden) fingerprintshidden = list() - fingerprintshidden += text("\[[time_stamp()]\] Real name: [], Key: []",M.real_name, M.key) + fingerprintshidden += text("\[[time_stamp()]\] Real name: [], Key: []", M.real_name, M.key) fingerprintslast = M.ckey return //Set ignoregloves to add prints irrespective of the mob having gloves on. -/atom/proc/add_fingerprint(mob/living/M as mob, ignoregloves = 0) - if(isnull(M)) return - if(isnull(M.key)) return +/atom/proc/add_fingerprint(mob/living/M, ignoregloves = FALSE) + if(isnull(M)) + return + if(isnull(M.key)) + return if(ishuman(M)) //Add the list if it does not exist. if(!fingerprintshidden) @@ -447,7 +482,7 @@ if(fingerprintslast != M.key) fingerprintshidden += "(Has no fingerprints) Real name: [M.real_name], Key: [M.key]" fingerprintslast = M.key - return 0 //Now, lets get to the dirty work. + return FALSE //Now, lets get to the dirty work. //First, make sure their DNA makes sense. var/mob/living/carbon/human/H = M if(!istype(H.dna, /datum/dna) || !H.dna.uni_identity || (length(H.dna.uni_identity) != 32)) @@ -460,20 +495,20 @@ if(H.gloves) var/obj/item/clothing/gloves/G = H.gloves if(G.transfer_prints) - ignoregloves = 1 + ignoregloves = TRUE //Now, deal with gloves. if(!ignoregloves) if(H.gloves && H.gloves != src) if(fingerprintslast != H.ckey) - fingerprintshidden += text("\[[]\](Wearing gloves). Real name: [], Key: []",time_stamp(), H.real_name, H.key) + fingerprintshidden += text("\[[]\](Wearing gloves). Real name: [], Key: []", time_stamp(), H.real_name, H.key) fingerprintslast = H.ckey H.gloves.add_fingerprint(M) - return 0 + return FALSE //More adminstuffz if(fingerprintslast != H.ckey) - fingerprintshidden += text("\[[]\]Real name: [], Key: []",time_stamp(), H.real_name, H.key) + fingerprintshidden += text("\[[]\]Real name: [], Key: []", time_stamp(), H.real_name, H.key) fingerprintslast = H.ckey //Make the list if it does not exist. @@ -486,18 +521,16 @@ // Add the fingerprints fingerprints[full_print] = full_print - return 1 + return TRUE else //Smudge up dem prints some if(fingerprintslast != M.ckey) - fingerprintshidden += text("\[[]\]Real name: [], Key: []",time_stamp(), M.real_name, M.key) + fingerprintshidden += text("\[[]\]Real name: [], Key: []", time_stamp(), M.real_name, M.key) fingerprintslast = M.ckey return - -/atom/proc/transfer_fingerprints_to(var/atom/A) - +/atom/proc/transfer_fingerprints_to(atom/A) // Make sure everything are lists. if(!islist(A.fingerprints)) A.fingerprints = list() @@ -544,7 +577,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) /atom/proc/transfer_mob_blood_dna(mob/living/L) var/new_blood_dna = L.get_blood_dna_list() if(!new_blood_dna) - return 0 + return FALSE return transfer_blood_dna(new_blood_dna) /obj/effect/decal/cleanable/blood/splatter/transfer_mob_blood_dna(mob/living/L) @@ -572,14 +605,13 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) var/old_length = blood_DNA.len blood_DNA |= blood_dna if(blood_DNA.len > old_length) - return 1//some new blood DNA was added - + return TRUE//some new blood DNA was added //to add blood from a mob onto something, and transfer their dna info /atom/proc/add_mob_blood(mob/living/M) var/list/blood_dna = M.get_blood_dna_list() if(!blood_dna) - return 0 + return FALSE var/bloodcolor = "#A10808" var/list/b_data = M.get_blood_data(M.get_blood_id()) if(b_data) @@ -589,7 +621,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) //to add blood onto something, with blood dna info to include. /atom/proc/add_blood(list/blood_dna, color) - return 0 + return FALSE /obj/add_blood(list/blood_dna, color) return transfer_blood_dna(blood_dna) @@ -597,10 +629,10 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) /obj/item/add_blood(list/blood_dna, color) var/blood_count = !blood_DNA ? 0 : blood_DNA.len if(!..()) - return 0 + return FALSE if(!blood_count)//apply the blood-splatter overlay if it isn't already in there add_blood_overlay(color) - return 1 //we applied blood to the item + return TRUE //we applied blood to the item /obj/item/clothing/gloves/add_blood(list/blood_dna, color) . = ..() @@ -612,25 +644,25 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) B = new /obj/effect/decal/cleanable/blood/splatter(src) B.transfer_blood_dna(blood_dna) //give blood info to the blood decal. B.basecolor = color - return 1 //we bloodied the floor + return TRUE //we bloodied the floor /mob/living/carbon/human/add_blood(list/blood_dna, color) if(wear_suit) wear_suit.add_blood(blood_dna, color) wear_suit.blood_color = color - update_inv_wear_suit(1) + update_inv_wear_suit() else if(w_uniform) w_uniform.add_blood(blood_dna, color) w_uniform.blood_color = color - update_inv_w_uniform(1) + update_inv_w_uniform() if(head) head.add_blood(blood_dna, color) head.blood_color = color - update_inv_head(0,0) + update_inv_head() if(glasses) glasses.add_blood(blood_dna, color) glasses.blood_color = color - update_inv_glasses(0) + update_inv_glasses() if(gloves) var/obj/item/clothing/gloves/G = gloves G.add_blood(blood_dna, color) @@ -642,8 +674,8 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) transfer_blood_dna(blood_dna) verbs += /mob/living/carbon/human/proc/bloody_doodle - update_inv_gloves(1) //handles bloody hands overlays and updating - return 1 + update_inv_gloves() //handles bloody hands overlays and updating + return TRUE /obj/item/proc/add_blood_overlay(color) if(initial(icon) && initial(icon_state)) @@ -681,7 +713,6 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) if(.) transfer_blood = 0 - /obj/item/clothing/shoes/clean_blood() ..() bloody_shoes = list(BLOOD_STATE_HUMAN = 0, BLOOD_STATE_XENO = 0, BLOOD_STATE_NOT_BLOODY = 0) @@ -690,7 +721,6 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) var/mob/M = loc M.update_inv_shoes() - /mob/living/carbon/human/clean_blood() if(gloves) if(gloves.clean_blood()) @@ -704,9 +734,8 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) update_inv_gloves() update_icons() //apply the now updated overlays to the mob - -/atom/proc/add_vomit_floor(toxvomit = 0, green = FALSE) - playsound(src, 'sound/effects/splat.ogg', 50, 1) +/atom/proc/add_vomit_floor(toxvomit = FALSE, green = FALSE) + playsound(src, 'sound/effects/splat.ogg', 50, TRUE) if(!isspaceturf(src)) var/type = green ? /obj/effect/decal/cleanable/vomit/green : /obj/effect/decal/cleanable/vomit var/vomit_reagent = green ? "green_vomit" : "vomit" @@ -719,23 +748,24 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) // Make toxins vomit look different if(toxvomit) - this.icon_state = "vomittox_[pick(1,4)]" + this.icon_state = "vomittox_[pick(1, 4)]" /atom/proc/get_global_map_pos() - if(!islist(GLOB.global_map) || isemptylist(GLOB.global_map)) return + if(!islist(GLOB.global_map) || isemptylist(GLOB.global_map)) + return var/cur_x = null var/cur_y = null var/list/y_arr = null - for(cur_x=1,cur_x<=GLOB.global_map.len,cur_x++) + for(cur_x in 1 to GLOB.global_map.len) y_arr = GLOB.global_map[cur_x] cur_y = y_arr.Find(src.z) if(cur_y) break // to_chat(world, "X = [cur_x]; Y = [cur_y]") if(cur_x && cur_y) - return list("x"=cur_x,"y"=cur_y) + return list("x" = cur_x, "y" = cur_y) else - return 0 + return null // Used to provide overlays when using this atom as a viewing focus // (cameras, locker tint, etc.) @@ -748,7 +778,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) return /atom/proc/checkpass(passflag) - return pass_flags&passflag + return pass_flags & passflag /atom/proc/isinspace() if(isspaceturf(get_turf(src))) @@ -791,7 +821,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) return audible_message("[src] [atom_say_verb], \"[message]\"") -/atom/proc/speech_bubble(var/bubble_state = "",var/bubble_loc = src, var/list/bubble_recipients = list()) +/atom/proc/speech_bubble(bubble_state = "", bubble_loc = src, list/bubble_recipients = list()) return /atom/vv_edit_var(var_name, var_value) @@ -848,7 +878,6 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) atom_colours[colour_priority] = coloration update_atom_colour() - /* Removes an instance of colour_type from the atom's atom_colours list */ @@ -863,7 +892,6 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) atom_colours[colour_priority] = null update_atom_colour() - /* Resets the atom's color to null, and then sets it to the highest priority colour available diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index ac77d3d4553..b679c8db407 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -233,6 +233,9 @@ SEND_SIGNAL(src, COMSIG_MOVABLE_CROSSED, AM) SEND_SIGNAL(AM, COMSIG_CROSSED_MOVABLE, src) +/atom/movable/Uncrossed(atom/movable/AM) + SEND_SIGNAL(src, COMSIG_MOVABLE_UNCROSSED, AM) + /atom/movable/Bump(atom/A, yes) //the "yes" arg is to differentiate our Bump proc from byond's, without it every Bump() call would become a double Bump(). if(A && yes) SEND_SIGNAL(src, COMSIG_MOVABLE_BUMP, A) @@ -265,15 +268,8 @@ var/dest_z = (destturf ? destturf.z : null) if(old_z != dest_z) onTransitZ(old_z, dest_z) - if(isturf(destination) && opacity) - var/turf/new_loc = destination - new_loc.reconsider_lights() - if(isturf(old_loc) && opacity) - old_loc.reconsider_lights() - - for(var/datum/light_source/L in light_sources) - L.source_atom.update_light() + Moved(old_loc, NONE) return 1 @@ -330,7 +326,6 @@ SSspacedrift.processing[src] = src return 1 - //called when src is thrown into hit_atom /atom/movable/proc/throw_impact(atom/hit_atom, throwingdatum) set waitfor = 0 @@ -501,7 +496,7 @@ target.fingerprintshidden += fingerprintshidden target.fingerprintslast = fingerprintslast -/atom/movable/proc/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) +/atom/movable/proc/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!no_effect && (visual_effect_icon || used_item)) do_item_attack_animation(A, visual_effect_icon, used_item) @@ -509,10 +504,6 @@ return //don't do an animation if attacking self var/pixel_x_diff = 0 var/pixel_y_diff = 0 - var/final_pixel_y = initial(pixel_y) - if(end_pixel_y) - final_pixel_y = end_pixel_y - var/direction = get_dir(src, A) if(direction & NORTH) pixel_y_diff = 8 @@ -525,7 +516,7 @@ pixel_x_diff = -8 animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2) - animate(pixel_x = initial(pixel_x), pixel_y = final_pixel_y, time = 2) + animate(pixel_x = pixel_x - pixel_x_diff, pixel_y = pixel_y - pixel_y_diff, time = 2) /atom/movable/proc/do_item_attack_animation(atom/A, visual_effect_icon, obj/item/used_item) var/image/I diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 08a7b77daff..6bd00d286fe 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -135,8 +135,6 @@ return "health-90" else return "health-100" //past this point, you're just in trouble - return "0" - ///HOOKS @@ -270,7 +268,6 @@ return "crit" else return "dead" - return "dead" //Sillycone hooks /mob/living/silicon/proc/diag_hud_set_health() @@ -400,7 +397,6 @@ return "max" else return "zero" - return "zero" /obj/machinery/hydroponics/proc/plant_hud_set_nutrient() var/image/holder = hud_list[PLANT_NUTRIENT_HUD] diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index ceabae25973..1a92210f570 100644 --- a/code/game/dna/dna2.dm +++ b/code/game/dna/dna2.dm @@ -22,17 +22,17 @@ GLOBAL_LIST_EMPTY(bad_blocks) /datum/dna // READ-ONLY, GETS OVERWRITTEN // DO NOT FUCK WITH THESE OR BYOND WILL EAT YOUR FACE - var/uni_identity="" // Encoded UI - var/struc_enzymes="" // Encoded SE - var/unique_enzymes="" // MD5 of player name + var/uni_identity = "" // Encoded UI + var/struc_enzymes = "" // Encoded SE + var/unique_enzymes = "" // MD5 of player name // Original Encoded SE, for use with Ryetalin - var/struc_enzymes_original="" // Encoded SE + var/struc_enzymes_original = "" // Encoded SE var/list/SE_original[DNA_SE_LENGTH] // Internal dirtiness checks - var/dirtyUI=0 - var/dirtySE=0 + var/dirtyUI = 0 + var/dirtySE = 0 // Okay to read, but you're an idiot if you do. // BLOCK = VALUE @@ -50,10 +50,10 @@ GLOBAL_LIST_EMPTY(bad_blocks) // USE THIS WHEN COPYING STUFF OR YOU'LL GET CORRUPTION! /datum/dna/proc/Clone() var/datum/dna/new_dna = new() - new_dna.unique_enzymes=unique_enzymes - new_dna.struc_enzymes_original=struc_enzymes_original // will make clone's SE the same as the original, do we want this? + new_dna.unique_enzymes = unique_enzymes + new_dna.struc_enzymes_original = struc_enzymes_original // will make clone's SE the same as the original, do we want this? new_dna.blood_type = blood_type - new_dna.real_name=real_name + new_dna.real_name = real_name new_dna.species = new species.type for(var/b=1;b<=DNA_SE_LENGTH;b++) new_dna.SE[b]=SE[b] @@ -68,17 +68,17 @@ GLOBAL_LIST_EMPTY(bad_blocks) /////////////////////////////////////// // Create random UI. -/datum/dna/proc/ResetUI(var/defer=0) +/datum/dna/proc/ResetUI(defer = FALSE) for(var/i=1,i<=DNA_UI_LENGTH,i++) switch(i) if(DNA_UI_SKIN_TONE) - SetUIValueRange(DNA_UI_SKIN_TONE,rand(1,220),220,1) // Otherwise, it gets fucked + SetUIValueRange(DNA_UI_SKIN_TONE, rand(1, 220), 220, 1) // Otherwise, it gets fucked else UI[i]=rand(0,4095) if(!defer) UpdateUI() -/datum/dna/proc/ResetUIFrom(var/mob/living/carbon/human/character) +/datum/dna/proc/ResetUIFrom(mob/living/carbon/human/character) // INITIALIZE! ResetUI(1) // Hair @@ -135,83 +135,90 @@ GLOBAL_LIST_EMPTY(bad_blocks) UpdateUI() // Set a DNA UI block's raw value. -/datum/dna/proc/SetUIValue(var/block,var/value,var/defer=0) - if(block<=0) return - ASSERT(value>0) - ASSERT(value<=4095) +/datum/dna/proc/SetUIValue(block, value, defer = FALSE) + if(block <= 0) + return + ASSERT(value > 0) + ASSERT(value <= 4095) UI[block]=value - dirtyUI=1 + dirtyUI = 1 if(!defer) UpdateUI() // Get a DNA UI block's raw value. -/datum/dna/proc/GetUIValue(var/block) - if(block<=0) return 0 +/datum/dna/proc/GetUIValue(block) + if(block <= 0) + return FALSE return UI[block] // Set a DNA UI block's value, given a value and a max possible value. // Used in hair and facial styles (value being the index and maxvalue being the len of the hairstyle list) -/datum/dna/proc/SetUIValueRange(var/block,var/value,var/maxvalue,var/defer=0) - if(block<=0) +/datum/dna/proc/SetUIValueRange(block, value, maxvalue, defer = FALSE) + if(block <= 0) return if(value == 0) value = 1 - ASSERT(maxvalue<=4095) + ASSERT(maxvalue <= 4095) var/range = (4095 / maxvalue) if(value) - SetUIValue(block,round(value * range),defer) + SetUIValue(block,round(value * range), defer) // Getter version of above. -/datum/dna/proc/GetUIValueRange(var/block,var/maxvalue) - if(block<=0) return 0 +/datum/dna/proc/GetUIValueRange(block, maxvalue) + if(block <= 0) + return FALSE var/value = GetUIValue(block) - return round(1 +(value / 4096)*maxvalue) + return round(1 + (value / 4096) * maxvalue) // Is the UI gene "on" or "off"? // For UI, this is simply a check of if the value is > 2050. -/datum/dna/proc/GetUIState(var/block) - if(block<=0) return +/datum/dna/proc/GetUIState(block) + if(block <= 0) + return return UI[block] > 2050 // Set UI gene "on" (1) or "off" (0) -/datum/dna/proc/SetUIState(var/block,var/on,var/defer=0) - if(block<=0) return +/datum/dna/proc/SetUIState(block, on, defer = FALSE) + if(block <= 0) + return var/val if(on) - val=rand(2050,4095) + val = rand(2050, 4095) else - val=rand(1,2049) - SetUIValue(block,val,defer) + val=rand(1, 2049) + SetUIValue(block, val, defer) // Get a hex-encoded UI block. -/datum/dna/proc/GetUIBlock(var/block) +/datum/dna/proc/GetUIBlock(block) return EncodeDNABlock(GetUIValue(block)) // Do not use this unless you absolutely have to. // Set a block from a hex string. This is inefficient. If you can, use SetUIValue(). // Used in DNA modifiers. -/datum/dna/proc/SetUIBlock(var/block,var/value,var/defer=0) - if(block<=0) return - return SetUIValue(block,hex2num(value),defer) +/datum/dna/proc/SetUIBlock(block, value, defer = FALSE) + if(block <= 0) + return + return SetUIValue(block, hex2num(value), defer) // Get a sub-block from a block. -/datum/dna/proc/GetUISubBlock(var/block,var/subBlock) - return copytext(GetUIBlock(block),subBlock,subBlock+1) +/datum/dna/proc/GetUISubBlock(block, subBlock) + return copytext(GetUIBlock(block), subBlock, subBlock + 1) // Do not use this unless you absolutely have to. // Set a block from a hex string. This is inefficient. If you can, use SetUIValue(). // Used in DNA modifiers. -/datum/dna/proc/SetUISubBlock(var/block,var/subBlock, var/newSubBlock, var/defer=0) - if(block<=0) return - var/oldBlock=GetUIBlock(block) - var/newBlock="" - for(var/i=1, i<=length(oldBlock), i++) +/datum/dna/proc/SetUISubBlock(block, subBlock, newSubBlock, defer = FALSE) + if(block <= 0) + return + var/oldBlock = GetUIBlock(block) + var/newBlock = "" + for(var/i = 1, i <= length(oldBlock), i++) if(i==subBlock) - newBlock+=newSubBlock + newBlock += newSubBlock else - newBlock+=copytext(oldBlock,i,i+1) - SetUIBlock(block,newBlock,defer) + newBlock += copytext(oldBlock, i, i + 1) + SetUIBlock(block, newBlock, defer) /////////////////////////////////////// // STRUCTURAL ENZYMES @@ -220,126 +227,134 @@ GLOBAL_LIST_EMPTY(bad_blocks) // "Zeroes out" all of the blocks. /datum/dna/proc/ResetSE() for(var/i = 1, i <= DNA_SE_LENGTH, i++) - SetSEValue(i,rand(1,1024),1) + SetSEValue(i, rand(1, 1024), 1) UpdateSE() // Set a DNA SE block's raw value. -/datum/dna/proc/SetSEValue(var/block,var/value,var/defer=0) +/datum/dna/proc/SetSEValue(block, value, defer = FALSE) - if(block<=0) return - ASSERT(value>=0) - ASSERT(value<=4095) - SE[block]=value - dirtySE=1 + if(block<=0) + return + ASSERT(value >= 0) + ASSERT(value <= 4095) + SE[block] = value + dirtySE = 1 if(!defer) UpdateSE() //testing("SetSEBlock([block],[value],[defer]): [value] -> [GetSEValue(block)]") // Get a DNA SE block's raw value. -/datum/dna/proc/GetSEValue(var/block) - if(block<=0) return 0 +/datum/dna/proc/GetSEValue(block) + if(block <= 0) + return FALSE return SE[block] // Set a DNA SE block's value, given a value and a max possible value. // Might be used for species? -/datum/dna/proc/SetSEValueRange(var/block,var/value,var/maxvalue) - if(block<=0) return - ASSERT(maxvalue<=4095) +/datum/dna/proc/SetSEValueRange(block, value, maxvalue) + if(block <= 0) + return + ASSERT(maxvalue <= 4095) var/range = round(4095 / maxvalue) if(value) - SetSEValue(block, value * range - rand(1,range-1)) + SetSEValue(block, value * range - rand(1, range - 1)) // Getter version of above. -/datum/dna/proc/GetSEValueRange(var/block,var/maxvalue) - if(block<=0) return 0 +/datum/dna/proc/GetSEValueRange(block, maxvalue) + if(block <= 0) + return FALSE var/value = GetSEValue(block) - return round(1 +(value / 4096)*maxvalue) + return round(1 + (value / 4096) * maxvalue) // Is the block "on" (1) or "off" (0)? (Un-assigned genes are always off.) -/datum/dna/proc/GetSEState(var/block) - if(block<=0) return 0 - var/list/BOUNDS=GetDNABounds(block) - var/value=GetSEValue(block) +/datum/dna/proc/GetSEState(block) + if(block <= 0) + return FALSE + var/list/BOUNDS = GetDNABounds(block) + var/value = GetSEValue(block) return (value >= BOUNDS[DNA_ON_LOWERBOUND]) // Set a block "on" or "off". -/datum/dna/proc/SetSEState(var/block,var/on,var/defer=0) - if(block<=0) return +/datum/dna/proc/SetSEState(block, on, defer = FALSE) + if(block <= 0) + return var/list/BOUNDS=GetDNABounds(block) var/val if(on) - val=rand(BOUNDS[DNA_ON_LOWERBOUND],BOUNDS[DNA_ON_UPPERBOUND]) + val = rand(BOUNDS[DNA_ON_LOWERBOUND], BOUNDS[DNA_ON_UPPERBOUND]) else - val=rand(1,BOUNDS[DNA_OFF_UPPERBOUND]) - SetSEValue(block,val,defer) + val = rand(1, BOUNDS[DNA_OFF_UPPERBOUND]) + SetSEValue(block, val, defer) // Get hex-encoded SE block. -/datum/dna/proc/GetSEBlock(var/block) +/datum/dna/proc/GetSEBlock(block) return EncodeDNABlock(GetSEValue(block)) // Do not use this unless you absolutely have to. // Set a block from a hex string. This is inefficient. If you can, use SetUIValue(). // Used in DNA modifiers. -/datum/dna/proc/SetSEBlock(var/block,var/value,var/defer=0) - if(block<=0) return +/datum/dna/proc/SetSEBlock(block, value, defer = FALSE) + if(block <= 0) + return var/nval=hex2num(value) //testing("SetSEBlock([block],[value],[defer]): [value] -> [nval]") - return SetSEValue(block,nval,defer) + return SetSEValue(block, nval, defer) -/datum/dna/proc/GetSESubBlock(var/block,var/subBlock) - return copytext(GetSEBlock(block),subBlock,subBlock+1) +/datum/dna/proc/GetSESubBlock(block, subBlock) + return copytext(GetSEBlock(block), subBlock, subBlock + 1) // Do not use this unless you absolutely have to. // Set a sub-block from a hex character. This is inefficient. If you can, use SetUIValue(). // Used in DNA modifiers. -/datum/dna/proc/SetSESubBlock(var/block,var/subBlock, var/newSubBlock, var/defer=0) - if(block<=0) return +/datum/dna/proc/SetSESubBlock(block, subBlock, newSubBlock, defer = FALSE) + if(block <= 0) + return var/oldBlock=GetSEBlock(block) - var/newBlock="" - for(var/i=1, i<=length(oldBlock), i++) + var/newBlock = "" + for(var/i = 1, i <= length(oldBlock), i++) if(i==subBlock) newBlock+=newSubBlock else - newBlock+=copytext(oldBlock,i,i+1) + newBlock += copytext(oldBlock, i, i + 1) //testing("SetSESubBlock([block],[subBlock],[newSubBlock],[defer]): [oldBlock] -> [newBlock]") - SetSEBlock(block,newBlock,defer) + SetSEBlock(block, newBlock, defer) -/proc/EncodeDNABlock(var/value) - return add_zero2(num2hex(value,1), 3) +/proc/EncodeDNABlock(value) + return add_zero2(num2hex(value, 1), 3) /datum/dna/proc/UpdateUI() - src.uni_identity="" + uni_identity = "" for(var/block in UI) uni_identity += EncodeDNABlock(block) //testing("New UI: [uni_identity]") - dirtyUI=0 + dirtyUI = 0 /datum/dna/proc/UpdateSE() //var/oldse=struc_enzymes - struc_enzymes="" + struc_enzymes = "" for(var/block in SE) struc_enzymes += EncodeDNABlock(block) //testing("Old SE: [oldse]") //testing("New SE: [struc_enzymes]") - dirtySE=0 + dirtySE = 0 // BACK-COMPAT! // Just checks our character has all the crap it needs. -/datum/dna/proc/check_integrity(var/mob/living/carbon/human/character) +/datum/dna/proc/check_integrity(mob/living/carbon/human/character) if(character) if(UI.len != DNA_UI_LENGTH) ResetUIFrom(character) - if(length(struc_enzymes)!= 3*DNA_SE_LENGTH) + if(length(struc_enzymes)!= 3 * DNA_SE_LENGTH) ResetSE() if(length(unique_enzymes) != 32) unique_enzymes = md5(character.real_name) else - if(length(uni_identity) != 3*DNA_UI_LENGTH) + if(length(uni_identity) != 3 * DNA_UI_LENGTH) uni_identity = "00600200A00E0110148FC01300B0095BD7FD3F4" - if(length(struc_enzymes)!= 3*DNA_SE_LENGTH) + if(length(struc_enzymes)!= 3 * DNA_SE_LENGTH) struc_enzymes = "43359156756131E13763334D1C369012032164D4FE4CD61544B6C03F251B6C60A42821D26BA3B0FD6" // BACK-COMPAT! diff --git a/code/game/dna/dna2_domutcheck.dm b/code/game/dna/dna2_domutcheck.dm index 0091745c518..16eee549bf2 100644 --- a/code/game/dna/dna2_domutcheck.dm +++ b/code/game/dna/dna2_domutcheck.dm @@ -3,7 +3,7 @@ // M: Mob to mess with // connected: Machine we're in, type unchecked so I doubt it's used beyond monkeying // flags: See below, bitfield. -/proc/domutcheck(var/mob/living/M, var/connected=null, var/flags=0) +/proc/domutcheck(mob/living/M, connected = null, flags = 0) for(var/datum/dna/gene/gene in GLOB.dna_genes) if(!M || !M.dna) return @@ -13,7 +13,7 @@ domutation(gene, M, connected, flags) // Use this to force a mut check on a single gene! -/proc/genemutcheck(var/mob/living/M, var/block, var/connected=null, var/flags=0) +/proc/genemutcheck(mob/living/M, block, connected = null, flags = 0) if(ishuman(M)) // Would've done this via species instead of type, but the basic mob doesn't have a species, go figure. var/mob/living/carbon/human/H = M if(NO_DNA in H.dna.species.species_traits) @@ -27,9 +27,9 @@ domutation(gene, M, connected, flags) -/proc/domutation(var/datum/dna/gene/gene, var/mob/living/M, var/connected=null, var/flags=0) +/proc/domutation(datum/dna/gene/gene, mob/living/M, connected = null, flags = 0) if(!gene || !istype(gene)) - return 0 + return FALSE // Current state var/gene_active = M.dna.GetSEState(gene.block) @@ -37,7 +37,7 @@ // Sanity checks, don't skip. if(!gene.can_activate(M,flags) && gene_active) //testing("[M] - Failed to activate [gene.name] (can_activate fail).") - return 0 + return FALSE var/defaultgenes // Do not mutate inherent species abilities if(ishuman(M)) diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index 1857848c2c9..435133a3796 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -9,58 +9,61 @@ t = "0[t]" temp1 = t if(length(t) > u) - temp1 = copytext(t,2,u+1) + temp1 = copytext(t, 2, u + 1) return temp1 // DNA Gene activation boundaries, see dna2.dm. // Returns a list object with 4 numbers. -/proc/GetDNABounds(var/block) - var/list/BOUNDS=GLOB.dna_activity_bounds[block] +/proc/GetDNABounds(block) + var/list/BOUNDS = GLOB.dna_activity_bounds[block] if(!istype(BOUNDS)) return DNA_DEFAULT_BOUNDS return BOUNDS // Give Random Bad Mutation to M -/proc/randmutb(var/mob/living/M) - if(!M || !M.dna) return +/proc/randmutb(mob/living/M) + if(!M || !M.dna) + return M.dna.check_integrity() var/block = pick(GLOB.bad_blocks) M.dna.SetSEState(block, 1) // Give Random Good Mutation to M -/proc/randmutg(var/mob/living/M) - if(!M || !M.dna) return +/proc/randmutg(mob/living/M) + if(!M || !M.dna) + return M.dna.check_integrity() var/block = pick(GLOB.good_blocks) M.dna.SetSEState(block, 1) // Random Appearance Mutation -/proc/randmuti(var/mob/living/M) - if(!M || !M.dna) return +/proc/randmuti(mob/living/M) + if(!M || !M.dna) + return M.dna.check_integrity() - M.dna.SetUIValue(rand(1,DNA_UI_LENGTH),rand(1,4095)) + M.dna.SetUIValue(rand(1, DNA_UI_LENGTH), rand(1, 4095)) // Scramble UI or SE. -/proc/scramble(var/UI, var/mob/M, var/prob) - if(!M || !M.dna) return +/proc/scramble(UI, mob/M, prob) + if(!M || !M.dna) + return M.dna.check_integrity() if(UI) - for(var/i = 1, i <= DNA_UI_LENGTH-1, i++) + for(var/i = 1, i <= DNA_UI_LENGTH - 1, i++) if(prob(prob)) - M.dna.SetUIValue(i,rand(1,4095),1) + M.dna.SetUIValue(i, rand(1, 4095), 1) M.dna.UpdateUI() M.UpdateAppearance() else - for(var/i = 1, i <= DNA_SE_LENGTH-1, i++) + for(var/i = 1, i <= DNA_SE_LENGTH - 1, i++) if(prob(prob)) - M.dna.SetSEValue(i,rand(1,4095),1) + M.dna.SetSEValue(i, rand(1, 4095), 1) M.dna.UpdateSE() domutcheck(M, null) - return // I haven't yet figured out what the fuck this is supposed to do. -/proc/miniscramble(input,rs,rd) +/proc/miniscramble(input, rs, rd) var/output output = null if(input == "C" || input == "D" || input == "E" || input == "F") @@ -79,7 +82,7 @@ // input: YOUR TARGET // rs: RAD STRENGTH // rd: DURATION -/proc/miniscrambletarget(input,rs,rd) +/proc/miniscrambletarget(input, rs, rd) var/output = null switch(input) if("0") @@ -124,11 +127,11 @@ // Use mob.UpdateAppearance() instead. // Simpler. Don't specify UI in order for the mob to use its own. -/mob/proc/UpdateAppearance(var/list/UI=null) - if(istype(src, /mob/living/carbon/human)) +/mob/proc/UpdateAppearance(list/UI = null) + if(istype(src, /mob/living/carbon/human)) // WHY?! if(UI!=null) - src.dna.UI=UI - src.dna.UpdateUI() + dna.UI = UI + dna.UpdateUI() dna.check_integrity() var/mob/living/carbon/human/H = src var/obj/item/organ/external/head/head_organ = H.get_organ("head") @@ -169,9 +172,9 @@ H.regenerate_icons() - return 1 + return TRUE else - return 0 + return FALSE /* ORGAN WRITING PROCS @@ -219,9 +222,9 @@ // In absence of eyes, possibly randomize the eye color DNA? return - SetUIValueRange(DNA_UI_EYES_R, color2R(eyes_organ.eye_colour), 255, 1) - SetUIValueRange(DNA_UI_EYES_G, color2G(eyes_organ.eye_colour), 255, 1) - SetUIValueRange(DNA_UI_EYES_B, color2B(eyes_organ.eye_colour), 255, 1) + SetUIValueRange(DNA_UI_EYES_R, color2R(eyes_organ.eye_colour), 255, 1) + SetUIValueRange(DNA_UI_EYES_G, color2G(eyes_organ.eye_colour), 255, 1) + SetUIValueRange(DNA_UI_EYES_B, color2B(eyes_organ.eye_colour), 255, 1) /datum/dna/proc/head_traits_to_dna(obj/item/organ/external/head/head_organ) if(!head_organ) @@ -241,26 +244,26 @@ head_organ.ha_style = "None" var/headacc = GLOB.head_accessory_styles_list.Find(head_organ.ha_style) - SetUIValueRange(DNA_UI_HAIR_R, color2R(head_organ.hair_colour), 255, 1) - SetUIValueRange(DNA_UI_HAIR_G, color2G(head_organ.hair_colour), 255, 1) - SetUIValueRange(DNA_UI_HAIR_B, color2B(head_organ.hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR_R, color2R(head_organ.hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR_G, color2G(head_organ.hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR_B, color2B(head_organ.hair_colour), 255, 1) - SetUIValueRange(DNA_UI_HAIR2_R, color2R(head_organ.sec_hair_colour), 255, 1) - SetUIValueRange(DNA_UI_HAIR2_G, color2G(head_organ.sec_hair_colour), 255, 1) - SetUIValueRange(DNA_UI_HAIR2_B, color2B(head_organ.sec_hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR2_R, color2R(head_organ.sec_hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR2_G, color2G(head_organ.sec_hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR2_B, color2B(head_organ.sec_hair_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD_R, color2R(head_organ.facial_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD_G, color2G(head_organ.facial_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD_B, color2B(head_organ.facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD_R, color2R(head_organ.facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD_G, color2G(head_organ.facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD_B, color2B(head_organ.facial_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD2_R, color2R(head_organ.sec_facial_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD2_G, color2G(head_organ.sec_facial_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD2_B, color2B(head_organ.sec_facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD2_R, color2R(head_organ.sec_facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD2_G, color2G(head_organ.sec_facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD2_B, color2B(head_organ.sec_facial_colour), 255, 1) - SetUIValueRange(DNA_UI_HACC_R, color2R(head_organ.headacc_colour), 255, 1) - SetUIValueRange(DNA_UI_HACC_G, color2G(head_organ.headacc_colour), 255, 1) - SetUIValueRange(DNA_UI_HACC_B, color2B(head_organ.headacc_colour), 255, 1) + SetUIValueRange(DNA_UI_HACC_R, color2R(head_organ.headacc_colour), 255, 1) + SetUIValueRange(DNA_UI_HACC_G, color2G(head_organ.headacc_colour), 255, 1) + SetUIValueRange(DNA_UI_HACC_B, color2B(head_organ.headacc_colour), 255, 1) - SetUIValueRange(DNA_UI_HAIR_STYLE, hair, GLOB.hair_styles_full_list.len, 1) - SetUIValueRange(DNA_UI_BEARD_STYLE, beard, GLOB.facial_hair_styles_list.len, 1) - SetUIValueRange(DNA_UI_HACC_STYLE, headacc, GLOB.head_accessory_styles_list.len, 1) + SetUIValueRange(DNA_UI_HAIR_STYLE, hair, GLOB.hair_styles_full_list.len, 1) + SetUIValueRange(DNA_UI_BEARD_STYLE, beard, GLOB.facial_hair_styles_list.len, 1) + SetUIValueRange(DNA_UI_HACC_STYLE, headacc, GLOB.head_accessory_styles_list.len, 1) diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index c06dc24c545..a6ec98e8866 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -10,15 +10,15 @@ //list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0), /datum/dna2/record var/datum/dna/dna = null - var/types=0 - var/name="Empty" + var/types = 0 + var/name = "Empty" // Stuff for cloners - var/id=null - var/implant=null - var/ckey=null - var/mind=null - var/languages=null + var/id = null + var/implant = null + var/ckey = null + var/mind = null + var/languages = null /datum/dna2/record/proc/GetData() var/list/ser=list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0) @@ -28,7 +28,7 @@ ser["data"] = dna.SE else ser["data"] = dna.UI - ser["owner"] = src.dna.real_name + ser["owner"] = dna.real_name ser["label"] = name if(types & DNA2_BUF_UI) ser["type"] = "ui" @@ -54,13 +54,13 @@ desc = "It scans DNA structures." icon = 'icons/obj/cryogenic2.dmi' icon_state = "scanner_open" - density = 1 - anchored = 1.0 + density = TRUE + anchored = TRUE use_power = IDLE_POWER_USE idle_power_usage = 50 active_power_usage = 300 interact_offline = 1 - var/locked = 0 + var/locked = FALSE var/mob/living/carbon/occupant = null var/obj/item/reagent_containers/glass/beaker = null var/opened = 0 @@ -106,31 +106,29 @@ /obj/machinery/dna_scannernew/AllowDrop() return FALSE -/obj/machinery/dna_scannernew/relaymove(mob/user as mob) +/obj/machinery/dna_scannernew/relaymove(mob/user) if(user.stat) return - src.go_out() - return + go_out() /obj/machinery/dna_scannernew/verb/eject() set src in oview(1) set category = null set name = "Eject DNA Scanner" - if(usr.stat != 0) + if(usr.incapacitated()) return eject_occupant() add_fingerprint(usr) - return /obj/machinery/dna_scannernew/Destroy() eject_occupant() return ..() /obj/machinery/dna_scannernew/proc/eject_occupant() - src.go_out() + go_out() for(var/obj/O in src) if(!istype(O,/obj/item/circuitboard/clonescanner) && \ !istype(O,/obj/item/stock_parts) && \ @@ -146,14 +144,12 @@ set category = null set name = "Enter DNA Scanner" - if(usr.stat != 0) - return if(usr.incapacitated()) //are you cuffed, dying, lying, stunned or other return if(!ishuman(usr)) //Make sure they're a mob that has dna to_chat(usr, "Try as you might, you can not climb up into the [src].") return - if(src.occupant) + if(occupant) to_chat(usr, "The [src] is already occupied!") return if(usr.abiotic()) @@ -164,12 +160,11 @@ return usr.stop_pulling() usr.forceMove(src) - src.occupant = usr - src.icon_state = "scanner_occupied" - src.add_fingerprint(usr) - return + occupant = usr + icon_state = "scanner_occupied" + add_fingerprint(usr) -/obj/machinery/dna_scannernew/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob) +/obj/machinery/dna_scannernew/MouseDrop_T(atom/movable/O, mob/user) if(!istype(O)) return if(O.loc == user) //no you can't pull things out of your ass @@ -208,27 +203,27 @@ if(user.pulling == L) user.stop_pulling() -/obj/machinery/dna_scannernew/attackby(var/obj/item/item as obj, var/mob/user as mob, params) - if(exchange_parts(user, item)) +/obj/machinery/dna_scannernew/attackby(obj/item/I, mob/user, params) + if(exchange_parts(user, I)) return - else if(istype(item, /obj/item/reagent_containers/glass)) + else if(istype(I, /obj/item/reagent_containers/glass)) if(beaker) to_chat(user, "A beaker is already loaded into the machine.") return if(!user.drop_item()) - to_chat(user, "\The [item] is stuck to you!") + to_chat(user, "\The [I] is stuck to you!") return - beaker = item - item.forceMove(src) - user.visible_message("[user] adds \a [item] to \the [src]!", "You add \a [item] to \the [src]!") + beaker = I + I.forceMove(src) + user.visible_message("[user] adds \a [I] to \the [src]!", "You add \a [I] to \the [src]!") return - if(istype(item, /obj/item/grab)) - var/obj/item/grab/G = item + if(istype(I, /obj/item/grab)) + var/obj/item/grab/G = I if(!ismob(G.affecting)) return - if(src.occupant) + if(occupant) to_chat(user, "The scanner is already occupied!") return if(G.affecting.abiotic()) @@ -241,7 +236,7 @@ to_chat(usr, "Close the maintenance panel first.") return put_in(G.affecting) - src.add_fingerprint(user) + add_fingerprint(user) qdel(G) return return ..() @@ -249,7 +244,7 @@ /obj/machinery/dna_scannernew/crowbar_act(mob/user, obj/item/I) if(default_deconstruction_crowbar(user, I)) for(var/obj/thing in contents) // in case there is something in the scanner - thing.forceMove(src.loc) + thing.forceMove(loc) /obj/machinery/dna_scannernew/screwdriver_act(mob/user, obj/item/I) if(occupant) @@ -258,15 +253,15 @@ if(default_deconstruction_screwdriver(user, "[icon_state]_maintenance", "[initial(icon_state)]", I)) return TRUE -/obj/machinery/dna_scannernew/relaymove(mob/user as mob) +/obj/machinery/dna_scannernew/relaymove(mob/user) if(user.incapacitated()) - return 0 //maybe they should be able to get out with cuffs, but whatever + return FALSE //maybe they should be able to get out with cuffs, but whatever go_out() -/obj/machinery/dna_scannernew/proc/put_in(var/mob/M) +/obj/machinery/dna_scannernew/proc/put_in(mob/M) M.forceMove(src) - src.occupant = M - src.icon_state = "scanner_occupied" + occupant = M + icon_state = "scanner_occupied" // search for ghosts, if the corpse is empty and the scanner is connected to a cloner if(locate(/obj/machinery/computer/cloning, get_step(src, NORTH)) \ @@ -275,20 +270,19 @@ || locate(/obj/machinery/computer/cloning, get_step(src, WEST))) occupant.notify_ghost_cloning(source = src) - return /obj/machinery/dna_scannernew/proc/go_out() - if(!src.occupant) + if(!occupant) to_chat(usr, "The scanner is empty!") return - if(src.locked) + if(locked) to_chat(usr, "The scanner is locked!") return - src.occupant.forceMove(src.loc) - src.occupant = null - src.icon_state = "scanner_open" + occupant.forceMove(loc) + occupant = null + icon_state = "scanner_open" /obj/machinery/dna_scannernew/ex_act(severity) if(occupant) @@ -305,18 +299,17 @@ // Checks if occupants can be irradiated/mutated - prevents exploits where wearing full rad protection would still let you gain mutations /obj/machinery/dna_scannernew/proc/radiation_check() if(!occupant) - return 1 + return TRUE if(ishuman(occupant)) var/mob/living/carbon/human/H = occupant if(NO_DNA in H.dna.species.species_traits) - return 1 + return TRUE var/radiation_protection = occupant.run_armor_check(null, "rad", "Your clothes feel warm.", "Your clothes feel warm.") if(radiation_protection > NEGATE_MUTATION_THRESHOLD) - return 1 - - return 0 + return TRUE + return FALSE /obj/machinery/computer/scan_consolenew name = "\improper DNA Modifier access console" @@ -324,7 +317,7 @@ icon = 'icons/obj/computer.dmi' icon_screen = "dna" icon_keyboard = "med_key" - density = 1 + density = TRUE circuit = /obj/item/circuitboard/scan_consolenew var/selected_ui_block = 1.0 var/selected_ui_subblock = 1.0 @@ -336,22 +329,22 @@ var/radiation_intensity = 1.0 var/list/datum/dna2/record/buffers[3] var/irradiating = 0 - var/injector_ready = 0 //Quick fix for issue 286 (screwdriver the screen twice to restore injector) -Pete + var/injector_ready = FALSE //Quick fix for issue 286 (screwdriver the screen twice to restore injector) -Pete var/obj/machinery/dna_scannernew/connected = null var/obj/item/disk/data/disk = null var/selected_menu_key = null - anchored = 1 + anchored = TRUE use_power = IDLE_POWER_USE idle_power_usage = 10 active_power_usage = 400 - var/waiting_for_user_input=0 // Fix for #274 (Mash create block injector without answering dialog to make unlimited injectors) - N3X + var/waiting_for_user_input = 0 // Fix for #274 (Mash create block injector without answering dialog to make unlimited injectors) - N3X -/obj/machinery/computer/scan_consolenew/attackby(obj/item/I as obj, mob/user as mob, params) +/obj/machinery/computer/scan_consolenew/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/disk/data)) //INSERT SOME diskS - if(!src.disk) + if(!disk) user.drop_item() I.forceMove(src) - src.disk = I + disk = I to_chat(user, "You insert [I].") SSnanoui.update_uis(src) // update all UIs attached to src() return @@ -368,39 +361,30 @@ if(!isnull(connected)) break spawn(250) - src.injector_ready = 1 - return - return + injector_ready = TRUE -/obj/machinery/computer/scan_consolenew/proc/all_dna_blocks(var/list/buffer) +/obj/machinery/computer/scan_consolenew/proc/all_dna_blocks(list/buffer) var/list/arr = list() for(var/i = 1, i <= buffer.len, i++) arr += "[i]:[EncodeDNABlock(buffer[i])]" return arr -/obj/machinery/computer/scan_consolenew/proc/setInjectorBlock(var/obj/item/dnainjector/I, var/blk, var/datum/dna2/record/buffer) +/obj/machinery/computer/scan_consolenew/proc/setInjectorBlock(obj/item/dnainjector/I, blk, datum/dna2/record/buffer) var/pos = findtext(blk,":") - if(!pos) return 0 + if(!pos) + return FALSE var/id = text2num(copytext(blk,1,pos)) - if(!id) return 0 + if(!id) + return FALSE I.block = id I.buf = buffer - return 1 + return TRUE -/* -/obj/machinery/computer/scan_consolenew/process() //not really used right now - if(stat & (NOPOWER|BROKEN)) - return - if(!( src.status )) //remove this - return - return -*/ - -/obj/machinery/computer/scan_consolenew/attack_ai(user as mob) - src.add_hiddenprint(user) +/obj/machinery/computer/scan_consolenew/attack_ai(mob/user) + add_hiddenprint(user) attack_hand(user) -/obj/machinery/computer/scan_consolenew/attack_hand(user as mob) +/obj/machinery/computer/scan_consolenew/attack_hand(mob/user) if(isnull(connected)) for(dir in list(NORTH,EAST,SOUTH,WEST)) connected = locate(/obj/machinery/dna_scannernew, get_step(src, dir)) @@ -427,7 +411,7 @@ * * @return nothing */ -/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) +/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1) if(user == connected.occupant) return @@ -445,7 +429,7 @@ /obj/machinery/computer/scan_consolenew/ui_data(mob/user, datum/topic_state/state) var/data[0] data["selectedMenuKey"] = selected_menu_key - data["locked"] = src.connected.locked + data["locked"] = connected.locked data["hasOccupant"] = connected.occupant ? 1 : 0 data["isInjectorReady"] = injector_ready @@ -464,7 +448,7 @@ data["disk"] = diskData var/list/new_buffers = list() - for(var/datum/dna2/record/buf in src.buffers) + for(var/datum/dna2/record/buf in buffers) new_buffers += list(buf.GetData()) data["buffers"]=new_buffers @@ -481,7 +465,7 @@ data["selectedUITargetHex"] = selected_ui_target_hex var/occupantData[0] - if(!src.connected.occupant || !src.connected.occupant.dna) + if(!connected.occupant || !connected.occupant.dna) occupantData["name"] = null occupantData["stat"] = null occupantData["isViableSubject"] = null @@ -496,7 +480,7 @@ occupantData["name"] = connected.occupant.dna.real_name occupantData["stat"] = connected.occupant.stat occupantData["isViableSubject"] = 1 - if((NOCLONE in connected.occupant.mutations && connected.scan_level < 3) || !src.connected.occupant.dna || (NO_DNA in connected.occupant.dna.species.species_traits)) + if((NOCLONE in connected.occupant.mutations && connected.scan_level < 3) || !connected.occupant.dna || (NO_DNA in connected.occupant.dna.species.species_traits)) occupantData["isViableSubject"] = 0 occupantData["health"] = connected.occupant.health occupantData["maxHealth"] = connected.occupant.maxHealth @@ -520,173 +504,173 @@ /obj/machinery/computer/scan_consolenew/Topic(href, href_list) if(..()) - return 0 // don't update uis + return FALSE // don't update uis if(!istype(usr.loc, /turf)) - return 0 // don't update uis - if(!src || !src.connected) - return 0 // don't update uis + return FALSE // don't update uis + if(!src || !connected) + return FALSE // don't update uis if(irradiating) // Make sure that it isn't already irradiating someone... - return 0 // don't update uis + return FALSE // don't update uis add_fingerprint(usr) if(href_list["selectMenuKey"]) selected_menu_key = href_list["selectMenuKey"] - return 1 // return 1 forces an update to all Nano uis attached to src + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["toggleLock"]) - if((src.connected && src.connected.occupant)) - src.connected.locked = !( src.connected.locked ) - return 1 // return 1 forces an update to all Nano uis attached to src + if((connected && connected.occupant)) + connected.locked = !(connected.locked) + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["pulseRadiation"]) - irradiating = src.radiation_duration - var/lock_state = src.connected.locked - src.connected.locked = 1//lock it + irradiating = radiation_duration + var/lock_state = connected.locked + connected.locked = TRUE //lock it SSnanoui.update_uis(src) // update all UIs attached to src - sleep(10*src.radiation_duration) // sleep for radiation_duration seconds + sleep(10 * radiation_duration) // sleep for radiation_duration seconds irradiating = 0 - src.connected.locked = lock_state + connected.locked = lock_state - if(!src.connected.occupant) - return 1 // return 1 forces an update to all Nano uis attached to src + if(!connected.occupant) + return TRUE // return 1 forces an update to all Nano uis attached to src - var/radiation = (((src.radiation_intensity*3)+src.radiation_duration*3) / connected.damage_coeff) - src.connected.occupant.apply_effect(radiation,IRRADIATE,0) - if(src.connected.radiation_check()) - return 1 + var/radiation = (((radiation_intensity * 3) + radiation_duration * 3) / connected.damage_coeff) + connected.occupant.apply_effect(radiation, IRRADIATE, 0) + if(connected.radiation_check()) + return TRUE if(prob(95)) if(prob(75)) - randmutb(src.connected.occupant) + randmutb(connected.occupant) else - randmuti(src.connected.occupant) + randmuti(connected.occupant) else if(prob(95)) - randmutg(src.connected.occupant) + randmutg(connected.occupant) else - randmuti(src.connected.occupant) + randmuti(connected.occupant) - return 1 // return 1 forces an update to all Nano uis attached to src + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["radiationDuration"]) if(text2num(href_list["radiationDuration"]) > 0) - if(src.radiation_duration < 20) - src.radiation_duration += 2 + if(radiation_duration < 20) + radiation_duration += 2 else - if(src.radiation_duration > 2) - src.radiation_duration -= 2 - return 1 // return 1 forces an update to all Nano uis attached to src + if(radiation_duration > 2) + radiation_duration -= 2 + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["radiationIntensity"]) if(text2num(href_list["radiationIntensity"]) > 0) - if(src.radiation_intensity < 10) - src.radiation_intensity++ + if(radiation_intensity < 10) + radiation_intensity++ else - if(src.radiation_intensity > 1) - src.radiation_intensity-- - return 1 // return 1 forces an update to all Nano uis attached to src + if(radiation_intensity > 1) + radiation_intensity-- + return TRUE // return 1 forces an update to all Nano uis attached to src //////////////////////////////////////////////////////// if(href_list["changeUITarget"] && text2num(href_list["changeUITarget"]) > 0) - if(src.selected_ui_target < 15) - src.selected_ui_target++ - src.selected_ui_target_hex = src.selected_ui_target + if(selected_ui_target < 15) + selected_ui_target++ + selected_ui_target_hex = selected_ui_target switch(selected_ui_target) if(10) - src.selected_ui_target_hex = "A" + selected_ui_target_hex = "A" if(11) - src.selected_ui_target_hex = "B" + selected_ui_target_hex = "B" if(12) - src.selected_ui_target_hex = "C" + selected_ui_target_hex = "C" if(13) - src.selected_ui_target_hex = "D" + selected_ui_target_hex = "D" if(14) - src.selected_ui_target_hex = "E" + selected_ui_target_hex = "E" if(15) - src.selected_ui_target_hex = "F" + selected_ui_target_hex = "F" else - src.selected_ui_target = 0 - src.selected_ui_target_hex = 0 - return 1 // return 1 forces an update to all Nano uis attached to src + selected_ui_target = 0 + selected_ui_target_hex = 0 + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["changeUITarget"] && text2num(href_list["changeUITarget"]) < 1) - if(src.selected_ui_target > 0) - src.selected_ui_target-- - src.selected_ui_target_hex = src.selected_ui_target + if(selected_ui_target > 0) + selected_ui_target-- + selected_ui_target_hex = selected_ui_target switch(selected_ui_target) if(10) - src.selected_ui_target_hex = "A" + selected_ui_target_hex = "A" if(11) - src.selected_ui_target_hex = "B" + selected_ui_target_hex = "B" if(12) - src.selected_ui_target_hex = "C" + selected_ui_target_hex = "C" if(13) - src.selected_ui_target_hex = "D" + selected_ui_target_hex = "D" if(14) - src.selected_ui_target_hex = "E" + selected_ui_target_hex = "E" else - src.selected_ui_target = 15 - src.selected_ui_target_hex = "F" - return 1 // return 1 forces an update to all Nano uis attached to src + selected_ui_target = 15 + selected_ui_target_hex = "F" + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["selectUIBlock"] && href_list["selectUISubblock"]) // This chunk of code updates selected block / sub-block based on click var/select_block = text2num(href_list["selectUIBlock"]) var/select_subblock = text2num(href_list["selectUISubblock"]) if((select_block <= DNA_UI_LENGTH) && (select_block >= 1)) - src.selected_ui_block = select_block + selected_ui_block = select_block if((select_subblock <= DNA_BLOCK_SIZE) && (select_subblock >= 1)) - src.selected_ui_subblock = select_subblock - return 1 // return 1 forces an update to all Nano uis attached to src + selected_ui_subblock = select_subblock + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["pulseUIRadiation"]) - var/block = src.connected.occupant.dna.GetUISubBlock(src.selected_ui_block,src.selected_ui_subblock) + var/block = connected.occupant.dna.GetUISubBlock(selected_ui_block, selected_ui_subblock) - irradiating = src.radiation_duration - var/lock_state = src.connected.locked - src.connected.locked = 1//lock it + irradiating = radiation_duration + var/lock_state = connected.locked + connected.locked = TRUE //lock it SSnanoui.update_uis(src) // update all UIs attached to src - sleep(10*src.radiation_duration) // sleep for radiation_duration seconds + sleep(10 * radiation_duration) // sleep for radiation_duration seconds irradiating = 0 - src.connected.locked = lock_state + connected.locked = lock_state - if(!src.connected.occupant) - return 1 + if(!connected.occupant) + return TRUE - if(prob((80 + (src.radiation_duration / 2)))) - var/radiation = (src.radiation_intensity+src.radiation_duration) - src.connected.occupant.apply_effect(radiation,IRRADIATE,0) + if(prob((80 + (radiation_duration / 2)))) + var/radiation = (radiation_intensity + radiation_duration) + connected.occupant.apply_effect(radiation,IRRADIATE,0) - if(src.connected.radiation_check()) - return 1 + if(connected.radiation_check()) + return TRUE - block = miniscrambletarget(num2text(selected_ui_target), src.radiation_intensity, src.radiation_duration) - src.connected.occupant.dna.SetUISubBlock(src.selected_ui_block,src.selected_ui_subblock,block) - src.connected.occupant.UpdateAppearance() + block = miniscrambletarget(num2text(selected_ui_target), radiation_intensity, radiation_duration) + connected.occupant.dna.SetUISubBlock(selected_ui_block, selected_ui_subblock, block) + connected.occupant.UpdateAppearance() else - var/radiation = ((src.radiation_intensity*2)+src.radiation_duration) - src.connected.occupant.apply_effect(radiation,IRRADIATE,0) - if(src.connected.radiation_check()) - return 1 + var/radiation = ((radiation_intensity * 2) + radiation_duration) + connected.occupant.apply_effect(radiation, IRRADIATE, 0) + if(connected.radiation_check()) + return TRUE - if(prob(20+src.radiation_intensity)) - randmutb(src.connected.occupant) - domutcheck(src.connected.occupant,src.connected) + if(prob(20 + radiation_intensity)) + randmutb(connected.occupant) + domutcheck(connected.occupant, connected) else - randmuti(src.connected.occupant) - src.connected.occupant.UpdateAppearance() - return 1 // return 1 forces an update to all Nano uis attached to src + randmuti(connected.occupant) + connected.occupant.UpdateAppearance() + return TRUE // return 1 forces an update to all Nano uis attached to src //////////////////////////////////////////////////////// if(href_list["injectRejuvenators"]) if(!connected.occupant) - return 0 + return FALSE var/inject_amount = round(text2num(href_list["injectRejuvenators"]), 5) // round to nearest 5 if(inject_amount < 0) // Since the user can actually type the commands himself, some sanity checking inject_amount = 0 @@ -694,7 +678,7 @@ inject_amount = 50 connected.beaker.reagents.trans_to(connected.occupant, inject_amount) connected.beaker.reagents.reaction(connected.occupant) - return 1 // return 1 forces an update to all Nano uis attached to src + return TRUE // return 1 forces an update to all Nano uis attached to src //////////////////////////////////////////////////////// @@ -702,73 +686,73 @@ var/select_block = text2num(href_list["selectSEBlock"]) var/select_subblock = text2num(href_list["selectSESubblock"]) if((select_block <= DNA_SE_LENGTH) && (select_block >= 1)) - src.selected_se_block = select_block + selected_se_block = select_block if((select_subblock <= DNA_BLOCK_SIZE) && (select_subblock >= 1)) - src.selected_se_subblock = select_subblock + selected_se_subblock = select_subblock //testing("User selected block [selected_se_block] (sent [select_block]), subblock [selected_se_subblock] (sent [select_block]).") - return 1 // return 1 forces an update to all Nano uis attached to src + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["pulseSERadiation"]) - var/block = src.connected.occupant.dna.GetSESubBlock(src.selected_se_block,src.selected_se_subblock) + var/block = connected.occupant.dna.GetSESubBlock(selected_se_block, selected_se_subblock) //var/original_block=block - //testing("Irradiating SE block [src.selected_se_block]:[src.selected_se_subblock] ([block])...") + //testing("Irradiating SE block [selected_se_block]:[selected_se_subblock] ([block])...") - irradiating = src.radiation_duration - var/lock_state = src.connected.locked - src.connected.locked = 1 //lock it + irradiating = radiation_duration + var/lock_state = connected.locked + connected.locked = TRUE //lock it SSnanoui.update_uis(src) // update all UIs attached to src - sleep(10*src.radiation_duration) // sleep for radiation_duration seconds + sleep(10 * radiation_duration) // sleep for radiation_duration seconds irradiating = 0 - src.connected.locked = lock_state + connected.locked = lock_state - if(src.connected.occupant) - if(prob((80 + ((src.radiation_duration / 2) + (connected.precision_coeff ** 3))))) - var/radiation = ((src.radiation_intensity+src.radiation_duration) / connected.damage_coeff) - src.connected.occupant.apply_effect(radiation,IRRADIATE,0) + if(connected.occupant) + if(prob((80 + ((radiation_duration / 2) + (connected.precision_coeff ** 3))))) + var/radiation = ((radiation_intensity + radiation_duration) / connected.damage_coeff) + connected.occupant.apply_effect(radiation, IRRADIATE, 0) - if(src.connected.radiation_check()) + if(connected.radiation_check()) return 1 var/real_SE_block=selected_se_block - block = miniscramble(block, src.radiation_intensity, src.radiation_duration) + block = miniscramble(block, radiation_intensity, radiation_duration) if(prob(20)) - if(src.selected_se_block > 1 && src.selected_se_block < DNA_SE_LENGTH/2) + if(selected_se_block > 1 && selected_se_block < DNA_SE_LENGTH/2) real_SE_block++ - else if(src.selected_se_block > DNA_SE_LENGTH/2 && src.selected_se_block < DNA_SE_LENGTH) + else if(selected_se_block > DNA_SE_LENGTH/2 && selected_se_block < DNA_SE_LENGTH) real_SE_block-- - //testing("Irradiated SE block [real_SE_block]:[src.selected_se_subblock] ([original_block] now [block]) [(real_SE_block!=selected_se_block) ? "(SHIFTED)":""]!") - connected.occupant.dna.SetSESubBlock(real_SE_block,selected_se_subblock,block) - domutcheck(src.connected.occupant,src.connected) + //testing("Irradiated SE block [real_SE_block]:[selected_se_subblock] ([original_block] now [block]) [(real_SE_block!=selected_se_block) ? "(SHIFTED)":""]!") + connected.occupant.dna.SetSESubBlock(real_SE_block, selected_se_subblock, block) + domutcheck(connected.occupant, connected) else - var/radiation = (((src.radiation_intensity*2)+src.radiation_duration) / connected.damage_coeff) - src.connected.occupant.apply_effect(radiation,IRRADIATE,0) + var/radiation = (((radiation_intensity * 2) + radiation_duration) / connected.damage_coeff) + connected.occupant.apply_effect(radiation, IRRADIATE, 0) - if(src.connected.radiation_check()) + if(connected.radiation_check()) return 1 - if(prob(80-src.radiation_duration)) + if(prob(80 - radiation_duration)) //testing("Random bad mut!") - randmutb(src.connected.occupant) - domutcheck(src.connected.occupant,src.connected) + randmutb(connected.occupant) + domutcheck(connected.occupant, connected) else - randmuti(src.connected.occupant) + randmuti(connected.occupant) //testing("Random identity mut!") - src.connected.occupant.UpdateAppearance() - return 1 // return 1 forces an update to all Nano uis attached to src + connected.occupant.UpdateAppearance() + return TRUE // return 1 forces an update to all Nano uis attached to src if(href_list["ejectBeaker"]) if(connected.beaker) var/obj/item/reagent_containers/glass/B = connected.beaker B.forceMove(connected.loc) connected.beaker = null - return 1 + return TRUE if(href_list["ejectOccupant"]) connected.eject_occupant() - return 1 + return TRUE // Transfer Buffer Management if(href_list["bufferOption"]) @@ -776,113 +760,113 @@ // These bufferOptions do not require a bufferId if(bufferOption == "wipeDisk") - if((isnull(src.disk)) || (src.disk.read_only)) - //src.temphtml = "Invalid disk. Please try again." - return 0 + if((isnull(disk)) || (disk.read_only)) + //temphtml = "Invalid disk. Please try again." + return FALSE - src.disk.buf=null - //src.temphtml = "Data saved." - return 1 + disk.buf = null + //temphtml = "Data saved." + return TRUE if(bufferOption == "ejectDisk") - if(!src.disk) + if(!disk) return - src.disk.forceMove(get_turf(src)) - src.disk = null - return 1 + disk.forceMove(get_turf(src)) + disk = null + return TRUE // All bufferOptions from here on require a bufferId if(!href_list["bufferId"]) - return 0 + return FALSE var/bufferId = text2num(href_list["bufferId"]) if(bufferId < 1 || bufferId > 3) - return 0 // Not a valid buffer id + return FALSE // Not a valid buffer id if(bufferOption == "saveUI") - if(src.connected.occupant && src.connected.occupant.dna) - var/datum/dna2/record/databuf=new + if(connected.occupant && connected.occupant.dna) + var/datum/dna2/record/databuf = new databuf.types = DNA2_BUF_UI // DNA2_BUF_UE - databuf.dna = src.connected.occupant.dna.Clone() + databuf.dna = connected.occupant.dna.Clone() if(ishuman(connected.occupant)) databuf.dna.real_name=connected.occupant.name databuf.name = "Unique Identifier" - src.buffers[bufferId] = databuf - return 1 + buffers[bufferId] = databuf + return TRUE if(bufferOption == "saveUIAndUE") - if(src.connected.occupant && src.connected.occupant.dna) - var/datum/dna2/record/databuf=new + if(connected.occupant && connected.occupant.dna) + var/datum/dna2/record/databuf = new databuf.types = DNA2_BUF_UI|DNA2_BUF_UE - databuf.dna = src.connected.occupant.dna.Clone() + databuf.dna = connected.occupant.dna.Clone() if(ishuman(connected.occupant)) databuf.dna.real_name=connected.occupant.dna.real_name databuf.name = "Unique Identifier + Unique Enzymes" - src.buffers[bufferId] = databuf - return 1 + buffers[bufferId] = databuf + return TRUE if(bufferOption == "saveSE") - if(src.connected.occupant && src.connected.occupant.dna) - var/datum/dna2/record/databuf=new + if(connected.occupant && connected.occupant.dna) + var/datum/dna2/record/databuf = new databuf.types = DNA2_BUF_SE - databuf.dna = src.connected.occupant.dna.Clone() + databuf.dna = connected.occupant.dna.Clone() if(ishuman(connected.occupant)) - databuf.dna.real_name=connected.occupant.dna.real_name + databuf.dna.real_name = connected.occupant.dna.real_name databuf.name = "Structural Enzymes" - src.buffers[bufferId] = databuf - return 1 + buffers[bufferId] = databuf + return TRUE if(bufferOption == "clear") - src.buffers[bufferId]=new /datum/dna2/record() - return 1 + buffers[bufferId] = new /datum/dna2/record() + return TRUE if(bufferOption == "changeLabel") - var/datum/dna2/record/buf = src.buffers[bufferId] + var/datum/dna2/record/buf = buffers[bufferId] var/text = sanitize(input(usr, "New Label:", "Edit Label", buf.name) as text|null) buf.name = text - src.buffers[bufferId] = buf - return 1 + buffers[bufferId] = buf + return TRUE if(bufferOption == "transfer") - if(!src.connected.occupant || (NOCLONE in src.connected.occupant.mutations && connected.scan_level < 3) || !src.connected.occupant.dna) - return 1 + if(!connected.occupant || (NOCLONE in connected.occupant.mutations && connected.scan_level < 3) || !connected.occupant.dna) + return TRUE irradiating = 2 - var/lock_state = src.connected.locked - src.connected.locked = 1//lock it + var/lock_state = connected.locked + connected.locked = TRUE //lock it SSnanoui.update_uis(src) // update all UIs attached to src sleep(2 SECONDS) irradiating = 0 - src.connected.locked = lock_state + connected.locked = lock_state var/radiation = (rand(20,50) / connected.damage_coeff) - src.connected.occupant.apply_effect(radiation,IRRADIATE,0) + connected.occupant.apply_effect(radiation, IRRADIATE, 0) - if(src.connected.radiation_check()) - return 1 + if(connected.radiation_check()) + return TRUE - var/datum/dna2/record/buf = src.buffers[bufferId] + var/datum/dna2/record/buf = buffers[bufferId] if((buf.types & DNA2_BUF_UI)) if((buf.types & DNA2_BUF_UE)) - src.connected.occupant.real_name = buf.dna.real_name - src.connected.occupant.name = buf.dna.real_name - src.connected.occupant.UpdateAppearance(buf.dna.UI.Copy()) + connected.occupant.real_name = buf.dna.real_name + connected.occupant.name = buf.dna.real_name + connected.occupant.UpdateAppearance(buf.dna.UI.Copy()) else if(buf.types & DNA2_BUF_SE) - src.connected.occupant.dna.SE = buf.dna.SE.Copy() - src.connected.occupant.dna.UpdateSE() - domutcheck(src.connected.occupant,src.connected) - return 1 + connected.occupant.dna.SE = buf.dna.SE.Copy() + connected.occupant.dna.UpdateSE() + domutcheck(connected.occupant, connected) + return TRUE if(bufferOption == "createInjector") if(injector_ready && !waiting_for_user_input) var/success = 1 var/obj/item/dnainjector/I = new /obj/item/dnainjector - var/datum/dna2/record/buf = src.buffers[bufferId] + var/datum/dna2/record/buf = buffers[bufferId] buf = buf.copy() if(href_list["createBlockInjector"]) waiting_for_user_input=1 @@ -897,35 +881,35 @@ I.buf = buf waiting_for_user_input = 0 if(success) - I.forceMove(src.loc) + I.forceMove(loc) I.name += " ([buf.name])" if(connected) I.damage_coeff = connected.damage_coeff - src.injector_ready = 0 + injector_ready = FALSE spawn(300) - src.injector_ready = 1 - return 1 + injector_ready = TRUE + return TRUE if(bufferOption == "loadDisk") - if((isnull(src.disk)) || (!src.disk.buf)) - //src.temphtml = "Invalid disk. Please try again." - return 0 + if((isnull(disk)) || (!disk.buf)) + //temphtml = "Invalid disk. Please try again." + return FALSE - src.buffers[bufferId]=src.disk.buf.copy() - //src.temphtml = "Data loaded." - return 1 + buffers[bufferId] = disk.buf.copy() + //temphtml = "Data loaded." + return TRUE if(bufferOption == "saveDisk") - if((isnull(src.disk)) || (src.disk.read_only)) - //src.temphtml = "Invalid disk. Please try again." - return 0 + if((isnull(disk)) || (disk.read_only)) + //temphtml = "Invalid disk. Please try again." + return FALSE - var/datum/dna2/record/buf = src.buffers[bufferId] + var/datum/dna2/record/buf = buffers[bufferId] - src.disk.buf = buf.copy() - src.disk.name = "data disk - '[buf.dna.real_name]'" - //src.temphtml = "Data saved." - return 1 + disk.buf = buf.copy() + disk.name = "data disk - '[buf.dna.real_name]'" + //temphtml = "Data saved." + return TRUE /////////////////////////// DNA MACHINES diff --git a/code/game/dna/genes/disabilities.dm b/code/game/dna/genes/disabilities.dm index e1af06f2ff4..8b8a86009b9 100644 --- a/code/game/dna/genes/disabilities.dm +++ b/code/game/dna/genes/disabilities.dm @@ -7,113 +7,144 @@ ///////////////////// /datum/dna/gene/disability - name="DISABILITY" + name = "DISABILITY" // Mutation to give (or 0) - var/mutation=0 - - // Disability to give (or 0) - var/disability=0 + var/mutation = 0 // Activation message - var/activation_message="" + var/activation_message = "" // Yay, you're no longer growing 3 arms - var/deactivation_message="" + var/deactivation_message = "" -/datum/dna/gene/disability/can_activate(var/mob/M,var/flags) - return 1 // Always set! +/datum/dna/gene/disability/can_activate(mob/M, flags) + return TRUE // Always set! -/datum/dna/gene/disability/activate(var/mob/living/M, var/connected, var/flags) +/datum/dna/gene/disability/activate(mob/living/M, connected, flags) ..() - if(mutation && !(mutation in M.mutations)) - M.mutations.Add(mutation) - if(disability) - M.disabilities|=disability + M.mutations |= mutation if(activation_message) to_chat(M, "[activation_message]") else testing("[name] has no activation message.") -/datum/dna/gene/disability/deactivate(var/mob/living/M, var/connected, var/flags) +/datum/dna/gene/disability/deactivate(mob/living/M, connected, flags) ..() - if(mutation && (mutation in M.mutations)) - M.mutations.Remove(mutation) - if(disability) - M.disabilities &= ~disability + M.mutations.Remove(mutation) if(deactivation_message) to_chat(M, "[deactivation_message]") else testing("[name] has no deactivation message.") /datum/dna/gene/disability/hallucinate - name="Hallucinate" - activation_message="Your mind says 'Hello'." - deactivation_message ="Sanity returns. Or does it?" + name = "Hallucinate" + activation_message = "Your mind says 'Hello'." + deactivation_message = "Sanity returns. Or does it?" instability = -GENE_INSTABILITY_MODERATE - mutation=HALLUCINATE + mutation = HALLUCINATE /datum/dna/gene/disability/hallucinate/New() - block=GLOB.hallucinationblock + ..() + block = GLOB.hallucinationblock + +/datum/dna/gene/disability/hallucinate/OnMobLife(mob/living/carbon/human/H) + if(prob(1)) + H.Hallucinate(20) /datum/dna/gene/disability/epilepsy - name="Epilepsy" - activation_message="You get a headache." - deactivation_message ="Your headache is gone, at last." + name = "Epilepsy" + activation_message = "You get a headache." + deactivation_message = "Your headache is gone, at last." instability = -GENE_INSTABILITY_MODERATE - disability=EPILEPSY + mutation = EPILEPSY /datum/dna/gene/disability/epilepsy/New() - block=GLOB.epilepsyblock + ..() + block = GLOB.epilepsyblock + +/datum/dna/gene/disability/epilepsy/OnMobLife(mob/living/carbon/human/H) + if((prob(1) && H.paralysis < 1)) + H.visible_message("[H] starts having a seizure!","You have a seizure!") + H.Paralyse(10) + H.Jitter(1000) /datum/dna/gene/disability/cough - name="Coughing" - activation_message="You start coughing." - deactivation_message ="Your throat stops aching." + name = "Coughing" + activation_message = "You start coughing." + deactivation_message = "Your throat stops aching." instability = -GENE_INSTABILITY_MINOR - disability=COUGHING + mutation = COUGHING /datum/dna/gene/disability/cough/New() - block=GLOB.coughblock + ..() + block = GLOB.coughblock + +/datum/dna/gene/disability/cough/OnMobLife(mob/living/carbon/human/H) + if((prob(5) && H.paralysis <= 1)) + H.drop_item() + H.emote("cough") /datum/dna/gene/disability/clumsy - name="Clumsiness" - activation_message="You feel lightheaded." - deactivation_message ="You regain some control of your movements" + name = "Clumsiness" + activation_message = "You feel lightheaded." + deactivation_message = "You regain some control of your movements" instability = -GENE_INSTABILITY_MINOR - mutation=CLUMSY + mutation = CLUMSY /datum/dna/gene/disability/clumsy/New() - block=GLOB.clumsyblock + ..() + block = GLOB.clumsyblock /datum/dna/gene/disability/tourettes - name="Tourettes" - activation_message="You twitch." - deactivation_message ="Your mouth tastes like soap." + name = "Tourettes" + activation_message = "You twitch." + deactivation_message = "Your mouth tastes like soap." instability = -GENE_INSTABILITY_MODERATE - disability=TOURETTES + mutation = TOURETTES /datum/dna/gene/disability/tourettes/New() - block=GLOB.twitchblock + ..() + block = GLOB.twitchblock + +/datum/dna/gene/disability/tourettes/OnMobLife(mob/living/carbon/human/H) + if((prob(10) && H.paralysis <= 1)) + H.Stun(10) + switch(rand(1, 3)) + if(1) + H.emote("twitch") + if(2 to 3) + H.say("[prob(50) ? ";" : ""][pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS")]") + var/x_offset_old = H.pixel_x + var/y_offset_old = H.pixel_y + var/x_offset = H.pixel_x + rand(-2, 2) + var/y_offset = H.pixel_y + rand(-1, 1) + animate(H, pixel_x = x_offset, pixel_y = y_offset, time = 1) + animate(H, pixel_x = x_offset_old, pixel_y = y_offset_old, time = 1) /datum/dna/gene/disability/nervousness - name="Nervousness" + name = "Nervousness" activation_message="You feel nervous." deactivation_message ="You feel much calmer." - disability=NERVOUS + mutation = NERVOUS /datum/dna/gene/disability/nervousness/New() - block=GLOB.nervousblock + ..() + block = GLOB.nervousblock +/datum/dna/gene/disability/nervousness/OnMobLife(mob/living/carbon/human/H) + if(prob(10)) + H.Stuttering(10) /datum/dna/gene/disability/blindness - name="Blindness" + name = "Blindness" activation_message = "You can't seem to see anything." deactivation_message = "You can see now, in case you didn't notice..." instability = -GENE_INSTABILITY_MAJOR - disability = BLIND + mutation = BLINDNESS /datum/dna/gene/disability/blindness/New() + ..() block = GLOB.blindblock /datum/dna/gene/disability/blindness/activate(mob/M, connected, flags) @@ -130,51 +161,54 @@ activation_message = "You feel a peculiar prickling in your eyes while your perception of colour changes." deactivation_message ="Your eyes tingle unsettlingly, though everything seems to become alot more colourful." instability = -GENE_INSTABILITY_MODERATE - disability = COLOURBLIND + mutation = COLOURBLIND /datum/dna/gene/disability/colourblindness/New() - block=GLOB.colourblindblock + ..() + block = GLOB.colourblindblock -/datum/dna/gene/disability/colourblindness/activate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/disability/colourblindness/activate(mob/M, connected, flags) ..() M.update_client_colour() //Handle the activation of the colourblindness on the mob. M.update_icons() //Apply eyeshine as needed. -/datum/dna/gene/disability/colourblindness/deactivate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/disability/colourblindness/deactivate(mob/M, connected, flags) ..() M.update_client_colour() //Handle the deactivation of the colourblindness on the mob. M.update_icons() //Remove eyeshine as needed. /datum/dna/gene/disability/deaf - name="Deafness" + name = "Deafness" activation_message="It's kinda quiet." deactivation_message ="You can hear again!" instability = -GENE_INSTABILITY_MAJOR - disability=DEAF + mutation = DEAF /datum/dna/gene/disability/deaf/New() - block=GLOB.deafblock + ..() + block = GLOB.deafblock -/datum/dna/gene/disability/deaf/activate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/disability/deaf/activate(mob/M, connected, flags) ..() M.MinimumDeafTicks(1) /datum/dna/gene/disability/nearsighted - name="Nearsightedness" + name = "Nearsightedness" activation_message="Your eyes feel weird..." deactivation_message ="You can see clearly now" instability = -GENE_INSTABILITY_MODERATE - disability=NEARSIGHTED + mutation = NEARSIGHTED /datum/dna/gene/disability/nearsighted/New() - block=GLOB.glassesblock + ..() + block = GLOB.glassesblock /datum/dna/gene/disability/nearsighted/activate(mob/living/M, connected, flags) - . = ..() + ..() M.update_nearsighted_effects() /datum/dna/gene/disability/nearsighted/deactivate(mob/living/M, connected, flags) - . = ..() + ..() M.update_nearsighted_effects() /datum/dna/gene/disability/lisp @@ -186,9 +220,9 @@ /datum/dna/gene/disability/lisp/New() ..() - block=GLOB.lispblock + block = GLOB.lispblock -/datum/dna/gene/disability/lisp/OnSay(var/mob/M, var/message) +/datum/dna/gene/disability/lisp/OnSay(mob/M, message) return replacetext(message,"s","th") /datum/dna/gene/disability/comic @@ -196,9 +230,10 @@ desc = "This will only bring death and destruction." activation_message = "Uh oh!" deactivation_message = "Well thank god that's over with." - mutation=COMIC + mutation = COMIC /datum/dna/gene/disability/comic/New() + ..() block = GLOB.comicblock /datum/dna/gene/disability/wingdings @@ -210,9 +245,10 @@ mutation = WINGDINGS /datum/dna/gene/disability/wingdings/New() + ..() block = GLOB.wingdingsblock -/datum/dna/gene/disability/wingdings/OnSay(var/mob/M, var/message) +/datum/dna/gene/disability/wingdings/OnSay(mob/M, message) var/list/chars = string2charlist(message) var/garbled_message = "" for(var/C in chars) diff --git a/code/game/dna/genes/gene.dm b/code/game/dna/genes/gene.dm index a8357a437f1..1509cd098a4 100644 --- a/code/game/dna/genes/gene.dm +++ b/code/game/dna/genes/gene.dm @@ -11,63 +11,61 @@ /datum/dna/gene // Display name - var/name="BASE GENE" + var/name = "BASE GENE" // Probably won't get used but why the fuck not var/desc="Oh god who knows what this does." // Set in initialize()! // What gene activates this? - var/block=0 + var/block = 0 // Any of a number of GENE_ flags. - var/flags=0 + var/flags = 0 // Chance of the gene to cause adverse effects when active - var/instability=0 + var/instability = 0 /* * Is the gene active in this mob's DNA? */ -/datum/dna/gene/proc/is_active(var/mob/M) +/datum/dna/gene/proc/is_active(mob/M) return M.active_genes && (type in M.active_genes) // Return 1 if we can activate. // HANDLE MUTCHK_FORCED HERE! -/datum/dna/gene/proc/can_activate(var/mob/M, var/flags) - return 0 +/datum/dna/gene/proc/can_activate(mob/M, flags) + return FALSE // Called when the gene activates. Do your magic here. -/datum/dna/gene/proc/activate(var/mob/living/M, var/connected, var/flags) +/datum/dna/gene/proc/activate(mob/living/M, connected, flags) M.gene_stability -= instability - return /** * Called when the gene deactivates. Undo your magic here. * Only called when the block is deactivated. */ -/datum/dna/gene/proc/deactivate(var/mob/living/M, var/connected, var/flags) +/datum/dna/gene/proc/deactivate(mob/living/M, connected, flags) M.gene_stability += instability - return // This section inspired by goone's bioEffects. /** * Called in each life() tick. */ -/datum/dna/gene/proc/OnMobLife(var/mob/M) +/datum/dna/gene/proc/OnMobLife(mob/M) return /** * Called when the mob dies */ -/datum/dna/gene/proc/OnMobDeath(var/mob/M) +/datum/dna/gene/proc/OnMobDeath(mob/M) return /** * Called when the mob says shit */ -/datum/dna/gene/proc/OnSay(var/mob/M, var/message) +/datum/dna/gene/proc/OnSay(mob/M, message) return message /** @@ -77,7 +75,7 @@ * @params g Gender (m or f) */ /datum/dna/gene/proc/OnDrawUnderlays(mob/M, g) - return 0 + return FALSE ///////////////////// @@ -93,34 +91,34 @@ /datum/dna/gene/basic - name="BASIC GENE" + name = "BASIC GENE" // Mutation to give - var/mutation=0 + var/mutation = 0 // Activation probability - var/activation_prob=100 + var/activation_prob = 100 // Possible activation messages - var/list/activation_messages=list() + var/list/activation_messages = list() // Possible deactivation messages - var/list/deactivation_messages=list() + var/list/deactivation_messages = list() -/datum/dna/gene/basic/can_activate(var/mob/M,var/flags) +/datum/dna/gene/basic/can_activate(mob/M, flags) if(flags & MUTCHK_FORCED) - return 1 + return TRUE // Probability check return prob(activation_prob) -/datum/dna/gene/basic/activate(var/mob/M) +/datum/dna/gene/basic/activate(mob/M, connected, flags) ..() M.mutations.Add(mutation) if(activation_messages.len) var/msg = pick(activation_messages) to_chat(M, "[msg]") -/datum/dna/gene/basic/deactivate(var/mob/M) +/datum/dna/gene/basic/deactivate(mob/living/M, connected, flags) ..() M.mutations.Remove(mutation) if(deactivation_messages.len) diff --git a/code/game/dna/genes/goon_disabilities.dm b/code/game/dna/genes/goon_disabilities.dm index f8c9f53d0e5..7615f737cd0 100644 --- a/code/game/dna/genes/goon_disabilities.dm +++ b/code/game/dna/genes/goon_disabilities.dm @@ -13,13 +13,13 @@ activation_message = "You feel unable to express yourself at all." deactivation_message = "You feel able to speak freely again." instability = -GENE_INSTABILITY_MODERATE - disability = MUTE + mutation = MUTE /datum/dna/gene/disability/mute/New() ..() - block=GLOB.muteblock + block = GLOB.muteblock -/datum/dna/gene/disability/mute/OnSay(var/mob/M, var/message) +/datum/dna/gene/disability/mute/OnSay(mob/M, message) return "" //////////////////////////////////////// @@ -36,27 +36,26 @@ /datum/dna/gene/disability/radioactive/New() ..() - block=GLOB.radblock + block = GLOB.radblock -/datum/dna/gene/disability/radioactive/can_activate(var/mob/M,var/flags) +/datum/dna/gene/disability/radioactive/can_activate(mob/M, flags) if(!..()) - return 0 + return FALSE if(ishuman(M)) var/mob/living/carbon/human/H = M if((RADIMMUNE in H.dna.species.species_traits) && !(flags & MUTCHK_FORCED)) - return 0 - return 1 + return FALSE + return TRUE -/datum/dna/gene/disability/radioactive/OnMobLife(var/mob/living/owner) - var/radiation_amount = abs(min(owner.radiation - 20,0)) - owner.apply_effect(radiation_amount, IRRADIATE) - for(var/mob/living/L in range(1, owner)) - if(L == owner) +/datum/dna/gene/disability/radioactive/OnMobLife(mob/living/carbon/human/H) + var/radiation_amount = abs(min(H.radiation - 20,0)) + H.apply_effect(radiation_amount, IRRADIATE) + for(var/mob/living/L in range(1, H)) + if(L == H) continue - to_chat(L, "You are enveloped by a soft green glow emanating from [owner].") + to_chat(L, "You are enveloped by a soft green glow emanating from [H].") L.apply_effect(5, IRRADIATE) - return /datum/dna/gene/disability/radioactive/OnDrawUnderlays(mob/M, g) return "rads_s" @@ -76,7 +75,7 @@ /datum/dna/gene/disability/fat/New() ..() - block=GLOB.fatblock + block = GLOB.fatblock // WAS: /datum/bioEffect/chav /datum/dna/gene/disability/speech/chav @@ -88,9 +87,9 @@ /datum/dna/gene/disability/speech/chav/New() ..() - block=GLOB.chavblock + block = GLOB.chavblock -/datum/dna/gene/disability/speech/chav/OnSay(var/mob/M, var/message) +/datum/dna/gene/disability/speech/chav/OnSay(mob/M, message) // THIS ENTIRE THING BEGS FOR REGEX message = replacetext(message,"dick","prat") message = replacetext(message,"comdom","knob'ead") @@ -127,9 +126,9 @@ /datum/dna/gene/disability/speech/swedish/New() ..() - block=GLOB.swedeblock + block = GLOB.swedeblock -/datum/dna/gene/disability/speech/swedish/OnSay(var/mob/M, var/message) +/datum/dna/gene/disability/speech/swedish/OnSay(mob/M, message) // svedish message = replacetextEx(message,"W","V") message = replacetextEx(message,"w","v") @@ -157,10 +156,10 @@ /datum/dna/gene/disability/unintelligable/New() ..() - block=GLOB.scrambleblock + block = GLOB.scrambleblock -/datum/dna/gene/disability/unintelligable/OnSay(var/mob/M, var/message) - var/prefix=copytext(message,1,2) +/datum/dna/gene/disability/unintelligable/OnSay(mob/M, message) + var/prefix = copytext(message,1,2) if(prefix == ";") message = copytext(message,2) else if(prefix in list(":","#")) @@ -197,7 +196,7 @@ /datum/dna/gene/disability/strong/New() ..() - block=GLOB.strongblock + block = GLOB.strongblock // WAS: /datum/bioEffect/horns /datum/dna/gene/disability/horns @@ -209,7 +208,7 @@ /datum/dna/gene/disability/horns/New() ..() - block=GLOB.hornsblock + block = GLOB.hornsblock /datum/dna/gene/disability/horns/OnDrawUnderlays(mob/M, g) return "horns_s" @@ -223,7 +222,7 @@ deactivation_messages = list("You no longer feel uncomfortably hot.") mutation = IMMOLATE - spelltype=/obj/effect/proc_holder/spell/targeted/immolate + spelltype = /obj/effect/proc_holder/spell/targeted/immolate /datum/dna/gene/basic/grant_spell/immolate/New() ..() diff --git a/code/game/dna/genes/goon_powers.dm b/code/game/dna/genes/goon_powers.dm index fd2f300e8fb..87bbdf97c5c 100644 --- a/code/game/dna/genes/goon_powers.dm +++ b/code/game/dna/genes/goon_powers.dm @@ -2,26 +2,28 @@ // WAS: /datum/bioEffect/alcres /datum/dna/gene/basic/sober - name="Sober" - activation_messages=list("You feel unusually sober.") + name = "Sober" + activation_messages = list("You feel unusually sober.") deactivation_messages = list("You feel like you could use a stiff drink.") - mutation=SOBER + mutation = SOBER /datum/dna/gene/basic/sober/New() - block=GLOB.soberblock + ..() + block = GLOB.soberblock //WAS: /datum/bioEffect/psychic_resist /datum/dna/gene/basic/psychic_resist - name="Psy-Resist" + name = "Psy-Resist" desc = "Boosts efficiency in sectors of the brain commonly associated with meta-mental energies." activation_messages = list("Your mind feels closed.") deactivation_messages = list("You feel oddly exposed.") - mutation=PSY_RESIST + mutation = PSY_RESIST /datum/dna/gene/basic/psychic_resist/New() - block=GLOB.psyresistblock + ..() + block = GLOB.psyresistblock ///////////////////////// // Stealth Enhancers @@ -30,16 +32,16 @@ /datum/dna/gene/basic/stealth instability = GENE_INSTABILITY_MODERATE -/datum/dna/gene/basic/stealth/can_activate(var/mob/M, var/flags) +/datum/dna/gene/basic/stealth/can_activate(mob/M, flags) // Can only activate one of these at a time. if(is_type_in_list(/datum/dna/gene/basic/stealth,M.active_genes)) testing("Cannot activate [type]: /datum/dna/gene/basic/stealth in M.active_genes.") - return 0 - return ..(M,flags) + return FALSE + return ..() -/datum/dna/gene/basic/stealth/deactivate(var/mob/M) - ..(M) - M.alpha=255 +/datum/dna/gene/basic/stealth/deactivate(mob/living/M, connected, flags) + ..() + M.alpha = 255 // WAS: /datum/bioEffect/darkcloak /datum/dna/gene/basic/stealth/darkcloak @@ -47,13 +49,14 @@ desc = "Enables the subject to bend low levels of light around themselves, creating a cloaking effect." activation_messages = list("You begin to fade into the shadows.") deactivation_messages = list("You become fully visible.") - activation_prob=25 + activation_prob = 25 mutation = CLOAK /datum/dna/gene/basic/stealth/darkcloak/New() - block=GLOB.shadowblock + ..() + block = GLOB.shadowblock -/datum/dna/gene/basic/stealth/darkcloak/OnMobLife(var/mob/M) +/datum/dna/gene/basic/stealth/darkcloak/OnMobLife(mob/M) var/turf/simulated/T = get_turf(M) if(!istype(T)) return @@ -69,13 +72,14 @@ desc = "The subject becomes able to subtly alter light patterns to become invisible, as long as they remain still." activation_messages = list("You feel one with your surroundings.") deactivation_messages = list("You feel oddly visible.") - activation_prob=25 + activation_prob = 25 mutation = CHAMELEON /datum/dna/gene/basic/stealth/chameleon/New() - block=GLOB.chameleonblock + ..() + block = GLOB.chameleonblock -/datum/dna/gene/basic/stealth/chameleon/OnMobLife(var/mob/M) +/datum/dna/gene/basic/stealth/chameleon/OnMobLife(mob/M) if((world.time - M.last_movement) >= 30 && !M.stat && M.canmove && !M.restrained()) M.alpha -= 25 else @@ -86,27 +90,27 @@ /datum/dna/gene/basic/grant_spell var/obj/effect/proc_holder/spell/spelltype -/datum/dna/gene/basic/grant_spell/activate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/basic/grant_spell/activate(mob/M, connected, flags) M.AddSpell(new spelltype(null)) ..() - return 1 + return TRUE -/datum/dna/gene/basic/grant_spell/deactivate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/basic/grant_spell/deactivate(mob/M, connected, flags) for(var/obj/effect/proc_holder/spell/S in M.mob_spell_list) if(istype(S, spelltype)) M.RemoveSpell(S) ..() - return 1 + return TRUE /datum/dna/gene/basic/grant_verb var/verbtype -/datum/dna/gene/basic/grant_verb/activate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/basic/grant_verb/activate(mob/M, connected, flags) ..() M.verbs += verbtype - return 1 + return TRUE -/datum/dna/gene/basic/grant_verb/deactivate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/basic/grant_verb/deactivate(mob/M, connected, flags) ..() M.verbs -= verbtype @@ -183,8 +187,6 @@ new/obj/effect/self_deleting(C.loc, icon('icons/effects/genetics.dmi', "cryokinesis")) - return - /obj/effect/self_deleting density = 0 opacity = 0 @@ -193,12 +195,11 @@ desc = "" //layer = 15 -/obj/effect/self_deleting/New(var/atom/location, var/icon/I, var/duration = 20, var/oname = "something") - src.name = oname +/obj/effect/self_deleting/New(atom/location, icon/I, duration = 20, oname = "something") + name = oname loc=location - src.icon = I - spawn(duration) - qdel(src) + icon = I + QDEL_IN(src, duration) /////////////////////////////////////////////////////////////////////////////////////////// @@ -255,7 +256,7 @@ /obj/item/implant ) -/obj/effect/proc_holder/spell/targeted/eat/proc/doHeal(var/mob/user) +/obj/effect/proc_holder/spell/targeted/eat/proc/doHeal(mob/user) if(ishuman(user)) var/mob/living/carbon/human/H = user for(var/name in H.bodyparts_by_name) @@ -300,12 +301,12 @@ perform(targets, user = user) /obj/effect/proc_holder/spell/targeted/eat/proc/check_mouth(mob/user = usr) - var/can_eat = 1 + var/can_eat = TRUE if(iscarbon(user)) var/mob/living/carbon/C = user if((C.head && (C.head.flags_cover & HEADCOVERSMOUTH)) || (C.wear_mask && (C.wear_mask.flags_cover & MASKCOVERSMOUTH) && !C.wear_mask.mask_adjusted)) to_chat(C, "Your mouth is covered, preventing you from eating!") - can_eat = 0 + can_eat = FALSE return can_eat /obj/effect/proc_holder/spell/targeted/eat/cast(list/targets, mob/user = usr) @@ -320,17 +321,17 @@ if(!istype(limb)) to_chat(user, "You can't eat this part of them!") revert_cast() - return 0 + return FALSE if(istype(limb,/obj/item/organ/external/head)) // Bullshit, but prevents being unable to clone someone. to_chat(user, "You try to put \the [limb] in your mouth, but [the_item.p_their()] ears tickle your throat!") revert_cast() - return 0 + return FALSE if(istype(limb,/obj/item/organ/external/chest)) // Bullshit, but prevents being able to instagib someone. to_chat(user, "You try to put [the_item.p_their()] [limb] in your mouth, but it's too big to fit!") revert_cast() - return 0 + return FALSE user.visible_message("[user] begins stuffing [the_item]'s [limb.name] into [user.p_their()] gaping maw!") var/oldloc = H.loc if(!do_mob(user,H,EAT_MOB_DELAY)) @@ -350,7 +351,6 @@ playsound(user.loc, 'sound/items/eatfood.ogg', 50, 0) qdel(the_item) doHeal(user) - return //////////////////////////////////////////////////////////////////////// @@ -387,7 +387,7 @@ action_icon_state = "genetic_jump" /obj/effect/proc_holder/spell/targeted/leap/cast(list/targets, mob/user = usr) - var/failure = 0 + var/failure = FALSE if(istype(user.loc,/mob/) || user.lying || user.stunned || user.buckled || user.stat) to_chat(user, "You can't jump right now!") return @@ -397,7 +397,7 @@ for(var/mob/M in range(user, 1)) if(M.pulling == user) if(!M.restrained() && M.stat == 0 && M.canmove && user.Adjacent(M)) - failure = 1 + failure = TRUE else M.stop_pulling() @@ -409,12 +409,12 @@ user.visible_message("[user] attempts to leap away but is slammed back down to the ground!", "You attempt to leap away but are suddenly slammed back down to the ground!", "You hear the flexing of powerful muscles and suddenly a crash as a body hits the floor.") - return 0 + return FALSE var/prevLayer = user.layer var/prevFlying = user.flying user.layer = 9 - user.flying = 1 + user.flying = TRUE for(var/i=0, i<10, i++) step(user, user.dir) if(i < 5) user.pixel_y += 8 @@ -508,7 +508,7 @@ activation_messages = list("You suddenly notice more about others than you did before.") deactivation_messages = list("You no longer feel able to sense intentions.") instability = GENE_INSTABILITY_MINOR - mutation=EMPATH + mutation = EMPATH /datum/dna/gene/basic/grant_spell/empath/New() ..() @@ -614,4 +614,3 @@ to_chat(M, "You sense [user.name] reading your mind.") else if(prob(5) || M.mind.assigned_role=="Chaplain") to_chat(M, "You sense someone intruding upon your thoughts...") - return diff --git a/code/game/dna/genes/monkey.dm b/code/game/dna/genes/monkey.dm index 3b6182ecf63..583b2c75836 100644 --- a/code/game/dna/genes/monkey.dm +++ b/code/game/dna/genes/monkey.dm @@ -1,10 +1,11 @@ /datum/dna/gene/monkey - name="Monkey" + name = "Monkey" /datum/dna/gene/monkey/New() - block=GLOB.monkeyblock + ..() + block = GLOB.monkeyblock -/datum/dna/gene/monkey/can_activate(var/mob/M,var/flags) +/datum/dna/gene/monkey/can_activate(mob/M, flags) return ishuman(M) /datum/dna/gene/monkey/activate(mob/living/carbon/human/H, connected, flags) @@ -21,7 +22,7 @@ H.regenerate_icons() H.SetStunned(1) - H.canmove = 0 + H.canmove = FALSE H.icon = null H.invisibility = 101 var/has_primitive_form = H.dna.species.primitive_form // cache this diff --git a/code/game/dna/genes/powers.dm b/code/game/dna/genes/powers.dm index 465a58cab25..d893c64565c 100644 --- a/code/game/dna/genes/powers.dm +++ b/code/game/dna/genes/powers.dm @@ -3,109 +3,121 @@ /////////////////////////////////// /datum/dna/gene/basic/nobreath - name="No Breathing" - activation_messages=list("You feel no need to breathe.") - deactivation_messages=list("You feel the need to breathe, once more.") + name = "No Breathing" + activation_messages = list("You feel no need to breathe.") + deactivation_messages = list("You feel the need to breathe, once more.") instability = GENE_INSTABILITY_MODERATE mutation = BREATHLESS - activation_prob=25 + activation_prob = 25 /datum/dna/gene/basic/nobreath/New() + ..() block = GLOB.breathlessblock /datum/dna/gene/basic/regenerate - name="Regenerate" - activation_messages=list("Your wounds start healing.") - deactivation_messages=list("Your regenerative powers feel like they've vanished.") + name = "Regenerate" + activation_messages = list("Your wounds start healing.") + deactivation_messages = list("Your regenerative powers feel like they've vanished.") instability = GENE_INSTABILITY_MINOR - mutation=REGEN + mutation = REGEN /datum/dna/gene/basic/regenerate/New() - block=GLOB.regenerateblock + ..() + block = GLOB.regenerateblock + +/datum/dna/gene/basic/regenerate/OnMobLife(mob/living/carbon/human/H) + H.adjustBruteLoss(-0.1, FALSE) + H.adjustFireLoss(-0.1) /datum/dna/gene/basic/increaserun - name="Super Speed" - activation_messages=list("You feel swift and unencumbered.") - deactivation_messages=list("You feel slow.") + name = "Super Speed" + activation_messages = list("You feel swift and unencumbered.") + deactivation_messages = list("You feel slow.") instability = GENE_INSTABILITY_MINOR - mutation=RUN + mutation = RUN /datum/dna/gene/basic/increaserun/New() - block=GLOB.increaserunblock + ..() + block = GLOB.increaserunblock -/datum/dna/gene/basic/increaserun/can_activate(var/mob/M,var/flags) +/datum/dna/gene/basic/increaserun/can_activate(mob/M, flags) if(!..()) - return 0 + return FALSE if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.dna.species && H.dna.species.speed_mod && !(flags & MUTCHK_FORCED)) - return 0 - return 1 + return FALSE + return TRUE /datum/dna/gene/basic/heat_resist - name="Heat Resistance" - activation_messages=list("Your skin is icy to the touch.") - deactivation_messages=list("Your skin no longer feels icy to the touch.") + name = "Heat Resistance" + activation_messages = list("Your skin is icy to the touch.") + deactivation_messages = list("Your skin no longer feels icy to the touch.") instability = GENE_INSTABILITY_MODERATE mutation = HEATRES /datum/dna/gene/basic/heat_resist/New() - block=GLOB.coldblock + ..() + block = GLOB.coldblock /datum/dna/gene/basic/heat_resist/OnDrawUnderlays(mob/M, g) return "cold_s" /datum/dna/gene/basic/cold_resist - name="Cold Resistance" - activation_messages=list("Your body is filled with warmth.") - deactivation_messages=list("Your body is no longer filled with warmth.") + name = "Cold Resistance" + activation_messages = list("Your body is filled with warmth.") + deactivation_messages = list("Your body is no longer filled with warmth.") instability = GENE_INSTABILITY_MODERATE mutation = COLDRES /datum/dna/gene/basic/cold_resist/New() - block=GLOB.fireblock + ..() + block = GLOB.fireblock /datum/dna/gene/basic/cold_resist/OnDrawUnderlays(mob/M, g) return "fire_s" /datum/dna/gene/basic/noprints - name="No Prints" - activation_messages=list("Your fingers feel numb.") - deactivation_messages=list("your fingers no longer feel numb.") + name = "No Prints" + activation_messages = list("Your fingers feel numb.") + deactivation_messages = list("your fingers no longer feel numb.") instability = GENE_INSTABILITY_MINOR - mutation=FINGERPRINTS + mutation = FINGERPRINTS /datum/dna/gene/basic/noprints/New() - block=GLOB.noprintsblock + ..() + block = GLOB.noprintsblock /datum/dna/gene/basic/noshock - name="Shock Immunity" - activation_messages=list("Your skin feels dry and unreactive.") - deactivation_messages=list("Your skin no longer feels dry and unreactive.") + name = "Shock Immunity" + activation_messages = list("Your skin feels dry and unreactive.") + deactivation_messages = list("Your skin no longer feels dry and unreactive.") instability = GENE_INSTABILITY_MODERATE - mutation=NO_SHOCK + mutation = NO_SHOCK /datum/dna/gene/basic/noshock/New() - block=GLOB.shockimmunityblock + ..() + block = GLOB.shockimmunityblock /datum/dna/gene/basic/midget - name="Midget" - activation_messages=list("Everything around you seems bigger now...") + name = "Midget" + activation_messages = list("Everything around you seems bigger now...") deactivation_messages = list("Everything around you seems to shrink...") instability = GENE_INSTABILITY_MINOR - mutation=DWARF + mutation = DWARF /datum/dna/gene/basic/midget/New() - block=GLOB.smallsizeblock + ..() + block = GLOB.smallsizeblock -/datum/dna/gene/basic/midget/activate(var/mob/M, var/connected, var/flags) - ..(M,connected,flags) +/datum/dna/gene/basic/midget/activate(mob/M, connected, flags) + ..() M.pass_flags |= PASSTABLE M.resize = 0.8 M.update_transform() -/datum/dna/gene/basic/midget/deactivate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/basic/midget/deactivate(mob/M, connected, flags) ..() M.pass_flags &= ~PASSTABLE M.resize = 1.25 @@ -113,31 +125,32 @@ // OLD HULK BEHAVIOR /datum/dna/gene/basic/hulk - name="Hulk" - activation_messages=list("Your muscles hurt.") - deactivation_messages=list("Your muscles shrink.") + name = "Hulk" + activation_messages = list("Your muscles hurt.") + deactivation_messages = list("Your muscles shrink.") instability = GENE_INSTABILITY_MAJOR - mutation=HULK - activation_prob=15 + mutation = HULK + activation_prob = 15 /datum/dna/gene/basic/hulk/New() - block=GLOB.hulkblock + ..() + block = GLOB.hulkblock -/datum/dna/gene/basic/hulk/activate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/basic/hulk/activate(mob/M, connected, flags) ..() var/status = CANSTUN | CANWEAKEN | CANPARALYSE | CANPUSH M.status_flags &= ~status -/datum/dna/gene/basic/hulk/deactivate(var/mob/M, var/connected, var/flags) +/datum/dna/gene/basic/hulk/deactivate(mob/M, connected, flags) ..() M.status_flags |= CANSTUN | CANWEAKEN | CANPARALYSE | CANPUSH /datum/dna/gene/basic/hulk/OnDrawUnderlays(mob/M, g) if(HULK in M.mutations) return "hulk_[g]_s" - return 0 + return FALSE -/datum/dna/gene/basic/hulk/OnMobLife(var/mob/living/carbon/human/M) +/datum/dna/gene/basic/hulk/OnMobLife(mob/living/carbon/human/M) if(!istype(M)) return if((HULK in M.mutations) && M.health <= 0) @@ -150,15 +163,16 @@ to_chat(M, "You suddenly feel very weak.") /datum/dna/gene/basic/xray - name="X-Ray Vision" - activation_messages=list("The walls suddenly disappear.") - deactivation_messages=list("the walls around you re-appear.") + name = "X-Ray Vision" + activation_messages = list("The walls suddenly disappear.") + deactivation_messages = list("the walls around you re-appear.") instability = GENE_INSTABILITY_MAJOR - mutation=XRAY - activation_prob=15 + mutation = XRAY + activation_prob = 15 /datum/dna/gene/basic/xray/New() - block=GLOB.xrayblock + ..() + block = GLOB.xrayblock /datum/dna/gene/basic/xray/activate(mob/living/M, connected, flags) ..() @@ -171,15 +185,16 @@ M.update_icons() //Remove eyeshine as needed. /datum/dna/gene/basic/tk - name="Telekenesis" + name = "Telekenesis" activation_messages = list("You feel smarter.") deactivation_messages = list("You feel dumber.") instability = GENE_INSTABILITY_MAJOR - mutation=TK - activation_prob=15 + mutation = TK + activation_prob = 15 /datum/dna/gene/basic/tk/New() - block=GLOB.teleblock + ..() + block = GLOB.teleblock /datum/dna/gene/basic/tk/OnDrawUnderlays(mob/M, g) return "telekinesishead_s" diff --git a/code/game/dna/genes/vg_disabilities.dm b/code/game/dna/genes/vg_disabilities.dm index d423f0bf89b..c2ad1559b6a 100644 --- a/code/game/dna/genes/vg_disabilities.dm +++ b/code/game/dna/genes/vg_disabilities.dm @@ -8,11 +8,11 @@ /datum/dna/gene/disability/speech/loud/New() ..() - block=GLOB.loudblock + block = GLOB.loudblock -/datum/dna/gene/disability/speech/loud/OnSay(var/mob/M, var/message) +/datum/dna/gene/disability/speech/loud/OnSay(mob/M, message) message = replacetext(message,".","!") message = replacetext(message,"?","?!") message = replacetext(message,"!","!!") @@ -28,15 +28,15 @@ /datum/dna/gene/disability/dizzy/New() ..() - block=GLOB.dizzyblock + block = GLOB.dizzyblock -/datum/dna/gene/disability/dizzy/OnMobLife(var/mob/living/carbon/human/M) +/datum/dna/gene/disability/dizzy/OnMobLife(mob/living/carbon/human/M) if(!istype(M)) return if(DIZZY in M.mutations) M.Dizzy(300) /datum/dna/gene/disability/dizzy/deactivate(mob/living/M, connected, flags) - . = ..() + ..() M.SetDizzy(0) diff --git a/code/game/dna/genes/vg_powers.dm b/code/game/dna/genes/vg_powers.dm index 5ed6c705a17..9092448e398 100644 --- a/code/game/dna/genes/vg_powers.dm +++ b/code/game/dna/genes/vg_powers.dm @@ -4,10 +4,10 @@ name = "Morphism" desc = "Enables the subject to reconfigure their appearance to that of any human." spelltype =/obj/effect/proc_holder/spell/targeted/morph - activation_messages=list("Your body feels if can alter its appearance.") + activation_messages = list("Your body feels if can alter its appearance.") deactivation_messages = list("Your body doesn't feel capable of altering its appearance.") instability = GENE_INSTABILITY_MINOR - mutation=MORPH + mutation = MORPH /datum/dna/gene/basic/grant_spell/morph/New() ..() @@ -29,7 +29,8 @@ action_icon_state = "genetic_morph" /obj/effect/proc_holder/spell/targeted/morph/cast(list/targets, mob/user = usr) - if(!ishuman(user)) return + if(!ishuman(user)) + return if(istype(user.loc,/mob/)) to_chat(user, "You can't change your appearance right now!") @@ -173,24 +174,24 @@ M.update_dna() - M.visible_message("[src] morphs and changes [p_their()] appearance!", "You change your appearance!", "Oh, god! What the hell was that? It sounded like flesh getting squished and bone ground into a different shape!") + M.visible_message("[M] morphs and changes [M.p_their()] appearance!", "You change your appearance!", "Oh, god! What the hell was that? It sounded like flesh getting squished and bone ground into a different shape!") /datum/dna/gene/basic/grant_spell/remotetalk - name="Telepathy" - activation_messages=list("You feel you can project your thoughts.") - deactivation_messages=list("You no longer feel you can project your thoughts.") + name = "Telepathy" + activation_messages = list("You feel you can project your thoughts.") + deactivation_messages = list("You no longer feel you can project your thoughts.") instability = GENE_INSTABILITY_MINOR - mutation=REMOTE_TALK + mutation = REMOTE_TALK spelltype =/obj/effect/proc_holder/spell/targeted/remotetalk /datum/dna/gene/basic/grant_spell/remotetalk/New() ..() - block=GLOB.remotetalkblock + block = GLOB.remotetalkblock -/datum/dna/gene/basic/grant_spell/remotetalk/activate(mob/user) +/datum/dna/gene/basic/grant_spell/remotetalk/activate(mob/living/M, connected, flags) ..() - user.AddSpell(new /obj/effect/proc_holder/spell/targeted/mindscan(null)) + M.AddSpell(new /obj/effect/proc_holder/spell/targeted/mindscan(null)) /datum/dna/gene/basic/grant_spell/remotetalk/deactivate(mob/user) ..() @@ -336,22 +337,23 @@ return ..() /datum/dna/gene/basic/grant_spell/remoteview - name="Remote Viewing" - activation_messages=list("Your mind can see things from afar.") - deactivation_messages=list("Your mind can no longer can see things from afar.") + name = "Remote Viewing" + activation_messages = list("Your mind can see things from afar.") + deactivation_messages = list("Your mind can no longer can see things from afar.") instability = GENE_INSTABILITY_MINOR - mutation=REMOTE_VIEW + mutation = REMOTE_VIEW spelltype =/obj/effect/proc_holder/spell/targeted/remoteview /datum/dna/gene/basic/grant_spell/remoteview/New() - block=GLOB.remoteviewblock + ..() + block = GLOB.remoteviewblock /obj/effect/proc_holder/spell/targeted/remoteview name = "Remote View" desc = "Spy on people from any range!" - charge_max = 600 + charge_max = 100 clothes_req = 0 stat_allowed = 0 @@ -363,18 +365,23 @@ /obj/effect/proc_holder/spell/targeted/remoteview/choose_targets(mob/user = usr) var/list/targets = list() - var/list/remoteviewers = new /list() - for(var/mob/M in GLOB.living_mob_list) + var/list/remoteviewers = list() + for(var/mob/M in GLOB.alive_mob_list) + if(M == user) + continue if(PSY_RESIST in M.mutations) continue if(REMOTE_VIEW in M.mutations) remoteviewers += M - if(!remoteviewers.len || remoteviewers.len == 1) + if(!LAZYLEN(remoteviewers)) to_chat(user, "No valid targets with remote view were found!") start_recharge() return - targets += input("Choose the target to spy on.", "Targeting") as mob in remoteviewers - + targets += input("Choose the target to spy on.", "Targeting") as null|anything in remoteviewers + if(!targets) + to_chat(user, "You decide against remote viewing.") + start_recharge() + return perform(targets, user = user) /obj/effect/proc_holder/spell/targeted/remoteview/cast(list/targets, mob/user = usr) @@ -386,15 +393,15 @@ var/mob/target - if(istype(H.l_hand, /obj/item/tk_grab) || istype(H.r_hand, /obj/item/tk_grab/)) + if(istype(H.l_hand, /obj/item/tk_grab) || istype(H.r_hand, /obj/item/tk_grab)) to_chat(H, "Your mind is too busy with that telekinetic grab.") H.remoteview_target = null - H.reset_perspective(0) + H.reset_perspective() return if(H.client.eye != user.client.mob) H.remoteview_target = null - H.reset_perspective(0) + H.reset_perspective() return for(var/mob/living/L in targets) @@ -405,4 +412,4 @@ H.reset_perspective(target) else H.remoteview_target = null - H.reset_perspective(0) + H.reset_perspective() diff --git a/code/game/gamemodes/blob/blob_report.dm b/code/game/gamemodes/blob/blob_report.dm index 6128c22f66d..9c7fb99fe81 100644 --- a/code/game/gamemodes/blob/blob_report.dm +++ b/code/game/gamemodes/blob/blob_report.dm @@ -19,7 +19,7 @@ intercepttext += "Message ends." if(2) var/nukecode = rand(10000, 99999) - for(var/obj/machinery/nuclearbomb/bomb in world) + for(var/obj/machinery/nuclearbomb/bomb in GLOB.machines) if(bomb && bomb.r_code) if(is_station_level(bomb.z)) bomb.r_code = nukecode diff --git a/code/game/gamemodes/blob/blobs/blob_mobs.dm b/code/game/gamemodes/blob/blobs/blob_mobs.dm index fb26ce91698..38da76a348b 100644 --- a/code/game/gamemodes/blob/blobs/blob_mobs.dm +++ b/code/game/gamemodes/blob/blobs/blob_mobs.dm @@ -51,11 +51,12 @@ speak_emote = list("pulses") var/obj/structure/blob/factory/factory = null var/list/human_overlays = list() - var/is_zombie = 0 + var/mob/living/carbon/human/oldguy + var/is_zombie = FALSE /mob/living/simple_animal/hostile/blob/blobspore/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume, global_overlay = TRUE) ..() - adjustBruteLoss(Clamp(0.01 * exposed_temperature, 1, 5)) + adjustBruteLoss(clamp(0.01 * exposed_temperature, 1, 5)) /mob/living/simple_animal/hostile/blob/blobspore/CanPass(atom/movable/mover, turf/target, height=0) @@ -85,8 +86,8 @@ is_zombie = TRUE if(H.wear_suit) var/obj/item/clothing/suit/armor/A = H.wear_suit - if(A.armor && A.armor["melee"]) - maxHealth += A.armor["melee"] //That zombie's got armor, I want armor! + if(A.armor && A.armor.getRating("melee")) + maxHealth += A.armor.getRating("melee") //That zombie's got armor, I want armor! maxHealth += 40 health = maxHealth name = "blob zombie" @@ -102,6 +103,7 @@ human_overlays = H.overlays update_icons() H.forceMove(src) + oldguy = H visible_message("The corpse of [H.name] suddenly rises!") /mob/living/simple_animal/hostile/blob/blobspore/death(gibbed) @@ -130,9 +132,9 @@ if(factory) factory.spores -= src factory = null - if(contents) - for(var/mob/M in contents) - M.loc = get_turf(src) + if(oldguy) + oldguy.forceMove(get_turf(src)) + oldguy = null return ..() diff --git a/code/game/gamemodes/blob/overmind.dm b/code/game/gamemodes/blob/overmind.dm index 74ed59d2469..316a136afc6 100644 --- a/code/game/gamemodes/blob/overmind.dm +++ b/code/game/gamemodes/blob/overmind.dm @@ -35,11 +35,15 @@ color = blob_reagent_datum.complementary_color ..() + START_PROCESSING(SSobj, src) -/mob/camera/blob/Life(seconds, times_fired) +/mob/camera/blob/Destroy() + STOP_PROCESSING(SSobj, src) + return ..() + +/mob/camera/blob/process() if(!blob_core) qdel(src) - ..() /mob/camera/blob/Login() ..() @@ -53,7 +57,7 @@ /mob/camera/blob/proc/add_points(var/points) if(points != 0) - blob_points = Clamp(blob_points + points, 0, max_blob_points) + blob_points = clamp(blob_points + points, 0, max_blob_points) if(hud_used) hud_used.blobpwrdisplay.maptext = "
[round(src.blob_points)]
" diff --git a/code/game/gamemodes/blob/powers.dm b/code/game/gamemodes/blob/powers.dm index bdbd875a3dc..6f2eed39499 100644 --- a/code/game/gamemodes/blob/powers.dm +++ b/code/game/gamemodes/blob/powers.dm @@ -357,7 +357,7 @@ if(!surrounding_turfs.len) return - for(var/mob/living/simple_animal/hostile/blob/blobspore/BS in GLOB.living_mob_list) + for(var/mob/living/simple_animal/hostile/blob/blobspore/BS in GLOB.alive_mob_list) if(isturf(BS.loc) && get_dist(BS, T) <= 35) BS.LoseTarget() BS.Goto(pick(surrounding_turfs), BS.move_to_delay) diff --git a/code/game/gamemodes/blob/theblob.dm b/code/game/gamemodes/blob/theblob.dm index 886975a2c92..5e2c3befc9a 100644 --- a/code/game/gamemodes/blob/theblob.dm +++ b/code/game/gamemodes/blob/theblob.dm @@ -49,7 +49,7 @@ /obj/structure/blob/CanAStarPass(ID, dir, caller) . = 0 - if(ismovableatom(caller)) + if(ismovable(caller)) var/atom/movable/mover = caller . = . || mover.checkpass(PASSBLOB) @@ -74,9 +74,6 @@ /obj/structure/blob/proc/Pulse(var/pulse = 0, var/origin_dir = 0, var/a_color)//Todo: Fix spaceblob expand - - set background = BACKGROUND_ENABLED - RegenHealth() if(run_action())//If we can do something here then we dont need to pulse more @@ -179,7 +176,7 @@ return 0 var/armor_protection = 0 if(damage_flag) - armor_protection = armor[damage_flag] + armor_protection = armor.getRating(damage_flag) damage_amount = round(damage_amount * (100 - armor_protection)*0.01, 0.1) if(overmind && damage_flag) damage_amount = overmind.blob_reagent_datum.damage_reaction(src, damage_amount, damage_type, damage_flag) diff --git a/code/game/gamemodes/changeling/powers/augmented_eyesight.dm b/code/game/gamemodes/changeling/powers/augmented_eyesight.dm index 4663fef8b97..d6062a02c5d 100644 --- a/code/game/gamemodes/changeling/powers/augmented_eyesight.dm +++ b/code/game/gamemodes/changeling/powers/augmented_eyesight.dm @@ -49,7 +49,7 @@ /obj/item/organ/internal/cyberimp/eyes/shield/ling/on_life() ..() var/obj/item/organ/internal/eyes/E = owner.get_int_organ(/obj/item/organ/internal/eyes) - if(owner.eye_blind || owner.eye_blurry || (owner.disabilities & BLIND) || (owner.disabilities & NEARSIGHTED) || (E.damage > 0)) + if(owner.eye_blind || owner.eye_blurry || (BLINDNESS in owner.mutations) || (NEARSIGHTED in owner.mutations) || (E.damage > 0)) owner.reagents.add_reagent("oculine", 1) /obj/item/organ/internal/cyberimp/eyes/shield/ling/prepare_eat() @@ -76,11 +76,11 @@ var/mob/living/carbon/human/H = owner H.weakeyes = 1 if(!H.vision_type) - H.vision_type = new /datum/vision_override/nightvision + H.set_sight(/datum/vision_override/nightvision) /obj/item/organ/internal/cyberimp/eyes/thermals/ling/remove(mob/living/carbon/M, special = 0) if(ishuman(owner)) var/mob/living/carbon/human/H = owner H.weakeyes = 0 - H.vision_type = null + H.set_sight(null) ..() diff --git a/code/game/gamemodes/changeling/powers/fakedeath.dm b/code/game/gamemodes/changeling/powers/fakedeath.dm index d403059b0c7..61882b85287 100644 --- a/code/game/gamemodes/changeling/powers/fakedeath.dm +++ b/code/game/gamemodes/changeling/powers/fakedeath.dm @@ -16,11 +16,8 @@ user.emote("deathgasp") user.timeofdeath = world.time user.status_flags |= FAKEDEATH //play dead - user.update_stat("fakedeath sting") + user.updatehealth("fakedeath sting") user.update_canmove() - user.med_hud_set_health() - user.handle_hud_icons_health() - user.med_hud_set_status() user.mind.changeling.regenerating = TRUE addtimer(CALLBACK(src, .proc/ready_to_regenerate, user), LING_FAKEDEATH_TIME) diff --git a/code/game/gamemodes/changeling/powers/mutations.dm b/code/game/gamemodes/changeling/powers/mutations.dm index d225ac6886a..d12b970d884 100644 --- a/code/game/gamemodes/changeling/powers/mutations.dm +++ b/code/game/gamemodes/changeling/powers/mutations.dm @@ -95,8 +95,8 @@ user.unEquip(user.head) user.unEquip(user.wear_suit) - user.equip_to_slot_if_possible(new suit_type(user), slot_wear_suit, 1, 1, 1) - user.equip_to_slot_if_possible(new helmet_type(user), slot_head, 1, 1, 1) + user.equip_to_slot_if_possible(new suit_type(user), slot_wear_suit, TRUE, TRUE) + user.equip_to_slot_if_possible(new helmet_type(user), slot_head, TRUE, TRUE) var/datum/changeling/changeling = user.mind.changeling changeling.chem_recharge_slowdown += recharge_slowdown @@ -321,7 +321,7 @@ if(INTENT_GRAB) C.visible_message("[L] is grabbed by [H]'s tentacle!","A tentacle grabs you and pulls you towards [H]!") - add_attack_logs(src, C, "[src] has grabbed [C] and pulled them towards [H] with a tentacle") + add_attack_logs(H, C, "[H] grabbed [C] with a changeling tentacle") C.throw_at(get_step_towards(H,C), 8, 2, callback=CALLBACK(H, /mob/proc/tentacle_grab, C)) return 1 diff --git a/code/game/gamemodes/changeling/powers/spiders.dm b/code/game/gamemodes/changeling/powers/spiders.dm index 82b2db6ac7b..778ec768e55 100644 --- a/code/game/gamemodes/changeling/powers/spiders.dm +++ b/code/game/gamemodes/changeling/powers/spiders.dm @@ -1,7 +1,7 @@ /datum/action/changeling/spiders name = "Spread Infestation" desc = "Our form divides, creating arachnids which will grow into deadly beasts." - helptext = "The spiders are thoughtless creatures, and may attack their creators when fully grown. Requires at least 5 DNA absorptions." + helptext = "The spiders are thoughtless creatures, and may attack their creators when fully grown. Requires at least 5 stored DNA." button_icon_state = "spread_infestation" chemical_cost = 45 dna_cost = 1 diff --git a/code/game/gamemodes/cult/cult_comms.dm b/code/game/gamemodes/cult/cult_comms.dm index 375a02251bc..fcc39124233 100644 --- a/code/game/gamemodes/cult/cult_comms.dm +++ b/code/game/gamemodes/cult/cult_comms.dm @@ -23,7 +23,7 @@ if(!message) return - if((user.disabilities & MUTE) || user.mind.miming) //Under vow of silence/mute? + if((MUTE in user.mutations) || user.mind.miming) //Under vow of silence/mute? user.visible_message("[user] appears to whisper to themselves.","You begin to whisper to yourself.") //Make them do *something* abnormal. else user.whisper("O bidai nabora se[pick("'","`")]sma!") // Otherwise book club sayings. @@ -32,7 +32,7 @@ if(!user) return - if(!((user.disabilities & MUTE) || user.mind.miming)) // If they aren't mute/miming, commence the whisperting + if(!((MUTE in user.mutations) || user.mind.miming)) // If they aren't mute/miming, commence the whisperting user.whisper(message) var/my_message if(istype(user, /mob/living/simple_animal/slaughter/cult)) //Harbringers of the Slaughter @@ -46,3 +46,4 @@ to_chat(M, " (F) [my_message] ") log_say("(CULT) [message]", user) + user.create_log(SAY_LOG, "(CULT) [message]") diff --git a/code/game/gamemodes/devil/true_devil/inventory.dm b/code/game/gamemodes/devil/true_devil/inventory.dm index 437203e2e91..3f5446d88bc 100644 --- a/code/game/gamemodes/devil/true_devil/inventory.dm +++ b/code/game/gamemodes/devil/true_devil/inventory.dm @@ -5,7 +5,7 @@ return 1 return 0 -/mob/living/carbon/true_devil/update_inv_r_hand(var/update_icons=1) +/mob/living/carbon/true_devil/update_inv_r_hand() ..() if(r_hand) var/t_state = r_hand.item_state @@ -17,11 +17,10 @@ devil_overlays[DEVIL_R_HAND_LAYER] = I else devil_overlays[DEVIL_R_HAND_LAYER] = null - if(update_icons) - update_icons() + update_icons() -/mob/living/carbon/true_devil/update_inv_l_hand(var/update_icons=1) +/mob/living/carbon/true_devil/update_inv_l_hand() ..() if(l_hand) var/t_state = l_hand.item_state @@ -33,8 +32,7 @@ devil_overlays[DEVIL_L_HAND_LAYER] = I else devil_overlays[DEVIL_L_HAND_LAYER] = null - if(update_icons) - update_icons() + update_icons() /mob/living/carbon/true_devil/proc/remove_overlay(cache_index) if(devil_overlays[cache_index]) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 2b604839c62..2d71df8c979 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -415,7 +415,7 @@ proc/display_roundstart_logout_report() /proc/get_nuke_code() var/nukecode = "ERROR" - for(var/obj/machinery/nuclearbomb/bomb in world) + for(var/obj/machinery/nuclearbomb/bomb in GLOB.machines) if(bomb && bomb.r_code && is_station_level(bomb.z)) nukecode = bomb.r_code return nukecode diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index c1a907f9191..a4b8c594b89 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -652,7 +652,8 @@ button.desc = desc /datum/action/innate/ai/blackout/Activate() - for(var/obj/machinery/power/apc/apc in GLOB.apcs) + for(var/thing in GLOB.apcs) + var/obj/machinery/power/apc/apc if(prob(30 * apc.overload)) apc.overload_lighting() else diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index c27b230b3b2..c7ca587b34f 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -25,6 +25,11 @@ var/combat_armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 50, "bomb" = 50, "bio" = 50, "rad" = 50, "fire" = 90, "acid" = 90) sprite_sheets = null +/obj/item/clothing/suit/armor/abductor/vest/Initialize(mapload) + . = ..() + stealth_armor = getArmor(arglist(stealth_armor)) + combat_armor = getArmor(arglist(combat_armor)) + /obj/item/clothing/suit/armor/abductor/vest/proc/toggle_nodrop() flags ^= NODROP if(ismob(loc)) diff --git a/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm b/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm index 6e1b4a39d3a..d7354b87c5c 100644 --- a/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm +++ b/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm @@ -166,7 +166,6 @@ eject_abductee() SendBack(H) return "Specimen braindead - disposed." - return "ERROR" /obj/machinery/abductor/experiment/proc/SendBack(mob/living/carbon/human/H) diff --git a/code/game/gamemodes/miniantags/borer/borer.dm b/code/game/gamemodes/miniantags/borer/borer.dm index fa797ac929b..f99a00567ae 100644 --- a/code/game/gamemodes/miniantags/borer/borer.dm +++ b/code/game/gamemodes/miniantags/borer/borer.dm @@ -590,8 +590,6 @@ GrantBorerActions() RemoveInfestActions() forceMove(get_turf(host)) - - reset_perspective(null) machine = null host.reset_perspective(null) diff --git a/code/game/gamemodes/miniantags/borer/borer_event.dm b/code/game/gamemodes/miniantags/borer/borer_event.dm index 245b8fa7b41..f5a3b7aa4af 100644 --- a/code/game/gamemodes/miniantags/borer/borer_event.dm +++ b/code/game/gamemodes/miniantags/borer/borer_event.dm @@ -16,7 +16,7 @@ /datum/event/borer_infestation/start() var/list/vents = list() - for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world) + for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in SSair.atmos_machinery) if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) //Stops cortical borers getting stuck in small networks. See: Security, Virology if(temp_vent.parent.other_atmosmch.len > 50) diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 126587a0c97..5f9256e18b4 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -112,7 +112,7 @@ summoner.death() -/mob/living/simple_animal/hostile/guardian/handle_hud_icons_health() +/mob/living/simple_animal/hostile/guardian/update_health_hud() if(summoner) var/resulthealth if(iscarbon(summoner)) @@ -121,8 +121,6 @@ resulthealth = round((summoner.health / summoner.maxHealth) * 100) if(hud_used) hud_used.guardianhealthdisplay.maptext = "
[resulthealth]%
" - med_hud_set_health() - med_hud_set_status() /mob/living/simple_animal/hostile/guardian/adjustHealth(amount, updating_health = TRUE) //The spirit is invincible, but passes on damage to the summoner var/damage = amount * damage_transfer @@ -164,7 +162,7 @@ if(loc == summoner) forceMove(get_turf(summoner)) new /obj/effect/temp_visual/guardian/phase(loc) - src.client.eye = loc + reset_perspective() cooldown = world.time + 30 /mob/living/simple_animal/hostile/guardian/proc/Recall(forced = FALSE) @@ -182,15 +180,19 @@ input = stripped_input(src, "Please enter a message to tell your summoner.", "Guardian", "") else input = message - if(!input) return + if(!input) + return - for(var/mob/M in GLOB.mob_list) - if(M == summoner) - to_chat(M, "[src]: [input]") - log_say("(GUARDIAN to [key_name(M)]) [input]", src) - else if(M in GLOB.dead_mob_list && M.client && M.stat == DEAD && !isnewplayer(M)) - to_chat(M, "Guardian Communication from [src] ([ghost_follow_link(src, ghost=M)]): [input]") + // Show the message to the host and to the guardian. + to_chat(summoner, "[src]: [input]") to_chat(src, "[src]: [input]") + log_say("(GUARDIAN to [key_name(summoner)]) [input]", src) + create_log(SAY_LOG, "GUARDIAN to HOST: [input]", summoner) + + // Show the message to any ghosts/dead players. + for(var/mob/M in GLOB.dead_mob_list) + if(M && M.client && M.stat == DEAD && !isnewplayer(M)) + to_chat(M, "Guardian Communication from [src] ([ghost_follow_link(src, ghost=M)]): [input]") //override set to true if message should be passed through instead of going to host communication /mob/living/simple_animal/hostile/guardian/say(message, override = FALSE) @@ -208,18 +210,24 @@ set category = "Guardian" set desc = "Communicate telepathically with your guardian." var/input = stripped_input(src, "Please enter a message to tell your guardian.", "Message", "") - if(!input) return + if(!input) + return - for(var/mob/M in GLOB.mob_list) - if(istype(M, /mob/living/simple_animal/hostile/guardian)) - var/mob/living/simple_animal/hostile/guardian/G = M - if(G.summoner == src) - to_chat(G, "[src]: [input]") - log_say("(GUARDIAN to [key_name(G)]) [input]", src) + // Find the guardian in our host's contents. + var/mob/living/simple_animal/hostile/guardian/G = locate() in contents + if(!G) + return - else if(M in GLOB.dead_mob_list && M.client && M.stat == DEAD && !isnewplayer(M)) - to_chat(M, "Guardian Communication from [src] ([ghost_follow_link(src, ghost=M)]): [input]") + // Show the message to our guardian and to host. + to_chat(G, "[src]: [input]") to_chat(src, "[src]: [input]") + log_say("(GUARDIAN to [key_name(G)]) [input]", src) + create_log(SAY_LOG, "HOST to GUARDIAN: [input]", G) + + // Show the message to any ghosts/dead players. + for(var/mob/M in GLOB.dead_mob_list) + if(M && M.client && M.stat == DEAD && !isnewplayer(M)) + to_chat(M, "Guardian Communication from [src] ([ghost_follow_link(src, ghost=M)]): [input]") /mob/living/proc/guardian_recall() set name = "Recall Guardian" @@ -286,7 +294,7 @@ var/name_list = list("Aries", "Leo", "Sagittarius", "Taurus", "Virgo", "Capricorn", "Gemini", "Libra", "Aquarius", "Cancer", "Scorpio", "Pisces") /obj/item/guardiancreator/attack_self(mob/living/user) - for(var/mob/living/simple_animal/hostile/guardian/G in GLOB.living_mob_list) + for(var/mob/living/simple_animal/hostile/guardian/G in GLOB.alive_mob_list) if(G.summoner == user) to_chat(user, "You already have a [mob_name]!") return diff --git a/code/game/gamemodes/miniantags/guardian/types/fire.dm b/code/game/gamemodes/miniantags/guardian/types/fire.dm index 09a202afb91..bf8a908e979 100644 --- a/code/game/gamemodes/miniantags/guardian/types/fire.dm +++ b/code/game/gamemodes/miniantags/guardian/types/fire.dm @@ -35,7 +35,7 @@ new /obj/effect/hallucination/delusion(target.loc, target, force_kind = "custom", duration = 200, skip_nearby = 0, custom_icon = icon_state, custom_icon_file = icon) else if(prob(45)) - if(ismovableatom(target)) + if(ismovable(target)) var/atom/movable/M = target if(!M.anchored && M != summoner) new /obj/effect/temp_visual/guardian/phase/out(get_turf(M)) diff --git a/code/game/gamemodes/miniantags/guardian/types/healer.dm b/code/game/gamemodes/miniantags/guardian/types/healer.dm index e3217e0249a..75f5fddba53 100644 --- a/code/game/gamemodes/miniantags/guardian/types/healer.dm +++ b/code/game/gamemodes/miniantags/guardian/types/healer.dm @@ -130,7 +130,7 @@ if(beacon) //Check that the beacon still exists and is in a safe place. No instant kills. if(beacon.air) var/datum/gas_mixture/Z = beacon.air - if(Z.oxygen >= 16 && !Z.toxins && Z.carbon_dioxide < 10 && !Z.trace_gases.len) + if(Z.oxygen >= 16 && !Z.toxins && Z.carbon_dioxide < 10 && !Z.sleeping_agent) if((Z.temperature > 270) && (Z.temperature < 360)) var/pressure = Z.return_pressure() if((pressure > 20) && (pressure < 550)) diff --git a/code/game/gamemodes/miniantags/revenant/revenant_spawn_event.dm b/code/game/gamemodes/miniantags/revenant/revenant_spawn_event.dm index 1f902a51806..5e5f0f87a79 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant_spawn_event.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant_spawn_event.dm @@ -26,13 +26,15 @@ var/datum/mind/player_mind = new /datum/mind(key_of_revenant) player_mind.active = 1 var/list/spawn_locs = list() - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(isturf(L.loc)) switch(L.name) if("revenantspawn") spawn_locs += L.loc if(!spawn_locs) //If we can't find any revenant spawns, try the carp spawns - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(isturf(L.loc)) switch(L.name) if("carpspawn") diff --git a/code/game/gamemodes/miniantags/slaughter/slaughter.dm b/code/game/gamemodes/miniantags/slaughter/slaughter.dm index 73ab05a00aa..e3ce78d582a 100644 --- a/code/game/gamemodes/miniantags/slaughter/slaughter.dm +++ b/code/game/gamemodes/miniantags/slaughter/slaughter.dm @@ -139,7 +139,7 @@ /obj/effect/proc_holder/spell/targeted/sense_victims/cast(list/targets, mob/user) var/list/victims = targets - for(var/mob/living/L in GLOB.living_mob_list) + for(var/mob/living/L in GLOB.alive_mob_list) if(!L.stat && !iscultist(L) && L.key && L != usr) victims.Add(L) if(!targets.len) diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index ad1146c0bc8..5fed8ae00f4 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -95,7 +95,8 @@ proc/issyndicate(mob/living/M as mob) var/list/turf/synd_spawn = list() - for(var/obj/effect/landmark/A in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/A = thing if(A.name == "Syndicate-Spawn") synd_spawn += get_turf(A) qdel(A) @@ -140,7 +141,7 @@ proc/issyndicate(mob/living/M as mob) /datum/game_mode/nuclear/proc/scale_telecrystals() var/danger danger = GLOB.player_list.len - while(!IsMultiple(++danger, 10)) //Increments danger up to the nearest multiple of ten + while(!ISMULTIPLE(++danger, 10)) //Increments danger up to the nearest multiple of ten total_tc += danger * NUKESCALINGMODIFIER @@ -450,7 +451,7 @@ proc/issyndicate(mob/living/M as mob) if(foecount == GLOB.score_arrested) GLOB.score_allarrested = 1 - for(var/obj/machinery/nuclearbomb/nuke in world) + for(var/obj/machinery/nuclearbomb/nuke in GLOB.machines) if(nuke.r_code == "Nope") continue var/turf/T = get_turf(nuke) var/area/A = T.loc @@ -491,13 +492,16 @@ proc/issyndicate(mob/living/M as mob) for(var/datum/mind/M in SSticker.mode.syndicates) foecount++ - for(var/mob/living/C in world) + for(var/mob in GLOB.mob_living_list) + var/mob/living/C = mob if(ishuman(C) || isAI(C) || isrobot(C)) - if(C.stat == 2) continue - if(!C.client) continue + if(C.stat == DEAD) + continue + if(!C.client) + continue crewcount++ - var/obj/item/disk/nuclear/N = locate() in world + var/obj/item/disk/nuclear/N = locate() in GLOB.poi_list if(istype(N)) var/atom/disk_loc = N.loc while(!isturf(disk_loc)) diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index de15f62d09d..0da5d8a3a0a 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -399,6 +399,9 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective) if(!steal_target) return 1 // Free Objective + if(!owner.current) + return FALSE + var/list/all_items = owner.current.GetAllContents() for(var/obj/I in all_items) @@ -475,7 +478,7 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective) n_p++ target_amount = min(target_amount, n_p) - explanation_text = "Absorb [target_amount] compatible genomes." + explanation_text = "Acquire [target_amount] compatible genomes. The 'Extract DNA Sting' can be used to stealthily get genomes without killing somebody." return target_amount /datum/objective/absorb/check_completion() diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index 00ce24b6c46..b09bb7a851f 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -336,7 +336,7 @@ if(head_revolutionaries.len || GAMEMODE_IS_REVOLUTION) var/num_revs = 0 var/num_survivors = 0 - for(var/mob/living/carbon/survivor in GLOB.living_mob_list) + for(var/mob/living/carbon/survivor in GLOB.alive_mob_list) if(survivor.ckey) num_survivors++ if(survivor.mind) @@ -385,7 +385,7 @@ if(foecount == GLOB.score_arrested) GLOB.score_allarrested = 1 - for(var/mob/living/carbon/human/player in world) + for(var/mob/living/carbon/human/player in GLOB.mob_living_list) if(player.mind) var/role = player.mind.assigned_role if(role in list("Captain", "Head of Security", "Head of Personnel", "Chief Engineer", "Research Director")) @@ -415,7 +415,7 @@ for(var/datum/mind/M in SSticker.mode:revolutionaries) if(M.current && M.current.stat != DEAD) revcount++ - for(var/mob/living/carbon/human/player in world) + for(var/mob/living/carbon/human/player in GLOB.mob_living_list) if(player.mind) var/role = player.mind.assigned_role if(role in list("Captain", "Head of Security", "Head of Personnel", "Chief Engineer", "Research Director")) @@ -425,7 +425,8 @@ if(player.mind in SSticker.mode.revolutionaries) continue loycount++ - for(var/mob/living/silicon/X in world) + for(var/beepboop in GLOB.silicon_mob_list) + var/mob/living/silicon/X = beepboop if(X.stat != DEAD) loycount++ diff --git a/code/game/gamemodes/scoreboard.dm b/code/game/gamemodes/scoreboard.dm index 069b0915c00..182bcc78bd2 100644 --- a/code/game/gamemodes/scoreboard.dm +++ b/code/game/gamemodes/scoreboard.dm @@ -71,7 +71,8 @@ // Check station's power levels - for(var/obj/machinery/power/apc/A in GLOB.apcs) + for(var/thing in GLOB.apcs) + var/obj/machinery/power/apc/A = thing if(!is_station_level(A.z)) continue for(var/obj/item/stock_parts/cell/C in A.contents) if(C.charge < 2300) diff --git a/code/game/gamemodes/setupgame.dm b/code/game/gamemodes/setupgame.dm index c7c46d89c19..f6ba6504381 100644 --- a/code/game/gamemodes/setupgame.dm +++ b/code/game/gamemodes/setupgame.dm @@ -34,7 +34,7 @@ //message_admins("Assigning DNA blocks:") // Standard muts - GLOB.blindblock = getAssignedBlock("BLIND", numsToAssign) + GLOB.blindblock = getAssignedBlock("BLINDNESS", numsToAssign) GLOB.colourblindblock = getAssignedBlock("COLOURBLIND", numsToAssign) GLOB.deafblock = getAssignedBlock("DEAF", numsToAssign) GLOB.hulkblock = getAssignedBlock("HULK", numsToAssign, DNA_HARD_BOUNDS, good=1) diff --git a/code/game/gamemodes/shadowling/shadowling.dm b/code/game/gamemodes/shadowling/shadowling.dm index 9cd91817af4..2e43096ce8e 100644 --- a/code/game/gamemodes/shadowling/shadowling.dm +++ b/code/game/gamemodes/shadowling/shadowling.dm @@ -101,7 +101,7 @@ Made by Xhuis shadowlings-- var/thrall_scaling = round(num_players() / 3) - required_thralls = Clamp(thrall_scaling, 15, 25) + required_thralls = clamp(thrall_scaling, 15, 25) thrall_ratio = required_thralls / 15 warning_threshold = round(0.66 * required_thralls) diff --git a/code/game/gamemodes/shadowling/shadowling_abilities.dm b/code/game/gamemodes/shadowling/shadowling_abilities.dm index 37f7296bd4e..27267d2ec02 100644 --- a/code/game/gamemodes/shadowling/shadowling_abilities.dm +++ b/code/game/gamemodes/shadowling/shadowling_abilities.dm @@ -175,7 +175,6 @@ range = -1 include_user = 1 clothes_req = 0 - var/datum/vision_override/vision_path = /datum/vision_override/nightvision action_icon_state = "darksight" /obj/effect/proc_holder/spell/targeted/shadow_vision/cast(list/targets, mob/user = usr) @@ -185,10 +184,10 @@ var/mob/living/carbon/human/H = target if(!H.vision_type) to_chat(H, "You shift the nerves in your eyes, allowing you to see in the dark.") - H.vision_type = new vision_path + H.set_sight(/datum/vision_override/nightvision) else to_chat(H, "You return your vision to normal.") - H.vision_type = null + H.set_sight(null) /obj/effect/proc_holder/spell/targeted/shadow_vision/thrall desc = "Thrall Darksight" @@ -375,7 +374,7 @@ to_chat(target, "You focus your telepathic energies abound, harnessing and drawing together the strength of your thralls.") - for(M in GLOB.living_mob_list) + for(M in GLOB.alive_mob_list) if(is_thrall(M)) thralls++ to_chat(M, "You feel hooks sink into your mind and pull.") @@ -413,7 +412,7 @@ else if(thralls >= victory_threshold) to_chat(target, "You are now powerful enough to ascend. Use the Ascendance ability when you are ready. This will kill all of your thralls.") to_chat(target, "You may find Ascendance in the Shadowling Evolution tab.") - for(M in GLOB.living_mob_list) + for(M in GLOB.alive_mob_list) if(is_shadow(M)) var/obj/effect/proc_holder/spell/targeted/collective_mind/CM if(CM in M.mind.spell_list) diff --git a/code/game/gamemodes/shadowling/special_shadowling_abilities.dm b/code/game/gamemodes/shadowling/special_shadowling_abilities.dm index 7896a4aab61..5fc5e1e78cc 100644 --- a/code/game/gamemodes/shadowling/special_shadowling_abilities.dm +++ b/code/game/gamemodes/shadowling/special_shadowling_abilities.dm @@ -161,7 +161,8 @@ GLOBAL_LIST_INIT(possibleShadowlingNames, list("U'ruan", "Y`shej", "Nex", "Hel-u for(var/mob/living/M in orange(7, H)) M.Weaken(10) to_chat(M, "An immense pressure slams you onto the ground!") - for(var/obj/machinery/power/apc/A in GLOB.apcs) + for(var/thing in GLOB.apcs) + var/obj/machinery/power/apc/A = thing A.overload_lighting() var/mob/living/simple_animal/ascendant_shadowling/A = new /mob/living/simple_animal/ascendant_shadowling(H.loc) A.announce("VYSHA NERADA YEKHEZET U'RUU!!", 5, 'sound/hallucinations/veryfar_noise.ogg') diff --git a/code/game/gamemodes/vampire/vampire.dm b/code/game/gamemodes/vampire/vampire.dm index 6c22313ef6e..3caf860383d 100644 --- a/code/game/gamemodes/vampire/vampire.dm +++ b/code/game/gamemodes/vampire/vampire.dm @@ -227,6 +227,7 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha if(istype(spell, /obj/effect/proc_holder/spell)) owner.mind.AddSpell(spell) powers += spell + owner.update_sight() // Life updates conditionally, so we need to update sight here in case the vamp gets new vision based on his powers. Maybe one day refactor to be more OOP and on the vampire's ability datum. /datum/vampire/proc/get_ability(path) for(var/P in powers) @@ -244,6 +245,7 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha powers -= ability owner.mind.spell_list.Remove(ability) qdel(ability) + owner.update_sight() // Life updates conditionally, so we need to update sight here in case the vamp loses his vision based powers. Maybe one day refactor to be more OOP and on the vampire's ability datum. /datum/vampire/proc/update_owner(var/mob/living/carbon/human/current) //Called when a vampire gets cloned. This updates vampire.owner to the new body. if(current.mind && current.mind.vampire && current.mind.vampire.owner && (current.mind.vampire.owner != current)) diff --git a/code/game/gamemodes/vampire/vampire_powers.dm b/code/game/gamemodes/vampire/vampire_powers.dm index 032bab0b6e8..7e0f00f8721 100644 --- a/code/game/gamemodes/vampire/vampire_powers.dm +++ b/code/game/gamemodes/vampire/vampire_powers.dm @@ -243,7 +243,7 @@ scramble(1, H, 100) H.real_name = random_name(H.gender, H.dna.species.name) //Give them a name that makes sense for their species. H.sync_organ_dna(assimilate = 1) - H.update_body(0) + H.update_body() H.reset_hair() //No more winding up with hairstyles you're not supposed to have, and blowing your cover. H.reset_markings() //...Or markings. H.dna.ResetUIFrom(H) @@ -507,13 +507,13 @@ to_chat(user, "You cannot find darkness to step to.") return + turfs = list(pick(turfs)) // Pick a single turf for the vampire to jump to. perform(turfs, user = user) +// `targets` should only ever contain the 1 valid turf we're jumping to, even though its a list, that's just how the cast() proc works. /obj/effect/proc_holder/spell/vampire/shadowstep/cast(list/targets, mob/user = usr) spawn(0) - var/turf/picked = pick(targets) - - if(!picked || !isturf(picked)) + if(!LAZYLEN(targets)) // If for some reason the turf got deleted. return var/mob/living/U = user U.ExtinguishMob() @@ -525,7 +525,7 @@ animation.alpha = 127 animation.layer = 5 //animation.master = src - user.forceMove(picked) + user.forceMove(targets[1]) spawn(10) qdel(animation) diff --git a/code/game/gamemodes/wizard/artefact.dm b/code/game/gamemodes/wizard/artefact.dm index da7c6d4e1de..205fd63d9c6 100644 --- a/code/game/gamemodes/wizard/artefact.dm +++ b/code/game/gamemodes/wizard/artefact.dm @@ -809,7 +809,7 @@ GLOBAL_LIST_EMPTY(multiverse) return return ..() -/obj/item/voodoo/check_eye(mob/user as mob) +/obj/item/voodoo/check_eye(mob/user) if(loc != user) user.reset_perspective(null) user.unset_machine() @@ -866,7 +866,7 @@ GLOBAL_LIST_EMPTY(multiverse) possible = list() if(!link) return - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) if(md5(H.dna.uni_identity) in link.fingerprints) possible |= H diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm index a7eb5d135e9..b76b31255e9 100644 --- a/code/game/gamemodes/wizard/spellbook.dm +++ b/code/game/gamemodes/wizard/spellbook.dm @@ -1011,7 +1011,7 @@ magichead.voicechange = 1 //NEEEEIIGHH if(!user.unEquip(user.wear_mask)) qdel(user.wear_mask) - user.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1) + user.equip_to_slot_if_possible(magichead, slot_wear_mask, TRUE, TRUE) qdel(src) else to_chat(user, "I say thee neigh") diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm index 7f93fd9fef6..d5a59a36872 100644 --- a/code/game/jobs/access.dm +++ b/code/game/jobs/access.dm @@ -20,8 +20,6 @@ else return check_access_list(acc) - return 0 - /obj/item/proc/GetAccess() return list() diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index a30799f08b9..d5c5089c8af 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -51,6 +51,7 @@ var/disabilities_allowed = 1 var/transfer_allowed = TRUE // If false, ID computer will always discourage transfers to this job, even if player is eligible + var/hidden_from_job_prefs = FALSE // if true, job preferences screen never shows this job. var/admin_only = 0 var/spawn_ert = 0 diff --git a/code/game/jobs/job/support.dm b/code/game/jobs/job/support.dm index d0064300b62..f2b8cf31671 100644 --- a/code/game/jobs/job/support.dm +++ b/code/game/jobs/job/support.dm @@ -450,3 +450,24 @@ /obj/item/storage/box/lip_stick = 1, /obj/item/storage/box/barber = 1 ) + +/datum/job/explorer + title = "Explorer" + flag = JOB_EXPLORER + department_flag = JOBCAT_SUPPORT + total_positions = 0 + spawn_positions = 0 + supervisors = "the head of personnel" + selection_color = "#dddddd" + access = list(ACCESS_MAINT_TUNNELS, ACCESS_GATEWAY, ACCESS_EVA, ACCESS_EXTERNAL_AIRLOCKS) + minimal_access = list(ACCESS_MAINT_TUNNELS, ACCESS_GATEWAY, ACCESS_EVA, ACCESS_EXTERNAL_AIRLOCKS) + outfit = /datum/outfit/job/explorer + hidden_from_job_prefs = TRUE + +/datum/outfit/job/explorer + // This outfit is never used, because there are no slots for this job. + // To get it, you have to go to the HOP and ask for a transfer to it. + name = "Explorer" + jobtype = /datum/job/explorer + uniform = /obj/item/clothing/under/color/random + shoes = /obj/item/clothing/shoes/black diff --git a/code/game/jobs/jobs.dm b/code/game/jobs/jobs.dm index 8ff6b58e5c4..81cc54aa3c3 100644 --- a/code/game/jobs/jobs.dm +++ b/code/game/jobs/jobs.dm @@ -58,7 +58,8 @@ GLOBAL_LIST_INIT(support_positions, list( "Barber", "Magistrate", "Nanotrasen Representative", - "Blueshield" + "Blueshield", + "Explorer" )) GLOBAL_LIST_INIT(supply_positions, list( diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 7317099b8dc..3bcb9675c50 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -136,7 +136,7 @@ /obj/machinery/optable/wrench_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(I.use_tool(src, user, 20, volume = I.tool_volume)) to_chat(user, "You deconstruct the table.") diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index 3185cdcddd4..332df41f086 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -30,15 +30,11 @@ /obj/machinery/pdapainter/New() ..() var/blocked = list(/obj/item/pda/silicon/ai, /obj/item/pda/silicon/robot, /obj/item/pda/silicon/pai, /obj/item/pda/heads, - /obj/item/pda/clear, /obj/item/pda/syndicate) + /obj/item/pda/clear, /obj/item/pda/syndicate, /obj/item/pda/chameleon, /obj/item/pda/chameleon/broken) - for(var/P in typesof(/obj/item/pda)-blocked) - var/obj/item/pda/D = new P - - //D.name = "PDA Style [colorlist.len+1]" //Gotta set the name, otherwise it all comes up as "PDA" - D.name = D.icon_state //PDAs don't have unique names, but using the sprite names works. - - src.colorlist += D + for(var/thing in typesof(/obj/item/pda) - blocked) + var/obj/item/pda/P = thing + colorlist[initial(P.icon_state)] = initial(P.desc) /obj/machinery/pdapainter/Destroy() QDEL_NULL(storedpda) @@ -104,8 +100,8 @@ if(!in_range(src, user)) return - storedpda.icon_state = P.icon_state - storedpda.desc = P.desc + storedpda.icon_state = P + storedpda.desc = colorlist[P] else to_chat(user, "The [src] is empty.") diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 9d96ec94b99..1ee30b6e9d0 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -314,9 +314,9 @@ occupantData["intOrgan"] = intOrganData - occupantData["blind"] = (occupant.disabilities & BLIND) - occupantData["colourblind"] = (occupant.disabilities & COLOURBLIND) - occupantData["nearsighted"] = (occupant.disabilities & NEARSIGHTED) + occupantData["blind"] = (BLINDNESS in occupant.mutations) + occupantData["colourblind"] = (COLOURBLIND in occupant.mutations) + occupantData["nearsighted"] = (NEARSIGHTED in occupant.mutations) data["occupant"] = occupantData return data @@ -498,11 +498,11 @@ dat += "[i.name]N/A[i.damage][infection]:[mech][dead]" dat += "" dat += "" - if(occupant.disabilities & BLIND) + if(BLINDNESS in occupant.mutations) dat += "Cataracts detected.
" - if(occupant.disabilities & COLOURBLIND) + if(COLOURBLIND in occupant.mutations) dat += "Photoreceptor abnormalities detected.
" - if(occupant.disabilities & NEARSIGHTED) + if(NEARSIGHTED in occupant.mutations) dat += "Retinal misalignment detected.
" else dat += "[src] is empty." diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 02d95278e30..6174f4a497d 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -199,8 +199,8 @@ mode = AALARM_MODE_REPLACEMENT apply_mode() -/obj/machinery/alarm/New(var/loc, var/dir, var/building = 0) - ..() +/obj/machinery/alarm/New(loc, direction, building = 0) + . = ..() GLOB.air_alarms += src GLOB.air_alarms = sortAtom(GLOB.air_alarms) @@ -211,12 +211,11 @@ src.loc = loc if(dir) - src.dir = dir + setDir(direction) buildstage = 0 wiresexposed = 1 - pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) - pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0 + set_pixel_offsets_from_dir(-24, 24, -24, 24) update_icon() return @@ -251,7 +250,7 @@ /obj/machinery/alarm/proc/master_is_operating() if(!alarm_area) - alarm_area = areaMaster + alarm_area = get_area(src) if(!alarm_area) log_runtime(EXCEPTION("Air alarm /obj/machinery/alarm lacks alarm_area and areaMaster vars during proc/master_is_operating()"), src) return FALSE @@ -299,10 +298,7 @@ var/plasma_dangerlevel = cur_tlv.get_danger_level(environment.toxins*GET_PP) cur_tlv = TLV["other"] - var/other_moles = 0.0 - for(var/datum/gas/G in environment.trace_gases) - other_moles+=G.moles - var/other_dangerlevel = cur_tlv.get_danger_level(other_moles*GET_PP) + var/other_dangerlevel = cur_tlv.get_danger_level(environment.total_trace_moles() * GET_PP) cur_tlv = TLV["temperature"] var/temperature_dangerlevel = cur_tlv.get_danger_level(environment.temperature) @@ -625,10 +621,8 @@ var/plasma_percent = round(environment.toxins / total * 100, 2) cur_tlv = TLV["other"] - var/other_moles = 0.0 - for(var/datum/gas/G in environment.trace_gases) - other_moles+=G.moles - var/other_dangerlevel = cur_tlv.get_danger_level(other_moles*GET_PP) + var/other_moles = environment.total_trace_moles() + var/other_dangerlevel = cur_tlv.get_danger_level(other_moles * GET_PP) cur_tlv = TLV["temperature"] var/temperature_dangerlevel = cur_tlv.get_danger_level(environment.temperature) @@ -996,7 +990,7 @@ if(buildstage != AIR_ALARM_BUILDING) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return to_chat(user, "You start prying out the circuit.") if(!I.use_tool(src, user, 20, volume = I.tool_volume)) diff --git a/code/game/machinery/atmoalter/area_atmos_computer.dm b/code/game/machinery/atmoalter/area_atmos_computer.dm index 3d53e130628..d7650d1cb68 100644 --- a/code/game/machinery/atmoalter/area_atmos_computer.dm +++ b/code/game/machinery/atmoalter/area_atmos_computer.dm @@ -164,7 +164,7 @@ var/turf/T = get_turf(src) if(!T.loc) return var/area/A = get_area(T) - for(var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber in world ) + for(var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber in SSair.atmos_machinery) var/turf/T2 = get_turf(scrubber) if(T2 && T2.loc) var/area/A2 = T2.loc diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index d91fba5fa5c..e927415c759 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -417,8 +417,7 @@ update_flag if(air_contents.toxins > 0) message_admins("[key_name_admin(usr)] opened a canister that contains plasma in [get_area(src)]! (JMP)") log_admin("[key_name(usr)] opened a canister that contains plasma at [get_area(src)]: [x], [y], [z]") - var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in air_contents.trace_gases - if(sleeping_agent && (sleeping_agent.moles > 1)) + if(air_contents.sleeping_agent > 0) message_admins("[key_name_admin(usr)] opened a canister that contains N2O in [get_area(src)]! (JMP)") log_admin("[key_name(usr)] opened a canister that contains N2O at [get_area(src)]: [x], [y], [z]") investigate_log(logmsg, "atmos") @@ -533,29 +532,11 @@ update_flag ..() canister_color["prim"] = "redws" - var/datum/gas/sleeping_agent/trace_gas = new - air_contents.trace_gases += trace_gas - trace_gas.moles = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature) + air_contents.sleeping_agent = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) src.update_icon() return 1 - -//Dirty way to fill room with gas. However it is a bit easier to do than creating some floor/engine/n2o -rastaf0 -/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller/New() - ..() - var/datum/gas/sleeping_agent/trace_gas = air_contents.trace_gases[1] - trace_gas.moles = 9*4000 - spawn(100) - var/turf/simulated/location = src.loc - if(istype(src.loc)) - while(!location.air) - sleep(1000) - location.assume_air(air_contents) - air_contents = new - return 1 - - /obj/machinery/portable_atmospherics/canister/nitrogen/New() ..() diff --git a/code/game/machinery/atmoalter/pump.dm b/code/game/machinery/atmoalter/pump.dm index 0144a7f93c2..4d54b162466 100644 --- a/code/game/machinery/atmoalter/pump.dm +++ b/code/game/machinery/atmoalter/pump.dm @@ -167,7 +167,7 @@ if(href_list["pressure_adj"]) var/diff = text2num(href_list["pressure_adj"]) - target_pressure = Clamp(target_pressure+diff, pressuremin, pressuremax) + target_pressure = clamp(target_pressure+diff, pressuremin, pressuremax) update_icon() src.add_fingerprint(usr) diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm index 36e340d1a12..7af7751ff2c 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -81,17 +81,11 @@ filtered_out.carbon_dioxide = removed.carbon_dioxide removed.carbon_dioxide = 0 - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/sleeping_agent)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas + filtered_out.sleeping_agent = removed.sleeping_agent + removed.sleeping_agent = 0 - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas + filtered_out.agent_b = removed.agent_b + removed.agent_b = 0 //Remix the resulting gases air_contents.merge(filtered_out) @@ -158,7 +152,7 @@ if(href_list["volume_adj"]) var/diff = text2num(href_list["volume_adj"]) - volume_rate = Clamp(volume_rate+diff, minrate, maxrate) + volume_rate = clamp(volume_rate+diff, minrate, maxrate) src.add_fingerprint(usr) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 78367327a0c..c22922e4d14 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -38,7 +38,7 @@ var/list/categories = list("Tools", "Electronics", "Construction", "Communication", "Security", "Machinery", "Medical", "Miscellaneous", "Dinnerware", "Imported") /obj/machinery/autolathe/New() - AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS), 0, TRUE, null, null, CALLBACK(src, .proc/AfterMaterialInsert)) + AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS), _show_on_examine=TRUE, _after_insert=CALLBACK(src, .proc/AfterMaterialInsert)) ..() component_parts = list() component_parts += new /obj/item/circuitboard/autolathe(null) @@ -66,7 +66,7 @@ /obj/machinery/autolathe/Destroy() QDEL_NULL(wires) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() return ..() @@ -87,7 +87,7 @@ ui.open() /obj/machinery/autolathe/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/data[0] data["screen"] = screen data["total_amount"] = materials.total_amount @@ -138,7 +138,7 @@ /obj/machinery/autolathe/proc/design_cost_data(datum/design/D) var/list/data = list() var/coeff = get_coeff(D) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/has_metal = 1 if(D.materials[MAT_METAL] && (materials.amount(MAT_METAL) < (D.materials[MAT_METAL] / coeff))) has_metal = 0 @@ -152,7 +152,7 @@ return data /obj/machinery/autolathe/proc/queue_data(list/data) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/temp_metal = materials.amount(MAT_METAL) var/temp_glass = materials.amount(MAT_GLASS) data["processing"] = being_built.len ? get_processing_line() : null @@ -288,7 +288,7 @@ //multiplier checks : only stacks can have one and its value is 1, 10 ,25 or max_multiplier var/multiplier = text2num(href_list["multiplier"]) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/max_multiplier = min(design_last_ordered.maxstack, design_last_ordered.materials[MAT_METAL] ?round(materials.amount(MAT_METAL)/design_last_ordered.materials[MAT_METAL]):INFINITY,design_last_ordered.materials[MAT_GLASS]?round(materials.amount(MAT_GLASS)/design_last_ordered.materials[MAT_GLASS]):INFINITY) var/is_stack = ispath(design_last_ordered.build_path, /obj/item/stack) @@ -309,13 +309,13 @@ if(href_list["remove_from_queue"]) var/index = text2num(href_list["remove_from_queue"]) - if(isnum(index) && IsInRange(index, 1, queue.len)) + if(isnum(index) && ISINRANGE(index, 1, queue.len)) remove_from_queue(index) if(href_list["queue_move"] && href_list["index"]) var/index = text2num(href_list["index"]) var/new_index = index + text2num(href_list["queue_move"]) if(isnum(index) && isnum(new_index)) - if(IsInRange(new_index, 1, queue.len)) + if(ISINRANGE(new_index, 1, queue.len)) queue.Swap(index,new_index) if(href_list["clear_queue"]) queue = list() @@ -342,7 +342,7 @@ for(var/obj/item/stock_parts/matter_bin/MB in component_parts) tot_rating += MB.rating tot_rating *= 25000 - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.max_amount = tot_rating * 3 for(var/obj/item/stock_parts/manipulator/M in component_parts) prod_coeff += M.rating - 1 @@ -355,7 +355,7 @@ desc = initial(desc)+"\nIt's building \a [initial(D.name)]." var/is_stack = ispath(D.build_path, /obj/item/stack) var/coeff = get_coeff(D) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/metal_cost = D.materials[MAT_METAL] var/glass_cost = D.materials[MAT_GLASS] var/power = max(2000, (metal_cost+glass_cost)*multiplier/5) @@ -387,7 +387,7 @@ return 0 var/coeff = get_coeff(D) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/metal_amount = materials.amount(MAT_METAL) if(custom_metal) metal_amount = custom_metal diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index 796d5c552dd..5ec4206734c 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -189,12 +189,12 @@ active = 1 icon_state = "launcheract" - for(var/obj/machinery/sparker/M in world) + for(var/obj/machinery/sparker/M in GLOB.machines) if(M.id == id) spawn( 0 ) M.spark() - for(var/obj/machinery/igniter/M in world) + for(var/obj/machinery/igniter/M in GLOB.machines) if(M.id == id) use_power(50) M.on = !( M.on ) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 24ffb494422..b66cad8d328 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -360,15 +360,12 @@ for(var/obj/machinery/camera/C in oview(4, M)) if(C.can_use()) // check if camera disabled return C - break return null /proc/near_range_camera(mob/M) for(var/obj/machinery/camera/C in range(4, M)) if(C.can_use()) // check if camera disabled return C - break - return null /obj/machinery/camera/proc/Togglelight(on = FALSE) diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index c0949fb3c9d..b7ae75cd13f 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -41,7 +41,7 @@ number = 1 var/area/A = get_area(src) if(A) - for(var/obj/machinery/camera/autoname/C in world) + for(var/obj/machinery/camera/autoname/C in GLOB.machines) if(C == src) continue var/area/CA = get_area(C) if(CA.type == A.type) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index a98d7b08c13..c622b12c94c 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -27,7 +27,7 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ desc = "An electronically-lockable pod for growing organic tissue." density = 1 icon = 'icons/obj/cloning.dmi' - icon_state = "pod_0" + icon_state = "pod_idle" req_access = list(ACCESS_GENETICS) //For premature unlocking. var/mob/living/carbon/human/occupant @@ -419,7 +419,9 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ /obj/machinery/clonepod/screwdriver_act(mob/user, obj/item/I) . = TRUE - default_deconstruction_screwdriver(user, "[icon_state]_maintenance", "[initial(icon_state)]", I) + // These icon states don't really matter since we need to call update_icon() to handle panel open/closed overlays anyway. + default_deconstruction_screwdriver(user, null, null, I) + update_icon() /obj/machinery/clonepod/wrench_act(mob/user, obj/item/I) . = TRUE @@ -545,11 +547,17 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ /obj/machinery/clonepod/update_icon() ..() - icon_state = "pod_0" + cut_overlays() + + if(panel_open) + add_overlay("panel_open") + if(occupant && !(stat & NOPOWER)) - icon_state = "pod_1" - else if(mess && !panel_open) - icon_state = "pod_g" + icon_state = "pod_cloning" + else if(mess) + icon_state = "pod_mess" + else + icon_state = "pod_idle" /obj/machinery/clonepod/relaymove(mob/user) if(user.stat == CONSCIOUS) diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index adc4175a45d..b502d6e5441 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -45,7 +45,6 @@ var/list/req_components = null var/powernet = null var/list/records = null - var/frame_desc = null var/contain_parts = 1 toolspeed = 1 usesound = 'sound/items/deconstruct.ogg' @@ -64,7 +63,7 @@ var/atom/A = B if(!ispath(A)) continue - nice_list += list("[req_components[A]] [initial(A.name)]") + nice_list += list("[req_components[A]] [initial(A.name)]\s") . += "Required components: [english_list(nice_list)]." /obj/item/circuitboard/message_monitor @@ -351,9 +350,6 @@ build_path = /obj/machinery/computer/telescience origin_tech = "programming=3;bluespace=3;plasmatech=4" -/obj/item/circuitboard/atmos_automation - name = "Circuit board (Atmospherics Automation)" - build_path = /obj/machinery/computer/general_air_control/atmos_automation /obj/item/circuitboard/large_tank_control name = "Circuit board (Atmospheric Tank Control)" build_path = /obj/machinery/computer/general_air_control/large_tank_control diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 1649397a68f..3f8fc080bf8 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -53,6 +53,9 @@ return TRUE /obj/machinery/computer/security/check_eye(mob/user) + if((stat & (NOPOWER|BROKEN)) || user.incapacitated() || !user.has_vision()) + user.unset_machine() + return if(!(user in watchers)) user.unset_machine() return @@ -65,8 +68,6 @@ return if(!can_access_camera(C, user)) user.unset_machine() - return - return 1 /obj/machinery/computer/security/on_unset_machine(mob/user) watchers.Remove(user) diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm index 76242c4a0e4..bc1bfe6135b 100644 --- a/code/game/machinery/computer/camera_advanced.dm +++ b/code/game/machinery/computer/camera_advanced.dm @@ -37,17 +37,14 @@ eyeobj.RemoveImages() eyeobj.eye_user = null user.remote_control = null - user.remote_view = FALSE current_user = null user.unset_machine() playsound(src, 'sound/machines/terminal_off.ogg', 25, 0) /obj/machinery/computer/camera_advanced/check_eye(mob/user) - if((stat & (NOPOWER|BROKEN)) || !Adjacent(user) || !user.has_vision() || user.incapacitated()) + if((stat & (NOPOWER|BROKEN)) || (!Adjacent(user) && !user.has_unlimited_silicon_privilege) || !user.has_vision() || user.incapacitated()) user.unset_machine() - return 0 - return 1 /obj/machinery/computer/camera_advanced/Destroy() if(current_user) @@ -99,8 +96,6 @@ current_user = user eyeobj.eye_user = user eyeobj.name = "Camera Eye ([user.name])" - // This should be able to be excised once the full view refactor rolls out - user.remote_view = 1 user.remote_control = eyeobj user.reset_perspective(eyeobj) diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index 40005f8fd12..978ba25b8d3 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -25,7 +25,8 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) /datum/job/ntnavyofficer, /datum/job/ntspecops, /datum/job/civilian, - /datum/job/syndicateofficer + /datum/job/syndicateofficer, + /datum/job/explorer // blacklisted so that HOPs don't try prioritizing it, then wonder why that doesn't work ) // Jobs that appear in the list, and you can prioritize, but not open/close slots for var/list/blacklisted_partial = list( diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index aec41c80be3..2ec8611f420 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -135,7 +135,7 @@ /obj/machinery/computer/screwdriver_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(circuit && !(flags & NODECONSTRUCT)) if(I.use_tool(src, user, 20, volume = I.tool_volume)) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 9464c43b107..3674358f07f 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -121,7 +121,7 @@ data["virus"] += list(list("name" = DS.name, "D" = D)) if(MED_DATA_MEDBOT) data["medbots"] = list() - for(var/mob/living/simple_animal/bot/medbot/M in world) + for(var/mob/living/simple_animal/bot/medbot/M in GLOB.bots_list) if(M.z != z) continue var/turf/T = get_turf(M) diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm index 6ea095028a2..bafcd2d8ca2 100644 --- a/code/game/machinery/computer/pod.dm +++ b/code/game/machinery/computer/pod.dm @@ -23,7 +23,7 @@ timings = list() times = list() synced = list() - for(var/obj/machinery/mass_driver/M in world) + for(var/obj/machinery/mass_driver/M in GLOB.machines) if(M.z != src.z) continue for(var/ident_tag in id_tags) if((M.id_tag == ident_tag) && !(ident_tag in synced)) @@ -49,7 +49,7 @@ return /obj/machinery/computer/pod/proc/solo_sync(var/ident_tag) - for(var/obj/machinery/mass_driver/M in world) + for(var/obj/machinery/mass_driver/M in GLOB.machines) if(M.z != src.z) continue if((M.id_tag == ident_tag) && !(ident_tag in synced)) synced += ident_tag @@ -78,7 +78,7 @@ if(stat & (NOPOWER|BROKEN)) return var/anydriver = 0 - for(var/obj/machinery/mass_driver/M in world) + for(var/obj/machinery/mass_driver/M in GLOB.machines) if(M.z != src.z) continue if(M.id_tag == ident_tag) anydriver = 1 @@ -94,7 +94,7 @@ sleep(20) - for(var/obj/machinery/mass_driver/M in world) + for(var/obj/machinery/mass_driver/M in GLOB.machines) if(M.z != src.z) continue if(M.id_tag == ident_tag) M.drive() @@ -219,7 +219,7 @@ var/ident_tag = href_list["driver"] var/t = text2num(href_list["power"]) t = min(max(0.25, t), 16) - for(var/obj/machinery/mass_driver/M in world) + for(var/obj/machinery/mass_driver/M in GLOB.machines) if(M.id_tag == ident_tag) M.power = t powers[ident_tag] = t @@ -294,7 +294,7 @@ if(stat & (NOPOWER|BROKEN)) return var/anydriver = 0 - for(var/obj/machinery/mass_driver/M in world) + for(var/obj/machinery/mass_driver/M in GLOB.machines) if(M.z != src.z) continue if(M.id_tag == ident_tag) anydriver = 1 @@ -303,10 +303,12 @@ return var/spawn_marauder[] = new() - for(var/obj/effect/landmark/L in world) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Marauder Entry") spawn_marauder.Add(L) - for(var/obj/effect/landmark/L in world) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Marauder Exit") var/obj/effect/portal/P = new(L.loc, pick(spawn_marauder)) P.invisibility = 101//So it is not seen by anyone. @@ -320,7 +322,7 @@ M.open() sleep(20) - for(var/obj/machinery/mass_driver/M in world) + for(var/obj/machinery/mass_driver/M in GLOB.machines) if(M.z != src.z) continue if(M.id_tag == ident_tag) M.drive() diff --git a/code/game/machinery/computer/specops_shuttle.dm b/code/game/machinery/computer/specops_shuttle.dm index f509ee42d34..2ba3b25b6f6 100644 --- a/code/game/machinery/computer/specops_shuttle.dm +++ b/code/game/machinery/computer/specops_shuttle.dm @@ -93,7 +93,7 @@ GLOBAL_VAR_INIT(specops_shuttle_timeleft, 0) GLOB.specops_shuttle_at_station = 0 - for(var/obj/machinery/computer/specops_shuttle/S in world) + for(var/obj/machinery/computer/specops_shuttle/S in GLOB.machines) S.specops_shuttle_timereset = world.time + SPECOPS_RETURN_DELAY qdel(announcer) @@ -160,10 +160,12 @@ GLOBAL_VAR_INIT(specops_shuttle_timeleft, 0) sleep(10) var/spawn_marauder[] = new() - for(var/obj/effect/landmark/L in world) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Marauder Entry") spawn_marauder.Add(L.loc) - for(var/obj/effect/landmark/L in world) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Marauder Exit") var/obj/effect/portal/P = new(L.loc, pick(spawn_marauder)) //P.invisibility = 101//So it is not seen by anyone. @@ -233,7 +235,7 @@ GLOBAL_VAR_INIT(specops_shuttle_timeleft, 0) var/mob/M = locate(/mob) in T to_chat(M, "You have arrived to [station_name()]. Commence operation!") - for(var/obj/machinery/computer/specops_shuttle/S in world) + for(var/obj/machinery/computer/specops_shuttle/S in GLOB.machines) S.specops_shuttle_timereset = world.time + SPECOPS_RETURN_DELAY qdel(announcer) @@ -241,7 +243,7 @@ GLOBAL_VAR_INIT(specops_shuttle_timeleft, 0) /proc/specops_can_move() if(GLOB.specops_shuttle_moving_to_station || GLOB.specops_shuttle_moving_to_centcom) return 0 - for(var/obj/machinery/computer/specops_shuttle/S in world) + for(var/obj/machinery/computer/specops_shuttle/S in GLOB.machines) if(world.timeofday <= S.specops_shuttle_timereset) return 0 return 1 diff --git a/code/game/machinery/computer/syndicate_specops_shuttle.dm b/code/game/machinery/computer/syndicate_specops_shuttle.dm index 0a65b6be408..7ec7bd7a026 100644 --- a/code/game/machinery/computer/syndicate_specops_shuttle.dm +++ b/code/game/machinery/computer/syndicate_specops_shuttle.dm @@ -23,7 +23,7 @@ GLOBAL_VAR_INIT(syndicate_elite_shuttle_timeleft, 0) /proc/syndicate_elite_process() var/area/syndicate_mothership/control/syndicate_ship = locate()//To find announcer. This area should exist for this proc to work. - var/area/syndicate_mothership/elite_squad/elite_squad = locate()//Where is the specops area located? + //var/area/syndicate_mothership/elite_squad/elite_squad = locate()//Where is the specops area located? var/mob/living/silicon/decoy/announcer = locate() in syndicate_ship//We need a fake AI to announce some stuff below. Otherwise it will be wonky. var/message_tracker[] = list(0,1,2,3,5,10,30,45)//Create a a list with potential time values. @@ -63,7 +63,6 @@ GLOBAL_VAR_INIT(syndicate_elite_shuttle_timeleft, 0) to_chat(usr, "The Syndicate Elite shuttle is unable to leave.") return - sleep(600) /* //Begin Marauder launchpad. spawn(0)//So it parallel processes it. @@ -129,11 +128,12 @@ GLOBAL_VAR_INIT(syndicate_elite_shuttle_timeleft, 0) if("ASSAULT3") spawn(0) M.close() - */ elite_squad.readyreset()//Reset firealarm after the team launched. + */ //End Marauder launchpad. - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Syndicate Breach Area") explosion(L.loc,4,6,8,10,0) diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index 92db2f4a419..ee29504fe99 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -218,7 +218,7 @@ //Machine Frame Circuit Boards /*Common Parts: Parts List: Ignitor, Timer, Infra-red laser, Infra-red sensor, t_scanner, Capacitor, Valve, sensor unit, -micro-manipulator, console screen, beaker, Microlaser, matter bin, power cells. +micro-manipulator, glass sheets, beaker, Microlaser, matter bin, power cells. Note: Once everything is added to the public areas, will add MAT_METAL and MAT_GLASS to circuit boards since autolathe won't be able to destroy them and players will be able to make replacements. */ @@ -226,7 +226,6 @@ to destroy them and players will be able to make replacements. name = "circuit board (Booze-O-Mat Vendor)" board_type = "machine" origin_tech = "programming=1" - frame_desc = "Requires 1 Resupply Canister." build_path = /obj/machinery/vending/boozeomat req_components = list(/obj/item/vending_refill/boozeomat = 1) @@ -282,7 +281,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/power/smes board_type = "machine" origin_tech = "programming=3;powerstorage=3;engineering=3" - frame_desc = "Requires 5 pieces of cable, 5 Power Cells and 1 Capacitor." req_components = list( /obj/item/stack/cable_coil = 5, /obj/item/stock_parts/cell = 5, @@ -321,7 +319,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/atmospherics/unary/cold_sink/freezer board_type = "machine" origin_tech = "programming=3;plasmatech=3" - frame_desc = "Requires 2 Matter Bins, 2 Micro Lasers, 1 piece of cable and 1 Console Screen." req_components = list( /obj/item/stock_parts/matter_bin = 2, /obj/item/stock_parts/micro_laser = 2, @@ -346,7 +343,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/recharger board_type = "machine" origin_tech = "powerstorage=3;materials=2" - frame_desc = "Requires 1 Capacitor" req_components = list(/obj/item/stock_parts/capacitor = 1) /obj/item/circuitboard/snow_machine @@ -354,7 +350,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/snow_machine board_type = "machine" origin_tech = "programming=2;materials=2" - frame_desc = "Requires 1 Matter Bin and 1 Micro Laser." req_components = list( /obj/item/stock_parts/matter_bin = 1, /obj/item/stock_parts/micro_laser = 1) @@ -364,7 +359,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/biogenerator board_type = "machine" origin_tech = "programming=2;biotech=3;materials=3" - frame_desc = "Requires 1 Matter Bin, 1 Manipulator, 1 piece of cable and 1 Console Screen." req_components = list( /obj/item/stock_parts/matter_bin = 1, /obj/item/stock_parts/manipulator = 1, @@ -376,7 +370,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/plantgenes board_type = "machine" origin_tech = "programming=3;biotech=3" - frame_desc = "Requires 1 Manipulator, 1 Micro Laser, 1 Console Screen, and 1 Scanning Module." req_components = list( /obj/item/stock_parts/manipulator = 1, /obj/item/stock_parts/micro_laser = 1, @@ -390,7 +383,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/seed_extractor board_type = "machine" origin_tech = "programming=1" - frame_desc = "Requires 1 Matter Bin and 1 Manipulator." req_components = list( /obj/item/stock_parts/matter_bin = 1, /obj/item/stock_parts/manipulator = 1) @@ -400,7 +392,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/hydroponics/constructable board_type = "machine" origin_tech = "programming=1;biotech=2" - frame_desc = "Requires 2 Matter Bins, 1 Manipulator, and 1 Console Screen." req_components = list( /obj/item/stock_parts/matter_bin = 2, /obj/item/stock_parts/manipulator = 1, @@ -411,7 +402,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/kitchen_machine/microwave board_type = "machine" origin_tech = "programming=2;magnets=2" - frame_desc = "Requires 1 Micro Laser, 2 pieces of cable and 1 Console Screen." req_components = list( /obj/item/stock_parts/micro_laser = 1, /obj/item/stack/cable_coil = 2, @@ -422,7 +412,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/kitchen_machine/oven board_type = "machine" origin_tech = "programming=2;magnets=2" - frame_desc = "Requires 2 Micro Lasers, 5 pieces of cable and 1 Console Screen." req_components = list( /obj/item/stock_parts/micro_laser = 2, /obj/item/stack/cable_coil = 5, @@ -433,7 +422,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/kitchen_machine/grill board_type = "machine" origin_tech = "programming=2;magnets=2" - frame_desc = "Requires 2 Micro Lasers, 5 pieces of cable and 1 Console Screen." req_components = list( /obj/item/stock_parts/micro_laser = 2, /obj/item/stack/cable_coil = 5, @@ -444,7 +432,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/kitchen_machine/candy_maker board_type = "machine" origin_tech = "programming=2;magnets=2" - frame_desc = "Requires 1 Manipulator, 5 pieces of cable and 1 Console Screen." req_components = list( /obj/item/stock_parts/manipulator = 1, /obj/item/stack/cable_coil = 5, @@ -455,7 +442,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/cooker/deepfryer board_type = "machine" origin_tech = "programming=1" - frame_desc = "Requires 2 Micro Lasers and 5 pieces of cable." req_components = list( /obj/item/stock_parts/micro_laser = 2, /obj/item/stack/cable_coil = 5) @@ -568,7 +554,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/chem_dispenser board_type = "machine" origin_tech = "materials=4;programming=4;plasmatech=4;biotech=3" - frame_desc = "Requires 2 Matter Bins, 1 Capacitor, 1 Manipulator, 1 Console Screen, and 1 Power Cell." req_components = list( /obj/item/stock_parts/matter_bin = 2, /obj/item/stock_parts/capacitor = 1, /obj/item/stock_parts/manipulator = 1, @@ -609,7 +594,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/chem_heater board_type = "machine" origin_tech = "programming=2;engineering=2;biotech=2" - frame_desc = "Requires 1 Micro Laser and 1 Console Screen." req_components = list( /obj/item/stock_parts/micro_laser = 1, /obj/item/stack/sheet/glass = 1) @@ -619,7 +603,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/reagentgrinder/empty board_type = "machine" origin_tech = "materials=2;engineering=2;biotech=2" - frame_desc = "Requires 2 Manipulators and 1 Matter Bin." req_components = list( /obj/item/stock_parts/manipulator = 2, /obj/item/stock_parts/matter_bin = 1) @@ -640,7 +623,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/r_n_d/destructive_analyzer board_type = "machine" origin_tech = "magnets=2;engineering=2;programming=2" - frame_desc = "Requires 1 Scanning Module, 1 Manipulator, and 1 Micro-Laser." req_components = list( /obj/item/stock_parts/scanning_module = 1, /obj/item/stock_parts/manipulator = 1, @@ -651,7 +633,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/autolathe board_type = "machine" origin_tech = "engineering=2;programming=2" - frame_desc = "Requires 3 Matter Bins, 1 Manipulator, and 1 Console Screen." req_components = list( /obj/item/stock_parts/matter_bin = 3, /obj/item/stock_parts/manipulator = 1, @@ -662,7 +643,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/r_n_d/protolathe board_type = "machine" origin_tech = "engineering=2;programming=2" - frame_desc = "Requires 2 Matter Bins, 2 Manipulators, and 2 Beakers." req_components = list( /obj/item/stock_parts/matter_bin = 2, /obj/item/stock_parts/manipulator = 2, @@ -681,7 +661,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/r_n_d/circuit_imprinter board_type = "machine" origin_tech = "engineering=2;programming=2" - frame_desc = "Requires 1 Matter Bin, 1 Manipulator, and 2 Beakers." req_components = list( /obj/item/stock_parts/matter_bin = 1, /obj/item/stock_parts/manipulator = 1, @@ -692,7 +671,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/power/port_gen/pacman board_type = "machine" origin_tech = "programming=2;powerstorage=3;plasmatech=3;engineering=3" - frame_desc = "Requires 1 Matter Bin, 1 Micro-Laser, 2 Pieces of Cable, and 1 Capacitor." req_components = list( /obj/item/stock_parts/matter_bin = 1, /obj/item/stock_parts/micro_laser = 1, @@ -714,7 +692,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/r_n_d/server board_type = "machine" origin_tech = "programming=3" - frame_desc = "Requires 2 pieces of cable, and 1 Scanning Module." req_components = list( /obj/item/stack/cable_coil = 2, /obj/item/stock_parts/scanning_module = 1) @@ -724,7 +701,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/mecha_part_fabricator board_type = "machine" origin_tech = "programming=2;engineering=2" - frame_desc = "Requires 2 Matter Bins, 1 Manipulator, 1 Micro-Laser and 1 Console Screen." req_components = list( /obj/item/stock_parts/matter_bin = 2, /obj/item/stock_parts/manipulator = 1, @@ -736,7 +712,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/mecha_part_fabricator/spacepod board_type = "machine" origin_tech = "programming=2;engineering=2" - frame_desc = "Requires 2 Matter Bins, 1 Manipulators, 1 Micro-Lasers, and 1 Console Screen." req_components = list( /obj/item/stock_parts/matter_bin = 2, /obj/item/stock_parts/manipulator = 1, @@ -749,7 +724,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/clonepod board_type = "machine" origin_tech = "programming=2;biotech=2" - frame_desc = "Requires 2 Manipulator, 2 Scanning Module, 2 pieces of cable and 1 Console Screen." req_components = list( /obj/item/stack/cable_coil = 2, /obj/item/stock_parts/scanning_module = 2, @@ -761,7 +735,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/dna_scannernew board_type = "machine" origin_tech = "programming=2;biotech=2" - frame_desc = "Requires 1 Scanning Module, 1 Manipulator, 1 Micro-Laser, 2 pieces of cable and 1 Console Screen." req_components = list( /obj/item/stock_parts/scanning_module = 1, /obj/item/stock_parts/manipulator = 1, @@ -774,7 +747,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/mech_bay_recharge_port board_type = "machine" origin_tech = "programming=3;powerstorage=3;engineering=3" - frame_desc = "Requires 1 piece of cable and 5 Capacitors." req_components = list( /obj/item/stack/cable_coil = 1, /obj/item/stock_parts/capacitor = 5) @@ -784,7 +756,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/teleport/hub board_type = "machine" origin_tech = "programming=3;engineering=4;bluespace=4;materials=4" - frame_desc = "Requires 3 Bluespace Crystals and 1 Matter Bin." req_components = list( /obj/item/stack/ore/bluespace_crystal = 3, /obj/item/stock_parts/matter_bin = 1) @@ -794,7 +765,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/teleport/station board_type = "machine" origin_tech = "programming=4;engineering=4;bluespace=4;plasmatech=3" - frame_desc = "Requires 2 Bluespace Crystals, 2 Capacitors and 1 Console Screen." req_components = list( /obj/item/stack/ore/bluespace_crystal = 2, /obj/item/stock_parts/capacitor = 2, @@ -805,7 +775,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/teleport/perma board_type = "machine" origin_tech = "programming=3;engineering=4;bluespace=4;materials=4" - frame_desc = "Requires 3 Bluespace Crystals and 1 Matter Bin." req_components = list( /obj/item/stack/ore/bluespace_crystal = 3, /obj/item/stock_parts/matter_bin = 1) @@ -825,7 +794,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/telepad board_type = "machine" origin_tech = "programming=4;engineering=3;plasmatech=4;bluespace=4" - frame_desc = "Requires 2 Bluespace Crystals, 1 Capacitor, 1 piece of cable and 1 Console Screen." req_components = list( /obj/item/stack/ore/bluespace_crystal = 2, /obj/item/stock_parts/capacitor = 1, @@ -837,7 +805,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/quantumpad board_type = "machine" origin_tech = "programming=3;engineering=3;plasmatech=3;bluespace=4" - frame_desc = "Requires 1 Bluespace Crystal, 1 Capacitor, 1 piece of cable and 1 Manipulator." req_components = list( /obj/item/stack/ore/bluespace_crystal = 1, /obj/item/stock_parts/capacitor = 1, @@ -849,7 +816,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/sleeper board_type = "machine" origin_tech = "programming=3;biotech=2;engineering=3" - frame_desc = "Requires 1 Matter Bin, 1 Manipulator, 1 piece of cable and 2 Console Screens." req_components = list( /obj/item/stock_parts/matter_bin = 1, /obj/item/stock_parts/manipulator = 1, @@ -870,7 +836,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/bodyscanner board_type = "machine" origin_tech = "programming=3;biotech=2;engineering=3" - frame_desc = "Requires 1 Scanning Module, 2 pieces of cable and 2 Console Screens." req_components = list( /obj/item/stock_parts/scanning_module = 1, /obj/item/stack/cable_coil = 2, @@ -881,7 +846,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/atmospherics/unary/cryo_cell board_type = "machine" origin_tech = "programming=4;biotech=3;engineering=4;plasmatech=3" - frame_desc = "Requires 1 Matter Bin, 1 piece of cable and 4 Console Screens." req_components = list( /obj/item/stock_parts/matter_bin = 1, /obj/item/stack/cable_coil = 1, @@ -892,7 +856,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/recharge_station board_type = "machine" origin_tech = "powerstorage=3;engineering=3" - frame_desc = "Requires 2 Capacitors, 1 Power Cell and 1 Manipulator." req_components = list( /obj/item/stock_parts/capacitor = 2, /obj/item/stock_parts/cell = 1, @@ -904,7 +867,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/tcomms/relay board_type = "machine" origin_tech = "programming=2;engineering=2;bluespace=2" - frame_desc = "Requires 2 Manipulators and 2 Cable Coil." req_components = list(/obj/item/stock_parts/manipulator = 2, /obj/item/stack/cable_coil = 2) /obj/item/circuitboard/tcomms/core @@ -912,7 +874,6 @@ to destroy them and players will be able to make replacements. build_path = /obj/machinery/tcomms/core board_type = "machine" origin_tech = "programming=2;engineering=2" - frame_desc = "Requires 2 Manipulators and 2 Cable Coil." req_components = list(/obj/item/stock_parts/manipulator = 2, /obj/item/stack/cable_coil = 2) // End telecomms circuit boards /obj/item/circuitboard/ore_redemption @@ -975,50 +936,3 @@ to destroy them and players will be able to make replacements. /obj/item/stock_parts/micro_laser = 1, /obj/item/stack/cable_coil = 3, /obj/item/stack/sheet/glass = 1) - -//Selectable mode board, like vending machine boards -/obj/item/circuitboard/logic_gate - name = "circuit board (Logic Connector)" - build_path = /obj/machinery/logic_gate - board_type = "machine" - origin_tech = "programming=1" //This stuff is pretty much the absolute basis of programming, so it's mostly useless for research - req_components = list(/obj/item/stack/cable_coil = 1) - - var/list/names_paths = list( - "NOT Gate" = /obj/machinery/logic_gate/not, - "OR Gate" = /obj/machinery/logic_gate/or, - "AND Gate" = /obj/machinery/logic_gate/and, - "NAND Gate" = /obj/machinery/logic_gate/nand, - "NOR Gate" = /obj/machinery/logic_gate/nor, - "XOR Gate" = /obj/machinery/logic_gate/xor, - "XNOR Gate" = /obj/machinery/logic_gate/xnor, - "STATUS Gate" = /obj/machinery/logic_gate/status, - "CONVERT Gate" = /obj/machinery/logic_gate/convert - ) - -/obj/item/circuitboard/logic_gate/New() - ..() - if(build_path == /obj/machinery/logic_gate) //If we spawn the base type board (determined by the base type machine as the build path), become a random gate board - var/new_path = names_paths[pick(names_paths)] - set_type(new_path) - -/obj/item/circuitboard/logic_gate/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/screwdriver)) - set_type(null, user) - return - return ..() - -/obj/item/circuitboard/logic_gate/proc/set_type(typepath, mob/user) - var/new_name = "Logic Base" - if(!typepath) - new_name = input("Circuit Setting", "What would you change the board setting to?") in names_paths - typepath = names_paths[new_name] - else - for(var/name in names_paths) - if(names_paths[name] == typepath) - new_name = name - break - build_path = typepath - name = "circuit board ([new_name])" - if(user) - to_chat(user, "You set the board to [new_name].") diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 756a22259f0..c7dc139446a 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -533,11 +533,17 @@ /datum/data/function/proc/display() return -/obj/machinery/atmospherics/components/unary/cryo_cell/get_remote_view_fullscreens(mob/user) +/obj/machinery/atmospherics/unary/cryo_cell/get_remote_view_fullscreens(mob/user) user.overlay_fullscreen("remote_view", /obj/screen/fullscreen/impaired, 1) -/obj/machinery/atmospherics/components/unary/cryo_cell/update_remote_sight(mob/living/user) +/obj/machinery/atmospherics/unary/cryo_cell/update_remote_sight(mob/living/user) return //we don't see the pipe network while inside cryo. +/obj/machinery/atmospherics/unary/cryo_cell/can_crawl_through() + return // can't ventcrawl in or out of cryo. + +/obj/machinery/atmospherics/unary/cryo_cell/can_see_pipes() + return FALSE // you can't see the pipe network when inside a cryo cell. + #undef AUTO_EJECT_HEALTHY #undef AUTO_EJECT_DEAD diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index de077917adf..49b75588468 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -444,7 +444,7 @@ control_computer.frozen_crew += "[occupant.real_name]" var/ailist[] = list() - for(var/mob/living/silicon/ai/A in GLOB.living_mob_list) + for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list) ailist += A if(ailist.len) var/mob/living/silicon/ai/announcer = pick(ailist) diff --git a/code/game/machinery/defib_mount.dm b/code/game/machinery/defib_mount.dm index 9ee32716e53..79d02155832 100644 --- a/code/game/machinery/defib_mount.dm +++ b/code/game/machinery/defib_mount.dm @@ -29,11 +29,10 @@ loc = location if(direction) - dir = direction + setDir(direction) if(building) - pixel_x = (dir & 3)? 0 : (dir == 4 ? -30 : 30) - pixel_y = (dir & 3)? (dir == 1 ? -30 : 30) : 0 + set_pixel_offsets_from_dir(30, -30, 30, -30) /obj/machinery/defibrillator_mount/loaded/New() //loaded subtype for mapping use ..() @@ -157,6 +156,6 @@ w_class = WEIGHT_CLASS_BULKY /obj/item/mounted/frame/defib_mount/do_build(turf/on_wall, mob/user) - new /obj/machinery/defibrillator_mount(get_turf(src), get_dir(on_wall, user), 1) + new /obj/machinery/defibrillator_mount(get_turf(src), get_dir(user, on_wall), 1) playsound(src, 'sound/machines/click.ogg', 50, TRUE) qdel(src) diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index 94a3219c159..ffb56109e9e 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -42,7 +42,7 @@ WELDER_ATTEMPT_REPAIR_MESSAGE if(I.use_tool(src, user, 40, volume = I.tool_volume)) WELDER_REPAIR_SUCCESS_MESSAGE - obj_integrity = Clamp(obj_integrity + 20, 0, max_integrity) + obj_integrity = clamp(obj_integrity + 20, 0, max_integrity) update_icon() return TRUE diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 1a8828012dc..6f93afb7c6d 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -876,6 +876,8 @@ About the new airlock wires panel: if(!user.unEquip(C)) to_chat(user, "For some reason, you can't attach [C]!") return + C.add_fingerprint(user) + user.create_log(MISC_LOG, "put [C] on", src) C.forceMove(src) user.visible_message("[user] pins [C] to [src].", "You pin [C] to [src].") note = C @@ -933,7 +935,7 @@ About the new airlock wires panel: if(!panel_open || user.a_intent == INTENT_HARM) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(security_level == AIRLOCK_SECURITY_PLASTEEL) if(arePowerSystemsOn() && shock(user, 60)) // Protective grille of wiring is electrified @@ -949,7 +951,7 @@ About the new airlock wires panel: if(note) remove_airlock_note(user, TRUE) else - return interact_with_panel(user) + interact_with_panel(user) /obj/machinery/door/airlock/multitool_act(mob/user, obj/item/I) if(!headbutt_shock_check(user)) @@ -965,63 +967,58 @@ About the new airlock wires panel: . = TRUE if(!I.tool_use_check(user, 0)) return - switch(security_level) - if(AIRLOCK_SECURITY_METAL) - to_chat(user, "You begin cutting the panel's shielding...") - if(!I.use_tool(src, user, 40, volume = I.tool_volume)) - return - if(!panel_open) - return - visible_message("[user] cuts through \the [src]'s shielding.", - "You cut through \the [src]'s shielding.", - "You hear welding.") - security_level = AIRLOCK_SECURITY_NONE - spawn_atom_to_turf(/obj/item/stack/sheet/metal, user.loc, 2) - if(AIRLOCK_SECURITY_PLASTEEL_O) - to_chat(user, "You begin cutting the outer layer of shielding...") - if(!I.use_tool(src, user, 40, volume = I.tool_volume)) - return - if(!panel_open) - return - visible_message("[user] cuts through \the [src]'s shielding.", - "You cut through \the [src]'s shielding.", - "You hear welding.") - security_level = AIRLOCK_SECURITY_PLASTEEL_O_S - if(AIRLOCK_SECURITY_PLASTEEL_I) - to_chat(user, "You begin cutting the inner layer of shielding...") - if(!I.use_tool(src, user, 40, volume = I.tool_volume)) - return - if(!panel_open) - return - user.visible_message("[user] cuts through \the [src]'s shielding.", - "You cut through \the [src]'s shielding.", - "You hear welding.") - security_level = AIRLOCK_SECURITY_PLASTEEL_I_S - else - if(user.a_intent != INTENT_HELP) - user.visible_message("[user] is [welded ? "unwelding":"welding"] the airlock.", \ - "You begin [welded ? "unwelding":"welding"] the airlock...", \ + if(panel_open) // panel should be open before we try to slice out any shielding. + switch(security_level) + if(AIRLOCK_SECURITY_METAL) + to_chat(user, "You begin cutting the panel's shielding...") + if(!I.use_tool(src, user, 40, volume = I.tool_volume)) + return + visible_message("[user] cuts through \the [src]'s shielding.", + "You cut through \the [src]'s shielding.", "You hear welding.") + security_level = AIRLOCK_SECURITY_NONE + spawn_atom_to_turf(/obj/item/stack/sheet/metal, user.loc, 2) + if(AIRLOCK_SECURITY_PLASTEEL_O) + to_chat(user, "You begin cutting the outer layer of shielding...") + if(!I.use_tool(src, user, 40, volume = I.tool_volume)) + return + visible_message("[user] cuts through \the [src]'s shielding.", + "You cut through \the [src]'s shielding.", + "You hear welding.") + security_level = AIRLOCK_SECURITY_PLASTEEL_O_S + if(AIRLOCK_SECURITY_PLASTEEL_I) + to_chat(user, "You begin cutting the inner layer of shielding...") + if(!I.use_tool(src, user, 40, volume = I.tool_volume)) + return + user.visible_message("[user] cuts through \the [src]'s shielding.", + "You cut through \the [src]'s shielding.", + "You hear welding.") + security_level = AIRLOCK_SECURITY_PLASTEEL_I_S + else + if(user.a_intent != INTENT_HELP) + user.visible_message("[user] is [welded ? "unwelding":"welding"] the airlock.", \ + "You begin [welded ? "unwelding":"welding"] the airlock...", \ + "You hear welding.") - if(I.use_tool(src, user, 40, volume = I.tool_volume, extra_checks = CALLBACK(src, .proc/weld_checks, I, user))) - if(!density && !welded) - return - welded = !welded - user.visible_message("[user.name] has [welded? "welded shut":"unwelded"] [src].", \ - "You [welded ? "weld the airlock shut":"unweld the airlock"].") - update_icon() - else if(obj_integrity < max_integrity) - user.visible_message("[user] is welding the airlock.", \ - "You begin repairing the airlock...", \ - "You hear welding.") - if(I.use_tool(src, user, 40, volume = I.tool_volume, extra_checks = CALLBACK(src, .proc/weld_checks, I, user))) - obj_integrity = max_integrity - stat &= ~BROKEN - user.visible_message("[user.name] has repaired [src].", \ - "You finish repairing the airlock.") + if(I.use_tool(src, user, 40, volume = I.tool_volume, extra_checks = CALLBACK(src, .proc/weld_checks, I, user))) + if(!density && !welded) + return + welded = !welded + user.visible_message("[user.name] has [welded? "welded shut":"unwelded"] [src].", \ + "You [welded ? "weld the airlock shut":"unweld the airlock"].") update_icon() - else - to_chat(user, "The airlock doesn't need repairing.") + else if(obj_integrity < max_integrity) + user.visible_message("[user] is welding the airlock.", \ + "You begin repairing the airlock...", \ + "You hear welding.") + if(I.use_tool(src, user, 40, volume = I.tool_volume, extra_checks = CALLBACK(src, .proc/weld_checks, I, user))) + obj_integrity = max_integrity + stat &= ~BROKEN + user.visible_message("[user.name] has repaired [src].", \ + "You finish repairing the airlock.") + update_icon() + else + to_chat(user, "The airlock doesn't need repairing.") update_icon() /obj/machinery/door/airlock/proc/weld_checks(obj/item/I, mob/user) @@ -1347,10 +1344,13 @@ About the new airlock wires panel: if (ishuman(user) && user.a_intent == INTENT_GRAB)//grab that note user.visible_message("[user] removes [note] from [src].", "You remove [note] from [src].") playsound(src, 'sound/items/poster_ripped.ogg', 50, 1) - else return FALSE + else + return FALSE else user.visible_message("[user] cuts down [note] from [src].", "You remove [note] from [src].") playsound(src, 'sound/items/wirecutter.ogg', 50, 1) + note.add_fingerprint(user) + user.create_log(MISC_LOG, "removed [note] from", src) user.put_in_hands(note) note = null update_icon() diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 29549a05630..9970974e4ff 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -2,6 +2,7 @@ #define FONT_SIZE "5pt" #define FONT_COLOR "#09f" #define FONT_STYLE "Small Fonts" +#define CELL_NONE "None" /////////////////////////////////////////////////////////////////////////////////////////////// // Brig Door control displays. @@ -31,10 +32,13 @@ maptext_height = 26 maptext_width = 32 maptext_y = -1 - var/occupant = "None" - var/crimes = "None" + var/occupant = CELL_NONE + var/crimes = CELL_NONE var/time = 0 - var/officer = "None" + var/officer = CELL_NONE + var/prisoner_name = "" + var/prisoner_charge = "" + var/prisoner_time = "" /obj/machinery/door_timer/New() GLOB.celltimers_list += src @@ -45,33 +49,29 @@ return ..() /obj/machinery/door_timer/proc/print_report() - var/logname = input(usr, "Name of the guilty?","[id] log name") - var/logcharges = stripped_multiline_input(usr, "What have they been charged with?","[id] log charges") - - if(!logname || !logcharges) + if(occupant == CELL_NONE || crimes == CELL_NONE) return 0 - occupant = logname - crimes = logcharges + time = timetoset officer = usr.name for(var/obj/machinery/computer/prisoner/C in GLOB.prisoncomputer_list) var/obj/item/paper/P = new /obj/item/paper(C.loc) - P.name = "[id] log - [logname] [station_time_timestamp()]" + P.name = "[id] log - [occupant] [station_time_timestamp()]" P.info = "
[id] - Brig record



" P.info += {"
[station_name()] - Security Department

Admission data:

Log generated at: [station_time_timestamp()]
- Detainee: [logname]
+ Detainee: [occupant]
Duration: [seconds_to_time(timetoset / 10)]
- Charge(s): [logcharges]
+ Charge(s): [crimes]
Arresting Officer: [usr.name]


This log file was generated automatically upon activation of a cell timer."} playsound(C.loc, "sound/goonstation/machines/printer_dotmatrix.ogg", 50, 1) GLOB.cell_logs += P - var/datum/data/record/G = find_record("name", logname, GLOB.data_core.general) + var/datum/data/record/G = find_record("name", occupant, GLOB.data_core.general) var/prisoner_drank = "unknown" var/prisoner_trank = "unknown" if(G) @@ -80,9 +80,9 @@ if(G.fields["real_rank"]) // Ignore alt job titles - necessary for lookups prisoner_trank = G.fields["real_rank"] - var/datum/data/record/R = find_security_record("name", logname) + var/datum/data/record/R = find_security_record("name", occupant) - var/announcetext = "Detainee [logname] ([prisoner_drank]) has been incarcerated for [seconds_to_time(timetoset / 10)] for the charges of, '[logcharges]'. \ + var/announcetext = "Detainee [occupant] ([prisoner_drank]) has been incarcerated for [seconds_to_time(timetoset / 10)] for the charges of: '[crimes]'. \ Arresting Officer: [usr.name].[R ? "" : " Detainee record not found, manual record update required."]" Radio.autosay(announcetext, name, "Security", list(z)) @@ -91,15 +91,16 @@ if(R) prisoner = R - R.fields["criminal"] = "Incarcerated" + R.fields["criminal"] = SEC_RECORD_STATUS_INCARCERATED var/mob/living/carbon/human/M = usr var/rank = "UNKNOWN RANK" - if(istype(M) && M.wear_id) - var/obj/item/card/id/I = M.wear_id - rank = I.assignment + if(istype(M)) + var/obj/item/card/id/I = M.get_id_card() + if(I) + rank = I.assignment if(!R.fields["comments"] || !islist(R.fields["comments"])) //copied from security computer code because apparently these need to be initialized R.fields["comments"] = list() - R.fields["comments"] += "Autogenerated by [name] on [GLOB.current_date_string] [station_time_timestamp()]
Sentenced to [timetoset/10] seconds for the charges of \"[logcharges]\" by [rank] [usr.name]." + R.fields["comments"] += "Autogenerated by [name] on [GLOB.current_date_string] [station_time_timestamp()]
Sentenced to [timetoset/10] seconds for the charges of \"[crimes]\" by [rank] [usr.name]." update_all_mob_security_hud() return 1 @@ -136,8 +137,7 @@ Radio.config(list("Security" = 0)) Radio.follow_target = src - pixel_x = ((dir & 3)? (0) : (dir == 4 ? 32 : -32)) - pixel_y = ((dir & 3)? (dir ==1 ? 32 : -32) : (0)) + set_pixel_offsets_from_dir(32, -32, 32, -32) spawn(20) for(var/obj/machinery/door/window/brigdoor/M in GLOB.airlocks) @@ -175,12 +175,10 @@ if(timing) if(timeleft() <= 0) Radio.autosay("Timer has expired. Releasing prisoner.", name, "Security", list(z)) - occupant = "None" + occupant = CELL_NONE timer_end() // open doors, reset timer, clear status screen timing = 0 . = PROCESS_KILL - - updateUsrDialog() update_icon() else timer_end() @@ -203,8 +201,8 @@ if(!printed) if(!print_report()) - timing = 0 - return 0 + timing = FALSE + return FALSE // Set releasetime releasetime = world.timeofday + timetoset @@ -237,14 +235,14 @@ return 0 // Reset vars - occupant = "None" - crimes = "None" + occupant = CELL_NONE + crimes = CELL_NONE time = 0 - officer = "None" + officer = CELL_NONE releasetime = 0 printed = 0 if(prisoner) - prisoner.fields["criminal"] = "Released" + prisoner.fields["criminal"] = SEC_RECORD_STATUS_RELEASED update_all_mob_security_hud() prisoner = null @@ -290,10 +288,11 @@ //Allows AIs to use door_timer, see human attack_hand function below /obj/machinery/door_timer/attack_ai(mob/user) - interact(user) + attack_hand(user) + ui_interact(user) /obj/machinery/door_timer/attack_ghost(mob/user) - interact(user) + ui_interact(user) //Allows humans to use door_timer //Opens dialog window when someone clicks on door timer @@ -302,98 +301,71 @@ /obj/machinery/door_timer/attack_hand(mob/user) if(..()) return - interact(user) + ui_interact(user) -/obj/machinery/door_timer/interact(mob/user) - // Used for the 'time left' display - var/second = round(timeleft() % 60) - var/minute = round((timeleft() - second) / 60) +/obj/machinery/door_timer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) + ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open) + if(!ui) + ui = new(user, src, ui_key, "brig_timer.tmpl", "Brig Timer", 500, 400) + ui.open() + ui.set_auto_update(TRUE) - // Used for 'set timer' - var/setsecond = round((timetoset / 10) % 60) - var/setminute = round(((timetoset / 10) - setsecond) / 60) +/obj/machinery/door_timer/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state) + var/data[0] + data["cell_id"] = name + data["occupant"] = occupant + data["crimes"] = crimes + data["brigged_by"] = officer + data["time_set"] = seconds_to_clock(time / 10) + data["time_left"] = seconds_to_clock(timeleft()) + data["timing"] = timing + data["isAllowed"] = allowed(user) + data["prisoner_name"] = prisoner_name + data["prisoner_charge"] = prisoner_charge + data["prisoner_time"] = prisoner_time - user.set_machine(src) + return data - // dat - var/dat = "
Timer System:" - dat += " Door [id] controls
" - - // Start/Stop timer - if(timing) - dat += "Stop Timer and open door
" - else - dat += "Activate Timer and close door
" - - // Time Left display (uses releasetime) - dat += "Time Left: [(minute ? text("[minute]:") : null)][second]
" - dat += "
" - - // Set Timer display (uses timetoset) - if(timing) - dat += "Set Timer: [(setminute ? text("[setminute]:") : null)][setsecond] Set
" - else - dat += "Set Timer: [(setminute ? text("[setminute]:") : null)][setsecond]
" - - // Controls - dat += "Input Time" - - // Mounted flash controls - for(var/obj/machinery/flasher/F in targets) - if(F.last_flash && (F.last_flash + 150) > world.time) - dat += "
Flash Charging" - else - dat += "
Activate Flash" - - dat += "

Close" - - var/datum/browser/popup = new(user, "door_timer", name, 400, 500) - popup.set_content(dat) - popup.open() - - -//Function for using door_timer dialog input, checks if user has permission -// href_list to -// "timing" turns on timer -// "tp" value to modify timer -// "fc" activates flasher -// "change" resets the timer to the timetoset amount while the timer is counting down -// Also updates dialog window and timer icon /obj/machinery/door_timer/Topic(href, href_list) - if(..()) - return 1 - if(!allowed(usr) && !usr.can_admin_interact()) return 1 - usr.set_machine(src) - - if(href_list["timing"]) - timing = text2num(href_list["timing"]) - - if(timing) - timer_start() - else - timer_end() - if(!isobserver(usr)) //spooky admin ghosts are in your brig, releasing your prisoners - Radio.autosay("Timer stopped manually by [usr.name].", name, "Security", list(z)) - - else - if(href_list["settime"]) - var/time = min(max(round(return_time_input(usr)), 0), 3600) - timeset(time) - - if(href_list["fc"]) - for(var/obj/machinery/flasher/F in targets) + if(href_list["flash"]) + for(var/obj/machinery/flasher/F in targets) + if(F.last_flash && (F.last_flash + 150) > world.time) + to_chat(usr, "Flash still charging.") + else F.flash() - if(href_list["change"]) - printed = 1 - timer_start() + if(href_list["release"]) + if(timing) + timer_end() + Radio.autosay("Timer stopped manually from cell control.", name, "Security", list(z)) + ui_interact(usr) - add_fingerprint(usr) - updateUsrDialog() - update_icon() + if(href_list["prisoner_name"]) + prisoner_name = input("Prisoner Name:", name, prisoner_name) as text|null + + if(href_list["prisoner_charge"]) + prisoner_charge = input("Prisoner Charge:", name, prisoner_charge) as text|null + + if(href_list["prisoner_time"]) + prisoner_time = input("Prisoner Time (in minutes):", name, prisoner_time) as num|null + prisoner_time = min(max(round(prisoner_time), 0), 60) + + if(href_list["set_timer"]) + if(!prisoner_name || !prisoner_charge || !prisoner_time) + return + timeset(prisoner_time * 60) + occupant = prisoner_name + crimes = prisoner_charge + prisoner_name = "" + prisoner_charge = "" + prisoner_time = "" + timing = TRUE + timer_start() + ui_interact(usr) + update_icon() //icon update function @@ -502,3 +474,4 @@ #undef FONT_COLOR #undef FONT_STYLE #undef CHARS_PER_LINE +#undef CELL_NONE diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 448c410c1c8..37dbdb6c9c0 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -419,7 +419,7 @@ if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return user.visible_message("[user] starts cutting the wires from [src]...", \ @@ -442,7 +442,7 @@ if(locate(/obj/machinery/door/firedoor) in get_turf(src)) to_chat(user, "There's already a firelock there.") return - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return user.visible_message("[user] starts bolting down [src]...", \ "You begin bolting [src]...") diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 9beba3f4789..f12361f1664 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -309,13 +309,13 @@ FIRE ALARM update_icon() /obj/machinery/firealarm/New(location, direction, building) - ..() + . = ..() if(building) buildstage = 0 wiresexposed = TRUE - pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) - pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0 + setDir(direction) + set_pixel_offsets_from_dir(26, -26, 26, -26) if(is_station_contact(z) && show_alert_level) if(GLOB.security_level) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index b7b7e35eef6..37766db58fb 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -58,6 +58,8 @@ playsound(loc, 'sound/weapons/flash.ogg', 100, 1) flick("[base_state]_flash", src) + set_light(2, 1, COLOR_WHITE) + addtimer(CALLBACK(src, /atom./proc/set_light, 0), 2) last_flash = world.time use_power(1000) @@ -142,7 +144,7 @@ active = 1 icon_state = "launcheract" - for(var/obj/machinery/flasher/M in world) + for(var/obj/machinery/flasher/M in GLOB.machines) if(M.id == id) spawn() M.flash() diff --git a/code/game/machinery/holosign.dm b/code/game/machinery/holosign.dm index aca4254b517..aa541ec8619 100644 --- a/code/game/machinery/holosign.dm +++ b/code/game/machinery/holosign.dm @@ -67,7 +67,7 @@ else icon_state = "light0" - for(var/obj/machinery/holosign/M in world) + for(var/obj/machinery/holosign/M in GLOB.machines) if(M.id == src.id) spawn( 0 ) M.toggle() diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 19dc80f9a40..f02e037e8c5 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -116,8 +116,8 @@ Class Procs: var/panel_open = 0 var/area/myArea var/interact_offline = 0 // Can the machine be interacted with while de-powered. - var/use_log = list() - var/list/settagwhitelist = list()//WHITELIST OF VARIABLES THAT THE set_tag HREF CAN MODIFY, DON'T PUT SHIT YOU DON'T NEED ON HERE, AND IF YOU'RE GONNA USE set_tag (format_tag() proc), ADD TO THIS LIST. + var/list/use_log // Init this list if you wish to add logging to your machine - currently only viewable in VV + var/list/settagwhitelist // (Init this list if needed) WHITELIST OF VARIABLES THAT THE set_tag HREF CAN MODIFY, DON'T PUT SHIT YOU DON'T NEED ON HERE, AND IF YOU'RE GONNA USE set_tag (format_tag() proc), ADD TO THIS LIST. atom_say_verb = "beeps" var/siemens_strength = 0.7 // how badly will it shock you? @@ -224,7 +224,7 @@ Class Procs: var/obj/item/multitool/P = get_multitool(usr) if(P && istype(P)) var/update_mt_menu = FALSE - if("set_tag" in href_list) + if("set_tag" in href_list && settagwhitelist) if(!(href_list["set_tag"] in settagwhitelist))//I see you're trying Href exploits, I see you're failing, I SEE ADMIN WARNING. (seriously though, this is a powerfull HREF, I originally found this loophole, I'm not leaving it in on my PR) message_admins("set_tag HREF (var attempted to edit: [href_list["set_tag"]]) exploit attempted by [key_name_admin(user)] on [src] (JMP)") return FALSE @@ -369,7 +369,6 @@ Class Procs: /obj/machinery/proc/RefreshParts() //Placeholder proc for machines that are built using frames. return - return 0 /obj/machinery/proc/assign_uid() uid = gl_uid diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm index b73fa94259f..d713817ca06 100644 --- a/code/game/machinery/magnet.dm +++ b/code/game/machinery/magnet.dm @@ -202,7 +202,7 @@ ..() if(autolink) - for(var/obj/machinery/magnetic_module/M in world) + for(var/obj/machinery/magnetic_module/M in GLOB.machines) if(M.freq == frequency && M.code == code) magnets.Add(M) @@ -224,7 +224,7 @@ /obj/machinery/magnetic_controller/process() if(magnets.len == 0 && autolink) - for(var/obj/machinery/magnetic_module/M in world) + for(var/obj/machinery/magnetic_module/M in GLOB.machines) if(M.freq == frequency && M.code == code) magnets.Add(M) diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index b63f4ab7f8b..79f1eb83e23 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -520,8 +520,6 @@ GLOBAL_LIST_EMPTY(turret_icons) /obj/machinery/porta_turret/process() //the main machinery process - set background = BACKGROUND_ENABLED - if(stat & (NOPOWER|BROKEN)) if(!always_up) //if the turret has no power or is broken, make the turret pop down if it hasn't already diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 081a48c3da1..e4e37ae1bcb 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -19,8 +19,7 @@ var/item_recycle_sound = 'sound/machines/recycler.ogg' /obj/machinery/recycler/New() - AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_PLASTIC, MAT_BLUESPACE), 0, - TRUE, null, null, null, TRUE) + AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_PLASTIC, MAT_BLUESPACE), 0, TRUE, null, null, null, TRUE) ..() component_parts = list() component_parts += new /obj/item/circuitboard/recycler(null) @@ -37,7 +36,7 @@ mat_mod *= 50000 for(var/obj/item/stock_parts/manipulator/M in component_parts) amt_made = 25 * M.rating //% of materials salvaged - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.max_amount = mat_mod amount_produced = min(100, amt_made) @@ -135,7 +134,7 @@ /obj/machinery/recycler/proc/recycle_item(obj/item/I) I.forceMove(loc) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/material_amount = materials.get_item_material_amount(I) if(!material_amount) qdel(I) diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 095b2e7d56e..6529dd4b73d 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -200,7 +200,7 @@ GLOBAL_LIST_EMPTY(allRequestConsoles) var/log_msg = message var/pass = 0 screen = RCS_SENTFAIL - for(var/obj/machinery/message_server/MS in world) + for(var/obj/machinery/message_server/MS in GLOB.machines) if(!MS.active) continue MS.send_rc_message(ckey(href_list["department"]),department,log_msg,msgStamped,msgVerified,priority) pass = 1 diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index 6299be7be3d..a5cff57ad52 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -121,7 +121,8 @@ if(user) to_chat(user, "The connected wire doesn't have enough current.") return - for(var/obj/singularity/singulo in GLOB.singularities) + for(var/thing in GLOB.singularities) + var/obj/singularity/singulo = thing if(singulo.z == z) singulo.target = src icon_state = "[icontype]1" @@ -132,7 +133,8 @@ /obj/machinery/power/singularity_beacon/proc/Deactivate(mob/user = null) - for(var/obj/singularity/singulo in world) + for(var/thing in GLOB.singularities) + var/obj/singularity/singulo = thing if(singulo.target == src) singulo.target = null icon_state = "[icontype]0" diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index b3745f947cd..2d15472f521 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -244,7 +244,7 @@ /obj/machinery/syndicatebomb/proc/settings(mob/user) var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num if(can_interact(user)) //No running off and setting bombs from across the station - timer_set = Clamp(new_timer, minimum_timer, maximum_timer) + timer_set = clamp(new_timer, minimum_timer, maximum_timer) loc.visible_message("[bicon(src)] timer set for [timer_set] seconds.") if(alert(user,"Would you like to start the countdown now?",,"Yes","No") == "Yes" && can_interact(user)) if(defused || active) diff --git a/code/game/machinery/tcomms/_base.dm b/code/game/machinery/tcomms/_base.dm index a857afcef89..7fc2ddae23b 100644 --- a/code/game/machinery/tcomms/_base.dm +++ b/code/game/machinery/tcomms/_base.dm @@ -171,6 +171,8 @@ GLOBAL_LIST_EMPTY(tcomms_machines) var/vname /// List of all channels this can be sent or recieved on var/list/zlevels = list() + /// Should this signal be re-broadcasted (Can be modified by NTTC, defaults to TRUE) + var/pass = TRUE /** * Destructor for the TCM datum. diff --git a/code/game/machinery/tcomms/core.dm b/code/game/machinery/tcomms/core.dm index 9e638913f9d..3fdae14746f 100644 --- a/code/game/machinery/tcomms/core.dm +++ b/code/game/machinery/tcomms/core.dm @@ -1,5 +1,6 @@ #define UI_TAB_CONFIG "CONFIG" #define UI_TAB_LINKS "LINKS" +#define UI_TAB_FILTER "FILTER" /** * # Telecommunications Core @@ -81,6 +82,11 @@ // Now we can run NTTC tcm = nttc.modify_message(tcm) + // If the signal shouldnt be broadcast, dont broadcast it + if(!tcm.pass) + // We still return TRUE here because the signal was handled, even though we didnt broadcast + return TRUE + // Now we generate the list of where that signal should go to tcm.zlevels = reachable_zlevels tcm.zlevels |= tcm.source_level @@ -168,6 +174,9 @@ data["entries"] += list(list("addr" = "\ref[R]", "net_id" = R.network_id, "sector" = R.loc.z, "status" = status, "status_color" = status_color)) // End the shit + if(ui_tab == UI_TAB_FILTER) + data["filtered_users"] = nttc.filtering + return data /obj/machinery/tcomms/core/Topic(href, href_list) @@ -177,7 +186,7 @@ if(href_list["tab"]) // Make sure its a valid tab - if(href_list["tab"] in list(UI_TAB_CONFIG, UI_TAB_LINKS)) + if(href_list["tab"] in list(UI_TAB_CONFIG, UI_TAB_LINKS, UI_TAB_FILTER)) ui_tab = href_list["tab"] // Check if they did a href, but only for that current tab @@ -257,9 +266,35 @@ to_chat(usr, "Successfully changed password from [link_password] to [new_password].") link_password = new_password + if(ui_tab == UI_TAB_FILTER) + if(href_list["add_filter"]) + // This is a stripped input because I did NOT come this far for this system to be abused by HTML injection + var/name_to_add = stripped_input(usr, "Enter a name to add to the filtering list", "Name Entry") + if(name_to_add == "") + return + if(name_to_add in nttc.filtering) + to_chat(usr, "ERROR: User already in filtering list.") + else + nttc.filtering |= name_to_add + log_action(usr, "has added [name_to_add] to the NTTC filter list on core with ID [network_id]", TRUE) + to_chat(usr, "Successfully added [name_to_add] to the NTTC filtering list.") + + + if(href_list["remove_filter"]) + var/name_to_remove = href_list["remove_filter"] + if(!(name_to_remove in nttc.filtering)) + to_chat(usr, "ERROR: Name does not exist in filter list. Please file an issue report.") + else + var/confirm = alert(usr, "Are you sure you want to remove [name_to_remove] from the filtering list?", "Confirm Removal", "Yes", "No") + if(confirm == "Yes") + nttc.filtering -= name_to_remove + log_action(usr, "has removed [name_to_remove] from the NTTC filter list on core with ID [network_id]", TRUE) + to_chat(usr, "Successfully removed [name_to_remove] from the NTTC filtering list.") + // Hack to speed update the nanoUI SSnanoui.update_uis(src) #undef UI_TAB_CONFIG #undef UI_TAB_LINKS +#undef UI_TAB_FILTER diff --git a/code/game/machinery/tcomms/nttc.dm b/code/game/machinery/tcomms/nttc.dm index 6ee158c6cc0..14e932dcf7f 100644 --- a/code/game/machinery/tcomms/nttc.dm +++ b/code/game/machinery/tcomms/nttc.dm @@ -153,6 +153,10 @@ var/list/job_card_styles = list( JOB_STYLE_1, JOB_STYLE_2, JOB_STYLE_3, JOB_STYLE_4 ) + + // List of people who will get blocked out of comms + var/list/filtering = list() + // Used to determine what languages are allowable for conversion. Generated during runtime. var/list/valid_languages = list("--DISABLE--") @@ -220,6 +224,9 @@ // Primary signal modification. This is where all of the variables behavior are actually implemented. /datum/nttc_configuration/proc/modify_message(datum/tcomms_message/tcm) + // Check if they should be blacklisted right off the bat. We can save CPU if the message wont even be processed + if(tcm.sender_name in filtering) + tcm.pass = FALSE // All job and coloring shit if(toggle_job_color || toggle_name_color) var/job = tcm.sender_job diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index c0b1c44f806..cc9fc3e4666 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -317,7 +317,7 @@ scramble(1, H, 100) H.generate_name() H.sync_organ_dna(assimilate = 1) - H.update_body(0) + H.update_body() H.reset_hair() H.dna.ResetUIFrom(H) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 1487256c712..7aa5661febe 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -190,7 +190,6 @@ var/obj/item/vending_refill/R = locate() in component_parts if(!R) CRASH("Constructible vending machine did not have a refill canister") - return R.products = unbuild_inventory(product_records) R.contraband = unbuild_inventory(hidden_records) diff --git a/code/game/mecha/combat/gygax.dm b/code/game/mecha/combat/gygax.dm index d9ec4412ab3..0898936cbfb 100644 --- a/code/game/mecha/combat/gygax.dm +++ b/code/game/mecha/combat/gygax.dm @@ -39,7 +39,7 @@ icon_state = "darkgygax" initial_icon = "darkgygax" max_integrity = 300 - deflect_chance = 15 + deflect_chance = 20 armor = list(melee = 40, bullet = 40, laser = 50, energy = 35, bomb = 20, bio = 0, rad =20, fire = 100, acid = 100) max_temperature = 35000 leg_overload_coeff = 100 @@ -50,16 +50,24 @@ starting_voice = /obj/item/mecha_modkit/voice/syndicate destruction_sleep_duration = 1 +/obj/mecha/combat/gygax/dark/GrantActions(mob/living/user, human_occupant = 0) + . = ..() + thrusters_action.Grant(user, src) + +/obj/mecha/combat/gygax/dark/RemoveActions(mob/living/user, human_occupant = 0) + . = ..() + thrusters_action.Remove(user) + /obj/mecha/combat/gygax/dark/loaded/New() ..() - var/obj/item/mecha_parts/mecha_equipment/ME = new /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/carbine + var/obj/item/mecha_parts/mecha_equipment/ME = new /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/scattershot ME.attach(src) - ME = new /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/flashbang + ME = new /obj/item/mecha_parts/mecha_equipment/anticcw_armor_booster ME.attach(src) - ME = new /obj/item/mecha_parts/mecha_equipment/teleporter/precise + ME = new /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster ME.attach(src) ME = new /obj/item/mecha_parts/mecha_equipment/tesla_energy_relay ME.attach(src) /obj/mecha/combat/gygax/dark/add_cell() - cell = new /obj/item/stock_parts/cell/hyper(src) + cell = new /obj/item/stock_parts/cell/bluespace(src) diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm index 43937ab1111..61ba683ad18 100644 --- a/code/game/mecha/equipment/tools/other_tools.dm +++ b/code/game/mecha/equipment/tools/other_tools.dm @@ -206,6 +206,7 @@ /obj/item/mecha_parts/mecha_equipment/repair_droid/detach() chassis.overlays -= droid_overlay STOP_PROCESSING(SSobj, src) + return ..() /obj/item/mecha_parts/mecha_equipment/repair_droid/get_equip_info() if(!chassis) return diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 90256fe5d2a..50fdfef3cb3 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -38,9 +38,7 @@ ) /obj/machinery/mecha_part_fabricator/New() - var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, - list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE), 0, - FALSE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) + var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE), 0, FALSE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) materials.precise_insertion = TRUE ..() component_parts = list() @@ -65,7 +63,7 @@ RefreshParts() /obj/machinery/mecha_part_fabricator/Destroy() - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() return ..() @@ -75,7 +73,7 @@ //maximum stocking amount (default 300000, 600000 at T4) for(var/obj/item/stock_parts/matter_bin/M in component_parts) T += M.rating - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.max_amount = (200000 + (T*50000)) //resources adjustment coefficient (1 -> 0.85 -> 0.7 -> 0.55) @@ -118,7 +116,7 @@ /obj/machinery/mecha_part_fabricator/proc/output_available_resources() var/output - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/mat_id in materials.materials) var/datum/material/M = materials.materials[mat_id] output += "[M.name]: [M.amount] cm³" @@ -139,7 +137,7 @@ /obj/machinery/mecha_part_fabricator/proc/check_resources(datum/design/D) if(D.reagents_list.len) // No reagents storage - no reagent designs. return FALSE - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) if(materials.has_materials(get_resources_w_coeff(D))) return TRUE return FALSE @@ -149,7 +147,7 @@ desc = "It's building \a [initial(D.name)]." var/list/res_coef = get_resources_w_coeff(D) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.use_amount(res_coef) overlays += "fab-active" use_power = ACTIVE_POWER_USE @@ -392,7 +390,7 @@ var/index = afilter.getNum("index") var/new_index = index + afilter.getNum("queue_move") if(isnum(index) && isnum(new_index)) - if(IsInRange(new_index,1,queue.len)) + if(ISINRANGE(new_index,1,queue.len)) queue.Swap(index,new_index) return update_queue_on_page() if(href_list["clear_queue"]) @@ -414,7 +412,7 @@ break if(href_list["remove_mat"] && href_list["material"]) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_sheets(text2num(href_list["remove_mat"]), href_list["material"]) updateUsrDialog() diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 7efa81863b6..4c912cf8e55 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -609,6 +609,8 @@ occupant = null icon_state = initial(icon_state)+"-open" setDir(dir_in) + if(A in trackers) + trackers -= A /obj/mecha/Destroy() if(occupant) @@ -639,7 +641,7 @@ cabin_air = null QDEL_NULL(spark_system) QDEL_NULL(smoke_system) - + QDEL_LIST(trackers) GLOB.mechas_list -= src //global mech list return ..() @@ -1102,7 +1104,6 @@ occupant = H H.stop_pulling() H.forceMove(src) - H.reset_perspective(src) add_fingerprint(H) GrantActions(H, human_occupant = 1) forceMove(loc) @@ -1455,7 +1456,7 @@ ..() -/obj/mecha/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) +/obj/mecha/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!no_effect) if(selected) used_item = selected diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index 9a3dffb0c3b..f72770a8ea3 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -28,7 +28,12 @@ data["screen"] = screen if(screen == 0) var/list/mechas[0] - for(var/obj/item/mecha_parts/mecha_tracking/TR in world) + var/list/trackerlist = list() + for(var/stompy in GLOB.mechas_list) + var/obj/mecha/MC = stompy + trackerlist += MC.trackers + for(var/thing in trackerlist) + var/obj/item/mecha_parts/mecha_tracking/TR = thing var/answer = TR.get_mecha_info() if(answer) mechas[++mechas.len] = answer diff --git a/code/game/mecha/working/ripley.dm b/code/game/mecha/working/ripley.dm index 494fc70d36b..7569d8b5263 100644 --- a/code/game/mecha/working/ripley.dm +++ b/code/game/mecha/working/ripley.dm @@ -124,8 +124,7 @@ //Attach hydraulic clamp var/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp/HC = new HC.attach(src) - for(var/obj/item/mecha_parts/mecha_tracking/B in trackers)//Deletes the beacon so it can't be found easily - qdel(B) + QDEL_LIST(trackers) //Deletes the beacon so it can't be found easily var/obj/item/mecha_parts/mecha_equipment/mining_scanner/scanner = new scanner.attach(src) diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm index 1e7ad8397ee..b7eea1b367f 100644 --- a/code/game/objects/effects/decals/Cleanable/humans.dm +++ b/code/game/objects/effects/decals/Cleanable/humans.dm @@ -86,7 +86,7 @@ GLOBAL_LIST_EMPTY(splatter_cache) user.blood_DNA |= blood_DNA.Copy() user.bloody_hands += taken user.hand_blood_color = basecolor - user.update_inv_gloves(1) + user.update_inv_gloves() user.verbs += /mob/living/carbon/human/proc/bloody_doodle /obj/effect/decal/cleanable/blood/can_bloodcrawl_in() diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm index 434c0af1136..a0006fd00d6 100644 --- a/code/game/objects/effects/misc.dm +++ b/code/game/objects/effects/misc.dm @@ -88,7 +88,7 @@ name = "horrific experiment" desc = "Some sort of pod filled with blood and vicerea. You swear you can see it moving..." icon = 'icons/obj/cloning.dmi' - icon_state = "pod_g" + icon_state = "pod_mess" //Makes a tile fully lit no matter what diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index d97663759af..7af5d7a998f 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -98,6 +98,7 @@ pixel_x = rand(6,-6) pixel_y = rand(6,-6) START_PROCESSING(SSobj, src) + AddComponent(/datum/component/swarming) /obj/structure/spider/spiderling/Destroy() STOP_PROCESSING(SSobj, src) diff --git a/code/game/objects/effects/step_triggers.dm b/code/game/objects/effects/step_triggers.dm index 0a47e57112e..bde6cb538df 100644 --- a/code/game/objects/effects/step_triggers.dm +++ b/code/game/objects/effects/step_triggers.dm @@ -51,7 +51,7 @@ var/list/affecting = list() /obj/effect/step_trigger/thrower/Trigger(atom/A) - if(!A || !ismovableatom(A)) + if(!A || !ismovable(A)) return var/atom/movable/AM = A var/curtiles = 0 diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index 54ddb01b653..1b31891e537 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -88,7 +88,7 @@ var/turf/T = A if(!T) continue - var/dist = hypotenuse(T.x, T.y, x0, y0) + var/dist = HYPOTENUSE(T.x, T.y, x0, y0) if(config.reactionary_explosions) var/turf/Trajectory = T @@ -209,7 +209,7 @@ var/list/wipe_colours = list() for(var/turf/T in spiral_range_turfs(max_range, epicenter)) wipe_colours += T - var/dist = hypotenuse(T.x, T.y, x0, y0) + var/dist = HYPOTENUSE(T.x, T.y, x0, y0) if(newmode == "Yes") var/turf/TT = T diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index fba55ba0557..c571330b7e5 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -19,6 +19,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect can_be_hit = FALSE suicidal_hands = TRUE + var/list/attack_verb //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]" var/hitsound = null var/usesound = null var/throwhitsound @@ -98,15 +99,6 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect var/icon_override = null //Used to override hardcoded clothing dmis in human clothing proc. var/sprite_sheets_obj = null //Used to override hardcoded clothing inventory object dmis in human clothing proc. - var/trip_verb = TV_TRIP - var/trip_chance = 0 - - var/trip_stun = 0 - var/trip_weaken = 0 - var/trip_any = FALSE - var/trip_walksafe = TRUE - var/trip_tiles = 0 - //Tooltip vars var/in_inventory = FALSE //is this item equipped into an inventory slot or hand of a mob? var/tip_timer = 0 @@ -606,16 +598,6 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect /obj/item/proc/is_equivalent(obj/item/I) return I == src -/obj/item/Crossed(atom/movable/AM, oldloc) - . = ..() - if(prob(trip_chance) && ishuman(AM)) - var/mob/living/carbon/human/H = AM - on_trip(H) - -/obj/item/proc/on_trip(mob/living/carbon/human/H) - if(H.slip(src, trip_stun, trip_weaken, trip_tiles, trip_walksafe, trip_any, trip_verb)) - return TRUE - /obj/item/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum) return diff --git a/code/game/objects/items/devices/camera_bug.dm b/code/game/objects/items/devices/camera_bug.dm index 7acf6b61a6d..7724d499e7e 100644 --- a/code/game/objects/items/devices/camera_bug.dm +++ b/code/game/objects/items/devices/camera_bug.dm @@ -54,21 +54,21 @@ user.set_machine(src) interact(user) -/obj/item/camera_bug/check_eye(var/mob/user as mob) - if(user.stat || loc != user || !user.canmove || !user.has_vision() || !current) - user.reset_perspective(null) +/obj/item/camera_bug/check_eye(mob/user) + if(loc != user || user.incapacitated() || !user.has_vision() || !current) user.unset_machine() - return null - - var/turf/T = get_turf(user.loc) - if(T.z != current.z || !current.can_use()) + return FALSE + var/turf/T_user = get_turf(user.loc) + var/turf/T_current = get_turf(current) + if(!atoms_share_level(T_user, T_current) || !current.can_use()) to_chat(user, "[src] has lost the signal.") current = null - user.reset_perspective(null) user.unset_machine() - return null + return FALSE + return TRUE - return 1 +/obj/item/camera_bug/on_unset_machine(mob/user) + user.reset_perspective(null) /obj/item/camera_bug/proc/get_cameras() if(world.time > (last_net_update + 100)) @@ -182,7 +182,6 @@ /obj/item/camera_bug/Topic(var/href,var/list/href_list) if(usr != loc) usr.unset_machine() - usr.reset_perspective(null) usr << browse(null, "window=camerabug") return usr.set_machine(src) @@ -233,7 +232,6 @@ interact() else usr.unset_machine() - usr.reset_perspective(null) usr << browse(null, "window=camerabug") return else diff --git a/code/game/objects/items/devices/enginepicker.dm b/code/game/objects/items/devices/enginepicker.dm index a2fa30a243b..0fd3a591560 100644 --- a/code/game/objects/items/devices/enginepicker.dm +++ b/code/game/objects/items/devices/enginepicker.dm @@ -76,7 +76,7 @@ new G(T) //Spawns the switch-selected engine on the chosen beacon's turf var/ailist[] = list() - for(var/mob/living/silicon/ai/A in GLOB.living_mob_list) + for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list) ailist += A if(ailist.len) var/mob/living/silicon/ai/announcer = pick(ailist) diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm index b8602e671c3..58848f3f7e4 100644 --- a/code/game/objects/items/devices/flash.dm +++ b/code/game/objects/items/devices/flash.dm @@ -67,20 +67,22 @@ times_used = max(0, times_used) //sanity -/obj/item/flash/proc/try_use_flash(var/mob/user = null) +/obj/item/flash/proc/try_use_flash(mob/user = null) flash_recharge(user) if(broken) - return 0 + return FALSE - playsound(src.loc, use_sound, 100, 1) + playsound(loc, use_sound, 100, 1) flick("[initial(icon_state)]2", src) + set_light(2, 1, COLOR_WHITE) + addtimer(CALLBACK(src, /atom./proc/set_light, 0), 2) times_used++ if(user && !clown_check(user)) - return 0 + return FALSE - return 1 + return TRUE /obj/item/flash/proc/flash_carbon(var/mob/living/carbon/M, var/mob/user = null, var/power = 5, targeted = 1) diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 4ce64a859ec..307964ca25c 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -74,7 +74,7 @@ if(istype(H)) //robots and aliens are unaffected var/obj/item/organ/internal/eyes/eyes = H.get_int_organ(/obj/item/organ/internal/eyes) - if(M.stat == DEAD || !eyes || M.disabilities & BLIND) //mob is dead or fully blind + if(M.stat == DEAD || !eyes || (BLINDNESS in M.mutations)) //mob is dead or fully blind to_chat(user, "[M]'s pupils are unresponsive to the light!") else if((XRAY in M.mutations) || eyes.see_in_dark >= 8) //The mob's either got the X-RAY vision or has a tapetum lucidum (extreme nightvision, i.e. Vulp/Tajara with COLOURBLIND & their monkey forms). to_chat(user, "[M]'s pupils glow eerily!") diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index d9c6d60cf54..7a6b41966a8 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -167,7 +167,7 @@ // Negative numbers will subtract /obj/item/lightreplacer/proc/AddUses(amount = 1) - uses = Clamp(uses + amount, 0, max_uses) + uses = clamp(uses + amount, 0, max_uses) /obj/item/lightreplacer/proc/AddShards(amount = 1, user) bulb_shards += amount diff --git a/code/game/objects/items/devices/pizza_bomb.dm b/code/game/objects/items/devices/pizza_bomb.dm index c12331b2be2..dd824332ad3 100644 --- a/code/game/objects/items/devices/pizza_bomb.dm +++ b/code/game/objects/items/devices/pizza_bomb.dm @@ -27,7 +27,7 @@ desc = "A box suited for pizzas." icon_state = "pizzabox1" return - timer = Clamp(timer, 10, 100) + timer = clamp(timer, 10, 100) icon_state = "pizzabox1" to_chat(user, "You set the timer to [timer / 10] before activating the payload and closing \the [src].") message_admins("[key_name_admin(usr)] has set a timer on a pizza bomb to [timer/10] seconds at (JMP).") diff --git a/code/game/objects/items/devices/radio/electropack.dm b/code/game/objects/items/devices/radio/electropack.dm index 083720f0e22..284ce8d5598 100644 --- a/code/game/objects/items/devices/radio/electropack.dm +++ b/code/game/objects/items/devices/radio/electropack.dm @@ -65,7 +65,7 @@ else if(href_list["code"]) code += text2num(href_list["code"]) code = round(code) - code = Clamp(code, 1, 100) + code = clamp(code, 1, 100) else if(href_list["power"]) on = !on diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 13c97f26730..59d2c2a99bd 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -46,16 +46,15 @@ name = "station intercom (Security)" frequency = SEC_I_FREQ -/obj/item/radio/intercom/New(turf/loc, ndir, building = 3) - ..() +/obj/item/radio/intercom/New(turf/loc, direction, building = 3) + . = ..() buildstage = building if(buildstage) START_PROCESSING(SSobj, src) else - if(ndir) - pixel_x = (ndir & EAST|WEST) ? (ndir == EAST ? 28 : -28) : 0 - pixel_y = (ndir & NORTH|SOUTH) ? (ndir == NORTH ? 28 : -28) : 0 - dir=ndir + if(direction) + setDir(direction) + set_pixel_offsets_from_dir(28, -28, 28, -28) b_stat=1 on = 0 GLOB.global_intercoms.Add(src) @@ -204,7 +203,7 @@ STOP_PROCESSING(SSobj, src) /obj/item/radio/intercom/welder_act(mob/user, obj/item/I) - if(!buildstage) + if(buildstage != 0) return . = TRUE if(!I.tool_use_check(user, 3)) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 6d0f6d1dfe1..0d8873a6377 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -859,11 +859,11 @@ REAGENT SCANNER dat += "[i.name]N/A[i.damage][infection]:[mech]" dat += "" dat += "" - if(target.disabilities & BLIND) + if(BLINDNESS in target.mutations) dat += "Cataracts detected.
" - if(target.disabilities & COLOURBLIND) + if(COLOURBLIND in target.mutations) dat += "Photoreceptor abnormalities detected.
" - if(target.disabilities & NEARSIGHTED) + if(NEARSIGHTED in target.mutations) dat += "Retinal misalignment detected.
" return dat diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index c5c8f67e34d..77e9eacc6a1 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -131,7 +131,6 @@ GLOBAL_LIST_EMPTY(world_uplinks) else var/datum/uplink_item/UI = ItemsReference[href_list["buy_item"]] return buy(UI, UI ? UI.reference : "") - return 0 /obj/item/uplink/proc/buy(var/datum/uplink_item/UI, var/reference) if(!UI) diff --git a/code/game/objects/items/mixing_bowl.dm b/code/game/objects/items/mixing_bowl.dm index da851437fd5..1e1a39d49d0 100644 --- a/code/game/objects/items/mixing_bowl.dm +++ b/code/game/objects/items/mixing_bowl.dm @@ -118,7 +118,7 @@ /obj/item/mixing_bowl/Topic(href, href_list) if(..()) return - if("dispose") + if(href_list["dispose"]) dispose() return diff --git a/code/game/objects/items/mountable_frames/fire_alarm.dm b/code/game/objects/items/mountable_frames/fire_alarm.dm index 83f435a277c..22c526664aa 100644 --- a/code/game/objects/items/mountable_frames/fire_alarm.dm +++ b/code/game/objects/items/mountable_frames/fire_alarm.dm @@ -6,5 +6,5 @@ mount_reqs = list("simfloor", "nospace") /obj/item/mounted/frame/firealarm/do_build(turf/on_wall, mob/user) - new /obj/machinery/firealarm(get_turf(src), get_dir(on_wall, user), 1) + new /obj/machinery/firealarm(get_turf(src), get_dir(user, on_wall), 1) qdel(src) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index a13bce6fb61..43178a85ef8 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -74,7 +74,7 @@ R.stat = CONSCIOUS GLOB.dead_mob_list -= R //please never forget this ever kthx - GLOB.living_mob_list += R + GLOB.alive_mob_list += R R.notify_ai(1) return 1 diff --git a/code/game/objects/items/shooting_range.dm b/code/game/objects/items/shooting_range.dm index 8b85d8821d9..9b24b1efce6 100644 --- a/code/game/objects/items/shooting_range.dm +++ b/code/game/objects/items/shooting_range.dm @@ -4,24 +4,23 @@ desc = "A shooting target." icon = 'icons/obj/objects.dmi' icon_state = "target_h" - density = 0 + density = FALSE var/hp = 1800 - var/icon/virtualIcon - var/list/bulletholes = list() /obj/item/target/Destroy() + cut_overlays() // if a target is deleted and associated with a stake, force stake to forget - for(var/obj/structure/target_stake/T in view(3,src)) + for(var/obj/structure/target_stake/T in view(3, src)) if(T.pinned_target == src) T.pinned_target = null - T.density = 1 + T.density = TRUE break return ..() // delete target /obj/item/target/Move() ..() // After target moves, check for nearby stakes. If associated, move to target - for(var/obj/structure/target_stake/M in view(3,src)) + for(var/obj/structure/target_stake/M in view(3, src)) if(M.density == 0 && M.pinned_target == src) M.loc = loc @@ -33,12 +32,12 @@ /obj/item/target/welder_act(mob/user, obj/item/I) . = TRUE - if(!use_tool(src, user, 0,, volume = I.tool_volume)) + if(!use_tool(src, user, 0, volume = I.tool_volume)) return overlays.Cut() - to_chat(usr, "You slice off [src]'s uneven chunks of aluminum and scorch marks.") + to_chat(user, "You slice off [src]'s uneven chunks of aluminium and scorch marks.") -/obj/item/target/attack_hand(mob/user as mob) +/obj/item/target/attack_hand(mob/user) // taking pinned targets off! var/obj/structure/target_stake/stake for(var/obj/structure/target_stake/T in view(3,src)) @@ -48,8 +47,8 @@ if(stake) if(stake.pinned_target) - stake.density = 1 - density = 0 + stake.density = TRUE + density = FALSE layer = OBJ_LAYER loc = user.loc @@ -77,101 +76,37 @@ desc = "A shooting target that looks like a xenomorphic alien." hp = 2350 // alium onest too kinda -/obj/item/target/bullet_act(var/obj/item/projectile/Proj) - var/p_x = Proj.p_x + pick(0,0,0,0,0,-1,1) // really ugly way of coding "sometimes offset Proj.p_x!" - var/p_y = Proj.p_y + pick(0,0,0,0,0,-1,1) - var/decaltype = 1 // 1 - scorch, 2 - bullet +#define DECALTYPE_SCORCH 1 +#define DECALTYPE_BULLET 2 - if(istype(/obj/item/projectile/bullet, Proj)) - decaltype = 2 +/obj/item/target/bullet_act(obj/item/projectile/P) + var/p_x = P.p_x + pick(0,0,0,0,0,-1,1) // really ugly way of coding "sometimes offset P.p_x!" + var/p_y = P.p_y + pick(0,0,0,0,0,-1,1) + var/decaltype = DECALTYPE_SCORCH + if(istype(P, /obj/item/projectile/bullet)) + decaltype = DECALTYPE_BULLET - - virtualIcon = new(icon, icon_state) - - if( virtualIcon.GetPixel(p_x, p_y) ) // if the located pixel isn't blank (null) - - hp -= Proj.damage + var/icon/C = icon(icon, icon_state) + if(LAZYLEN(overlays) <= 35 && C.GetPixel(p_x, p_y)) // if the located pixel isn't blank (null) + hp -= P.damage if(hp <= 0) - visible_message("[src] breaks into tiny pieces and collapses!") + visible_message("[src] breaks into tiny pieces and collapses!") qdel(src) - - // Create a temporary object to represent the damage - var/obj/bmark = new - bmark.pixel_x = p_x - bmark.pixel_y = p_y - bmark.icon = 'icons/effects/effects.dmi' - bmark.layer = 3.5 - bmark.icon_state = "scorch" - - if(decaltype == 1) - // Energy weapons are hot. they scorch! - - // offset correction - bmark.pixel_x-- - bmark.pixel_y-- - - if(Proj.damage >= 20 || istype(Proj, /obj/item/projectile/beam/practice)) - bmark.icon_state = "scorch" - bmark.dir = pick(NORTH,SOUTH,EAST,WEST) // random scorch design - - + return + var/image/bullet_hole = image('icons/effects/effects.dmi', "scorch", OBJ_LAYER + 0.5) + bullet_hole.pixel_x = p_x - 1 //offset correction + bullet_hole.pixel_y = p_y - 1 + if(decaltype == DECALTYPE_SCORCH) + if(P.damage >= 20 || istype(P, /obj/item/projectile/beam/practice)) + bullet_hole.setDir(pick(NORTH,SOUTH,EAST,WEST))// random scorch design. light_scorch does not have different directions else - bmark.icon_state = "light_scorch" + bullet_hole.icon_state = "light_scorch" else - - // Bullets are hard. They make dents! - bmark.icon_state = "dent" - - if(Proj.damage >= 10 && bulletholes.len <= 35) // maximum of 35 bullet holes - if(decaltype == 2) // bullet - if(prob(Proj.damage+30)) // bullets make holes more commonly! - new/datum/bullethole(src, bmark.pixel_x, bmark.pixel_y) // create new bullet hole - else // Lasers! - if(prob(Proj.damage-10)) // lasers make holes less commonly - new/datum/bullethole(src, bmark.pixel_x, bmark.pixel_y) // create new bullet hole - - // draw bullet holes - for(var/datum/bullethole/B in bulletholes) - - virtualIcon.DrawBox(null, B.b1x1, B.b1y, B.b1x2, B.b1y) // horizontal line, left to right - virtualIcon.DrawBox(null, B.b2x, B.b2y1, B.b2x, B.b2y2) // vertical line, top to bottom - - overlays += bmark // add the decal - - icon = virtualIcon // apply bulletholes over decals - + bullet_hole.icon_state = "dent" + add_overlay(bullet_hole) return return -1 // the bullet/projectile goes through the target! Ie, you missed - -// Small memory holder entity for transparent bullet holes -/datum/bullethole - // First box - var/b1x1 = 0 - var/b1x2 = 0 - var/b1y = 0 - - // Second box - var/b2x = 0 - var/b2y1 = 0 - var/b2y2 = 0 - -/datum/bullethole/New(obj/item/target/Target, pixel_x = 0, pixel_y = 0) - if(!Target) return - - // Randomize the first box - b1x1 = pixel_x - pick(1,1,1,1,2,2,3,3,4) - b1x2 = pixel_x + pick(1,1,1,1,2,2,3,3,4) - b1y = pixel_y - if(prob(35)) - b1y += rand(-4,4) - - // Randomize the second box - b2x = pixel_x - if(prob(35)) - b2x += rand(-4,4) - b2y1 = pixel_y + pick(1,1,1,1,2,2,3,3,4) - b2y2 = pixel_y - pick(1,1,1,1,2,2,3,3,4) - - Target.bulletholes.Add(src) +#undef DECALTYPE_SCORCH +#undef DECALTYPE_BULLET diff --git a/code/game/objects/items/stacks/sheets/leather.dm b/code/game/objects/items/stacks/sheets/leather.dm index 5fc457dae62..6bdfdd49234 100644 --- a/code/game/objects/items/stacks/sheets/leather.dm +++ b/code/game/objects/items/stacks/sheets/leather.dm @@ -169,9 +169,9 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( \ return if(is_type_in_typecache(target, goliath_platable_armor_typecache)) var/obj/item/clothing/C = target - var/list/current_armor = C.armor - if(current_armor["melee"] < 60) - current_armor["melee"] = min(current_armor["melee"] + 10, 60) + var/datum/armor/current_armor = C.armor + if(current_armor.getRating("melee") < 60) + C.armor = current_armor.setRating(melee_value = min(current_armor.getRating("melee") + 10, 60)) to_chat(user, "You strengthen [target], improving its resistance against melee attacks.") use(1) else @@ -180,9 +180,9 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( \ var/obj/mecha/working/ripley/D = target if(D.hides < 3) D.hides++ - D.armor["melee"] = min(D.armor["melee"] + 10, 70) - D.armor["bullet"] = min(D.armor["bullet"] + 5, 50) - D.armor["laser"] = min(D.armor["laser"] + 5, 50) + D.armor = D.armor.setRating(melee_value = min(D.armor.getRating("melee") + 10, 70)) + D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating("bullet") + 5, 50)) + D.armor = D.armor.setRating(laser_value = min(D.armor.getRating("laser") + 5, 50)) to_chat(user, "You strengthen [target], improving its resistance against melee attacks.") D.update_icon() if(D.hides == 3) diff --git a/code/game/objects/items/tools/tool_behaviour.dm b/code/game/objects/items/tools/tool_behaviour.dm index 986e3a981b2..136bea77e6a 100644 --- a/code/game/objects/items/tools/tool_behaviour.dm +++ b/code/game/objects/items/tools/tool_behaviour.dm @@ -4,7 +4,7 @@ // No delay means there is no start message, and no reason to call tool_start_check before use_tool. // Run the start check here so we wouldn't have to call it manually. target.add_fingerprint(user) - if(!tool_start_check(user, amount) && !delay) + if(!tool_start_check(target, user, amount) && !delay) return delay *= toolspeed @@ -39,7 +39,7 @@ // Called before use_tool if there is a delay, or by use_tool if there isn't. // Only ever used by welding tools and stacks, so it's not added on any other use_tool checks. -/obj/item/proc/tool_start_check(mob/living/user, amount=0) +/obj/item/proc/tool_start_check(atom/target, mob/living/user, amount=0) return tool_use_check(user, amount) // A check called by tool_start_check once, and by use_tool on every tick of delay. diff --git a/code/game/objects/items/tools/welder.dm b/code/game/objects/items/tools/welder.dm index 270a44ee559..4ac934462a0 100644 --- a/code/game/objects/items/tools/welder.dm +++ b/code/game/objects/items/tools/welder.dm @@ -35,10 +35,12 @@ ..() create_reagents(maximum_fuel) reagents.add_reagent("fuel", maximum_fuel) - if(refills_over_time) - reagents.reagents_generated_per_cycle += list("fuel" = 1) update_icon() +/obj/item/weldingtool/Destroy() + STOP_PROCESSING(SSobj, src) + return ..() + /obj/item/weldingtool/examine(mob/user) . = ..() if(get_dist(user, src) <= 0) @@ -49,11 +51,15 @@ return FIRELOSS /obj/item/weldingtool/process() - var/turf/T = get_turf(src) - if(T) // Implants for instance won't find a turf - T.hotspot_expose(2500, 5) - if(prob(5)) - remove_fuel(1) + if(tool_enabled) + var/turf/T = get_turf(src) + if(T) // Implants for instance won't find a turf + T.hotspot_expose(2500, 5) + if(prob(5)) + remove_fuel(1) + if(refills_over_time) + if(GET_FUEL < maximum_fuel) + reagents.add_reagent("fuel", 1) ..() /obj/item/weldingtool/attack_self(mob/user) @@ -77,7 +83,8 @@ playsound(loc, activation_sound, 50, 1) set_light(light_intensity) else - STOP_PROCESSING(SSobj, src) + if(!refills_over_time) + STOP_PROCESSING(SSobj, src) damtype = BRUTE force = 3 hitsound = "swing_hit" @@ -101,9 +108,9 @@ return FALSE // When welding is about to start, run a normal tool_use_check, then flash a mob if it succeeds. -/obj/item/weldingtool/tool_start_check(mob/living/user, amount=0) +/obj/item/weldingtool/tool_start_check(atom/target, mob/living/user, amount=0) . = tool_use_check(user, amount) - if(. && user) + if(. && user && !ismob(target)) // Don't flash the user if they're repairing robo limbs or repairing a borg etc. Only flash them if the target is an object user.flash_eyes(light_intensity) /obj/item/weldingtool/use(amount) @@ -160,7 +167,7 @@ /obj/item/weldingtool/update_icon() if(low_fuel_changes_icon) var/ratio = GET_FUEL / maximum_fuel - ratio = Ceiling(ratio*4) * 25 + ratio = CEILING(ratio*4, 1) * 25 if(ratio == 100) icon_state = initial(icon_state) else diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 8e51a6760b7..40d659ccf6b 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -1023,6 +1023,18 @@ obj/item/toy/cards/deck/syndicate/black name = "orange fox plushie" icon_state = "orangefox" +/obj/item/toy/plushie/orange_fox/grump + name = "grumpy fox" + desc = "An ancient plushie that seems particularly grumpy." + +/obj/item/toy/plushie/orange_fox/grump/ComponentInitialize() + . = ..() + var/static/list/grumps = list("Ahh, yes, you're so clever, var editing that.", "Really?", "If you make a runtime with var edits, it's your own damn fault.", + "Don't you dare post issues on the git when you don't even know how this works.", "Was that necessary?", "Ohhh, setting admin edited var must be your favorite pastime!", + "Oh, so you have time to var edit, but you don't have time to ban that greytider?", "Oh boy, is this another one of those 'events'?", "Seriously, just stop.", "You do realize this is incurring proc call overhead.", + "Congrats, you just left a reference with your dirty client and now that thing you edited will never garbage collect properly.", "Is it that time of day, again, for unecessary adminbus?") + AddComponent(/datum/component/edit_complainer, grumps) + /obj/item/toy/plushie/coffee_fox name = "coffee fox plushie" icon_state = "coffeefox" @@ -1087,6 +1099,21 @@ obj/item/toy/cards/deck/syndicate/black return ..() +/obj/item/toy/plushie/ipcplushie + name = "IPC plushie" + desc = "An adorable IPC plushie, straight from New Canaan. Arguably more durable than the real deal. Toaster functionality included." + icon_state = "plushie_ipc" + item_state = "plushie_ipc" + +/obj/item/toy/plushie/ipcplushie/attackby(obj/item/B, mob/user, params) + if(istype(B, /obj/item/reagent_containers/food/snacks/breadslice)) + new /obj/item/reagent_containers/food/snacks/toast(get_turf(loc)) + to_chat(user, " You insert bread into the toaster. ") + playsound(loc, 'sound/machines/ding.ogg', 50, 1) + qdel(B) + else + return ..() + //New generation TG plushies /obj/item/toy/plushie/lizardplushie @@ -1117,15 +1144,15 @@ obj/item/toy/cards/deck/syndicate/black * Foam Armblade */ - /obj/item/toy/foamblade - name = "foam armblade" - desc = "it says \"Sternside Changs #1 fan\" on it. " - icon = 'icons/obj/toy.dmi' - icon_state = "foamblade" - item_state = "arm_blade" - attack_verb = list("pricked", "absorbed", "gored") - w_class = WEIGHT_CLASS_SMALL - resistance_flags = FLAMMABLE +/obj/item/toy/foamblade + name = "foam armblade" + desc = "it says \"Sternside Changs #1 fan\" on it. " + icon = 'icons/obj/toy.dmi' + icon_state = "foamblade" + item_state = "arm_blade" + attack_verb = list("pricked", "absorbed", "gored") + w_class = WEIGHT_CLASS_SMALL + resistance_flags = FLAMMABLE /* * Toy/fake flash @@ -1220,7 +1247,6 @@ obj/item/toy/cards/deck/syndicate/black spawn(20) cooldown = FALSE return - ..() /obj/item/toy/owl name = "owl action figure" diff --git a/code/game/objects/items/weapons/chrono_eraser.dm b/code/game/objects/items/weapons/chrono_eraser.dm index bf46343b963..1dc0b22abdf 100644 --- a/code/game/objects/items/weapons/chrono_eraser.dm +++ b/code/game/objects/items/weapons/chrono_eraser.dm @@ -188,7 +188,7 @@ /obj/structure/chrono_field/update_icon() var/ttk_frame = 1 - (tickstokill / initial(tickstokill)) - ttk_frame = Clamp(Ceiling(ttk_frame * CHRONO_FRAME_COUNT), 1, CHRONO_FRAME_COUNT) + ttk_frame = clamp(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT) if(ttk_frame != RPpos) RPpos = ttk_frame mob_underlay.icon_state = "frame[RPpos]" diff --git a/code/game/objects/items/weapons/cigs.dm b/code/game/objects/items/weapons/cigs.dm index 24c904bc9d3..98a7b769642 100644 --- a/code/game/objects/items/weapons/cigs.dm +++ b/code/game/objects/items/weapons/cigs.dm @@ -360,7 +360,7 @@ LIGHTERS ARE IN LIGHTERS.DM lit = FALSE icon_state = icon_off item_state = icon_off - M.update_inv_wear_mask(0) + M.update_inv_wear_mask() STOP_PROCESSING(SSobj, src) return smoke() diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 581c4395650..ee98d309876 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -72,7 +72,7 @@ if(powered) //so it doesn't show charge if it's unpowered if(cell) var/ratio = cell.charge / cell.maxcharge - ratio = Ceiling(ratio*4) * 25 + ratio = CEILING(ratio*4, 1) * 25 overlays += "[icon_state]-charge[ratio]" /obj/item/defibrillator/CheckParts(list/parts_list) diff --git a/code/game/objects/items/weapons/dice.dm b/code/game/objects/items/weapons/dice.dm index bc6a98a9b1f..629942860be 100644 --- a/code/game/objects/items/weapons/dice.dm +++ b/code/game/objects/items/weapons/dice.dm @@ -138,7 +138,7 @@ /obj/item/dice/proc/diceroll(mob/user) result = roll(sides) if(rigged != DICE_NOT_RIGGED && result != rigged_value) - if(rigged == DICE_BASICALLY_RIGGED && prob(Clamp(1/(sides - 1) * 100, 25, 80))) + if(rigged == DICE_BASICALLY_RIGGED && prob(clamp(1/(sides - 1) * 100, 25, 80))) result = rigged_value else if(rigged == DICE_TOTALLY_RIGGED) result = rigged_value diff --git a/code/game/objects/items/weapons/dnascrambler.dm b/code/game/objects/items/weapons/dnascrambler.dm index c2dc8e285ab..1dcc4a942c2 100644 --- a/code/game/objects/items/weapons/dnascrambler.dm +++ b/code/game/objects/items/weapons/dnascrambler.dm @@ -45,7 +45,7 @@ scramble(1, H, 100) H.real_name = random_name(H.gender, H.dna.species.name) //Give them a name that makes sense for their species. H.sync_organ_dna(assimilate = 1) - H.update_body(0) + H.update_body() H.reset_hair() //No more winding up with hairstyles you're not supposed to have, and blowing your cover. H.reset_markings() //...Or markings. H.dna.ResetUIFrom(H) diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index 5c69a59aba9..9584130c0c6 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -62,7 +62,7 @@ return var/newtime = input(usr, "Please set the timer.", "Timer", det_time) as num if(user.is_in_active_hand(src)) - newtime = Clamp(newtime, 10, 60000) + newtime = clamp(newtime, 10, 60000) det_time = newtime to_chat(user, "Timer set for [det_time] seconds.") diff --git a/code/game/objects/items/weapons/gift_wrappaper.dm b/code/game/objects/items/weapons/gift_wrappaper.dm index 5a3286bfc05..48edcc826e6 100644 --- a/code/game/objects/items/weapons/gift_wrappaper.dm +++ b/code/game/objects/items/weapons/gift_wrappaper.dm @@ -49,8 +49,7 @@ to_chat(user, "You cut open the present.") for(var/mob/M in src) //Should only be one but whatever. - M.loc = src.loc - M.reset_perspective(null) + M.forceMove(loc) qdel(src) diff --git a/code/game/objects/items/weapons/grenades/clowngrenade.dm b/code/game/objects/items/weapons/grenades/clowngrenade.dm index cfb2e1cad3d..1dcf250dfe4 100644 --- a/code/game/objects/items/weapons/grenades/clowngrenade.dm +++ b/code/game/objects/items/weapons/grenades/clowngrenade.dm @@ -13,22 +13,12 @@ /obj/item/grenade/clown_grenade/prime() ..() playsound(src.loc, 'sound/items/bikehorn.ogg', 25, -3) - /* - for(var/turf/simulated/floor/T in view(affected_area, src.loc)) - if(prob(75)) - banana(T) - */ var/i = 0 var/number = 0 for(var/direction in GLOB.alldirs) for(i = 0; i < 2; i++) number++ var/obj/item/grown/bananapeel/traitorpeel/peel = new /obj/item/grown/bananapeel/traitorpeel(get_turf(src.loc)) - /* var/direction = pick(alldirs) - var/spaces = pick(1;150, 2) - var/a = 0 - for(a = 0; a < spaces; a++) - step(peel,direction)*/ var/a = 1 if(number & 2) for(a = 1; a <= 2; a++) @@ -39,21 +29,17 @@ qdel(src) return -/obj/item/grown/bananapeel/traitorpeel - trip_stun = 0 - trip_weaken = 7 - trip_tiles = 4 - trip_walksafe = FALSE - - trip_chance = 100 - - -/obj/item/grown/bananapeel/traitorpeel/on_trip(mob/living/carbon/human/H) +/obj/item/grown/bananapeel/traitorpeel/New(newloc, obj/item/seeds/new_seed) . = ..() - if(.) - to_chat(H, "Your feet feel like they're on fire!") - H.take_overall_damage(0, rand(2,8)) - H.take_organ_damage(2) // Was 5 -- TLE + // The reason this AddComponent is here and not in ComponentInitialize() is because if it's put there, it will be ran before the parent New proc for /grown types. + // And then be overriden by the generic component placed onto it by the `/datum/plant_gene/trait/slip`. + AddComponent(/datum/component/slippery, src, 0, 7, 100, 4, FALSE) + +/obj/item/grown/bananapeel/traitorpeel/after_slip(mob/living/carbon/human/H) + to_chat(H, "Your feet feel like they're on fire!") + H.take_overall_damage(0, rand(2,8)) + H.take_organ_damage(2) + return ..() /obj/item/grown/bananapeel/traitorpeel/throw_impact(atom/hit_atom) var/burned = rand(1,3) diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index c3f2e50174b..006de63af17 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -37,7 +37,7 @@ return BRUTELOSS|FIRELOSS /obj/item/melee/energy/attack_self(mob/living/carbon/user) - if(user.disabilities & CLUMSY && prob(50)) + if((CLUMSY in user.mutations) && prob(50)) to_chat(user, "You accidentally cut yourself with [src], like a doofus!") user.take_organ_damage(5,5) active = !active @@ -290,7 +290,7 @@ if(ishuman(user)) var/mob/living/carbon/human/H = user - if(H.disabilities & CLUMSY && prob(50)) + if((CLUMSY in H.mutations) && prob(50)) to_chat(H, "You accidentally cut yourself with [src], like a doofus!") H.take_organ_damage(10,10) active = !active diff --git a/code/game/objects/items/weapons/scrolls.dm b/code/game/objects/items/weapons/scrolls.dm index 0f25239e4e4..14f3b0ab91f 100644 --- a/code/game/objects/items/weapons/scrolls.dm +++ b/code/game/objects/items/weapons/scrolls.dm @@ -100,7 +100,7 @@ break if(!success) - user.loc = pick(L) + user.forceMove(pick(L)) smoke.start() src.uses -= 1 diff --git a/code/game/objects/items/weapons/shields.dm b/code/game/objects/items/weapons/shields.dm index 362ab601685..19e56e161e3 100644 --- a/code/game/objects/items/weapons/shields.dm +++ b/code/game/objects/items/weapons/shields.dm @@ -76,7 +76,7 @@ return (active) /obj/item/shield/energy/attack_self(mob/living/carbon/human/user) - if(user.disabilities & CLUMSY && prob(50)) + if((CLUMSY in user.mutations) && prob(50)) to_chat(user, "You beat yourself in the head with [src].") user.take_organ_damage(5) active = !active diff --git a/code/game/objects/items/weapons/soap.dm b/code/game/objects/items/weapons/soap.dm index 62f65b5a6cc..cb220ff9565 100644 --- a/code/game/objects/items/weapons/soap.dm +++ b/code/game/objects/items/weapons/soap.dm @@ -11,15 +11,11 @@ throw_speed = 4 throw_range = 20 discrete = 1 - - trip_stun = 4 - trip_weaken = 2 - trip_chance = 100 - trip_walksafe = FALSE - trip_verb = TV_SLIP - var/cleanspeed = 50 //slower than mop +/obj/item/soap/ComponentInitialize() + AddComponent(/datum/component/slippery, src, 4, 2, 100, 0, FALSE) + /obj/item/soap/afterattack(atom/target, mob/user, proximity) if(!proximity) return //I couldn't feasibly fix the overlay bugs caused by cleaning items we are wearing. diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm index 66288713775..4a449069d4c 100644 --- a/code/game/objects/items/weapons/storage/bags.dm +++ b/code/game/objects/items/weapons/storage/bags.dm @@ -33,9 +33,11 @@ icon_state = "trashbag" item_state = "trashbag" - w_class = WEIGHT_CLASS_TINY + w_class = WEIGHT_CLASS_BULKY max_w_class = WEIGHT_CLASS_SMALL + slot_flags = null storage_slots = 30 + max_combined_w_class = 30 can_hold = list() // any cant_hold = list(/obj/item/disk/nuclear) @@ -45,18 +47,15 @@ return TOXLOSS /obj/item/storage/bag/trash/update_icon() - if(contents.len == 0) - w_class = WEIGHT_CLASS_TINY - icon_state = "[initial(icon_state)]" - else if(contents.len < 12) - w_class = WEIGHT_CLASS_BULKY - icon_state = "[initial(icon_state)]1" - else if(contents.len < 21) - w_class = WEIGHT_CLASS_BULKY - icon_state = "[initial(icon_state)]2" - else - w_class = WEIGHT_CLASS_BULKY - icon_state = "[initial(icon_state)]3" + switch(contents.len) + if(20 to INFINITY) + icon_state = "[initial(icon_state)]3" + if(11 to 20) + icon_state = "[initial(icon_state)]2" + if(1 to 11) + icon_state = "[initial(icon_state)]1" + else + icon_state = "[initial(icon_state)]" /obj/item/storage/bag/trash/cyborg diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 0aa7d976082..55b25ad725a 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -83,13 +83,14 @@ return /obj/item/storage/AltClick(mob/user) - if(Adjacent(user) && !user.incapacitated(FALSE, TRUE, TRUE)) + if(ishuman(user) && Adjacent(user) && !user.incapacitated(FALSE, TRUE, TRUE)) orient2hud(user) if(user.s_active) user.s_active.close(user) show_to(user) playsound(loc, "rustle", 50, 1, -5) add_fingerprint(user) + return ..() /obj/item/storage/proc/return_inv() diff --git a/code/game/objects/items/weapons/tanks/tank_types.dm b/code/game/objects/items/weapons/tanks/tank_types.dm index 11355b34170..a82d6c0c223 100644 --- a/code/game/objects/items/weapons/tanks/tank_types.dm +++ b/code/game/objects/items/weapons/tanks/tank_types.dm @@ -53,13 +53,8 @@ obj/item/tank/oxygen/empty/New() /obj/item/tank/anesthetic/New() ..() - - air_contents.oxygen = (3*ONE_ATMOSPHERE)*70/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD - - var/datum/gas/sleeping_agent/trace_gas = new() - trace_gas.moles = (3*ONE_ATMOSPHERE)*70/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD - - air_contents.trace_gases += trace_gas + air_contents.oxygen = (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C) * O2STANDARD + air_contents.sleeping_agent = (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C) * N2STANDARD /* * Air diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm index 4ac9651ea65..33aeddeaab0 100644 --- a/code/game/objects/items/weapons/teleportation.dm +++ b/code/game/objects/items/weapons/teleportation.dm @@ -115,7 +115,7 @@ Frequency: to_chat(user, "\The [src] is malfunctioning.") return var/list/L = list( ) - for(var/obj/machinery/computer/teleporter/com in world) + for(var/obj/machinery/computer/teleporter/com in GLOB.machines) if(com.target) if(com.power_station && com.power_station.teleporter_hub && com.power_station.engaged) L["[com.id] (Active)"] = com.target diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm deleted file mode 100644 index 012fcf79b10..00000000000 --- a/code/game/objects/items/weapons/tools.dm +++ /dev/null @@ -1,785 +0,0 @@ -#define HEALPERWELD 15 - -/* Tools! - * Note: Multitools are in devices - * - * Contains: - * Wrench - * Screwdriver - * Wirecutters - * Welding Tool - * Crowbar - * Revolver Conversion Kit - */ - -//Wrench -/obj/item/wrench - name = "wrench" - desc = "A wrench with common uses. Can be found in your hand." - icon = 'icons/obj/tools.dmi' - icon_state = "wrench" - flags = CONDUCT - slot_flags = SLOT_BELT - force = 5 - throwforce = 7 - usesound = 'sound/items/ratchet.ogg' - w_class = WEIGHT_CLASS_SMALL - materials = list(MAT_METAL=150) - origin_tech = "materials=1;engineering=1" - attack_verb = list("bashed", "battered", "bludgeoned", "whacked") - toolspeed = 1 - armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30) - -/obj/item/wrench/suicide_act(mob/user) - user.visible_message("[user] is beating [user.p_them()]self to death with [src]! It looks like [user.p_theyre()] trying to commit suicide!") - playsound(loc, 'sound/weapons/genhit.ogg', 50, 1, -1) - return BRUTELOSS - -/obj/item/wrench/cyborg - name = "automatic wrench" - desc = "An advanced robotic wrench. Can be found in construction cyborgs." - toolspeed = 0.5 - -/obj/item/wrench/brass - name = "brass wrench" - desc = "A brass wrench. It's faintly warm to the touch." - icon_state = "wrench_brass" - toolspeed = 0.5 - resistance_flags = FIRE_PROOF | ACID_PROOF - -/obj/item/wrench/abductor - name = "alien wrench" - desc = "A polarized wrench. It causes anything placed between the jaws to turn." - icon = 'icons/obj/abductor.dmi' - icon_state = "wrench" - usesound = 'sound/effects/empulse.ogg' - toolspeed = 0.1 - origin_tech = "materials=5;engineering=5;abductor=3" - -/obj/item/wrench/power - name = "hand drill" - desc = "A simple powered drill with a bolt bit." - icon_state = "drill_bolt" - item_state = "drill" - usesound = 'sound/items/drill_use.ogg' - materials = list(MAT_METAL=150,MAT_SILVER=50,MAT_TITANIUM=25) - origin_tech = "materials=2;engineering=2" //done for balance reasons, making them high value for research, but harder to get - force = 8 //might or might not be too high, subject to change - throwforce = 8 - attack_verb = list("drilled", "screwed", "jabbed") - toolspeed = 0.25 - -/obj/item/wrench/power/attack_self(mob/user) - playsound(get_turf(user),'sound/items/change_drill.ogg', 50, 1) - var/obj/item/wirecutters/power/s_drill = new /obj/item/screwdriver/power - to_chat(user, "You attach the screwdriver bit to [src].") - qdel(src) - user.put_in_active_hand(s_drill) - -/obj/item/wrench/power/suicide_act(mob/user) - user.visible_message("[user] is pressing [src] against [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!") - return BRUTELOSS - -/obj/item/wrench/medical - name = "medical wrench" - desc = "A medical wrench with common (medical?) uses. Can be found in your hand." - icon_state = "wrench_medical" - force = 2 //MEDICAL - throwforce = 4 - origin_tech = "materials=1;engineering=1;biotech=3" - attack_verb = list("wrenched", "medicaled", "tapped", "jabbed", "whacked") - -/obj/item/wrench/medical/suicide_act(mob/user) - user.visible_message("[user] is praying to the medical wrench to take [user.p_their()] soul. It looks like [user.p_theyre()] trying to commit suicide!") - // TODO Make them glow with the power of the M E D I C A L W R E N C H - // during their ascension - - // Stun stops them from wandering off - user.Stun(5) - playsound(loc, 'sound/effects/pray.ogg', 50, 1, -1) - - // Let the sound effect finish playing - sleep(20) - - if(!user) - return - - for(var/obj/item/W in user) - user.unEquip(W) - - var/obj/item/wrench/medical/W = new /obj/item/wrench/medical(loc) - W.add_fingerprint(user) - W.desc += " For some reason, it reminds you of [user.name]." - - if(!user) - return - - user.dust() - return OBLITERATION - -//Screwdriver -/obj/item/screwdriver - name = "screwdriver" - desc = "You can be totally screwy with this." - icon = 'icons/obj/tools.dmi' - icon_state = "screwdriver_map" - flags = CONDUCT - slot_flags = SLOT_BELT - force = 5 - w_class = WEIGHT_CLASS_TINY - throwforce = 5 - throw_speed = 3 - throw_range = 5 - materials = list(MAT_METAL=75) - attack_verb = list("stabbed") - hitsound = 'sound/weapons/bladeslice.ogg' - usesound = 'sound/items/screwdriver.ogg' - toolspeed = 1 - armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30) - var/random_color = TRUE //if the screwdriver uses random coloring - -/obj/item/screwdriver/nuke - name = "screwdriver" - desc = "A screwdriver with an ultra thin tip." - icon_state = "screwdriver_nuke" - toolspeed = 0.5 - -/obj/item/screwdriver/suicide_act(mob/user) - user.visible_message("[user] is stabbing [src] into [user.p_their()] [pick("temple", "heart")]! It looks like [user.p_theyre()] trying to commit suicide!") - return BRUTELOSS - -/obj/item/screwdriver/New(loc, var/param_color = null) - ..() - if(random_color) - if(!param_color) - param_color = pick("red","blue","pink","brown","green","cyan","yellow") - icon_state = "screwdriver_[param_color]" - - if (prob(75)) - src.pixel_y = rand(0, 16) - -/obj/item/screwdriver/attack(mob/living/carbon/M, mob/living/carbon/user) - if(!istype(M) || user.a_intent == INTENT_HELP) - return ..() - if(user.zone_selected != "eyes" && user.zone_selected != "head") - return ..() - if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, "You don't want to harm [M]!") - return - if((CLUMSY in user.mutations) && prob(50)) - M = user - return eyestab(M,user) - -/obj/item/screwdriver/brass - name = "brass screwdriver" - desc = "A screwdriver made of brass. The handle feels freezing cold." - icon_state = "screwdriver_brass" - toolspeed = 0.5 - random_color = FALSE - resistance_flags = FIRE_PROOF | ACID_PROOF - -/obj/item/screwdriver/abductor - name = "alien screwdriver" - desc = "An ultrasonic screwdriver." - icon = 'icons/obj/abductor.dmi' - icon_state = "screwdriver" - usesound = 'sound/items/pshoom.ogg' - toolspeed = 0.1 - random_color = FALSE - -/obj/item/screwdriver/power - name = "hand drill" - desc = "A simple hand drill with a screwdriver bit attached." - icon_state = "drill_screw" - item_state = "drill" - materials = list(MAT_METAL=150,MAT_SILVER=50,MAT_TITANIUM=25) - origin_tech = "materials=2;engineering=2" //done for balance reasons, making them high value for research, but harder to get - force = 8 //might or might not be too high, subject to change - throwforce = 8 - throw_speed = 2 - throw_range = 3//it's heavier than a screw driver/wrench, so it does more damage, but can't be thrown as far - attack_verb = list("drilled", "screwed", "jabbed","whacked") - hitsound = 'sound/items/drill_hit.ogg' - usesound = 'sound/items/drill_use.ogg' - toolspeed = 0.25 - random_color = FALSE - -/obj/item/screwdriver/power/suicide_act(mob/user) - user.visible_message("[user] is putting [src] to [user.p_their()] temple. It looks like [user.p_theyre()] trying to commit suicide!") - return BRUTELOSS - -/obj/item/screwdriver/power/attack_self(mob/user) - playsound(get_turf(user), 'sound/items/change_drill.ogg', 50, 1) - var/obj/item/wrench/power/b_drill = new /obj/item/wrench/power - to_chat(user, "You attach the bolt driver bit to [src].") - qdel(src) - user.put_in_active_hand(b_drill) - -/obj/item/screwdriver/cyborg - name = "powered screwdriver" - desc = "An electrical screwdriver, designed to be both precise and quick." - usesound = 'sound/items/drill_use.ogg' - toolspeed = 0.5 - -//Wirecutters -/obj/item/wirecutters - name = "wirecutters" - desc = "This cuts wires." - icon = 'icons/obj/tools.dmi' - icon_state = "cutters" - flags = CONDUCT - slot_flags = SLOT_BELT - force = 6 - throw_speed = 3 - throw_range = 7 - w_class = WEIGHT_CLASS_SMALL - materials = list(MAT_METAL=80) - origin_tech = "materials=1;engineering=1" - attack_verb = list("pinched", "nipped") - hitsound = 'sound/items/wirecutter.ogg' - usesound = 'sound/items/wirecutter.ogg' - sharp = 1 - toolspeed = 1 - armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30) - var/random_color = TRUE - -/obj/item/wirecutters/New(loc, param_color = null) - ..() - if(random_color) - if(!param_color) - param_color = pick("yellow", "red") - icon_state = "cutters_[param_color]" - -/obj/item/wirecutters/attack(mob/living/carbon/C, mob/user) - if(istype(C) && C.handcuffed && istype(C.handcuffed, /obj/item/restraints/handcuffs/cable)) - user.visible_message("[user] cuts [C]'s restraints with [src]!") - QDEL_NULL(C.handcuffed) - if(C.buckled && C.buckled.buckle_requires_restraints) - C.buckled.unbuckle_mob(C) - C.update_handcuffed() - return - else - ..() - -/obj/item/wirecutters/suicide_act(mob/user) - user.visible_message("[user] is cutting at [user.p_their()] arteries with [src]! It looks like [user.p_theyre()] trying to commit suicide!") - playsound(loc, usesound, 50, 1, -1) - return BRUTELOSS - -/obj/item/wirecutters/brass - name = "brass wirecutters" - desc = "A pair of wirecutters made of brass. The handle feels freezing cold to the touch." - icon_state = "cutters_brass" - toolspeed = 0.5 - random_color = FALSE - resistance_flags = FIRE_PROOF | ACID_PROOF - -/obj/item/wirecutters/abductor - name = "alien wirecutters" - desc = "Extremely sharp wirecutters, made out of a silvery-green metal." - icon = 'icons/obj/abductor.dmi' - icon_state = "cutters" - toolspeed = 0.1 - origin_tech = "materials=5;engineering=4;abductor=3" - random_color = FALSE - -/obj/item/wirecutters/cyborg - name = "wirecutters" - desc = "This cuts wires." - toolspeed = 0.5 - -/obj/item/wirecutters/power - name = "jaws of life" - desc = "A set of jaws of life, the magic of science has managed to fit it down into a device small enough to fit in a tool belt. It's fitted with a cutting head." - icon_state = "jaws_cutter" - item_state = "jawsoflife" - origin_tech = "materials=2;engineering=2" - materials = list(MAT_METAL=150,MAT_SILVER=50,MAT_TITANIUM=25) - usesound = 'sound/items/jaws_cut.ogg' - toolspeed = 0.25 - random_color = FALSE - -/obj/item/wirecutters/power/suicide_act(mob/user) - user.visible_message("[user] is wrapping \the [src] around [user.p_their()] neck. It looks like [user.p_theyre()] trying to rip [user.p_their()] head off!") - playsound(loc, 'sound/items/jaws_cut.ogg', 50, 1, -1) - if(ishuman(user)) - var/mob/living/carbon/human/H = user - var/obj/item/organ/external/head/head = H.bodyparts_by_name["head"] - if(head) - head.droplimb(0, DROPLIMB_BLUNT, FALSE, TRUE) - playsound(loc,pick('sound/misc/desceration-01.ogg','sound/misc/desceration-02.ogg','sound/misc/desceration-01.ogg') ,50, 1, -1) - return BRUTELOSS - -/obj/item/wirecutters/power/attack_self(mob/user) - playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, 1) - var/obj/item/crowbar/power/pryjaws = new /obj/item/crowbar/power - to_chat(user, "You attach the pry jaws to [src].") - qdel(src) - user.put_in_active_hand(pryjaws) - -//Welding Tool -/obj/item/weldingtool - name = "welding tool" - desc = "A standard edition welder provided by Nanotrasen." - icon = 'icons/obj/tools.dmi' - icon_state = "welder" - item_state = "welder" - flags = CONDUCT - slot_flags = SLOT_BELT - force = 3 - throwforce = 5 - throw_speed = 3 - throw_range = 5 - hitsound = "swing_hit" - usesound = 'sound/items/welder.ogg' - var/acti_sound = 'sound/items/welderactivate.ogg' - var/deac_sound = 'sound/items/welderdeactivate.ogg' - w_class = WEIGHT_CLASS_SMALL - armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 30) - resistance_flags = FIRE_PROOF - materials = list(MAT_METAL=70, MAT_GLASS=30) - origin_tech = "engineering=1;plasmatech=1" - toolspeed = 1 - var/welding = 0 //Whether or not the welding tool is off(0), on(1) or currently welding(2) - var/status = 1 //Whether the welder is secured or unsecured (able to attach rods to it to make a flamethrower) - var/max_fuel = 20 //The max amount of fuel the welder can hold - var/change_icons = 1 - var/can_off_process = 0 - var/light_intensity = 2 //how powerful the emitted light is when used. - var/nextrefueltick = 0 - -/obj/item/weldingtool/New() - ..() - create_reagents(max_fuel) - reagents.add_reagent("fuel", max_fuel) - update_icon() - -/obj/item/weldingtool/examine(mob/user) - . = ..() - if(get_dist(user, src) <= 0) - . += "It contains [get_fuel()] unit\s of fuel out of [max_fuel]." - -/obj/item/weldingtool/suicide_act(mob/user) - user.visible_message("[user] welds [user.p_their()] every orifice closed! It looks like [user.p_theyre()] trying to commit suicide!") - return FIRELOSS - -/obj/item/weldingtool/proc/update_torch() - overlays.Cut() - if(welding) - overlays += "[initial(icon_state)]-on" - item_state = "[initial(item_state)]1" - else - item_state = "[initial(item_state)]" - -/obj/item/weldingtool/update_icon() - if(change_icons) - var/ratio = get_fuel() / max_fuel - ratio = Ceiling(ratio*4) * 25 - if(ratio == 100) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)][ratio]" - update_torch() - ..() - -/obj/item/weldingtool/process() - switch(welding) - if(0) - force = 3 - damtype = "brute" - update_icon() - if(!can_off_process) - STOP_PROCESSING(SSobj, src) - return - //Welders left on now use up fuel, but lets not have them run out quite that fast - if(1) - force = 15 - damtype = "fire" - if(prob(5)) - remove_fuel(1) - update_icon() - - //This is to start fires. process() is only called if the welder is on. - var/turf/location = loc - if(ismob(location)) - var/mob/M = location - if(M.l_hand == src || M.r_hand == src) - location = get_turf(M) - if(isturf(location)) - location.hotspot_expose(700, 5) - -/obj/item/weldingtool/attackby(obj/item/I, mob/user, params) - if(isscrewdriver(I)) - flamethrower_screwdriver(I, user) - else if(istype(I, /obj/item/stack/rods)) - flamethrower_rods(I, user) - else - ..() - -/obj/item/weldingtool/attack(mob/M, mob/user) - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/obj/item/organ/external/S = H.bodyparts_by_name[user.zone_selected] - - if(!S) - return - - if(!S.is_robotic() || user.a_intent != INTENT_HELP || S.open == 2) - return ..() - - if(!isOn()) //why wasn't this being checked already? - to_chat(user, "Turn on [src] before attempting repairs!") - return 1 - - if(S.brute_dam > ROBOLIMB_SELF_REPAIR_CAP) - to_chat(user, "The damage is far too severe to patch over externally.") - return - - if(!S.brute_dam) - to_chat(user, "Nothing to fix!") - return - - if(get_fuel() >= 1) - if(H == user) - if(!do_mob(user, H, 10)) - return 1 - if(!remove_fuel(1,null)) - to_chat(user, "Need more welding fuel!") - var/rembrute = HEALPERWELD - var/nrembrute = 0 - var/childlist - if(!isnull(S.children)) - childlist = S.children.Copy() - var/parenthealed = FALSE - while(rembrute > 0) - var/obj/item/organ/external/E - if(S.brute_dam) - E = S - else if(LAZYLEN(childlist)) - E = pick_n_take(childlist) - if(!E.brute_dam || !E.is_robotic()) - continue - else if(S.parent && !parenthealed) - E = S.parent - parenthealed = TRUE - if(!E.brute_dam || !E.is_robotic()) - break - else - break - playsound(src.loc, usesound, 50, 1) - nrembrute = max(rembrute - E.brute_dam, 0) - E.heal_damage(rembrute,0,0,1) - rembrute = nrembrute - user.visible_message("\The [user] patches some dents on \the [M]'s [E.name] with \the [src].") - if(H.bleed_rate && H.isSynthetic()) - H.bleed_rate = 0 - user.visible_message("\The [user] patches some leaks on [M] with \the [src].") - return 1 - else - return ..() - -/obj/item/weldingtool/afterattack(atom/O, mob/user, proximity) - if(!proximity) - return - if(welding) - remove_fuel(1) - var/turf/location = get_turf(user) - location.hotspot_expose(700, 50, 1) - if(get_fuel() <= 0) - set_light(0) - - if(isliving(O)) - var/mob/living/L = O - if(L.IgniteMob()) - message_admins("[key_name_admin(user)] set [key_name_admin(L)] on fire") - log_game("[key_name(user)] set [key_name(L)] on fire") - -/obj/item/weldingtool/attack_self(mob/user) - switched_on(user) - if(welding) - set_light(light_intensity) - - update_icon() - -//Returns the amount of fuel in the welder -/obj/item/weldingtool/proc/get_fuel() - return reagents.get_reagent_amount("fuel") - -//Removes fuel from the welding tool. If a mob is passed, it will try to flash the mob's eyes. This should probably be renamed to use() -/obj/item/weldingtool/proc/remove_fuel(amount = 1, mob/living/M = null) - if(!welding || !check_fuel()) - return FALSE - if(get_fuel() >= amount) - reagents.remove_reagent("fuel", amount) - check_fuel() - if(M) - M.flash_eyes(light_intensity) - return TRUE - else - if(M) - to_chat(M, "You need more welding fuel to complete this task.") - return FALSE - -//Returns whether or not the welding tool is currently on. -/obj/item/weldingtool/proc/isOn() - return welding - -//Turns off the welder if there is no more fuel (does this really need to be its own proc?) -/obj/item/weldingtool/proc/check_fuel(mob/user) - if(get_fuel() <= 0 && welding) - switched_on(user) - update_icon() - //mob icon update - if(ismob(loc)) - var/mob/M = loc - M.update_inv_r_hand(0) - M.update_inv_l_hand(0) - return 0 - return 1 - -//Switches the welder on -/obj/item/weldingtool/proc/switched_on(mob/user) - if(!status) - to_chat(user, "[src] can't be turned on while unsecured!") - return - welding = !welding - if(welding) - if(get_fuel() >= 1) - to_chat(user, "You switch [src] on.") - playsound(loc, acti_sound, 50, 1) - force = 15 - damtype = "fire" - hitsound = 'sound/items/welder.ogg' - update_icon() - START_PROCESSING(SSobj, src) - else - to_chat(user, "You need more fuel!") - switched_off(user) - else - if(user) - to_chat(user, "You switch [src] off.") - playsound(loc, deac_sound, 50, 1) - switched_off(user) - -//Switches the welder off -/obj/item/weldingtool/proc/switched_off(mob/user) - welding = 0 - set_light(0) - - force = 3 - damtype = "brute" - hitsound = "swing_hit" - update_icon() - -/obj/item/weldingtool/proc/flamethrower_screwdriver(obj/item/I, mob/user) - if(welding) - to_chat(user, "Turn it off first!") - return - status = !status - if(status) - to_chat(user, "You resecure [src].") - else - to_chat(user, "[src] can now be attached and modified.") - add_fingerprint(user) - -/obj/item/weldingtool/proc/flamethrower_rods(obj/item/I, mob/user) - if(!status) - var/obj/item/stack/rods/R = I - if(R.use(1)) - var/obj/item/flamethrower/F = new /obj/item/flamethrower(user.loc) - if(!remove_item_from_storage(F)) - user.unEquip(src) - loc = F - F.weldtool = src - add_fingerprint(user) - to_chat(user, "You add a rod to a welder, starting to build a flamethrower.") - user.put_in_hands(F) - else - to_chat(user, "You need one rod to start building a flamethrower!") - -/obj/item/weldingtool/largetank - name = "Industrial Welding Tool" - desc = "A slightly larger welder with a larger tank." - icon_state = "indwelder" - max_fuel = 40 - materials = list(MAT_METAL=70, MAT_GLASS=60) - origin_tech = "engineering=2;plasmatech=2" - -/obj/item/weldingtool/largetank/cyborg - name = "integrated welding tool" - desc = "An advanced welder designed to be used in robotic systems." - toolspeed = 0.5 - -/obj/item/weldingtool/largetank/flamethrower_screwdriver() - return - -/obj/item/weldingtool/mini - name = "emergency welding tool" - desc = "A miniature welder used during emergencies." - icon_state = "miniwelder" - max_fuel = 10 - w_class = WEIGHT_CLASS_TINY - materials = list(MAT_METAL=30, MAT_GLASS=10) - change_icons = 0 - -/obj/item/weldingtool/mini/flamethrower_screwdriver() - return - -/obj/item/weldingtool/abductor - name = "alien welding tool" - desc = "An alien welding tool. Whatever fuel it uses, it never runs out." - icon = 'icons/obj/abductor.dmi' - icon_state = "welder" - toolspeed = 0.1 - light_intensity = 0 - change_icons = 0 - origin_tech = "plasmatech=5;engineering=5;abductor=3" - can_off_process = 1 - -/obj/item/weldingtool/abductor/process() - if(get_fuel() <= max_fuel) - reagents.add_reagent("fuel", 1) - ..() - -/obj/item/weldingtool/hugetank - name = "Upgraded Welding Tool" - desc = "An upgraded welder based off the industrial welder." - icon_state = "upindwelder" - item_state = "upindwelder" - max_fuel = 80 - materials = list(MAT_METAL=70, MAT_GLASS=120) - origin_tech = "engineering=3;plasmatech=2" - -/obj/item/weldingtool/experimental - name = "Experimental Welding Tool" - desc = "An experimental welder capable of self-fuel generation and less harmful to the eyes." - icon_state = "exwelder" - item_state = "exwelder" - max_fuel = 40 - materials = list(MAT_METAL=70, MAT_GLASS=120) - origin_tech = "materials=4;engineering=4;bluespace=3;plasmatech=4" - change_icons = 0 - can_off_process = 1 - light_intensity = 1 - toolspeed = 0.5 - var/last_gen = 0 - -/obj/item/weldingtool/experimental/brass - name = "brass welding tool" - desc = "A brass welder that seems to constantly refuel itself. It is faintly warm to the touch." - icon_state = "brasswelder" - item_state = "brasswelder" - resistance_flags = FIRE_PROOF | ACID_PROOF - -obj/item/weldingtool/experimental/process() - ..() - if(get_fuel() < max_fuel && nextrefueltick < world.time) - nextrefueltick = world.time + 10 - reagents.add_reagent("fuel", 1) - -//Crowbar -/obj/item/crowbar - name = "pocket crowbar" - desc = "A small crowbar. This handy tool is useful for lots of things, such as prying floor tiles or opening unpowered doors." - icon = 'icons/obj/tools.dmi' - icon_state = "crowbar" - item_state = "crowbar" - usesound = 'sound/items/crowbar.ogg' - flags = CONDUCT - slot_flags = SLOT_BELT - force = 5 - throwforce = 7 - item_state = "crowbar" - w_class = WEIGHT_CLASS_SMALL - materials = list(MAT_METAL=50) - origin_tech = "engineering=1;combat=1" - attack_verb = list("attacked", "bashed", "battered", "bludgeoned", "whacked") - toolspeed = 1 - armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30) - -/obj/item/crowbar/red - icon_state = "crowbar_red" - item_state = "crowbar_red" - force = 8 - -/obj/item/crowbar/brass - name = "brass crowbar" - desc = "A brass crowbar. It feels faintly warm to the touch." - icon_state = "crowbar_brass" - item_state = "crowbar_brass" - toolspeed = 0.5 - resistance_flags = FIRE_PROOF | ACID_PROOF - -/obj/item/crowbar/abductor - name = "alien crowbar" - desc = "A hard-light crowbar. It appears to pry by itself, without any effort required." - icon = 'icons/obj/abductor.dmi' - usesound = 'sound/weapons/sonic_jackhammer.ogg' - icon_state = "crowbar" - toolspeed = 0.1 - origin_tech = "combat=4;engineering=4;abductor=3" - -/obj/item/crowbar/large - name = "crowbar" - desc = "It's a big crowbar. It doesn't fit in your pockets, because its too big." - force = 12 - w_class = WEIGHT_CLASS_NORMAL - throw_speed = 3 - throw_range = 3 - materials = list(MAT_METAL=70) - icon_state = "crowbar_large" - item_state = "crowbar_large" - toolspeed = 0.5 - -/obj/item/crowbar/cyborg - name = "hydraulic crowbar" - desc = "A hydraulic prying tool, compact but powerful. Designed to replace crowbar in construction cyborgs." - usesound = 'sound/items/jaws_pry.ogg' - force = 10 - toolspeed = 0.5 - -/obj/item/crowbar/power - name = "jaws of life" - desc = "A set of jaws of life, the magic of science has managed to fit it down into a device small enough to fit in a tool belt. It's fitted with a prying head." - icon_state = "jaws_pry" - item_state = "jawsoflife" - materials = list(MAT_METAL=150,MAT_SILVER=50,MAT_TITANIUM=25) - origin_tech = "materials=2;engineering=2" - usesound = 'sound/items/jaws_pry.ogg' - force = 15 - toolspeed = 0.25 - var/airlock_open_time = 100 // Time required to open powered airlocks - -/obj/item/crowbar/power/suicide_act(mob/user) - user.visible_message("[user] is putting [user.p_their()] head in [src]. It looks like [user.p_theyre()] trying to commit suicide!") - playsound(loc, 'sound/items/jaws_pry.ogg', 50, 1, -1) - return BRUTELOSS - -/obj/item/crowbar/power/attack_self(mob/user) - playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, 1) - var/obj/item/wirecutters/power/cutjaws = new /obj/item/wirecutters/power - to_chat(user, "You attach the cutting jaws to [src].") - qdel(src) - user.put_in_active_hand(cutjaws) - -// Conversion kit -/obj/item/conversion_kit - name = "\improper Revolver Conversion Kit" - desc = "A professional conversion kit used to convert any knock off revolver into the real deal capable of shooting lethal .357 rounds without the possibility of catastrophic failure." - icon_state = "kit" - flags = CONDUCT - w_class = WEIGHT_CLASS_SMALL - origin_tech = "combat=2" - var/open = 0 - -/obj/item/conversion_kit/New() - ..() - update_icon() - -/obj/item/conversion_kit/update_icon() - icon_state = "[initial(icon_state)]_[open]" - -/obj/item/conversion_kit/attack_self(mob/user) - open = !open - to_chat(user, "You [open ? "open" : "close"] the conversion kit.") - update_icon() diff --git a/code/game/objects/items/weapons/whetstone.dm b/code/game/objects/items/weapons/whetstone.dm index f74f8d28f57..d2ab4b2733f 100644 --- a/code/game/objects/items/weapons/whetstone.dm +++ b/code/game/objects/items/weapons/whetstone.dm @@ -34,15 +34,15 @@ if(TH.force_wielded > initial(TH.force_wielded)) to_chat(user, "[TH] has already been refined before. It cannot be sharpened further!") return - TH.force_wielded = Clamp(TH.force_wielded + increment, 0, max)//wieldforce is increased since normal force wont stay + TH.force_wielded = clamp(TH.force_wielded + increment, 0, max)//wieldforce is increased since normal force wont stay if(I.force > initial(I.force)) to_chat(user, "[I] has already been refined before. It cannot be sharpened further!") return user.visible_message("[user] sharpens [I] with [src]!", "You sharpen [I], making it much more deadly than before.") if(!requires_sharpness) I.sharp = 1 - I.force = Clamp(I.force + increment, 0, max) - I.throwforce = Clamp(I.throwforce + increment, 0, max) + I.force = clamp(I.force + increment, 0, max) + I.throwforce = clamp(I.throwforce + increment, 0, max) I.name = "[prefix] [I.name]" playsound(get_turf(src), usesound, 50, 1) name = "worn out [name]" diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index e1464e47e48..bbd43db7c1e 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -30,9 +30,9 @@ return 0 var/armor_protection = 0 if(damage_flag) - armor_protection = armor[damage_flag] + armor_protection = armor.getRating(damage_flag) if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. - armor_protection = Clamp(armor_protection - armour_penetration, min(armor_protection, 0), 100) + armor_protection = clamp(armor_protection - armour_penetration, min(armor_protection, 0), 100) return round(damage_amount * (100 - armor_protection)*0.01, DAMAGE_PRECISION) ///the sound played when the obj is damaged. @@ -201,7 +201,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e return ..() if(exposed_temperature && !(resistance_flags & FIRE_PROOF)) - take_damage(Clamp(0.02 * exposed_temperature, 0, 20), BURN, "fire", 0) + take_damage(clamp(0.02 * exposed_temperature, 0, 20), BURN, "fire", 0) if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE) && !(resistance_flags & FIRE_PROOF)) resistance_flags |= ON_FIRE SSfires.processing[src] = src diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 951eb79f853..43244c470ff 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -1,15 +1,14 @@ /obj //var/datum/module/mod //not used var/origin_tech = null //Used by R&D to determine what research bonuses it grants. - var/crit_fail = 0 + var/crit_fail = FALSE animate_movement = 2 - var/list/attack_verb = list() //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]" var/list/species_exception = null // list() of species types, if a species cannot put items in a certain slot, but species type is in list, it will be able to wear that item - var/sharp = 0 // whether this object cuts - var/in_use = 0 // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING! + var/sharp = FALSE // whether this object cuts + var/in_use = FALSE // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING! var/damtype = "brute" var/force = 0 - var/list/armor + var/datum/armor/armor var/obj_integrity //defaults to max_integrity var/max_integrity = 500 var/integrity_failure = 0 //0 if we have no special broken behavior @@ -22,9 +21,9 @@ var/can_be_hit = TRUE //can this be bludgeoned by items? - var/Mtoollink = 0 // variable to decide if an object should show the multitool menu linking menu, not all objects use it + var/Mtoollink = FALSE // variable to decide if an object should show the multitool menu linking menu, not all objects use it - var/being_shocked = 0 + var/being_shocked = FALSE var/speed_process = FALSE var/on_blueprints = FALSE //Are we visible on the station blueprints at roundstart? @@ -33,8 +32,6 @@ /obj/New() ..() - if(!armor) - armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0) if(obj_integrity == null) obj_integrity = max_integrity if(on_blueprints && isturf(loc)) @@ -44,25 +41,34 @@ else T.add_blueprints_preround(src) -/obj/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/state = GLOB.default_state) +/obj/Initialize(mapload) + . = ..() + if(islist(armor)) + armor = getArmor(arglist(armor)) + else if(!armor) + armor = getArmor() + else if(!istype(armor, /datum/armor)) + stack_trace("Invalid type [armor.type] found in .armor during /obj Initialize()") + +/obj/Topic(href, href_list, nowindow = FALSE, datum/topic_state/state = GLOB.default_state) // Calling Topic without a corresponding window open causes runtime errors if(!nowindow && ..()) - return 1 + return TRUE // In the far future no checks are made in an overriding Topic() beyond if(..()) return // Instead any such checks are made in CanUseTopic() if(CanUseTopic(usr, state, href_list) == STATUS_INTERACTIVE) CouldUseTopic(usr) - return 0 + return FALSE CouldNotUseTopic(usr) - return 1 + return TRUE -/obj/proc/CouldUseTopic(var/mob/user) +/obj/proc/CouldUseTopic(mob/user) var/atom/host = nano_host() host.add_fingerprint(user) -/obj/proc/CouldNotUseTopic(var/mob/user) +/obj/proc/CouldNotUseTopic(mob/user) // Nada /obj/Destroy() @@ -110,23 +116,23 @@ // null if object handles breathing logic for lifeform // datum/air_group to tell lifeform to process using that breath return //DEFAULT: Take air from turf to give to have mob process - if(breath_request>0) + if(breath_request > 0) return remove_air(breath_request) else return null /obj/proc/updateUsrDialog() if(in_use) - var/is_in_use = 0 + var/is_in_use = FALSE var/list/nearby = viewers(1, src) for(var/mob/M in nearby) if((M.client && M.machine == src)) - is_in_use = 1 + is_in_use = TRUE src.attack_hand(M) if(istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/living/silicon/robot)) if(!(usr in nearby)) if(usr.client && usr.machine==src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh. - is_in_use = 1 + is_in_use = TRUE src.attack_ai(usr) // check for TK users @@ -134,8 +140,8 @@ if(istype(usr, /mob/living/carbon/human)) if(istype(usr.l_hand, /obj/item/tk_grab) || istype(usr.r_hand, /obj/item/tk_grab/)) if(!(usr in nearby)) - if(usr.client && usr.machine==src) - is_in_use = 1 + if(usr.client && usr.machine == src) + is_in_use = TRUE src.attack_hand(usr) in_use = is_in_use @@ -143,15 +149,15 @@ // Check that people are actually using the machine. If not, don't update anymore. if(in_use) var/list/nearby = viewers(1, src) - var/is_in_use = 0 + var/is_in_use = FALSE for(var/mob/M in nearby) if((M.client && M.machine == src)) - is_in_use = 1 + is_in_use = TRUE src.interact(M) var/ai_in_use = AutoUpdateAI(src) if(!ai_in_use && !is_in_use) - in_use = 0 + in_use = FALSE /obj/proc/interact(mob/user) return @@ -168,12 +174,12 @@ /atom/movable/proc/on_unset_machine(mob/user) return -/mob/proc/set_machine(var/obj/O) +/mob/proc/set_machine(obj/O) if(src.machine) unset_machine() src.machine = O if(istype(O)) - O.in_use = 1 + O.in_use = TRUE /obj/item/proc/updateSelfDialog() var/mob/M = src.loc @@ -183,48 +189,48 @@ /obj/proc/hide(h) return - /obj/proc/hear_talk(mob/M, list/message_pieces) return -/obj/proc/hear_message(mob/M as mob, text) +/obj/proc/hear_message(mob/M, text) -/obj/proc/multitool_menu(var/mob/user,var/obj/item/multitool/P) +/obj/proc/multitool_menu(mob/user, obj/item/multitool/P) return "NO MULTITOOL_MENU!" -/obj/proc/linkWith(var/mob/user, var/obj/buffer, var/context) - return 0 +/obj/proc/linkWith(mob/user, obj/buffer, context) + return FALSE -/obj/proc/unlinkFrom(var/mob/user, var/obj/buffer) - return 0 +/obj/proc/unlinkFrom(mob/user, obj/buffer) + return FALSE -/obj/proc/canLink(var/obj/O, var/context) - return 0 +/obj/proc/canLink(obj/O, list/context) + return FALSE -/obj/proc/isLinkedWith(var/obj/O) - return 0 +/obj/proc/isLinkedWith(obj/O) + return FALSE -/obj/proc/getLink(var/idx) +/obj/proc/getLink(idx) return null -/obj/proc/linkMenu(var/obj/O) - var/dat="" +/obj/proc/linkMenu(obj/O) + var/dat = "" if(canLink(O, list())) dat += " \[Link\] " return dat -/obj/proc/format_tag(var/label,var/varname, var/act="set_tag") +/obj/proc/format_tag(label, varname, act = "set_tag") var/value = vars[varname] - if(!value || value=="") - value="-----" + if(!value || value == "") + value = "-----" return "[label]: [value]" -/obj/proc/update_multitool_menu(mob/user as mob) +/obj/proc/update_multitool_menu(mob/user) var/obj/item/multitool/P = get_multitool(user) if(!istype(P)) - return 0 + return FALSE + var/dat = {" [name] Configuration @@ -246,13 +252,13 @@ a {

[name]

"} if(allowed(user))//no, assistants, you're not ruining all vents on the station with just a multitool - dat += multitool_menu(user,P) + dat += multitool_menu(user, P) if(Mtoollink) if(P) if(P.buffer) var/id = null if("id_tag" in P.buffer.vars) - id=P.buffer:id_tag + id = P.buffer:id_tag dat += "

MULTITOOL BUFFER: [P.buffer] [id ? "([id])" : ""]" dat += linkMenu(P.buffer) @@ -309,12 +315,12 @@ a { /obj/singularity_pull(S, current_size) ..() if(!anchored || current_size >= STAGE_FIVE) - step_towards(src,S) + step_towards(src, S) -/obj/proc/container_resist(var/mob/living) +/obj/proc/container_resist(mob/living) return -/obj/proc/CanAStarPass() +/obj/proc/CanAStarPass(ID, dir, caller) . = !density /obj/proc/on_mob_move(dir, mob/user) @@ -343,4 +349,4 @@ a { .["Make normal process"] = "?_src_=vars;makenormalspeed=[UID()]" /obj/proc/check_uplink_validity() - return 1 + return TRUE diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 663f210df3e..b1ed99357ad 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -7,8 +7,6 @@ var/broken = FALSE /obj/structure/New() - if (!armor) - armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 50) ..() if(smooth) if(SSticker && SSticker.current_state == GAME_STATE_PLAYING) @@ -20,6 +18,11 @@ if(SSticker) GLOB.cameranet.updateVisibility(src) +/obj/structure/Initialize(mapload) + if(!armor) + armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 50) + return ..() + /obj/structure/Destroy() if(SSticker) GLOB.cameranet.updateVisibility(src) diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index 1de93f4d583..033787cce75 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -141,7 +141,6 @@ return ..() /obj/structure/alien/weeds/proc/Life() - set background = BACKGROUND_ENABLED var/turf/U = get_turf(src) if(istype(U, /turf/space)) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 82487dbd0ae..553cfda4d59 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -12,6 +12,8 @@ var/opened = FALSE var/welded = FALSE var/locked = FALSE + var/large = TRUE + var/can_be_emaged = FALSE var/wall_mounted = 0 //never solid (You can always pass over it) var/lastbang var/sound = 'sound/machines/click.ogg' @@ -143,84 +145,21 @@ /obj/structure/closet/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/rcs) && !opened) - if(user in contents) //to prevent self-teleporting. - return var/obj/item/rcs/E = W - if(E.rcell && (E.rcell.charge >= E.chargecost)) - if(!is_level_reachable(z)) - to_chat(user, "The rapid-crate-sender can't locate any telepads!") - return - if(E.mode == 0) - if(!E.teleporting) - var/list/L = list() - var/list/areaindex = list() - for(var/obj/machinery/telepad_cargo/R in world) - if(R.stage == 0) - var/turf/T = get_turf(R) - var/tmpname = T.loc.name - if(areaindex[tmpname]) - tmpname = "[tmpname] ([++areaindex[tmpname]])" - else - areaindex[tmpname] = 1 - L[tmpname] = R - var/desc = input("Please select a telepad.", "RCS") in L - E.pad = L[desc] - if(!Adjacent(user)) - to_chat(user, "Unable to teleport, too far from crate.") - return - playsound(E.loc, E.usesound, 50, 1) - to_chat(user, "Teleporting [name]...") - E.teleporting = 1 - if(!do_after(user, 50 * E.toolspeed, target = src)) - E.teleporting = 0 - return - E.teleporting = 0 - if(user in contents) - to_chat(user, "Error: User located in container--aborting for safety.") - playsound(E.loc, 'sound/machines/buzz-sigh.ogg', 50, 1) - return - if(!(E.rcell && E.rcell.use(E.chargecost))) - to_chat(user, "Unable to teleport, insufficient charge.") - return - do_sparks(5, 1, src) - do_teleport(src, E.pad, 0) - to_chat(user, "Teleport successful. [round(E.rcell.charge/E.chargecost)] charge\s left.") - return - else - E.rand_x = rand(50,200) - E.rand_y = rand(50,200) - var/L = locate(E.rand_x, E.rand_y, 6) - if(!Adjacent(user)) - to_chat(user, "Unable to teleport, too far from crate.") - return - playsound(E.loc, E.usesound, 50, 1) - to_chat(user, "Teleporting [name]...") - E.teleporting = 1 - if(!do_after(user, 50, E.toolspeed, target = src)) - E.teleporting = 0 - return - E.teleporting = 0 - if(user in contents) - to_chat(user, "Error: User located in container--aborting for safety.") - playsound(E.loc, 'sound/machines/buzz-sigh.ogg', 50, 1) - return - if(!(E.rcell && E.rcell.use(E.chargecost))) - to_chat(user, "Unable to teleport, insufficient charge.") - return - do_sparks(5, 1, src) - do_teleport(src, L) - to_chat(user, "Teleport successful. [round(E.rcell.charge/E.chargecost)] charge\s left.") - return - else - to_chat(user, "Out of charges.") - return + E.try_send_container(user, src) return if(opened) if(istype(W, /obj/item/grab)) - MouseDrop_T(W:affecting, user) //act like they were dragged onto the closet - if(istype(W,/obj/item/tk_grab)) + var/obj/item/grab/G = W + if(large) + MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet + else + to_chat(user, "[src] is too small to stuff [G.affecting] into!") + if(istype(W, /obj/item/tk_grab)) return FALSE + if(user.a_intent != INTENT_HELP) // Stops you from putting your baton in the closet on accident + return if(isrobot(user)) return if(!user.drop_item()) //couldn't drop the item @@ -228,13 +167,20 @@ return if(W) W.forceMove(loc) + return TRUE // It's resolved. No afterattack needed. Stops you from emagging lockers when putting in an emag + else if(can_be_emaged && (istype(W, /obj/item/card/emag) || istype(W, /obj/item/melee/energy/blade) && !broken)) + emag_act(user) else if(istype(W, /obj/item/stack/packageWrap)) return else if(user.a_intent != INTENT_HARM) - attack_hand(user) + closed_item_click(user) else return ..() +// What happens when the closet is attacked by a random item not on harm mode +/obj/structure/closet/proc/closed_item_click(mob/user) + attack_hand(user) + /obj/structure/closet/welder_act(mob/user, obj/item/I) . = TRUE if(!opened && user.loc == src) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm index 096133b6e0d..7eab5858772 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm @@ -54,36 +54,33 @@ new /obj/item/storage/backpack/satchel/withwallet( src ) new /obj/item/radio/headset( src ) -/obj/structure/closet/secure_closet/personal/attackby(obj/item/W as obj, mob/user as mob, params) - if(src.opened) - if(istype(W, /obj/item/grab)) - src.MouseDrop_T(W:affecting, user) //act like they were dragged onto the closet - user.drop_item() - if(W) W.forceMove(loc) - else if(istype(W, /obj/item/card/id)) - if(src.broken) - to_chat(user, "It appears to be broken.") - return - var/obj/item/card/id/I = W - if(!I || !I.registered_name) return - if(src == user.loc) - to_chat(user, "You can't reach the lock from inside.") - else if(src.allowed(user) || !src.registered_name || (istype(I) && (src.registered_name == I.registered_name))) - //they can open all lockers, or nobody owns this, or they own this locker - src.locked = !( src.locked ) - if(src.locked) - src.icon_state = src.icon_locked - else - src.icon_state = src.icon_closed - registered_name = null - desc = initial(desc) - - if(!src.registered_name && src.locked) - src.registered_name = I.registered_name - src.desc = "Owned by [I.registered_name]." - else - to_chat(user, "Access Denied") - else if((istype(W, /obj/item/card/emag) || istype(W, /obj/item/melee/energy/blade)) && !broken) - emag_act(user) - else +/obj/structure/closet/secure_closet/personal/attackby(obj/item/W, mob/user, params) + if(opened || !istype(W, /obj/item/card/id)) return ..() + + if(broken) + to_chat(user, "It appears to be broken.") + return + + var/obj/item/card/id/I = W + if(!I || !I.registered_name) + return + + if(src == user.loc) + to_chat(user, "You can't reach the lock from inside.") + + else if(allowed(user) || !registered_name || (istype(I) && (registered_name == I.registered_name))) + //they can open all lockers, or nobody owns this, or they own this locker + locked = !locked + if(locked) + icon_state = icon_locked + else + icon_state = icon_closed + registered_name = null + desc = initial(desc) + + if(!registered_name && locked) + registered_name = I.registered_name + desc = "Owned by [I.registered_name]." + else + to_chat(user, "Access Denied") diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm index dbb3b8f283d..763717dc270 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm @@ -7,10 +7,10 @@ opened = 0 locked = 1 broken = 0 + can_be_emaged = TRUE max_integrity = 250 armor = list("melee" = 30, "bullet" = 50, "laser" = 50, "energy" = 100, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80) damage_deflection = 20 - var/large = 1 icon_closed = "secure" var/icon_locked = "secure1" icon_opened = "secureopen" @@ -66,31 +66,8 @@ else to_chat(user, "Access Denied") -/obj/structure/closet/secure_closet/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/rcs)) - return ..() - - if(opened) - if(istype(W, /obj/item/grab)) - if(large) - MouseDrop_T(W:affecting, user) //act like they were dragged onto the closet - else - to_chat(user, "The locker is too small to stuff [W:affecting] into!") - if(isrobot(user)) - return - if(!user.drop_item()) //couldn't drop the item - to_chat(user, "\The [W] is stuck to your hand, you cannot put it in \the [src]!") - return - if(W) - W.forceMove(loc) - else if((istype(W, /obj/item/card/emag)||istype(W, /obj/item/melee/energy/blade)) && !broken) - emag_act(user) - else if(istype(W,/obj/item/stack/packageWrap) || istype(W,/obj/item/weldingtool)) - return ..(W, user) - else if(user.a_intent != INTENT_HARM) - togglelock(user) - else - return ..() +/obj/structure/closet/secure_closet/closed_item_click(mob/user) + togglelock(user) /obj/structure/closet/secure_closet/emag_act(mob/user) if(!broken) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/security.dm b/code/game/objects/structures/crates_lockers/closets/secure/security.dm index 6d4b47df6ab..8576afe14b8 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/security.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/security.dm @@ -426,7 +426,7 @@ icon_off = "wall-lockeroff" //too small to put a man in - large = 0 + large = FALSE /obj/structure/closet/secure_closet/wall/update_icon() if(broken) diff --git a/code/game/objects/structures/crates_lockers/closets/statue.dm b/code/game/objects/structures/crates_lockers/closets/statue.dm index 501abd4922d..e285c6a0ae9 100644 --- a/code/game/objects/structures/crates_lockers/closets/statue.dm +++ b/code/game/objects/structures/crates_lockers/closets/statue.dm @@ -19,7 +19,7 @@ L.buckled = 0 L.anchored = 0 L.forceMove(src) - L.disabilities += MUTE + L.mutations |= MUTE max_integrity = L.health + 100 //stoning damaged mobs will result in easier to shatter statues intialTox = L.getToxLoss() intialFire = L.getFireLoss() @@ -69,7 +69,7 @@ for(var/mob/living/M in src) M.forceMove(loc) - M.disabilities -= MUTE + M.mutations -= MUTE M.take_overall_damage((M.health - obj_integrity - 100),0) //any new damage the statue incurred is transfered to the mob ..() diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index f9010c19415..2441a2d57d6 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -79,111 +79,42 @@ return TRUE /obj/structure/closet/crate/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/rcs) && !src.opened) - var/obj/item/rcs/E = W - if(E.rcell && (E.rcell.charge >= E.chargecost)) - if(!is_level_reachable(src.z)) // This is inconsistent with the closet sending code - to_chat(user, "The rapid-crate-sender can't locate any telepads!") - return - if(E.mode == 0) - if(!E.teleporting) - var/list/L = list() - var/list/areaindex = list() - for(var/obj/machinery/telepad_cargo/R in world) - if(R.stage == 0) - var/turf/T = get_turf(R) - var/tmpname = T.loc.name - if(areaindex[tmpname]) - tmpname = "[tmpname] ([++areaindex[tmpname]])" - else - areaindex[tmpname] = 1 - L[tmpname] = R - var/desc = input("Please select a telepad.", "RCS") in L - E.pad = L[desc] - if(!Adjacent(user)) - to_chat(user, "Unable to teleport, too far from crate.") - return - playsound(E.loc, E.usesound, 50, 1) - to_chat(user, "Teleporting [src.name]...") - E.teleporting = TRUE - if(!do_after(user, 50 * E.toolspeed, target = src)) - E.teleporting = 0 - return - E.teleporting = 0 - if(!(E.rcell && E.rcell.use(E.chargecost))) - to_chat(user, "Unable to teleport, insufficient charge.") - return - do_sparks(5, 1, src) - do_teleport(src, E.pad, 0) - to_chat(user, "Teleport successful. [round(E.rcell.charge/E.chargecost)] charge\s left.") - return - - else - E.rand_x = rand(50,200) - E.rand_y = rand(50,200) - var/L = locate(E.rand_x, E.rand_y, 6) - if(!Adjacent(user)) - to_chat(user, "Unable to teleport, too far from crate.") - return - playsound(E.loc, E.usesound, 50, 1) - to_chat(user, "Teleporting [src.name]...") - E.teleporting = TRUE - if(!do_after(user, 50 * E.toolspeed, target = src)) - E.teleporting = FALSE - return - E.teleporting = 0 - if(!(E.rcell && E.rcell.use(E.chargecost))) - to_chat(user, "Unable to teleport, insufficient charge.") - return - do_sparks(5, 1, src) - do_teleport(src, L) - to_chat(user, "Teleport successful. [round(E.rcell.charge/E.chargecost)] charge\s left.") - return - else - to_chat(user, "Out of charges.") - return - - if(opened) - if(isrobot(user)) - return - if(!user.drop_item()) //couldn't drop the item - to_chat(user, "\The [W] is stuck to your hand, you cannot put it in \the [src]!") - return - if(W) - W.forceMove(loc) - else if(istype(W, /obj/item/stack/packageWrap)) + if(!opened && try_rig(W, user)) return - else if(istype(W, /obj/item/stack/cable_coil)) + return ..() + +/obj/structure/closet/crate/proc/try_rig(obj/item/W, mob/user) + if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = W if(rigged) to_chat(user, "[src] is already rigged!") - return + return TRUE if(C.use(15)) to_chat(user, "You rig [src].") rigged = TRUE else to_chat(user, "You need atleast 15 wires to rig [src]!") - return - else if(istype(W, /obj/item/radio/electropack)) + return TRUE + if(istype(W, /obj/item/radio/electropack)) if(rigged) + if(!user.drop_item()) + to_chat(user, "[W] seems to be stuck to your hand!") + return TRUE to_chat(user, "You attach [W] to [src].") - user.drop_item() W.forceMove(src) - return - else if(istype(W, /obj/item/wirecutters)) - if(rigged) - to_chat(user, "You cut away the wiring.") - playsound(loc, W.usesound, 100, 1) - rigged = FALSE - return - else if(user.a_intent != INTENT_HARM) - attack_hand(user) - else - return ..() + return TRUE -/obj/structure/closet/singularity_act() - dump_contents() - ..() +/obj/structure/closet/crate/wirecutter_act(mob/living/user, obj/item/I) + if(opened) + return + if(!rigged) + return + + if(I.use_tool(src, user)) + to_chat(user, "You cut away the wiring.") + playsound(loc, I.usesound, 100, 1) + rigged = FALSE + return TRUE /obj/structure/closet/crate/welder_act() return @@ -229,9 +160,10 @@ max_integrity = 500 armor = list("melee" = 30, "bullet" = 50, "laser" = 50, "energy" = 100, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80) damage_deflection = 25 - var/tamperproof = 0 - broken = 0 - locked = 1 + var/tamperproof = FALSE + broken = FALSE + locked = TRUE + can_be_emaged = TRUE /obj/structure/closet/crate/secure/update_icon() ..() @@ -306,17 +238,8 @@ else src.toggle(user) - -/obj/structure/closet/crate/secure/attackby(obj/item/W, mob/user, params) - if(is_type_in_list(W, list(/obj/item/stack/packageWrap, /obj/item/stack/cable_coil, /obj/item/radio/electropack, /obj/item/wirecutters,/obj/item/rcs))) - return ..() - if((istype(W, /obj/item/card/emag) || istype(W, /obj/item/melee/energy/blade))) - emag_act(user) - return - if(!opened) - src.togglelock(user) - return - return ..() +/obj/structure/closet/crate/secure/closed_item_click(mob/user) + togglelock(user) /obj/structure/closet/crate/secure/emag_act(mob/user) if(locked) diff --git a/code/game/objects/structures/curtains.dm b/code/game/objects/structures/curtains.dm index e2ab534923d..029b0a761ad 100644 --- a/code/game/objects/structures/curtains.dm +++ b/code/game/objects/structures/curtains.dm @@ -46,7 +46,7 @@ /obj/structure/curtain/screwdriver_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(anchored) user.visible_message("[user] unscrews [src] from the floor.", "You start to unscrew [src] from the floor...", "You hear rustling noises.") @@ -65,7 +65,7 @@ if(anchored) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return WIRECUTTER_ATTEMPT_DISMANTLE_MESSAGE if(I.use_tool(src, user, 50, volume = I.tool_volume)) diff --git a/code/game/objects/structures/dresser.dm b/code/game/objects/structures/dresser.dm index 878b03436ff..4531613610e 100644 --- a/code/game/objects/structures/dresser.dm +++ b/code/game/objects/structures/dresser.dm @@ -56,7 +56,7 @@ /obj/structure/dresser/crowbar_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return TOOL_ATTEMPT_DISMANTLE_MESSAGE if(I.use_tool(src, user, 50, volume = I.tool_volume)) diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 2dc0cf415cc..cd7b3525478 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -17,11 +17,11 @@ var/opened = 0 var/material_drop = /obj/item/stack/sheet/metal -/obj/structure/extinguisher_cabinet/New(turf/loc, ndir = null) +/obj/structure/extinguisher_cabinet/New(turf/loc, direction = null) ..() - if(ndir) - pixel_x = (ndir & EAST|WEST) ? (ndir == EAST ? 28 : -28) : 0 - pixel_y = (ndir & NORTH|SOUTH)? (ndir == WEST ? 28 : -28) : 0 + if(direction) + setDir(direction) + set_pixel_offsets_from_dir(28, -28, 30, -30) switch(extinguishertype) if(NO_EXTINGUISHER) return @@ -165,9 +165,8 @@ else icon_state = "extinguisher_empty" -/obj/structure/extinguisher_cabinet/empty/New(turf/loc, ndir = null) +/obj/structure/extinguisher_cabinet/empty extinguishertype = NO_EXTINGUISHER - ..() #undef NO_EXTINGUISHER #undef NORMAL_EXTINGUISHER diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index dcb74369d72..5fea799ecb0 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -374,7 +374,7 @@ /obj/structure/girder/CanAStarPass(ID, dir, caller) . = !density - if(ismovableatom(caller)) + if(ismovable(caller)) var/atom/movable/mover = caller . = . || mover.checkpass(PASSGRILLE) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 755d2a3de1b..72acf72f613 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -111,7 +111,7 @@ /obj/structure/grille/CanAStarPass(ID, dir, caller) . = !density - if(ismovableatom(caller)) + if(ismovable(caller)) var/atom/movable/mover = caller . = . || mover.checkpass(PASSGRILLE) diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 1ea1c277af8..5849d96a158 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -232,7 +232,7 @@ /obj/structure/tray/m_tray/CanAStarPass(ID, dir, caller) . = !density - if(ismovableatom(caller)) + if(ismovable(caller)) var/atom/movable/mover = caller . = . || mover.checkpass(PASSTABLE) diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 1102901c8bd..93403a98553 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -246,7 +246,7 @@ GLOBAL_LIST_EMPTY(safes) var/ticks = text2num(href_list["turnright"]) for(var/i = 1 to ticks) - dial = Wrap(dial - 1, 0, 100) + dial = WRAP(dial - 1, 0, 100) var/invalid_turn = current_tumbler_index % 2 == 0 || current_tumbler_index > number_of_tumblers if(invalid_turn) // The moment you turn the wrong way or go too far, the tumblers reset @@ -274,7 +274,7 @@ GLOBAL_LIST_EMPTY(safes) var/ticks = text2num(href_list["turnleft"]) for(var/i = 1 to ticks) - dial = Wrap(dial + 1, 0, 100) + dial = WRAP(dial + 1, 0, 100) var/invalid_turn = current_tumbler_index % 2 != 0 || current_tumbler_index > number_of_tumblers if(invalid_turn) // The moment you turn the wrong way or go too far, the tumblers reset diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 5acd4f7d8a3..bdab5ca2466 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -128,7 +128,7 @@ /obj/structure/table/CanAStarPass(ID, dir, caller) . = !density - if(ismovableatom(caller)) + if(ismovable(caller)) var/atom/movable/mover = caller . = . || mover.checkpass(PASSTABLE) @@ -224,8 +224,8 @@ if(!click_params || !click_params["icon-x"] || !click_params["icon-y"]) return //Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf) - I.pixel_x = Clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2) - I.pixel_y = Clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2) + I.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2) + I.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2) item_placed(I) else return ..() @@ -666,7 +666,7 @@ /obj/structure/rack/CanAStarPass(ID, dir, caller) . = !density - if(ismovableatom(caller)) + if(ismovable(caller)) var/atom/movable/mover = caller . = . || mover.checkpass(PASSTABLE) diff --git a/code/game/objects/structures/tank_dispenser.dm b/code/game/objects/structures/tank_dispenser.dm index 854bc18ce00..692d15d79ec 100644 --- a/code/game/objects/structures/tank_dispenser.dm +++ b/code/game/objects/structures/tank_dispenser.dm @@ -1,3 +1,5 @@ +#define MAX_TANK_STORAGE 10 + /obj/structure/dispenser name = "tank storage unit" desc = "A simple yet bulky storage device for gas tanks. Has room for up to ten oxygen tanks, and ten plasma tanks." @@ -5,29 +7,51 @@ icon_state = "dispenser" density = 1 anchored = 1.0 - var/oxygentanks = 10 - var/plasmatanks = 10 - var/list/oxytanks = list() //sorry for the similar var names - var/list/platanks = list() + var/starting_oxygen_tanks = MAX_TANK_STORAGE // The starting amount of oxygen tanks the dispenser gets when it's spawned + var/starting_plasma_tanks = MAX_TANK_STORAGE // Starting amount of plasma tanks + var/list/stored_oxygen_tanks = list() // List of currently stored oxygen tanks + var/list/stored_plasma_tanks = list() // And plasma tanks /obj/structure/dispenser/oxygen - plasmatanks = 0 + starting_plasma_tanks = 0 /obj/structure/dispenser/plasma - oxygentanks = 0 + starting_oxygen_tanks = 0 /obj/structure/dispenser/New() ..() + initialize_tanks() update_icon() +/obj/structure/dispenser/Destroy() + QDEL_LIST(stored_plasma_tanks) + QDEL_LIST(stored_oxygen_tanks) + return ..() + +/obj/structure/dispenser/proc/initialize_tanks() + for(var/I in 1 to starting_plasma_tanks) + var/obj/item/tank/plasma/P = new(src) + stored_plasma_tanks.Add(P) + + for(var/I in 1 to starting_oxygen_tanks) + var/obj/item/tank/oxygen/O = new(src) + stored_oxygen_tanks.Add(O) + /obj/structure/dispenser/update_icon() - overlays.Cut() - switch(oxygentanks) - if(1 to 3) overlays += "oxygen-[oxygentanks]" - if(4 to INFINITY) overlays += "oxygen-4" - switch(plasmatanks) - if(1 to 4) overlays += "plasma-[plasmatanks]" - if(5 to INFINITY) overlays += "plasma-5" + cut_overlays() + var/oxy_tank_amount = LAZYLEN(stored_oxygen_tanks) + switch(oxy_tank_amount) + if(1 to 3) + overlays += "oxygen-[oxy_tank_amount]" + if(4 to INFINITY) + overlays += "oxygen-4" + + var/pla_tank_amount = LAZYLEN(stored_plasma_tanks) + switch(pla_tank_amount) + if(1 to 4) + overlays += "plasma-[pla_tank_amount]" + if(5 to INFINITY) + overlays += "plasma-5" /obj/structure/dispenser/attack_hand(mob/user) if(..()) @@ -38,7 +62,7 @@ /obj/structure/dispenser/attack_ghost(mob/user) ui_interact(user) -/obj/structure/dispenser/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, var/master_ui = null, var/datum/topic_state/state = GLOB.default_state) +/obj/structure/dispenser/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, master_ui = null, datum/topic_state/state = GLOB.default_state) user.set_machine(src) ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open) if(!ui) @@ -47,35 +71,19 @@ /obj/structure/dispenser/ui_data(user) var/list/data = list() - data["o_tanks"] = oxygentanks - data["p_tanks"] = plasmatanks + data["o_tanks"] = LAZYLEN(stored_oxygen_tanks) + data["p_tanks"] = LAZYLEN(stored_plasma_tanks) return data /obj/structure/dispenser/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/tank/oxygen) || istype(I, /obj/item/tank/air) || istype(I, /obj/item/tank/anesthetic)) - if(oxygentanks < 10) - user.drop_item() - I.forceMove(src) - oxytanks.Add(I) - oxygentanks++ - update_icon() - to_chat(user, "You put [I] in [src].") - else - to_chat(user, "[src] is full.") - SSnanoui.update_uis(src) + try_insert_tank(user, stored_oxygen_tanks, I) return + if(istype(I, /obj/item/tank/plasma)) - if(plasmatanks < 10) - user.drop_item() - I.forceMove(src) - platanks.Add(I) - plasmatanks++ - update_icon() - to_chat(user, "You put [I] in [src].") - else - to_chat(user, "[src] is full.") - SSnanoui.update_uis(src) + try_insert_tank(user, stored_plasma_tanks, I) return + if(istype(I, /obj/item/wrench)) if(anchored) to_chat(user, "You lean down and unwrench [src].") @@ -88,40 +96,55 @@ /obj/structure/dispenser/Topic(href, href_list) if(..()) - return 1 + return TRUE if(Adjacent(usr)) usr.set_machine(src) + + // The oxygen tank button if(href_list["oxygen"]) - if(oxygentanks > 0) - var/obj/item/tank/oxygen/O - if(oxytanks.len == oxygentanks) - O = oxytanks[1] - oxytanks.Remove(O) - else - O = new /obj/item/tank/oxygen(loc) - O.loc = loc - to_chat(usr, "You take [O] out of [src].") - oxygentanks-- - update_icon() + try_remove_tank(usr, stored_oxygen_tanks) + + // The plasma tank button if(href_list["plasma"]) - if(plasmatanks > 0) - var/obj/item/tank/plasma/P - if(platanks.len == plasmatanks) - P = platanks[1] - platanks.Remove(P) - else - P = new /obj/item/tank/plasma(loc) - P.loc = loc - to_chat(usr, "You take [P] out of [src].") - plasmatanks-- - update_icon() + try_remove_tank(usr, stored_plasma_tanks) + add_fingerprint(usr) updateUsrDialog() - SSnanoui.update_uis(src) + SSnanoui.try_update_ui(usr, src) else SSnanoui.close_user_uis(usr,src) - return 1 + return TRUE + +/// Called when the user clicks on the oxygen or plasma tank UI buttons, and tries to withdraw a tank. +/obj/structure/dispenser/proc/try_remove_tank(mob/living/user, list/tank_list) + if(!LAZYLEN(tank_list)) + return // There are no tanks left to withdraw. + + var/obj/item/tank/T = tank_list[1] + tank_list.Remove(T) + + if(!user.put_in_hands(T)) + T.forceMove(loc) // If the user's hands are full, place it on the tile of the dispenser. + + to_chat(user, "You take [T] out of [src].") + update_icon() + +/// Called when the user clicks on the dispenser with a tank. Tries to insert the tank into the dispenser, and updates the UI if successful. +/obj/structure/dispenser/proc/try_insert_tank(mob/living/user, list/tank_list, obj/item/tank/T) + if(LAZYLEN(tank_list) >= MAX_TANK_STORAGE) + to_chat(user, "[src] is full.") + return + + if(!user.drop_item()) // Antidrop check + to_chat(user, "[T] is stuck to your hand!") + return + + T.forceMove(src) + tank_list.Add(T) + update_icon() + to_chat(user, "You put [T] in [src].") + SSnanoui.try_update_ui(user, src) /obj/structure/tank_dispenser/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) @@ -130,3 +153,5 @@ I.forceMove(loc) new /obj/item/stack/sheet/metal(loc, 2) qdel(src) + +#undef MAX_TANK_STORAGE diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index 7095fd4eeda..8984dc60a52 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -144,9 +144,7 @@ if(istype(mob, /mob) && mob.client) // If the pod is not in a tube at all, you can get out at any time. if(!(locate(/obj/structure/transit_tube) in loc)) - mob.loc = loc - mob.client.Move(get_step(loc, direction), direction) - mob.reset_perspective(null) + mob.forceMove(loc) //if(moving && istype(loc, /turf/space)) // Todo: If you get out of a moving pod in space, you should move as well. @@ -158,9 +156,7 @@ if(!station.pod_moving) if(direction == station.dir) if(station.icon_state == "open") - mob.loc = loc - mob.client.Move(get_step(loc, direction), direction) - mob.reset_perspective(null) + mob.forceMove(loc) else station.open_animation() diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index a529dc3a6e7..87107f97abe 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -411,7 +411,7 @@ M.l_hand.clean_blood() if(M.back) if(M.back.clean_blood()) - M.update_inv_back(0) + M.update_inv_back() if(ishuman(M)) var/mob/living/carbon/human/H = M var/washgloves = 1 @@ -437,38 +437,38 @@ if(H.head) if(H.head.clean_blood()) - H.update_inv_head(0,0) + H.update_inv_head() if(H.wear_suit) if(H.wear_suit.clean_blood()) - H.update_inv_wear_suit(0,0) + H.update_inv_wear_suit() else if(H.w_uniform) if(H.w_uniform.clean_blood()) - H.update_inv_w_uniform(0,0) + H.update_inv_w_uniform() if(H.gloves && washgloves) if(H.gloves.clean_blood()) - H.update_inv_gloves(0,0) + H.update_inv_gloves() if(H.shoes && washshoes) if(H.shoes.clean_blood()) - H.update_inv_shoes(0,0) + H.update_inv_shoes() if(H.wear_mask && washmask) if(H.wear_mask.clean_blood()) - H.update_inv_wear_mask(0) + H.update_inv_wear_mask() if(H.glasses && washglasses) if(H.glasses.clean_blood()) - H.update_inv_glasses(0) + H.update_inv_glasses() if(H.l_ear && washears) if(H.l_ear.clean_blood()) - H.update_inv_ears(0) + H.update_inv_ears() if(H.r_ear && washears) if(H.r_ear.clean_blood()) - H.update_inv_ears(0) + H.update_inv_ears() if(H.belt) if(H.belt.clean_blood()) - H.update_inv_belt(0) + H.update_inv_belt() else if(M.wear_mask) //if the mob is not human, it cleans the mask without asking for bitflags if(M.wear_mask.clean_blood()) - M.update_inv_wear_mask(0) + M.update_inv_wear_mask() else O.clean_blood() diff --git a/code/game/turfs/simulated/floor/asteroid.dm b/code/game/turfs/simulated/floor/asteroid.dm index 6d5d95dff0e..6118885a921 100644 --- a/code/game/turfs/simulated/floor/asteroid.dm +++ b/code/game/turfs/simulated/floor/asteroid.dm @@ -227,7 +227,7 @@ GLOBAL_LIST_INIT(megafauna_spawn_list, list(/mob/living/simple_animal/hostile/me break var/list/L = list(45) - if(IsOdd(dir2angle(dir))) // We're going at an angle and we want thick angled tunnels. + if(ISODD(dir2angle(dir))) // We're going at an angle and we want thick angled tunnels. L += -45 // Expand the edges of our tunnel diff --git a/code/game/turfs/simulated/floor/lava.dm b/code/game/turfs/simulated/floor/lava.dm index aa1be2200fa..b32580b9bab 100644 --- a/code/game/turfs/simulated/floor/lava.dm +++ b/code/game/turfs/simulated/floor/lava.dm @@ -80,8 +80,8 @@ O.resistance_flags |= FLAMMABLE //Even fireproof things burn up in lava if(O.resistance_flags & FIRE_PROOF) O.resistance_flags &= ~FIRE_PROOF - if(O.armor["fire"] > 50) //obj with 100% fire armor still get slowly burned away. - O.armor["fire"] = 50 + if(O.armor.getRating("fire") > 50) //obj with 100% fire armor still get slowly burned away. + O.armor = O.armor.setRating(fire_value = 50) O.fire_act(10000, 1000) else if(isliving(thing)) diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm index 0ca6494497c..95d5f816aa4 100644 --- a/code/game/turfs/simulated/floor/misc_floor.dm +++ b/code/game/turfs/simulated/floor/misc_floor.dm @@ -20,6 +20,14 @@ icon = 'icons/turf/floors.dmi' icon_state = "bcircuit" +/turf/simulated/floor/bluegrid/telecomms + nitrogen = 100 + oxygen = 0 + temperature = 80 + +/turf/simulated/floor/bluegrid/telecomms/server + name = "server base" + /turf/simulated/floor/greengrid icon = 'icons/turf/floors.dmi' icon_state = "gcircuit" diff --git a/code/game/turfs/simulated/floor/plasteel_floor.dm b/code/game/turfs/simulated/floor/plasteel_floor.dm index d36396aaa5f..ee19b4eeeb5 100644 --- a/code/game/turfs/simulated/floor/plasteel_floor.dm +++ b/code/game/turfs/simulated/floor/plasteel_floor.dm @@ -41,6 +41,11 @@ /turf/simulated/floor/plasteel/dark icon_state = "darkfull" +/turf/simulated/floor/plasteel/dark/telecomms + nitrogen = 100 + oxygen = 0 + temperature = 80 + /turf/simulated/floor/plasteel/freezer icon_state = "freezerfloor" diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index 588a8387474..c692135dc44 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -205,16 +205,41 @@ color = "#FAE48C" animate(src, color = previouscolor, time = 8) -/turf/simulated/floor/engine/n20/New() - ..() - var/datum/gas_mixture/adding = new - var/datum/gas/sleeping_agent/trace_gas = new +//air filled floors; used in atmos pressure chambers - trace_gas.moles = 6000 - adding.trace_gases += trace_gas - adding.temperature = T20C +/turf/simulated/floor/engine/n20 + name = "\improper N2O floor" + sleeping_agent = 6000 + oxygen = 0 + nitrogen = 0 + +/turf/simulated/floor/engine/co2 + name = "\improper CO2 floor" + carbon_dioxide = 50000 + oxygen = 0 + nitrogen = 0 + +/turf/simulated/floor/engine/plasma + name = "plasma floor" + toxins = 70000 + oxygen = 0 + nitrogen = 0 + +/turf/simulated/floor/engine/o2 + name = "\improper O2 floor" + oxygen = 100000 + nitrogen = 0 + +/turf/simulated/floor/engine/n2 + name = "\improper N2 floor" + nitrogen = 100000 + oxygen = 0 + +/turf/simulated/floor/engine/air + name = "air floor" + oxygen = 2644 + nitrogen = 10580 - assume_air(adding) /turf/simulated/floor/engine/singularity_pull(S, current_size) ..() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index b78b90f2769..96ee03283d3 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -3,15 +3,18 @@ level = 1 luminosity = 1 - var/intact = 1 + var/intact = TRUE var/turf/baseturf = /turf/space var/slowdown = 0 //negative for faster, positive for slower - //Properties for open tiles (/floor) + ///Properties for open tiles (/floor) + /// All the gas vars, on the turf, are meant to be utilized for initializing a gas datum and setting its first gas values; the turf vars are never further modified at runtime; it is never directly used for calculations by the atmospherics system. var/oxygen = 0 var/carbon_dioxide = 0 var/nitrogen = 0 var/toxins = 0 + var/sleeping_agent = 0 + var/agent_b = 0 //Properties for airtight tiles (/wall) var/thermal_conductivity = 0.05 @@ -30,7 +33,7 @@ var/list/blueprint_data //for the station blueprints, images of objects eg: pipes - var/list/footstep_sounds = list() + var/list/footstep_sounds var/shoe_running_volume = 50 var/shoe_walking_volume = 20 @@ -69,7 +72,7 @@ user.Move_Pulled(src) /turf/ex_act(severity) - return 0 + return FALSE /turf/rpd_act(mob/user, obj/item/rpd/our_rpd) //This is the default turf behaviour for the RPD; override it as required if(our_rpd.mode == RPD_ATMOS_MODE) @@ -87,55 +90,53 @@ else if(our_rpd.mode == RPD_DELETE_MODE) our_rpd.delete_all_pipes(user, src) -/turf/bullet_act(var/obj/item/projectile/Proj) - if(istype(Proj ,/obj/item/projectile/beam/pulse)) +/turf/bullet_act(obj/item/projectile/Proj) + if(istype(Proj, /obj/item/projectile/beam/pulse)) src.ex_act(2) ..() - return 0 + return FALSE -/turf/bullet_act(var/obj/item/projectile/Proj) - if(istype(Proj ,/obj/item/projectile/bullet/gyro)) +/turf/bullet_act(obj/item/projectile/Proj) + if(istype(Proj, /obj/item/projectile/bullet/gyro)) explosion(src, -1, 0, 2) ..() - return 0 + return FALSE -/turf/Enter(atom/movable/mover as mob|obj, atom/forget as mob|obj|turf|area) +/turf/Enter(atom/movable/mover as mob|obj, atom/forget) if(!mover) - return 1 - + return TRUE // First, make sure it can leave its square if(isturf(mover.loc)) // Nothing but border objects stop you from leaving a tile, only one loop is needed for(var/obj/obstacle in mover.loc) if(!obstacle.CheckExit(mover, src) && obstacle != mover && obstacle != forget) - mover.Bump(obstacle, 1) - return 0 + mover.Bump(obstacle, TRUE) + return FALSE var/list/large_dense = list() //Next, check objects to block entry that are on the border for(var/atom/movable/border_obstacle in src) - if(border_obstacle.flags&ON_BORDER) - if(!border_obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != border_obstacle)) - mover.Bump(border_obstacle, 1) - return 0 + if(border_obstacle.flags & ON_BORDER) + if(!border_obstacle.CanPass(mover, mover.loc, 1) && (forget != border_obstacle)) + mover.Bump(border_obstacle, TRUE) + return FALSE else large_dense += border_obstacle //Then, check the turf itself if(!src.CanPass(mover, src)) - mover.Bump(src, 1) - return 0 + mover.Bump(src, TRUE) + return FALSE //Finally, check objects/mobs to block entry that are not on the border for(var/atom/movable/obstacle in large_dense) - if(!obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != obstacle)) - mover.Bump(obstacle, 1) - return 0 - return 1 //Nothing found to block so return success! + if(!obstacle.CanPass(mover, mover.loc, 1) && (forget != obstacle)) + mover.Bump(obstacle, TRUE) + return FALSE + return TRUE //Nothing found to block so return success! - -/turf/Entered(atom/movable/M, atom/OL, ignoreRest = 0) +/turf/Entered(atom/movable/M, atom/OL, ignoreRest = FALSE) ..() if(ismob(M)) var/mob/O = M @@ -148,7 +149,12 @@ if(loopsanity == 0) break loopsanity-- - A.HasProximity(M, 1) + A.HasProximity(M) + + // If an opaque movable atom moves around we need to potentially update visibility. + if(M.opacity) + has_opaque_atom = TRUE // Make sure to do this before reconsider_lights(), incase we're on instant updates. Guaranteed to be on in this case. + reconsider_lights() /turf/proc/levelupdate() for(var/obj/O in src) @@ -159,7 +165,7 @@ /turf/space/levelupdate() for(var/obj/O in src) if(O.level == 1) - O.hide(0) + O.hide(FALSE) // Removes all signs of lattice on the pos of the turf -Donkieyo /turf/proc/RemoveLattice() @@ -229,7 +235,7 @@ return // I'm including `ignore_air` because BYOND lacks positional-only arguments -/turf/proc/AfterChange(ignore_air, keep_cabling = FALSE) //called after a turf has been replaced in ChangeTurf() +/turf/proc/AfterChange(ignore_air = FALSE, keep_cabling = FALSE) //called after a turf has been replaced in ChangeTurf() levelupdate() CalculateAdjacentTurfs() @@ -240,7 +246,7 @@ for(var/obj/structure/cable/C in contents) qdel(C) -/turf/simulated/AfterChange(ignore_air, keep_cabling = FALSE) +/turf/simulated/AfterChange(ignore_air = FALSE, keep_cabling = FALSE) ..() RemoveLattice() if(!ignore_air) @@ -249,32 +255,38 @@ //////Assimilate Air////// /turf/simulated/proc/Assimilate_Air() if(air) - var/aoxy = 0//Holders to assimilate air from nearby turfs + var/aoxy = 0 //Holders to assimilate air from nearby turfs var/anitro = 0 var/aco = 0 var/atox = 0 + var/asleep = 0 + var/ab = 0 var/atemp = 0 var/turf_count = 0 for(var/direction in GLOB.cardinal)//Only use cardinals to cut down on lag - var/turf/T = get_step(src,direction) - if(istype(T,/turf/space))//Counted as no air + var/turf/T = get_step(src, direction) + if(istype(T, /turf/space))//Counted as no air turf_count++//Considered a valid turf for air calcs continue - else if(istype(T,/turf/simulated/floor)) + else if(istype(T, /turf/simulated/floor)) var/turf/simulated/S = T if(S.air)//Add the air's contents to the holders aoxy += S.air.oxygen anitro += S.air.nitrogen aco += S.air.carbon_dioxide atox += S.air.toxins + asleep += S.air.sleeping_agent + ab += S.air.agent_b atemp += S.air.temperature turf_count++ - air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like - air.nitrogen = (anitro/max(turf_count,1)) - air.carbon_dioxide = (aco/max(turf_count,1)) - air.toxins = (atox/max(turf_count,1)) - air.temperature = (atemp/max(turf_count,1))//Trace gases can get bant + air.oxygen = (aoxy / max(turf_count, 1)) //Averages contents of the turfs, ignoring walls and the like + air.nitrogen = (anitro / max(turf_count, 1)) + air.carbon_dioxide = (aco / max(turf_count, 1)) + air.toxins = (atox / max(turf_count, 1)) + air.sleeping_agent = (asleep / max(turf_count, 1)) + air.agent_b = (ab / max(turf_count, 1)) + air.temperature = (atemp / max(turf_count, 1)) if(SSair) SSair.add_to_active(src) @@ -288,12 +300,11 @@ /turf/proc/kill_creatures(mob/U = null)//Will kill people/creatures and damage mechs./N //Useful to batch-add creatures to the list. for(var/mob/living/M in src) - if(M==U) continue//Will not harm U. Since null != M, can be excluded to kill everyone. - spawn(0) - M.gib() + if(M == U) + continue//Will not harm U. Since null != M, can be excluded to kill everyone. + INVOKE_ASYNC(M, /mob/.proc/gib) for(var/obj/mecha/M in src)//Mecha are not gibbed but are damaged. - spawn(0) - M.take_damage(100, "brute") + INVOKE_ASYNC(M, /obj/mecha/.proc/take_damage, 100, "brute") /turf/proc/Bless() flags |= NOJAUNT @@ -350,11 +361,11 @@ // Returns the surrounding simulated turfs with open links // Including through doors openable with the ID -/turf/proc/AdjacentTurfsWithAccess(var/obj/item/card/id/ID = null,var/list/closed)//check access if one is passed +/turf/proc/AdjacentTurfsWithAccess(obj/item/card/id/ID = null, list/closed)//check access if one is passed var/list/L = new() var/turf/simulated/T - for(var/dir in list(NORTHWEST,NORTHEAST,SOUTHEAST,SOUTHWEST,NORTH,EAST,SOUTH,WEST)) //arbitrarily ordered list to favor non-diagonal moves in case of ties - T = get_step(src,dir) + for(var/dir in GLOB.alldirs2) //arbitrarily ordered list to favor non-diagonal moves in case of ties + T = get_step(src, dir) if(T in closed) //turf already proceeded in A* continue if(istype(T) && !T.density) @@ -363,11 +374,11 @@ return L //Idem, but don't check for ID and goes through open doors -/turf/proc/AdjacentTurfs(var/list/closed) +/turf/proc/AdjacentTurfs(list/closed) var/list/L = new() var/turf/simulated/T - for(var/dir in list(NORTHWEST,NORTHEAST,SOUTHEAST,SOUTHWEST,NORTH,EAST,SOUTH,WEST)) //arbitrarily ordered list to favor non-diagonal moves in case of ties - T = get_step(src,dir) + for(var/dir in GLOB.alldirs2) //arbitrarily ordered list to favor non-diagonal moves in case of ties + T = get_step(src, dir) if(T in closed) //turf already proceeded by A* continue if(istype(T) && !T.density) @@ -376,11 +387,11 @@ return L // check for all turfs, including unsimulated ones -/turf/proc/AdjacentTurfsSpace(var/obj/item/card/id/ID = null, var/list/closed)//check access if one is passed +/turf/proc/AdjacentTurfsSpace(obj/item/card/id/ID = null, list/closed)//check access if one is passed var/list/L = new() var/turf/T - for(var/dir in list(NORTHWEST,NORTHEAST,SOUTHEAST,SOUTHWEST,NORTH,EAST,SOUTH,WEST)) //arbitrarily ordered list to favor non-diagonal moves in case of ties - T = get_step(src,dir) + for(var/dir in GLOB.alldirs2) //arbitrarily ordered list to favor non-diagonal moves in case of ties + T = get_step(src, dir) if(T in closed) //turf already proceeded by A* continue if(istype(T) && !T.density) @@ -397,20 +408,21 @@ ////////////////////////////// //Distance associates with all directions movement -/turf/proc/Distance(var/turf/T) - return get_dist(src,T) +/turf/proc/Distance(turf/T) + return get_dist(src, T) // This Distance proc assumes that only cardinal movement is // possible. It results in more efficient (CPU-wise) pathing // for bots and anything else that only moves in cardinal dirs. /turf/proc/Distance_cardinal(turf/T) - if(!src || !T) return 0 + if(!src || !T) + return 0 return abs(src.x - T.x) + abs(src.y - T.y) //////////////////////////////////////////////////// /turf/acid_act(acidpwr, acid_volume) - . = 1 + . = TRUE var/acid_type = /obj/effect/acid if(acidpwr >= 200) //alien acid power acid_type = /obj/effect/acid/alien @@ -435,7 +447,7 @@ if(!forced) return if(has_gravity(src)) - playsound(src, "bodyfall", 50, 1) + playsound(src, "bodyfall", 50, TRUE) /turf/singularity_act() if(intact) @@ -445,7 +457,7 @@ if(O.invisibility == INVISIBILITY_MAXIMUM) O.singularity_act() ChangeTurf(baseturf) - return(2) + return 2 /turf/proc/visibilityChanged() if(SSticker) @@ -456,25 +468,25 @@ if(istype(I, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = I for(var/obj/structure/cable/LC in src) - if(LC.d1 == 0 || LC.d2==0) - LC.attackby(C,user) + if(LC.d1 == 0 || LC.d2 == 0) + LC.attackby(C, user) return C.place_turf(src, user) - return 1 + return TRUE else if(istype(I, /obj/item/twohanded/rcl)) var/obj/item/twohanded/rcl/R = I if(R.loaded) for(var/obj/structure/cable/LC in src) - if(LC.d1 == 0 || LC.d2==0) + if(LC.d1 == 0 || LC.d2 == 0) LC.attackby(R, user) return R.loaded.place_turf(src, user) R.is_empty(user) - return 0 + return FALSE /turf/proc/can_have_cabling() - return 1 + return TRUE /turf/proc/can_lay_cable() return can_have_cabling() & !intact @@ -510,7 +522,7 @@ if(!SSticker || SSticker.current_state != GAME_STATE_PLAYING) add_blueprints(AM) -/turf/proc/empty(turf_type=/turf/space) +/turf/proc/empty(turf_type = /turf/space) // Remove all atoms except observers, landmarks, docking ports, and (un)`simulated` atoms (lighting overlays) var/turf/T0 = src for(var/X in T0.GetAllContents()) @@ -523,13 +535,13 @@ continue if(istype(A, /obj/docking_port)) continue - qdel(A, force=TRUE) + qdel(A, force = TRUE) T0.ChangeTurf(turf_type) SSair.remove_from_active(T0) T0.CalculateAdjacentTurfs() - SSair.add_to_active(T0,1) + SSair.add_to_active(T0, TRUE) /turf/AllowDrop() return TRUE diff --git a/code/game/world.dm b/code/game/world.dm index 9d0e6e5a0ba..b9af02769f2 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -1,5 +1,3 @@ -#define RECOMMENDED_VERSION 510 - GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG) /world/New() @@ -13,7 +11,7 @@ GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG) log_world("[GLOB.vars.len - GLOB.gvars_datum_in_built_vars.len] global variables") connectDB() // This NEEDS TO HAPPEN EARLY. I CANNOT STRESS THIS ENOUGH!!!!!!! -aa load_admins() // Same here - if(byond_version < RECOMMENDED_VERSION) + if(byond_version < MIN_COMPILER_VERSION || byond_build < MIN_COMPILER_BUILD) log_world("Your server's byond version does not meet the recommended requirements for this code. Please update BYOND") if(config && config.server_name != null && config.server_suffix && world.port > 0) @@ -31,10 +29,6 @@ GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG) . = ..() Master.Initialize(10, FALSE) - - -#undef RECOMMENDED_VERSION - return // This is basically a replacement for hook/startup. Please dont shove random bullshit here @@ -253,7 +247,7 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) if(!key_valid) return keySpamProtect(addr) if(input["req"] == "public") - hub_password = hub_password_base + hub_password = initial(hub_password) update_status() return "Set listed status to public." else @@ -274,6 +268,10 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) /world/Reboot(var/reason, var/feedback_c, var/feedback_r, var/time) if(reason == 1) //special reboot, do none of the normal stuff if(usr) + if(!check_rights(R_SERVER)) + message_admins("[key_name_admin(usr)] attempted to restart the server via the Profiler, without access.") + log_admin("[key_name(usr)] attempted to restart the server via the Profiler, without access.") + return message_admins("[key_name_admin(usr)] has requested an immediate world restart via client side debugging tools") log_admin("[key_name(usr)] has requested an immediate world restart via client side debugging tools") spawn(0) diff --git a/code/hub.dm b/code/hub.dm index 665193a9d5b..32fe613399e 100644 --- a/code/hub.dm +++ b/code/hub.dm @@ -3,7 +3,6 @@ hub = "Exadv1.spacestation13" hub_password = "kMZy3U5jJHSiBQjr" name = "Space Station 13" - /var/hub_password_base = "kMZy3U5jJHSiBQjr" /* This is for any host that would like their server to appear on the main SS13 hub. To use it, simply replace the password above, with the password found below, and it should work. If not, let us know on the main tgstation IRC channel of irc.rizon.net #tgstation13 we can help you there. diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index 861882b0dbb..4ea6a83857c 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -64,6 +64,10 @@ GLOBAL_PROTECT(admin_ranks) // this shit is being protected for obvious reasons C.holder = null GLOB.admins.Cut() + // Remove all profiler access + for(var/A in world.GetConfig("admin")) + world.SetConfig("APP/admin", A, null) + if(config.admin_legacy_system) load_admin_ranks() @@ -94,6 +98,9 @@ GLOBAL_PROTECT(admin_ranks) // this shit is being protected for obvious reasons //create the admin datum and store it for later use var/datum/admins/D = new /datum/admins(rank, rights, ckey) + if(D.rights & R_DEBUG || D.rights & R_VIEWRUNTIMES) // Grants profiler access to anyone with R_DEBUG or R_VIEWRUNTIMES + world.SetConfig("APP/admin", ckey, "role=admin") + //find the client for a ckey if they are connected and associate them with the new admin datum D.associate(GLOB.directory[ckey]) @@ -118,6 +125,9 @@ GLOBAL_PROTECT(admin_ranks) // this shit is being protected for obvious reasons if(istext(rights)) rights = text2num(rights) var/datum/admins/D = new /datum/admins(rank, rights, ckey) + if(D.rights & R_DEBUG || D.rights & R_VIEWRUNTIMES) // Grants profiler access to anyone with R_DEBUG or R_VIEWRUNTIMES + world.SetConfig("APP/admin", ckey, "role=admin") + //find the client for a ckey if they are connected and associate them with the new admin datum D.associate(GLOB.directory[ckey]) if(!GLOB.admin_datums) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 62cb627db17..4e3d2d65f30 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -247,6 +247,8 @@ GLOBAL_LIST_INIT(admin_verbs_ticket, list( verbs += GLOB.admin_verbs_server if(holder.rights & R_DEBUG) verbs += GLOB.admin_verbs_debug + spawn(1) + control_freak = 0 // Setting control_freak to 0 allows you to use the Profiler and other client-side tools if(holder.rights & R_POSSESS) verbs += GLOB.admin_verbs_possess if(holder.rights & R_PERMISSIONS) @@ -267,6 +269,9 @@ GLOBAL_LIST_INIT(admin_verbs_ticket, list( verbs += GLOB.admin_verbs_proccall if(holder.rights & R_VIEWRUNTIMES) verbs += /client/proc/view_runtimes + spawn(1) // This setting exposes the profiler for people with R_VIEWRUNTIMES. They must still have it set in cfg/admin.txt + control_freak = 0 + /client/proc/remove_admin_verbs() verbs.Remove( diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 2a1d03b79aa..efb5ac32f97 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -2,6 +2,10 @@ /datum/admins/proc/player_panel_new()//The new one if(!usr.client.holder) return + // This stops the panel from being invoked by mentors who press F7. + if(!check_rights(R_ADMIN)) + message_admins("[key_name_admin(usr)] attempted to invoke player panel without admin rights. If this is a mentor, its a chance they accidentally hit F7. If this is NOT a mentor, there is a high chance an exploit is being used") + return var/dat = "Admin Player Panel" //javascript, the part that does most of the work~ @@ -486,6 +490,9 @@ if(SSticker.mode.wizards.len) dat += check_role_table("Wizards", SSticker.mode.wizards) + if(SSticker.mode.apprentices.len) + dat += check_role_table("Apprentices", SSticker.mode.apprentices) + if(SSticker.mode.raiders.len) dat += check_role_table("Raiders", SSticker.mode.raiders) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 7826a005e7d..1a040d46e90 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1980,7 +1980,7 @@ to_chat(usr, "ERROR: This mob ([H]) has no mind!") return var/list/possible_traitors = list() - for(var/mob/living/player in GLOB.living_mob_list) + for(var/mob/living/player in GLOB.alive_mob_list) if(player.client && player.mind && player.stat != DEAD && player != H) if(ishuman(player) && !player.mind.special_role) if(player.client && (ROLE_TRAITOR in player.client.prefs.be_special) && !jobban_isbanned(player, ROLE_TRAITOR) && !jobban_isbanned(player, "Syndicate")) diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2.dm b/code/modules/admin/verbs/SDQL2/SDQL_2.dm index e2da701cf4d..018b45422c5 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_2.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_2.dm @@ -430,7 +430,7 @@ else if(expression[start + 1] == "\[" && islist(v)) var/list/L = v var/index = SDQL_expression(source, expression[start + 2]) - if(isnum(index) && (!IsInteger(index) || L.len < index)) + if(isnum(index) && (!ISINTEGER(index) || L.len < index)) to_chat(world, "Invalid list index: [index]") return null return L[index] diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index 087a90eebe6..ed8533dc9d5 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -1,7 +1,6 @@ /client/proc/atmosscan() set category = "Mapping" set name = "Check Piping" - set background = 1 if(!src.holder) to_chat(src, "Only administrators may use this command.") return @@ -12,17 +11,18 @@ to_chat(usr, "Checking for disconnected pipes...") //all plumbing - yes, some things might get stated twice, doesn't matter. - for(var/obj/machinery/atmospherics/plumbing in world) + for(var/thing in SSair.atmos_machinery) + var/obj/machinery/atmospherics/plumbing = thing if(plumbing.nodealert) to_chat(usr, "Unconnected [plumbing.name] located at [plumbing.x],[plumbing.y],[plumbing.z] ([get_area(plumbing.loc)])") //Manifolds - for(var/obj/machinery/atmospherics/pipe/manifold/pipe in world) + for(var/obj/machinery/atmospherics/pipe/manifold/pipe in SSair.atmos_machinery) if(!pipe.node1 || !pipe.node2 || !pipe.node3) to_chat(usr, "Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])") //Pipes - for(var/obj/machinery/atmospherics/pipe/simple/pipe in world) + for(var/obj/machinery/atmospherics/pipe/simple/pipe in SSair.atmos_machinery) if(!pipe.node1 || !pipe.node2) to_chat(usr, "Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])") diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 32dcf3daa7b..329efb8e067 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -487,7 +487,8 @@ GLOBAL_PROTECT(AdminProcCaller) for(var/area/A in world) areas_all |= A.type - for(var/obj/machinery/power/apc/APC in world) + for(var/thing in GLOB.apcs) + var/obj/machinery/power/apc/APC = thing var/area/A = get_area(APC) if(!A) continue @@ -496,7 +497,8 @@ GLOBAL_PROTECT(AdminProcCaller) else areas_with_multiple_APCs |= A.type - for(var/obj/machinery/alarm/alarm in world) + for(var/thing in GLOB.air_alarms) + var/obj/machinery/alarm/alarm = thing var/area/A = get_area(alarm) if(!A) continue @@ -505,31 +507,31 @@ GLOBAL_PROTECT(AdminProcCaller) else areas_with_multiple_air_alarms |= A.type - for(var/obj/machinery/requests_console/RC in world) + for(var/obj/machinery/requests_console/RC in GLOB.machines) var/area/A = get_area(RC) if(!A) continue areas_with_RC |= A.type - for(var/obj/machinery/light/L in world) + for(var/obj/machinery/light/L in GLOB.machines) var/area/A = get_area(L) if(!A) continue areas_with_light |= A.type - for(var/obj/machinery/light_switch/LS in world) + for(var/obj/machinery/light_switch/LS in GLOB.machines) var/area/A = get_area(LS) if(!A) continue areas_with_LS |= A.type - for(var/obj/item/radio/intercom/I in world) + for(var/obj/item/radio/intercom/I in GLOB.global_radios) var/area/A = get_area(I) if(!A) continue areas_with_intercom |= A.type - for(var/obj/machinery/camera/C in world) + for(var/obj/machinery/camera/C in GLOB.machines) var/area/A = get_area(C) if(!A) continue @@ -716,23 +718,25 @@ GLOBAL_PROTECT(AdminProcCaller) if(!check_rights(R_DEBUG)) return - switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Silicons","Clients","Respawnable Mobs")) + switch(input("Which list?") in list("Players", "Admins", "Mobs", "Living Mobs", "Alive Mobs", "Dead Mobs", "Silicons", "Clients", "Respawnable Mobs")) if("Players") - to_chat(usr, jointext(GLOB.player_list,",")) + to_chat(usr, jointext(GLOB.player_list, ",")) if("Admins") - to_chat(usr, jointext(GLOB.admins,",")) + to_chat(usr, jointext(GLOB.admins, ",")) if("Mobs") - to_chat(usr, jointext(GLOB.mob_list,",")) + to_chat(usr, jointext(GLOB.mob_list, ",")) if("Living Mobs") - to_chat(usr, jointext(GLOB.living_mob_list,",")) + to_chat(usr, jointext(GLOB.mob_living_list, ",")) + if("Alive Mobs") + to_chat(usr, jointext(GLOB.alive_mob_list, ",")) if("Dead Mobs") - to_chat(usr, jointext(GLOB.dead_mob_list,",")) + to_chat(usr, jointext(GLOB.dead_mob_list, ",")) if("Silicons") - to_chat(usr, jointext(GLOB.silicon_mob_list,",")) + to_chat(usr, jointext(GLOB.silicon_mob_list, ",")) if("Clients") - to_chat(usr, jointext(GLOB.clients,",")) + to_chat(usr, jointext(GLOB.clients, ",")) if("Respawnable Mobs") - to_chat(usr, jointext(GLOB.respawnable_list,",")) + to_chat(usr, jointext(GLOB.respawnable_list, ",")) /client/proc/cmd_display_del_log() set category = "Debug" diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index ce10383ca4e..78f2647e429 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -15,9 +15,7 @@ if(T.active_hotspot) burning = 1 - to_chat(usr, "@[target.x],[target.y]: O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("BURNING"):(null)]") - for(var/datum/gas/trace_gas in GM.trace_gases) - to_chat(usr, "[trace_gas.type]: [trace_gas.moles]") + to_chat(usr, "@[target.x],[target.y]: O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] N2O: [GM.sleeping_agent] Agent B: [GM.agent_b] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("BURNING"):(null)]") message_admins("[key_name_admin(usr)] has checked the air status of [target]") log_admin("[key_name(usr)] has checked the air status of [target]") diff --git a/code/modules/admin/verbs/honksquad.dm b/code/modules/admin/verbs/honksquad.dm index 8c8d46ec97b..5107ce7e22c 100644 --- a/code/modules/admin/verbs/honksquad.dm +++ b/code/modules/admin/verbs/honksquad.dm @@ -48,7 +48,8 @@ GLOBAL_VAR_INIT(sent_honksquad, 0) commandos += candidate//Add their ghost to commandos. //Spawns HONKsquad and equips them. - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(honksquad_number<=0) break if(L.name == "HONKsquad") honk_leader_selected = honksquad_number == 1?1:0 diff --git a/code/modules/admin/verbs/infiltratorteam_syndicate.dm b/code/modules/admin/verbs/infiltratorteam_syndicate.dm index 459f2b8fb4b..54ddf85045e 100644 --- a/code/modules/admin/verbs/infiltratorteam_syndicate.dm +++ b/code/modules/admin/verbs/infiltratorteam_syndicate.dm @@ -66,7 +66,8 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0) var/list/sit_spawns = list() var/list/sit_spawns_leader = list() var/list/sit_spawns_mgmt = list() - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Syndicate-Infiltrator") sit_spawns += L if(L.name == "Syndicate-Infiltrator-Leader") diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 10ad31ef410..5e05b8ecebd 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -118,7 +118,7 @@ GLOBAL_VAR_INIT(intercom_range_display_status, 0) qdel(M) if(GLOB.intercom_range_display_status) - for(var/obj/item/radio/intercom/I in world) + for(var/obj/item/radio/intercom/I in GLOB.global_radios) for(var/turf/T in orange(7,I)) var/obj/effect/debugging/marker/F = new/obj/effect/debugging/marker(T) if(!(F in view(7,I.loc))) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 0474629dea0..079446b0994 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -627,6 +627,7 @@ GLOBAL_LIST_INIT(VVpixelmovement, list("step_x", "step_y", "step_size", "bound_h if(!O.vv_edit_var(variable, var_new)) to_chat(src, "Your edit was rejected by the object.") return + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_VAR_EDIT, args) log_world("### VarEdit by [src]: [O.type] [variable]=[html_encode("[var_new]")]") log_admin("[key_name(src)] modified [original_name]'s [variable] to [var_new]") var/msg = "[key_name_admin(src)] modified [original_name]'s [variable] to [var_new]" diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 57f7cad31c4..3e89a6ac18d 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -267,7 +267,7 @@ client/proc/one_click_antag() var/I = image('icons/mob/mob.dmi', loc = synd_mind_1.current, icon_state = "synd") synd_mind.current.client.images += I - for(var/obj/machinery/nuclearbomb/bomb in world) + for(var/obj/machinery/nuclearbomb/bomb in GLOB.machines) bomb.r_code = nuke_code // All the nukes are set to this code. return 1 @@ -455,7 +455,8 @@ client/proc/one_click_antag() if(candidates.len) var/raiders = min(antnum, candidates.len) //Spawns vox raiders and equips them. - for(var/obj/effect/landmark/L in world) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "voxstart") if(raiders<=0) break @@ -583,7 +584,8 @@ client/proc/one_click_antag() var/teamOneMembers = 5 var/teamTwoMembers = 5 var/datum/preferences/A = new() - for(var/obj/effect/landmark/L in world) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "tdome1") if(teamOneMembers<=0) break diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 13a258e4212..a7763f31fb1 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -979,7 +979,7 @@ Traitors and the like can also be revived with the previous role mostly intact. var/role_string var/obj_count = 0 var/obj_string = "" - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) if(!isLivingSSD(H)) continue mins_ssd = round((world.time - H.last_logout) / 600) @@ -1016,7 +1016,7 @@ Traitors and the like can also be revived with the previous role mostly intact. msg += "AFK Players:
" msg += "" var/mins_afk - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) if(H.client == null || H.stat == DEAD) // No clientless or dead continue mins_afk = round(H.client.inactivity / 600) diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm index a03c37c4f67..0b84c96e71a 100644 --- a/code/modules/admin/verbs/striketeam.dm +++ b/code/modules/admin/verbs/striketeam.dm @@ -30,7 +30,7 @@ GLOBAL_VAR_INIT(sent_strike_team, 0) // Find the nuclear auth code var/nuke_code var/temp_code - for(var/obj/machinery/nuclearbomb/N in world) + for(var/obj/machinery/nuclearbomb/N in GLOB.machines) temp_code = text2num(N.r_code) if(temp_code)//if it's actually a number. It won't convert any non-numericals. nuke_code = N.r_code @@ -48,7 +48,8 @@ GLOBAL_VAR_INIT(sent_strike_team, 0) var/commando_number = COMMANDOS_POSSIBLE //for selecting a leader var/is_leader = TRUE // set to FALSE after leader is spawned - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(commando_number <= 0) break @@ -109,7 +110,8 @@ GLOBAL_VAR_INIT(sent_strike_team, 0) commando_number-- //Spawns the rest of the commando gear. - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Commando_Manual") //new /obj/item/gun/energy/pulse_rifle(L.loc) var/obj/item/paper/P = new(L.loc) @@ -120,7 +122,8 @@ GLOBAL_VAR_INIT(sent_strike_team, 0) P.stamp(stamp) qdel(stamp) - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "Commando-Bomb") new /obj/effect/spawner/newbomb/timer/syndicate(L.loc) qdel(L) diff --git a/code/modules/admin/verbs/striketeam_syndicate.dm b/code/modules/admin/verbs/striketeam_syndicate.dm index 73ee5edb82d..12df7467cbc 100644 --- a/code/modules/admin/verbs/striketeam_syndicate.dm +++ b/code/modules/admin/verbs/striketeam_syndicate.dm @@ -38,7 +38,7 @@ GLOBAL_VAR_INIT(sent_syndicate_strike_team, 0) // Find the nuclear auth code var/nuke_code var/temp_code - for(var/obj/machinery/nuclearbomb/N in world) + for(var/obj/machinery/nuclearbomb/N in GLOB.machines) temp_code = text2num(N.r_code) if(temp_code)//if it's actually a number. It won't convert any non-numericals. nuke_code = N.r_code @@ -53,7 +53,8 @@ GLOBAL_VAR_INIT(sent_syndicate_strike_team, 0) GLOB.sent_syndicate_strike_team = 1 //Spawns commandos and equips them. - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(syndicate_commando_number <= 0) break diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 827e7893396..5fea7baa019 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -59,8 +59,7 @@ cooldown-- if(cooldown <= 0) return FALSE - spawn(10) - process_cooldown() + addtimer(CALLBACK(src, .proc/process_cooldown), 10) return TRUE /obj/item/assembly/Destroy() @@ -94,8 +93,7 @@ if(!secured || cooldown > 0) return FALSE cooldown = 2 - spawn(10) - process_cooldown() + addtimer(CALLBACK(src, .proc/process_cooldown), 10) return TRUE /obj/item/assembly/toggle_secure() diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index 19263e010ab..400b50614a6 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -127,13 +127,12 @@ /obj/item/assembly/infra/proc/trigger_beam() if(!secured || !on || cooldown > 0) return FALSE - pulse(0) + cooldown = 2 + pulse(FALSE) audible_message("[bicon(src)] *beep* *beep*", null, 3) if(first) qdel(first) - cooldown = 2 - spawn(10) - process_cooldown() + addtimer(CALLBACK(src, .proc/process_cooldown), 10) /obj/item/assembly/infra/interact(mob/user)//TODO: change this this to the wire control panel if(!secured) return diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index 7e777f235b1..caefabcb1f8 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -47,11 +47,10 @@ /obj/item/assembly/prox_sensor/proc/sense() if(!secured || !scanning || cooldown > 0) return FALSE - pulse(0) - visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*") cooldown = 2 - spawn(10) - process_cooldown() + pulse(FALSE) + visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*") + addtimer(CALLBACK(src, .proc/process_cooldown), 10) /obj/item/assembly/prox_sensor/process() if(timing && (time >= 0)) diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index f774d28921f..2759d12c21a 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -41,8 +41,7 @@ if(cooldown > 0) return FALSE cooldown = 2 - spawn(10) - process_cooldown() + addtimer(CALLBACK(src, .proc/process_cooldown), 10) signal() return TRUE diff --git a/code/modules/assembly/timer.dm b/code/modules/assembly/timer.dm index cab132ab747..5bbd9a26538 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -39,12 +39,11 @@ /obj/item/assembly/timer/proc/timer_end() if(!secured || cooldown > 0) return FALSE - pulse(0) + cooldown = 2 + pulse(FALSE) if(loc) loc.visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*") - cooldown = 2 - spawn(10) - process_cooldown() + addtimer(CALLBACK(src, .proc/process_cooldown), 10) /obj/item/assembly/timer/process() if(timing && (time > 0)) diff --git a/code/modules/atmos_automation/console.dm b/code/modules/atmos_automation/console.dm deleted file mode 100644 index 8d23bb390aa..00000000000 --- a/code/modules/atmos_automation/console.dm +++ /dev/null @@ -1,454 +0,0 @@ -/obj/machinery/computer/general_air_control/atmos_automation - icon = 'icons/obj/computer.dmi' - icon_screen = "area_atmos" - icon_keyboard = "atmos_key" - circuit = /obj/item/circuitboard/atmos_automation - req_one_access_txt = "24;10" - Mtoollink = 1 - - show_sensors = 0 - var/on = 0 - - name = "Atmospherics Automations Console" - - var/list/datum/automation/automations = list() - -/obj/machinery/computer/general_air_control/atmos_automation/receive_signal(datum/signal/signal) - if(!signal || signal.encryption) return - - var/id_tag = signal.data["tag"] - if(!id_tag) - return - - sensor_information[id_tag] = signal.data - -/obj/machinery/computer/general_air_control/atmos_automation/process() - if(on) - for(var/datum/automation/A in automations) - A.process() - -/obj/machinery/computer/general_air_control/atmos_automation/update_icon() - icon_state = initial(icon_state) - // Broken - if(stat & BROKEN) - icon_state += "b" - - // Powered - else if(stat & NOPOWER) - icon_state = initial(icon_state) - icon_state += "0" - else if(on) - icon_state += "_active" - -/obj/machinery/computer/general_air_control/atmos_automation/proc/request_device_refresh(device) - send_signal(list("tag"=device, "status")) - -/obj/machinery/computer/general_air_control/atmos_automation/proc/send_signal(list/data, filter = RADIO_ATMOSIA)//filter's here so the AAC can cross communicate to things like vents, which have a different filter - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src - signal.data=data - signal.data["sigtype"]="command" - signal.data["advcontrol"]=1//AAC balancing, you need to manually get up to the machine to make it listen to this - radio_connection.post_signal(src, signal, range = 8, filter = filter) - -/obj/machinery/computer/general_air_control/atmos_automation/proc/selectValidChildFor(datum/automation/parent, mob/user, list/valid_returntypes) - var/list/choices=list() - for(var/childtype in GLOB.automation_types) - var/datum/automation/A = new childtype(src) - if(A.returntype == null) - continue - if(!(A.returntype in valid_returntypes)) - continue - choices[A.name]=A - if(choices.len==0) - testing("Unable to find automations with returntype in [english_list(valid_returntypes)]!") - return 0 - var/label=input(user, "Select new automation:", "Automations", "Cancel") as null|anything in choices - if(!label) - return 0 - return choices[label] - -/obj/machinery/computer/general_air_control/atmos_automation/return_text() - var/out=..() - - if(on) - out += "RUNNING" - else - out += "STOPPED" - - out += {" -

Automations

-

\[ - - Add - - | - - Reset All - - | - - Clear - - \]

-

\[ - - Export - - | - - Import - - \]

"} - if(automations.len==0) - out += "No automations present." - else - for(var/datum/automation/A in automations) - out += {" -
- - [A.label] - (Reset | - ×) - - [A.GetText()] -
- "} - return out - -/obj/machinery/computer/general_air_control/atmos_automation/Topic(href,href_list) - if(..()) - return 1 - - if(href_list["on"]) - on = !on - updateUsrDialog() - update_icon() - return 1 - - if(href_list["add"]) - var/new_child=selectValidChildFor(null,usr,list(0)) - if(!new_child) - return 1 - automations += new_child - updateUsrDialog() - return 1 - - if(href_list["label"]) - var/datum/automation/A=locate(href_list["label"]) - if(!A) return 1 - var/nl=input(usr, "Please enter a label for this automation task.") as text|null - if(!nl) return 1 - nl = copytext(sanitize(nl), 1, 50) - A.label=nl - updateUsrDialog() - return 1 - - if(href_list["reset"]) - if(href_list["reset"]=="*") - for(var/datum/automation/A in automations) - if(!A) continue - A.OnReset() - else - var/datum/automation/A=locate(href_list["reset"]) - if(!A) return 1 - A.OnReset() - updateUsrDialog() - return 1 - - if(href_list["remove"]) - if(href_list["remove"]=="*") - var/confirm=alert("Are you sure you want to remove ALL automations?","Automations","Yes","No") - if(confirm == "No") return 0 - for(var/datum/automation/A in automations) - if(!A) continue - A.OnRemove() - automations.Remove(A) - else - var/datum/automation/A=locate(href_list["remove"]) - if(!A) return 1 - A.OnRemove() - automations.Remove(A) - updateUsrDialog() - return 1 - - if(href_list["read"]) - var/code = input("Input exported AAC code.","Automations","") as message|null - if(!code) return 0 - ReadCode(code) - updateUsrDialog() - return 1 - - if(href_list["dump"]) - input("Exported AAC code:","Automations",DumpCode()) as message|null - return 0 - -/obj/machinery/computer/general_air_control/atmos_automation/proc/MakeCompare(datum/automation/a, datum/automation/b, comparetype) - var/datum/automation/compare/compare=new(src) - compare.comparator = comparetype - compare.children[1] = a - compare.children[2] = b - return compare - -/obj/machinery/computer/general_air_control/atmos_automation/proc/MakeNumber(value) - var/datum/automation/static_value/val = new(src) - val.value=value - return val - -/obj/machinery/computer/general_air_control/atmos_automation/proc/MakeGetSensorData(sns_tag,field) - var/datum/automation/get_sensor_data/sensor=new(src) - sensor.sensor=sns_tag - sensor.field=field - return sensor - -/obj/machinery/computer/general_air_control/atmos_automation/proc/DumpCode() - var/list/json[0] - for(var/datum/automation/A in automations) - json += list(A.Export()) - return json_encode(json) - -/obj/machinery/computer/general_air_control/atmos_automation/proc/ReadCode(jsonStr) - automations.Cut() - var/list/json = json_decode(jsonStr) - if(json.len>0) - for(var/list/cData in json) - if(isnull(cData) || !("type" in cData)) - testing("AAC: Null cData in root JS array.") - continue - var/Atype=text2path(cData["type"]) - if(!(Atype in GLOB.automation_types)) - testing("AAC: Unrecognized Atype [Atype].") - continue - var/datum/automation/A = new Atype(src) - A.Import(cData) - automations += A - -/obj/machinery/computer/general_air_control/atmos_automation/burnchamber - var/injector_tag="inc_in" - var/output_tag="inc_out" - var/sensor_tag="inc_sensor" - frequency=AIRLOCK_FREQ - var/temperature=1000 - -/obj/machinery/computer/general_air_control/atmos_automation/burnchamber/New() - ..() - - // On State - // Pretty much this: - /* - if(get_sensor("inc_sensor","temperature") < 200) - set_injector_state("inc_in",1) - set_vent_pump_power("inc_out",0) - else - set_vent_pump_power("inc_out",1 - */ - - var/datum/automation/get_sensor_data/sensor=new(src) - sensor.sensor=sensor_tag - sensor.field="temperature" - - var/datum/automation/static_value/val = new(src) - val.value=temperature - 800 - - var/datum/automation/compare/compare=new(src) - compare.comparator = "Less Than" - compare.children[1] = sensor - compare.children[2] = val - - var/datum/automation/set_injector_power/inj_on=new(src) - inj_on.injector=injector_tag - inj_on.state=1 - - var/datum/automation/set_vent_pump_power/vp_on=new(src) - vp_on.vent_pump=output_tag - vp_on.state=1 - - var/datum/automation/set_vent_pump_power/vp_off=new(src) - vp_off.vent_pump=output_tag - vp_off.state=0 - - var/datum/automation/if_statement/i = new (src) - i.label = "Fuel Injector On" - i.condition = compare - i.children_then.Add(inj_on) - i.children_then.Add(vp_off) - i.children_else.Add(vp_on) - - automations += i - - // Off state - /* - if(get_sensor("inc_sensor","temperature") > 1000) - set_injector_state("inc_in",0) - */ - sensor=new(src) - sensor.sensor=sensor_tag - sensor.field="temperature" - - val = new(src) - val.value=temperature - - compare=new(src) - compare.comparator = "Greater Than" - compare.children[1] = sensor - compare.children[2] = val - - var/datum/automation/set_injector_power/inj_off=new(src) - inj_off.injector=injector_tag - inj_off.state=0 - - i = new (src) - i.label = "Fuel Injector Off" - i.condition = compare - i.children_then.Add(inj_off) - - automations += i - -/obj/machinery/computer/general_air_control/atmos_automation/air_mixing - var/n2_injector_tag="air_n2_in" - var/o2_injector_tag="air_o2_in" - var/output_tag="air_out" - var/sensor_tag="air_sensor" - frequency=ATMOS_DISTRO_FREQ - var/temperature=1000 - -/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/New() - ..() - buildO2() - buildN2() - buildOutletVent() - -/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/proc/buildO2() - /////////////////////////////////////////////////////////////// - // Oxygen Injection - /////////////////////////////////////////////////////////////// - - var/datum/automation/set_injector_power/inj_on=new(src) - inj_on.injector=o2_injector_tag - inj_on.state=1 - - var/datum/automation/set_injector_power/inj_off=new(src) - inj_off.injector=o2_injector_tag - inj_off.state=0 - - var/datum/automation/if_statement/i = new (src) - i.label = "Oxygen Injection" - i.condition = MakeCompare( - MakeGetSensorData(sensor_tag,"oxygen"), - MakeNumber(20), - "Less Than or Equal to" - ) - i.children_then.Add(inj_on) - i.children_else.Add(inj_off) - - automations += i - -/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/proc/buildN2() - /////////////////////////////////////////////////////////////// - // Nitrogen Injection - /////////////////////////////////////////////////////////////// - /* - if(get_sensor_data("pressure") < 100) - injector_on() - else - if(get_sensor_data("pressure") > 5000) - injector_off() - */ - - var/datum/automation/set_injector_power/inj_on=new(src) - inj_on.injector=n2_injector_tag - inj_on.state=1 - - var/datum/automation/set_injector_power/inj_off=new(src) - inj_off.injector=n2_injector_tag - inj_off.state=0 - - var/datum/automation/if_statement/if_on = new (src) - if_on.label = "Nitrogen Injection" - if_on.condition = MakeCompare( - MakeGetSensorData(sensor_tag,"pressure"), - MakeNumber(100), - "Less Than" - ) - if_on.children_then.Add(inj_on) - - - var/datum/automation/if_statement/if_off=new(src) - if_off.condition=MakeCompare( - MakeGetSensorData(sensor_tag,"pressure"), - MakeNumber(5000), - "Greater Than" - ) - if_off.children_then.Add(inj_off) - - if_on.children_else.Add(if_off) - - automations += if_on - -/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/proc/buildOutletVent() - /////////////////////////////////////////////////////////////// - // Outlet Management - /////////////////////////////////////////////////////////////// - /* - if(get_sensor_data("pressure") >= 5000 && get_sensor_data("oxygen") >= 20) - vent_on() - else - if(get_sensor_data("oxygen") < 20 || get_sensor_data("pressure") < 100) - vent_off() - */ - - var/datum/automation/set_vent_pump_power/vp_on=new(src) - vp_on.vent_pump=output_tag - vp_on.state=1 - - var/datum/automation/set_vent_pump_power/vp_off=new(src) - vp_off.vent_pump=output_tag - vp_off.state=0 - - var/datum/automation/if_statement/if_on=new(src) - if_on.label="Air Output" - - var/datum/automation/and/and_on=new(src) - and_on.children.Add( - MakeCompare( - MakeGetSensorData(sensor_tag,"pressure"), - MakeNumber(5000), - "Greater Than or Equal to" - ) - ) - and_on.children.Add( - MakeCompare( - MakeGetSensorData(sensor_tag,"oxygen"), - MakeNumber(20), - "Greater Than or Equal to" - ) - ) - if_on.condition=and_on - if_on.children_then.Add(vp_on) - - ////////////////////////////// - - var/datum/automation/if_statement/if_off=new(src) - - var/datum/automation/or/or_off=new(src) - or_off.children.Add( - MakeCompare( - MakeGetSensorData(sensor_tag,"pressure"), - MakeNumber(100), - "Less Than" - ) - ) - or_off.children.Add( - MakeCompare( - MakeGetSensorData(sensor_tag,"oxygen"), - MakeNumber(20), - "Less Than" - ) - ) - if_off.condition=or_off - if_off.children_then.Add(vp_off) - - if_on.children_else.Add(if_off) - - automations += if_on diff --git a/code/modules/atmos_automation/implementation/digital_valves.dm b/code/modules/atmos_automation/implementation/digital_valves.dm deleted file mode 100644 index dc0d0b2be00..00000000000 --- a/code/modules/atmos_automation/implementation/digital_valves.dm +++ /dev/null @@ -1,44 +0,0 @@ - - -/datum/automation/set_valve_state - name = "Digital Valve: Set Open/Closed" - var/valve=null - var/state=0 - - Export() - var/list/json = ..() - json["valve"]=valve - json["state"]=state - return json - - Import(var/list/json) - ..(json) - valve = json["valve"] - state = text2num(json["state"]) - - process() - if(valve) - parent.send_signal(list ("tag" = valve, "command"="valve_set","valve_set"=state)) - return 0 - - GetText() - return "Set digital valve [fmtString(valve)] to [state?"open":"closed"]." - - Topic(href,href_list) - if(..()) - return 1 - if(href_list["set_state"]) - state=!state - parent.updateUsrDialog() - return 1 - if(href_list["set_subject"]) - var/list/valves=list() - for(var/obj/machinery/atmospherics/binary/valve/digital/V in world) - if(!isnull(V.id_tag) && V.frequency == parent.frequency) - valves|=V.id_tag - if(valves.len==0) - to_chat(usr, "Unable to find any digital valves on this frequency.") - return - valve = input("Select a valve:", "Sensor Data", valve) as null|anything in valves - parent.updateUsrDialog() - return 1 diff --git a/code/modules/atmos_automation/implementation/emitters.dm b/code/modules/atmos_automation/implementation/emitters.dm deleted file mode 100644 index e6315fbceb2..00000000000 --- a/code/modules/atmos_automation/implementation/emitters.dm +++ /dev/null @@ -1,42 +0,0 @@ -/datum/automation/set_emitter_power - name = "Emitter: Set Power" - var/emitter=null - var/on=0 - - Export() - var/list/json = ..() - json["emitter"]=emitter - json["on"]=on - return json - - Import(var/list/json) - ..(json) - emitter = json["emitter"] - on = text2num(json["on"]) - - process() - if(emitter) - parent.send_signal(list("tag" = emitter, "command"="set", "state" = on, "hiddenprints" = parent.fingerprintshidden)) - return 0 - - GetText() - return "Set emitter [fmtString(emitter)] to [on?"on":"off"]." - - Topic(href,href_list) - if(..()) - return 1 - if(href_list["set_power"]) - on=!on - parent.updateUsrDialog() - return 1 - if(href_list["set_subject"]) - var/list/emitters=list() - for(var/obj/machinery/power/emitter/E in GLOB.machines) - if(!isnull(E.id_tag) && E.frequency == parent.frequency) - emitters|=E.id_tag - if(emitters.len==0) - to_chat(usr, "Unable to find any emitters on this frequency.") - return - emitter = input("Select an emitter:", "Emitter", emitter) as null|anything in emitters - parent.updateUsrDialog() - return 1 diff --git a/code/modules/atmos_automation/implementation/injectors.dm b/code/modules/atmos_automation/implementation/injectors.dm deleted file mode 100644 index d6747f31447..00000000000 --- a/code/modules/atmos_automation/implementation/injectors.dm +++ /dev/null @@ -1,83 +0,0 @@ - -//////////////////////////////////////////// -// Injector -//////////////////////////////////////////// -/datum/automation/set_injector_power - name = "Injector: Power" - var/injector=null - var/state=0 - - Export() - var/list/json = ..() - json["injector"]=injector - json["state"]=state - return json - - Import(var/list/json) - ..(json) - injector = json["injector"] - state = text2num(json["state"]) - - process() - if(injector) - parent.send_signal(list ("tag" = injector, "power"=state)) - return 0 - - GetText() - return "Set injector [fmtString(injector)] power to [state ? "on" : "off"]." - - Topic(href,href_list) - if(..()) - return 1 - if(href_list["toggle_state"]) - state = !state - parent.updateUsrDialog() - return 1 - if(href_list["set_injector"]) - var/list/injector_names=list() - for(var/obj/machinery/atmospherics/unary/outlet_injector/I in GLOB.machines) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - injector = input("Select an injector:", "Sensor Data", injector) as null|anything in injector_names - parent.updateUsrDialog() - return 1 - -/datum/automation/set_injector_rate - name = "Injector: Rate" - var/injector = null - var/rate = 0 - - Export() - var/list/json = ..() - json["injector"] = injector - json["rate"] = rate - return json - - Import(var/list/json) - ..(json) - injector = json["injector"] - rate = text2num(json["rate"]) - - process() - if(injector) - parent.send_signal(list ("tag" = injector, "set_volume_rate"=rate)) - return 0 - - GetText() - return "Set injector [fmtString(injector)] transfer rate to [rate] L/s." - - Topic(href,href_list) - if(..()) - return 1 - if(href_list["set_rate"]) - rate = input("Set rate in L/s.", "Rate", rate) as num - parent.updateUsrDialog() - return 1 - if(href_list["set_injector"]) - var/list/injector_names=list() - for(var/obj/machinery/atmospherics/unary/outlet_injector/I in GLOB.machines) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - injector = input("Select an injector:", "Sensor Data", injector) as null|anything in injector_names - parent.updateUsrDialog() - return 1 diff --git a/code/modules/atmos_automation/implementation/scrubbers.dm b/code/modules/atmos_automation/implementation/scrubbers.dm deleted file mode 100644 index 54829d01cea..00000000000 --- a/code/modules/atmos_automation/implementation/scrubbers.dm +++ /dev/null @@ -1,153 +0,0 @@ -/datum/automation/set_scrubber_mode - name="Scrubber: Mode" - - var/scrubber=null - var/mode=1 - - Export() - var/list/json = ..() - json["scrubber"]=scrubber - json["mode"]=mode - return json - - Import(var/list/json) - ..(json) - scrubber = json["scrubber"] - mode = text2num(json["mode"]) - - New(var/obj/machinery/computer/general_air_control/atmos_automation/aa) - ..(aa) - children=list(null) - - process() - if(scrubber) - parent.send_signal(list ("tag" = scrubber, "sigtype"="command", "scrubbing"=mode),filter = RADIO_FROM_AIRALARM) - return 0 - - GetText() - return "Set Scrubber [fmtString(scrubber)] mode to [mode?"Scrubbing":"Syphoning"]." - - Topic(href,href_list) - if(..()) return - if(href_list["set_mode"]) - mode=!mode - parent.updateUsrDialog() - return 1 - if(href_list["set_scrubber"]) - var/list/injector_names=list() - for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in GLOB.machines) - if(!isnull(S.id_tag) && S.frequency == parent.frequency) - injector_names|=S.id_tag - scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names - parent.updateUsrDialog() - return 1 - -/datum/automation/set_scrubber_power - name="Scrubber: Power" - - var/scrubber=null - var/state=0 - - Export() - var/list/json = ..() - json["scrubber"]=scrubber - json["state"]=state - return json - - Import(var/list/json) - ..(json) - scrubber = json["scrubber"] - state = text2num(json["state"]) - - New(var/obj/machinery/computer/general_air_control/atmos_automation/aa) - ..(aa) - - process() - if(scrubber) - parent.send_signal(list ("tag" = scrubber, "sigtype"="command", "power"=state),filter = RADIO_FROM_AIRALARM) - - GetText() - return "Set Scrubber [fmtString(scrubber)] power to [state ? "on" : "off"]." - - Topic(href,href_list) - if(..()) return - if(href_list["set_power"]) - state = !state - parent.updateUsrDialog() - return 1 - if(href_list["set_scrubber"]) - var/list/injector_names=list() - for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in GLOB.machines) - if(!isnull(S.id_tag) && S.frequency == parent.frequency) - injector_names|=S.id_tag - scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names - parent.updateUsrDialog() - return 1 - -GLOBAL_LIST_INIT(gas_labels, list( - "co2" = "CO2", - "tox" = "Plasma", - "n2o" = "N2O", - "o2" = "O2", - "n2" = "N2" -)) -/datum/automation/set_scrubber_gasses - name="Scrubber: Gasses" - - var/scrubber=null - var/list/gasses=list( - "co2" = 1, - "tox" = 0, - "n2o" = 0, - "o2" = 0, - "n2" = 0 - ) - - Export() - var/list/json = ..() - json["scrubber"]=scrubber - json["gasses"]=gasses - return json - - Import(var/list/json) - ..(json) - scrubber = json["scrubber"] - - var/list/newgasses=json["gasses"] - for(var/key in newgasses) - gasses[key]=newgasses[key] - - - New(var/obj/machinery/computer/general_air_control/atmos_automation/aa) - ..(aa) - - process() - if(scrubber) - var/list/data = list ("tag" = scrubber, "sigtype"="command") - for(var/gas in gasses) - data[gas+"_scrub"]=gasses[gas] - parent.send_signal(data,filter = RADIO_FROM_AIRALARM) - - GetText() - var/txt = "Set Scrubber [fmtString(scrubber)] to scrub " - for(var/gas in gasses) - txt += " [GLOB.gas_labels[gas]] ([gasses[gas] ? "on" : "off"])," - return txt - - Topic(href,href_list) - if(..()) return - if(href_list["tog_gas"]) - var/gas = href_list["tog_gas"] - if(!(gas in gasses)) - return - gasses[gas] = !gasses[gas] - parent.updateUsrDialog() - return 1 - if(href_list["set_scrubber"]) - var/list/injector_names=list() - for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in GLOB.machines) - if(!isnull(S.id_tag) && S.frequency == parent.frequency) - injector_names|=S.id_tag - scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names - parent.updateUsrDialog() - return 1 diff --git a/code/modules/atmos_automation/implementation/sensors.dm b/code/modules/atmos_automation/implementation/sensors.dm deleted file mode 100644 index e1ef348a617..00000000000 --- a/code/modules/atmos_automation/implementation/sensors.dm +++ /dev/null @@ -1,56 +0,0 @@ - -/////////////////////////////////////////// -// sensor data -/////////////////////////////////////////// - -/datum/automation/get_sensor_data - name = "Sensor: Get Data" - var/field="temperature" - var/sensor=null - - returntype=AUTOM_RT_NUM - - Export() - var/list/json = ..() - json["sensor"]=sensor - json["field"]=field - return json - - Import(var/list/json) - ..(json) - sensor = json["sensor"] - field = json["field"] - - Evaluate() - if(sensor && field && (sensor in parent.sensor_information)) - return parent.sensor_information[sensor][field] - return 0 - - GetText() - return "[fmtString(field)] from sensor [fmtString(sensor)]" - - Topic(href,href_list) - if(..()) - return 1 - if(href_list["set_field"]) - field = input("Select a sensor output:", "Sensor Data", field) as null|anything in list( - "temperature", - "pressure", - "oxygen", - "toxins", - "nitrogen", - "carbon_dioxide" - ) - parent.updateUsrDialog() - return 1 - if(href_list["set_sensor"]) - var/list/sensor_list = list() - for(var/obj/machinery/air_sensor/G in GLOB.machines) - if(!isnull(G.id_tag) && G.frequency == parent.frequency) - sensor_list|=G.id_tag - for(var/obj/machinery/meter/M in GLOB.machines) - if(!isnull(M.id_tag) && M.frequency == parent.frequency) - sensor_list|=M.id_tag - sensor = input("Select a sensor:", "Sensor Data", field) as null|anything in sensor_list - parent.updateUsrDialog() - return 1 diff --git a/code/modules/atmos_automation/implementation/vent_pump.dm b/code/modules/atmos_automation/implementation/vent_pump.dm deleted file mode 100644 index 71d728b316d..00000000000 --- a/code/modules/atmos_automation/implementation/vent_pump.dm +++ /dev/null @@ -1,314 +0,0 @@ -/datum/automation/set_vent_pump_mode - name="Vent Pump: Mode" - - var/vent_pump = null - var/mode = "stabilize" - var/vent_type = 0//0 for unary vents, 1 for DP vents - - var/list/modes = list("stabilize","purge") - - Export() - var/list/json = ..() - json["vent_pump"] = vent_pump - json["mode"] = mode - json["vent_type"] = vent_type - return json - - Import(var/list/json) - ..(json) - vent_pump = json["vent_pump"] - mode = json["mode"] - vent_type = text2num(json["vent_type"]) - - process() - if(vent_pump) - var/dirvalue = (mode == "stabilize" ? 1 : mode == "purge" ? 0 : 1) - parent.send_signal(list("tag" = vent_pump, "direction" = dirvalue), filter = (vent_type ? RADIO_ATMOSIA : RADIO_FROM_AIRALARM)) - return 0 - - GetText() - return "Set [vent_type ? "Dual-Port" : "Unary"] vent pump [fmtString(vent_pump)] mode to [mode]." - - Topic(href,href_list) - if(..()) - return 1 - - if(href_list["set_mode"]) - mode = input("Select a mode to put this pump into.",mode) in modes - parent.updateUsrDialog() - return 1 - - if(href_list["set_vent_pump"]) - var/list/injector_names = list() - if(!vent_type) - for(var/obj/machinery/atmospherics/unary/vent_pump/I in GLOB.machines) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names |= I.id_tag - else - for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world) -// to_chat(world, "test") - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names |= I.id_tag - - vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names - parent.updateUsrDialog() - return 1 - - if(href_list["toggle_type"]) - vent_type = !vent_type - parent.updateUsrDialog() - return 1 - -/datum/automation/set_vent_pump_power - name="Vent Pump: Power" - - var/vent_pump = null - var/state = 0 - var/mode = 0//0 for unary vents, 1 for DP vents. - - Export() - var/list/json = ..() - json["vent_pump"] = vent_pump - json["state"] = state - json["mode"] = mode - return json - - Import(var/list/json) - ..(json) - vent_pump = json["vent_pump"] - state = text2num(json["state"]) - mode = text2num(json["mode"]) - - process() - if(vent_pump) - parent.send_signal(list ("tag" = vent_pump, "power" = state), filter = (mode ? RADIO_ATMOSIA : RADIO_FROM_AIRALARM)) - - GetText() - return "Set [mode ? "Dual-Port" : "Unary"] vent pump [fmtString(vent_pump)] power to [state ? "on" : "off"]." - - Topic(href,href_list) - if(..()) - return 1 - - if(href_list["set_power"]) - state = !state - parent.updateUsrDialog() - return 1 - - if(href_list["set_vent_pump"]) - var/list/injector_names=list() - if(!mode) - for(var/obj/machinery/atmospherics/unary/vent_pump/I in GLOB.machines) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - else - for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names - parent.updateUsrDialog() - return 1 - - if(href_list["toggle_mode"]) - mode = !mode - parent.updateUsrDialog() - return 1 - -/datum/automation/set_vent_pump_pressure//controls the internal/external pressure bounds of a vent pump. - name = "Vent Pump: Pressure Settings" - - var/vent_pump = null - var/intpressureout = 0//these 2 are for DP vents, if it's a unary vent you're sending to it will take intpressureout as var - var/intpressurein = 0 - var/extpressure = 0 - var/mode = 0//0 for unary vents, 1 for DP vents. - - Export() - var/list/json = ..() - json["vent_pump"] = vent_pump - json["intpressureout"] = intpressureout - json["intpressurein"] = intpressurein - json["extpressure"] = extpressure - json["mode"] = mode - return json - - Import(var/list/json) - ..(json) - vent_pump = json["vent_pump"] - intpressureout = text2num(json["intpressureout"]) - intpressurein = text2num(json["intpressurein"]) - extpressure = text2num(json["extpressure"]) - mode = text2num(json["mode"]) - - New(var/obj/machinery/computer/general_air_control/atmos_automation/aa) - ..(aa) - - process() - if(vent_pump) - var/list/data = list( \ - "tag" = vent_pump, \ - ) - var/filter = RADIO_ATMOSIA - if(mode)//it's a DP vent - if(intpressurein) - data.Add(list("set_input_pressure" = intpressurein)) - if(intpressureout) - data.Add(list("set_output_pressure" = intpressureout)) - if(extpressure) - data.Add(list("set_external_pressure" = extpressure)) - - else - if(intpressureout) - data.Add(list("set_internal_pressure" = intpressureout)) - if(extpressure) - data.Add(list("set_external_pressure" = extpressure)) - filter = RADIO_FROM_AIRALARM - - parent.send_signal(data, filter) - - GetText() - if(mode)//DP vent - return {"Set dual-port vent pump [fmtString(vent_pump)] - pressure bounds: internal outwards: [fmtString(intpressureout)] - internal inwards: [fmtString(intpressurein)] - external: [fmtString(extpressure)] - "}//well that was a lot to type - else - return {"Set unary vent pump [fmtString(vent_pump)] - pressure bounds: internal: [fmtString(intpressureout)] - external: [fmtString(extpressure)] - "}//copy paste FTW - - Topic(href, href_list) - if(..()) - return 1 - - if(href_list["set_vent_pump"]) - var/list/injector_names=list() - if(mode)//DP vent selection - for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - else - for(var/obj/machinery/atmospherics/unary/vent_pump/I in GLOB.machines) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names - parent.updateUsrDialog() - return 1 - - if(href_list["set_intpressure_out"]) - var/response = input("Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num - intpressureout = text2num(response) - intpressureout = between(0, intpressureout, 50*ONE_ATMOSPHERE) - parent.updateUsrDialog() - return 1 - - if(href_list["set_intpressure_in"]) - var/response = input("Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num - intpressurein = text2num(response) - intpressurein = between(0, intpressurein, 50*ONE_ATMOSPHERE) - parent.updateUsrDialog() - return 1 - - if(href_list["set_external"]) - var/response = input(usr,"Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num - extpressure = text2num(response) - extpressure = between(0, extpressure, 50*ONE_ATMOSPHERE) - parent.updateUsrDialog() - return 1 - - if(href_list["swap_modes"]) - mode = !mode - vent_pump = null//if we don't clear this is could get glitchy, by which I mean not at all, whatever, stay clean - parent.updateUsrDialog() - return 1 - -/datum/automation/set_vent_pressure_checks - name = "Vent Pump: Pressure Checks" - - var/vent_pump = null - var/checks = 1 - var/mode = 0//1 for DP vent, 0 for unary vent -/* -checks bitflags -1 = external -2 = internal in (regular internal for unaries) -4 = internal out (ignored by unaries) -*/ - - - Export() - var/list/json = ..() - json["vent_pump"] = vent_pump - json["checks"] = checks - json["mode"] = mode - return json - - Import(var/list/json) - ..(json) - vent_pump = json["vent_pump"] - checks = text2num(json["checks"]) - mode = text2num(json["mode"]) - - New(var/obj/machinery/computer/general_air_control/atmos_automation/aa) - ..(aa) - - process() - if(vent_pump) - parent.send_signal(list("tag" = vent_pump, "checks" = checks), filter = (mode ? RADIO_ATMOSIA : RADIO_FROM_AIRALARM))//not gonna bother with a sanity check here, there *should* not be any problems - - GetText() - if(mode) - return {"Set dual-port vent pump [fmtString(vent_pump)] pressure checks to: - external [checks&1 ? "Enabled" : "Disabled"] - internal inwards [checks&2 ? "Enabled" : "Disabled"] - internal outwards [checks&4 ? "Enabled" : "Disabled"] - "} - else - return {"Set unary vent pump [fmtString(vent_pump)] pressure checks to: - external: [checks&1 ? "Enabled" : "Disabled"], - internal: [checks&2 ? "Enabled" : "Disabled"] - "} - - Topic(href, href_list) - if(..()) - return 1 - - if(href_list["set_vent_pump"]) - var/list/injector_names=list() - if(mode)//DP vent selection - for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - else - for(var/obj/machinery/atmospherics/unary/vent_pump/I in GLOB.machines) - if(!isnull(I.id_tag) && I.frequency == parent.frequency) - injector_names|=I.id_tag - vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names - parent.updateUsrDialog() - return 1 - - if(href_list["swap_modes"]) - mode = !mode - vent_pump = null//if we don't clear this is could get glitchy, by which I mean not at all, whatever, stay clean - if(!mode && checks&4)//disable this bitflag since we're switching to unaries - checks &= ~4 - parent.updateUsrDialog() - return 1 - - if(href_list["togglecheck"]) - var/bitflagvalue = text2num(href_list["togglecheck"]) - if(mode) - if(!(bitflagvalue in list(1, 2, 4))) - return 0 - else if(!(bitflagvalue in list(1, 2))) - return 0 - - if(checks&bitflagvalue)//the bitflag is on ATM - checks &= ~bitflagvalue - else//can't not be off - checks |= bitflagvalue - parent.updateUsrDialog() - return 1 - diff --git a/code/modules/atmos_automation/statements.dm b/code/modules/atmos_automation/statements.dm deleted file mode 100644 index 3f5ed0fb6a7..00000000000 --- a/code/modules/atmos_automation/statements.dm +++ /dev/null @@ -1,457 +0,0 @@ -GLOBAL_LIST_INIT(automation_types, subtypesof(/datum/automation)) - -#define AUTOM_RT_NULL 0 -#define AUTOM_RT_NUM 1 -#define AUTOM_RT_STRING 2 -/datum/automation - // Name of the Automation - var/name="Base Automation" - - // For labelling what shit does on the AAC. - var/label="Unnamed Script" - var/desc ="No Description." - - var/obj/machinery/computer/general_air_control/atmos_automation/parent - var/list/valid_child_returntypes=list() - var/list/datum/automation/children=list() - - var/returntype=AUTOM_RT_NULL - -/datum/automation/New(var/obj/machinery/computer/general_air_control/atmos_automation/aa) - parent=aa - -/datum/automation/proc/GetText() - return "[type] doesn't override GetText()!" - -/datum/automation/proc/OnReset() - return - -/datum/automation/proc/OnRemove() - return - -/datum/automation/process() - return - -/datum/automation/proc/Evaluate() - return 0 - -/datum/automation/proc/Export() - var/list/R = list("type"=type) - - if(initial(label)!=label) - R["label"]=label - - if(initial(desc)!=desc) - R["desc"]=desc - - if(children.len>0) - var/list/C=list() - for(var/datum/automation/A in children) - C += list(A.Export()) - R["children"]=C - - return R - -/datum/automation/proc/unpackChild(var/list/cData) - if(isnull(cData) || !("type" in cData)) - return null - var/Atype=text2path(cData["type"]) - if(!(Atype in GLOB.automation_types)) - return null - var/datum/automation/A = new Atype(parent) - A.Import(cData) - return A - -/datum/automation/proc/unpackChildren(var/list/childList) - . = list() - if(childList.len>0) - for(var/list/cData in childList) - if(isnull(cData) || !("type" in cData)) - . += null - continue - var/Atype=text2path(cData["type"]) - if(!(Atype in GLOB.automation_types)) - continue - var/datum/automation/A = new Atype(parent) - A.Import(cData) - . += A - -/datum/automation/proc/packChildren(var/list/childList) - . = list() - if(childList.len>0) - for(var/datum/automation/A in childList) - if(isnull(A) || !istype(A)) - . += null - continue - . += list(A.Export()) - -/datum/automation/proc/Import(var/list/json) - if("label" in json) - label = json["label"] - - if("desc" in json) - desc = json["desc"] - - if("children" in json) - children = unpackChildren(json["children"]) - -/datum/automation/proc/fmtString(var/str) - if(str==null || str == "") - return "-----" - return str - -/datum/automation/Topic(href,href_list) - if(parent.Topic("src=[parent.UID()]", list("src" = parent)))//dumb hack to check sanity, empty topic shouldn't trigger a 1 on anything but sanity checks - return 1 - - if(href_list["add"]) - var/new_child=selectValidChildFor(usr) - if(!new_child) return 1 - children += new_child - parent.updateUsrDialog() - return 1 - - if(href_list["remove"]) - if(href_list["remove"]=="*") - var/confirm=alert("Are you sure you want to remove ALL automations?","Automations","Yes","No") - if(confirm == "No") return 0 - for(var/datum/automation/A in children) - A.OnRemove() - children.Remove(A) - else - var/datum/automation/A=locate(href_list["remove"]) - if(!A) return 1 - var/confirm=alert("Are you sure you want to remove this automation?","Automations","Yes","No") - if(confirm == "No") return 0 - A.OnRemove() - children.Remove(A) - parent.updateUsrDialog() - return 1 - - if(href_list["reset"]) - if(href_list["reset"]=="*") - for(var/datum/automation/A in children) - A.OnReset() - else - var/datum/automation/A=locate(href_list["reset"]) - if(!A) return 1 - A.OnReset() - parent.updateUsrDialog() - return 1 - return 0 // 1 if handled - -/datum/automation/proc/selectValidChildFor(var/mob/user, var/list/returntypes=valid_child_returntypes) - return parent.selectValidChildFor(src, user, returntypes) - -/////////////////////////////////////////// -// AND -/////////////////////////////////////////// -/datum/automation/and - name = "AND statement" - returntype=AUTOM_RT_NUM - valid_child_returntypes=list(AUTOM_RT_NUM) - - Evaluate() - if(children.len==0) return 0 - for(var/datum/automation/stmt in children) - if(!stmt.Evaluate()) - return 0 - return 1 - - GetText() - var/out="AND (Add)" - if(children.len>0) - out += "
    " - for(var/datum/automation/stmt in children) - out += {"
  • - \[Reset | - ×\] - [stmt.GetText()] -
  • "} - out += "
" - else - out += "
No statements to evaluate.
" - return out - -/////////////////////////////////////////// -// OR -/////////////////////////////////////////// - -/datum/automation/or - name = "OR statement" - returntype=AUTOM_RT_NUM - valid_child_returntypes=list(AUTOM_RT_NUM) - - Evaluate() - if(children.len==0) return 0 - for(var/datum/automation/stmt in children) - if(stmt.Evaluate()) - return 1 - return 0 - - GetText() - var/out="OR (Add)" - if(children.len>0) - out += "
    " - for(var/datum/automation/stmt in children) - out += {"
  • - \[Reset | - ×\] - [stmt.GetText()] -
  • "} - out += "
" - else - out += "
No statements to evaluate.
" - return out - -/////////////////////////////////////////// -// if .. then -/////////////////////////////////////////// - -/datum/automation/if_statement - name = "IF statement" - var/datum/automation/condition=null - valid_child_returntypes=list(AUTOM_RT_NULL) - var/list/valid_conditions=list(AUTOM_RT_NUM) - - var/list/children_then=list() - var/list/children_else=list() - - Export() - var/list/R = ..() - - if(children_then.len>0) - R["then"]=packChildren(children_then) - - if(children_else.len>0) - R["else"]=packChildren(children_else) - - if(condition) - R["condition"]=condition.Export() - - return R - - Import(var/list/json) - ..(json) - - if("then" in json) - children_then = unpackChildren(json["then"]) - - if("else" in json) - children_else = unpackChildren(json["else"]) - - if("condition" in json) - condition = unpackChild(json["condition"]) - - GetText() - var/out="IF (SET):
" - if(condition) - out += condition.GetText() - else - out += "Not set" - out += "
" - out += "THEN: (Add)" - if(children_then.len>0) - out += "
    " - for(var/datum/automation/stmt in children_then) - out += {"
  • - \[Reset | - ×\] - [stmt.GetText()] -
  • "} - out += "
" - else - out += "
(No statements to run)
" - out += "ELSE: (Add)" - if(children_then.len>0) - out += "
    " - for(var/datum/automation/stmt in children_else) - out += {"
  • - \[Reset | - ×\] - [stmt.GetText()] -
  • "} - out += "
" - else - out += "
(No statements to run)
" - return out - - Topic(href,href_list) - if(href_list["add"]) - var/new_child=selectValidChildFor(usr) - if(!new_child) return 1 - switch(href_list["add"]) - if("then") - children_then += new_child - if("else") - children_else += new_child - else - warning("Unknown add value given to [type]/Topic():[__LINE__]: [href]") - return 1 - parent.updateUsrDialog() - return 1 - if(href_list["remove"]) - if(href_list["remove"]=="*") - var/confirm=input("Are you sure you want to remove ALL automations?","Automations","No") in list("Yes","No") - if(confirm == "No") return 0 - for(var/datum/automation/A in children_then) - A.OnRemove() - children_then.Remove(A) - for(var/datum/automation/A in children_else) - A.OnRemove() - children_else.Remove(A) - else - var/datum/automation/A=locate(href_list["remove"]) - if(!A) return 1 - var/confirm=input("Are you sure you want to remove this automation?","Automations","No") in list("Yes","No") - if(confirm == "No") return 0 - A.OnRemove() - switch(href_list["context"]) - if("then") - children_then.Remove(A) - if("else") - children_else.Remove(A) - parent.updateUsrDialog() - return 1 - if(href_list["reset"]) - if(href_list["reset"]=="*") - for(var/datum/automation/A in children_then) - A.OnReset() - for(var/datum/automation/A in children_else) - A.OnReset() - else - var/datum/automation/A=locate(href_list["reset"]) - if(!A) return 1 - A.OnReset() - parent.updateUsrDialog() - return 1 - if(href_list["set_condition"]) - var/new_condition = selectValidChildFor(usr,valid_conditions) - testing("Selected condition: [new_condition]") - if(!new_condition) - return 1 - condition = new_condition - parent.updateUsrDialog() - return 1 - - process() - if(condition) - if(condition.Evaluate()) - for(var/datum/automation/stmt in children_then) - stmt.process() - else - for(var/datum/automation/stmt in children_else) - stmt.process() - -/////////////////////////////////////////// -// compare -/////////////////////////////////////////// - -/datum/automation/compare - name = "comparison" - var/comparator="Greater Than" - returntype=AUTOM_RT_NUM - valid_child_returntypes=list(AUTOM_RT_NUM) - - New(var/obj/machinery/computer/general_air_control/atmos_automation/aa) - ..(aa) - children=list(null,null) - - Export() - var/list/json = ..() - json["cmp"]=comparator - return json - - Import(var/list/json) - ..(json) - comparator = json["cmp"] - - Evaluate() - if(children.len<2) - return 0 - var/datum/automation/d_left =children[1] - var/datum/automation/d_right=children[2] - if(!d_left || !d_right) - return 0 - var/left=d_left.Evaluate() - var/right=d_right.Evaluate() - switch(comparator) - if("Greater Than") - return left>right - if("Greater Than or Equal to") - return left>=right - if("Less Than") - return left(Set Left) (" - if(left==null) - out += "-----" - else - out += left.GetText() - - out += ") is [comparator]: (Set Right) (" - - if(right==null) - out += "-----" - else - out += right.GetText() - out +=")" - return out - - Topic(href,href_list) - if(href_list["set_comparator"]) - comparator = input("Select a comparison operator:", "Compare", "Greater Than") in list("Greater Than","Greater Than or Equal to","Less Than","Less Than or Equal to","Equal to","NOT Equal To") - parent.updateUsrDialog() - return 1 - if(href_list["set_field"]) - var/idx = text2num(href_list["set_field"]) - var/new_child = selectValidChildFor(usr) - if(!new_child) - return 1 - children[idx] = new_child - parent.updateUsrDialog() - return 1 - -/////////////////////////////////////////// -// static value -/////////////////////////////////////////// - -/datum/automation/static_value - name = "Number" - - var/value=0 - - returntype=AUTOM_RT_NUM - - Evaluate() - return value - - Export() - var/list/json = ..() - json["value"]=value - return json - - Import(var/list/json) - ..(json) - value = text2num(json["value"]) - - GetText() - return "[value]" - - Topic(href,href_list) - if(href_list["set_value"]) - value = input("Set a value:", "Static Value", value) as num - parent.updateUsrDialog() - return 1 diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index d7e298e8c96..0118b0febb4 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -48,7 +48,7 @@ GLOBAL_DATUM_INIT(the_gateway, /obj/machinery/gateway/centerstation, null) ..() update_icon() wait = world.time + config.gateway_delay //+ thirty minutes default - awaygate = locate(/obj/machinery/gateway/centeraway) in world + awaygate = locate(/obj/machinery/gateway/centeraway) in GLOB.machines /obj/machinery/gateway/centerstation/update_density_from_dir() return @@ -103,7 +103,7 @@ GLOBAL_DATUM_INIT(the_gateway, /obj/machinery/gateway/centerstation, null) if(!powered()) return if(!awaygate) - awaygate = locate(/obj/machinery/gateway/centeraway) in world + awaygate = locate(/obj/machinery/gateway/centeraway) in GLOB.machines if(!awaygate) to_chat(user, "Error: No destination found.") return @@ -180,7 +180,7 @@ GLOBAL_DATUM_INIT(the_gateway, /obj/machinery/gateway/centerstation, null) /obj/machinery/gateway/centeraway/Initialize() ..() update_icon() - stationgate = locate(/obj/machinery/gateway/centerstation) in world + stationgate = locate(/obj/machinery/gateway/centerstation) in GLOB.machines /obj/machinery/gateway/centeraway/update_density_from_dir() @@ -219,7 +219,7 @@ GLOBAL_DATUM_INIT(the_gateway, /obj/machinery/gateway/centerstation, null) if(linked.len != 8) return if(!stationgate) - stationgate = locate(/obj/machinery/gateway/centerstation) in world + stationgate = locate(/obj/machinery/gateway/centerstation) in GLOB.machines if(!stationgate) to_chat(user, "Error: No destination found.") return diff --git a/code/modules/awaymissions/mission_code/UO71-terrorspiders.dm b/code/modules/awaymissions/mission_code/UO71-terrorspiders.dm index b41ec901573..f06a9a37f9c 100644 --- a/code/modules/awaymissions/mission_code/UO71-terrorspiders.dm +++ b/code/modules/awaymissions/mission_code/UO71-terrorspiders.dm @@ -191,26 +191,27 @@ origin_tech = null selfcharge = 1 can_charge = 0 - var/inawaymission = 1 + // Selfcharge is enabled and disabled, and used as the away mission tracker + selfcharge = TRUE -/obj/item/gun/energy/laser/awaymission_aeg/process() - var/turf/my_loc = get_turf(src) - if(is_away_level(my_loc.z)) - if(inawaymission) - return ..() +/obj/item/gun/energy/laser/awaymission_aeg/Initialize(mapload) + . = ..() + // Force update it incase it spawns outside an away mission and shouldnt be charged + onTransitZ(new_z = loc.z) + +/obj/item/gun/energy/laser/awaymission_aeg/onTransitZ(old_z, new_z) + if(is_away_level(new_z)) if(ismob(loc)) to_chat(loc, "Your [src] activates, starting to draw power from a nearby wireless power source.") - inawaymission = 1 + selfcharge = TRUE else - if(inawaymission) + if(selfcharge) if(ismob(loc)) to_chat(loc, "Your [src] deactivates, as it is out of range from its power source.") cell.charge = 0 - inawaymission = 0 + selfcharge = FALSE update_icon() - - /obj/item/reagent_containers/glass/beaker/terror_black_toxin name = "beaker 'Black Terror Venom'" diff --git a/code/modules/awaymissions/mission_code/ruins/oldstation.dm b/code/modules/awaymissions/mission_code/ruins/oldstation.dm index e939cf06f32..4d3c54f8f4b 100644 --- a/code/modules/awaymissions/mission_code/ruins/oldstation.dm +++ b/code/modules/awaymissions/mission_code/ruins/oldstation.dm @@ -105,7 +105,7 @@ /obj/item/paper/fluff/ruins/oldstation/damagereport name = "Damage Report" - info = "*Damage Report*

Alpha Station - Destroyed

Beta Station - Catastrophic Damage. Medical, destroyed. Atmospherics, partially destroyed. Engine Core, destroyed.

Charlie Station - Intact. Loss of oxygen to eastern side of main corridor.

Delta Station - Intact. WARNING: Unknown force occupying Delta Station. Intent unknown. Species unknown. Numbers unknown.

Recommendation - Reestablish station powernet via solar array. Reestablish station atmospherics system to restore air." + info = "*Damage Report*

Alpha Station - Destroyed

Beta Station - Catastrophic Damage. Medical, destroyed. Atmospherics, partially destroyed. Engine Core, destroyed.

Charlie Station - Intact. Loss of oxygen to eastern side of main corridor.

Theta Station - Intact. WARNING: Unknown force occupying Theta Station. Intent unknown. Species unknown. Numbers unknown.

Recommendation - Reestablish station powernet via solar array. Reestablish station atmospherics system to restore air." /obj/item/paper/fluff/ruins/oldstation/protosuit name = "B01-RIG Hardsuit Report" @@ -145,7 +145,7 @@ info = "Artificial Program's report to surviving crewmembers.

Crew were placed into cryostasis on March 10th, 2445.

Crew were awoken from cryostasis around June, 2557.

\ SIGNIFICANT EVENTS OF NOTE
1: The primary radiation detectors were taken offline after 112 years due to power failure, secondary radiation detectors showed no residual \ radiation on station. Deduction, primarily detector was malfunctioning and was producing a radiation signal when there was none.

2: A data burst from a nearby Nanotrasen Space \ - Station was received, this data burst contained research data that has been uploaded to our RnD labs.

3: Unknown invasion force has occupied Delta station." + Station was received, this data burst contained research data that has been uploaded to our RnD labs.

3: Unknown invasion force has occupied Theta station." /obj/item/paper/fluff/ruins/oldstation/generator_manual name = "S.U.P.E.R.P.A.C.M.A.N.-type portable generator manual" @@ -350,16 +350,16 @@ name = "Charlie Station Security" icon_state = "red" -/area/ruin/space/ancientstation/deltacorridor - name = "Delta Station Main Corridor" +/area/ruin/space/ancientstation/thetacorridor + name = "Theta Station Main Corridor" icon_state = "green" /area/ruin/space/ancientstation/proto - name = "Delta Station Prototype Lab" + name = "Theta Station Prototype Lab" icon_state = "toxlab" /area/ruin/space/ancientstation/rnd - name = "Delta Station Research and Development" + name = "Theta Station Research and Development" icon_state = "toxlab" /area/ruin/space/ancientstation/hivebot diff --git a/code/modules/awaymissions/mission_code/wildwest.dm b/code/modules/awaymissions/mission_code/wildwest.dm index ca79a1ea2a6..b678106df5c 100644 --- a/code/modules/awaymissions/mission_code/wildwest.dm +++ b/code/modules/awaymissions/mission_code/wildwest.dm @@ -117,10 +117,8 @@ if("Peace") to_chat(user, "Whatever alien sentience that the Wish Granter possesses is satisfied with your wish. There is a distant wailing as the last of the Faithless begin to die, then silence.") to_chat(user, "You feel as if you just narrowly avoided a terrible fate...") - for(var/mob/living/simple_animal/hostile/faithless/F in world) - F.health = -10 - F.stat = 2 - F.icon_state = "faithless_dead" + for(var/mob/living/simple_animal/hostile/faithless/F in GLOB.mob_living_list) + F.death() ///////////////Meatgrinder////////////// @@ -173,23 +171,9 @@ to_chat(C, "Death is not your end!") spawn(rand(800,1200)) - if(C.stat == DEAD) - GLOB.dead_mob_list -= C - GLOB.living_mob_list += C - C.stat = CONSCIOUS - C.timeofdeath = 0 - C.setToxLoss(0) - C.setOxyLoss(0) - C.setCloneLoss(0) - C.SetParalysis(0) - C.SetStunned(0) - C.SetWeakened(0) - C.radiation = 0 - C.heal_overall_damage(C.getBruteLoss(), C.getFireLoss()) - C.reagents.clear_reagents() + C.revive() to_chat(C, "You have regenerated.") C.visible_message("[usr] appears to wake from the dead, having healed all wounds.") - C.update_canmove() return 1 /obj/item/wildwest_communicator @@ -234,7 +218,8 @@ to_chat(user, "The communicator buzzes, and you hear the voice again: 'Really? I think not. Get them!'") if(option_threat) to_chat(user, "The communicator buzzes, and you hear the voice again: 'Oh really now?' You hear a clicking sound. 'Team, get back here. We have trouble'. Then the line goes dead.") - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name == "wildwest_syndipod") var/obj/spacepod/syndi/P = new /obj/spacepod/syndi(get_turf(L)) P.name = "Syndi Recon Pod" @@ -247,7 +232,7 @@ used = TRUE /obj/item/wildwest_communicator/proc/stand_down() - for(var/mob/living/simple_animal/hostile/syndicate/ranged/wildwest/W in GLOB.living_mob_list) + for(var/mob/living/simple_animal/hostile/syndicate/ranged/wildwest/W in GLOB.alive_mob_list) W.on_alert = FALSE /mob/living/simple_animal/hostile/syndicate/ranged/wildwest @@ -262,6 +247,6 @@ // putting this up here so we don't say anything after deathgasp if(can_die() && !on_alert) say("How could you betray the Syndicate?") - for(var/mob/living/simple_animal/hostile/syndicate/ranged/wildwest/W in GLOB.living_mob_list) + for(var/mob/living/simple_animal/hostile/syndicate/ranged/wildwest/W in GLOB.alive_mob_list) W.on_alert = TRUE return ..(gibbed) diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm index 3b31a8bbcfc..c582508ace1 100644 --- a/code/modules/awaymissions/zlevel.dm +++ b/code/modules/awaymissions/zlevel.dm @@ -56,7 +56,8 @@ GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "config/away GLOB.space_manager.remove_dirt(zlev) log_world(" Away mission loaded: [map]") - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name != "awaystart") continue GLOB.awaydestinations.Add(L) @@ -89,7 +90,8 @@ GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "config/away //map_transition_config.Add(AWAY_MISSION_LIST) - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(L.name != "awaystart") continue GLOB.awaydestinations.Add(L) diff --git a/code/modules/buildmode/bm_mode.dm b/code/modules/buildmode/bm_mode.dm index 0169df7cd62..bf3b52a20ce 100644 --- a/code/modules/buildmode/bm_mode.dm +++ b/code/modules/buildmode/bm_mode.dm @@ -28,8 +28,8 @@ return "buildmode_[key]" /datum/buildmode_mode/proc/show_help(mob/user) - CRASH("No help defined, yell at a coder") to_chat(user, "There is no help defined for this mode, this is a bug.") + CRASH("No help defined, yell at a coder") /datum/buildmode_mode/proc/change_settings(mob/user) to_chat(user, "There is no configuration available for this mode") diff --git a/code/modules/buildmode/effects/line.dm b/code/modules/buildmode/effects/line.dm index b49d35af095..5cc88309e56 100644 --- a/code/modules/buildmode/effects/line.dm +++ b/code/modules/buildmode/effects/line.dm @@ -12,7 +12,7 @@ var/matrix/mat = matrix() mat.Translate(0, 16) mat.Scale(1, sqrt((x_offset * x_offset) + (y_offset * y_offset)) / 32) - mat.Turn(90 - Atan2(x_offset, y_offset)) // So... You pass coords in order x,y to this version of atan2. It should be called acsc2. + mat.Turn(90 - ATAN2(x_offset, y_offset)) // So... You pass coords in order x,y to this version of atan2. It should be called acsc2. mat.Translate(atom_a.pixel_x, atom_a.pixel_y) transform = mat diff --git a/code/modules/buildmode/submodes/atmos.dm b/code/modules/buildmode/submodes/atmos.dm index b3a07374846..ac840acbead 100644 --- a/code/modules/buildmode/submodes/atmos.dm +++ b/code/modules/buildmode/submodes/atmos.dm @@ -9,6 +9,7 @@ var/plasma = 0 var/cdiox = 0 var/nitrox = 0 + var/agentbx = 0 /datum/buildmode_mode/atmos/show_help(mob/user) @@ -29,6 +30,7 @@ plasma = input(user, "Plasma ratio", "Input", 0) as num|null cdiox = input(user, "CO2 ratio", "Input", 0) as num|null nitrox = input(user, "N2O ratio", "Input", 0) as num|null + agentbx = input(user, "Agent B ratio", "Input", 0) as num|null /datum/buildmode_mode/atmos/proc/ppratio_to_moles(ppratio) // ideal gas equation: Pressure * Volume = Moles * r * Temperature @@ -52,11 +54,8 @@ S.air.nitrogen = ppratio_to_moles(nitrogen) S.air.toxins = ppratio_to_moles(plasma) S.air.carbon_dioxide = ppratio_to_moles(cdiox) - S.air.trace_gases.Cut() - if(nitrox) - var/datum/gas/TG = new /datum/gas/sleeping_agent - TG.moles = ppratio_to_moles(nitrox) - S.air.trace_gases += TG + S.air.sleeping_agent = ppratio_to_moles(nitrox) + S.air.agent_b = ppratio_to_moles(agentbx) S.update_visuals() S.air_update_turf() else if(ctrl_click) // overwrite "default" unsimulated air @@ -65,7 +64,8 @@ T.nitrogen = ppratio_to_moles(nitrogen) T.toxins = ppratio_to_moles(plasma) T.carbon_dioxide = ppratio_to_moles(cdiox) - // no interface for trace gases on unsim turfs + T.sleeping_agent = ppratio_to_moles(nitrox) + T.agent_b = ppratio_to_moles(agentbx) T.air_update_turf() // admin log diff --git a/code/modules/buildmode/submodes/copy.dm b/code/modules/buildmode/submodes/copy.dm index 48cbb2c3cf0..95d8eee8b87 100644 --- a/code/modules/buildmode/submodes/copy.dm +++ b/code/modules/buildmode/submodes/copy.dm @@ -22,6 +22,6 @@ if(stored) DuplicateObject(stored, perfectcopy=1, sameloc=0,newloc=T) else if(right_click) - if(ismovableatom(object)) // No copying turfs for now. + if(ismovable(object)) // No copying turfs for now. to_chat(user, "[object] set as template.") stored = object diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index a063fafd736..3cd6458afdf 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -20,7 +20,6 @@ var/skip_antag = FALSE //TRUE when a player declines to be included for the selection process of game mode antagonists. var/move_delay = 1 var/moving = null - var/adminobs = null var/area = null var/time_died_as_mouse = null //when the client last died as a mouse diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 800022877f7..0b74b7132fd 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -54,7 +54,6 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts return C.player_age else return max(0, days - C.player_age) - return 0 #define MAX_SAVE_SLOTS 30 // Save slots for regular players #define MAX_SAVE_SLOTS_MEMBER 30 // Save slots for BYOND members @@ -624,6 +623,9 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts if(job.admin_only) continue + if(job.hidden_from_job_prefs) + continue + index += 1 if((index >= limit) || (job.title in splitJobs)) if((index < limit) && (lastJob != null)) @@ -2001,6 +2003,11 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts windowflashing = !windowflashing if("afk_watch") + if(!afk_watch) + to_chat(user, "You will now get put into cryo dorms after [config.auto_cryo_afk] minutes. \ + Then after [config.auto_despawn_afk] minutes you will be fully despawned. You will receive a visual and auditory warning before you will be put into cryodorms.") + else + to_chat(user, "Automatic cryoing turned off.") afk_watch = !afk_watch if("UIcolor") diff --git a/code/modules/client/preference/preferences_mysql.dm b/code/modules/client/preference/preferences_mysql.dm index 811d163c955..4219935c766 100644 --- a/code/modules/client/preference/preferences_mysql.dm +++ b/code/modules/client/preference/preferences_mysql.dm @@ -96,7 +96,7 @@ UI_style_alpha='[UI_style_alpha]', be_role='[sanitizeSQL(list2params(be_special))]', default_slot='[default_slot]', - toggles='[num2text(toggles, Ceiling(log(10, (TOGGLES_TOTAL))))]', + toggles='[num2text(toggles, CEILING(log(10, (TOGGLES_TOTAL)), 1))]', atklog='[atklog]', sound='[sound]', randomslot='[randomslot]', @@ -320,6 +320,10 @@ if(!rlimb_data) src.rlimb_data = list() if(!loadout_gear) loadout_gear = list() + // Check if the current body accessory exists + if(!GLOB.body_accessory_by_name[body_accessory]) + body_accessory = null + return 1 /datum/preferences/proc/save_character(client/C) diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index da0873f162f..38b49314667 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -9,6 +9,10 @@ ..() initialize_outfits() +/datum/action/chameleon_outfit/Destroy() + STOP_PROCESSING(SSprocessing, src) + return ..() + /datum/action/chameleon_outfit/proc/initialize_outfits() var/static/list/standard_outfit_options if(!standard_outfit_options) @@ -140,29 +144,29 @@ UpdateButtonIcon() /datum/action/item_action/chameleon/change/proc/update_item(obj/item/picked_item) - // Species-related variables are lists, which can not be retrieved using initial(). As such, we need to instantiate the picked item. - var/obj/item/P = new picked_item(null) - - target.name = P.name - target.desc = P.desc - target.icon_state = P.icon_state + target.name = initial(picked_item.name) + target.desc = initial(picked_item.desc) + target.icon_state = initial(picked_item.icon_state) if(isitem(target)) var/obj/item/I = target - I.item_state = P.item_state - I.item_color = P.item_color + I.item_state = initial(picked_item.item_state) + I.item_color = initial(picked_item.item_color) - I.icon_override = P.icon_override - I.sprite_sheets = P.sprite_sheets + I.icon_override = initial(picked_item.icon_override) + if(initial(picked_item.sprite_sheets)) + // Species-related variables are lists, which can not be retrieved using initial(). As such, we need to instantiate the picked item. + var/obj/item/P = new picked_item(null) + I.sprite_sheets = P.sprite_sheets + qdel(P) - if(istype(I, /obj/item/clothing) && istype(P, /obj/item/clothing)) + if(istype(I, /obj/item/clothing) && istype(initial(picked_item), /obj/item/clothing)) var/obj/item/clothing/CL = I - var/obj/item/clothing/PCL = P - CL.flags_cover = PCL.flags_cover + var/obj/item/clothing/PCL = picked_item + CL.flags_cover = initial(PCL.flags_cover) - target.icon = P.icon - qdel(P) + target.icon = initial(picked_item.icon) /datum/action/item_action/chameleon/change/Trigger() if(!IsAvailable()) @@ -198,7 +202,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/under/chameleon/Initialize() +/obj/item/clothing/under/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/clothing/under @@ -206,11 +210,15 @@ chameleon_action.chameleon_blacklist = typecacheof(list(/obj/item/clothing/under, /obj/item/clothing/under/color, /obj/item/clothing/under/rank), only_root_path = TRUE) chameleon_action.initialize_disguises() +/obj/item/clothing/under/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/under/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/clothing/under/chameleon/broken/Initialize() +/obj/item/clothing/under/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -229,7 +237,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/suit/chameleon/Initialize() +/obj/item/clothing/suit/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/clothing/suit @@ -237,11 +245,15 @@ chameleon_action.chameleon_blacklist = typecacheof(list(/obj/item/clothing/suit/armor/abductor), only_root_path = TRUE) chameleon_action.initialize_disguises() +/obj/item/clothing/suit/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/suit/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/clothing/suit/chameleon/broken/Initialize() +/obj/item/clothing/suit/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -261,7 +273,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/glasses/chameleon/Initialize() +/obj/item/clothing/glasses/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/clothing/glasses @@ -269,11 +281,15 @@ chameleon_action.chameleon_blacklist = list() chameleon_action.initialize_disguises() +/obj/item/clothing/glasses/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/glasses/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/clothing/glasses/chameleon/broken/Initialize() +/obj/item/clothing/glasses/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -289,7 +305,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/glasses/hud/security/chameleon/Initialize() +/obj/item/clothing/glasses/hud/security/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/clothing/glasses @@ -297,11 +313,15 @@ chameleon_action.chameleon_blacklist = list() chameleon_action.initialize_disguises() +/obj/item/clothing/glasses/hud/security/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/glasses/hud/security/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/clothing/glasses/hud/security/chameleon/broken/Initialize() +/obj/item/clothing/glasses/hud/security/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -316,7 +336,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/gloves/chameleon/Initialize() +/obj/item/clothing/gloves/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/clothing/gloves @@ -324,11 +344,15 @@ chameleon_action.chameleon_blacklist = typecacheof(list(/obj/item/clothing/gloves, /obj/item/clothing/gloves/color), only_root_path = TRUE) chameleon_action.initialize_disguises() +/obj/item/clothing/gloves/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/gloves/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/clothing/gloves/chameleon/broken/Initialize() +/obj/item/clothing/gloves/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -347,7 +371,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/head/chameleon/Initialize() +/obj/item/clothing/head/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/clothing/head @@ -355,11 +379,15 @@ chameleon_action.chameleon_blacklist = list() chameleon_action.initialize_disguises() +/obj/item/clothing/head/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/head/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/clothing/head/chameleon/broken/Initialize() +/obj/item/clothing/head/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -389,7 +417,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/mask/chameleon/Initialize() +/obj/item/clothing/mask/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) @@ -402,13 +430,14 @@ /obj/item/clothing/mask/chameleon/Destroy() QDEL_NULL(voice_changer) + QDEL_NULL(chameleon_action) return ..() /obj/item/clothing/mask/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/clothing/mask/chameleon/broken/Initialize() +/obj/item/clothing/mask/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -423,7 +452,7 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/clothing/shoes/chameleon/Initialize() +/obj/item/clothing/shoes/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/clothing/shoes @@ -431,6 +460,10 @@ chameleon_action.chameleon_blacklist = list() chameleon_action.initialize_disguises() +/obj/item/clothing/shoes/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/shoes/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() @@ -442,7 +475,7 @@ desc = "A pair of black shoes." flags = NOSLIP -/obj/item/clothing/shoes/chameleon/noslip/broken/Initialize() +/obj/item/clothing/shoes/chameleon/noslip/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -455,18 +488,22 @@ var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/storage/backpack/chameleon/Initialize() +/obj/item/storage/backpack/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/storage/backpack chameleon_action.chameleon_name = "Backpack" chameleon_action.initialize_disguises() +/obj/item/storage/backpack/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/storage/backpack/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/storage/backpack/chameleon/broken/Initialize() +/obj/item/storage/backpack/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -475,7 +512,7 @@ desc = "Holds tools." var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/storage/belt/chameleon/Initialize() +/obj/item/storage/belt/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) @@ -483,11 +520,15 @@ chameleon_action.chameleon_name = "Belt" chameleon_action.initialize_disguises() +/obj/item/storage/belt/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/storage/belt/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/storage/belt/chameleon/broken/Initialize() +/obj/item/storage/belt/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -495,18 +536,22 @@ name = "radio headset" var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/radio/headset/chameleon/Initialize() +/obj/item/radio/headset/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/radio/headset chameleon_action.chameleon_name = "Headset" chameleon_action.initialize_disguises() +/obj/item/radio/headset/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/radio/headset/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/radio/headset/chameleon/broken/Initialize() +/obj/item/radio/headset/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) @@ -514,7 +559,7 @@ name = "PDA" var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/pda/chameleon/Initialize() +/obj/item/pda/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/pda @@ -522,24 +567,32 @@ chameleon_action.chameleon_blacklist = typecacheof(list(/obj/item/pda/heads), only_root_path = TRUE) chameleon_action.initialize_disguises() +/obj/item/pda/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/pda/chameleon/emp_act(severity) . = ..() chameleon_action.emp_randomise() -/obj/item/pda/chameleon/broken/Initialize() +/obj/item/pda/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) /obj/item/stamp/chameleon var/datum/action/item_action/chameleon/change/chameleon_action -/obj/item/stamp/chameleon/Initialize() +/obj/item/stamp/chameleon/Initialize(mapload) . = ..() chameleon_action = new(src) chameleon_action.chameleon_type = /obj/item/stamp chameleon_action.chameleon_name = "Stamp" chameleon_action.initialize_disguises() -/obj/item/stamp/chameleon/broken/Initialize() +/obj/item/stamp/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + +/obj/item/stamp/chameleon/broken/Initialize(mapload) . = ..() chameleon_action.emp_randomise(INFINITY) diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 1b9c87f56e5..011bc60cdc4 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -376,7 +376,6 @@ desc = "Covers the eyes, preventing sight." icon_state = "blindfold" item_state = "blindfold" - //vision_flags = BLIND flash_protect = 2 tint = 3 //to make them blind prescription_upgradable = 0 @@ -412,7 +411,7 @@ if(M.glasses == src) M.EyeBlind(3) M.EyeBlurry(5) - if(!(M.disabilities & NEARSIGHTED)) + if(!(NEARSIGHTED in M.mutations)) M.BecomeNearsighted() spawn(100) M.CureNearsighted() diff --git a/code/modules/clothing/shoes/colour.dm b/code/modules/clothing/shoes/colour.dm index 0bf54e8692f..5bf6b90c98e 100644 --- a/code/modules/clothing/shoes/colour.dm +++ b/code/modules/clothing/shoes/colour.dm @@ -86,21 +86,25 @@ name = "orange shoes" icon_state = "orange" item_color = "orange" + var/obj/item/restraints/handcuffs/shackles -/obj/item/clothing/shoes/orange/attack_self(mob/user as mob) - if(src.chained) - src.chained = null - src.slowdown = SHOES_SLOWDOWN - new /obj/item/restraints/handcuffs( user.loc ) - src.icon_state = "orange" - return +/obj/item/clothing/shoes/orange/Destroy() + QDEL_NULL(shackles) + return ..() -/obj/item/clothing/shoes/orange/attackby(obj/H, loc, params) - ..() - if(istype(H, /obj/item/restraints/handcuffs) && !chained && !(H.flags & NODROP)) - if(src.icon_state != "orange") return - qdel(H) - src.chained = 1 - src.slowdown = 15 - src.icon_state = "orange1" - return +/obj/item/clothing/shoes/orange/attack_self(mob/user) + if(shackles) + user.put_in_hands(shackles) + shackles = null + slowdown = SHOES_SLOWDOWN + icon_state = "orange" + +/obj/item/clothing/shoes/orange/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/restraints/handcuffs) && !shackles) + if(user.drop_item()) + I.forceMove(src) + shackles = I + slowdown = 15 + icon_state = "orange1" + return + return ..() diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 916cb8e89d4..129b07af36e 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -73,16 +73,15 @@ obj/item/clothing/shoes/magboots/syndie/advance //For the Syndicate Strike Team shoe_sound = "clownstep" origin_tech = "magnets=4;syndicate=2" var/enabled_waddle = TRUE - var/datum/component/waddle /obj/item/clothing/shoes/magboots/clown/equipped(mob/user, slot) . = ..() if(slot == slot_shoes && enabled_waddle) - waddle = user.AddComponent(/datum/component/waddling) + user.AddElement(/datum/element/waddling) /obj/item/clothing/shoes/magboots/clown/dropped(mob/user) . = ..() - QDEL_NULL(waddle) + user.RemoveElement(/datum/element/waddling) /obj/item/clothing/shoes/magboots/clown/CtrlClick(mob/living/user) if(!isliving(user)) diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index 6858355f876..962cfed80c5 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -71,16 +71,15 @@ var/footstep = 1 //used for squeeks whilst walking shoe_sound = "clownstep" var/enabled_waddle = TRUE - var/datum/component/waddle /obj/item/clothing/shoes/clown_shoes/equipped(mob/user, slot) . = ..() if(slot == slot_shoes && enabled_waddle) - waddle = user.AddComponent(/datum/component/waddling) + user.AddElement(/datum/element/waddling) /obj/item/clothing/shoes/clown_shoes/dropped(mob/user) . = ..() - QDEL_NULL(waddle) + user.RemoveElement(/datum/element/waddling) /obj/item/clothing/shoes/clown_shoes/CtrlClick(mob/living/user) if(!isliving(user)) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 5a01c9f6f55..1198792c980 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -531,7 +531,7 @@ /obj/item/clothing/suit/space/hardsuit/shielded/process() if(world.time > recharge_cooldown && current_charges < max_charges) - current_charges = Clamp((current_charges + recharge_rate), 0, max_charges) + current_charges = clamp((current_charges + recharge_rate), 0, max_charges) playsound(loc, 'sound/magic/charge.ogg', 50, TRUE) if(current_charges == max_charges) playsound(loc, 'sound/machines/ding.ogg', 50, TRUE) diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index 3608ee85164..0d106a874a7 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -155,9 +155,8 @@ if(piece.siemens_coefficient > siemens_coefficient) //So that insulated gloves keep their insulation. piece.siemens_coefficient = siemens_coefficient piece.permeability_coefficient = permeability_coefficient - if(islist(armor)) - var/list/L = armor - piece.armor = L.Copy() + if(armor) + piece.armor = armor update_icon(1) @@ -286,7 +285,7 @@ if(helmet) helmet.update_light(wearer) - correct_piece.armor["bio"] = 100 + correct_piece.armor = correct_piece.armor.setRating(bio_value = 100) sealing = FALSE @@ -389,7 +388,7 @@ if(helmet) helmet.update_light(wearer) - correct_piece.armor["bio"] = armor["bio"] + correct_piece.armor = correct_piece.armor.setRating(bio_value = armor.getRating("bio")) sealing = FALSE @@ -553,7 +552,7 @@ data["charge"] = cell ? round(cell.charge,1) : 0 data["maxcharge"] = cell ? cell.maxcharge : 0 - data["chargestatus"] = cell ? Floor((cell.charge/cell.maxcharge)*50) : 0 + data["chargestatus"] = cell ? FLOOR((cell.charge/cell.maxcharge)*50, 1) : 0 data["emagged"] = subverted data["coverlock"] = locked @@ -798,7 +797,7 @@ to_chat(wearer, "You are unable to deploy \the [piece] as \the [check_slot] [check_slot.gender == PLURAL ? "are" : "is"] in the way.") return use_obj.forceMove(wearer) - if(!wearer.equip_to_slot_if_possible(use_obj, equip_to, 0, 1)) + if(!wearer.equip_to_slot_if_possible(use_obj, equip_to, FALSE, TRUE)) use_obj.forceMove(src) else if(wearer) diff --git a/code/modules/clothing/spacesuits/rig/rig_armormod.dm b/code/modules/clothing/spacesuits/rig/rig_armormod.dm index 68daec45b5a..c04270aa97b 100644 --- a/code/modules/clothing/spacesuits/rig/rig_armormod.dm +++ b/code/modules/clothing/spacesuits/rig/rig_armormod.dm @@ -9,13 +9,22 @@ multi *= (100 - chest.damage) / 100 //If we have some breaches, lower the armor value. //TODO check for other armor mods, likely modules, which need to be coded. + if(!armor) //Did we even give them some armor, if this is the case, the list should be initialized from New() + return + var/datum/armor/A = armor for(var/obj/item/piece in list(gloves, helmet, boots, chest)) if(!istype(piece)) //Do we have the piece continue - if(islist(armor)) //Did we even give them some armor, if this is the case, the list should be initialized from New() - var/list/L = armor - for(var/armortype in L) - piece.armor[armortype] = L[armortype]*multi + + piece.armor = piece.armor.setRating(melee_value = A.getRating("melee") * multi, + bullet_value = A.getRating("bullet") * multi, + laser_value = A.getRating("laser") * multi, + energy_value = A.getRating("energy") * multi, + bomb_value = A.getRating("bomb") * multi, + bio_value = A.getRating("bio") * multi, + rad_value = A.getRating("rad") * multi, + fire_value = A.getRating("fire") * multi, + acid_value = A.getRating("acidd") * multi) //Perfect place to also add something like shield modules, or any other hit_reaction modules check. diff --git a/code/modules/clothing/suits/hood.dm b/code/modules/clothing/suits/hood.dm index 83f0fcfc211..be05ced4fd8 100644 --- a/code/modules/clothing/suits/hood.dm +++ b/code/modules/clothing/suits/hood.dm @@ -59,7 +59,7 @@ if(H.head) to_chat(H,"You're already wearing something on your head!") return - else if(H.equip_to_slot_if_possible(hood, slot_head, 0, 0, 1)) + else if(H.equip_to_slot_if_possible(hood, slot_head, FALSE, FALSE)) suit_adjusted = 1 icon_state = "[initial(icon_state)]_hood" H.update_inv_wear_suit() diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index c329d8a0033..7e1a993fca4 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -68,7 +68,7 @@ if(H.head) to_chat(H, "You're already wearing something on your head!") return - else if(H.equip_to_slot_if_possible(helmet, slot_head, 0 ,0, 1)) + else if(H.equip_to_slot_if_possible(helmet, slot_head, FALSE, FALSE)) to_chat(H, "You engage the helmet on the hardsuit.") suittoggled = TRUE H.update_inv_wear_suit() diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index b417df89426..673b6a14b9a 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -37,8 +37,13 @@ var/mob/M = has_suit.loc A.Grant(M) - for(var/armor_type in armor) - has_suit.armor[armor_type] += armor[armor_type] + if (islist(has_suit.armor) || isnull(has_suit.armor)) // This proc can run before /obj/Initialize has run for U and src, + has_suit.armor = getArmor(arglist(has_suit.armor)) // we have to check that the armor list has been transformed into a datum before we try to call a proc on it + // This is safe to do as /obj/Initialize only handles setting up the datum if actually needed. + if (islist(armor) || isnull(armor)) + armor = getArmor(arglist(armor)) + + has_suit.armor = has_suit.armor.attachArmor(armor) if(user) to_chat(user, "You attach [src] to [has_suit].") @@ -56,8 +61,7 @@ var/mob/M = has_suit.loc A.Remove(M) - for(var/armor_type in armor) - has_suit.armor[armor_type] -= armor[armor_type] + has_suit.armor = has_suit.armor.detachArmor(armor) has_suit = null if(user) diff --git a/code/modules/crafting/craft.dm b/code/modules/crafting/craft.dm index a9c47e760e7..a0d6823fe80 100644 --- a/code/modules/crafting/craft.dm +++ b/code/modules/crafting/craft.dm @@ -128,7 +128,7 @@ continue main_loop return FALSE for(var/obj/item/T in tools_used) - if(!T.tool_start_check(user, 0)) //Check if all our tools are valid for their use + if(!T.tool_start_check(null, user, 0)) //Check if all our tools are valid for their use return FALSE return TRUE diff --git a/code/modules/economy/Accounts_DB.dm b/code/modules/economy/Accounts_DB.dm index 6995e260500..aafc91cb849 100644 --- a/code/modules/economy/Accounts_DB.dm +++ b/code/modules/economy/Accounts_DB.dm @@ -159,7 +159,7 @@ GLOBAL_VAR(current_date_string) var/account_name = href_list["holder_name"] var/starting_funds = max(text2num(href_list["starting_funds"]), 0) - starting_funds = Clamp(starting_funds, 0, GLOB.station_account.money) // Not authorized to put the station in debt. + starting_funds = clamp(starting_funds, 0, GLOB.station_account.money) // Not authorized to put the station in debt. starting_funds = min(starting_funds, fund_cap) // Not authorized to give more than the fund cap. var/datum/money_account/M = create_account(account_name, starting_funds, src) diff --git a/code/modules/economy/utils.dm b/code/modules/economy/utils.dm index f7d6992e31f..4d7273cd719 100644 --- a/code/modules/economy/utils.dm +++ b/code/modules/economy/utils.dm @@ -5,7 +5,7 @@ //////////////////////// /proc/get_money_account(var/account_number, var/from_z=-1) - for(var/obj/machinery/computer/account_database/DB in world) + for(var/obj/machinery/computer/account_database/DB in GLOB.machines) if(from_z > -1 && DB.z != from_z) continue if((DB.stat & NOPOWER) || !DB.activated ) continue var/datum/money_account/acct = DB.get_account(account_number) diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 5e39295113c..8c01d5c7cc2 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -17,7 +17,7 @@ playercount = length(GLOB.clients)//grab playercount when event starts not when game starts if(playercount >= highpop_trigger) //spawn with 4 if highpop spawncount = 4 - for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world) + for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in SSair.atmos_machinery) if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) if(temp_vent.parent.other_atmosmch.len > 50) //Stops Aliens getting stuck in small networks. See: Security, Virology vents += temp_vent diff --git a/code/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm index 2924effa0de..929612cf6f9 100644 --- a/code/modules/events/anomaly_bluespace.dm +++ b/code/modules/events/anomaly_bluespace.dm @@ -18,7 +18,7 @@ // Calculate new position (searches through beacons in world) var/obj/item/radio/beacon/chosen var/list/possible = list() - for(var/obj/item/radio/beacon/W in world) + for(var/obj/item/radio/beacon/W in GLOB.global_radios) if(!is_station_level(W.z)) continue possible += W diff --git a/code/modules/events/anomaly_pyro.dm b/code/modules/events/anomaly_pyro.dm index 79e7c7b8434..0a5dc14bc3a 100644 --- a/code/modules/events/anomaly_pyro.dm +++ b/code/modules/events/anomaly_pyro.dm @@ -15,7 +15,7 @@ if(!newAnomaly) kill() return - if(IsMultiple(activeFor, 5)) + if(ISMULTIPLE(activeFor, 5)) newAnomaly.anomalyEffect() /datum/event/anomaly/anomaly_pyro/end() diff --git a/code/modules/events/apc_overload.dm b/code/modules/events/apc_overload.dm new file mode 100644 index 00000000000..13cabe81b3c --- /dev/null +++ b/code/modules/events/apc_overload.dm @@ -0,0 +1,64 @@ +#define APC_BREAK_PROBABILITY 25 // the probability that a given APC will be broken + +/datum/event/apc_overload + var/const/announce_after_mc_ticks = 5 + var/const/delayed = FALSE + var/const/event_max_duration_mc_ticks = announce_after_mc_ticks * 2 + var/const/event_min_duration_mc_ticks = announce_after_mc_ticks + + announceWhen = announce_after_mc_ticks + +/datum/event/apc_overload/setup() + endWhen = rand(event_min_duration_mc_ticks, event_max_duration_mc_ticks) + +/datum/event/apc_overload/start() + apc_overload_failure(announce=delayed) + var/sound/S = sound('sound/effects/powerloss.ogg') + for(var/mob/living/M in GLOB.player_list) + var/turf/T = get_turf(M) + if(!M.client || !is_station_level(T.z)) + continue + SEND_SOUND(M, S) + +/datum/event/apc_overload/announce() + GLOB.event_announcement.Announce("Overload detected in [station_name()]'s powernet. Engineering, please check all underfloor APC terminals.", "Critical Power Failure", new_sound = 'sound/AI/apc_overload.ogg') + +/datum/event/apc_overload/end() + return TRUE + +/proc/apc_overload_failure(announce=TRUE) + var/list/skipped_areas_apc = list( + /area/engine/engineering, + /area/turret_protected/ai) + + if(announce) + GLOB.event_announcement.Announce("Overload detected in [station_name()]'s powernet. Engineering, please check all underfloor APC terminals.", "Critical Power Failure", new_sound = 'sound/AI/apc_overload.ogg') + + // break APC_BREAK_PROBABILITY% of all of the APCs on the station + var/affected_apc_count = 0 + for(var/thing in GLOB.apcs) + var/obj/machinery/power/apc/C = thing + // skip any APCs that are too critical to break + var/area/current_area = get_area(C) + if((current_area.type in skipped_areas_apc) || !is_station_level(C.z)) + continue + // if we are going to break this one + if(prob(APC_BREAK_PROBABILITY)) + // if it has a cell, drain all the charge from the cell + if(C.cell) + C.cell.charge = 0 + // if it has a terminal, disconnect and delete the terminal + if(C.terminal) + var/obj/machinery/power/terminal/T = C.terminal + C.terminal.master = null + C.terminal = null + qdel(T) + // if it was operating, toggle off the breaker + if(C.operating) + C.toggle_breaker() + // no matter what, ensure the area knows something happened to the power + current_area.power_change() + affected_apc_count++ + log_and_message_admins("APC Overload event deleted [affected_apc_count] underfloor APC terminals.") + +#undef APC_BREAK_PROBABILITY diff --git a/code/modules/events/apc_short.dm b/code/modules/events/apc_short.dm new file mode 100644 index 00000000000..d2fe04dcc5d --- /dev/null +++ b/code/modules/events/apc_short.dm @@ -0,0 +1,79 @@ +#define APC_BREAK_PROBABILITY 25 // the probability that a given APC will be disabled + +/datum/event/apc_short + var/const/announce_after_mc_ticks = 5 + var/const/delayed = FALSE + var/const/event_max_duration_mc_ticks = announce_after_mc_ticks * 2 + var/const/event_min_duration_mc_ticks = announce_after_mc_ticks + + announceWhen = announce_after_mc_ticks + +/datum/event/apc_short/setup() + endWhen = rand(event_min_duration_mc_ticks, event_max_duration_mc_ticks) + +/datum/event/apc_short/start() + power_failure(announce=delayed) + var/sound/S = sound('sound/effects/powerloss.ogg') + for(var/mob/living/M in GLOB.player_list) + var/turf/T = get_turf(M) + if(!M.client || !is_station_level(T.z)) + continue + SEND_SOUND(M, S) + +/datum/event/apc_short/announce() + GLOB.event_announcement.Announce("Overload detected in [station_name()]'s powernet. Engineering, please repair shorted APCs.", "Systems Power Failure", new_sound = 'sound/AI/apc_short.ogg') + +/datum/event/apc_short/end() + return TRUE + +/proc/power_failure(announce=TRUE) + var/list/skipped_areas_apc = list( + /area/engine/engineering, + /area/turret_protected/ai) + + if(announce) + GLOB.event_announcement.Announce("Overload detected in [station_name()]'s powernet. Engineering, please repair shorted APCs.", "Systems Power Failure", new_sound = 'sound/AI/apc_short.ogg') + + // break APC_BREAK_PROBABILITY% of all of the APCs on the station + var/affected_apc_count = 0 + for(var/thing in GLOB.apcs) + var/obj/machinery/power/apc/C = thing + // skip any APCs that are too critical to disable + var/area/current_area = get_area(C) + if((current_area.type in skipped_areas_apc) || !is_station_level(C.z)) + continue + // if we are going to break this one + if(prob(APC_BREAK_PROBABILITY)) + // if it has internal wires, cut the power wires + if(C.wires) + if(!C.wires.IsIndexCut(APC_WIRE_MAIN_POWER1)) + C.wires.CutWireIndex(APC_WIRE_MAIN_POWER1) + if(!C.wires.IsIndexCut(APC_WIRE_MAIN_POWER2)) + C.wires.CutWireIndex(APC_WIRE_MAIN_POWER2) + // if it was operating, toggle off the breaker + if(C.operating) + C.toggle_breaker() + // no matter what, ensure the area knows something happened to the power + current_area.power_change() + affected_apc_count++ + log_and_message_admins("APC Short event shorted out [affected_apc_count] APCs.") + +/proc/power_restore(announce=TRUE) + power_restore_quick(announce) + +/proc/power_restore_quick(announce=TRUE) + if(announce) + GLOB.event_announcement.Announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg') + + // fix all of the SMESs + for(var/obj/machinery/power/smes/S in GLOB.machines) + if(!is_station_level(S.z)) + continue + S.charge = S.capacity + S.output_level = S.output_level_max + S.output_attempt = 1 + S.input_attempt = 1 + S.update_icon() + S.power_change() + +#undef APC_BREAK_PROBABILITY diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index d3b7cf012b8..8d91635c458 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -55,12 +55,12 @@ kill() return - if(IsMultiple(activeFor, 4)) + if(ISMULTIPLE(activeFor, 4)) var/obj/machinery/vending/rebel = pick(vendingMachines) vendingMachines.Remove(rebel) infectedMachines.Add(rebel) rebel.shut_up = 0 rebel.shoot_inventory = 1 - if(IsMultiple(activeFor, 8)) + if(ISMULTIPLE(activeFor, 8)) originMachine.speak(pick(rampant_speeches)) diff --git a/code/modules/events/carp_migration.dm b/code/modules/events/carp_migration.dm index fb12a258c2d..fb02033b802 100644 --- a/code/modules/events/carp_migration.dm +++ b/code/modules/events/carp_migration.dm @@ -30,7 +30,8 @@ /datum/event/carp_migration/proc/spawn_fish(num_groups, group_size_min = 3, group_size_max = 5) var/list/spawn_locations = list() - for(var/obj/effect/landmark/C in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/C = thing if(C.name == "carpspawn") spawn_locations.Add(C.loc) spawn_locations = shuffle(spawn_locations) diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm index 291ae55c743..1bc00c93025 100644 --- a/code/modules/events/disease_outbreak.dm +++ b/code/modules/events/disease_outbreak.dm @@ -1,43 +1,36 @@ /datum/event/disease_outbreak announceWhen = 15 - - var/datum/disease/advance/virus_type + var/datum/disease/D /datum/event/disease_outbreak/setup() announceWhen = rand(15, 30) + if(prob(25)) + var/virus_type = pick(/datum/disease/advance/flu, /datum/disease/advance/cold, /datum/disease/brainrot, /datum/disease/magnitis, /datum/disease/beesease, /datum/disease/anxiety, /datum/disease/fake_gbs, /datum/disease/fluspanish, /datum/disease/pierrot_throat, /datum/disease/lycan) + D = new virus_type() + else + var/datum/disease/advance/A = new /datum/disease/advance + A.name = capitalize(pick(GLOB.adjectives)) + " " + capitalize(pick(GLOB.nouns + GLOB.verbs)) // random silly name + A.GenerateSymptoms(1,9,6) + A.AssignProperties(list("resistance" = rand(0,11), "stealth" = rand(0,2), "stage_rate" = rand(0,5), "transmittable" = rand(0,5), "severity" = rand(0,10))) + D = A + + D.carrier = TRUE /datum/event/disease_outbreak/announce() GLOB.event_announcement.Announce("Confirmed outbreak of level 7 major viral biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg') /datum/event/disease_outbreak/start() - if(prob(25)) - virus_type = pick(/datum/disease/advance/flu, /datum/disease/advance/cold, /datum/disease/brainrot, /datum/disease/magnitis, /datum/disease/beesease, /datum/disease/anxiety, /datum/disease/fake_gbs, /datum/disease/fluspanish, /datum/disease/pierrot_throat, /datum/disease/lycan) - else - virus_type = new /datum/disease/advance - virus_type.name = capitalize(pick(GLOB.adjectives)) + " " + capitalize(pick(GLOB.nouns,GLOB.verbs)) // random silly name - virus_type.GenerateSymptoms(1,9,6) - virus_type.AssignProperties(list("resistance" = rand(0,11), "stealth" = rand(0,2), "stage_rate" = rand(0,5), "transmittable" = rand(0,5), "severity" = rand(0,10))) - for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list)) - if(issmall(H)) //don't infect monkies; that's a waste - continue + for(var/mob/living/carbon/human/H in shuffle(GLOB.alive_mob_list)) if(!H.client) continue - if(VIRUSIMMUNE in H.dna.species.species_traits) //don't let virus immune things get diseases they're not supposed to get. + if(issmall(H)) //don't infect monkies; that's a waste continue var/turf/T = get_turf(H) if(!T) continue if(!is_station_level(T.z)) continue - var/foundAlready = FALSE // don't infect someone that already has the virus - for(var/thing in H.viruses) - foundAlready = TRUE - break - if(H.stat == DEAD || foundAlready) - continue - var/datum/disease/advance/D - D = virus_type - D.carrier = TRUE - H.AddDisease(D) + if(!H.ForceContractDisease(D)) + continue break diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index 755e2e2d47a..7304469f408 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -10,7 +10,8 @@ for(var/i=1, i <= lightsoutAmount, i++) var/list/possibleEpicentres = list() - for(var/obj/effect/landmark/newEpicentre in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/newEpicentre = thing if(newEpicentre.name == "lightsout" && !(newEpicentre in epicentreList)) possibleEpicentres += newEpicentre if(possibleEpicentres.len) @@ -21,7 +22,8 @@ if(!epicentreList.len) return - for(var/obj/effect/landmark/epicentre in epicentreList) - for(var/obj/machinery/power/apc/apc in range(epicentre,lightsoutRange)) + for(var/thing in epicentreList) + var/obj/effect/landmark/epicentre = thing + for(var/obj/machinery/power/apc/apc in range(epicentre, lightsoutRange)) apc.overload_lighting() diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index 9c744b8060a..908bc762315 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -128,7 +128,7 @@ GLOBAL_LIST_EMPTY(event_last_fired) /datum/event_container/mundane severity = EVENT_LEVEL_MUNDANE available_events = list( - // Severity level, event name, even type, base weight, role weights, one shot, min weight, max weight. Last two only used if set and non-zero + // Severity level, event name, event type, base weight, role weights, one shot, min weight, max weight. Last two only used if set and non-zero new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Nothing", /datum/event/nothing, 1100), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "PDA Spam", /datum/event/pda_spam, 0, list(ASSIGNMENT_ANY = 4), 0, 25, 50), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Lotto", /datum/event/money_lotto, 0, list(ASSIGNMENT_ANY = 1), 1, 5, 15), @@ -157,7 +157,7 @@ GLOBAL_LIST_EMPTY(event_last_fired) new /datum/event_meta(EVENT_LEVEL_MODERATE, "Prison Break", /datum/event/prison_break, 0, list(ASSIGNMENT_SECURITY = 100)), //new /datum/event_meta(EVENT_LEVEL_MODERATE, "Virology Breach", /datum/event/prison_break/virology, 0, list(ASSIGNMENT_MEDICAL = 100)), //new /datum/event_meta(EVENT_LEVEL_MODERATE, "Xenobiology Breach", /datum/event/prison_break/xenobiology, 0, list(ASSIGNMENT_SCIENCE = 100)), - new /datum/event_meta(EVENT_LEVEL_MODERATE, "Grid Check", /datum/event/grid_check, 200, list(ASSIGNMENT_ENGINEER = 60)), + new /datum/event_meta(EVENT_LEVEL_MODERATE, "APC Short", /datum/event/apc_short, 200, list(ASSIGNMENT_ENGINEER = 60)), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Electrical Storm", /datum/event/electrical_storm, 250, list(ASSIGNMENT_ENGINEER = 20, ASSIGNMENT_JANITOR = 150)), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Radiation Storm", /datum/event/radiation_storm, 25, list(ASSIGNMENT_MEDICAL = 50), 1), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Spider Infestation", /datum/event/spider_infestation, 100, list(ASSIGNMENT_SECURITY = 30), 1), @@ -191,6 +191,7 @@ GLOBAL_LIST_EMPTY(event_last_fired) new /datum/event_meta(EVENT_LEVEL_MAJOR, "Nothing", /datum/event/nothing, 1320), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Carp Migration", /datum/event/carp_migration, 0, list(ASSIGNMENT_SECURITY = 3), 1), //new /datum/event_meta(EVENT_LEVEL_MAJOR, "Containment Breach", /datum/event/prison_break/station, 0, list(ASSIGNMENT_ANY = 5)), + new /datum/event_meta(EVENT_LEVEL_MAJOR, "APC Overload", /datum/event/apc_overload, 0), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Blob", /datum/event/blob, 0, list(ASSIGNMENT_ENGINEER = 30), 1), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Meteor Wave", /datum/event/meteor_wave, 0, list(ASSIGNMENT_ENGINEER = 5), 1), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Abductor Visit", /datum/event/abductor, 80, is_one_shot = 1), diff --git a/code/modules/events/grid_check.dm b/code/modules/events/grid_check.dm deleted file mode 100644 index 8da2a6d707e..00000000000 --- a/code/modules/events/grid_check.dm +++ /dev/null @@ -1,82 +0,0 @@ -/datum/event/grid_check //NOTE: Times are measured in master controller ticks! - announceWhen = 5 - -/datum/event/grid_check/setup() - endWhen = rand(30,120) - -/datum/event/grid_check/start() - power_failure(0) - var/sound/S = sound('sound/effects/powerloss.ogg') - for(var/mob/living/M in GLOB.player_list) - var/turf/T = get_turf(M) - if(!M.client || !is_station_level(T.z)) - continue - SEND_SOUND(M, S) - -/datum/event/grid_check/announce() - GLOB.event_announcement.Announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Automated Grid Check", new_sound = 'sound/AI/poweroff.ogg') - -/datum/event/grid_check/end() - power_restore() - -/proc/power_failure(var/announce = 1) - if(announce) - GLOB.event_announcement.Announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", new_sound = 'sound/AI/poweroff.ogg') - - var/list/skipped_areas = list(/area/turret_protected/ai) - var/list/skipped_areas_apc = list(/area/engine/engineering) - - for(var/obj/machinery/power/smes/S in GLOB.machines) - var/area/current_area = get_area(S) - if((current_area.type in skipped_areas) || !is_station_level(S.z)) - continue - S.last_charge = S.charge - S.last_output_attempt = S.output_attempt - S.last_input_attempt = S.input_attempt - S.charge = 0 - S.inputting(0) - S.outputting(0) - S.update_icon() - S.power_change() - - for(var/obj/machinery/power/apc/C in GLOB.apcs) - var/area/current_area = get_area(C) - if((current_area.type in skipped_areas_apc) || !is_station_level(C.z)) - continue - if(C.cell) - C.cell.charge = 0 - -/proc/power_restore(var/announce = 1) - var/list/skipped_areas = list(/area/turret_protected/ai) - var/list/skipped_areas_apc = list(/area/engine/engineering) - - if(announce) - GLOB.event_announcement.Announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg') - for(var/obj/machinery/power/apc/C in GLOB.apcs) - var/area/current_area = get_area(C) - if((current_area.type in skipped_areas_apc) || !is_station_level(C.z)) - continue - if(C.cell) - C.cell.charge = C.cell.maxcharge - for(var/obj/machinery/power/smes/S in GLOB.machines) - var/area/current_area = get_area(S) - if((current_area.type in skipped_areas) || !is_station_level(S.z)) - continue - S.charge = S.last_charge - S.output_attempt = S.last_output_attempt - S.input_attempt = S.last_input_attempt - S.update_icon() - S.power_change() - -/proc/power_restore_quick(var/announce = 1) - if(announce) - GLOB.event_announcement.Announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg') - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(!is_station_level(S.z)) - continue - S.charge = S.capacity - S.output_level = S.output_level_max - S.output_attempt = 1 - S.input_attempt = 1 - S.update_icon() - S.power_change() diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm index 021004c6ee9..90718ef2928 100644 --- a/code/modules/events/ion_storm.dm +++ b/code/modules/events/ion_storm.dm @@ -22,7 +22,7 @@ /datum/event/ion_storm/start() //AI laws - for(var/mob/living/silicon/ai/M in GLOB.living_mob_list) + for(var/mob/living/silicon/ai/M in GLOB.alive_mob_list) if(M.stat != DEAD && M.see_in_dark != FALSE) var/message = generate_ion_law(ionMessage) if(message) diff --git a/code/modules/events/mass_hallucination.dm b/code/modules/events/mass_hallucination.dm index 6aceefcd41a..196642ce39c 100644 --- a/code/modules/events/mass_hallucination.dm +++ b/code/modules/events/mass_hallucination.dm @@ -2,7 +2,7 @@ announceWhen = rand(0, 20) /datum/event/mass_hallucination/start() - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) var/armor = H.getarmor(type = "rad") if((RADIMMUNE in H.dna.species.species_traits) || armor >= 75) // Leave radiation-immune species/rad armored players completely unaffected continue diff --git a/code/modules/events/money_hacker.dm b/code/modules/events/money_hacker.dm index 928b35e84ea..f26c12f5f7d 100644 --- a/code/modules/events/money_hacker.dm +++ b/code/modules/events/money_hacker.dm @@ -23,7 +23,7 @@ GLOBAL_VAR_INIT(account_hack_attempted, 0) Notifications will be sent as updates occur.
" var/my_department = "[station_name()] firewall subroutines" - for(var/obj/machinery/message_server/MS in world) + for(var/obj/machinery/message_server/MS in GLOB.machines) if(!MS.active) continue MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2) @@ -64,7 +64,7 @@ GLOBAL_VAR_INIT(account_hack_attempted, 0) var/my_department = "[station_name()] firewall subroutines" - for(var/obj/machinery/message_server/MS in world) + for(var/obj/machinery/message_server/MS in GLOB.machines) if(!MS.active) continue MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2) diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm index 35c976fa2f9..748d39f2080 100644 --- a/code/modules/events/prison_break.dm +++ b/code/modules/events/prison_break.dm @@ -47,7 +47,7 @@ if(areas && areas.len > 0) var/my_department = "[station_name()] firewall subroutines" var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [station_time_timestamp()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.
" - for(var/obj/machinery/message_server/MS in world) + for(var/obj/machinery/message_server/MS in GLOB.machines) MS.send_rc_message("Engineering", my_department, rc_message, "", "", 2) for(var/mob/living/silicon/ai/A in GLOB.player_list) to_chat(A, "Malicious program detected in the [english_list(areaName)] lighting and airlock control systems by [my_department].") diff --git a/code/modules/events/rogue_drones.dm b/code/modules/events/rogue_drones.dm index e2a7dc739c3..02fa69b7c3e 100644 --- a/code/modules/events/rogue_drones.dm +++ b/code/modules/events/rogue_drones.dm @@ -6,7 +6,8 @@ /datum/event/rogue_drone/start() //spawn them at the same place as carp var/list/possible_spawns = list() - for(var/obj/effect/landmark/C in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/C = thing if(C.name == "carpspawn") possible_spawns.Add(C) diff --git a/code/modules/events/sentience.dm b/code/modules/events/sentience.dm index 4dfe181bdb5..918746f4595 100644 --- a/code/modules/events/sentience.dm +++ b/code/modules/events/sentience.dm @@ -8,7 +8,7 @@ var/list/potential = list() var/sentience_type = SENTIENCE_ORGANIC - for(var/mob/living/simple_animal/L in GLOB.living_mob_list) + for(var/mob/living/simple_animal/L in GLOB.alive_mob_list) var/turf/T = get_turf(L) if (T.z != 1) continue diff --git a/code/modules/events/slaughterevent.dm b/code/modules/events/slaughterevent.dm index 999303bf069..ac265adb420 100644 --- a/code/modules/events/slaughterevent.dm +++ b/code/modules/events/slaughterevent.dm @@ -16,13 +16,15 @@ var/datum/mind/player_mind = new /datum/mind(key_of_slaughter) player_mind.active = 1 var/list/spawn_locs = list() - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(isturf(L.loc)) switch(L.name) if("revenantspawn") spawn_locs += L.loc if(!spawn_locs) //If we can't find any revenant spawns, try the carp spawns - for(var/obj/effect/landmark/L in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/L = thing if(isturf(L.loc)) switch(L.name) if("carpspawn") diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index e09e1efb705..694f8e98c89 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -15,7 +15,7 @@ GLOBAL_VAR_INIT(sent_spiders_to_station, 0) /datum/event/spider_infestation/start() var/list/vents = list() - for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world) + for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in SSair.atmos_machinery) if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) if(temp_vent.parent.other_atmosmch.len > 50) vents += temp_vent diff --git a/code/modules/events/spontaneous_appendicitis.dm b/code/modules/events/spontaneous_appendicitis.dm index fb9c146d7cd..53923f4d124 100644 --- a/code/modules/events/spontaneous_appendicitis.dm +++ b/code/modules/events/spontaneous_appendicitis.dm @@ -1,5 +1,5 @@ /datum/event/spontaneous_appendicitis/start() - for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list)) + for(var/mob/living/carbon/human/H in shuffle(GLOB.alive_mob_list)) if(issmall(H)) //don't infect monkies; that's a waste. continue if(!H.client) diff --git a/code/modules/events/traders.dm b/code/modules/events/traders.dm index 4159885e993..0beeb3691e2 100644 --- a/code/modules/events/traders.dm +++ b/code/modules/events/traders.dm @@ -24,7 +24,8 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol")) return var/list/spawnlocs = list() - for(var/obj/effect/landmark/landmark in GLOB.landmarks_list) + for(var/thing in GLOB.landmarks_list) + var/obj/effect/landmark/landmark = thing if(landmark.name == "traderstart_[station]") spawnlocs += get_turf(landmark) if(!spawnlocs.len) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 32e209f98f6..51ac13d4e13 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -460,7 +460,7 @@ Gunshots/explosions/opening doors/less rare audio (done) target = T var/image/A = null var/kind = force_kind ? force_kind : pick("clown", "corgi", "carp", "skeleton", "demon","zombie") - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) if(H == target) continue if(skip_nearby && (H in view(target))) @@ -539,7 +539,7 @@ Gunshots/explosions/opening doors/less rare audio (done) var/mob/living/carbon/human/clone = null var/clone_weapon = null - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) if(H.stat || H.lying) continue clone = H @@ -751,7 +751,7 @@ GLOBAL_LIST_INIT(non_fakeattack_weapons, list(/obj/item/gun/projectile, /obj/ite target.client.images.Remove(speech_overlay) else // Radio talk var/list/humans = list() - for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) humans += H person = pick(humans) target.hear_radio(message_to_multilingual(pick(radio_messages), pick(person.languages)), speaker = person, part_a = "\[[get_frequency_name(PUB_FREQ)]\] ", part_b = " ") diff --git a/code/modules/food_and_drinks/drinks/bottler/bottler.dm b/code/modules/food_and_drinks/drinks/bottler/bottler.dm index b1667fc6a00..d7f1736bb4a 100644 --- a/code/modules/food_and_drinks/drinks/bottler/bottler.dm +++ b/code/modules/food_and_drinks/drinks/bottler/bottler.dm @@ -82,7 +82,6 @@ else //If it doesn't qualify in the above checks, we don't want it. Inform the person so they (ideally) stop trying to put the nuke disc in. to_chat(user, "You aren't sure this is able to be processed by the machine.") return 0 - return ..() /obj/machinery/bottler/wrench_act(mob/user, obj/item/I) . = TRUE diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index 90929175eba..d6395bf3d43 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -72,8 +72,8 @@ if(istype(H.head, /obj/item/clothing/head) && affecting == "head") // If their head has an armor value, assign headarmor to it, else give it 0. - if(H.head.armor["melee"]) - headarmor = H.head.armor["melee"] + if(H.head.armor.getRating("melee")) + headarmor = H.head.armor.getRating("melee") else headarmor = 0 else diff --git a/code/modules/food_and_drinks/food/foods/bread.dm b/code/modules/food_and_drinks/food/foods/bread.dm index d888a532c01..55255658233 100644 --- a/code/modules/food_and_drinks/food/foods/bread.dm +++ b/code/modules/food_and_drinks/food/foods/bread.dm @@ -166,6 +166,15 @@ list_reagents = list("nutriment" = 2, "vitamin" = 2) tastes = list("bread" = 2) +/obj/item/reagent_containers/food/snacks/toast + name = "Toast" + desc = "Yeah! Toast!" + icon_state = "toast" + filling_color = "#B2580E" + bitesize = 3 + list_reagents = list("nutriment" = 3) + tastes = list("toast" = 2) + /obj/item/reagent_containers/food/snacks/jelliedtoast name = "Jellied Toast" desc = "A slice of bread covered with delicious jam." @@ -198,3 +207,5 @@ trash = /obj/item/trash/waffles filling_color = "#E6DEB5" list_reagents = list("nutriment" = 8, "vitamin" = 1) + + diff --git a/code/modules/food_and_drinks/food/foods/seafood.dm b/code/modules/food_and_drinks/food/foods/seafood.dm index b74ab0c3149..d4134ebe516 100644 --- a/code/modules/food_and_drinks/food/foods/seafood.dm +++ b/code/modules/food_and_drinks/food/foods/seafood.dm @@ -129,7 +129,7 @@ tastes = list("shrimp" = 1, "batter" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Ebi_maki - name = "ebi makiroll" + name = "ebi maki roll" desc = "A large unsliced roll of Ebi Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Ebi_maki" @@ -149,7 +149,7 @@ tastes = list("shrimp" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Ikura_maki - name = "ikura makiroll" + name = "ikura maki roll" desc = "A large unsliced roll of Ikura Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Ikura_maki" @@ -169,7 +169,7 @@ tastes = list("salmon roe" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Sake_maki - name = "sake makiroll" + name = "sake maki roll" desc = "A large unsliced roll of Sake Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Sake_maki" @@ -189,7 +189,7 @@ tastes = list("raw salmon" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/SmokedSalmon_maki - name = "smoked salmon makiroll" + name = "smoked salmon maki roll" desc = "A large unsliced roll of Smoked Salmon Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "SmokedSalmon_maki" @@ -209,7 +209,7 @@ tastes = list("smoked salmon" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Tamago_maki - name = "tamago makiroll" + name = "tamago maki roll" desc = "A large unsliced roll of Tamago Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Tamago_maki" @@ -229,7 +229,7 @@ tastes = list("egg" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Inari_maki - name = "inari makiroll" + name = "inari maki roll" desc = "A large unsliced roll of Inari Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Inari_maki" @@ -249,7 +249,7 @@ tastes = list("fried tofu" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Masago_maki - name = "masago makiroll" + name = "masago maki roll" desc = "A large unsliced roll of Masago Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Masago_maki" @@ -269,7 +269,7 @@ tastes = list("goldfish roe" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Tobiko_maki - name = "tobiko makiroll" + name = "tobiko maki roll" desc = "A large unsliced roll of Tobkio Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Tobiko_maki" @@ -289,7 +289,7 @@ tastes = list("shark roe" = 1, "rice" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/TobikoEgg_maki - name = "tobiko and egg makiroll" + name = "tobiko and egg maki roll" desc = "A large unsliced roll of Tobkio and Egg Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "TobikoEgg_maki" @@ -309,7 +309,7 @@ tastes = list("shark roe" = 1, "rice" = 1, "egg" = 1, "seaweed" = 1) /obj/item/reagent_containers/food/snacks/sliceable/Tai_maki - name = "tai makiroll" + name = "tai maki roll" desc = "A large unsliced roll of Tai Sushi." icon = 'icons/obj/food/seafood.dmi' icon_state = "Tai_maki" diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index 61f887e44bc..6891ab578bc 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -175,7 +175,7 @@ if(default_unfasten_wrench(user, O)) return - default_deconstruction_crowbar(user, O) + default_deconstruction_crowbar(user, O) var/obj/item/what = O diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 756d2cf77ef..346b78e5b26 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -602,7 +602,7 @@ if(stat & (NOPOWER|BROKEN)) return 0 if(usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) - if(!allowed(usr) && !emagged && locked != -1 && href_list["vend"]) + if(!allowed(usr) && !emagged && locked != -1 && scan_id && href_list["vend"]) to_chat(usr, "Access denied.") SSnanoui.update_uis(src) return 0 diff --git a/code/modules/food_and_drinks/recipes/tablecraft/recipes_table.dm b/code/modules/food_and_drinks/recipes/tablecraft/recipes_table.dm index db7774fa41f..1aa33cab232 100644 --- a/code/modules/food_and_drinks/recipes/tablecraft/recipes_table.dm +++ b/code/modules/food_and_drinks/recipes/tablecraft/recipes_table.dm @@ -90,7 +90,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/Ebi_maki - name = "Ebi Makiroll" + name = "Ebi Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/reagent_containers/food/snacks/boiled_shrimp = 4, @@ -111,7 +111,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/Ikura_maki - name = "Ikura Makiroll" + name = "Ikura Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/fish_eggs/salmon = 4, @@ -132,7 +132,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/Inari_maki - name = "Inari Makiroll" + name = "Inari Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/reagent_containers/food/snacks/fried_tofu = 4, @@ -153,7 +153,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/Sake_maki - name = "Sake Makiroll" + name = "Sake Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/reagent_containers/food/snacks/salmonmeat = 4, @@ -174,7 +174,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/SmokedSalmon_maki - name = "Smoked Salmon Makiroll" + name = "Smoked Salmon Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/reagent_containers/food/snacks/salmonsteak = 4, @@ -195,7 +195,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/Masago_maki - name = "Masago Makiroll" + name = "Masago Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/fish_eggs/goldfish = 4, @@ -216,7 +216,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/Tobiko_maki - name = "Tobiko Makiroll" + name = "Tobiko Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/fish_eggs/shark = 4, @@ -237,18 +237,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/TobikoEgg_maki - name = "Tobiko Makiroll" - reqs = list( - /obj/item/reagent_containers/food/snacks/sushi_Tobiko = 4, - /obj/item/reagent_containers/food/snacks/egg = 4, - ) - pathtools = list(/obj/item/kitchen/sushimat) - result = /obj/item/reagent_containers/food/snacks/sliceable/TobikoEgg_maki - category = CAT_FOOD - subcategory = CAT_SUSHI - -/datum/crafting_recipe/Sake_maki - name = "Sake Makiroll" + name = "Tobiko and Egg Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/sushi_Tobiko = 4, /obj/item/reagent_containers/food/snacks/egg = 4, @@ -269,7 +258,7 @@ subcategory = CAT_SUSHI /datum/crafting_recipe/Tai_maki - name = "Tai Makiroll" + name = "Tai Maki Roll" reqs = list( /obj/item/reagent_containers/food/snacks/boiledrice = 1, /obj/item/reagent_containers/food/snacks/catfishmeat = 4, diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index 7be44052729..9a7c8cca075 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -438,7 +438,7 @@ overlays += I return - var/offset = Floor(20/cards.len + 1) + var/offset = FLOOR(20/cards.len + 1, 1) var/matrix/M = matrix() if(direction) diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index c1b5e471315..bb25025cb7f 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -327,7 +327,7 @@ else if(href_list["create"]) var/amount = (text2num(href_list["amount"])) //Can't be outside these (if you change this keep a sane limit) - amount = Clamp(amount, 1, 10) + amount = clamp(amount, 1, 10) var/datum/design/D = locate(href_list["create"]) create_product(D, amount) updateUsrDialog() diff --git a/code/modules/hydroponics/gene_modder.dm b/code/modules/hydroponics/gene_modder.dm index d39a0168f14..7ce64f40b20 100644 --- a/code/modules/hydroponics/gene_modder.dm +++ b/code/modules/hydroponics/gene_modder.dm @@ -71,7 +71,7 @@ for(var/obj/item/stock_parts/micro_laser/ML in component_parts) var/wratemod = ML.rating * 2.5 - min_wrate = Floor(10-wratemod) // 7,5,2,0 Clamps at 0 and 10 You want this low + min_wrate = FLOOR(10-wratemod, 1) // 7,5,2,0 Clamps at 0 and 10 You want this low min_wchance = 67-(ML.rating*16) // 48,35,19,3 Clamps at 0 and 67 You want this low for(var/obj/item/circuitboard/plantgenes/vaultcheck in component_parts) if(istype(vaultcheck, /obj/item/circuitboard/plantgenes/vault)) // TRAIT_DUMB BOTANY TUTS diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index d86f6f8f4c5..adb43034bc2 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -40,7 +40,7 @@ for(var/datum/plant_gene/trait/T in seed.genes) T.on_new(src, newloc) seed.prepare_result(src) - transform *= TransformUsingVariable(seed.potency, 100, 0.5) //Makes the resulting produce's sprite larger or smaller based on potency! + transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5 //Makes the resulting produce's sprite larger or smaller based on potency! add_juice() /obj/item/reagent_containers/food/snacks/grown/Destroy() @@ -154,17 +154,11 @@ T.on_consume(src, usr) ..() -/obj/item/reagent_containers/food/snacks/grown/Crossed(atom/movable/AM, oldloc) - if(seed) - for(var/datum/plant_gene/trait/T in seed.genes) - T.on_cross(src, AM) - ..() - -/obj/item/reagent_containers/food/snacks/grown/on_trip(mob/living/carbon/human/H) - . = ..() - if(. && seed) - for(var/datum/plant_gene/trait/T in seed.genes) - T.on_slip(src, H) +/obj/item/reagent_containers/food/snacks/grown/after_slip(mob/living/carbon/human/H) + if(!seed) + return + for(var/datum/plant_gene/trait/T in seed.genes) + T.on_slip(src, H) // Glow gene procs /obj/item/reagent_containers/food/snacks/grown/generate_trash(atom/location) diff --git a/code/modules/hydroponics/grown/banana.dm b/code/modules/hydroponics/grown/banana.dm index dc78ff71335..0552f78ee92 100644 --- a/code/modules/hydroponics/grown/banana.dm +++ b/code/modules/hydroponics/grown/banana.dm @@ -118,12 +118,10 @@ /obj/item/grown/bananapeel/specialpeel //used by /obj/item/clothing/shoes/clown_shoes/banana_shoes name = "synthesized banana peel" desc = "A synthetic banana peel." - trip_stun = 2 - trip_weaken = 2 - trip_chance = 100 - trip_walksafe = FALSE - trip_verb = TV_SLIP -/obj/item/grown/bananapeel/specialpeel/on_trip(mob/living/carbon/human/H) - if(..()) - qdel(src) +/obj/item/grown/bananapeel/specialpeel/ComponentInitialize() + AddComponent(/datum/component/slippery, src, 2, 2, 100, 0, FALSE) + +/obj/item/grown/bananapeel/specialpeel/after_slip(mob/living/carbon/human/H) + . = ..() + qdel(src) diff --git a/code/modules/hydroponics/growninedible.dm b/code/modules/hydroponics/growninedible.dm index 14a4b42ca5f..f10b286469a 100644 --- a/code/modules/hydroponics/growninedible.dm +++ b/code/modules/hydroponics/growninedible.dm @@ -28,7 +28,7 @@ if(istype(src, seed.product)) // no adding reagents if it is just a trash item seed.prepare_result(src) - transform *= TransformUsingVariable(seed.potency, 100, 0.5) + transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5 add_juice() /obj/item/grown/Destroy() @@ -50,18 +50,11 @@ return 1 return 0 - -/obj/item/grown/Crossed(atom/movable/AM, oldloc) - if(seed) - for(var/datum/plant_gene/trait/T in seed.genes) - T.on_cross(src, AM) - ..() - -/obj/item/grown/on_trip(mob/living/carbon/human/H) - . = ..() - if(. && seed) - for(var/datum/plant_gene/trait/T in seed.genes) - T.on_slip(src, H) +/obj/item/grown/after_slip(mob/living/carbon/human/H) + if(!seed) + return + for(var/datum/plant_gene/trait/T in seed.genes) + T.on_slip(src, H) /obj/item/grown/throw_impact(atom/hit_atom) if(!..()) //was it caught by a mob? diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 0f41ba4b602..5bc63d4bace 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -888,7 +888,7 @@ /obj/machinery/hydroponics/wrench_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(wrenchable) if(using_irrigation) @@ -949,30 +949,30 @@ /// Tray Setters - The following procs adjust the tray or plants variables, and make sure that the stat doesn't go out of bounds./// /obj/machinery/hydroponics/proc/adjustNutri(adjustamt) - nutrilevel = Clamp(nutrilevel + adjustamt, 0, maxnutri) + nutrilevel = clamp(nutrilevel + adjustamt, 0, maxnutri) plant_hud_set_nutrient() /obj/machinery/hydroponics/proc/adjustWater(adjustamt) - waterlevel = Clamp(waterlevel + adjustamt, 0, maxwater) + waterlevel = clamp(waterlevel + adjustamt, 0, maxwater) plant_hud_set_water() if(adjustamt>0) adjustToxic(-round(adjustamt/4))//Toxicity dilutation code. The more water you put in, the lesser the toxin concentration. /obj/machinery/hydroponics/proc/adjustHealth(adjustamt) if(myseed && !dead) - plant_health = Clamp(plant_health + adjustamt, 0, myseed.endurance) + plant_health = clamp(plant_health + adjustamt, 0, myseed.endurance) plant_hud_set_health() /obj/machinery/hydroponics/proc/adjustToxic(adjustamt) - toxic = Clamp(toxic + adjustamt, 0, 100) + toxic = clamp(toxic + adjustamt, 0, 100) plant_hud_set_toxin() /obj/machinery/hydroponics/proc/adjustPests(adjustamt) - pestlevel = Clamp(pestlevel + adjustamt, 0, 10) + pestlevel = clamp(pestlevel + adjustamt, 0, 10) plant_hud_set_pest() /obj/machinery/hydroponics/proc/adjustWeeds(adjustamt) - weedlevel = Clamp(weedlevel + adjustamt, 0, 10) + weedlevel = clamp(weedlevel + adjustamt, 0, 10) plant_hud_set_weed() /obj/machinery/hydroponics/proc/spawnplant() // why would you put strange reagent in a hydro tray you monster I bet you also feed them blood diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index d20413d6331..a4c6fe7280d 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -175,9 +175,6 @@ /datum/plant_gene/trait/proc/on_consume(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/target) return -/datum/plant_gene/trait/proc/on_cross(obj/item/reagent_containers/food/snacks/grown/G, atom/target) - return - /datum/plant_gene/trait/proc/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/target) return @@ -217,11 +214,7 @@ stun_len = min(stun_len, 7) // No fun allowed - G.trip_stun = stun_len - G.trip_weaken = stun_len - G.trip_chance = 100 - G.trip_verb = TV_SLIP - G.trip_walksafe = FALSE + G.AddComponent(/datum/component/slippery, G, stun_len, stun_len, 100, 0, FALSE) /datum/plant_gene/trait/cell_charge // Cell recharging trait. Charges all mob's power cells to (potency*rate)% mark when eaten. diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 8cfc9b7d5f0..08ccac07062 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -182,7 +182,7 @@ /// Setters procs /// /obj/item/seeds/proc/adjust_yield(adjustamt) if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable - yield = Clamp(yield + adjustamt, 0, 10) + yield = clamp(yield + adjustamt, 0, 10) if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism)) yield = 1 // Mushrooms always have a minimum yield of 1. @@ -191,39 +191,39 @@ C.value = yield /obj/item/seeds/proc/adjust_lifespan(adjustamt) - lifespan = Clamp(lifespan + adjustamt, 10, 100) + lifespan = clamp(lifespan + adjustamt, 10, 100) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan) if(C) C.value = lifespan /obj/item/seeds/proc/adjust_endurance(adjustamt) - endurance = Clamp(endurance + adjustamt, 10, 100) + endurance = clamp(endurance + adjustamt, 10, 100) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance) if(C) C.value = endurance /obj/item/seeds/proc/adjust_production(adjustamt) if(yield != -1) - production = Clamp(production + adjustamt, 1, 10) + production = clamp(production + adjustamt, 1, 10) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production) if(C) C.value = production /obj/item/seeds/proc/adjust_potency(adjustamt) if(potency != -1) - potency = Clamp(potency + adjustamt, 0, 100) + potency = clamp(potency + adjustamt, 0, 100) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency) if(C) C.value = potency /obj/item/seeds/proc/adjust_weed_rate(adjustamt) - weed_rate = Clamp(weed_rate + adjustamt, 0, 10) + weed_rate = clamp(weed_rate + adjustamt, 0, 10) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate) if(C) C.value = weed_rate /obj/item/seeds/proc/adjust_weed_chance(adjustamt) - weed_chance = Clamp(weed_chance + adjustamt, 0, 67) + weed_chance = clamp(weed_chance + adjustamt, 0, 67) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance) if(C) C.value = weed_chance @@ -232,7 +232,7 @@ /obj/item/seeds/proc/set_yield(adjustamt) if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable - yield = Clamp(adjustamt, 0, 10) + yield = clamp(adjustamt, 0, 10) if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism)) yield = 1 // Mushrooms always have a minimum yield of 1. @@ -241,39 +241,39 @@ C.value = yield /obj/item/seeds/proc/set_lifespan(adjustamt) - lifespan = Clamp(adjustamt, 10, 100) + lifespan = clamp(adjustamt, 10, 100) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan) if(C) C.value = lifespan /obj/item/seeds/proc/set_endurance(adjustamt) - endurance = Clamp(adjustamt, 10, 100) + endurance = clamp(adjustamt, 10, 100) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance) if(C) C.value = endurance /obj/item/seeds/proc/set_production(adjustamt) if(yield != -1) - production = Clamp(adjustamt, 1, 10) + production = clamp(adjustamt, 1, 10) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production) if(C) C.value = production /obj/item/seeds/proc/set_potency(adjustamt) if(potency != -1) - potency = Clamp(adjustamt, 0, 100) + potency = clamp(adjustamt, 0, 100) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency) if(C) C.value = potency /obj/item/seeds/proc/set_weed_rate(adjustamt) - weed_rate = Clamp(adjustamt, 0, 10) + weed_rate = clamp(adjustamt, 0, 10) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate) if(C) C.value = weed_rate /obj/item/seeds/proc/set_weed_chance(adjustamt) - weed_chance = Clamp(adjustamt, 0, 67) + weed_chance = clamp(adjustamt, 0, 67) var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance) if(C) C.value = weed_chance diff --git a/code/modules/karma/karma.dm b/code/modules/karma/karma.dm index cccf9977ad6..837e3a21104 100644 --- a/code/modules/karma/karma.dm +++ b/code/modules/karma/karma.dm @@ -4,9 +4,9 @@ proc/sql_report_karma(var/mob/spender, var/mob/receiver) var/sqlspendername = sanitizeSQL(spender.name) - var/sqlspenderkey = spender.ckey + var/sqlspenderkey = sanitizeSQL(spender.ckey) var/sqlreceivername = sanitizeSQL(receiver.name) - var/sqlreceiverkey = receiver.ckey + var/sqlreceiverkey = sanitizeSQL(receiver.ckey) var/sqlreceiverrole = "None" var/sqlreceiverspecial = "None" @@ -28,7 +28,7 @@ proc/sql_report_karma(var/mob/spender, var/mob/receiver) log_game("SQL ERROR during karma logging. Error : \[[err]\]\n") - query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("karmatotals")] WHERE byondkey='[receiver.ckey]'") + query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("karmatotals")] WHERE byondkey='[sqlreceiverkey]'") query.Execute() var/karma @@ -38,7 +38,7 @@ proc/sql_report_karma(var/mob/spender, var/mob/receiver) karma = text2num(query.item[3]) if(karma == null) karma = 1 - query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("karmatotals")] (byondkey, karma) VALUES ('[receiver.ckey]', [karma])") + query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("karmatotals")] (byondkey, karma) VALUES ('[sqlreceiverkey]', [karma])") if(!query.Execute()) var/err = query.ErrorMsg() log_game("SQL ERROR during karmatotal logging (adding new key). Error : \[[err]\]\n") @@ -168,11 +168,12 @@ GLOBAL_LIST_EMPTY(karma_spenders) /client/proc/verify_karma() var/currentkarma = 0 + var/sanitzedkey = sanitizeSQL(src.ckey) if(!GLOB.dbcon.IsConnected()) to_chat(usr, "Unable to connect to karma database. Please try again later.
") return else - var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT karma, karmaspent FROM [format_table_name("karmatotals")] WHERE byondkey='[src.ckey]'") + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT karma, karmaspent FROM [format_table_name("karmatotals")] WHERE byondkey='[sanitzedkey]'") query.Execute() var/totalkarma @@ -195,6 +196,24 @@ GLOBAL_LIST_EMPTY(karma_spenders) karmashopmenu() /client/proc/karmashopmenu() + var/sanitzedkey = sanitizeSQL(usr.ckey) + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[sanitzedkey]'") + query.Execute() + + var/list/joblist + var/list/specieslist + var/dbjob + var/dbspecies + var/dbckey + while(query.NextRow()) + dbckey = query.item[2] + dbjob = query.item[3] + dbspecies = query.item[4] + + if(dbckey) + joblist = splittext(dbjob,",") + specieslist = splittext(dbspecies,",") + var/dat = "
" dat += "Job Unlocks" dat += "Species Unlocks" @@ -202,28 +221,69 @@ GLOBAL_LIST_EMPTY(karma_spenders) dat += "
" dat += "
" + var/currentkarma = verify_karma() + dat += "You have [currentkarma] available.

" + switch(karma_tab) if(0) // Job Unlocks - dat += {" - Unlock Barber -- 5KP
- Unlock Brig Physician -- 5KP
- Unlock Nanotrasen Representative -- 30KP
- Unlock Blueshield -- 30KP
- Unlock Security Pod Pilot -- 30KP
- Unlock Mechanic -- 30KP
- Unlock Magistrate -- 45KP
- "} + if(!("Barber" in joblist)) + dat += "Unlock Barber -- 5KP
" + else + dat += "Barber - Unlocked
" + if(!("Brig Physician" in joblist)) + dat += "Unlock Brig Physician -- 5KP
" + else + dat += "Brig Physician - Unlocked
" + if(!("Nanotrasen Representative" in joblist)) + dat += "Unlock Nanotrasen Representative -- 30KP
" + else + dat += "Nanotrasen Representative - Unlocked
" + if(!("Blueshield" in joblist)) + dat += "Unlock Blueshield -- 30KP
" + else + dat += "Blueshield - Unlocked
" + if(!("Security Pod Pilot" in joblist)) + dat += "Unlock Security Pod Pilot -- 30KP
" + else + dat += "Security Pod Pilot - Unlocked
" + if(!("Mechanic" in joblist)) + dat += "Unlock Mechanic -- 30KP
" + else + dat += "Mechanic - Unlocked
" + if(!("Magistrate" in joblist)) + dat += "Unlock Magistrate -- 45KP
" + else + dat+= "Magistrate - Unlocked
" if(1) // Species Unlocks - dat += {" - Unlock Machine People -- 15KP
- Unlock Kidan -- 30KP
- Unlock Grey -- 30KP
- Unlock Drask -- 30KP
- Unlock Vox -- 45KP
- Unlock Slime People -- 45KP
- Unlock Plasmaman -- 45KP
- "} + if(!("Machine" in specieslist)) + dat += "Unlock Machine People -- 15KP
" + else + dat += "Machine People - Unlocked
" + if(!("Kidan" in specieslist)) + dat += "Unlock Kidan -- 30KP
" + else + dat += "Kidan - Unlocked
" + if(!("Grey" in specieslist)) + dat += "Unlock Grey -- 30KP
" + else + dat += "Grey - Unlocked
" + if(!("Drask" in specieslist)) + dat += "Unlock Drask -- 30KP
" + else + dat += "Drask - Unlocked
" + if(!("Vox" in specieslist)) + dat += "Unlock Vox -- 45KP
" + else + dat += "Vox - Unlocked
" + if(!("Slime People" in specieslist)) + dat += "Unlock Slime People -- 45KP
" + else + dat += "Slime People - Unlocked
" + if(!("Plasmaman" in specieslist)) + dat += "Unlock Plasmaman -- 45KP
" + else + dat += "Plasmaman - Unlocked
" if(2) // Karma Refunds var/list/refundable = list() @@ -283,11 +343,14 @@ GLOBAL_LIST_EMPTY(karma_spenders) name = DBname if(category == "job") DB_job_unlock(name,price) + karmashopmenu() else if(category == "species") DB_species_unlock(name,price) + karmashopmenu() /client/proc/DB_job_unlock(var/job,var/cost) - var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[usr.ckey]'") + var/sanitzedkey = sanitizeSQL(usr.ckey) + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[sanitzedkey]'") query.Execute() var/dbjob @@ -296,7 +359,7 @@ GLOBAL_LIST_EMPTY(karma_spenders) dbckey = query.item[2] dbjob = query.item[3] if(!dbckey) - query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("whitelist")] (ckey, job) VALUES ('[usr.ckey]','[job]')") + query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("whitelist")] (ckey, job) VALUES ('[sanitzedkey]','[job]')") if(!query.Execute()) queryErrorLog(query.ErrorMsg(),"adding new key") return @@ -323,7 +386,8 @@ GLOBAL_LIST_EMPTY(karma_spenders) return /client/proc/DB_species_unlock(var/species,var/cost) - var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[usr.ckey]'") + var/sanitzedkey = sanitizeSQL(usr.ckey) + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[sanitzedkey]'") query.Execute() var/dbspecies @@ -332,7 +396,7 @@ GLOBAL_LIST_EMPTY(karma_spenders) dbckey = query.item[2] dbspecies = query.item[4] if(!dbckey) - query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("whitelist")] (ckey, species) VALUES ('[usr.ckey]','[species]')") + query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("whitelist")] (ckey, species) VALUES ('[sanitzedkey]','[species]')") if(!query.Execute()) queryErrorLog(query.ErrorMsg(),"adding new key") return @@ -359,7 +423,8 @@ GLOBAL_LIST_EMPTY(karma_spenders) return /client/proc/karmacharge(var/cost,var/refund = FALSE) - var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("karmatotals")] WHERE byondkey='[usr.ckey]'") + var/sanitzedkey = sanitizeSQL(usr.ckey) + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("karmatotals")] WHERE byondkey='[sanitzedkey]'") query.Execute() while(query.NextRow()) @@ -368,7 +433,7 @@ GLOBAL_LIST_EMPTY(karma_spenders) spent -= cost else spent += cost - query = GLOB.dbcon.NewQuery("UPDATE [format_table_name("karmatotals")] SET karmaspent=[spent] WHERE byondkey='[usr.ckey]'") + query = GLOB.dbcon.NewQuery("UPDATE [format_table_name("karmatotals")] SET karmaspent=[spent] WHERE byondkey='[sanitzedkey]'") if(!query.Execute()) queryErrorLog(query.ErrorMsg(),"updating existing entry") return @@ -378,6 +443,7 @@ GLOBAL_LIST_EMPTY(karma_spenders) return /client/proc/karmarefund(var/type,var/name,var/cost) + var/sanitzedkey = sanitizeSQL(usr.ckey) switch(name) if("Tajaran Ambassador","Unathi Ambassador","Skrell Ambassador","Diona Ambassador","Kidan Ambassador", "Slime People Ambassador","Grey Ambassador","Vox Ambassador","Customs Officer") @@ -388,7 +454,7 @@ GLOBAL_LIST_EMPTY(karma_spenders) to_chat(usr, "That job is not refundable.") return - var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[usr.ckey]'") + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[sanitzedkey]'") query.Execute() var/dbjob @@ -431,7 +497,8 @@ GLOBAL_LIST_EMPTY(karma_spenders) message_admins("SQL ERROR during whitelist logging ([errType]]). Error : \[[err]\]\n") /client/proc/checkpurchased(var/name = null) // If the first parameter is null, return a full list of purchases - var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[usr.ckey]'") + var/sanitzedkey = sanitizeSQL(usr.ckey) + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("whitelist")] WHERE ckey='[sanitzedkey]'") query.Execute() var/dbjob diff --git a/code/modules/library/computers/checkout.dm b/code/modules/library/computers/checkout.dm index 31eebc5d05c..5200c4bb00b 100644 --- a/code/modules/library/computers/checkout.dm +++ b/code/modules/library/computers/checkout.dm @@ -95,7 +95,7 @@ dat += "ERROR: Unable to contact External Archive. Please contact your system administrator for assistance." else num_results = src.get_num_results() - num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE) + num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1) dat += {""} @@ -224,13 +224,13 @@ else var/pn = text2num(href_list["pagenum"]) if(!isnull(pn)) - page_num = Clamp(pn, 1, num_pages) + page_num = clamp(pn, 1, num_pages) if(href_list["page"]) if(num_pages == 0) page_num = 1 else - page_num = Clamp(text2num(href_list["page"]), 1, num_pages) + page_num = clamp(text2num(href_list["page"]), 1, num_pages) if(href_list["settitle"]) var/newtitle = input("Enter a title to search for:") as text|null if(newtitle) @@ -252,7 +252,7 @@ if(href_list["search"]) num_results = src.get_num_results() - num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE) + num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1) page_num = 1 screenstate = 4 diff --git a/code/modules/library/computers/public.dm b/code/modules/library/computers/public.dm index f94369b11b7..3c5116bc074 100644 --- a/code/modules/library/computers/public.dm +++ b/code/modules/library/computers/public.dm @@ -75,7 +75,7 @@ else var/pn = text2num(href_list["pagenum"]) if(!isnull(pn)) - page_num = Clamp(pn, 1, num_pages) + page_num = clamp(pn, 1, num_pages) if(href_list["settitle"]) var/newtitle = input("Enter a title to search for:") as text|null @@ -100,11 +100,11 @@ if(num_pages == 0) page_num = 1 else - page_num = Clamp(text2num(href_list["page"]), 1, num_pages) + page_num = clamp(text2num(href_list["page"]), 1, num_pages) if(href_list["search"]) num_results = src.get_num_results() - num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE) + num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1) page_num = 1 screenstate = 1 diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index ff4bc517979..fa848700557 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -38,7 +38,7 @@ if(!light_power || !light_range) // We won't emit light anyways, destroy the light source. QDEL_NULL(light) else - if(!ismovableatom(loc)) // We choose what atom should be the top atom of the light here. + if(!ismovable(loc)) // We choose what atom should be the top atom of the light here. . = src else . = loc diff --git a/code/modules/lighting/lighting_corner.dm b/code/modules/lighting/lighting_corner.dm index bc521114d56..57302b5b168 100644 --- a/code/modules/lighting/lighting_corner.dm +++ b/code/modules/lighting/lighting_corner.dm @@ -25,7 +25,7 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, var/cache_b = LIGHTING_SOFT_THRESHOLD var/cache_mx = 0 -/datum/lighting_corner/New(var/turf/new_turf, var/diagonal) +/datum/lighting_corner/New(turf/new_turf, diagonal) . = ..() masters = list() masters[new_turf] = turn(diagonal, 180) @@ -79,15 +79,16 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, active = FALSE var/turf/T var/thing - for (thing in masters) + for(thing in masters) T = thing if(T.lighting_object) active = TRUE + return // God that was a mess, now to do the rest of the corner code! Hooray! -/datum/lighting_corner/proc/update_lumcount(var/delta_r, var/delta_g, var/delta_b) +/datum/lighting_corner/proc/update_lumcount(delta_r, delta_g, delta_b) - if((abs(delta_r)+abs(delta_g)+abs(delta_b)) == 0) + if(!(delta_r || delta_g || delta_b)) // 0 is falsey ok return lum_r += delta_r @@ -96,10 +97,10 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, if(!needs_update) needs_update = TRUE - GLOB.lighting_update_corners += src + SSlighting.corners_queue += src /datum/lighting_corner/proc/update_objects() - // Cache these values a head of time so 4 individual lighting objects don't all calculate them individually. + // Cache these values ahead of time so 4 individual lighting objects don't all calculate them individually. var/lum_r = src.lum_r var/lum_g = src.lum_g var/lum_b = src.lum_b @@ -122,19 +123,18 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, #endif cache_mx = round(mx, LIGHTING_ROUND_VALUE) - for (var/TT in masters) + for(var/TT in masters) var/turf/T = TT - if(T.lighting_object) - if(!T.lighting_object.needs_update) - T.lighting_object.needs_update = TRUE - GLOB.lighting_update_objects += T.lighting_object + if(T.lighting_object && !T.lighting_object.needs_update) + T.lighting_object.needs_update = TRUE + SSlighting.objects_queue += T.lighting_object /datum/lighting_corner/dummy/New() return -/datum/lighting_corner/Destroy(var/force) +/datum/lighting_corner/Destroy(force) if(!force) return QDEL_HINT_LETMELIVE diff --git a/code/modules/lighting/lighting_object.dm b/code/modules/lighting/lighting_object.dm index ea3e954fa6e..168a95c07f2 100644 --- a/code/modules/lighting/lighting_object.dm +++ b/code/modules/lighting/lighting_object.dm @@ -5,7 +5,7 @@ icon = LIGHTING_ICON icon_state = "transparent" - color = LIGHTING_BASE_MATRIX + color = null //we manually set color in init instead plane = LIGHTING_PLANE mouse_opacity = MOUSE_OPACITY_TRANSPARENT layer = LIGHTING_LAYER @@ -18,6 +18,9 @@ /atom/movable/lighting_object/Initialize(mapload) . = ..() verbs.Cut() + //We avoid setting this in the base as if we do then the parent atom handling will add_atom_color it and that + //is totally unsuitable for this object, as we are always changing it's colour manually + color = LIGHTING_BASE_MATRIX myturf = loc if(myturf.lighting_object) @@ -29,11 +32,11 @@ S.update_starlight() needs_update = TRUE - GLOB.lighting_update_objects += src + SSlighting.objects_queue += src -/atom/movable/lighting_object/Destroy(var/force) +/atom/movable/lighting_object/Destroy(force) if(force) - GLOB.lighting_update_objects -= src + SSlighting.objects_queue -= src if(loc != myturf) var/turf/oldturf = get_turf(myturf) var/turf/newturf = get_turf(loc) @@ -143,6 +146,6 @@ return // Override here to prevent things accidentally moving around overlays. -/atom/movable/lighting_object/forceMove(atom/destination, var/no_tp=FALSE, var/harderforce = FALSE) +/atom/movable/lighting_object/forceMove(atom/destination, no_tp = FALSE, harderforce = FALSE) if(harderforce) . = ..() diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index fc87a855dc4..7b0b782bdca 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -29,7 +29,7 @@ var/needs_update = LIGHTING_NO_UPDATE // Whether we are queued for an update. -/datum/light_source/New(var/atom/owner, var/atom/top) +/datum/light_source/New(atom/owner, atom/top) source_atom = owner // Set our new owner. LAZYADD(source_atom.light_sources, src) top_atom = top @@ -56,7 +56,7 @@ LAZYREMOVE(top_atom.light_sources, src) if(needs_update) - GLOB.lighting_update_lights -= src + SSlighting.sources_queue -= src . = ..() @@ -65,13 +65,13 @@ // Actually that'd be great if you could! #define EFFECT_UPDATE(level) \ if(needs_update == LIGHTING_NO_UPDATE) \ - GLOB.lighting_update_lights += src; \ + SSlighting.sources_queue += src; \ if(needs_update < level) \ needs_update = level; \ // This proc will cause the light source to update the top atom, and add itself to the update queue. -/datum/light_source/proc/update(var/atom/new_top_atom) +/datum/light_source/proc/update(atom/new_top_atom) // This top atom is different. if(new_top_atom && new_top_atom != top_atom) if(top_atom != source_atom && top_atom.light_sources) // Remove ourselves from the light sources of that top atom. @@ -141,7 +141,7 @@ effect_str = null -/datum/light_source/proc/recalc_corner(var/datum/lighting_corner/C) +/datum/light_source/proc/recalc_corner(datum/lighting_corner/C) LAZYINITLIST(effect_str) if(effect_str[C]) // Already have one. REMOVE_CORNER(C) diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index f368ff5ac4b..5483eebf4e1 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -57,7 +57,7 @@ C.active = TRUE // Used to get a scaled lumcount. -/turf/proc/get_lumcount(var/minlum = 0, var/maxlum = 1) +/turf/proc/get_lumcount(minlum = 0, maxlum = 1) if(!lighting_object) return 1 @@ -102,7 +102,7 @@ recalc_atom_opacity() // Make sure to do this before reconsider_lights(), incase we're on instant updates. reconsider_lights() -/turf/proc/change_area(var/area/old_area, var/area/new_area) +/turf/proc/change_area(area/old_area, area/new_area) if(SSlighting.initialized) if(new_area.dynamic_lighting != old_area.dynamic_lighting) if(new_area.dynamic_lighting) diff --git a/code/modules/logic/converter.dm b/code/modules/logic/converter.dm deleted file mode 100644 index c54e3fe4882..00000000000 --- a/code/modules/logic/converter.dm +++ /dev/null @@ -1,143 +0,0 @@ - -////////////////////////////////// -// Converter Gate // -////////////////////////////////// - -/* - This gate is special enough to warrant its own file, as it overrides a lot of the logic_gate procs as well as adds a new one. - - CONVERT Gates convert signaler and logic signals, to allow logic gates to actually be used in tandem with assemblies and station equipment like doors. - - While technically a mono-input device, the input and output are actually completely different types of signals, and thus incompatible without this gate. - - A signaler must be attached manually before the gate is fully functional, and will retain any frequency and code settings it had when attached. - - You can adjust these settings through a link in the multitool menu, but the receiving mode is automatically controlled by the converter. - - While attached, the ability to manually send the signal on the signaler through its menu is also disabled, to avoid messing up the logic system. -*/ - -//CONVERT Gate -/obj/machinery/logic_gate/convert - name = "CONVERT Gate" - desc = "Converts signals between radio and logic types, allowing for signaller input/output from logic systems." - icon_state = "logic_convert" - mono_input = 1 - - var/logic_output = 0 //When set to 1, the logic signal is the output. When set to 0, the logic signal is the input. - var/obj/item/assembly/signaler/attached_signaler = null - -/obj/machinery/logic_gate/convert/handle_logic() - output_state = input1_state - return - -/obj/machinery/logic_gate/convert/attackby(obj/item/O, mob/user, params) - if(tamperproof) //Extra precaution to avoid people attaching/removing signalers from tamperproofed converters - return - if(istype(O, /obj/item/assembly/signaler)) - var/obj/item/assembly/signaler/S = O - if(S.secured) - to_chat(user, "The [S] is already secured.") - return - if(attached_signaler) - to_chat(user, "There is already a device attached, remove it first.") - return - user.unEquip(S) - S.forceMove(src) - S.holder = src - S.toggle_secure() - if(logic_output) //Make sure we are set to receive if the converter is set to output logic, and send if the converter is set to accept logic input - S.receiving = 1 - else - S.receiving = 0 - attached_signaler = S - to_chat(user, "You attach \the [S] to the I/O connection port and secure it.") - return - if(attached_signaler && istype(O, /obj/item/screwdriver)) //Makes sure we remove the attached signaler before we can open up and deconstruct the machine - var/obj/item/assembly/signaler/S = attached_signaler - attached_signaler = null - S.forceMove(get_turf(src)) - S.holder = null - S.toggle_secure() - to_chat(user, "You unsecure and detach \the [S] from the I/O connection port.") - return - return ..() - -/obj/machinery/logic_gate/convert/multitool_menu(var/mob/user, var/obj/item/multitool/P) - var/logic_state_string - var/menu_contents = {" -
- "} - if(logic_output) - switch(output_state) - if(LOGIC_OFF) - logic_state_string = "OFF" - if(LOGIC_ON) - logic_state_string = "ON" - if(LOGIC_FLICKER) - logic_state_string = "FLICKER" - else - logic_state_string = "ERROR: UNKNOWN STATE" - menu_contents += {" -
Output: [format_tag("ID Tag","output_id_tag")]
-
Output State: [logic_state_string]
- "} - else - switch(input1_state) - if(LOGIC_OFF) - logic_state_string = "OFF" - if(LOGIC_ON) - logic_state_string = "ON" - if(LOGIC_FLICKER) - logic_state_string = "FLICKER" - else - logic_state_string = "ERROR: UNKNOWN STATE" - menu_contents += {" -
Input: [format_tag("ID Tag","input1_id_tag")]
-
Input State: [logic_state_string]
- "} - menu_contents += {" -
Logic Signal Designation: [logic_output ? "Output" : "Input"]
- "} - if(attached_signaler) - menu_contents += "
Adjust Signaler Settings
" - else - menu_contents += "
NO SIGNALER ATTACHED!
" - menu_contents += {" -
- "} - return menu_contents - -/obj/machinery/logic_gate/convert/multitool_topic(var/mob/user,var/list/href_list,var/obj/O) - ..() - if("toggle_logic" in href_list) - logic_output = !logic_output - if(attached_signaler) //If we have a signaler attached, make sure we update it to send/receive when we change the logic signal desgination - if(logic_output) - attached_signaler.receiving = 1 - else - attached_signaler.receiving = 0 - if(("adjust_signaler" in href_list) && attached_signaler) //Make sure that we have a signaler attached to handle this one, otherwise ignore this command - attached_signaler.interact(user, 1) - update_multitool_menu(user) - -/obj/machinery/logic_gate/convert/receive_signal(datum/signal/signal, receive_method, receive_param) - if(logic_output) - if(attached_signaler) - attached_signaler.receive_signal(signal) - return - else - ..() - -/obj/machinery/logic_gate/convert/handle_output() - if(logic_output) - ..() - else - if(attached_signaler && (output_state == LOGIC_ON || output_state == LOGIC_FLICKER)) - attached_signaler.signal() - return - -/obj/machinery/logic_gate/convert/proc/process_activation(var/obj/item/D) - if(!logic_output) //Don't bother if our input is a logic signal - return - if(D == attached_signaler) //Ignore if we somehow got called by a device that isn't what we have attached - input1_state = LOGIC_FLICKER - spawn(LOGIC_FLICKER_TIME) - if(input1_state == LOGIC_FLICKER) - input1_state = LOGIC_OFF - return diff --git a/code/modules/logic/dual_input.dm b/code/modules/logic/dual_input.dm deleted file mode 100644 index b8f915ff46d..00000000000 --- a/code/modules/logic/dual_input.dm +++ /dev/null @@ -1,100 +0,0 @@ - -////////////////////////////////// -// Dual-Input Gates // -////////////////////////////////// - - -// OR Gate -/obj/machinery/logic_gate/or - name = "OR Gate" - desc = "Outputs ON when at least one input is ON." - icon_state = "logic_or" - -/obj/machinery/logic_gate/or/handle_logic() - if(input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER || input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER) - if(input1_state == LOGIC_ON || input2_state == LOGIC_ON) //continuous signal takes priority in determining what to output - output_state = LOGIC_ON - else - output_state = LOGIC_FLICKER - else //Both inputs were off, so input is off - output_state = LOGIC_OFF - return - -// AND Gate -/obj/machinery/logic_gate/and - name = "AND Gate" - desc = "Outputs ON only when both inputs are ON." - icon_state = "logic_and" - -/obj/machinery/logic_gate/and/handle_logic() - if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER)) - if(input1_state == LOGIC_ON && input2_state == LOGIC_ON) //only output a continuous signal when both inputs are continuous signals - output_state = LOGIC_ON - else - output_state = LOGIC_FLICKER - else //At least one input was off, so output is off - output_state = LOGIC_OFF - return - -// NAND Gate -/obj/machinery/logic_gate/nand - name = "NAND Gate" - desc = "Outputs OFF only when both inputs are ON." - output_state = LOGIC_ON - icon_state = "logic_nand" - -/obj/machinery/logic_gate/nand/handle_logic() - if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER)) - output_state = LOGIC_OFF //Both inputs are ON/FLICKER, so output is off - else - output_state = LOGIC_ON //This can only output continuous signals - return - -// NOR Gate -/obj/machinery/logic_gate/nor - name = "NOR Gate" - desc = "Outputs OFF when at least one input is ON." - icon_state = "logic_nor" - output_state = LOGIC_ON - -/obj/machinery/logic_gate/nor/handle_logic() - if(input1_state == LOGIC_OFF && input2_state == LOGIC_OFF) //Both inputs are OFF, so output is ON - output_state = LOGIC_ON //This can only output continuous signals - else - output_state = LOGIC_OFF - return - -// XOR Gate -/obj/machinery/logic_gate/xor - name = "XOR Gate" - desc = "Outputs ON when only one input is ON." - icon_state = "logic_xor" - -/obj/machinery/logic_gate/xor/handle_logic() - if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_OFF)) //Only input1 is ON/FLICKER, so output matches input1 - output_state = input1_state - else if((input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER) && (input1_state == LOGIC_OFF)) //Only input2 is ON/FLICKER, so output matches input2 - output_state = input2_state - else //Both inputs are ON or OFF, so output is OFF - output_state = LOGIC_OFF - return - - -// XNOR Gate -/obj/machinery/logic_gate/xnor - name = "XNOR Gate" - desc = "Outputs ON when both inputs are ON or OFF." - icon_state = "logic_xnor" - output_state = LOGIC_ON - -/obj/machinery/logic_gate/xnor/handle_logic() - if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER)) //Both inputs are ON/FLICKER - if(input1_state == LOGIC_ON && input2_state == LOGIC_ON) //Only continuous signal when both inputs are ON - output_state = LOGIC_ON - else //If at least one input is FLICKER, output FLICKER - output_state = LOGIC_FLICKER - else if(input1_state == LOGIC_OFF && input2_state == LOGIC_OFF) //Both inputs are OFF - output_state = LOGIC_ON //Always continuous in this case - else //Only one input is ON/FLICKER - output_state = LOGIC_OFF - return diff --git a/code/modules/logic/logic_base.dm b/code/modules/logic/logic_base.dm deleted file mode 100644 index 542cb09bc7f..00000000000 --- a/code/modules/logic/logic_base.dm +++ /dev/null @@ -1,284 +0,0 @@ - -/obj/machinery/logic_gate - name = "Logic Base" - desc = "This does nothing except connect to things. Highly illogical, report to a coder at once if you see this in-game." - icon = 'icons/obj/computer3.dmi' - icon_state = "serverframe" - density = 1 - anchored = 1 - - settagwhitelist = list("input1_id_tag", "input2_id_tag", "output_id_tag") - - var/tamperproof = 0 //if set, will make the machine unable to be destroyed, adjusted, etc. via in-game interaction (USE ONLY FOR MAPPING STUFF) - var/mono_input = 0 //if set, will ignore input2 - - var/datum/radio_frequency/radio_connection - var/frequency = 0 - - /* - Some notes on Input/Output: - - Multiple things can be linked to the same input or output tag, just like how wires can connect multiple sources and receivers. - - For inputs, only the last signal received BEFORE a process() call will be used in the logic handling. - - Input states are updated immediately whenever an input signal is received, so it is possible to update multiple times within a single process cycle. - - This means if you have multiple connected inputs, but the last signal received before the process() call is OFF, it won't matter if the others are both ON. - - For this reason, please set up your logic properly. You can theoretically chain these infinitely, so there's no need to link multiple things to a single input. - - For outputs, the signal will attempt to be sent out every process() call, to ensure newly connected things are updated within one process cycle - - Connecting an output to multiple inputs should not cause issues, as long as you don't have multiple connections to a given input (see previous notes on inputs). - - The output state is determined immediately preceeding the signal broadcast, using the input states at the time of the process() call, not when a signal is received. - - Because of how the process cycle works, it is possible that it may take multiple cycles for a signal to fully propogate through a logic chain. - - This is because machines attempt to process in the order they were added to the scheduler. - - Building the logic gates at the end of the chain first may cause delays in signal propogation. - If you take all this into consideration when linking and using logic machinery, you should have no unexpected issues with input/output. Your design flaws are on you though. - */ - - var/input1_id_tag = null - var/input1_state = LOGIC_OFF - var/input2_id_tag = null - var/input2_state = LOGIC_OFF - var/output_id_tag = null - var/output_state = LOGIC_OFF - -/obj/machinery/logic_gate/New() - if(tamperproof) //doing this during New so we don't have to worry about forgetting to set these vars during editting / defining - resistance_flags |= ACID_PROOF - ..() - if(SSradio) - set_frequency(frequency) - component_parts = list() - var/obj/item/circuitboard/logic_gate/LG = new(null) - LG.set_type(type) - component_parts += LG - component_parts += new /obj/item/stack/cable_coil(null, 1) - -/obj/machinery/logic_gate/Initialize() - ..() - set_frequency(frequency) - -/obj/machinery/logic_gate/proc/set_frequency(new_frequency) - SSradio.remove_object(src, frequency) - frequency = new_frequency - radio_connection = SSradio.add_object(src, frequency, RADIO_LOGIC) - return - -/obj/machinery/logic_gate/Destroy() - if(SSradio) - SSradio.remove_object(src, frequency) - radio_connection = null - return ..() - -/obj/machinery/logic_gate/process() - handle_logic() - handle_output() //All output will send for at least one cycle, and will attempt to send every cycle. Hopefully this won't be too taxing. - return - -/obj/machinery/logic_gate/proc/handle_logic() - return - -/obj/machinery/logic_gate/proc/handle_output() - if(!radio_connection) //can't output without this - return - - if(output_id_tag == null) //Don't output to an undefined id_tag - return - - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src - - signal.data = list( - "tag" = output_id_tag, - "sigtype" = "logic", - "state" = output_state, - ) - - radio_connection.post_signal(src, signal, filter = RADIO_LOGIC) - -/obj/machinery/logic_gate/receive_signal(datum/signal/signal, receive_method, receive_param) - if(!signal.data["tag"] || ((signal.data["tag"] != input1_id_tag) && (signal.data["tag"] != input2_id_tag)) || (signal.data["sigtype"] != "logic")) - //If the signal lacks tag data, the signal's tag data doesn't match either input id tag, or is not a "logic" signal, ignore it since it's not for us - return - - if(signal.data["tag"] == input1_id_tag) //If the signal is for input1 - if(signal.data["state"] == input1_state) //If we already match, ignore the new signal since nothing changes - return - if(signal.data["state"] == LOGIC_OFF) //Shut it down and keep it off - input1_state = LOGIC_OFF - return - if(signal.data["state"] == LOGIC_ON) //Turn it on and keep it on - input1_state = LOGIC_ON - return - if(signal.data["state"] == LOGIC_FLICKER) //Turn it on then turn it off - if(input1_state == LOGIC_ON) //An existing continuous ON state overrides new flicker signals - return - input1_state = LOGIC_FLICKER - spawn(LOGIC_FLICKER_TIME) - if(input1_state == LOGIC_FLICKER) //Make sure we didn't get a new continuous signal set while we waited (those take priority) - input1_state = LOGIC_OFF - return - - //Now, you may be wondering why I included those returns. - //The answer is "If you link both inputs to the same source, you're an idiot and deserve to have it break", so yeah. Deal with it. - - if(mono_input) - //We only care about input1, so if we didn't receive a signal for that, we're done. - return - - if(signal.data["tag"] == input2_id_tag) //If the signal is for input2 (reaching this point assumes mono_input is not set) - if(signal.data["state"] == input2_state) //If we already match, ignore the new signal since nothing changes - return - if(signal.data["state"] == LOGIC_OFF) //Shut it down and keep it off - input2_state = LOGIC_OFF - return - if(signal.data["state"] == LOGIC_ON) //Turn it on and keep it on - input2_state = LOGIC_ON - return - if(signal.data["state"] == LOGIC_FLICKER) //Turn it on then turn it off - if(input2_state == LOGIC_ON) //An existing continuous ON state overrides new flicker signals - return - input2_state = LOGIC_FLICKER - spawn(LOGIC_FLICKER_TIME) - if(input2_state == LOGIC_FLICKER) //Make sure we didn't get a new continuous signal set while we waited (those take priority) - input2_state = LOGIC_OFF - return - -/obj/machinery/logic_gate/multitool_menu(var/mob/user, var/obj/item/multitool/P) - var/input1_state_string - var/input2_state_string - var/output_state_string - - switch(input1_state) - if(LOGIC_OFF) - input1_state_string = "OFF" - if(LOGIC_ON) - input1_state_string = "ON" - if(LOGIC_FLICKER) - input1_state_string = "FLICKER" - else - input1_state_string = "ERROR: UNKNOWN STATE" - - switch(input2_state) - if(LOGIC_OFF) - input2_state_string = "OFF" - if(LOGIC_ON) - input2_state_string = "ON" - if(LOGIC_FLICKER) - input2_state_string = "FLICKER" - else - input2_state_string = "ERROR: UNKNOWN STATE" - - switch(output_state) - if(LOGIC_OFF) - output_state_string = "OFF" - if(LOGIC_ON) - output_state_string = "ON" - if(LOGIC_FLICKER) - output_state_string = "FLICKER" - else - output_state_string = "ERROR: UNKNOWN STATE" - var/menu_contents = {" -
-
Input: [format_tag("ID Tag","input1_id_tag")]
-
Input State: [input1_state_string]
- "} - if(!mono_input) - menu_contents = {" -
Input 1: [format_tag("ID Tag","input1_id_tag")]
-
Input 1 State: [input1_state_string]
-
Input 2: [format_tag("ID Tag","input2_id_tag")]
-
Input 2 State: [input2_state_string]
- "} - menu_contents += {" -
Output: [format_tag("ID Tag","output_id_tag")]
-
Output State: [output_state_string]
-
- "} - return menu_contents - -/obj/machinery/logic_gate/convert/multitool_topic(var/mob/user,var/list/href_list,var/obj/O) - ..() - update_multitool_menu(user) - -/obj/machinery/logic_gate/attackby(obj/item/O, mob/user, params) - if(tamperproof) - to_chat(user, "The [src] appears to be tamperproofed! You can't interact with it!") - return 0 - if(istype(O, /obj/item/multitool)) - update_multitool_menu(user) - return 1 - if(istype(O, /obj/item/screwdriver)) - panel_open = !panel_open - to_chat(user, "You [panel_open ? "open" : "close"] the access panel.") - return 1 - if(panel_open && istype(O, /obj/item/crowbar)) - default_deconstruction_crowbar(user, O) - return 1 - return ..() - -////////////////////////////////////// -// Attack procs // -////////////////////////////////////// - -/obj/machinery/logic_gate/attack_ai(mob/user) - if(tamperproof) - to_chat(user, "The [src] appears to be tamperproofed! You can't interface with it!") - return 0 - add_hiddenprint(user) - return ui_interact(user) - -/obj/machinery/logic_gate/attack_ghost(mob/user) - if(tamperproof) - to_chat(user, "The [src] appears to be tamperproofed! You can't haunt it!") - return 0 - return ui_interact(user) - -/obj/machinery/logic_gate/attack_hand(mob/user) - if(tamperproof) - to_chat(user, "The [src] appears to be tamperproofed! You can't interact with it!") - return 0 - . = ..() - if(.) - return 0 - return interact(user) - -/obj/machinery/logic_gate/attack_alien(mob/user) //No xeno logic, that's too silly. - to_chat(user, "The [src] appears to be too complex! You can't comprehend it and back off in fear!") - return 0 - -/obj/machinery/logic_gate/attack_animal(mob/user) //No animal logic either. - to_chat(user, "The [src] appears to be beyond your comprehension! You can't fathom it!") - return 0 - -/obj/machinery/logic_gate/attack_slime(mob/user) //No slime logic. Seriously. - to_chat(user, "The [src] appears to be beyond your gelatinous understanding! You ignore it!") - return 0 - -/obj/machinery/logic_gate/emp_act(severity) - if(tamperproof) - return 0 - ..() - -/obj/machinery/logic_gate/ex_act(severity) - if(tamperproof) - return 0 - ..() - -/obj/machinery/logic_gate/blob_act(obj/structure/blob/B) - if(!tamperproof) - return ..() - -/obj/machinery/logic_gate/singularity_act() - if(tamperproof) - //This is some top-level tamperproofing right here, that's for sure. It can even defy a singularity! - return 0 - ..() - -/obj/machinery/logic_gate/bullet_act() - if(tamperproof) - return 0 - ..() - -/obj/machinery/logic_gate/tesla_act(var/power) - if(tamperproof) - tesla_zap(src, 3, power) //If we're tamperproof, we'll just bounce the full shock of the tesla zap we got hit by, so it continues on normally without diminishing - return 0 - ..() diff --git a/code/modules/logic/mono_input.dm b/code/modules/logic/mono_input.dm deleted file mode 100644 index 58b76232fa0..00000000000 --- a/code/modules/logic/mono_input.dm +++ /dev/null @@ -1,62 +0,0 @@ - -////////////////////////////////// -// Mono-Input Gates // -////////////////////////////////// - -//NOT Gate -/obj/machinery/logic_gate/not - name = "NOT Gate" - desc = "Accepts one input and outputs the reverse state." - icon_state = "logic_not" - mono_input = 1 //NOT Gates are the simplest logic gate because they only utilize one input. - output_state = LOGIC_ON //Starts with an active output, since the input will be OFF at start -/* - A quick note regarding NOT Gates: - - Connecting multiple things to the input of a NOT Gate can cause weird behaviour due to updating both when it receives a signal and when it calls process(). - - This means it will attempt to output once for every logic machine connected to its input's own process() call. - - It will then attempt to output an additional time based on the current state when it comes to its own process() call. - - For this reason, it is HIGHLY RECOMMENDED that you only connect a single signal source to the input of a NOT Gate to avoid signal spasms. - - Connecting multiple things to the output of a NOT Gate should not cause this unusual behavior. -*/ -/obj/machinery/logic_gate/not/handle_logic() //Our output will always be a continuous signal, even with a FLICKER, it just will update the output when the FLICKER ends - if(input1_state == LOGIC_ON) //Output is OFF while input is ON - output_state = LOGIC_OFF - else if(input1_state == LOGIC_FLICKER) //Output is OFF while input is FLICKER, then output returns to ON when input returns to OFF - output_state = LOGIC_OFF - spawn(LOGIC_FLICKER_TIME + 1) //Call handle_logic again after this delay (the input should update from the spawn(LOGIC_FLICKER_TIME) in receive_signal() by then) - handle_logic() - else //Output is ON while input is OFF - output_state = LOGIC_ON - handle_output() - return - -//STATUS Gate -/obj/machinery/logic_gate/status - name = "Status Gate" - desc = "Accepts one input and outputs the same state, showing a colored light based on current state." - icon_state = "logic_status" - mono_input = 1 //STATUS Gate doesn't actually perform logic operations, but instead acts as a testing conduit. - -/* - STATUS Gates are largely a diagnostics tool, but I'm sure someone will still make a logic gate rave with them anyways. - - There is no need to actually connect an output for these to work, they just need an input to sample from. - - STATUS Gates attempt to update their lights whenever they receive a signal. -*/ - -/obj/machinery/logic_gate/status/receive_signal(datum/signal/signal, receive_method, receive_params) - ..() - handle_logic() //STATUS Gate calls handle_logic() when it receives a signal to update its light and output_state - -/obj/machinery/logic_gate/status/handle_logic() - output_state = input1_state //Output is equal to input, since it is simply a connection with an attached light - if(output_state == LOGIC_OFF) //Red light when OFF - set_light(2,2,"#ff0000") - return - if(output_state == LOGIC_ON) //Green light when ON - set_light(2,2,"#009933") - return - if(output_state == LOGIC_FLICKER) //Orange light when FLICKER, then update after LOGIC_FLICKER_TIME + 1 to reflect the changed state - set_light(2,2,"#ff9900") - spawn(LOGIC_FLICKER_TIME + 1) - handle_logic() - return diff --git a/code/modules/martial_arts/martial.dm b/code/modules/martial_arts/martial.dm index 64e7cba86cd..882da0a9387 100644 --- a/code/modules/martial_arts/martial.dm +++ b/code/modules/martial_arts/martial.dm @@ -227,7 +227,7 @@ /obj/item/twohanded/bostaff/attack(mob/target, mob/living/user) add_fingerprint(user) - if((CLUMSY in user.disabilities) && prob(50)) + if((CLUMSY in user.mutations) && prob(50)) to_chat(user, "You club yourself over the head with [src].") user.Weaken(3) if(ishuman(user)) @@ -275,7 +275,6 @@ return else return ..() - return ..() /obj/item/twohanded/bostaff/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) if(wielded) diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm index f21978db625..4af48e7050a 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -65,6 +65,8 @@ user.drop_l_hand() return var/datum/status_effect/crusher_damage/C = target.has_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) + if(!C) + C = target.apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) var/target_health = target.health ..() for(var/t in trophies) @@ -101,6 +103,8 @@ if(!CM || CM.hammer_synced != src || !L.remove_status_effect(STATUS_EFFECT_CRUSHERMARK)) return var/datum/status_effect/crusher_damage/C = L.has_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) + if(!C) + C = L.apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) var/target_health = L.health for(var/t in trophies) var/obj/item/crusher_trophy/T = t diff --git a/code/modules/mining/equipment/wormhole_jaunter.dm b/code/modules/mining/equipment/wormhole_jaunter.dm index 44462dedfda..43cce5904e3 100644 --- a/code/modules/mining/equipment/wormhole_jaunter.dm +++ b/code/modules/mining/equipment/wormhole_jaunter.dm @@ -26,7 +26,7 @@ /obj/item/wormhole_jaunter/proc/get_destinations(mob/user) var/list/destinations = list() - for(var/obj/item/radio/beacon/B in world) + for(var/obj/item/radio/beacon/B in GLOB.global_radios) var/turf/T = get_turf(B) if(is_station_level(T.z)) destinations += B diff --git a/code/modules/mining/lavaland/loot/ashdragon_loot.dm b/code/modules/mining/lavaland/loot/ashdragon_loot.dm index e9728bc7901..a0ea3eb7639 100644 --- a/code/modules/mining/lavaland/loot/ashdragon_loot.dm +++ b/code/modules/mining/lavaland/loot/ashdragon_loot.dm @@ -81,7 +81,7 @@ var/mob/dead/observer/current_spirits = list() for(var/mob/dead/observer/O in GLOB.player_list) - if((O.following in contents)) + if((O.orbiting in contents)) ghost_counter++ O.invisibility = 0 current_spirits |= O @@ -97,13 +97,13 @@ force = 0 var/ghost_counter = ghost_check() - force = Clamp((ghost_counter * 4), 0, 75) + force = clamp((ghost_counter * 4), 0, 75) user.visible_message("[user] strikes with the force of [ghost_counter] vengeful spirits!") ..() /obj/item/melee/ghost_sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) var/ghost_counter = ghost_check() - final_block_chance += Clamp((ghost_counter * 5), 0, 75) + final_block_chance += clamp((ghost_counter * 5), 0, 75) owner.visible_message("[owner] is protected by a ring of [ghost_counter] ghosts!") return ..() diff --git a/code/modules/mining/lavaland/loot/colossus_loot.dm b/code/modules/mining/lavaland/loot/colossus_loot.dm index ac4d6a1e551..0bde4d95464 100644 --- a/code/modules/mining/lavaland/loot/colossus_loot.dm +++ b/code/modules/mining/lavaland/loot/colossus_loot.dm @@ -306,7 +306,7 @@ if(H.stat == DEAD) H.set_species(/datum/species/shadow) H.revive() - H.disabilities |= NOCLONE //Free revives, but significantly limits your options for reviving except via the crystal + H.mutations |= NOCLONE //Free revives, but significantly limits your options for reviving except via the crystal H.grab_ghost(force = TRUE) /obj/machinery/anomalous_crystal/helpers //Lets ghost spawn as helpful creatures that can only heal people slightly. Incredibly fragile and they can't converse with humans @@ -458,7 +458,7 @@ if(isliving(A) && holder_animal) var/mob/living/L = A L.notransform = 1 - L.disabilities |= MUTE + L.mutations |= MUTE L.status_flags |= GODMODE L.mind.transfer_to(holder_animal) var/obj/effect/proc_holder/spell/targeted/exit_possession/P = new /obj/effect/proc_holder/spell/targeted/exit_possession @@ -468,7 +468,7 @@ /obj/structure/closet/stasis/dump_contents(var/kill = 1) STOP_PROCESSING(SSobj, src) for(var/mob/living/L in src) - L.disabilities &= ~MUTE + L.mutations -=MUTE L.status_flags &= ~GODMODE L.notransform = 0 if(holder_animal && !QDELETED(holder_animal)) diff --git a/code/modules/mining/lavaland/loot/hierophant_loot.dm b/code/modules/mining/lavaland/loot/hierophant_loot.dm index a3f6e738380..fc81e6399ae 100644 --- a/code/modules/mining/lavaland/loot/hierophant_loot.dm +++ b/code/modules/mining/lavaland/loot/hierophant_loot.dm @@ -93,7 +93,7 @@ blast_range = initial(blast_range) if(isliving(user)) var/mob/living/L = user - var/health_percent = L.health / L.maxHealth + var/health_percent = max(L.health / L.maxHealth, 0) // Don't go negative chaser_cooldown += round(health_percent * 20) //two tenths of a second for each missing 10% of health cooldown_time += round(health_percent * 10) //one tenth of a second for each missing 10% of health chaser_speed = max(chaser_speed + health_percent, 0.5) //one tenth of a second faster for each missing 10% of health diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 50cb7d09801..579df861c19 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -98,7 +98,7 @@ /obj/machinery/mineral/processing_unit/Destroy() CONSOLE = null QDEL_NULL(files) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() return ..() @@ -120,7 +120,7 @@ CONSOLE.updateUsrDialog() /obj/machinery/mineral/processing_unit/proc/process_ore(obj/item/stack/ore/O) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/material_amount = materials.get_item_material_amount(O) if(!materials.has_space(material_amount)) unload_mineral(O) @@ -132,7 +132,7 @@ /obj/machinery/mineral/processing_unit/proc/get_machine_data() var/dat = "Smelter control console

" - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/mat_id in materials.materials) var/datum/material/M = materials.materials[mat_id] dat += "[M.name]: [M.amount] cm³" @@ -165,7 +165,7 @@ return dat /obj/machinery/mineral/processing_unit/proc/smelt_ore() - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/datum/material/mat = materials.materials[selected_material] if(mat) var/sheets_to_remove = (mat.amount >= (MINERAL_MATERIAL_AMOUNT * SMELT_AMOUNT) ) ? SMELT_AMOUNT : round(mat.amount / MINERAL_MATERIAL_AMOUNT) @@ -187,7 +187,7 @@ on = FALSE return - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.use_amount(alloy.materials, amount) generate_mineral(alloy.build_path) @@ -198,7 +198,7 @@ var/build_amount = SMELT_AMOUNT - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/mat_id in D.materials) var/M = D.materials[mat_id] diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index ed955efda2c..9630395e0cd 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -67,7 +67,7 @@ /obj/machinery/mineral/ore_redemption/Destroy() QDEL_NULL(files) - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() return ..() @@ -92,7 +92,7 @@ if(O && O.refined_type) points += O.points * point_upgrade * O.amount - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/material_amount = materials.get_item_material_amount(O) if(!material_amount) @@ -111,7 +111,7 @@ var/build_amount = 0 - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/mat_id in D.materials) var/M = D.materials[mat_id] var/datum/material/redemption_mat = materials.materials[mat_id] @@ -147,7 +147,7 @@ var/has_minerals = FALSE var/mineral_name = null - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/mat_id in materials.materials) var/datum/material/M = materials.materials[mat_id] var/mineral_amount = M.amount / MINERAL_MATERIAL_AMOUNT @@ -221,7 +221,7 @@ . = TRUE if(!powered()) return - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return input_dir = turn(input_dir, -90) output_dir = turn(output_dir, -90) @@ -251,7 +251,7 @@ else dat += "No ID inserted. Insert ID.

" - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/mat_id in materials.materials) var/datum/material/M = materials.materials[mat_id] if(M.amount) @@ -302,7 +302,7 @@ /obj/machinery/mineral/ore_redemption/Topic(href, href_list) if(..()) return - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) if(href_list["eject_id"]) usr.put_in_hands(inserted_id) inserted_id = null diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 1198e2fb9d3..dbaa24fef34 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -101,7 +101,7 @@ if(user.a_intent != INTENT_HELP) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return I.melee_attack_chain(user, stored_gun) diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index 9fb73229ba7..9cabe4ac486 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -23,7 +23,7 @@ if(!T) return - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/obj/item/stack/sheet/O in T) materials.insert_stack(O, O.amount) @@ -32,7 +32,7 @@ return var/dat = "Coin Press
" - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) for(var/mat_id in materials.materials) var/datum/material/M = materials.materials[mat_id] if(!M.amount && chosen != mat_id) @@ -65,12 +65,12 @@ if(processing == 1) to_chat(usr, "The machine is processing.") return - GET_COMPONENT(materials, /datum/component/material_container) + var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) if(href_list["choose"]) if(materials.materials[href_list["choose"]]) chosen = href_list["choose"] if(href_list["chooseAmt"]) - coinsToProduce = Clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000) + coinsToProduce = clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000) if(href_list["makeCoins"]) var/temp_coins = coinsToProduce processing = TRUE diff --git a/code/modules/mob/camera/camera.dm b/code/modules/mob/camera/camera.dm index 39931a60fb2..090e5ddac1e 100644 --- a/code/modules/mob/camera/camera.dm +++ b/code/modules/mob/camera/camera.dm @@ -14,3 +14,8 @@ /mob/camera/experience_pressure_difference() return + +/mob/camera/forceMove(atom/destination) + var/oldloc = loc + loc = destination + Moved(oldloc, NONE) diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index 24f129ee387..f60777a97ff 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -15,7 +15,7 @@ onTransitZ(old_turf?.z, new_turf?.z) var/oldloc = loc loc = destination - Moved(oldloc, NONE, TRUE) + Moved(oldloc, NONE) /mob/dead/onTransitZ(old_z,new_z) ..() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 91a57e1ccbe..997920c8e23 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -23,7 +23,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) //If you died in the game and are a ghsot - this will remain as null. //Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot. universal_speak = TRUE - var/atom/movable/following = null var/image/ghostimage = null //this mobs ghost image, for deleting and stuff var/ghostvision = TRUE //is the ghost able to see things humans can't? var/seedarkness = TRUE @@ -91,10 +90,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) ..() /mob/dead/observer/Destroy() - if(ismob(following)) - var/mob/M = following - M.following_mobs -= src - following = null if(ghostimage) GLOB.ghost_images -= ghostimage QDEL_NULL(ghostimage) @@ -142,13 +137,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) Transfer_mind is there to check if mob is being deleted/not going to have a body. Works together with spawning an observer, noted above. */ -/mob/dead/observer/Life(seconds, times_fired) - ..() - if(!loc) return - if(!client) return 0 - - - /mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U) var/client/C = U.client for(var/mob/living/carbon/human/target in target_list) @@ -241,7 +229,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/Move(NewLoc, direct) update_parallax_contents() - following = null setDir(direct) ghostimage.setDir(dir) @@ -423,7 +410,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp forceMove(pick(L)) update_parallax_contents() - following = null /mob/dead/observer/verb/follow() set category = "Ghost" @@ -435,7 +421,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp A.on_close(CALLBACK(src, .proc/ManualFollow)) // This is the ghost's follow verb with an argument -/mob/dead/observer/proc/ManualFollow(var/atom/movable/target) +/mob/dead/observer/proc/ManualFollow(atom/movable/target) if(!target || !isobserver(usr)) return @@ -443,7 +429,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return if(target != src) - if(following && following == target) + if(orbiting && orbiting == target) return var/icon/I = icon(target.icon,target.icon_state,target.dir) @@ -469,7 +455,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp else //Circular rot_seg = 36 //360/10 bby, smooth enough aproximation of a circle - following = target to_chat(src, "Now following [target]") orbit(target,orbitsize, FALSE, 20, rot_seg) @@ -477,28 +462,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp setDir(2)//reset dir so the right directional sprites show up return ..() -/mob/proc/update_following() - . = get_turf(src) - for(var/mob/dead/observer/M in following_mobs) - if(M.following != src) - following_mobs -= M - else - if(M.loc != .) - M.forceMove(.) - -/mob - var/list/following_mobs = list() - -/mob/Move() - . = ..() - if(.) - update_following() - -/mob/Life(seconds, times_fired) - // to catch teleports etc which directly set loc - update_following() - return ..() - /mob/dead/observer/verb/jumptomob() //Moves the ghost instead of just changing the ghosts's eye -Nodrak set category = "Ghost" set name = "Jump to Mob" @@ -518,7 +481,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(T && isturf(T)) //Make sure the turf exists, then move the source to that destination. A.forceMove(T) M.update_parallax_contents() - following = null return to_chat(A, "This mob is not located in the game world.") @@ -649,7 +611,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/Topic(href, href_list) if(usr != src) return - ..() if(href_list["track"]) var/atom/target = locate(href_list["track"]) @@ -676,7 +637,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(!client) return forceMove(T) - following = null if(href_list["reenter"]) reenter_corpse() diff --git a/code/modules/mob/holder.dm b/code/modules/mob/holder.dm index ee9a3c3cca2..f89d19afaac 100644 --- a/code/modules/mob/holder.dm +++ b/code/modules/mob/holder.dm @@ -22,7 +22,6 @@ var/atom/movable/mob_container mob_container = M mob_container.forceMove(get_turf(src)) - M.reset_perspective() qdel(src) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 6d96d77c321..8f4f4dbb2da 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -214,9 +214,9 @@ if(M.equip_to_appropriate_slot(src)) if(M.hand) - M.update_inv_l_hand(0) + M.update_inv_l_hand() else - M.update_inv_r_hand(0) + M.update_inv_r_hand() return 1 if(M.s_active && M.s_active.can_be_inserted(src, 1)) //if storage active insert there diff --git a/code/modules/mob/language.dm b/code/modules/mob/language.dm index 8445dec51ee..92d936227cc 100644 --- a/code/modules/mob/language.dm +++ b/code/modules/mob/language.dm @@ -33,7 +33,7 @@ for(var/i = 0;i0;x--) + for(var/x = rand(FLOOR(syllable_count/2, 1),syllable_count);x>0;x--) new_name += pick(syllables) full_name += " [capitalize(lowertext(new_name))]" @@ -619,7 +619,7 @@ var/message_start_dead = "[name], [speaker.name] ([ghost_follow_link(speaker, ghost=M)])" M.show_message("[message_start_dead] [message_body]", 2) - for(var/mob/living/S in GLOB.living_mob_list) + for(var/mob/living/S in GLOB.alive_mob_list) if(drone_only && !istype(S,/mob/living/silicon/robot/drone)) continue else if(isAI(S)) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 1b85c3e5386..b12f62623e8 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -26,6 +26,8 @@ var/death_sound = 'sound/voice/hiss6.ogg' /mob/living/carbon/alien/New() + ..() + create_reagents(1000) verbs += /mob/living/verb/mob_sleep verbs += /mob/living/verb/lay_down alien_organs += new /obj/item/organ/internal/brain/xeno @@ -33,7 +35,6 @@ alien_organs += new /obj/item/organ/internal/ears for(var/obj/item/organ/internal/I in alien_organs) I.insert(src) - ..() /mob/living/carbon/alien/get_default_language() if(default_language) @@ -67,18 +68,6 @@ /mob/living/carbon/alien/check_eye_prot() return 2 -/mob/living/carbon/alien/updatehealth(reason = "none given") - if(status_flags & GODMODE) - health = maxHealth - stat = CONSCIOUS - return - health = maxHealth - getOxyLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() - - update_stat("updatehealth([reason])") - med_hud_set_health() - med_hud_set_status() - handle_hud_icons_health() - /mob/living/carbon/alien/handle_environment(var/datum/gas_mixture/environment) if(!environment) @@ -118,12 +107,6 @@ else clear_alert("alien_fire") -/mob/living/carbon/alien/handle_fire()//Aliens on fire code - if(..()) - return - bodytemperature += BODYTEMP_HEATING_MAX //If you're on fire, you heat up! - return - /mob/living/carbon/alien/IsAdvancedToolUser() return has_fine_manipulation @@ -243,7 +226,7 @@ Des: Removes all infected images from the alien. /mob/living/carbon/alien/handle_footstep(turf/T) if(..()) - if(T.footstep_sounds["xeno"]) + if(T.footstep_sounds && T.footstep_sounds["xeno"]) var/S = pick(T.footstep_sounds["xeno"]) if(S) if(m_intent == MOVE_INTENT_RUN) diff --git a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm index 1ea256357e9..fec3012529e 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm @@ -167,4 +167,4 @@ Doesn't work on other aliens/AI.*/ adjustPlasma(-amount) return 1 - return 0 + return 0 diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm index 2d894ee357e..99900183185 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm @@ -6,7 +6,6 @@ icon_state = "aliend_s" /mob/living/carbon/alien/humanoid/drone/New() - create_reagents(100) if(src.name == "alien drone") src.name = text("alien drone ([rand(1, 1000)])") src.real_name = src.name @@ -26,7 +25,7 @@ if(powerc(500)) // Queen check var/no_queen = 1 - for(var/mob/living/carbon/alien/humanoid/queen/Q in GLOB.living_mob_list) + for(var/mob/living/carbon/alien/humanoid/queen/Q in GLOB.alive_mob_list) if(!Q.key && Q.get_int_organ(/obj/item/organ/internal/brain/)) continue no_queen = 0 diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index 73931aa7be9..f23f9b7aa42 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -6,7 +6,6 @@ icon_state = "alienh_s" /mob/living/carbon/alien/humanoid/hunter/New() - create_reagents(100) if(name == "alien hunter") name = text("alien hunter ([rand(1, 1000)])") real_name = name @@ -17,28 +16,6 @@ . = -1 //hunters are sanic . += ..() //but they still need to slow down on stun -/mob/living/carbon/alien/humanoid/hunter/handle_hud_icons_health() - ..() //-Yvarov - - if(healths) - if(stat != 2) - switch(health) - if(125 to INFINITY) - healths.icon_state = "health0" - if(100 to 125) - healths.icon_state = "health1" - if(50 to 100) - healths.icon_state = "health2" - if(25 to 50) - healths.icon_state = "health3" - if(0 to 25) - healths.icon_state = "health4" - else - healths.icon_state = "health5" - else - healths.icon_state = "health6" - - /mob/living/carbon/alien/humanoid/hunter/handle_environment() if(m_intent == MOVE_INTENT_RUN || resting) ..() diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm index c436a43e4ff..4dd2d1b8569 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm @@ -33,7 +33,6 @@ overlays += I /mob/living/carbon/alien/humanoid/sentinel/New() - create_reagents(100) if(name == "alien sentinel") name = text("alien sentinel ([rand(1, 1000)])") real_name = name @@ -42,27 +41,6 @@ alien_organs += new /obj/item/organ/internal/xenos/neurotoxin ..() -/mob/living/carbon/alien/humanoid/sentinel/handle_hud_icons_health() - ..() //-Yvarov - - if(healths) - if(stat != 2) - switch(health) - if(150 to INFINITY) - healths.icon_state = "health0" - if(100 to 150) - healths.icon_state = "health1" - if(75 to 100) - healths.icon_state = "health2" - if(25 to 75) - healths.icon_state = "health3" - if(0 to 25) - healths.icon_state = "health4" - else - healths.icon_state = "health5" - else - healths.icon_state = "health6" - /* /mob/living/carbon/alien/humanoid/sentinel/verb/evolve() // -- TLE set name = "Evolve (250)" diff --git a/code/modules/mob/living/carbon/alien/humanoid/empress.dm b/code/modules/mob/living/carbon/alien/humanoid/empress.dm index a64602d030c..63514686f3d 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/empress.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/empress.dm @@ -30,17 +30,17 @@ overlays += I /mob/living/carbon/alien/humanoid/empress/New() - create_reagents(100) - //there should only be one queen - for(var/mob/living/carbon/alien/humanoid/empress/E in GLOB.living_mob_list) - if(E == src) continue - if(E.stat == DEAD) continue + for(var/mob/living/carbon/alien/humanoid/empress/E in GLOB.alive_mob_list) + if(E == src) + continue + if(E.stat == DEAD) + continue if(E.client) name = "alien grand princess ([rand(1, 999)])" //if this is too cutesy feel free to change it/remove it. break - real_name = src.name + real_name = name alien_organs += new /obj/item/organ/internal/xenos/plasmavessel/queen alien_organs += new /obj/item/organ/internal/xenos/acidgland alien_organs += new /obj/item/organ/internal/xenos/eggsac @@ -48,27 +48,6 @@ alien_organs += new /obj/item/organ/internal/xenos/neurotoxin ..() -/mob/living/carbon/alien/humanoid/empress/handle_hud_icons_health() - ..() //-Yvarov - - if(healths) - if(stat != 2) - switch(health) - if(250 to INFINITY) - healths.icon_state = "health0" - if(175 to 250) - healths.icon_state = "health1" - if(100 to 175) - healths.icon_state = "health2" - if(50 to 100) - healths.icon_state = "health3" - if(0 to 50) - healths.icon_state = "health4" - else - healths.icon_state = "health5" - else - healths.icon_state = "health6" - /mob/living/carbon/alien/humanoid/empress/verb/lay_egg() set name = "Lay Egg (250)" set desc = "Lay an egg to produce huggers to impregnate prey with." diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 63f6d3dcea9..e82488ee064 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -17,7 +17,6 @@ //This is fine right now, if we're adding organ specific damage this needs to be updated /mob/living/carbon/alien/humanoid/New() - create_reagents(1000) if(name == "alien") name = text("alien ([rand(1, 1000)])") real_name = name diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm index e7f783acd72..3174879caac 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -55,7 +55,7 @@ playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to disarm [src]!") -/mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) +/mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!no_effect && !visual_effect_icon) visual_effect_icon = ATTACK_EFFECT_CLAW ..() diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index 646f069970b..071987f808e 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -2,27 +2,6 @@ . = ..() update_icons() - - -/mob/living/carbon/alien/humanoid/handle_disabilities() - if(disabilities & EPILEPSY) - if((prob(1) && paralysis < 10)) - to_chat(src, "You have a seizure!") - Paralyse(10) - if(disabilities & COUGHING) - if((prob(5) && paralysis <= 1)) - drop_item() - emote("cough") - return - if(disabilities & TOURETTES) - if((prob(10) && paralysis <= 1)) - Stun(10) - emote("twitch") - return - if(disabilities & NERVOUS) - if(prob(10)) - stuttering = max(10, stuttering) - /mob/living/carbon/alien/humanoid/proc/adjust_body_temperature(current, loc_temp, boost) var/temperature = current var/difference = abs(current-loc_temp) //get difference @@ -39,51 +18,3 @@ temperature = max(loc_temp, temperature-change) temp_change = (temperature - current) return temp_change - -/mob/living/carbon/alien/humanoid/handle_regular_status_updates() - updatehealth() - - if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP - SetSilence(0) - else //ALIVE. LIGHTS ARE ON - if(health < HEALTH_THRESHOLD_DEAD && check_death_method() || !get_int_organ(/obj/item/organ/internal/brain)) - death() - SetSilence(0) - return 1 - - //UNCONSCIOUS. NO-ONE IS HOME - if((getOxyLoss() > 50) || (HEALTH_THRESHOLD_CRIT >= health && check_death_method())) - if(health <= 20 && prob(1)) - emote("gasp") - if(!reagents.has_reagent("epinephrine")) - adjustOxyLoss(1) - Paralyse(3) - - if(paralysis) - stat = UNCONSCIOUS - else if(sleeping) - stat = UNCONSCIOUS - if(prob(10) && health) - emote("hiss") - //CONSCIOUS - else - stat = CONSCIOUS - - /* What in the living hell is this?*/ - if(move_delay_add > 0) - move_delay_add = max(0, move_delay_add - rand(1, 2)) - - if(eye_blind) //blindness, heals slowly over time - AdjustEyeBlind(-1) - else if(eye_blurry) //blurry eyes heal slowly - AdjustEyeBlurry(-1) - - if(stuttering) - AdjustStuttering(-1) - - if(silent) - AdjustSilence(-1) - - if(druggy) - AdjustDruggy(-1) - return 1 diff --git a/code/modules/mob/living/carbon/alien/humanoid/queen.dm b/code/modules/mob/living/carbon/alien/humanoid/queen.dm index 9390885c558..3adb87ad505 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/queen.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/queen.dm @@ -11,12 +11,12 @@ pressure_resistance = 200 //Because big, stompy xenos should not be blown around like paper. /mob/living/carbon/alien/humanoid/queen/New() - create_reagents(100) - //there should only be one queen - for(var/mob/living/carbon/alien/humanoid/queen/Q in GLOB.living_mob_list) - if(Q == src) continue - if(Q.stat == DEAD) continue + for(var/mob/living/carbon/alien/humanoid/queen/Q in GLOB.alive_mob_list) + if(Q == src) + continue + if(Q.stat == DEAD) + continue if(Q.client) name = "alien princess ([rand(1, 999)])" //if this is too cutesy feel free to change it/remove it. break @@ -33,27 +33,6 @@ . = ..() . += 3 -/mob/living/carbon/alien/humanoid/queen/handle_hud_icons_health() - ..() //-Yvarov - - if(healths) - if(stat != DEAD) - switch(health) - if(250 to INFINITY) - healths.icon_state = "health0" - if(175 to 250) - healths.icon_state = "health1" - if(100 to 175) - healths.icon_state = "health2" - if(50 to 100) - healths.icon_state = "health3" - if(0 to 50) - healths.icon_state = "health4" - else - healths.icon_state = "health5" - else - healths.icon_state = "health6" - /mob/living/carbon/alien/humanoid/queen/can_inject(mob/user, error_msg, target_zone, penetrate_thick) return FALSE diff --git a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm index 4776f32596a..94c65095f01 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm @@ -56,13 +56,14 @@ /mob/living/carbon/alien/humanoid/regenerate_icons() ..() - if(notransform) return + if(notransform) + return - update_inv_head(0,0) - update_inv_wear_suit(0,0) - update_inv_r_hand(0) - update_inv_l_hand(0) - update_inv_pockets(0) + update_inv_head() + update_inv_wear_suit() + update_inv_r_hand() + update_inv_l_hand() + update_inv_pockets() update_icons() update_fire() update_transform() @@ -82,7 +83,7 @@ else overlays_standing[X_FIRE_LAYER] = null -/mob/living/carbon/alien/humanoid/update_inv_wear_suit(var/update_icons=1) +/mob/living/carbon/alien/humanoid/update_inv_wear_suit() if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_suit] inv.update_icon() @@ -110,10 +111,10 @@ overlays_standing[X_SUIT_LAYER] = standing else overlays_standing[X_SUIT_LAYER] = null - if(update_icons) update_icons() + update_icons() -/mob/living/carbon/alien/humanoid/update_inv_head(var/update_icons=1) +/mob/living/carbon/alien/humanoid/update_inv_head() if(head) var/t_state = head.item_state if(!t_state) t_state = head.icon_state @@ -124,17 +125,19 @@ overlays_standing[X_HEAD_LAYER] = standing else overlays_standing[X_HEAD_LAYER] = null - if(update_icons) update_icons() + update_icons() -/mob/living/carbon/alien/humanoid/update_inv_pockets(var/update_icons=1) - if(l_store) l_store.screen_loc = ui_storage1 - if(r_store) r_store.screen_loc = ui_storage2 - if(update_icons) update_icons() +/mob/living/carbon/alien/humanoid/update_inv_pockets() + if(l_store) + l_store.screen_loc = ui_storage1 + if(r_store) + r_store.screen_loc = ui_storage2 + update_icons() -/mob/living/carbon/alien/humanoid/update_inv_r_hand(var/update_icons=1) - ..(1) +/mob/living/carbon/alien/humanoid/update_inv_r_hand() + ..() if(r_hand) var/t_state = r_hand.item_state if(!t_state) t_state = r_hand.icon_state @@ -142,10 +145,10 @@ overlays_standing[X_R_HAND_LAYER] = image("icon" = r_hand.righthand_file, "icon_state" = t_state) else overlays_standing[X_R_HAND_LAYER] = null - if(update_icons) update_icons() + update_icons() -/mob/living/carbon/alien/humanoid/update_inv_l_hand(var/update_icons=1) - ..(1) +/mob/living/carbon/alien/humanoid/update_inv_l_hand() + ..() if(l_hand) var/t_state = l_hand.item_state if(!t_state) t_state = l_hand.icon_state @@ -153,7 +156,7 @@ overlays_standing[X_L_HAND_LAYER] = image("icon" = l_hand.lefthand_file, "icon_state" = t_state) else overlays_standing[X_L_HAND_LAYER] = null - if(update_icons) update_icons() + update_icons() //Xeno Overlays Indexes////////// diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index a55126ec045..aeee677b905 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -5,8 +5,8 @@ pass_flags = PASSTABLE | PASSMOB mob_size = MOB_SIZE_SMALL - maxHealth = 30 - health = 30 + maxHealth = 25 + health = 25 density = 0 var/amount_grown = 0 @@ -17,7 +17,6 @@ //This is fine right now, if we're adding organ specific damage this needs to be updated /mob/living/carbon/alien/larva/New() - create_reagents(100) if(name == "alien larva") name = "alien larva ([rand(1, 1000)])" real_name = name @@ -25,7 +24,6 @@ add_language("Xenomorph") add_language("Hivemind") alien_organs += new /obj/item/organ/internal/xenos/plasmavessel/larva - ..() //This needs to be fixed diff --git a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm index 69e12b6ae19..d13dab884b2 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -31,7 +31,7 @@ step_away(src, user, 15) return TRUE -/mob/living/carbon/alien/larva/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) +/mob/living/carbon/alien/larva/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!no_effect && !visual_effect_icon) visual_effect_icon = ATTACK_EFFECT_BITE ..() diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index fd1543673e6..496a12cbf82 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -1,57 +1,28 @@ /mob/living/carbon/alien/larva/Life(seconds, times_fired) - if(..()) //still breathing + set invisibility = 0 + if(notransform) + return + if(..()) //not dead and not in stasis // GROW! if(amount_grown < max_grown) amount_grown++ + update_icons() - //some kind of bug in canmove() isn't properly calling update_icons, so this is here as a placeholder - update_icons() - -/mob/living/carbon/alien/larva/handle_regular_status_updates() - updatehealth() - - if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP - SetSilence(0) - else //ALIVE. LIGHTS ARE ON - if(health < -25 || !get_int_organ(/obj/item/organ/internal/brain)) +/mob/living/carbon/alien/larva/update_stat(reason = "None given") + if(status_flags & GODMODE) + return + if(stat != DEAD) + if(health <= -maxHealth || !get_int_organ(/obj/item/organ/internal/brain)) death() - SetSilence(0) - return 1 + return - //UNCONSCIOUS. NO-ONE IS HOME - if((getOxyLoss() > 25) || (HEALTH_THRESHOLD_CRIT >= health && check_death_method())) - //if( health <= 20 && prob(1) ) - // spawn(0) - // emote("gasp") - if(!reagents.has_reagent("epinephrine")) - adjustOxyLoss(1) - Paralyse(3) - - if(paralysis) - stat = UNCONSCIOUS - else if(sleeping) - stat = UNCONSCIOUS - if(prob(10) && health) - emote("hiss_") - //CONSCIOUS + if(paralysis || sleeping || getOxyLoss() > 50 || (HEALTH_THRESHOLD_CRIT <= health && check_death_method())) + if(stat == CONSCIOUS) + KnockOut() + create_debug_log("fell unconscious, trigger reason: [reason]") else - stat = CONSCIOUS - - /* What in the living hell is this?*/ - if(move_delay_add > 0) - move_delay_add = max(0, move_delay_add - rand(1, 2)) - - if(eye_blind) //blindness, heals slowly over time - AdjustEyeBlind(-1) - else if(eye_blurry) //blurry eyes heal slowly - AdjustEyeBlurry(-1) - - if(stuttering) - AdjustStuttering(-1) - - if(silent) - AdjustSilence(-1) - - if(druggy) - AdjustDruggy(-1) - return 1 + if(stat == UNCONSCIOUS) + WakeUp() + create_debug_log("woke up, trigger reason: [reason]") + update_damage_hud() + update_health_hud() diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index a584f66dc97..5a1d08a010a 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -28,3 +28,15 @@ //BREATH TEMPERATURE handle_breath_temperature(breath) + +/mob/living/carbon/alien/handle_status_effects() + ..() + //natural reduction of movement delay due to stun. + if(move_delay_add > 0) + move_delay_add = max(0, move_delay_add - rand(1, 2)) + +/mob/living/carbon/alien/handle_fire()//Aliens on fire code + . = ..() + if(.) //if the mob isn't on fire anymore + return + adjust_bodytemperature(BODYTEMP_HEATING_MAX) //If you're on fire, you heat up! diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm index 5b80f6d032f..1dcd76c0358 100644 --- a/code/modules/mob/living/carbon/alien/special/facehugger.dm +++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm @@ -146,7 +146,7 @@ "[src] tears [W] off of [target]'s face!") src.loc = target - target.equip_to_slot(src, slot_wear_mask,,0) + target.equip_to_slot_if_possible(src, slot_wear_mask, FALSE, TRUE) if(!sterile) M.Paralyse(MAX_IMPREGNATION_TIME/6) //something like 25 ticks = 20 seconds with the default settings diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm index 130a2e3a574..16014e7c353 100644 --- a/code/modules/mob/living/carbon/brain/MMI.dm +++ b/code/modules/mob/living/carbon/brain/MMI.dm @@ -49,7 +49,7 @@ brainmob.stat = CONSCIOUS GLOB.respawnable_list -= brainmob GLOB.dead_mob_list -= brainmob//Update dem lists - GLOB.living_mob_list += brainmob + GLOB.alive_mob_list += brainmob held_brain = B if(istype(O,/obj/item/organ/internal/brain/xeno)) // kept the type check, as it still does other weird stuff @@ -157,7 +157,7 @@ brainmob.container = null//Reset brainmob mmi var. brainmob.forceMove(held_brain) //Throw mob into brain. GLOB.respawnable_list += brainmob - GLOB.living_mob_list -= brainmob//Get outta here + GLOB.alive_mob_list -= brainmob//Get outta here held_brain.brainmob = brainmob//Set the brain to use the brainmob held_brain.brainmob.cancel_camera() brainmob = null//Set mmi brainmob var to null diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index ec80d6a44b4..386d5ae138f 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -7,9 +7,8 @@ icon_state = "brain1" /mob/living/carbon/brain/New() - create_reagents(330) - add_language("Galactic Common") ..() + add_language("Galactic Common") /mob/living/carbon/brain/Destroy() if(key) //If there is a mob connected to this thing. Have to check key twice to avoid false death reporting. diff --git a/code/modules/mob/living/carbon/brain/brain_item.dm b/code/modules/mob/living/carbon/brain/brain_item.dm index 0b6bcededaf..93f31d0128c 100644 --- a/code/modules/mob/living/carbon/brain/brain_item.dm +++ b/code/modules/mob/living/carbon/brain/brain_item.dm @@ -26,11 +26,9 @@ mmi_icon = 'icons/mob/alien.dmi' mmi_icon_state = "AlienMMI" -/obj/item/organ/internal/brain/New() - ..() - spawn(5) - if(brainmob && brainmob.client) - brainmob.client.screen.len = null //clear the hud +/obj/item/organ/internal/brain/Destroy() + QDEL_NULL(brainmob) + return ..() /obj/item/organ/internal/brain/proc/transfer_identity(var/mob/living/carbon/H) brainmob = new(src) @@ -72,7 +70,7 @@ if(istype(owner,/mob/living/carbon/human)) var/mob/living/carbon/human/H = owner - H.update_hair(1) + H.update_hair() . = ..() /obj/item/organ/internal/brain/insert(var/mob/living/target,special = 0) @@ -84,7 +82,7 @@ brain_already_exists = 1 var/mob/living/carbon/human/H = target - H.update_hair(1) + H.update_hair() if(!brain_already_exists) if(brainmob) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 6bd88e5e111..0faa238190e 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -28,13 +28,11 @@ var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0) adjustFireLoss(5.0*discomfort) -/mob/living/carbon/brain/handle_regular_status_updates() +/mob/living/carbon/brain/Life() . = ..() - if(.) - if(!container && (health < HEALTH_THRESHOLD_DEAD && check_death_method() || ((world.time - timeofhostdeath) > config.revival_brain_life))) + if(!container && (world.time - timeofhostdeath) > config.revival_brain_life) death() - return 0 /mob/living/carbon/brain/breathe() return diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 3efcc7a9ce9..3aef7135679 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -2,6 +2,10 @@ var/canEnterVentWith = "/obj/item/implant=0&/obj/item/clothing/mask/facehugger=0&/obj/item/radio/borg=0&/obj/machinery/camera=0" var/datum/middleClickOverride/middleClickOverride = null +/mob/living/carbon/Initialize(mapload) + . = ..() + GLOB.carbon_list += src + /mob/living/carbon/Destroy() // This clause is here due to items falling off from limb deletion for(var/obj/item in get_all_slots()) @@ -14,6 +18,7 @@ if(B) B.leave_host() qdel(B) + GLOB.carbon_list -= src return ..() /mob/living/carbon/handle_atom_del(atom/A) @@ -486,7 +491,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven /mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine) - if(!istype(starting_machine) || !starting_machine.returnPipenet()) + if(!istype(starting_machine) || !starting_machine.returnPipenet() || !starting_machine.can_see_pipes()) return var/datum/pipeline/pipeline = starting_machine.returnPipenet() var/list/totalMembers = list() @@ -870,7 +875,6 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven unEquip(I) I.dropped() return - return 1 else to_chat(src, "You fail to remove [I]!") @@ -977,25 +981,30 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven /mob/living/carbon/proc/slip(description, stun, weaken, tilesSlipped, walkSafely, slipAny, slipVerb = "slip") if(flying || buckled || (walkSafely && m_intent == MOVE_INTENT_WALK)) - return 0 + return FALSE + if((lying) && (!(tilesSlipped))) - return 0 + return FALSE + if(!(slipAny)) if(istype(src, /mob/living/carbon/human)) var/mob/living/carbon/human/H = src if(isobj(H.shoes) && H.shoes.flags & NOSLIP) - return 0 + return FALSE + if(tilesSlipped) - for(var/t = 0, t<=tilesSlipped, t++) - spawn (t) step(src, src.dir) + for(var/i in 1 to tilesSlipped) + spawn(i) + step(src, dir) + stop_pulling() to_chat(src, "You [slipVerb]ped on [description]!") - playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) + playsound(loc, 'sound/misc/slip.ogg', 50, 1, -3) // Something something don't run with scissors moving_diagonally = 0 //If this was part of diagonal move slipping will stop it. Stun(stun) Weaken(weaken) - return 1 + return TRUE /mob/living/carbon/proc/can_eat(flags = 255) return 1 diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 75bd6d2664a..e0cba0b0281 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -12,7 +12,7 @@ visible_message("[src] catches [AM]!") throw_mode_off() return TRUE - ..() + return ..() /mob/living/carbon/water_act(volume, temperature, source, method = REAGENT_TOUCH) . = ..() diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm index bc4b5b43b1c..58c6a39e6c1 100644 --- a/code/modules/mob/living/carbon/human/appearance.dm +++ b/code/modules/mob/living/carbon/human/appearance.dm @@ -131,7 +131,7 @@ m_styles["head"] = "None" update_markings() - update_body(1, 1) //Update the body and force limb icon regeneration to update the head with the new icon. + update_body(TRUE) //Update the body and force limb icon regeneration to update the head with the new icon. if(wear_mask) update_inv_wear_mask() return 1 @@ -469,7 +469,7 @@ scramble(1, src, 100) real_name = random_name(gender, dna.species.name) //Give them a name that makes sense for their species. sync_organ_dna(assimilate = 1) - update_body(0) + update_body() reset_hair() //No more winding up with hairstyles you're not supposed to have, and blowing your cover. reset_markings() //...Or markings. dna.ResetUIFrom(src) diff --git a/code/modules/mob/living/carbon/human/body_accessories.dm b/code/modules/mob/living/carbon/human/body_accessories.dm index f644ed20e92..1583bc62c70 100644 --- a/code/modules/mob/living/carbon/human/body_accessories.dm +++ b/code/modules/mob/living/carbon/human/body_accessories.dm @@ -65,15 +65,6 @@ GLOBAL_LIST_INIT(body_accessory_by_species, list("None" = null)) /datum/body_accessory/body blend_mode = ICON_MULTIPLY -/datum/body_accessory/body/snake - name = "Snake" - - icon = 'icons/mob/body_accessory_64.dmi' - icon_state = "snake" - - pixel_x_offset = -16 - - //Tails /datum/body_accessory/tail icon = 'icons/mob/body_accessory.dmi' diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index aa8643173f4..6b7a0a2b15d 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -103,7 +103,6 @@ set_heartattack(FALSE) SSmobs.cubemonkeys -= src if(dna.species) - dna.species.handle_hud_icons(src) //Handle species-specific deaths. dna.species.handle_death(gibbed, src) @@ -124,10 +123,10 @@ if(. && healthdoll) // We're alive again, so re-build the entire healthdoll healthdoll.cached_healthdoll_overlays.Cut() + update_health_hud() // Update healthdoll if(dna.species) dna.species.update_sight(src) - dna.species.handle_hud_icons(src) /mob/living/carbon/human/proc/makeSkeleton() var/obj/item/organ/external/head/H = get_organ("head") @@ -146,14 +145,14 @@ H.alt_head = initial(H.alt_head) H.handle_alt_icon() m_styles = DEFAULT_MARKING_STYLES - update_fhair(0) - update_hair(0) - update_head_accessory(0) - update_markings(0) + update_fhair() + update_hair() + update_head_accessory() + update_markings() mutations.Add(SKELETON) mutations.Add(NOCLONE) - update_body(0) + update_body() update_mutantrace() return @@ -172,11 +171,11 @@ H.f_style = "Shaved" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE if(H.h_style) H.h_style = "Bald" - update_fhair(0) - update_hair(0) + update_fhair() + update_hair() mutations.Add(HUSK) - update_body(0) + update_body() update_mutantrace() return @@ -190,6 +189,6 @@ var/obj/item/organ/external/head/H = bodyparts_by_name["head"] if(istype(H)) H.disfigured = FALSE - update_body(0) - update_mutantrace(0) + update_body() + update_mutantrace() UpdateAppearance() // reset hair from DNA diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index c1f6acdefe5..fed50d442c9 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -139,10 +139,18 @@ //WHO THE FUCK THOUGHT THAT WAS A GOOD FUCKING IDEA!?!? if("howl", "howls") - var/M = handle_emote_param(param) //Check to see if the param is valid (mob with the param name is in view). - message = "[src] howls[M ? " at [M]" : ""]!" - playsound(loc, 'sound/goonstation/voice/howl.ogg', 100, 1, 10, frequency = get_age_pitch()) - m_type = 2 + var/M = handle_emote_param(param) + if(miming) + message = "[src] acts out a howl[M ? " at [M]" : ""]!" + m_type = 1 + else + if(!muzzled) + message = "[src] howls[M ? " at [M]" : ""]!" + playsound(loc, 'sound/goonstation/voice/howl.ogg', 100, 1, 10, frequency = get_age_pitch()) + m_type = 2 + else + message = "[src] makes a very loud noise[M ? " at [M]" : ""]." + m_type = 2 if("growl", "growls") var/M = handle_emote_param(param) @@ -256,12 +264,12 @@ if(body_accessory) if(body_accessory.try_restrictions(src)) message = "[src] starts wagging [p_their()] tail." - start_tail_wagging(1) + start_tail_wagging() else if(dna.species.bodyflags & TAIL_WAGGING) if(!wear_suit || !(wear_suit.flags_inv & HIDETAIL)) message = "[src] starts wagging [p_their()] tail." - start_tail_wagging(1) + start_tail_wagging() else return else @@ -271,7 +279,7 @@ if("swag", "swags") if(dna.species.bodyflags & TAIL_WAGGING || body_accessory) message = "[src] stops wagging [p_their()] tail." - stop_tail_wagging(1) + stop_tail_wagging() else return m_type = 1 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 7d1073fbdb2..9df498328fa 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -18,10 +18,10 @@ dna = new /datum/dna(null) // Species name is handled by set_species() - set_species(new_species, 1, delay_icon_update = 1, skip_same_check = TRUE) - ..() + set_species(new_species, 1, delay_icon_update = 1, skip_same_check = TRUE) + if(dna.species) real_name = dna.species.get_random_name(gender) name = real_name @@ -41,6 +41,7 @@ sync_organ_dna(1) UpdateAppearance() + GLOB.human_list += src /mob/living/carbon/human/OpenCraftingMenu() handcrafting.ui_interact(src) @@ -60,6 +61,7 @@ SSmobs.cubemonkeys -= src QDEL_LIST(bodyparts) splinted_limbs.Cut() + GLOB.human_list -= src /mob/living/carbon/human/dummy real_name = "Test Dummy" @@ -658,7 +660,7 @@ else if(place_item) usr.unEquip(place_item) - equip_to_slot_if_possible(place_item, pocket_id, 0, 1) + equip_to_slot_if_possible(place_item, pocket_id, FALSE, TRUE) add_attack_logs(usr, src, "Equipped with [place_item]", isLivingSSD(src) ? null : ATKLOG_ALL) // Update strip window @@ -1169,7 +1171,7 @@ qdel(feet_blood_DNA) bloody_feet = list(BLOOD_STATE_HUMAN = 0, BLOOD_STATE_XENO = 0, BLOOD_STATE_NOT_BLOODY = 0) blood_state = BLOOD_STATE_NOT_BLOODY - update_inv_shoes(1) + update_inv_shoes() return 1 /mob/living/carbon/human/cuff_resist(obj/item/I) @@ -1349,7 +1351,7 @@ dna.species.create_organs(src) for(var/obj/item/thing in kept_items) - equip_to_slot_if_possible(thing, kept_items[thing], redraw_mob = 0) + equip_to_slot_if_possible(thing, kept_items[thing]) thing.flags = item_flags[thing] // Reset the flags to the origional ones //Handle default hair/head accessories for created mobs. @@ -1399,7 +1401,7 @@ UpdateAppearance() overlays.Cut() - update_mutantrace(1) + update_mutantrace() regenerate_icons() if(dna.species) @@ -1962,3 +1964,6 @@ Eyes need to have significantly high darksight to shine unless the mob has the X if(O && O.glowing) O.toggle_biolum(TRUE) visible_message("[src] is engulfed in shadows and fades into the darkness.", "A sense of dread washes over you as you suddenly dim dark.") + +/mob/living/carbon/human/proc/get_perceived_trauma() + return min(health, maxHealth - getStaminaLoss()) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index f2a976e46d2..f9058065fb0 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -19,8 +19,6 @@ ChangeToHusk() update_stat("updatehealth([reason])") med_hud_set_health() - med_hud_set_status() - handle_hud_icons_health() /mob/living/carbon/human/adjustBrainLoss(amount, updating = TRUE, use_brain_mod = TRUE) if(status_flags & GODMODE) @@ -32,7 +30,7 @@ if(dna.species && amount > 0) if(use_brain_mod) amount = amount * dna.species.brain_mod - sponge.damage = Clamp(sponge.damage + amount, 0, 120) + sponge.damage = clamp(sponge.damage + amount, 0, 120) if(sponge.damage >= 120) visible_message("[src] goes limp, [p_their()] facial expression utterly blank.") death() @@ -50,7 +48,7 @@ if(dna.species && amount > 0) if(use_brain_mod) amount = amount * dna.species.brain_mod - sponge.damage = Clamp(amount, 0, 120) + sponge.damage = clamp(amount, 0, 120) if(sponge.damage >= 120) visible_message("[src] goes limp, [p_their()] facial expression utterly blank.") death() diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index d698a68c6d5..a849235af64 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -134,7 +134,7 @@ emp_act if(bp && istype(bp ,/obj/item/clothing)) var/obj/item/clothing/C = bp if(C.body_parts_covered & def_zone.body_part) - protection += C.armor[type] + protection += C.armor.getRating(type) return protection @@ -185,19 +185,19 @@ emp_act var/block_chance_modifier = round(damage / -3) if(l_hand && !istype(l_hand, /obj/item/clothing)) - var/final_block_chance = l_hand.block_chance - (Clamp((armour_penetration-l_hand.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example + var/final_block_chance = l_hand.block_chance - (clamp((armour_penetration-l_hand.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example if(l_hand.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) return 1 if(r_hand && !istype(r_hand, /obj/item/clothing)) - var/final_block_chance = r_hand.block_chance - (Clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)) + block_chance_modifier //Need to reset the var so it doesn't carry over modifications between attempts + var/final_block_chance = r_hand.block_chance - (clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)) + block_chance_modifier //Need to reset the var so it doesn't carry over modifications between attempts if(r_hand.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) return 1 if(wear_suit) - var/final_block_chance = wear_suit.block_chance - (Clamp((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier + var/final_block_chance = wear_suit.block_chance - (clamp((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier if(wear_suit.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) return 1 if(w_uniform) - var/final_block_chance = w_uniform.block_chance - (Clamp((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier + var/final_block_chance = w_uniform.block_chance - (clamp((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier if(w_uniform.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) return 1 return 0 @@ -457,13 +457,13 @@ emp_act if(bloody)//Apply blood if(wear_mask) wear_mask.add_mob_blood(src) - update_inv_wear_mask(0) + update_inv_wear_mask() if(head) head.add_mob_blood(src) - update_inv_head(0,0) + update_inv_head() if(glasses && prob(33)) glasses.add_mob_blood(src) - update_inv_glasses(0) + update_inv_glasses() if("chest")//Easier to score a stun but lasts less time @@ -475,10 +475,10 @@ emp_act if(bloody) if(wear_suit) wear_suit.add_mob_blood(src) - update_inv_wear_suit(1) + update_inv_wear_suit() if(w_uniform) w_uniform.add_mob_blood(src) - update_inv_w_uniform(1) + update_inv_w_uniform() @@ -525,16 +525,16 @@ emp_act else add_mob_blood(source) bloody_hands = amount - update_inv_gloves(1) //updates on-mob overlays for bloody hands and/or bloody gloves + update_inv_gloves() //updates on-mob overlays for bloody hands and/or bloody gloves /mob/living/carbon/human/proc/bloody_body(var/mob/living/source) if(wear_suit) wear_suit.add_mob_blood(source) - update_inv_wear_suit(0) + update_inv_wear_suit() return if(w_uniform) w_uniform.add_mob_blood(source) - update_inv_w_uniform(1) + update_inv_w_uniform() /mob/living/carbon/human/proc/handle_suit_punctures(var/damtype, var/damage) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 85bf001a206..5e1b5163a24 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -81,7 +81,7 @@ /mob/living/carbon/human/handle_footstep(turf/T) if(..()) - if(T.footstep_sounds["human"]) + if(T.footstep_sounds && T.footstep_sounds["human"]) var/S = pick(T.footstep_sounds["human"]) if(S) if(m_intent == MOVE_INTENT_RUN) diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index ea62f2fb5f9..b4a65b110a9 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -8,12 +8,15 @@ /mob/living/carbon/human/var/list/bodyparts_by_name = list() // map organ names to organs // Takes care of organ related updates, such as broken and missing limbs -/mob/living/carbon/human/proc/handle_organs() +/mob/living/carbon/human/handle_organs() + ..() //processing internal organs is pretty cheap, do that first. - for(var/obj/item/organ/internal/I in internal_organs) + for(var/X in internal_organs) + var/obj/item/organ/internal/I = X I.process() - for(var/obj/item/organ/external/E in bodyparts) + for(var/Y in bodyparts) + var/obj/item/organ/external/E = Y E.process() if(!lying && world.time - l_move_time < 15) @@ -109,6 +112,11 @@ do_sparks(5, 0, src) +/mob/living/carbon/human/handle_germs() + ..() + if(gloves && germ_level > gloves.germ_level && prob(10)) + gloves.germ_level += 1 + /mob/living/carbon/human/proc/becomeSlim() to_chat(src, "You feel fit again!") mutations.Remove(FAT) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index ea48884df9b..954d4e8fa55 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -178,8 +178,7 @@ //This is an UNSAFE proc. Use mob_can_equip() before calling this one! Or rather use equip_to_slot_if_possible() or advanced_equip_to_slot_if_possible() -//set redraw_mob to 0 if you don't wish the hud to be updated - if you're doing it manually in your own proc. -/mob/living/carbon/human/equip_to_slot(obj/item/I, slot, redraw_mob = 1) +/mob/living/carbon/human/equip_to_slot(obj/item/I, slot) if(!slot) return if(!istype(I)) @@ -203,40 +202,40 @@ switch(slot) if(slot_back) back = I - update_inv_back(redraw_mob) + update_inv_back() if(slot_wear_mask) wear_mask = I if((wear_mask.flags & BLOCKHAIR) || (wear_mask.flags & BLOCKHEADHAIR)) - update_hair(redraw_mob) //rebuild hair - update_fhair(redraw_mob) - update_head_accessory(redraw_mob) + update_hair() //rebuild hair + update_fhair() + update_head_accessory() if(hud_list.len) sec_hud_set_ID() wear_mask_update(I, toggle_off = TRUE) - update_inv_wear_mask(redraw_mob) + update_inv_wear_mask() if(slot_handcuffed) handcuffed = I - update_inv_handcuffed(redraw_mob) + update_inv_handcuffed() if(slot_legcuffed) legcuffed = I - update_inv_legcuffed(redraw_mob) + update_inv_legcuffed() if(slot_l_hand) l_hand = I - update_inv_l_hand(redraw_mob) + update_inv_l_hand() if(slot_r_hand) r_hand = I - update_inv_r_hand(redraw_mob) + update_inv_r_hand() if(slot_belt) belt = I - update_inv_belt(redraw_mob) + update_inv_belt() if(slot_wear_id) wear_id = I if(hud_list.len) sec_hud_set_ID() - update_inv_wear_id(redraw_mob) + update_inv_wear_id() if(slot_wear_pda) wear_pda = I - update_inv_wear_pda(redraw_mob) + update_inv_wear_pda() if(slot_l_ear) l_ear = I if(l_ear.slot_flags & SLOT_TWOEARS) @@ -245,7 +244,7 @@ r_ear = O O.layer = ABOVE_HUD_LAYER O.plane = ABOVE_HUD_PLANE - update_inv_ears(redraw_mob) + update_inv_ears() if(slot_r_ear) r_ear = I if(r_ear.slot_flags & SLOT_TWOEARS) @@ -254,7 +253,7 @@ l_ear = O O.layer = ABOVE_HUD_LAYER O.plane = ABOVE_HUD_PLANE - update_inv_ears(redraw_mob) + update_inv_ears() if(slot_glasses) glasses = I var/obj/item/clothing/glasses/G = I @@ -264,42 +263,42 @@ update_nearsighted_effects() if(G.vision_flags || G.see_in_dark || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) update_sight() - update_inv_glasses(redraw_mob) + update_inv_glasses() update_client_colour() if(slot_gloves) gloves = I - update_inv_gloves(redraw_mob) + update_inv_gloves() if(slot_head) head = I if((head.flags & BLOCKHAIR) || (head.flags & BLOCKHEADHAIR)) - update_hair(redraw_mob) //rebuild hair - update_fhair(redraw_mob) - update_head_accessory(redraw_mob) + update_hair() //rebuild hair + update_fhair() + update_head_accessory() // paper + bandanas if(istype(I, /obj/item/clothing/head)) var/obj/item/clothing/head/hat = I if(hat.vision_flags || hat.see_in_dark || !isnull(hat.lighting_alpha)) update_sight() head_update(I) - update_inv_head(redraw_mob) + update_inv_head() if(slot_shoes) shoes = I - update_inv_shoes(redraw_mob) + update_inv_shoes() if(slot_wear_suit) wear_suit = I - update_inv_wear_suit(redraw_mob) + update_inv_wear_suit() if(slot_w_uniform) w_uniform = I - update_inv_w_uniform(redraw_mob) + update_inv_w_uniform() if(slot_l_store) l_store = I - update_inv_pockets(redraw_mob) + update_inv_pockets() if(slot_r_store) r_store = I - update_inv_pockets(redraw_mob) + update_inv_pockets() if(slot_s_store) s_store = I - update_inv_s_store(redraw_mob) + update_inv_s_store() if(slot_in_backpack) if(get_active_hand() == I) unEquip(I) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 8f548100650..5030c5c4170 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1,18 +1,26 @@ /mob/living/carbon/human/Life(seconds, times_fired) + set invisibility = 0 + if(notransform) + return + + . = ..() + + if(QDELETED(src)) + return FALSE + life_tick++ voice = GetVoice() - if(..()) + if(.) //not dead if(check_mutations) domutcheck(src,null) update_mutations() - check_mutations=0 + check_mutations = FALSE handle_pain() handle_heartbeat() - handle_drunk() dna.species.handle_life(src) if(!client) dna.species.handle_npc(src) @@ -24,45 +32,45 @@ if(stat == DEAD) handle_decay() - if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle - return //We go ahead and process them 5 times for HUD images and other stuff though. - //Update our name based on whether our face is obscured/disfigured name = get_visible_name() pulse = handle_pulse(times_fired) - if(mind && mind.vampire) + if(mind?.vampire) mind.vampire.handle_vampire() if(life_tick == 1) regenerate_icons() // Make sure the inventory updates - handle_ghosted() - handle_ssd() + if(player_ghosted > 0 && stat == CONSCIOUS && job && !restrained()) + handle_ghosted() + if(player_logged > 0 && stat != DEAD && job) + handle_ssd() + + if(stat != DEAD) + return TRUE /mob/living/carbon/human/proc/handle_ghosted() - if(player_ghosted > 0 && stat == CONSCIOUS && job && !restrained()) - if(key) - player_ghosted = 0 - else - player_ghosted++ - if(player_ghosted % 150 == 0) - force_cryo_human(src) + if(key) + player_ghosted = 0 + else + player_ghosted++ + if(player_ghosted % 150 == 0) + force_cryo_human(src) /mob/living/carbon/human/proc/handle_ssd() - if(player_logged > 0 && stat != DEAD && job) - player_logged++ - if(istype(loc, /obj/machinery/cryopod)) + player_logged++ + if(istype(loc, /obj/machinery/cryopod)) + return + if(config.auto_cryo_ssd_mins && (player_logged >= (config.auto_cryo_ssd_mins * 30)) && player_logged % 30 == 0) + var/turf/T = get_turf(src) + if(!is_station_level(T.z)) return - if(config.auto_cryo_ssd_mins && (player_logged >= (config.auto_cryo_ssd_mins * 30)) && player_logged % 30 == 0) - var/turf/T = get_turf(src) - if(!is_station_level(T.z)) - return - var/area/A = get_area(src) - if(cryo_ssd(src)) - var/obj/effect/portal/P = new /obj/effect/portal(T, null, null, 40) - P.name = "NT SSD Teleportation Portal" - if(A.fast_despawn) - force_cryo_human(src) + var/area/A = get_area(src) + if(cryo_ssd(src)) + var/obj/effect/portal/P = new /obj/effect/portal(T, null, null, 40) + P.name = "NT SSD Teleportation Portal" + if(A.fast_despawn) + force_cryo_human(src) /mob/living/carbon/human/calculate_affecting_pressure(var/pressure) ..() @@ -80,38 +88,35 @@ /mob/living/carbon/human/handle_disabilities() - if(disabilities & EPILEPSY) - if((prob(1) && paralysis < 1)) - visible_message("[src] starts having a seizure!","You have a seizure!") - Paralyse(10) - Jitter(1000) + //Vision //god knows why this is here + var/obj/item/organ/vision + if(dna.species.vision_organ) + vision = get_int_organ(dna.species.vision_organ) - // If we have the gene for being crazy, have random events. - if(dna.GetSEState(GLOB.hallucinationblock)) - if(prob(1)) - Hallucinate(20) + if(!dna.species.vision_organ) // Presumably if a species has no vision organs, they see via some other means. + SetEyeBlind(0) + SetEyeBlurry(0) - if(disabilities & COUGHING) - if((prob(5) && paralysis <= 1)) - drop_item() - emote("cough") - if(disabilities & TOURETTES) - if((prob(10) && paralysis <= 1)) - Stun(10) - switch(rand(1, 3)) - if(1) - emote("twitch") - if(2 to 3) - var/tourettes = pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS") - say("[prob(50) ? ";" : ""][tourettes]") - var/x_offset = pixel_x + rand(-2,2) //Should probably be moved into the twitch emote at some point. - var/y_offset = pixel_y + rand(-1,1) - animate(src, pixel_x = pixel_x + x_offset, pixel_y = pixel_y + y_offset, time = 1) - animate(pixel_x = initial(pixel_x) , pixel_y = initial(pixel_y), time = 1) + else if(!vision || vision.is_broken()) // Vision organs cut out or broken? Permablind. + EyeBlind(2) + EyeBlurry(2) - if(disabilities & NERVOUS) - if(prob(10)) - Stuttering(10) + else + //blindness + if(BLINDNESS in mutations) // Disabled-blind, doesn't get better on its own + + else if(eye_blind) // Blindness, heals slowly over time + AdjustEyeBlind(-1) + + else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold) && eye_blurry) //resting your eyes with a blindfold heals blurry eyes faster + AdjustEyeBlurry(-3) + + //blurry sight + if(vision.is_bruised()) // Vision organs impaired? Permablurry. + EyeBlurry(2) + + if(eye_blurry) // Blurry eyes heal slowly + AdjustEyeBlurry(-1) if(getBrainLoss() >= 60 && stat != DEAD) if(prob(3)) @@ -192,7 +197,7 @@ if(!(RADIMMUNE in dna.species.species_traits)) if(radiation) - radiation = Clamp(radiation, 0, 200) + radiation = clamp(radiation, 0, 200) var/autopsy_damage = 0 switch(radiation) @@ -607,6 +612,7 @@ // nutrition decrease if(nutrition > 0 && stat != DEAD) + handle_nutrition_alerts() // THEY HUNGER var/hunger_rate = hunger_drain if(satiety > 0) @@ -656,22 +662,25 @@ AdjustSleeping(1) Paralyse(5) - AdjustConfused(-1) + if(confused) + AdjustConfused(-1) // decrement dizziness counter, clamped to 0 if(resting) - AdjustDizzy(-15) - AdjustJitter(-15) + if(dizziness) + AdjustDizzy(-15) + if(jitteriness) + AdjustJitter(-15) else - AdjustDizzy(-3) - AdjustJitter(-3) + if(dizziness) + AdjustDizzy(-3) + if(jitteriness) + AdjustJitter(-3) if(NO_INTORGANS in dna.species.species_traits) return handle_trace_chems() - return //TODO: DEFERRED - /mob/living/carbon/human/handle_drunk() var/slur_start = 30 //12u ethanol, 30u whiskey FOR HUMANS var/confused_start = 40 @@ -683,55 +692,54 @@ var/collapse_start = 75 var/braindamage_start = 120 var/alcohol_strength = drunk - var/sober_str=!(SOBER in mutations)?1:2 + var/sober_str =! (SOBER in mutations) ? 1 : 2 - if(drunk) - alcohol_strength/=sober_str + alcohol_strength /= sober_str - var/obj/item/organ/internal/liver/L - if(!isSynthetic()) - L = get_int_organ(/obj/item/organ/internal/liver) + var/obj/item/organ/internal/liver/L + if(!isSynthetic()) + L = get_int_organ(/obj/item/organ/internal/liver) + if(L) + alcohol_strength *= L.alcohol_intensity + else + alcohol_strength *= 5 + + if(alcohol_strength >= slur_start) //slurring + Slur(drunk) + if(alcohol_strength >= brawl_start) //the drunken martial art + if(!istype(martial_art, /datum/martial_art/drunk_brawling)) + var/datum/martial_art/drunk_brawling/F = new + F.teach(src, 1) + if(alcohol_strength < brawl_start) //removing the art + if(istype(martial_art, /datum/martial_art/drunk_brawling)) + martial_art.remove(src) + if(alcohol_strength >= confused_start && prob(33)) //confused walking + if(!confused) + Confused(1) + AdjustConfused(3 / sober_str) + if(alcohol_strength >= blur_start) //blurry eyes + EyeBlurry(10 / sober_str) + if(!isSynthetic()) //stuff only for non-synthetics + if(alcohol_strength >= vomit_start) //vomiting + if(prob(8)) + fakevomit() + if(alcohol_strength >= pass_out) + Paralyse(5 / sober_str) + Drowsy(30 / sober_str) if(L) - alcohol_strength *= L.alcohol_intensity - else - alcohol_strength *= 5 - - if(alcohol_strength >= slur_start) //slurring - Slur(drunk) - if(alcohol_strength >= brawl_start) //the drunken martial art - if(!istype(martial_art, /datum/martial_art/drunk_brawling)) - var/datum/martial_art/drunk_brawling/F = new - F.teach(src,1) - if(alcohol_strength < brawl_start) //removing the art - if(istype(martial_art, /datum/martial_art/drunk_brawling)) - martial_art.remove(src) - if(alcohol_strength >= confused_start && prob(33)) //confused walking - if(!confused) Confused(1) - AdjustConfused(3/sober_str) - if(alcohol_strength >= blur_start) //blurry eyes - EyeBlurry(10/sober_str) - if(!isSynthetic()) //stuff only for non-synthetics - if(alcohol_strength >= vomit_start) //vomiting - if(prob(8)) - fakevomit() - if(alcohol_strength >= pass_out) - Paralyse(5/sober_str) - Drowsy(30/sober_str) - if(L) - L.receive_damage(0.1, 1) - adjustToxLoss(0.1) - else //stuff only for synthetics - if(alcohol_strength >= spark_start && prob(25)) - do_sparks(3, 1, src) - if(alcohol_strength >= collapse_start && prob(10)) - emote("collapse") - do_sparks(3, 1, src) - if(alcohol_strength >= braindamage_start && prob(10)) - adjustBrainLoss(1) + L.receive_damage(0.1, 1) + adjustToxLoss(0.1) + else //stuff only for synthetics + if(alcohol_strength >= spark_start && prob(25)) + do_sparks(3, 1, src) + if(alcohol_strength >= collapse_start && prob(10)) + emote("collapse") + do_sparks(3, 1, src) + if(alcohol_strength >= braindamage_start && prob(10)) + adjustBrainLoss(1) if(!has_booze()) AdjustDrunk(-0.5) - return /mob/living/carbon/human/proc/has_booze() //checks if the human has ethanol or its subtypes inside for(var/A in reagents.reagent_list) @@ -740,180 +748,154 @@ return 1 return 0 -/mob/living/carbon/human/handle_regular_status_updates() +/mob/living/carbon/human/handle_critical_condition() if(status_flags & GODMODE) return 0 - . = ..() + var/guaranteed_death_threshold = health + (getOxyLoss() * 0.5) - (getFireLoss() * 0.67) - (getBruteLoss() * 0.67) - if(.) //alive - if(REGEN in mutations) - heal_overall_damage(0.1, 0.1) + if(getBrainLoss() >= 120 || (guaranteed_death_threshold) <= -500) + death() + return - if(paralysis) - stat = UNCONSCIOUS + if(getBrainLoss() >= 100) // braindeath + AdjustLoseBreath(10, bound_lower = 0, bound_upper = 25) + Weaken(30) - else if(sleeping) + if(!check_death_method()) + if(health <= HEALTH_THRESHOLD_DEAD) + var/deathchance = min(99, ((getBrainLoss() * -5) + (health + (getOxyLoss() / 2))) * -0.01) + if(prob(deathchance)) + death() + return - stat = UNCONSCIOUS + if(health <= HEALTH_THRESHOLD_CRIT) + if(prob(5)) + emote(pick("faint", "collapse", "cry", "moan", "gasp", "shudder", "shiver")) + AdjustStuttering(5, bound_lower = 0, bound_upper = 5) + EyeBlurry(5) + if(prob(7)) + AdjustConfused(2) + if(prob(5)) + Paralyse(2) + switch(health) + if(-INFINITY to -100) + adjustOxyLoss(1) + if(prob(health * -0.1)) + if(ishuman(src)) + var/mob/living/carbon/human/H = src + H.set_heartattack(TRUE) + if(prob(health * -0.2)) + var/datum/disease/D = new /datum/disease/critical/heart_failure + ForceContractDisease(D) + Paralyse(5) + if(-99 to -80) + adjustOxyLoss(1) + if(prob(4)) + to_chat(src, "Your chest hurts...") + Paralyse(2) + var/datum/disease/D = new /datum/disease/critical/heart_failure + ForceContractDisease(D) + if(-79 to -50) + adjustOxyLoss(1) + if(prob(10)) + var/datum/disease/D = new /datum/disease/critical/shock + ForceContractDisease(D) + if(prob(health * -0.08)) + var/datum/disease/D = new /datum/disease/critical/heart_failure + ForceContractDisease(D) + if(prob(6)) + to_chat(src, "You feel [pick("horrible pain", "awful", "like shit", "absolutely awful", "like death", "like you are dying", "nothing", "warm", "sweaty", "tingly", "really, really bad", "horrible")]!") + Weaken(3) + if(prob(3)) + Paralyse(2) + if(-49 to 0) + adjustOxyLoss(1) + if(prob(3)) + var/datum/disease/D = new /datum/disease/critical/shock + ForceContractDisease(D) + if(prob(5)) + to_chat(src, "You feel [pick("terrible", "awful", "like shit", "sick", "numb", "cold", "sweaty", "tingly", "horrible")]!") + Weaken(3) - if(mind) - if(mind.vampire) - if(istype(loc, /obj/structure/closet/coffin)) - adjustBruteLoss(-1) - adjustFireLoss(-1) - adjustToxLoss(-1) - - else if(status_flags & FAKEDEATH) - stat = UNCONSCIOUS - - //Vision //god knows why this is here - var/obj/item/organ/vision - if(dna.species.vision_organ) - vision = get_int_organ(dna.species.vision_organ) - - if(!dna.species.vision_organ) // Presumably if a species has no vision organs, they see via some other means. - SetEyeBlind(0) - SetEyeBlurry(0) - - else if(!vision || vision.is_broken()) // Vision organs cut out or broken? Permablind. - EyeBlind(2) - EyeBlurry(2) - - else - //blindness - if(disabilities & BLIND) // Disabled-blind, doesn't get better on its own - - else if(eye_blind) // Blindness, heals slowly over time - AdjustEyeBlind(-1) - - else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster - AdjustEyeBlurry(-3) - - //blurry sight - if(vision.is_bruised()) // Vision organs impaired? Permablurry. - EyeBlurry(2) - - if(eye_blurry) // Blurry eyes heal slowly - AdjustEyeBlurry(-1) - - - if(flying) - animate(src, pixel_y = pixel_y + 5 , time = 10, loop = 1, easing = SINE_EASING) - animate(pixel_y = pixel_y - 5, time = 10, loop = 1, easing = SINE_EASING) - - // If you're dirty, your gloves will become dirty, too. - if(gloves && germ_level > gloves.germ_level && prob(10)) - gloves.germ_level += 1 - - handle_organs() - - var/guaranteed_death_threshold = health + (getOxyLoss() * 0.5) - (getFireLoss() * 0.67) - (getBruteLoss() * 0.67) - - if(getBrainLoss() >= 120 || (guaranteed_death_threshold) <= -500) - death() - return - - if(getBrainLoss() >= 100) // braindeath - AdjustLoseBreath(10, bound_lower = 0, bound_upper = 25) - Weaken(30) - - if(!check_death_method()) - if(health <= HEALTH_THRESHOLD_DEAD) - var/deathchance = min(99, ((getBrainLoss() * -5) + (health + (getOxyLoss() / 2))) * -0.01) - if(prob(deathchance)) - death() - return - - if(health <= HEALTH_THRESHOLD_CRIT) - if(prob(5)) - emote(pick("faint", "collapse", "cry", "moan", "gasp", "shudder", "shiver")) - AdjustStuttering(5, bound_lower = 0, bound_upper = 5) - EyeBlurry(5) - if(prob(7)) - AdjustConfused(2) - if(prob(5)) - Paralyse(2) - switch(health) - if(-INFINITY to -100) - adjustOxyLoss(1) - if(prob(health * -0.1)) - if(ishuman(src)) - var/mob/living/carbon/human/H = src - H.set_heartattack(TRUE) - if(prob(health * -0.2)) - var/datum/disease/D = new /datum/disease/critical/heart_failure - ForceContractDisease(D) - Paralyse(5) - if(-99 to -80) - adjustOxyLoss(1) - if(prob(4)) - to_chat(src, "Your chest hurts...") - Paralyse(2) - var/datum/disease/D = new /datum/disease/critical/heart_failure - ForceContractDisease(D) - if(-79 to -50) - adjustOxyLoss(1) - if(prob(10)) - var/datum/disease/D = new /datum/disease/critical/shock - ForceContractDisease(D) - if(prob(health * -0.08)) - var/datum/disease/D = new /datum/disease/critical/heart_failure - ForceContractDisease(D) - if(prob(6)) - to_chat(src, "You feel [pick("horrible pain", "awful", "like shit", "absolutely awful", "like death", "like you are dying", "nothing", "warm", "sweaty", "tingly", "really, really bad", "horrible")]!") - Weaken(3) - if(prob(3)) - Paralyse(2) - if(-49 to 0) - adjustOxyLoss(1) - if(prob(3)) - var/datum/disease/D = new /datum/disease/critical/shock - ForceContractDisease(D) - if(prob(5)) - to_chat(src, "You feel [pick("terrible", "awful", "like shit", "sick", "numb", "cold", "sweaty", "tingly", "horrible")]!") - Weaken(3) - - else //dead - SetSilence(0) - - -/mob/living/carbon/human/handle_vision() - if(machine) - if(!machine.check_eye(src)) - reset_perspective(null) +/mob/living/carbon/human/update_health_hud() + if(!client) + return + if(dna.species.update_health_hud()) + return else - var/isRemoteObserve = 0 - if((REMOTE_VIEW in mutations) && remoteview_target) - isRemoteObserve = 1 + if(healths) + var/health_amount = get_perceived_trauma() + if(..(health_amount)) //not dead + switch(hal_screwyhud) + if(SCREWYHUD_CRIT) + healths.icon_state = "health6" + if(SCREWYHUD_DEAD) + healths.icon_state = "health7" + if(SCREWYHUD_HEALTHY) + healths.icon_state = "health0" - if(remoteview_target.stat != CONSCIOUS) - to_chat(src, "Your psy-connection grows too faint to maintain!") - isRemoteObserve = 0 + if(healthdoll) + if(stat == DEAD) + healthdoll.icon_state = "healthdoll_DEAD" + if(healthdoll.overlays.len) + healthdoll.overlays.Cut() + else + var/list/new_overlays = list() + var/list/cached_overlays = healthdoll.cached_healthdoll_overlays + // Use the dead health doll as the base, since we have proper "healthy" overlays now + healthdoll.icon_state = "healthdoll_DEAD" + for(var/obj/item/organ/external/O in bodyparts) + var/damage = O.burn_dam + O.brute_dam + var/comparison = (O.max_damage/5) + var/icon_num = 0 + if(damage) + icon_num = 1 + if(damage > (comparison)) + icon_num = 2 + if(damage > (comparison*2)) + icon_num = 3 + if(damage > (comparison*3)) + icon_num = 4 + if(damage > (comparison*4)) + icon_num = 5 + new_overlays += "[O.limb_name][icon_num]" + healthdoll.overlays += (new_overlays - cached_overlays) + healthdoll.overlays -= (cached_overlays - new_overlays) + healthdoll.cached_healthdoll_overlays = new_overlays - if(PSY_RESIST in remoteview_target.mutations) - to_chat(src, "Your mind is shut out!") - isRemoteObserve = 0 +/mob/living/carbon/human/proc/handle_nutrition_alerts() //This is a terrible abuse of the alert system; something like this should be a HUD element + if(NO_HUNGER in dna.species.species_traits) + return + if(mind?.vampire && (mind in SSticker.mode.vampires)) //Vampires + switch(nutrition) + if(NUTRITION_LEVEL_FULL to INFINITY) + throw_alert("nutrition", /obj/screen/alert/fat/vampire) + if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) + throw_alert("nutrition", /obj/screen/alert/full/vampire) + if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) + throw_alert("nutrition", /obj/screen/alert/well_fed/vampire) + if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) + throw_alert("nutrition", /obj/screen/alert/fed/vampire) + if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) + throw_alert("nutrition", /obj/screen/alert/hungry/vampire) + else + throw_alert("nutrition", /obj/screen/alert/starving/vampire) - // Not on the station or mining? - var/turf/temp_turf = get_turf(remoteview_target) - if(!(temp_turf in config.contact_levels)) - to_chat(src, "Your psy-connection grows too faint to maintain!") - isRemoteObserve = 0 - - if(remote_view) - isRemoteObserve = 1 - - if(!isRemoteObserve && client && !client.adminobs) - remoteview_target = null - reset_perspective(null) - -/mob/living/carbon/human/handle_hud_icons() - dna.species.handle_hud_icons(src) - -/mob/living/carbon/human/handle_hud_icons_health() - dna.species.handle_hud_icons_health(src) - handle_hud_icons_health_overlay() + else //Any other non-vampires + switch(nutrition) + if(NUTRITION_LEVEL_FULL to INFINITY) + throw_alert("nutrition", /obj/screen/alert/fat) + if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) + throw_alert("nutrition", /obj/screen/alert/full) + if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) + throw_alert("nutrition", /obj/screen/alert/well_fed) + if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) + throw_alert("nutrition", /obj/screen/alert/fed) + if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) + throw_alert("nutrition", /obj/screen/alert/hungry) + else + throw_alert("nutrition", /obj/screen/alert/starving) /mob/living/carbon/human/handle_random_events() // Puke if toxloss is too high @@ -942,15 +924,14 @@ clear_alert("embeddedobject") /mob/living/carbon/human/handle_changeling() - if(mind) - if(mind.changeling) - mind.changeling.regenerate(src) - if(hud_used) - hud_used.lingchemdisplay.invisibility = 0 - hud_used.lingchemdisplay.maptext = "
[round(mind.changeling.chem_charges)]
" - else - if(hud_used) - hud_used.lingchemdisplay.invisibility = 101 + if(mind.changeling) + mind.changeling.regenerate(src) + if(hud_used) + hud_used.lingchemdisplay.invisibility = 0 + hud_used.lingchemdisplay.maptext = "
[round(mind.changeling.chem_charges)]
" + else + if(hud_used) + hud_used.lingchemdisplay.invisibility = 101 /mob/living/carbon/human/proc/handle_pulse(times_fired) diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm index b53fa03cebf..65b4585ff6b 100644 --- a/code/modules/mob/living/carbon/human/say.dm +++ b/code/modules/mob/living/carbon/human/say.dm @@ -138,7 +138,7 @@ span = mind.speech_span if((COMIC in mutations) \ || (locate(/obj/item/organ/internal/cyberimp/brain/clown_voice) in internal_organs) \ - || GetComponent(/datum/component/jestosterone)) + || HAS_TRAIT(src, TRAIT_JESTER)) span = "sans" if(WINGDINGS in mutations) @@ -151,7 +151,7 @@ if(S.speaking && S.speaking.flags & NO_STUTTER) continue - if(silent || (disabilities & MUTE)) + if(silent || (MUTE in mutations)) S.message = "" if(istype(wear_mask, /obj/item/clothing/mask/horsehead)) diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index 06b42202b45..21695e25e78 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -754,105 +754,8 @@ return FALSE //Unsupported slot -/datum/species/proc/get_perceived_trauma(mob/living/carbon/human/H) - return min(H.health, H.maxHealth - H.getStaminaLoss()) - -/datum/species/proc/handle_hud_icons(mob/living/carbon/human/H) - if(!H.client) - return - handle_hud_icons_health(H) - H.handle_hud_icons_health_overlay() - handle_hud_icons_nutrition(H) - -/datum/species/proc/handle_hud_icons_health(mob/living/carbon/H) - if(!H.client) - return - handle_hud_icons_health_side(H) - handle_hud_icons_health_doll(H) - -/datum/species/proc/handle_hud_icons_health_side(mob/living/carbon/human/H) - if(H.healths) - if(H.stat == DEAD || (H.status_flags & FAKEDEATH)) - H.healths.icon_state = "health7" - else - switch(H.hal_screwyhud) - if(SCREWYHUD_CRIT) H.healths.icon_state = "health6" - if(SCREWYHUD_DEAD) H.healths.icon_state = "health7" - if(SCREWYHUD_HEALTHY) H.healths.icon_state = "health0" - else - switch(get_perceived_trauma(H)) - if(100 to INFINITY) H.healths.icon_state = "health0" - if(80 to 100) H.healths.icon_state = "health1" - if(60 to 80) H.healths.icon_state = "health2" - if(40 to 60) H.healths.icon_state = "health3" - if(20 to 40) H.healths.icon_state = "health4" - if(0 to 20) H.healths.icon_state = "health5" - else H.healths.icon_state = "health6" - -/datum/species/proc/handle_hud_icons_health_doll(mob/living/carbon/human/H) - if(H.healthdoll) - if(H.stat == DEAD || (H.status_flags & FAKEDEATH)) - H.healthdoll.icon_state = "healthdoll_DEAD" - if(H.healthdoll.overlays.len) - H.healthdoll.overlays.Cut() - else - var/list/new_overlays = list() - var/list/cached_overlays = H.healthdoll.cached_healthdoll_overlays - // Use the dead health doll as the base, since we have proper "healthy" overlays now - H.healthdoll.icon_state = "healthdoll_DEAD" - for(var/obj/item/organ/external/O in H.bodyparts) - var/damage = O.burn_dam + O.brute_dam - var/comparison = (O.max_damage/5) - var/icon_num = 0 - if(damage) - icon_num = 1 - if(damage > (comparison)) - icon_num = 2 - if(damage > (comparison*2)) - icon_num = 3 - if(damage > (comparison*3)) - icon_num = 4 - if(damage > (comparison*4)) - icon_num = 5 - new_overlays += "[O.limb_name][icon_num]" - H.healthdoll.overlays += (new_overlays - cached_overlays) - H.healthdoll.overlays -= (cached_overlays - new_overlays) - H.healthdoll.cached_healthdoll_overlays = new_overlays - -/datum/species/proc/handle_hud_icons_nutrition(mob/living/carbon/human/H) - if(NO_HUNGER in species_traits) - return FALSE - if(H.mind && H.mind.vampire && (H.mind in SSticker.mode.vampires)) //Vampires - switch(H.nutrition) - if(NUTRITION_LEVEL_FULL to INFINITY) - H.throw_alert("nutrition", /obj/screen/alert/fat/vampire) - if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) - H.throw_alert("nutrition", /obj/screen/alert/full/vampire) - if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) - H.throw_alert("nutrition", /obj/screen/alert/well_fed/vampire) - if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) - H.throw_alert("nutrition", /obj/screen/alert/fed/vampire) - if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) - H.throw_alert("nutrition", /obj/screen/alert/hungry/vampire) - else - H.throw_alert("nutrition", /obj/screen/alert/starving/vampire) - return 1 - - else ///Any other non-vampires - switch(H.nutrition) - if(NUTRITION_LEVEL_FULL to INFINITY) - H.throw_alert("nutrition", /obj/screen/alert/fat) - if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) - H.throw_alert("nutrition", /obj/screen/alert/full) - if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) - H.throw_alert("nutrition", /obj/screen/alert/well_fed) - if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) - H.throw_alert("nutrition", /obj/screen/alert/fed) - if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) - H.throw_alert("nutrition", /obj/screen/alert/hungry) - else - H.throw_alert("nutrition", /obj/screen/alert/starving) - return 1 +/datum/species/proc/update_health_hud(mob/living/carbon/human/H) + return FALSE /* Returns the path corresponding to the corresponding organ diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm index 9f4a27a3c41..7ff32e38644 100644 --- a/code/modules/mob/living/carbon/human/species/golem.dm +++ b/code/modules/mob/living/carbon/human/species/golem.dm @@ -636,12 +636,11 @@ H.mutations.Add(COMIC) H.equip_to_slot_or_del(new /obj/item/reagent_containers/food/drinks/bottle/bottleofbanana(H), slot_r_store) H.equip_to_slot_or_del(new /obj/item/bikehorn(H), slot_l_store) - H.AddComponent(/datum/component/waddling) + H.AddElement(/datum/element/waddling) /datum/species/golem/bananium/on_species_loss(mob/living/carbon/C) . = ..() - GET_COMPONENT_FROM(waddling, /datum/component/waddling, C) - waddling.Destroy() + C.RemoveElement(/datum/element/waddling) /datum/species/golem/bananium/get_random_name() var/clown_name = pick(GLOB.clown_names) diff --git a/code/modules/mob/living/carbon/human/species/shadow.dm b/code/modules/mob/living/carbon/human/species/shadow.dm index 63f062b8bc8..be2a7f44229 100644 --- a/code/modules/mob/living/carbon/human/species/shadow.dm +++ b/code/modules/mob/living/carbon/human/species/shadow.dm @@ -39,10 +39,10 @@ /datum/action/innate/shadow/darkvision/Activate() var/mob/living/carbon/human/H = owner if(!H.vision_type) - H.vision_type = new /datum/vision_override/nightvision + H.set_sight(/datum/vision_override/nightvision) to_chat(H, "You adjust your vision to pierce the darkness.") else - H.vision_type = null + H.set_sight(null) to_chat(H, "You adjust your vision to recognize the shadows.") /datum/species/shadow/on_species_gain(mob/living/carbon/human/H) diff --git a/code/modules/mob/living/carbon/human/species/slime.dm b/code/modules/mob/living/carbon/human/species/slime.dm index 0a708db223f..60f972b69a4 100644 --- a/code/modules/mob/living/carbon/human/species/slime.dm +++ b/code/modules/mob/living/carbon/human/species/slime.dm @@ -95,7 +95,7 @@ var/obj/item/organ/external/E = H.bodyparts_by_name[organname] if(istype(E) && E.dna && istype(E.dna.species, /datum/species/slime)) E.sync_colour_to_human(H) - H.update_hair(0) + H.update_hair() H.update_body() ..() diff --git a/code/modules/mob/living/carbon/human/species/tajaran.dm b/code/modules/mob/living/carbon/human/species/tajaran.dm index 1b1589cb6fd..903e4a32332 100644 --- a/code/modules/mob/living/carbon/human/species/tajaran.dm +++ b/code/modules/mob/living/carbon/human/species/tajaran.dm @@ -56,4 +56,4 @@ "is holding their breath!") /datum/species/tajaran/handle_death(gibbed, mob/living/carbon/human/H) - H.stop_tail_wagging(1) + H.stop_tail_wagging() diff --git a/code/modules/mob/living/carbon/human/species/unathi.dm b/code/modules/mob/living/carbon/human/species/unathi.dm index 61c34ab41d9..d4e9b02cd9b 100644 --- a/code/modules/mob/living/carbon/human/species/unathi.dm +++ b/code/modules/mob/living/carbon/human/species/unathi.dm @@ -104,7 +104,7 @@ return /datum/species/unathi/handle_death(gibbed, mob/living/carbon/human/H) - H.stop_tail_wagging(1) + H.stop_tail_wagging() /datum/species/unathi/ashwalker name = "Ash Walker" diff --git a/code/modules/mob/living/carbon/human/species/vox.dm b/code/modules/mob/living/carbon/human/species/vox.dm index e803a33f3ec..6ac20e77b9b 100644 --- a/code/modules/mob/living/carbon/human/species/vox.dm +++ b/code/modules/mob/living/carbon/human/species/vox.dm @@ -76,7 +76,7 @@ speciesbox = /obj/item/storage/box/survival_vox /datum/species/vox/handle_death(gibbed, mob/living/carbon/human/H) - H.stop_tail_wagging(1) + H.stop_tail_wagging() /datum/species/vox/after_equip_job(datum/job/J, mob/living/carbon/human/H) if(!H.mind || !H.mind.assigned_role || H.mind.assigned_role != "Clown" && H.mind.assigned_role != "Mime") diff --git a/code/modules/mob/living/carbon/human/species/vulpkanin.dm b/code/modules/mob/living/carbon/human/species/vulpkanin.dm index 9a313042d2d..920cd86659d 100644 --- a/code/modules/mob/living/carbon/human/species/vulpkanin.dm +++ b/code/modules/mob/living/carbon/human/species/vulpkanin.dm @@ -50,4 +50,4 @@ "is holding their breath!") /datum/species/vulpkanin/handle_death(gibbed, mob/living/carbon/human/H) - H.stop_tail_wagging(1) + H.stop_tail_wagging() diff --git a/code/modules/mob/living/carbon/human/species/wryn.dm b/code/modules/mob/living/carbon/human/species/wryn.dm index 9e02e2e28be..080a67a032b 100644 --- a/code/modules/mob/living/carbon/human/species/wryn.dm +++ b/code/modules/mob/living/carbon/human/species/wryn.dm @@ -50,7 +50,7 @@ /datum/species/wryn/handle_death(gibbed, mob/living/carbon/human/H) - for(var/mob/living/carbon/C in GLOB.living_mob_list) + for(var/mob/living/carbon/C in GLOB.alive_mob_list) if(C.get_int_organ(/obj/item/organ/internal/wryn/hivenode)) to_chat(C, "Your antennae tingle as you are overcome with pain...") to_chat(C, "It feels like part of you has died.") // This is bullshit diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index cbc768cdd02..2cce48d51c2 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -77,14 +77,14 @@ There are several things that need to be remembered: If you wish to update several overlays at once, you can set the argument to 0 to disable the update and call it manually: e.g. - update_inv_head(0) - update_inv_l_hand(0) + update_inv_head() + update_inv_l_hand() update_inv_r_hand() //<---calls update_icons() or equivillantly: - update_inv_head(0) - update_inv_l_hand(0) - update_inv_r_hand(0) + update_inv_head() + update_inv_l_hand() + update_inv_r_hand() update_icons() > If you need to update all overlays you can use regenerate_icons(). it works exactly like update_clothing used to. @@ -124,7 +124,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) //DAMAGE OVERLAYS //constructs damage icon for each organ from mask * damage field and saves it in our overlays_ lists -/mob/living/carbon/human/UpdateDamageIcon(var/update_icons=1) +/mob/living/carbon/human/UpdateDamageIcon() // first check whether something actually changed about damage appearance var/damage_appearance = "" @@ -164,7 +164,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) //BASE MOB SPRITE -/mob/living/carbon/human/proc/update_body(var/update_icons=1, var/rebuild_base=0) +/mob/living/carbon/human/proc/update_body(rebuild_base = FALSE) remove_overlay(BODY_LAYER) remove_overlay(LIMBS_LAYER) // So we don't get the old species' sprite splatted on top of the new one's remove_overlay(UNDERWEAR_LAYER) @@ -281,19 +281,19 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[BODY_LAYER] = standing apply_overlay(BODY_LAYER) //tail - update_tail_layer(0) + update_tail_layer() update_int_organs() //head accessory - update_head_accessory(0) + update_head_accessory() //markings - update_markings(0) + update_markings() //hair - update_hair(0) - update_fhair(0) + update_hair() + update_fhair() //MARKINGS OVERLAY -/mob/living/carbon/human/proc/update_markings(var/update_icons=1) +/mob/living/carbon/human/proc/update_markings() //Reset our markings. remove_overlay(MARKINGS_LAYER) @@ -325,7 +325,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(MARKINGS_LAYER) //HEAD ACCESSORY OVERLAY -/mob/living/carbon/human/proc/update_head_accessory(var/update_icons=1) +/mob/living/carbon/human/proc/update_head_accessory() //Reset our head accessory remove_overlay(HEAD_ACCESSORY_LAYER) remove_overlay(HEAD_ACC_OVER_LAYER) @@ -362,7 +362,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) //HAIR OVERLAY -/mob/living/carbon/human/proc/update_hair(var/update_icons=1) +/mob/living/carbon/human/proc/update_hair() //Reset our hair remove_overlay(HAIR_LAYER) @@ -403,7 +403,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) //FACIAL HAIR OVERLAY -/mob/living/carbon/human/proc/update_fhair(var/update_icons=1) +/mob/living/carbon/human/proc/update_fhair() //Reset our facial hair remove_overlay(FHAIR_LAYER) remove_overlay(FHAIR_OVER_LAYER) @@ -447,7 +447,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) -/mob/living/carbon/human/update_mutations(var/update_icons=1) +/mob/living/carbon/human/update_mutations() remove_overlay(MUTATIONS_LAYER) var/mutable_appearance/standing = mutable_appearance('icons/effects/genetics.dmi', layer = -MUTATIONS_LAYER) var/add_image = 0 @@ -478,7 +478,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(MUTATIONS_LAYER) -/mob/living/carbon/human/proc/update_mutantrace(var/update_icons=1) +/mob/living/carbon/human/proc/update_mutantrace() //BS12 EDIT var/skel = (SKELETON in mutations) if(skel) @@ -486,8 +486,8 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) else skeleton = null - update_hair(0) - update_fhair(0) + update_hair() + update_fhair() /mob/living/carbon/human/update_fire() @@ -501,41 +501,42 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) //For legacy support. /mob/living/carbon/human/regenerate_icons() ..() - if(notransform) return - update_mutations(0) - update_body(0, 1) //Update the body and force limb icon regeneration. - update_hair(0) - update_head_accessory(0) - update_fhair(0) - update_mutantrace(0) - update_inv_w_uniform(0,0) - update_inv_wear_id(0) - update_inv_gloves(0,0) - update_inv_glasses(0) - update_inv_ears(0) - update_inv_shoes(0,0) - update_inv_s_store(0) - update_inv_wear_mask(0) - update_inv_head(0,0) - update_inv_belt(0) - update_inv_back(0) - update_inv_wear_suit(0) - update_inv_r_hand(0) - update_inv_l_hand(0) - update_inv_handcuffed(0) - update_inv_legcuffed(0) - update_inv_pockets(0) - update_inv_wear_pda(0) - UpdateDamageIcon(0) + if(notransform) + return + update_mutations() + update_body(TRUE) //Update the body and force limb icon regeneration. + update_hair() + update_head_accessory() + update_fhair() + update_mutantrace() + update_inv_w_uniform() + update_inv_wear_id() + update_inv_gloves() + update_inv_glasses() + update_inv_ears() + update_inv_shoes() + update_inv_s_store() + update_inv_wear_mask() + update_inv_head() + update_inv_belt() + update_inv_back() + update_inv_wear_suit() + update_inv_r_hand() + update_inv_l_hand() + update_inv_handcuffed() + update_inv_legcuffed() + update_inv_pockets() + update_inv_wear_pda() + UpdateDamageIcon() force_update_limbs() - update_tail_layer(0) + update_tail_layer() overlays.Cut() // Force all overlays to regenerate update_fire() update_icons() /* --------------------------------------- */ //vvvvvv UPDATE_INV PROCS vvvvvv -/mob/living/carbon/human/update_inv_w_uniform(var/update_icons=1) +/mob/living/carbon/human/update_inv_w_uniform() remove_overlay(UNIFORM_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_w_uniform] @@ -593,7 +594,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) thing.plane = initial(thing.plane) apply_overlay(UNIFORM_LAYER) -/mob/living/carbon/human/update_inv_wear_id(var/update_icons=1) +/mob/living/carbon/human/update_inv_wear_id() remove_overlay(ID_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_id] @@ -609,7 +610,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[ID_LAYER] = mutable_appearance('icons/mob/mob.dmi', "id", layer = -ID_LAYER) apply_overlay(ID_LAYER) -/mob/living/carbon/human/update_inv_gloves(var/update_icons=1) +/mob/living/carbon/human/update_inv_gloves() remove_overlay(GLOVES_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_gloves] @@ -646,7 +647,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(GLOVES_LAYER) -/mob/living/carbon/human/update_inv_glasses(var/update_icons=1) +/mob/living/carbon/human/update_inv_glasses() remove_overlay(GLASSES_LAYER) remove_overlay(GLASSES_OVER_LAYER) remove_overlay(OVER_MASK_LAYER) @@ -687,7 +688,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) update_misc_effects() -/mob/living/carbon/human/update_inv_ears(var/update_icons=1) +/mob/living/carbon/human/update_inv_ears() remove_overlay(EARS_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_l_ear] @@ -735,7 +736,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[EARS_LAYER] = mutable_appearance('icons/mob/ears.dmi', "[t_type]", layer = -EARS_LAYER) apply_overlay(EARS_LAYER) -/mob/living/carbon/human/update_inv_shoes(var/update_icons=1) +/mob/living/carbon/human/update_inv_shoes() remove_overlay(SHOES_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_shoes] @@ -771,7 +772,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[SHOES_LAYER] = bloodsies apply_overlay(SHOES_LAYER) -/mob/living/carbon/human/update_inv_s_store(var/update_icons=1) +/mob/living/carbon/human/update_inv_s_store() remove_overlay(SUIT_STORE_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_s_store] @@ -792,7 +793,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(SUIT_STORE_LAYER) -/mob/living/carbon/human/update_inv_head(var/update_icons=1) +/mob/living/carbon/human/update_inv_head() ..() remove_overlay(HEAD_LAYER) if(client && hud_used) @@ -818,7 +819,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[HEAD_LAYER] = standing apply_overlay(HEAD_LAYER) -/mob/living/carbon/human/update_inv_belt(var/update_icons=1) +/mob/living/carbon/human/update_inv_belt() remove_overlay(BELT_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_belt] @@ -844,7 +845,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(BELT_LAYER) -/mob/living/carbon/human/update_inv_wear_suit(var/update_icons=1) +/mob/living/carbon/human/update_inv_wear_suit() remove_overlay(SUIT_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_suit] @@ -885,8 +886,8 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[SUIT_LAYER] = standing apply_overlay(SUIT_LAYER) - update_tail_layer(0) - update_collar(0) + update_tail_layer() + update_collar() /mob/living/carbon/human/update_inv_pockets() if(client && hud_used) @@ -919,7 +920,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) client.screen += wear_pda wear_pda.screen_loc = ui_pda -/mob/living/carbon/human/update_inv_wear_mask(var/update_icons = 1) +/mob/living/carbon/human/update_inv_wear_mask() ..() remove_overlay(FACEMASK_LAYER) if(client && hud_used) @@ -955,7 +956,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(FACEMASK_LAYER) -/mob/living/carbon/human/update_inv_back(var/update_icons=1) +/mob/living/carbon/human/update_inv_back() ..() remove_overlay(BACK_LAYER) if(back) @@ -978,7 +979,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[BACK_LAYER] = standing apply_overlay(BACK_LAYER) -/mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1) +/mob/living/carbon/human/update_inv_handcuffed() remove_overlay(HANDCUFF_LAYER) if(handcuffed) if(istype(handcuffed, /obj/item/restraints/handcuffs/pinkcuffs)) @@ -987,7 +988,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) overlays_standing[HANDCUFF_LAYER] = mutable_appearance('icons/mob/mob.dmi', "handcuff1", layer = -HANDCUFF_LAYER) apply_overlay(HANDCUFF_LAYER) -/mob/living/carbon/human/update_inv_legcuffed(var/update_icons=1) +/mob/living/carbon/human/update_inv_legcuffed() remove_overlay(LEGCUFF_LAYER) clear_alert("legcuffed") if(legcuffed) @@ -1000,7 +1001,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(LEGCUFF_LAYER) -/mob/living/carbon/human/update_inv_r_hand(var/update_icons=1) +/mob/living/carbon/human/update_inv_r_hand() ..() remove_overlay(R_HAND_LAYER) if(r_hand) @@ -1019,7 +1020,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(R_HAND_LAYER) -/mob/living/carbon/human/update_inv_l_hand(var/update_icons=1) +/mob/living/carbon/human/update_inv_l_hand() ..() remove_overlay(L_HAND_LAYER) if(l_hand) @@ -1060,7 +1061,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) client.screen += I -/mob/living/carbon/human/proc/update_tail_layer(var/update_icons=1) +/mob/living/carbon/human/proc/update_tail_layer() remove_overlay(TAIL_UNDERLIMBS_LAYER) // SEW direction icons, overlayed by LIMBS_LAYER. remove_overlay(TAIL_LAYER) /* This will be one of two things: If the species' tail is overlapped by limbs, this will be only the N direction icon so tails @@ -1135,7 +1136,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(TAIL_LAYER) apply_overlay(TAIL_UNDERLIMBS_LAYER) -/mob/living/carbon/human/proc/start_tail_wagging(var/update_icons=1) +/mob/living/carbon/human/proc/start_tail_wagging() remove_overlay(TAIL_UNDERLIMBS_LAYER) // SEW direction icons, overlayed by LIMBS_LAYER. remove_overlay(TAIL_LAYER) /* This will be one of two things: If the species' tail is overlapped by limbs, this will be only the N direction icon so tails @@ -1211,10 +1212,10 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) apply_overlay(TAIL_LAYER) apply_overlay(TAIL_UNDERLIMBS_LAYER) -/mob/living/carbon/human/proc/stop_tail_wagging(var/update_icons=1) +/mob/living/carbon/human/proc/stop_tail_wagging() remove_overlay(TAIL_UNDERLIMBS_LAYER) remove_overlay(TAIL_LAYER) - update_tail_layer(update_icons) //just trigger a full update for normal stationary sprites + update_tail_layer() //just trigger a full update for normal stationary sprites /mob/living/carbon/human/proc/update_int_organs() remove_overlay(INTORGAN_LAYER) @@ -1236,7 +1237,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) //Adds a collar overlay above the helmet layer if the suit has one // Suit needs an identically named sprite in icons/mob/collar.dmi // For suits with sprite_sheets, an identically named sprite needs to exist in a file like this icons/mob/species/[species_name_here]/collar.dmi. -/mob/living/carbon/human/proc/update_collar(var/update_icons=1) +/mob/living/carbon/human/proc/update_collar() remove_overlay(COLLAR_LAYER) var/icon/C = new('icons/mob/collar.dmi') var/mutable_appearance/standing = null @@ -1282,7 +1283,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts) /mob/living/carbon/human/proc/force_update_limbs() for(var/obj/item/organ/external/O in bodyparts) O.sync_colour_to_human(src) - update_body(0) + update_body() /mob/living/carbon/human/proc/get_overlays_copy(list/unwantedLayers) var/list/out = new diff --git a/code/modules/mob/living/carbon/human/update_stat.dm b/code/modules/mob/living/carbon/human/update_stat.dm index 14c87e13722..d5d1801e1a7 100644 --- a/code/modules/mob/living/carbon/human/update_stat.dm +++ b/code/modules/mob/living/carbon/human/update_stat.dm @@ -12,7 +12,7 @@ /mob/living/carbon/human/update_nearsighted_effects() var/obj/item/clothing/glasses/G = glasses - if((disabilities & NEARSIGHTED) && (!istype(G) || !G.prescription)) + if((NEARSIGHTED in mutations) && (!istype(G) || !G.prescription)) overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1) else clear_fullscreen("nearsighted") diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 87832154876..a2df4b30e9e 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -1,25 +1,35 @@ /mob/living/carbon/Life(seconds, times_fired) set invisibility = 0 - set background = BACKGROUND_ENABLED if(notransform) return - if(!loc) + + if(damageoverlaytemp) + damageoverlaytemp = 0 + update_damage_hud() + + if(stat != DEAD) + handle_organs() + + . = ..() + + if(QDELETED(src)) return - if(..()) - . = 1 + if(.) //not dead handle_blood() - for(var/obj/item/organ/internal/O in internal_organs) - O.on_life() - handle_patches() - handle_changeling() + if(LAZYLEN(processing_patches)) + handle_patches() + if(mind) + handle_changeling() handle_wetness(times_fired) // Increase germ_level regularly - if(germ_level < GERM_LEVEL_AMBIENT && prob(30)) //if you're just standing there, you shouldn't get more germs beyond an ambient level - germ_level++ + handle_germs() + + if(stat != DEAD) + return TRUE /////////////// @@ -112,7 +122,7 @@ var/O2_partialpressure = (breath.oxygen/breath.total_moles())*breath_pressure var/Toxins_partialpressure = (breath.toxins/breath.total_moles())*breath_pressure var/CO2_partialpressure = (breath.carbon_dioxide/breath.total_moles())*breath_pressure - + var/SA_partialpressure = (breath.sleeping_agent/breath.total_moles())*breath_pressure //OXYGEN if(O2_partialpressure < safe_oxy_min) //Not enough oxygen @@ -152,22 +162,20 @@ //TOXINS/PLASMA if(Toxins_partialpressure > safe_tox_max) var/ratio = (breath.toxins/safe_tox_max) * 10 - adjustToxLoss(Clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE)) + adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE)) throw_alert("too_much_tox", /obj/screen/alert/too_much_tox) else clear_alert("too_much_tox") //TRACE GASES - if(breath.trace_gases.len) - for(var/datum/gas/sleeping_agent/SA in breath.trace_gases) - var/SA_partialpressure = (SA.moles/breath.total_moles())*breath_pressure - if(SA_partialpressure > SA_para_min) - Paralyse(3) - if(SA_partialpressure > SA_sleep_min) - AdjustSleeping(2, bound_lower = 0, bound_upper = 10) - else if(SA_partialpressure > 0.01) - if(prob(20)) - emote(pick("giggle","laugh")) + if(breath.sleeping_agent) + if(SA_partialpressure > SA_para_min) + Paralyse(3) + if(SA_partialpressure > SA_sleep_min) + AdjustSleeping(2, bound_lower = 0, bound_upper = 10) + else if(SA_partialpressure > 0.01) + if(prob(20)) + emote(pick("giggle","laugh")) //BREATH TEMPERATURE handle_breath_temperature(breath) @@ -192,6 +200,11 @@ else update_action_buttons_icon() +/mob/living/carbon/proc/handle_organs() + for(var/thing in internal_organs) + var/obj/item/organ/internal/O = thing + O.on_life() + /mob/living/carbon/handle_diseases() for(var/thing in viruses) var/datum/disease/D = thing @@ -230,12 +243,11 @@ adjustToxLoss(3) updatehealth("handle mutations and radiation(75-100)") - radiation = Clamp(radiation, 0, 100) + radiation = clamp(radiation, 0, 100) /mob/living/carbon/handle_chemicals_in_body() - if(reagents) - reagents.metabolize(src) + reagents.metabolize(src) /mob/living/carbon/proc/handle_wetness(times_fired) @@ -262,7 +274,9 @@ if(stam_regen_start_time <= world.time) if(stam_paralyzed) update_stamina() - setStaminaLoss(0, FALSE) + if(staminaloss) + setStaminaLoss(0, FALSE) + update_health_hud() var/restingpwr = 1 + 4 * resting @@ -320,8 +334,17 @@ AdjustHallucinate(-2) + // Keep SSD people asleep + if(player_logged) + Sleeping(2) + /mob/living/carbon/handle_sleeping() if(..()) + if(mind?.vampire) + if(istype(loc, /obj/structure/closet/coffin)) + adjustBruteLoss(-1, FALSE) + adjustFireLoss(-1, FALSE) + adjustToxLoss(-1) handle_dreams() adjustStaminaLoss(-10) var/comfort = 1 @@ -337,44 +360,42 @@ comfort += 1 //Aren't naps SO much better when drunk? AdjustDrunk(-0.2*comfort) //reduce drunkenness while sleeping. if(comfort > 1 && prob(3))//You don't heal if you're just sleeping on the floor without a blanket. - adjustBruteLoss(-1*comfort) - adjustFireLoss(-1*comfort) + adjustBruteLoss(-1 * comfort, FALSE) + adjustFireLoss(-1 * comfort) if(prob(10) && health && hal_screwyhud != SCREWYHUD_CRIT) emote("snore") - // Keep SSD people asleep - if(player_logged) - Sleeping(2) + return sleeping -/mob/living/carbon/handle_hud_icons() - return - -/mob/living/carbon/handle_hud_icons_health() +/mob/living/carbon/update_health_hud(shown_health_amount) if(!client) return if(healths) if(stat != DEAD) - switch(health) - if(100 to INFINITY) - healths.icon_state = "health0" - if(80 to 100) - healths.icon_state = "health1" - if(60 to 80) - healths.icon_state = "health2" - if(40 to 60) - healths.icon_state = "health3" - if(20 to 40) - healths.icon_state = "health4" - if(0 to 20) - healths.icon_state = "health5" - else - healths.icon_state = "health6" + . = TRUE + if(shown_health_amount == null) + shown_health_amount = health + if(shown_health_amount >= maxHealth) + healths.icon_state = "health0" + else if(shown_health_amount > maxHealth * 0.8) + healths.icon_state = "health1" + else if(shown_health_amount > maxHealth * 0.6) + healths.icon_state = "health2" + else if(shown_health_amount > maxHealth * 0.4) + healths.icon_state = "health3" + else if(shown_health_amount > maxHealth * 0.2) + healths.icon_state = "health4" + else if(shown_health_amount > 0) + healths.icon_state = "health5" + else + healths.icon_state = "health6" else healths.icon_state = "health7" - handle_hud_icons_health_overlay() -/mob/living/carbon/proc/handle_hud_icons_health_overlay() +/mob/living/carbon/update_damage_hud() + if(!client) + return if(stat == UNCONSCIOUS && health <= HEALTH_THRESHOLD_CRIT) if(check_death_method()) var/severity = 0 @@ -441,20 +462,23 @@ clear_fullscreen("brute") /mob/living/carbon/proc/handle_patches() - if(LAZYLEN(processing_patches)) - var/multiple_patch_multiplier = processing_patches.len > 1 ? (processing_patches.len * 1.5) : 1 - var/applied_amount = 0.35 * multiple_patch_multiplier + var/multiple_patch_multiplier = processing_patches.len > 1 ? (processing_patches.len * 1.5) : 1 + var/applied_amount = 0.35 * multiple_patch_multiplier - for(var/patch in processing_patches) - var/obj/item/reagent_containers/food/pill/patch/P = patch + for(var/patch in processing_patches) + var/obj/item/reagent_containers/food/pill/patch/P = patch - if(P.reagents && P.reagents.total_volume) - var/fractional_applied_amount = applied_amount / P.reagents.total_volume - P.reagents.reaction(src, REAGENT_TOUCH, fractional_applied_amount, P.needs_to_apply_reagents) - P.needs_to_apply_reagents = FALSE - P.reagents.trans_to(src, applied_amount * 0.5) - P.reagents.remove_any(applied_amount * 0.5) - else - if(!P.reagents || P.reagents.total_volume <= 0) - processing_patches -= P - qdel(P) + if(P.reagents && P.reagents.total_volume) + var/fractional_applied_amount = applied_amount / P.reagents.total_volume + P.reagents.reaction(src, REAGENT_TOUCH, fractional_applied_amount, P.needs_to_apply_reagents) + P.needs_to_apply_reagents = FALSE + P.reagents.trans_to(src, applied_amount * 0.5) + P.reagents.remove_any(applied_amount * 0.5) + else + if(!P.reagents || P.reagents.total_volume <= 0) + processing_patches -= P + qdel(P) + +/mob/living/carbon/proc/handle_germs() + if(germ_level < GERM_LEVEL_AMBIENT && prob(30)) //if you're just standing there, you shouldn't get more germs beyond an ambient level + germ_level++ diff --git a/code/modules/mob/living/carbon/update_status.dm b/code/modules/mob/living/carbon/update_status.dm index b67953c7e69..918968800ce 100644 --- a/code/modules/mob/living/carbon/update_status.dm +++ b/code/modules/mob/living/carbon/update_status.dm @@ -2,12 +2,10 @@ if(status_flags & GODMODE) return if(stat != DEAD) -// if(health <= min_health) if(health <= HEALTH_THRESHOLD_DEAD && check_death_method()) death() create_debug_log("died of damage, trigger reason: [reason]") return -// if(paralysis || sleeping || getOxyLoss() > low_oxy_ko || (status_flags & FAKEDEATH) || health <= crit_health) if(paralysis || sleeping || (check_death_method() && getOxyLoss() > 50) || (status_flags & FAKEDEATH) || health <= HEALTH_THRESHOLD_CRIT && check_death_method()) if(stat == CONSCIOUS) KnockOut() @@ -16,6 +14,9 @@ if(stat == UNCONSCIOUS) WakeUp() create_debug_log("woke up, trigger reason: [reason]") + update_damage_hud() + update_health_hud() + med_hud_set_status() /mob/living/carbon/update_stamina() var/stam = getStaminaLoss() @@ -24,7 +25,6 @@ else if(stam_paralyzed) stam_paralyzed = FALSE update_canmove() - handle_hud_icons_health() /mob/living/carbon/can_hear() . = FALSE diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index fa1c392334d..60f186631b7 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -269,6 +269,7 @@ if(amount > 0) stam_regen_start_time = world.time + STAMINA_REGEN_BLOCK_TIME if(updating) + update_health_hud() update_stamina() /mob/living/proc/setStaminaLoss(amount, updating = TRUE) @@ -284,6 +285,7 @@ if(amount > 0) stam_regen_start_time = world.time + STAMINA_REGEN_BLOCK_TIME if(updating) + update_health_hud() update_stamina() /mob/living/proc/getMaxHealth() diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 0984c56decb..6af90792355 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -61,10 +61,13 @@ if(mind && suiciding) mind.suicided = TRUE + reset_perspective(null) clear_fullscreens() update_sight() update_action_buttons_icon() + update_damage_hud() + update_health_hud() med_hud_set_health() med_hud_set_status() if(!gibbed && !QDELETED(src)) @@ -83,7 +86,7 @@ timeofdeath = world.time create_log(ATTACK_LOG, "died[gibbed ? " (Gibbed)": ""]") - GLOB.living_mob_list -= src + GLOB.alive_mob_list -= src GLOB.dead_mob_list += src if(mind) mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 5ab604e5b3e..6d020ccdad1 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -1,12 +1,10 @@ -/mob/living/Life(seconds, times_fired) +/mob/living/proc/Life(seconds, times_fired) + set waitfor = FALSE set invisibility = 0 - set background = BACKGROUND_ENABLED - if(notransform) - return FALSE - if(!loc) - return FALSE - var/datum/gas_mixture/environment = loc.return_air() + if(flying) //TODO: Better floating + animate(src, pixel_y = pixel_y + 5 , time = 10, loop = 1, easing = SINE_EASING) + animate(pixel_y = pixel_y - 5, time = 10, loop = 1, easing = SINE_EASING) if(client || registered_z) // This is a temporary error tracker to make sure we've caught everything var/turf/T = get_turf(src) @@ -17,28 +15,44 @@ else if (!client && registered_z) log_game("Z-TRACKING: [src] of type [src.type] has a Z-registration despite not having a client.") update_z(null) + + if(notransform) + return FALSE + if(!loc) + return FALSE + if(stat != DEAD) //Chemicals in the body - handle_chemicals_in_body() + if(reagents) + handle_chemicals_in_body() + if(QDELETED(src)) // some chems can gib mobs + return + + if(stat != DEAD) //Mutations and radiation handle_mutations_and_radiation() + if(stat != DEAD) //Breathing, if applicable handle_breathing(times_fired) + if(stat != DEAD) //Random events (vomiting etc) handle_random_events() - . = 1 + if(LAZYLEN(viruses)) + handle_diseases() - handle_diseases() + if(QDELETED(src)) // diseases can qdel the mob via transformations + return //Heart Attack, if applicable if(stat != DEAD) handle_heartattack() //Handle temperature/pressure differences between body and environment + var/datum/gas_mixture/environment = loc.return_air() if(environment) handle_environment(environment) @@ -49,19 +63,38 @@ update_gravity(mob_has_gravity()) - update_pulling() + if(pulling) + update_pulling() for(var/obj/item/grab/G in src) G.process() - if(handle_regular_status_updates()) // Status & health update, are we dead or alive etc. + if(stat != DEAD) + handle_critical_condition() + + if(stat != DEAD) // Status & health update, are we dead or alive etc. handle_disabilities() // eye, ear, brain damages + + if(stat != DEAD) handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc - if(client) - handle_regular_hud_updates() + if(stat != DEAD) + if(forced_look) + if(!isnum(forced_look)) + var/atom/A = locateUID(forced_look) + if(istype(A)) + var/view = client ? client.view : world.view + if(get_dist(src, A) > view || !(src in viewers(view, A))) + forced_look = null + to_chat(src, "Your direction target has left your view, you are no longer facing anything.") + return + setDir() - ..() + if(machine) + machine.check_eye(src) + + if(stat != DEAD) + return TRUE /mob/living/proc/handle_breathing(times_fired) return @@ -71,7 +104,6 @@ /mob/living/proc/handle_mutations_and_radiation() radiation = 0 //so radiation don't accumulate in simple animals - return /mob/living/proc/handle_chemicals_in_body() return @@ -89,122 +121,54 @@ return /mob/living/proc/update_pulling() - if(pulling) - if(incapacitated()) - stop_pulling() - -//This updates the health and status of the mob (conscious, unconscious, dead) -/mob/living/proc/handle_regular_status_updates() - return stat != DEAD + if(incapacitated()) + stop_pulling() //this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc.. -/mob/living/proc/handle_status_effects() - handle_stunned() - handle_weakened() - handle_stuttering() - handle_silent() - handle_drugged() - handle_slurring() - handle_paralysed() - handle_sleeping() - handle_slowed() - handle_drunk() - handle_cultslurring() - - -/mob/living/proc/handle_stunned() +/mob/living/proc/handle_status_effects() // We check for the status effect in this proc as opposed to the procs below to avoid excessive proc call overhead if(stunned) AdjustStunned(-1, updating = 1, force = 1) - if(!stunned) - update_icons() - return stunned - -/mob/living/proc/handle_weakened() if(weakened) AdjustWeakened(-1, updating = 1, force = 1) - if(!weakened) - update_icons() - return weakened - -/mob/living/proc/handle_stuttering() if(stuttering) - stuttering = max(stuttering-1, 0) - return stuttering - -/mob/living/proc/handle_silent() + stuttering = max(stuttering - 1, 0) if(silent) AdjustSilence(-1) - return silent - -/mob/living/proc/handle_drugged() if(druggy) AdjustDruggy(-1) - return druggy - -/mob/living/proc/handle_slurring() if(slurring) AdjustSlur(-1) - return slurring - -/mob/living/proc/handle_cultslurring() - if(cultslurring) - AdjustCultSlur(-1) - return cultslurring - -/mob/living/proc/handle_paralysed() if(paralysis) AdjustParalysis(-1, updating = 1, force = 1) - return paralysis - -/mob/living/proc/handle_sleeping() if(sleeping) - AdjustSleeping(-1) - throw_alert("asleep", /obj/screen/alert/asleep) - else - clear_alert("asleep") - return sleeping - -/mob/living/proc/handle_slowed() + handle_sleeping() if(slowed) AdjustSlowed(-1) - return slowed + if(drunk) + handle_drunk() + if(cultslurring) + AdjustCultSlur(-1) + +/mob/living/proc/update_damage_hud() + return + +/mob/living/proc/handle_sleeping() + AdjustSleeping(-1) + return sleeping /mob/living/proc/handle_drunk() - if(drunk) - AdjustDrunk(-1) + AdjustDrunk(-1) return drunk /mob/living/proc/handle_disabilities() //Eyes - if(disabilities & BLIND || stat) //blindness from disability or unconsciousness doesn't get better on its own + if((BLINDNESS in mutations) || stat) //blindness from disability or unconsciousness doesn't get better on its own EyeBlind(1) else if(eye_blind) //blindness, heals slowly over time AdjustEyeBlind(-1) else if(eye_blurry) //blurry eyes heal slowly AdjustEyeBlurry(-1) -//this handles hud updates. Calls update_vision() and handle_hud_icons() -/mob/living/proc/handle_regular_hud_updates() - if(!client) return 0 - - handle_vision() - handle_hud_icons() - - return 1 - -/mob/living/proc/handle_vision() - update_sight() - - if(stat == DEAD) - return - - if(machine) - if(!machine.check_eye(src)) - reset_perspective(null) - else - if(!remote_view && !client.adminobs) - reset_perspective(null) - // Gives a mob the vision of being dead /mob/living/proc/grant_death_vision() sight |= SEE_TURFS @@ -215,9 +179,37 @@ see_invisible = SEE_INVISIBLE_OBSERVER sync_lighting_plane_alpha() -/mob/living/proc/handle_hud_icons() - handle_hud_icons_health() +/mob/living/proc/handle_critical_condition() return -/mob/living/proc/handle_hud_icons_health() - return +/mob/living/update_health_hud() + if(!client) + return + if(healths) + var/severity = 0 + var/healthpercent = (health / maxHealth) * 100 + switch(healthpercent) + if(100 to INFINITY) + healths.icon_state = "health0" + if(80 to 100) + healths.icon_state = "health1" + severity = 1 + if(60 to 80) + healths.icon_state = "health2" + severity = 2 + if(40 to 60) + healths.icon_state = "health3" + severity = 3 + if(20 to 40) + healths.icon_state = "health4" + severity = 4 + if(1 to 20) + healths.icon_state = "health5" + severity = 5 + else + healths.icon_state = "health7" + severity = 6 + if(severity > 0) + overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity) + else + clear_fullscreen("brute") diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 8371cacaebe..9f768ffc76d 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -3,6 +3,7 @@ var/datum/atom_hud/data/human/medical/advanced/medhud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] medhud.add_to_hud(src) faction += "\ref[src]" + GLOB.mob_living_list += src /mob/living/prepare_huds() ..() @@ -17,7 +18,7 @@ if(ranged_ability) ranged_ability.remove_ranged_ability(src) remove_from_all_data_huds() - + GLOB.mob_living_list -= src if(LAZYLEN(status_effects)) for(var/s in status_effects) var/datum/status_effect/S = s @@ -285,8 +286,9 @@ health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() update_stat("updatehealth([reason])") - handle_hud_icons_health() med_hud_set_health() + med_hud_set_status() + update_health_hud() //This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually @@ -738,7 +740,8 @@ clear_alert("weightless") else throw_alert("weightless", /obj/screen/alert/weightless) - float(!has_gravity) + if(!flying) + float(!has_gravity) /mob/living/proc/float(on) if(throwing) @@ -759,7 +762,7 @@ //called when the mob receives a bright flash /mob/living/proc/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, type = /obj/screen/fullscreen/flash) - if(check_eye_prot() < intensity && (override_blindness_check || !(disabilities & BLIND))) + if(check_eye_prot() < intensity && (override_blindness_check || !(BLINDNESS in mutations))) overlay_fullscreen("flash", type) addtimer(CALLBACK(src, .proc/clear_fullscreen, "flash", 25), 25) return 1 @@ -802,7 +805,7 @@ if(do_mob(src, who, what.put_on_delay)) if(what && Adjacent(who) && !(what.flags & NODROP)) unEquip(what) - who.equip_to_slot_if_possible(what, where, 0, 1) + who.equip_to_slot_if_possible(what, where, FALSE, TRUE) add_attack_logs(src, who, "Equipped [what]") /mob/living/singularity_act() @@ -823,8 +826,7 @@ spawn_dust() gib() -/mob/living/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) - end_pixel_y = get_standard_pixel_y_offset(lying) +/mob/living/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!used_item) used_item = get_active_hand() ..() @@ -1025,9 +1027,9 @@ if("stat") if((stat == DEAD) && (var_value < DEAD))//Bringing the dead back to life GLOB.dead_mob_list -= src - GLOB.living_mob_list += src + GLOB.alive_mob_list += src if((stat < DEAD) && (var_value == DEAD))//Kill he - GLOB.living_mob_list -= src + GLOB.alive_mob_list -= src GLOB.dead_mob_list += src . = ..() switch(var_name) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 604fd47de16..a67d00679f4 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -79,9 +79,9 @@ /obj/item/proc/get_volume_by_throwforce_and_or_w_class() if(throwforce && w_class) - return Clamp((throwforce + w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100 + return clamp((throwforce + w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100 else if(w_class) - return Clamp(w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100 + return clamp(w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100 else return 0 @@ -175,7 +175,7 @@ return /mob/living/proc/adjust_fire_stacks(add_fire_stacks) //Adjusting the amount of fire_stacks we have on person - fire_stacks = Clamp(fire_stacks + add_fire_stacks, -20, 20) + fire_stacks = clamp(fire_stacks + add_fire_stacks, -20, 20) if(on_fire && fire_stacks <= 0) ExtinguishMob() diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index edb62d0e013..fb633f116bd 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -172,6 +172,9 @@ proc/get_radio_key_from_channel(var/channel) var/list/hsp = handle_speech_problems(message_pieces, verb) verb = hsp["verb"] + // Do this so it gets logged for all types of communication + var/log_message = "[message_mode ? "([message_mode])" : ""] '[message]'" + create_log(SAY_LOG, log_message) var/list/used_radios = list() if(handle_message_mode(message_mode, message_pieces, verb, used_radios)) @@ -179,9 +182,7 @@ proc/get_radio_key_from_channel(var/channel) // Log of what we've said, plain message, no spans or junk // handle_message_mode should have logged this already if it handled it - var/log_message = "[message_mode ? "([message_mode])" : ""] '[message]'" say_log += log_message - create_log(SAY_LOG, log_message) // TODO after #13047: Include the channel log_say(log_message, src) var/list/handle_v = handle_speech_sound() @@ -335,7 +336,8 @@ proc/get_radio_key_from_channel(var/channel) var/datum/multilingual_say_piece/S = message_pieces // Yay BYOND's hilarious typecasting S.speaking.broadcast(src, S.message) return 1 - + // Log it here since it skips the default way say handles it + create_log(SAY_LOG, "(whisper) '[message]'") whisper_say(message_pieces) // for weird circumstances where you're inside an atom that is also you, like pai's @@ -364,7 +366,6 @@ proc/get_radio_key_from_channel(var/channel) say_log += "whisper: [message]" log_whisper(message, src) - create_log(SAY_LOG, "WHISPER: [message]") var/message_range = 1 var/eavesdropping_range = 2 var/watching_range = 5 diff --git a/code/modules/mob/living/silicon/ai/death.dm b/code/modules/mob/living/silicon/ai/death.dm index 641b1a2af0f..717f9700316 100644 --- a/code/modules/mob/living/silicon/ai/death.dm +++ b/code/modules/mob/living/silicon/ai/death.dm @@ -34,7 +34,7 @@ spawn(10) explosion(src.loc, 3, 6, 12, 15) - for(var/obj/machinery/ai_status_display/O in world) //change status + for(var/obj/machinery/ai_status_display/O in GLOB.machines) //change status O.mode = 2 if(istype(loc, /obj/item/aicard)) diff --git a/code/modules/mob/living/silicon/ai/freelook/chunk.dm b/code/modules/mob/living/silicon/ai/freelook/chunk.dm index 4b124c364c2..03e56a5e26e 100644 --- a/code/modules/mob/living/silicon/ai/freelook/chunk.dm +++ b/code/modules/mob/living/silicon/ai/freelook/chunk.dm @@ -67,9 +67,6 @@ // The actual updating. It gathers the visible turfs from cameras and puts them into the appropiate lists. /datum/camerachunk/proc/update() - - set background = BACKGROUND_ENABLED - var/list/newVisibleTurfs = list() for(var/camera in cameras) diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 8d1555182a2..61151e35c92 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -37,7 +37,8 @@ else adjustOxyLoss(-1) - handle_stunned() + if(stunned) + AdjustStunned(-1, updating = 1, force = 1) var/area/my_area = get_area(src) @@ -140,7 +141,6 @@ else health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() update_stat("updatehealth([reason])") - diag_hud_set_status() diag_hud_set_health() diff --git a/code/modules/mob/living/silicon/ai/logout.dm b/code/modules/mob/living/silicon/ai/logout.dm index a8060abd15c..d9dac308870 100644 --- a/code/modules/mob/living/silicon/ai/logout.dm +++ b/code/modules/mob/living/silicon/ai/logout.dm @@ -1,6 +1,6 @@ /mob/living/silicon/ai/Logout() ..() - for(var/obj/machinery/ai_status_display/O in world) //change status + for(var/obj/machinery/ai_status_display/O in GLOB.machines) //change status O.mode = 0 src.view_core() return diff --git a/code/modules/mob/living/silicon/ai/update_status.dm b/code/modules/mob/living/silicon/ai/update_status.dm index fd001956c67..8ee4a825631 100644 --- a/code/modules/mob/living/silicon/ai/update_status.dm +++ b/code/modules/mob/living/silicon/ai/update_status.dm @@ -9,7 +9,7 @@ else if(stat == UNCONSCIOUS) WakeUp() create_debug_log("woke up, trigger reason: [reason]") - //diag_hud_set_status() + diag_hud_set_status() /mob/living/silicon/ai/has_vision(information_only = FALSE) return ..() && !lacks_power() diff --git a/code/modules/mob/living/silicon/decoy/death.dm b/code/modules/mob/living/silicon/decoy/death.dm index 9e58001f47b..74db72978e0 100644 --- a/code/modules/mob/living/silicon/decoy/death.dm +++ b/code/modules/mob/living/silicon/decoy/death.dm @@ -4,7 +4,7 @@ if(!.) return FALSE icon_state = "ai-crash" - for(var/obj/machinery/ai_status_display/O in world) //change status + for(var/obj/machinery/ai_status_display/O in GLOB.machines) //change status if(atoms_share_level(O, src)) O.mode = 2 gib() diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index d91b724370b..321362217a1 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -1,22 +1,18 @@ /mob/living/silicon/pai/Life(seconds, times_fired) . = ..() - if(.) - //if(secHUD == 1) - // process_sec_hud(src, 1) - ////if(medHUD == 1) - // process_med_hud(src, 1) - if(silence_time) - if(world.timeofday >= silence_time) - silence_time = null - to_chat(src, "Communication circuit reinitialized. Speech and messaging functionality restored.") + if(QDELETED(src) || stat == DEAD) + return + if(silence_time) + if(world.timeofday >= silence_time) + silence_time = null + to_chat(src, "Communication circuit reinitialized. Speech and messaging functionality restored.") - if(cable) - if(get_dist(src, cable) > 1) - var/turf/T = get_turf_or_move(loc) - for(var/mob/M in viewers(T)) - M.show_message("The data cable rapidly retracts back into its spool.", 3, "You hear a click and the sound of wire spooling rapidly.", 2) - qdel(src.cable) - cable = null + if(cable) + if(get_dist(src, cable) > 1) + var/turf/T = get_turf_or_move(loc) + for(var/mob/M in viewers(T)) + M.show_message("The data cable rapidly retracts back into its spool.", 3, "You hear a click and the sound of wire spooling rapidly.", 2) + QDEL_NULL(cable) /mob/living/silicon/pai/updatehealth(reason = "none given") if(status_flags & GODMODE) diff --git a/code/modules/mob/living/silicon/robot/death.dm b/code/modules/mob/living/silicon/robot/death.dm index 224c706f324..72d9b210712 100644 --- a/code/modules/mob/living/silicon/robot/death.dm +++ b/code/modules/mob/living/silicon/robot/death.dm @@ -18,7 +18,7 @@ flick("gibbed-r", animation) robogibs(loc) - GLOB.living_mob_list -= src + GLOB.alive_mob_list -= src GLOB.dead_mob_list -= src QDEL_IN(animation, 15) QDEL_IN(src, 15) diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index dc32deaf5a7..39bedc78c77 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -18,6 +18,8 @@ magpulse = 1 mob_size = MOB_SIZE_SMALL + modules_break = FALSE + // We need to keep track of a few module items so we don't need to do list operations // every time we need them. These get set in New() after the module is chosen. var/obj/item/stack/sheet/metal/cyborg/stack_metal = null @@ -142,7 +144,7 @@ user.visible_message("\the [user] swipes [user.p_their()] ID card through [src], attempting to reboot it.", "You swipe your ID card through [src], attempting to reboot it.") last_reboot = world.time / 10 var/drones = 0 - for(var/mob/living/silicon/robot/drone/D in world) + for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) if(D.key && D.client) drones++ if(drones < config.max_maint_drones) diff --git a/code/modules/mob/living/silicon/robot/drone/drone_console.dm b/code/modules/mob/living/silicon/robot/drone/drone_console.dm index 80d9f4d1ba3..d961d8e1c62 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_console.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_console.dm @@ -34,7 +34,7 @@ var/dat dat += "Maintenance Units
" - for(var/mob/living/silicon/robot/drone/D in world) + for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) dat += "
[D.real_name] ([D.stat == 2 ? "INACTIVE" : "ACTIVE"])" dat += "
Cell charge: [D.cell.charge]/[D.cell.maxcharge]." dat += "
Currently located in: [get_area(D)]." @@ -74,7 +74,7 @@ else if(href_list["ping"]) to_chat(usr, "You issue a maintenance request for all active drones, highlighting [drone_call_area].") - for(var/mob/living/silicon/robot/drone/D in world) + for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) if(D.client && D.stat == 0) to_chat(D, "-- Maintenance drone presence requested in: [drone_call_area].") diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm index 50463b17bec..023cced9cdb 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm @@ -52,7 +52,7 @@ /obj/machinery/drone_fabricator/proc/count_drones() var/drones = 0 - for(var/mob/living/silicon/robot/drone/D in world) + for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) if(D.key && D.client) drones++ return drones @@ -142,7 +142,7 @@ if(alert("Are you sure you want to respawn as a drone?", "Are you sure?", "Yes", "No") != "Yes") return - for(var/obj/machinery/drone_fabricator/DF in world) + for(var/obj/machinery/drone_fabricator/DF in GLOB.machines) if(DF.stat & NOPOWER || !DF.produce_drones) continue diff --git a/code/modules/mob/living/silicon/robot/drone/update_status.dm b/code/modules/mob/living/silicon/robot/drone/update_status.dm index 80eac952966..d64824b1876 100644 --- a/code/modules/mob/living/silicon/robot/drone/update_status.dm +++ b/code/modules/mob/living/silicon/robot/drone/update_status.dm @@ -4,7 +4,7 @@ /mob/living/silicon/robot/drone/update_stat(reason = "none given") if(status_flags & GODMODE) return - if(health <= -35 && stat != DEAD) + if(health <= -maxHealth && stat != DEAD) gib() create_debug_log("died of damage, trigger reason: [reason]") return diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index a68da651ee9..f5b7048c3a8 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -78,6 +78,7 @@ set_actions(O) else to_chat(src, "You need to disable a module first!") + check_module_damage(FALSE) update_icons() /mob/living/silicon/robot/proc/set_actions(obj/item/I) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index d40e801ba5f..07080e694bf 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -1,23 +1,20 @@ /mob/living/silicon/robot/Life(seconds, times_fired) set invisibility = 0 - set background = BACKGROUND_ENABLED - - if(src.notransform) + if(notransform) return - //Status updates, death etc. - clamp_values() + . = ..() - if(..()) + handle_equipment() + + // if Alive + if(.) + handle_robot_hud_updates() handle_robot_cell() process_locks() + update_items() process_queued_alarms() -/mob/living/silicon/robot/proc/clamp_values() - SetStunned(min(stunned, 30)) - SetParalysis(min(paralysis, 30)) - SetWeakened(min(weakened, 20)) - SetSleeping(0) /mob/living/silicon/robot/proc/handle_robot_cell() if(stat != DEAD) @@ -39,7 +36,7 @@ if(is_component_functioning("power cell") && cell.charge) if(cell.charge <= 100) uneq_all() - var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell. + var/amt = clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell. cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick else uneq_all() @@ -47,36 +44,13 @@ update_headlamp() diag_hud_set_borgcell() -/mob/living/silicon/robot/handle_regular_status_updates() - - . = ..() - +/mob/living/silicon/robot/proc/handle_equipment() if(camera && !scrambledcodes) if(stat == DEAD || wires.IsCameraCut()) camera.status = 0 else camera.status = 1 - if(sleeping) - AdjustSleeping(-1) - - if(.) //alive - if(!istype(src, /mob/living/silicon/robot/drone)) - if(health < 50) //Gradual break down of modules as more damage is sustained - if(uneq_module(module_state_3)) - to_chat(src, "SYSTEM ERROR: Module 3 OFFLINE.") - - if(health < 0) - if(uneq_module(module_state_2)) - to_chat(src, "SYSTEM ERROR: Module 2 OFFLINE.") - - if(health < -50) - if(uneq_module(module_state_1)) - to_chat(src, "CRITICAL ERROR: All modules OFFLINE.") - - diag_hud_set_health() - diag_hud_set_status() - //update the state of modules and components here if(stat != CONSCIOUS) uneq_all() @@ -86,18 +60,21 @@ else radio.on = 1 - return 1 - -/mob/living/silicon/robot/handle_hud_icons() - update_items() - update_cell() +/mob/living/silicon/robot/proc/SetEmagged(new_state) + emagged = new_state + update_icons() if(emagged) throw_alert("hacked", /obj/screen/alert/hacked) else clear_alert("hacked") - ..() -/mob/living/silicon/robot/handle_hud_icons_health() +/mob/living/silicon/robot/proc/handle_robot_hud_updates() + if(!client) + return + + update_cell_hud_icon() + +/mob/living/silicon/robot/update_health_hud() if(healths) if(stat != DEAD) if(health >= maxHealth) @@ -115,19 +92,7 @@ else healths.icon_state = "health7" - switch(bodytemperature) //310.055 optimal body temp - if(335 to INFINITY) - throw_alert("temp", /obj/screen/alert/hot/robot, 2) - if(320 to 335) - throw_alert("temp", /obj/screen/alert/hot/robot, 1) - if(300 to 320) - clear_alert("temp") - if(260 to 300) - throw_alert("temp", /obj/screen/alert/cold/robot, 1) - else - throw_alert("temp", /obj/screen/alert/cold/robot, 2) - -/mob/living/silicon/robot/proc/update_cell() +/mob/living/silicon/robot/proc/update_cell_hud_icon() if(cell) var/cellcharge = cell.charge/cell.maxcharge switch(cellcharge) @@ -146,7 +111,7 @@ -/mob/living/silicon/robot/proc/update_items() +/mob/living/silicon/robot/proc/update_items() // What in the Sam hell is this? if(client) for(var/obj/I in get_all_slots()) client.screen |= I diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index cf3067b934f..2eb1e4669ab 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -87,6 +87,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( var/braintype = "Cyborg" var/base_icon = "" var/crisis = 0 + var/modules_break = TRUE var/lamp_max = 10 //Maximum brightness of a borg lamp. Set as a var for easy adjusting. var/lamp_intensity = 0 //Luminosity of the headlamp. 0 is off. Higher settings than the minimum require power. @@ -840,7 +841,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( return else sleep(6) - emagged = 1 + SetEmagged(TRUE) SetLockdown(1) //Borgs were getting into trouble because they would attack the emagger before the new laws were shown if(src.hud_used) src.hud_used.update_robot_modules_display() //Shows/hides the emag item if the inventory screen is already open. @@ -1157,16 +1158,16 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( if(cleaned_human.lying) if(cleaned_human.head) cleaned_human.head.clean_blood() - cleaned_human.update_inv_head(0,0) + cleaned_human.update_inv_head() if(cleaned_human.wear_suit) cleaned_human.wear_suit.clean_blood() - cleaned_human.update_inv_wear_suit(0,0) + cleaned_human.update_inv_wear_suit() else if(cleaned_human.w_uniform) cleaned_human.w_uniform.clean_blood() - cleaned_human.update_inv_w_uniform(0,0) + cleaned_human.update_inv_w_uniform() if(cleaned_human.shoes) cleaned_human.shoes.clean_blood() - cleaned_human.update_inv_shoes(0,0) + cleaned_human.update_inv_shoes() cleaned_human.clean_blood() to_chat(cleaned_human, "[src] cleans your face!") if(floor_only) @@ -1481,3 +1482,26 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( else uneq_active() // else unequip the module and put it back into the robot's inventory. return + +/mob/living/silicon/robot/proc/check_module_damage(makes_sound = TRUE) + if(modules_break) + if(health < 50) //Gradual break down of modules as more damage is sustained + if(uneq_module(module_state_3)) + if(makes_sound) + audible_message("[src] sounds an alarm! \"SYSTEM ERROR: Module 3 OFFLINE.\"") + playsound(loc, 'sound/machines/warning-buzzer.ogg', 50, TRUE) + to_chat(src, "SYSTEM ERROR: Module 3 OFFLINE.") + + if(health < 0) + if(uneq_module(module_state_2)) + if(makes_sound) + audible_message("[src] sounds an alarm! \"SYSTEM ERROR: Module 2 OFFLINE.\"") + playsound(loc, 'sound/machines/warning-buzzer.ogg', 60, TRUE) + to_chat(src, "SYSTEM ERROR: Module 2 OFFLINE.") + + if(health < -50) + if(uneq_module(module_state_1)) + if(makes_sound) + audible_message("[src] sounds an alarm! \"CRITICAL ERROR: All modules OFFLINE.\"") + playsound(loc, 'sound/machines/warning-buzzer.ogg', 75, TRUE) + to_chat(src, "CRITICAL ERROR: All modules OFFLINE.") diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm index c73d566b729..f4290d764d6 100644 --- a/code/modules/mob/living/silicon/robot/robot_damage.dm +++ b/code/modules/mob/living/silicon/robot/robot_damage.dm @@ -1,12 +1,6 @@ /mob/living/silicon/robot/updatehealth(reason = "none given") - if(status_flags & GODMODE) - health = maxHealth - stat = CONSCIOUS - return - health = maxHealth - (getOxyLoss() + getFireLoss() + getBruteLoss()) - update_stat("updatehealth([reason])") - handle_hud_icons_health() - diag_hud_set_health() + ..(reason) + check_module_damage() /mob/living/silicon/robot/getBruteLoss(repairable_only = FALSE) var/amount = 0 @@ -72,7 +66,7 @@ /mob/living/silicon/robot/heal_organ_damage(brute, burn, updating_health = TRUE) var/list/datum/robot_component/parts = get_damaged_components(brute, burn) - if(!LAZYLEN(parts)) + if(!LAZYLEN(parts)) return var/datum/robot_component/picked = pick(parts) picked.heal_damage(brute, burn, updating_health) diff --git a/code/modules/mob/living/silicon/robot/update_status.dm b/code/modules/mob/living/silicon/robot/update_status.dm index 5f1519395c7..91f9952c075 100644 --- a/code/modules/mob/living/silicon/robot/update_status.dm +++ b/code/modules/mob/living/silicon/robot/update_status.dm @@ -17,10 +17,12 @@ if(!is_component_functioning("actuator") || !is_component_functioning("power cell") || paralysis || sleeping || resting || stunned || IsWeakened() || getOxyLoss() > maxHealth * 0.5) if(stat == CONSCIOUS) KnockOut() + update_headlamp() create_debug_log("fell unconscious, trigger reason: [reason]") else if(stat == UNCONSCIOUS) WakeUp() + update_headlamp() create_debug_log("woke up, trigger reason: [reason]") else if(health > 0) @@ -31,9 +33,10 @@ ghost << sound('sound/effects/genetics.ogg') create_attack_log("revived, trigger reason: [reason]") create_log(MISC_LOG, "revived, trigger reason: [reason]") - // diag_hud_set_status() - // diag_hud_set_health() - // update_health_hud() + + diag_hud_set_status() + diag_hud_set_health() + update_health_hud() /mob/living/silicon/robot/SetStunned(amount, updating = 1, force = 0) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned" . = STATUS_UPDATE_CANMOVE diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index 2cfc5e746dc..b42f3275997 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -118,7 +118,7 @@ /mob/living/simple_animal/blob_act(obj/structure/blob/B) adjustBruteLoss(20) -/mob/living/simple_animal/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect, end_pixel_y) +/mob/living/simple_animal/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect) if(!no_effect && !visual_effect_icon && melee_damage_upper) if(melee_damage_upper < 10) visual_effect_icon = ATTACK_EFFECT_PUNCH diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 88d130ddc82..962b4722f39 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -1031,20 +1031,6 @@ Pass a positive integer as an argument to override a bot's default speed. Radio.talk_into(src, message, message_mode, verb, speaking) used_radios += Radio -/mob/living/simple_animal/bot/handle_hud_icons_health() - ..() - switch(bodytemperature) //310.055 optimal body temp - if(335 to INFINITY) - throw_alert("temp", /obj/screen/alert/hot/robot, 2) - if(320 to 335) - throw_alert("temp", /obj/screen/alert/hot/robot, 1) - if(300 to 320) - clear_alert("temp") - if(260 to 300) - throw_alert("temp", /obj/screen/alert/cold/robot, 1) - else - throw_alert("temp", /obj/screen/alert/cold/robot, 2) - /mob/living/simple_animal/bot/is_mechanical() return 1 diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index c89b160bf0e..728b050dd54 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -391,8 +391,6 @@ passenger = M load = M can_buckle = FALSE - // Not sure why this is done - reset_perspective(src) return TRUE return FALSE @@ -417,9 +415,6 @@ overlays.Cut() - if(ismob(load)) - var/mob/M = load - M.reset_perspective(null) unbuckle_all_mobs() if(load) @@ -446,9 +441,6 @@ AM.layer = initial(AM.layer) AM.pixel_y = initial(AM.pixel_y) AM.plane = initial(AM.plane) - if(ismob(AM)) - var/mob/M = AM - M.reset_perspective(null) /mob/living/simple_animal/bot/mulebot/call_bot() ..() diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm index ee03c204d48..f150005116e 100644 --- a/code/modules/mob/living/simple_animal/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs.dm @@ -333,73 +333,116 @@ ///ui stuff -/mob/living/simple_animal/hostile/construct/armoured/handle_hud_icons_health() - ..() +/mob/living/simple_animal/hostile/construct/armoured/update_health_hud() + if(!client) + return if(healths) switch(health) - if(250 to INFINITY) healths.icon_state = "juggernaut_health0" - if(208 to 249) healths.icon_state = "juggernaut_health1" - if(167 to 207) healths.icon_state = "juggernaut_health2" - if(125 to 166) healths.icon_state = "juggernaut_health3" - if(84 to 124) healths.icon_state = "juggernaut_health4" - if(42 to 83) healths.icon_state = "juggernaut_health5" - if(1 to 41) healths.icon_state = "juggernaut_health6" - else healths.icon_state = "juggernaut_health7" + if(250 to INFINITY) + healths.icon_state = "juggernaut_health0" + if(208 to 249) + healths.icon_state = "juggernaut_health1" + if(167 to 207) + healths.icon_state = "juggernaut_health2" + if(125 to 166) + healths.icon_state = "juggernaut_health3" + if(84 to 124) + healths.icon_state = "juggernaut_health4" + if(42 to 83) + healths.icon_state = "juggernaut_health5" + if(1 to 41) + healths.icon_state = "juggernaut_health6" + else + healths.icon_state = "juggernaut_health7" -/mob/living/simple_animal/hostile/construct/behemoth/handle_hud_icons_health() - ..() +/mob/living/simple_animal/hostile/construct/behemoth/update_health_hud() + if(!client) + return if(healths) switch(health) - if(750 to INFINITY) healths.icon_state = "juggernaut_health0" - if(625 to 749) healths.icon_state = "juggernaut_health1" - if(500 to 624) healths.icon_state = "juggernaut_health2" - if(375 to 499) healths.icon_state = "juggernaut_health3" - if(250 to 374) healths.icon_state = "juggernaut_health4" - if(125 to 249) healths.icon_state = "juggernaut_health5" - if(1 to 124) healths.icon_state = "juggernaut_health6" - else healths.icon_state = "juggernaut_health7" + if(750 to INFINITY) + healths.icon_state = "juggernaut_health0" + if(625 to 749) + healths.icon_state = "juggernaut_health1" + if(500 to 624) + healths.icon_state = "juggernaut_health2" + if(375 to 499) + healths.icon_state = "juggernaut_health3" + if(250 to 374) + healths.icon_state = "juggernaut_health4" + if(125 to 249) + healths.icon_state = "juggernaut_health5" + if(1 to 124) + healths.icon_state = "juggernaut_health6" + else + healths.icon_state = "juggernaut_health7" -/mob/living/simple_animal/hostile/construct/builder/handle_hud_icons_health() - ..() +/mob/living/simple_animal/hostile/construct/builder/update_health_hud() + if(!client) + return if(healths) switch(health) - if(50 to INFINITY) healths.icon_state = "artificer_health0" - if(42 to 49) healths.icon_state = "artificer_health1" - if(34 to 41) healths.icon_state = "artificer_health2" - if(26 to 33) healths.icon_state = "artificer_health3" - if(18 to 25) healths.icon_state = "artificer_health4" - if(10 to 17) healths.icon_state = "artificer_health5" - if(1 to 9) healths.icon_state = "artificer_health6" - else healths.icon_state = "artificer_health7" + if(50 to INFINITY) + healths.icon_state = "artificer_health0" + if(42 to 49) + healths.icon_state = "artificer_health1" + if(34 to 41) + healths.icon_state = "artificer_health2" + if(26 to 33) + healths.icon_state = "artificer_health3" + if(18 to 25) + healths.icon_state = "artificer_health4" + if(10 to 17) + healths.icon_state = "artificer_health5" + if(1 to 9) + healths.icon_state = "artificer_health6" + else + healths.icon_state = "artificer_health7" -/mob/living/simple_animal/hostile/construct/wraith/handle_hud_icons_health() - - ..() +/mob/living/simple_animal/hostile/construct/wraith/update_health_hud() + if(!client) + return if(healths) switch(health) - if(75 to INFINITY) healths.icon_state = "wraith_health0" - if(62 to 74) healths.icon_state = "wraith_health1" - if(50 to 61) healths.icon_state = "wraith_health2" - if(37 to 49) healths.icon_state = "wraith_health3" - if(25 to 36) healths.icon_state = "wraith_health4" - if(12 to 24) healths.icon_state = "wraith_health5" - if(1 to 11) healths.icon_state = "wraith_health6" - else healths.icon_state = "wraith_health7" + if(75 to INFINITY) + healths.icon_state = "wraith_health0" + if(62 to 74) + healths.icon_state = "wraith_health1" + if(50 to 61) + healths.icon_state = "wraith_health2" + if(37 to 49) + healths.icon_state = "wraith_health3" + if(25 to 36) + healths.icon_state = "wraith_health4" + if(12 to 24) + healths.icon_state = "wraith_health5" + if(1 to 11) + healths.icon_state = "wraith_health6" + else + healths.icon_state = "wraith_health7" -/mob/living/simple_animal/hostile/construct/harvester/handle_hud_icons_health() - - ..() +/mob/living/simple_animal/hostile/construct/harvester/update_health_hud() + if(!client) + return if(healths) switch(health) - if(150 to INFINITY) healths.icon_state = "harvester_health0" - if(125 to 149) healths.icon_state = "harvester_health1" - if(100 to 124) healths.icon_state = "harvester_health2" - if(75 to 99) healths.icon_state = "harvester_health3" - if(50 to 74) healths.icon_state = "harvester_health4" - if(25 to 49) healths.icon_state = "harvester_health5" - if(1 to 24) healths.icon_state = "harvester_health6" - else healths.icon_state = "harvester_health7" + if(150 to INFINITY) + healths.icon_state = "harvester_health0" + if(125 to 149) + healths.icon_state = "harvester_health1" + if(100 to 124) + healths.icon_state = "harvester_health2" + if(75 to 99) + healths.icon_state = "harvester_health3" + if(50 to 74) + healths.icon_state = "harvester_health4" + if(25 to 49) + healths.icon_state = "harvester_health5" + if(1 to 24) + healths.icon_state = "harvester_health6" + else + healths.icon_state = "harvester_health7" diff --git a/code/modules/mob/living/simple_animal/damage_procs.dm b/code/modules/mob/living/simple_animal/damage_procs.dm index 6ba69de6a61..fdcbf95216b 100644 --- a/code/modules/mob/living/simple_animal/damage_procs.dm +++ b/code/modules/mob/living/simple_animal/damage_procs.dm @@ -3,7 +3,7 @@ if(status_flags & GODMODE) return FALSE var/oldbruteloss = bruteloss - bruteloss = Clamp(bruteloss + amount, 0, maxHealth) + bruteloss = clamp(bruteloss + amount, 0, maxHealth) if(oldbruteloss == bruteloss) updating_health = FALSE . = STATUS_UPDATE_NONE diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 4b29e703116..07a21af8a0b 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -153,16 +153,16 @@ if(def_zone) if(def_zone == "head") if(inventory_head) - armorval = inventory_head.armor[type] + armorval = inventory_head.armor.getRating(type) else if(inventory_back) - armorval = inventory_back.armor[type] + armorval = inventory_back.armor.getRating(type) return armorval else if(inventory_head) - armorval += inventory_head.armor[type] + armorval += inventory_head.armor.getRating(type) if(inventory_back) - armorval += inventory_back.armor[type] + armorval += inventory_back.armor.getRating(type) return armorval * 0.5 /mob/living/simple_animal/pet/dog/corgi/attackby(obj/item/O, mob/user, params) diff --git a/code/modules/mob/living/simple_animal/friendly/penguin.dm b/code/modules/mob/living/simple_animal/friendly/penguin.dm index dc00e252661..08321b1bb5a 100644 --- a/code/modules/mob/living/simple_animal/friendly/penguin.dm +++ b/code/modules/mob/living/simple_animal/friendly/penguin.dm @@ -18,7 +18,7 @@ /mob/living/simple_animal/pet/penguin/Initialize(mapload) . = ..() - AddComponent(/datum/component/waddling) + AddElement(/datum/element/waddling) /mob/living/simple_animal/pet/penguin/emperor name = "Emperor penguin" diff --git a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm index 7a1227960f4..877d542fa2b 100644 --- a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm +++ b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm @@ -123,8 +123,6 @@ if(health >= maxHealth) to_chat(user, "[src] does not need repairing!") return - to_chat(user, "Unable to repair with the maintenance panel closed!") - return . = TRUE if(!I.use_tool(src, user, volume = I.tool_volume)) return diff --git a/code/modules/mob/living/simple_animal/hostile/alien.dm b/code/modules/mob/living/simple_animal/hostile/alien.dm index 038b3b3d221..65b0c492fe6 100644 --- a/code/modules/mob/living/simple_animal/hostile/alien.dm +++ b/code/modules/mob/living/simple_animal/hostile/alien.dm @@ -153,7 +153,7 @@ icon_dead = "maid_dead" /mob/living/simple_animal/hostile/alien/maid/AttackingTarget() - if(ismovableatom(target)) + if(ismovable(target)) if(istype(target, /obj/effect/decal/cleanable)) visible_message("\The [src] cleans up \the [target].") qdel(target) diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index c1e7548d9a3..3276416fe7f 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -60,6 +60,7 @@ /mob/living/simple_animal/hostile/poison/bees/New() ..() generate_bee_visuals() + AddComponent(/datum/component/swarming) /mob/living/simple_animal/hostile/poison/bees/Destroy() beegent = null diff --git a/code/modules/mob/living/simple_animal/hostile/headcrab.dm b/code/modules/mob/living/simple_animal/hostile/headcrab.dm index 8d2ba52709f..ced4a61d8c5 100644 --- a/code/modules/mob/living/simple_animal/hostile/headcrab.dm +++ b/code/modules/mob/living/simple_animal/hostile/headcrab.dm @@ -62,8 +62,8 @@ is_zombie = TRUE if(H.wear_suit) var/obj/item/clothing/suit/armor/A = H.wear_suit - if(A.armor && A.armor["melee"]) - maxHealth += A.armor["melee"] //That zombie's got armor, I want armor! + if(A.armor && A.armor.getRating("melee")) + maxHealth += A.armor.getRating("melee") //That zombie's got armor, I want armor! maxHealth += 200 health = maxHealth name = "zombie" diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 6cde07d0b8d..469ff0cc7e1 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -79,7 +79,7 @@ Difficulty: Hard /mob/living/simple_animal/hostile/megafauna/bubblegum/Initialize(mapload) . = ..() if(true_spawn) - for(var/mob/living/simple_animal/hostile/megafauna/bubblegum/B in GLOB.living_mob_list) + for(var/mob/living/simple_animal/hostile/megafauna/bubblegum/B in GLOB.alive_mob_list) if(B != src) qdel(src) //There can be only one return @@ -116,8 +116,8 @@ Difficulty: Hard if(charging) return - anger_modifier = Clamp(((maxHealth - health)/60),0,20) - enrage_time = initial(enrage_time) * Clamp(anger_modifier / 20, 0.5, 1) + anger_modifier = clamp(((maxHealth - health)/60),0,20) + enrage_time = initial(enrage_time) * clamp(anger_modifier / 20, 0.5, 1) ranged_cooldown = world.time + 50 if(client) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index 7f1b3942d94..b8c72d7cf84 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -83,7 +83,7 @@ Difficulty: Very Hard chosen_attack_num = 4 /mob/living/simple_animal/hostile/megafauna/colossus/OpenFire() - anger_modifier = Clamp(((maxHealth - health)/50),0,20) + anger_modifier = clamp(((maxHealth - health)/50),0,20) ranged_cooldown = world.time + 120 if(client) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm index e97b7671b67..6dca834169b 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm @@ -103,7 +103,7 @@ Difficulty: Medium if(swooping) return - anger_modifier = Clamp(((maxHealth - health)/50),0,20) + anger_modifier = clamp(((maxHealth - health)/50),0,20) ranged_cooldown = world.time + ranged_cooldown_time if(client) @@ -254,7 +254,7 @@ Difficulty: Medium /mob/living/simple_animal/hostile/megafauna/dragon/proc/line_target(var/offset, var/range, var/atom/at = target) if(!at) return - var/angle = Atan2(at.x - src.x, at.y - src.y) + offset + var/angle = ATAN2(at.x - src.x, at.y - src.y) + offset var/turf/T = get_turf(src) for(var/i in 1 to range) var/turf/check = locate(src.x + cos(angle) * i, src.y + sin(angle) * i, src.z) @@ -344,10 +344,10 @@ Difficulty: Medium //ensure swoop direction continuity. if(negative) - if(IsInRange(x, initial_x + 1, initial_x + DRAKE_SWOOP_DIRECTION_CHANGE_RANGE)) + if(ISINRANGE(x, initial_x + 1, initial_x + DRAKE_SWOOP_DIRECTION_CHANGE_RANGE)) negative = FALSE else - if(IsInRange(x, initial_x - DRAKE_SWOOP_DIRECTION_CHANGE_RANGE, initial_x - 1)) + if(ISINRANGE(x, initial_x - DRAKE_SWOOP_DIRECTION_CHANGE_RANGE, initial_x - 1)) negative = TRUE new /obj/effect/temp_visual/dragon_flight/end(loc, negative) new /obj/effect/temp_visual/dragon_swoop(loc) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index 716f5436223..65d056188a8 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -452,6 +452,7 @@ Difficulty: Hard else burst_range = 3 INVOKE_ASYNC(src, .proc/burst, get_turf(src), 0.25) //melee attacks on living mobs cause it to release a fast burst if on cooldown + OpenFire() else devour(L) else @@ -481,7 +482,7 @@ Difficulty: Hard /mob/living/simple_animal/hostile/megafauna/hierophant/proc/calculate_rage() //how angry we are overall did_reset = FALSE //oh hey we're doing SOMETHING, clearly we might need to heal if we recall - anger_modifier = Clamp(((maxHealth - health) / 42),0,50) + anger_modifier = clamp(((maxHealth - health) / 42),0,50) burst_range = initial(burst_range) + round(anger_modifier * 0.08) beam_range = initial(beam_range) + round(anger_modifier * 0.12) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm index 4ce66ccd1d5..eed05d55e91 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm @@ -43,7 +43,6 @@ . = ..() if(internal_type && true_spawn) internal = new internal_type(src) - apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) for(var/action_type in attack_action_types) var/datum/action/innate/megafauna_attack/attack_action = new action_type() attack_action.Grant(src) diff --git a/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm b/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm index ca9b632e06a..a5248e98bb6 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm @@ -90,6 +90,7 @@ /mob/living/simple_animal/hostile/asteroid/hivelordbrood/Initialize(mapload) . = ..() addtimer(CALLBACK(src, .proc/death), 100) + AddComponent(/datum/component/swarming) /mob/living/simple_animal/hostile/asteroid/hivelordbrood/blood diff --git a/code/modules/mob/living/simple_animal/hostile/mining/mining.dm b/code/modules/mob/living/simple_animal/hostile/mining/mining.dm index 7c7200e8588..a888fa7ee9a 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining/mining.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining/mining.dm @@ -23,10 +23,6 @@ var/icon_aggro = null var/crusher_drop_mod = 25 -/mob/living/simple_animal/hostile/asteroid/Initialize(mapload) - . = ..() - apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) - /mob/living/simple_animal/hostile/asteroid/Aggro() ..() if(vision_range != aggro_vision_range) diff --git a/code/modules/mob/living/simple_animal/hostile/spaceworms.dm b/code/modules/mob/living/simple_animal/hostile/spaceworms.dm index fd569984920..07f26031ed5 100644 --- a/code/modules/mob/living/simple_animal/hostile/spaceworms.dm +++ b/code/modules/mob/living/simple_animal/hostile/spaceworms.dm @@ -335,7 +335,7 @@ //Jiggle the whole worm forwards towards the next segment -/mob/living/simple_animal/hostile/spaceWorm/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect, end_pixel_y) +/mob/living/simple_animal/hostile/spaceWorm/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect) ..() if(previousWorm) previousWorm.do_attack_animation(src) diff --git a/code/modules/mob/living/simple_animal/hostile/statue.dm b/code/modules/mob/living/simple_animal/hostile/statue.dm index 95ce5491395..105b9a02819 100644 --- a/code/modules/mob/living/simple_animal/hostile/statue.dm +++ b/code/modules/mob/living/simple_animal/hostile/statue.dm @@ -180,7 +180,7 @@ range = 10 /obj/effect/proc_holder/spell/aoe_turf/blindness/cast(list/targets, mob/user = usr) - for(var/mob/living/L in GLOB.living_mob_list) + for(var/mob/living/L in GLOB.alive_mob_list) if(L == user) continue var/turf/T = get_turf(L.loc) diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate.dm b/code/modules/mob/living/simple_animal/hostile/syndicate.dm index f3389108498..6f40dfe2a3f 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate.dm @@ -281,7 +281,7 @@ /mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/armory/LateInitialize() if(istype(depotarea)) var/list/key_candidates = list() - for(var/mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/officer/O in GLOB.living_mob_list) + for(var/mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/officer/O in GLOB.alive_mob_list) key_candidates += O if(key_candidates.len) var/mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/officer/O = pick(key_candidates) @@ -349,7 +349,8 @@ icon = 'icons/mob/critter.dmi' icon_state = "viscerator_attack" icon_living = "viscerator_attack" - pass_flags = PASSTABLE + pass_flags = PASSTABLE | PASSMOB + a_intent = INTENT_HARM health = 15 maxHealth = 15 obj_damage = 0 @@ -365,3 +366,7 @@ gold_core_spawnable = HOSTILE_SPAWN del_on_death = 1 deathmessage = "is smashed into pieces!" + +/mob/living/simple_animal/hostile/viscerator/Initialize(mapload) + . = ..() + AddComponent(/datum/component/swarming) diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/princess.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/princess.dm index 828e0e5f8f6..047219a151b 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/princess.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/princess.dm @@ -38,9 +38,12 @@ evolvequeen_action.Grant(src) /mob/living/simple_animal/hostile/poison/terror_spider/princess/proc/evolve_to_queen() - var/mob/living/simple_animal/hostile/poison/terror_spider/queen/Q = new /mob/living/simple_animal/hostile/poison/terror_spider/queen(loc) + var/mob/living/simple_animal/hostile/poison/terror_spider/queen/Q = new(loc) if(mind) mind.transfer_to(Q) + // Calling `transfer_to()` removes our new body (the Queen's) ability to see the med hud, so we have to re-add the queen here. + var/datum/atom_hud/U = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] + U.add_hud_to(Q) qdel(src) /mob/living/simple_animal/hostile/poison/terror_spider/princess/DoWrap() diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm index 241cceb3d2c..bf3c98bb86a 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm @@ -168,7 +168,7 @@ neststep = 4 else spider_lastspawn = world.time - var/spiders_left_to_spawn = Clamp( (spider_max_per_nest - CountSpiders()), 1, 10) + var/spiders_left_to_spawn = clamp( (spider_max_per_nest - CountSpiders()), 1, 10) DoLayTerrorEggs(pick(spider_types_standard), spiders_left_to_spawn) if(4) // Nest should be full. Otherwise, start replenishing nest (stage 5). diff --git a/code/modules/mob/living/simple_animal/posessed_object.dm b/code/modules/mob/living/simple_animal/posessed_object.dm index bde995d8edb..c3cb61d5970 100644 --- a/code/modules/mob/living/simple_animal/posessed_object.dm +++ b/code/modules/mob/living/simple_animal/posessed_object.dm @@ -27,7 +27,7 @@ . += "[src] appears to be having trouble staying afloat!" -/mob/living/simple_animal/possessed_object/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect, end_pixel_y) +/mob/living/simple_animal/possessed_object/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect) ..() animate_ghostly_presence(src, -1, 20, 1) // Restart the floating animation after the attack animation, as it will be cancelled. diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 2479f3c0674..7d31b5d523b 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -144,8 +144,8 @@ /mob/living/simple_animal/updatehealth(reason = "none given") ..(reason) - health = Clamp(health, 0, maxHealth) - med_hud_set_status() + health = clamp(health, 0, maxHealth) + med_hud_set_health() /mob/living/simple_animal/StartResting(updating = 1) ..() @@ -166,12 +166,14 @@ /mob/living/simple_animal/update_stat(reason = "none given") if(status_flags & GODMODE) return - - ..(reason) if(stat != DEAD) - if(health < 1) + if(health <= 0) death() create_debug_log("died of damage, trigger reason: [reason]") + else + WakeUp() + create_debug_log("woke up, trigger reason: [reason]") + med_hud_set_status() /mob/living/simple_animal/proc/handle_automated_action() set waitfor = FALSE diff --git a/code/modules/mob/living/simple_animal/slime/powers.dm b/code/modules/mob/living/simple_animal/slime/powers.dm index bd9d001f12f..3f978abbfbb 100644 --- a/code/modules/mob/living/simple_animal/slime/powers.dm +++ b/code/modules/mob/living/simple_animal/slime/powers.dm @@ -190,7 +190,7 @@ step_away(M,src) M.Friends = Friends.Copy() babies += M - M.mutation_chance = Clamp(mutation_chance+(rand(5,-5)),0,100) + M.mutation_chance = clamp(mutation_chance+(rand(5,-5)),0,100) feedback_add_details("slime_babies_born", "slimebirth_[replacetext(M.colour," ","_")]") var/mob/living/simple_animal/slime/new_slime = pick(babies) diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 91e6c502869..8c7d14b23f4 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -156,7 +156,7 @@ . += config.slime_delay -/mob/living/simple_animal/slime/handle_hud_icons_health() +/mob/living/simple_animal/slime/update_health_hud() if(hud_used) if(!client) return diff --git a/code/modules/mob/living/stat_states.dm b/code/modules/mob/living/stat_states.dm index 926bdc5970d..eab88b5ec4d 100644 --- a/code/modules/mob/living/stat_states.dm +++ b/code/modules/mob/living/stat_states.dm @@ -51,7 +51,7 @@ log_game("[key_name(src)] came back to life at [atom_loc_line(get_turf(src))]") stat = CONSCIOUS GLOB.dead_mob_list -= src - GLOB.living_mob_list += src + GLOB.alive_mob_list += src if(mind) GLOB.respawnable_list -= src timeofdeath = null diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm index b2871038155..7cd2b4414f7 100644 --- a/code/modules/mob/living/status_procs.dm +++ b/code/modules/mob/living/status_procs.dm @@ -125,10 +125,6 @@ var/stuttering = 0 var/weakened = 0 -/mob/living - // Bitfields - var/disabilities = 0 - // RESTING /mob/living/proc/StartResting(updating = 1) @@ -467,16 +463,16 @@ // Blind /mob/living/proc/BecomeBlind(updating = TRUE) - var/val_change = !(disabilities & BLIND) + var/val_change = !(BLINDNESS in mutations) . = val_change ? STATUS_UPDATE_BLIND : STATUS_UPDATE_NONE - disabilities |= BLIND + mutations |= BLINDNESS if(val_change && updating) update_blind_effects() /mob/living/proc/CureBlind(updating = TRUE) - var/val_change = !!(disabilities & BLIND) + var/val_change = !!(BLINDNESS in mutations) . = val_change ? STATUS_UPDATE_BLIND : STATUS_UPDATE_NONE - disabilities &= ~BLIND + mutations -= BLINDNESS if(val_change && updating) CureIfHasDisability(GLOB.blindblock) update_blind_effects() @@ -484,52 +480,52 @@ // Coughing /mob/living/proc/BecomeCoughing() - disabilities |= COUGHING + mutations |= COUGHING /mob/living/proc/CureCoughing() - disabilities &= ~COUGHING + mutations -= COUGHING CureIfHasDisability(GLOB.coughblock) // Deaf /mob/living/proc/BecomeDeaf() - disabilities |= DEAF + mutations |= DEAF /mob/living/proc/CureDeaf() - disabilities &= ~DEAF + mutations -= DEAF CureIfHasDisability(GLOB.deafblock) // Epilepsy /mob/living/proc/BecomeEpilepsy() - disabilities |= EPILEPSY + mutations |= EPILEPSY /mob/living/proc/CureEpilepsy() - disabilities &= ~EPILEPSY + mutations -= EPILEPSY CureIfHasDisability(GLOB.epilepsyblock) // Mute /mob/living/proc/BecomeMute() - disabilities |= MUTE + mutations |= MUTE /mob/living/proc/CureMute() - disabilities &= ~MUTE + mutations -= MUTE CureIfHasDisability(GLOB.muteblock) // Nearsighted /mob/living/proc/BecomeNearsighted(updating = TRUE) - var/val_change = !(disabilities & NEARSIGHTED) + var/val_change = !(NEARSIGHTED in mutations) . = val_change ? STATUS_UPDATE_NEARSIGHTED : STATUS_UPDATE_NONE - disabilities |= NEARSIGHTED + mutations |= NEARSIGHTED if(val_change && updating) update_nearsighted_effects() /mob/living/proc/CureNearsighted(updating = TRUE) - var/val_change = !!(disabilities & NEARSIGHTED) + var/val_change = !!(NEARSIGHTED in mutations) . = val_change ? STATUS_UPDATE_NEARSIGHTED : STATUS_UPDATE_NONE - disabilities &= ~NEARSIGHTED + mutations -= NEARSIGHTED if(val_change && updating) CureIfHasDisability(GLOB.glassesblock) update_nearsighted_effects() @@ -537,19 +533,19 @@ // Nervous /mob/living/proc/BecomeNervous() - disabilities |= NERVOUS + mutations |= NERVOUS /mob/living/proc/CureNervous() - disabilities &= ~NERVOUS + mutations -= NERVOUS CureIfHasDisability(GLOB.nervousblock) // Tourettes /mob/living/proc/BecomeTourettes() - disabilities |= TOURETTES + mutations |= TOURETTES /mob/living/proc/CureTourettes() - disabilities &= ~TOURETTES + mutations -= TOURETTES CureIfHasDisability(GLOB.twitchblock) /mob/living/proc/CureIfHasDisability(block) diff --git a/code/modules/mob/living/update_status.dm b/code/modules/mob/living/update_status.dm index d24301b0dd0..8ef178918b4 100644 --- a/code/modules/mob/living/update_status.dm +++ b/code/modules/mob/living/update_status.dm @@ -25,7 +25,7 @@ clear_alert("high") /mob/living/update_nearsighted_effects() - if(disabilities & NEARSIGHTED) + if(NEARSIGHTED in mutations) overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1) else clear_fullscreen("nearsighted") @@ -41,17 +41,17 @@ // Whether the mob can hear things /mob/living/can_hear() - . = !(disabilities & DEAF) + . = !(DEAF in mutations) // Whether the mob is able to see // `information_only` is for stuff that's purely informational - like blindness overlays // This flag exists because certain things like angel statues expect this to be false for dead people /mob/living/has_vision(information_only = FALSE) - return (information_only && stat == DEAD) || !(eye_blind || (disabilities & BLIND) || stat) + return (information_only && stat == DEAD) || !(eye_blind || (BLINDNESS in mutations) || stat) // Whether the mob is capable of talking /mob/living/can_speak() - if(!(silent || (disabilities & MUTE))) + if(!(silent || (MUTE in mutations))) if(is_muzzled()) var/obj/item/clothing/mask/muzzle/M = wear_mask if(M.mute >= MUZZLE_MUTE_MUFFLE) @@ -112,22 +112,6 @@ /mob/living/proc/update_stamina() return -/mob/living/update_stat(reason = "None given") - if(status_flags & GODMODE) - return - if(stat != DEAD) - if(health <= HEALTH_THRESHOLD_DEAD && check_death_method()) - death() - create_debug_log("died of damage, trigger reason: [reason]") - else if(paralysis || status_flags & FAKEDEATH) - if(stat == CONSCIOUS) - KnockOut() - create_debug_log("fell unconscious, trigger reason: [reason]") - else - if(stat == UNCONSCIOUS) - WakeUp() - create_debug_log("woke up, trigger reason: [reason]") - /mob/living/vv_edit_var(var_name, var_value) . = ..() switch(var_name) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6123c8429c5..d7f05bd943d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1,7 +1,7 @@ /mob/Destroy()//This makes sure that mobs with clients/keys are not just deleted from the game. GLOB.mob_list -= src GLOB.dead_mob_list -= src - GLOB.living_mob_list -= src + GLOB.alive_mob_list -= src focus = null QDEL_NULL(hud_used) if(mind && mind.current == src) @@ -9,9 +9,6 @@ mobspellremove(src) QDEL_LIST(viruses) ghostize() - for(var/mob/dead/observer/M in following_mobs) - M.following = null - following_mobs = null QDEL_LIST_ASSOC_VAL(tkgrabbed_objects) for(var/I in tkgrabbed_objects) qdel(tkgrabbed_objects[I]) @@ -31,7 +28,7 @@ if(stat == DEAD) GLOB.dead_mob_list += src else - GLOB.living_mob_list += src + GLOB.alive_mob_list += src set_focus(src) prepare_huds() ..() @@ -45,6 +42,7 @@ hud_list[hud] = list() else var/image/I = image('icons/mob/hud.dmi', src, "") + I.appearance_flags = RESET_COLOR | RESET_TRANSFORM hud_list[hud] = I /mob/proc/generate_name() @@ -67,8 +65,8 @@ t+= "Oxygen: [environment.oxygen] \n" t+= "Plasma : [environment.toxins] \n" t+= "Carbon Dioxide: [environment.carbon_dioxide] \n" - for(var/datum/gas/trace_gas in environment.trace_gases) - to_chat(usr, "[trace_gas.type]: [trace_gas.moles] \n") + t+= "N2O: [environment.sleeping_agent] \n" + t+= "Agent B: [environment.agent_b] \n" usr.show_message(t, 1) @@ -174,21 +172,6 @@ /mob/proc/movement_delay() return 0 -/mob/proc/Life(seconds, times_fired) - set waitfor = FALSE - if(forced_look) - if(!isnum(forced_look)) - var/atom/A = locateUID(forced_look) - if(istype(A)) - var/view = client ? client.view : world.view - if(get_dist(src, A) > view || !(src in viewers(view, A))) - forced_look = null - to_chat(src, "Your direction target has left your view, you are no longer facing anything.") - return - setDir() -// handle_typing_indicator() - return - //This proc is called whenever someone clicks an inventory ui slot. /mob/proc/attack_ui(slot) var/obj/item/W = get_active_hand() @@ -204,10 +187,10 @@ src:update_hair() src:update_fhair() -/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1, redraw_mob = 1) - if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning, redraw_mob)) +/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1) + if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning)) return 1 - else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning, redraw_mob)) + else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning)) return 1 return 0 @@ -216,8 +199,7 @@ //This is a SAFE proc. Use this instead of equip_to_slot()! //set del_on_fail to have it delete W if it fails to equip //set disable_warning to disable the 'you are unable to equip that' warning. -//unset redraw_mob to prevent the mob from being redrawn at the end. -/mob/proc/equip_to_slot_if_possible(obj/item/W as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1) +/mob/proc/equip_to_slot_if_possible(obj/item/W, slot, del_on_fail = 0, disable_warning = 0) if(!istype(W)) return 0 if(!W.mob_can_equip(src, slot, disable_warning)) @@ -229,17 +211,17 @@ return 0 - equip_to_slot(W, slot, redraw_mob) //This proc should not ever fail. + equip_to_slot(W, slot) //This proc should not ever fail. return 1 //This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't eqip need to be done before! Use mob_can_equip() for that task. //In most cases you will want to use equip_to_slot_if_possible() -/mob/proc/equip_to_slot(obj/item/W as obj, slot) +/mob/proc/equip_to_slot(obj/item/W, slot) return //This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such. /mob/proc/equip_to_slot_or_del(obj/item/W as obj, slot) - return equip_to_slot_if_possible(W, slot, 1, 1, 0) + return equip_to_slot_if_possible(W, slot, TRUE, TRUE) // Convinience proc. Collects crap that fails to equip either onto the mob's back, or drops it. // Used in job equipping so shit doesn't pile up at the start loc. @@ -290,7 +272,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ for(var/slot in GLOB.slot_equipment_priority) if(istype(W,/obj/item/storage/) && slot == slot_head) // Storage items should be put on the belt before the head continue - if(equip_to_slot_if_possible(W, slot, 0, 1, 1)) //del_on_fail = 0; disable_warning = 0; redraw_mob = 1 + if(equip_to_slot_if_possible(W, slot, FALSE, TRUE)) //del_on_fail = 0; disable_warning = 0 return 1 return 0 @@ -527,12 +509,6 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ update_pipe_vision() /mob/dead/reset_perspective(atom/A) - if(client) - if(ismob(client.eye) && (client.eye != src)) - // Note to self: Use `client.eye` for ghost following in place - // of periodic ghost updates - var/mob/target = client.eye - target.following_mobs -= src . = ..() if(.) // Allows sharing HUDs with ghosts @@ -789,7 +765,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ var/list/namecounts = list() var/list/creatures = list() - for(var/obj/O in world) //EWWWWWWWWWWWWWWWWWWWWWWWW ~needs to be optimised + for(var/obj/O in GLOB.poi_list) if(!O.loc) continue if(istype(O, /obj/item/disk/nuclear)) @@ -839,10 +815,6 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ if(client && mob_eye) client.eye = mob_eye - if(is_admin) - client.adminobs = 1 - if(mob_eye == client.mob || client.eye == client.mob) - client.adminobs = 0 /mob/verb/cancel_camera() set name = "Cancel Camera View" @@ -1092,7 +1064,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ if((usr in GLOB.respawnable_list) && (stat==2 || istype(usr,/mob/dead/observer))) var/list/creatures = list("Mouse") - for(var/mob/living/L in GLOB.living_mob_list) + for(var/mob/living/L in GLOB.alive_mob_list) if(safe_respawn(L.type) && L.stat!=2) if(!L.key) creatures += L @@ -1127,7 +1099,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ var/mob/living/simple_animal/mouse/host var/obj/machinery/atmospherics/unary/vent_pump/vent_found var/list/found_vents = list() - for(var/obj/machinery/atmospherics/unary/vent_pump/v in world) + for(var/obj/machinery/atmospherics/unary/vent_pump/v in SSair.atmos_machinery) if(!v.welded && v.z == src.z) found_vents.Add(v) if(found_vents.len) @@ -1385,6 +1357,12 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) sync_lighting_plane_alpha() +/mob/proc/set_sight(datum/vision_override/O) + QDEL_NULL(vision_type) + if(O) //in case of null + vision_type = new O + update_sight() + /mob/proc/sync_lighting_plane_alpha() if(hud_used) var/obj/screen/plane_master/lighting/L = hud_used.plane_masters["[LIGHTING_PLANE]"] diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index ee514930c95..dc77610b97e 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -160,8 +160,6 @@ var/atom/movable/remote_control //Calls relaymove() to whatever it is - var/remote_view = 0 // Set to 1 to prevent view resets on Life - var/obj/control_object //Used by admins to possess objects. All mobs should have this var //Whether or not mobs can understand other mobtypes. These stay in /mob so that ghosts can hear everything. diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 1e0f31ac6fe..df2a39c0930 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -521,11 +521,11 @@ GLOBAL_LIST_INIT(intents, list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM alert_overlay.plane = FLOAT_PLANE A.overlays += alert_overlay -/mob/proc/switch_to_camera(var/obj/machinery/camera/C) - if(!C.can_use() || stat || (get_dist(C, src) > 1 || machine != src || !has_vision() || !canmove)) - return 0 +/mob/proc/switch_to_camera(obj/machinery/camera/C) + if(!C.can_use() || incapacitated() || (get_dist(C, src) > 1 || machine != src || !has_vision())) + return FALSE check_eye(src) - return 1 + return TRUE /mob/proc/rename_character(oldname, newname) if(!newname) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 69e27595a07..af3d439df59 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -392,7 +392,7 @@ /mob/new_player/proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank, var/join_message) if(SSticker.current_state == GAME_STATE_PLAYING) var/ailist[] = list() - for(var/mob/living/silicon/ai/A in GLOB.living_mob_list) + for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list) ailist += A if(ailist.len) var/mob/living/silicon/ai/announcer = pick(ailist) @@ -424,7 +424,7 @@ /mob/new_player/proc/AnnounceCyborg(var/mob/living/character, var/rank, var/join_message) if(SSticker.current_state == GAME_STATE_PLAYING) var/ailist[] = list() - for(var/mob/living/silicon/ai/A in GLOB.living_mob_list) + for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list) ailist += A if(ailist.len) var/mob/living/silicon/ai/announcer = pick(ailist) diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 880d9c167d6..77f8cc40da9 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -921,7 +921,7 @@ if(4) clothes_s.Blend(new /icon('icons/mob/back.dmi', "satchel"), ICON_OVERLAY) - if(disabilities & NEARSIGHTED) + if(disabilities & DISABILITY_FLAG_NEARSIGHTED) preview_icon.Blend(new /icon('icons/mob/eyes.dmi', "glasses"), ICON_OVERLAY) // Observers get tourist outfit. diff --git a/code/modules/mob/status_procs.dm b/code/modules/mob/status_procs.dm index b61ce171194..3a053e74e16 100644 --- a/code/modules/mob/status_procs.dm +++ b/code/modules/mob/status_procs.dm @@ -207,4 +207,4 @@ /mob/proc/adjust_bodytemperature(amount, min_temp = 0, max_temp = INFINITY) if(bodytemperature >= min_temp && bodytemperature <= max_temp) - bodytemperature = Clamp(bodytemperature + amount, min_temp, max_temp) + bodytemperature = clamp(bodytemperature + amount, min_temp, max_temp) diff --git a/code/modules/mob/typing_indicator.dm b/code/modules/mob/typing_indicator.dm index 7b13ab68229..4dfbddc2d84 100644 --- a/code/modules/mob/typing_indicator.dm +++ b/code/modules/mob/typing_indicator.dm @@ -15,7 +15,7 @@ GLOBAL_DATUM(typing_indicator, /image) if(ishuman(src)) var/mob/living/carbon/human/H = src - if(H.disabilities & MUTE || H.silent) + if((MUTE in H.mutations) || H.silent) overlays -= GLOB.typing_indicator return diff --git a/code/modules/modular_computers/computers/item/processor.dm b/code/modules/modular_computers/computers/item/processor.dm index 7bd5be3cf81..3095e0af876 100644 --- a/code/modules/modular_computers/computers/item/processor.dm +++ b/code/modules/modular_computers/computers/item/processor.dm @@ -19,7 +19,6 @@ /obj/item/modular_computer/processor/New(comp) if(!comp || !istype(comp, /obj/machinery/modular_computer)) CRASH("Inapropriate type passed to obj/item/modular_computer/processor/New()! Aborting.") - return // Obtain reference to machinery computer all_components = list() idle_threads = list() diff --git a/code/modules/modular_computers/file_system/programs/command/card.dm b/code/modules/modular_computers/file_system/programs/command/card.dm index 9067a345d4e..b85fb710e38 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -35,7 +35,8 @@ /datum/job/ntnavyofficer, /datum/job/ntspecops, /datum/job/civilian, - /datum/job/syndicateofficer + /datum/job/syndicateofficer, + /datum/job/explorer // blacklisted so that HOPs don't try prioritizing it, then wonder why that doesn't work ) //The scaling factor of max total positions in relation to the total amount of people on board the station in % diff --git a/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm index 379e71ba484..0045b36f30e 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm @@ -84,9 +84,7 @@ data["SM_ambienttemp"] = air.temperature data["SM_ambientpressure"] = air.return_pressure() //data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01) - var/other_moles = 0.0 - for(var/datum/gas/G in air.trace_gases) - other_moles+=G.moles + var/other_moles = air.total_trace_moles() var/TM = air.total_moles() if(TM) data["SM_gas_O2"] = round(100*air.oxygen/TM,0.01) @@ -94,7 +92,7 @@ data["SM_gas_N2"] = round(100*air.nitrogen/TM,0.01) data["SM_gas_PL"] = round(100*air.toxins/TM,0.01) if(other_moles) - data["SM_gas_OTHER"] = round(100*other_moles/TM,0.01) + data["SM_gas_OTHER"] = round(100 * other_moles / TM, 0.01) else data["SM_gas_OTHER"] = 0 else diff --git a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm index 517c8f99ebe..ca208c22b02 100644 --- a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm @@ -195,7 +195,6 @@ if(!computer) // This program shouldn't even be runnable without computer. CRASH("Var computer is null!") - return 1 if(!hard_drive) computer.visible_message("\The [computer] shows an \"I/O Error - Hard drive connection error\" warning.") else // In 99.9% cases this will mean our HDD is full diff --git a/code/modules/modular_computers/file_system/programs/research/airestorer.dm b/code/modules/modular_computers/file_system/programs/research/airestorer.dm index d5ff31af66b..a87a2cd87b4 100644 --- a/code/modules/modular_computers/file_system/programs/research/airestorer.dm +++ b/code/modules/modular_computers/file_system/programs/research/airestorer.dm @@ -78,7 +78,7 @@ A.stat = CONSCIOUS A.lying = 0 GLOB.dead_mob_list -= A - GLOB.living_mob_list += A + GLOB.alive_mob_list += A // Finished restoring if(A.health >= 100) ai_slot.locked = FALSE diff --git a/code/modules/modular_computers/hardware/battery_module.dm b/code/modules/modular_computers/hardware/battery_module.dm index 7cec597dc13..1a48110006a 100644 --- a/code/modules/modular_computers/hardware/battery_module.dm +++ b/code/modules/modular_computers/hardware/battery_module.dm @@ -67,7 +67,6 @@ holder.shutdown_computer() return TRUE - return FALSE // Stock parts diff --git a/code/modules/nano/interaction/default.dm b/code/modules/nano/interaction/default.dm index ca42220204d..fed18f989f5 100644 --- a/code/modules/nano/interaction/default.dm +++ b/code/modules/nano/interaction/default.dm @@ -85,7 +85,7 @@ GLOBAL_DATUM_INIT(default_state, /datum/topic_state/default, new()) if(. != STATUS_CLOSE) if(loc) . = min(., loc.contents_nano_distance(src_object, src)) - if(STATUS_INTERACTIVE) + if(. == STATUS_INTERACTIVE) return STATUS_UPDATE /mob/living/carbon/brain/default_can_use_topic(var/src_object) diff --git a/code/modules/nano/modules/law_manager.dm b/code/modules/nano/modules/law_manager.dm index f2423e57c2f..64850ea954d 100644 --- a/code/modules/nano/modules/law_manager.dm +++ b/code/modules/nano/modules/law_manager.dm @@ -99,7 +99,7 @@ if(href_list["change_supplied_law_position"]) var/new_position = input(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position) as num|null if(isnum(new_position) && can_still_topic()) - supplied_law_position = Clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER) + supplied_law_position = clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER) return 1 if(href_list["edit_law"]) diff --git a/code/modules/ninja/energy_katana.dm b/code/modules/ninja/energy_katana.dm index cf694e59d83..741f0399922 100644 --- a/code/modules/ninja/energy_katana.dm +++ b/code/modules/ninja/energy_katana.dm @@ -52,7 +52,7 @@ if(user.put_in_hands(src)) msg = "Your Energy Katana teleports into your hand!" - else if(user.equip_to_slot_if_possible(src, slot_belt, 0, 1, 1)) + else if(user.equip_to_slot_if_possible(src, slot_belt, FALSE, TRUE)) msg = "Your Energy Katana teleports back to you, sheathing itself as it does so!
" else loc = get_turf(user) diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index d76765b61a7..a3ca2c5d410 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -11,7 +11,7 @@ var/amount = 30 //How much paper is in the bin. var/list/papers = list() //List of papers put in the bin for reference. var/letterhead_type - + /obj/item/paper_bin/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume, global_overlay = TRUE) if(amount) amount = 0 @@ -84,6 +84,7 @@ P.loc = user.loc user.put_in_hands(P) + P.add_fingerprint(user) to_chat(user, "You take [P] out of the [src].") else to_chat(user, "[src] is empty!") @@ -143,7 +144,7 @@ add_fingerprint(user) return - + /obj/item/paper_bin/nanotrasen name = "nanotrasen paper bin" diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 7fac0e3386a..aa2a033f130 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -72,7 +72,7 @@ update_icon() else if(is_hot(P)) - if(user.disabilities & CLUMSY && prob(10)) + if((CLUMSY in user.mutations) && prob(10)) user.visible_message("[user] accidentally ignites [user.p_them()]self!", \ "You miss [src] and accidentally light yourself on fire!") user.unEquip(P) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 8d0525c5eb1..5934dfa4f7d 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -237,7 +237,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor if(A.invisibility) if(see_ghosts && istype(A,/mob/dead/observer)) var/mob/dead/observer/O = A - if(O.following) + if(O.orbiting) continue if(user.mind && !(user.mind.assigned_role == "Chaplain")) atoms.Add(image('icons/mob/mob.dmi', O.loc, pick(GLOB.SpookyGhosts), 4, SOUTH)) @@ -297,7 +297,7 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor if(M.invisibility) if(see_ghosts && istype(M,/mob/dead/observer)) var/mob/dead/observer/O = M - if(O.following) + if(O.orbiting) continue if(!mob_detail) mob_detail = "You can see a g-g-g-g-ghooooost! " @@ -324,24 +324,26 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor mob_detail += "You can also see [A] on the photo[A:health < 75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]." return mob_detail -/obj/item/camera/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag) - if(!on || !pictures_left || ismob(target.loc)) return +/obj/item/camera/afterattack(atom/target, mob/user, flag) + if(!on || !pictures_left || ismob(target.loc)) + return captureimage(target, user, flag) playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 75, 1, -3) - + set_light(3, 2, LIGHT_COLOR_TUNGSTEN) + addtimer(CALLBACK(src, /atom./proc/set_light, 0), 2) pictures_left-- desc = "A polaroid camera. It has [pictures_left] photos left." to_chat(user, "[pictures_left] photos left.") icon_state = icon_off - on = 0 + on = FALSE if(istype(src,/obj/item/camera/spooky)) if(user.mind && user.mind.assigned_role == "Chaplain" && see_ghosts) if(prob(24)) handle_haunt(user) spawn(64) icon_state = icon_on - on = 1 + on = TRUE /obj/item/camera/proc/can_capture_turf(turf/T, mob/user) var/viewer = user diff --git a/code/modules/pda/app.dm b/code/modules/pda/app.dm index 189f354446f..655bb891de5 100644 --- a/code/modules/pda/app.dm +++ b/code/modules/pda/app.dm @@ -50,8 +50,6 @@ if(!pda.notifying_programs.len) pda.overlays -= image('icons/obj/pda.dmi', "pda-r") -/datum/data/pda/proc/ - // An app has a button on the home screen and its own UI /datum/data/pda/app name = "App" diff --git a/code/modules/pda/pdas.dm b/code/modules/pda/pdas.dm index 0e5c58f968a..f6f02e3457f 100644 --- a/code/modules/pda/pdas.dm +++ b/code/modules/pda/pdas.dm @@ -38,11 +38,8 @@ desc = "A portable microcomputer by Thinktronic Systems, LTD. The surface is coated with polytetrafluoroethylene and banana drippings." ttone = "honk" - trip_stun = 8 - trip_weaken = 5 - trip_chance = 100 - trip_walksafe = TRUE - trip_verb = TV_SLIP +/obj/item/pda/clown/ComponentInitialize() + AddComponent(/datum/component/slippery, src, 8, 5, 100) /obj/item/pda/mime default_cartridge = /obj/item/cartridge/mime @@ -191,7 +188,7 @@ var/datum/data/pda/app/messenger/M = find_program(/datum/data/pda/app/messenger) if(M) M.m_hidden = 1 - + //Some spare PDAs in a box /obj/item/storage/box/PDAs name = "spare PDAs" diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 89988ec9f55..f613f34a8fd 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -147,7 +147,7 @@ if(terminal) terminal.connect_to_network() -/obj/machinery/power/apc/New(turf/loc, ndir, building = 0) +/obj/machinery/power/apc/New(turf/loc, direction, building = 0) if(!armor) armor = list("melee" = 20, "bullet" = 20, "laser" = 10, "energy" = 100, "bomb" = 30, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 50) ..() @@ -158,12 +158,11 @@ // offset 24 pixels in direction of dir // this allows the APC to be embedded in a wall, yet still inside an area if(building) - setDir(ndir) - tdir = dir // to fix Vars bug - setDir(SOUTH) + setDir(direction) // We set this to direction only for pixel location determination. + + set_pixel_offsets_from_dir(24, -24, 24, -24) // Set pixel offsets based on `dir` + setDir(SOUTH) // APC's should always appear to *face* south. - pixel_x = (src.tdir & 3)? 0 : (src.tdir == 4 ? 24 : -24) - pixel_y = (src.tdir & 3)? (src.tdir ==1 ? 24 : -24) : 0 if(building) area = get_area(src) area.apc |= src @@ -177,7 +176,7 @@ /obj/machinery/power/apc/Destroy() GLOB.apcs -= src if(malfai && operating) - malfai.malf_picker.processing_time = Clamp(malfai.malf_picker.processing_time - 10,0,1000) + malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000) area.power_light = 0 area.power_equip = 0 area.power_environ = 0 @@ -244,7 +243,7 @@ else if(has_electronics && !terminal) . += "Electronics installed but not wired." else /* if(!has_electronics && !terminal) */ - . += "There is no electronics nor connected wires." + . += "There are no electronics nor connected wires." else if(stat & MAINT) . += "The cover is closed. Something wrong with it: it doesn't work." @@ -545,7 +544,7 @@ /obj/machinery/power/apc/crowbar_act(mob/living/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(opened) // a) on open apc if(has_electronics==1) @@ -1333,7 +1332,7 @@ /obj/machinery/power/apc/proc/set_broken() if(malfai && operating) - malfai.malf_picker.processing_time = Clamp(malfai.malf_picker.processing_time - 10,0,1000) + malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000) stat |= BROKEN operating = 0 if(occupier) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 0dc2fe0a129..b6c65d979cf 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -125,7 +125,7 @@ By design, d1 is the smallest direction and d2 is the highest /obj/structure/cable/proc/surplus() if(powernet) - return Clamp(powernet.avail-powernet.load, 0, powernet.avail) + return clamp(powernet.avail-powernet.load, 0, powernet.avail) else return 0 @@ -141,7 +141,7 @@ By design, d1 is the smallest direction and d2 is the highest /obj/structure/cable/proc/delayed_surplus() if(powernet) - return Clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail) + return clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail) else return 0 diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 24f55d34454..b92b456890f 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -160,7 +160,7 @@ /obj/item/stock_parts/cell/proc/get_electrocute_damage() if(charge >= 1000) - return Clamp(20 + round(charge / 25000), 20, 195) + rand(-5, 5) + return clamp(20 + round(charge / 25000), 20, 195) + rand(-5, 5) else return 0 diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 78c2561ae7d..0a31d882488 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -39,81 +39,86 @@ if(3) . += "The casing is closed." -/obj/machinery/light_construct/attackby(obj/item/W as obj, mob/living/user as mob, params) - src.add_fingerprint(user) - if(istype(W, /obj/item/wrench)) - if(src.stage == 1) - playsound(src.loc, W.usesound, 75, 1) - to_chat(usr, "You begin deconstructing [src].") - if(!do_after(usr, 30 * W.toolspeed, target = src)) +/obj/machinery/light_construct/wrench_act(mob/living/user, obj/item/I) + . = TRUE + switch(stage) + if(1) + to_chat(user, "You begin deconstructing [src].") + if(!I.use_tool(src, user, 30, volume = I.tool_volume)) return - new /obj/item/stack/sheet/metal( get_turf(src.loc), sheets_refunded ) - user.visible_message("[user.name] deconstructs [src].", \ - "You deconstruct [src].", "You hear a noise.") - playsound(src.loc, W.usesound, 75, 1) + new /obj/item/stack/sheet/metal(get_turf(loc), sheets_refunded) + user.visible_message("[user] deconstructs [src].", \ + "You deconstruct [src].", "You hear a noise.") qdel(src) - if(src.stage == 2) - to_chat(usr, "You have to remove the wires first.") - return + if(2) + to_chat(user, "You have to remove the wires first.") + if(3) + to_chat(user, "You have to unscrew the case first.") - if(src.stage == 3) - to_chat(usr, "You have to unscrew the case first.") - return - - if(istype(W, /obj/item/wirecutters)) - if(src.stage != 2) return - src.stage = 1 - switch(fixture_type) - if("tube") - src.icon_state = "tube-construct-stage1" - if("bulb") - src.icon_state = "bulb-construct-stage1" - new /obj/item/stack/cable_coil(get_turf(src.loc), 1, paramcolor = COLOR_RED) - user.visible_message("[user.name] removes the wiring from [src].", \ - "You remove the wiring from [src].", "You hear a noise.") - playsound(loc, W.usesound, 100, 1) +/obj/machinery/light_construct/wirecutter_act(mob/living/user, obj/item/I) + if(stage != 2) return + . = TRUE + if(!I.use_tool(src, user, 0)) + return + playsound(loc, I.usesound, 100, 1) + . = TRUE + stage = 1 + switch(fixture_type) + if("tube") + icon_state = "tube-construct-stage1" + if("bulb") + icon_state = "bulb-construct-stage1" + new /obj/item/stack/cable_coil(get_turf(loc), 1, paramcolor = COLOR_RED) + user.visible_message("[user] removes the wiring from [src].", \ + "You remove the wiring from [src].", "You hear a noise.") + +/obj/machinery/light_construct/screwdriver_act(mob/living/user, obj/item/I) + if(stage != 2) + return + . = TRUE + if(!I.use_tool(src, user, 0)) + return + switch(fixture_type) + if("tube") + icon_state = "tube-empty" + if("bulb") + icon_state = "bulb-empty" + stage = 3 + user.visible_message("[user] closes [src]'s casing.", \ + "You close [src]'s casing.", "You hear a noise.") + playsound(loc, I.usesound, 75, 1) + + switch(fixture_type) + if("tube") + newlight = new /obj/machinery/light/built(loc) + if("bulb") + newlight = new /obj/machinery/light/small/built(loc) + + newlight.setDir(dir) + transfer_fingerprints_to(newlight) + qdel(src) + +/obj/machinery/light_construct/attackby(obj/item/W, mob/living/user, params) + add_fingerprint(user) if(istype(W, /obj/item/stack/cable_coil)) - if(src.stage != 1) return + if(stage != 1) + return var/obj/item/stack/cable_coil/coil = W coil.use(1) switch(fixture_type) if("tube") - src.icon_state = "tube-construct-stage2" + icon_state = "tube-construct-stage2" if("bulb") - src.icon_state = "bulb-construct-stage2" - src.stage = 2 + icon_state = "bulb-construct-stage2" + stage = 2 playsound(loc, coil.usesound, 50, 1) - user.visible_message("[user.name] adds wires to [src].", \ - "You add wires to [src].") + user.visible_message("[user.name] adds wires to [src].", \ + "You add wires to [src].") return - if(istype(W, /obj/item/screwdriver)) - if(src.stage == 2) - switch(fixture_type) - if("tube") - src.icon_state = "tube-empty" - if("bulb") - src.icon_state = "bulb-empty" - src.stage = 3 - user.visible_message("[user.name] closes [src]'s casing.", \ - "You close [src]'s casing.", "You hear a noise.") - playsound(src.loc, W.usesound, 75, 1) - - switch(fixture_type) - - if("tube") - newlight = new /obj/machinery/light/built(src.loc) - if("bulb") - newlight = new /obj/machinery/light/small/built(src.loc) - - newlight.dir = src.dir - src.transfer_fingerprints_to(newlight) - qdel(src) - return - else - return ..() + return ..() /obj/machinery/light_construct/blob_act(obj/structure/blob/B) if(B && B.loc == loc) diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index c74f9cc0007..ff4074d045e 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -42,7 +42,7 @@ /obj/machinery/power/proc/surplus() if(powernet) - return Clamp(powernet.avail-powernet.load, 0, powernet.avail) + return clamp(powernet.avail-powernet.load, 0, powernet.avail) else return 0 @@ -58,7 +58,7 @@ /obj/machinery/power/proc/delayed_surplus() if(powernet) - return Clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail) + return clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail) else return 0 @@ -375,6 +375,7 @@ return null /area/proc/get_apc() - for(var/obj/machinery/power/apc/APC in GLOB.apcs) + for(var/thing in GLOB.apcs) + var/obj/machinery/power/apc/APC = thing if(APC.area == src) return APC diff --git a/code/modules/power/powernet.dm b/code/modules/power/powernet.dm index a4ab64a2099..f73498cff2c 100644 --- a/code/modules/power/powernet.dm +++ b/code/modules/power/powernet.dm @@ -97,6 +97,6 @@ /datum/powernet/proc/get_electrocute_damage() if(avail >= 1000) - return Clamp(20 + round(avail / 25000), 20, 195) + rand(-5, 5) + return clamp(20 + round(avail / 25000), 20, 195) + rand(-5, 5) else return 0 diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 9579fcc6bf4..ceb3b578588 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -21,11 +21,8 @@ var/state = 0 var/locked = 0 - var/frequency = 0 - var/id_tag = null var/projectile_type = /obj/item/projectile/beam/emitter var/projectile_sound = 'sound/weapons/emitter.ogg' - var/datum/radio_frequency/radio_connection var/datum/effect_system/spark_spread/sparks /obj/machinery/power/emitter/Initialize(mapload) @@ -40,8 +37,6 @@ sparks = new sparks.attach(src) sparks.set_up(5, 1, src) - if(frequency) - set_frequency(frequency) /obj/machinery/power/emitter/RefreshParts() var/max_firedelay = 120 @@ -59,14 +54,6 @@ power_usage -= 50 * M.rating active_power_usage = power_usage - //Radio remote control -/obj/machinery/power/emitter/proc/set_frequency(new_frequency) - SSradio.remove_object(src, frequency) - frequency = new_frequency - if(frequency) - radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA) - - /obj/machinery/power/emitter/verb/rotate() set name = "Rotate" set category = "Object" @@ -86,44 +73,7 @@ return rotate() -/obj/machinery/power/emitter/multitool_menu(var/mob/user,var/obj/item/multitool/P) - return {" - - "} - -/obj/machinery/power/emitter/receive_signal(datum/signal/signal) - if(!signal.data["tag"] || (signal.data["tag"] != id_tag)) - return 0 - - var/on=0 - switch(signal.data["command"]) - if("on") - on=1 - - if("off") - on=0 - - if("set") - on = signal.data["state"] > 0 - - if("toggle") - on = !active - - if(anchored && state == 2 && on != active) - active=on - var/statestr=on?"on":"off" - // Spammy message_admins("Emitter turned [statestr] by radio signal ([signal.data["command"]] @ [frequency]) in [formatJumpTo(src)]",0,1) - log_game("Emitter turned [statestr] by radio signal ([signal.data["command"]] @ [frequency]) in ([x], [y], [z]) AAC prints: [jointext(signal.data["hiddenprints"], "")]") - investigate_log("turned [statestr] by radio signal ([signal.data["command"]] @ [frequency]) AAC prints: [jointext(signal.data["hiddenprints"], "")]","singulo") - update_icon() - /obj/machinery/power/emitter/Destroy() - if(SSradio) - SSradio.remove_object(src, frequency) - radio_connection = null msg_admin_attack("Emitter deleted at ([x],[y],[z] - [ADMIN_JMP(src)])", ATKLOG_FEW) log_game("Emitter deleted at ([x],[y],[z])") investigate_log("deleted at ([x],[y],[z])","singulo") diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 62f2ed36065..046cf68a543 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -113,15 +113,15 @@ field_generator power level display if(!I.tool_use_check(user, 0)) return if(state == FG_SECURED) - WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE - else if(state == FG_WELDED) WELDER_ATTEMPT_FLOOR_WELD_MESSAGE + else if(state == FG_WELDED) + WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE if(I.use_tool(src, user, 20, volume = I.tool_volume)) if(state == FG_SECURED) - WELDER_FLOOR_SLICE_SUCCESS_MESSAGE + WELDER_FLOOR_WELD_SUCCESS_MESSAGE state = FG_WELDED else if(state == FG_WELDED) - WELDER_FLOOR_WELD_SUCCESS_MESSAGE + WELDER_FLOOR_SLICE_SUCCESS_MESSAGE state = FG_SECURED /obj/machinery/field/generator/emp_act() @@ -312,7 +312,8 @@ field_generator power level display //I want to avoid using global variables. spawn(1) var/temp = 1 //stops spam - for(var/obj/singularity/O in GLOB.singularities) + for(var/thing in GLOB.singularities) + var/obj/singularity/O = thing if(O.last_warning && temp) if((world.time - O.last_warning) > 50) //to stop message-spam temp = 0 diff --git a/code/modules/power/singularity/narsie.dm b/code/modules/power/singularity/narsie.dm index cf3a16432c0..80b10ab3a8b 100644 --- a/code/modules/power/singularity/narsie.dm +++ b/code/modules/power/singularity/narsie.dm @@ -93,7 +93,7 @@ /obj/singularity/narsie/proc/pickcultist() //Narsie rewards his cultists with being devoured first, then picks a ghost to follow. --NEO var/list/cultists = list() var/list/noncultists = list() - for(var/mob/living/carbon/food in GLOB.living_mob_list) //we don't care about constructs or cult-Ians or whatever. cult-monkeys are fair game i guess + for(var/mob/living/carbon/food in GLOB.alive_mob_list) //we don't care about constructs or cult-Ians or whatever. cult-monkeys are fair game i guess var/turf/pos = get_turf(food) if(pos.z != src.z) continue @@ -139,7 +139,6 @@ grav_pull = 0 /obj/singularity/narsie/wizard/eat() - set background = BACKGROUND_ENABLED for(var/atom/X in orange(consume_range,src)) if(isturf(X) || istype(X, /atom/movable)) consume(X) diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index f1a7f130592..b8ba53ae432 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -24,6 +24,7 @@ wires = new(src) connected_parts = list() update_icon() + use_log = list() /obj/machinery/particle_accelerator/control_box/Destroy() if(active) diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 61e1d786490..18d211e8aeb 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -253,7 +253,6 @@ /obj/singularity/proc/eat() - set background = BACKGROUND_ENABLED for(var/tile in spiral_range_turfs(grav_pull, src)) var/turf/T = tile if(!T || !isturf(loc)) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index f2e8fa53a8d..59ce091b170 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -29,11 +29,6 @@ var/output_level_max = 200000 // cap on output_level var/output_used = 0 // amount of power actually outputted. may be less than output_level if the powernet returns excess power - //Holders for powerout event. - var/last_output_attempt = 0 - var/last_input_attempt = 0 - var/last_charge = 0 - var/name_tag = null var/obj/machinery/power/terminal/terminal = null @@ -253,8 +248,6 @@ disconnect_terminal() return ..() - return round(5.5*charge/(capacity ? capacity : 5e6)) - /obj/machinery/power/smes/proc/chargedisplay() return round(5.5*charge/(capacity ? capacity : 5e6)) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index f8c23a696fa..d3f5f76303c 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -183,7 +183,7 @@ if(damage > explosion_point) if(get_turf(src)) var/turf/position = get_turf(src) - for(var/mob/living/mob in GLOB.living_mob_list) + for(var/mob/living/mob in GLOB.alive_mob_list) var/turf/mob_pos = get_turf(mob) if(mob_pos && mob_pos.z == position.z) if(ishuman(mob)) @@ -218,7 +218,7 @@ damage = max(0, damage + between(-DAMAGE_RATE_LIMIT, (removed.temperature - CRITICAL_TEMPERATURE) / 150, damage_inc_limit)) //Maxes out at 100% oxygen pressure - oxygen = Clamp((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / removed.total_moles(), 0, 1) + oxygen = clamp((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / removed.total_moles(), 0, 1) var/temp_factor var/equilibrium_power diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index 60b2a30dc34..d9b20c9d075 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -51,7 +51,7 @@ pixel_x = -32 pixel_y = -32 for(var/ball in orbiting_balls) - var/range = rand(1, Clamp(orbiting_balls.len, 3, 7)) + var/range = rand(1, clamp(orbiting_balls.len, 3, 7)) tesla_zap(ball, range, TESLA_MINI_POWER/7*range, TRUE) else energy = 0 // ensure we dont have miniballs of miniballs @@ -271,7 +271,7 @@ closest_grounding_rod.tesla_act(power, explosive) else if(closest_mob) - var/shock_damage = Clamp(round(power/400), 10, 90) + rand(-5, 5) + var/shock_damage = clamp(round(power/400), 10, 90) + rand(-5, 5) closest_mob.electrocute_act(shock_damage, source, 1, tesla_shock = TRUE) if(issilicon(closest_mob)) var/mob/living/silicon/S = closest_mob diff --git a/code/modules/power/treadmill.dm b/code/modules/power/treadmill.dm index 39c5d732128..6fd72d0ae9c 100644 --- a/code/modules/power/treadmill.dm +++ b/code/modules/power/treadmill.dm @@ -50,7 +50,7 @@ update_icon() return - speed = Clamp(speed - friction, 0, MAX_SPEED) + speed = clamp(speed - friction, 0, MAX_SPEED) for(var/A in (loc.contents - src)) var/atom/movable/AM = A if(AM.anchored) diff --git a/code/modules/procedural_mapping/mapGenerator.dm b/code/modules/procedural_mapping/mapGenerator.dm index 5c46ac20058..58494fc8b45 100644 --- a/code/modules/procedural_mapping/mapGenerator.dm +++ b/code/modules/procedural_mapping/mapGenerator.dm @@ -102,8 +102,6 @@ //Requests the mapGeneratorModule(s) to (re)generate /datum/mapGenerator/proc/generate() - set background = 1 //this can get beefy - syncModules() if(!modules || !modules.len) return diff --git a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm index 3e43c5638d1..5a933251872 100644 --- a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm +++ b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm @@ -18,6 +18,8 @@ T.air.nitrogen = T.nitrogen T.air.carbon_dioxide = T.carbon_dioxide T.air.toxins = T.toxins + T.air.sleeping_agent = T.sleeping_agent + T.air.agent_b = T.agent_b T.air.temperature = T.temperature SSair.add_to_active(T) diff --git a/code/modules/projectiles/ammunition/magazines.dm b/code/modules/projectiles/ammunition/magazines.dm index 5890110b635..8cb48f8e36a 100644 --- a/code/modules/projectiles/ammunition/magazines.dm +++ b/code/modules/projectiles/ammunition/magazines.dm @@ -383,7 +383,7 @@ /obj/item/ammo_box/magazine/m12g/update_icon() ..() - icon_state = "[initial(icon_state)]-[Ceiling(ammo_count(0)/8)*8]" + icon_state = "[initial(icon_state)]-[CEILING(ammo_count(0)/8, 1)*8]" /obj/item/ammo_box/magazine/m12g/buckshot name = "shotgun magazine (12g buckshot slugs)" @@ -494,7 +494,7 @@ /obj/item/ammo_box/magazine/laser/update_icon() ..() - icon_state = "[initial(icon_state)]-[Ceiling(ammo_count(0)/20)*20]" + icon_state = "[initial(icon_state)]-[CEILING(ammo_count(0)/20, 1)*20]" /obj/item/ammo_box/magazine/toy/smgm45 name = "donksoft SMG magazine" diff --git a/code/modules/projectiles/firing.dm b/code/modules/projectiles/firing.dm index d1e549dbdb0..869feae8f97 100644 --- a/code/modules/projectiles/firing.dm +++ b/code/modules/projectiles/firing.dm @@ -96,7 +96,7 @@ var/ox = round(screenview/2) //"origin" x var/oy = round(screenview/2) //"origin" y - var/angle = Atan2(y - oy, x - ox) + var/angle = ATAN2(y - oy, x - ox) Angle = angle if(spread) Angle += spread diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index d071ad236d1..ce0abc8cc69 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -136,7 +136,7 @@ /obj/item/gun/energy/update_icon() overlays.Cut() - var/ratio = Ceiling((cell.charge / cell.maxcharge) * charge_sections) + var/ratio = CEILING((cell.charge / cell.maxcharge) * charge_sections, 1) var/obj/item/ammo_casing/energy/shot = ammo_type[select] var/iconState = "[icon_state]_charge" var/itemState = null diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index 7a013f3083c..5823e69b39a 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -12,9 +12,9 @@ /obj/item/gun/magic/wand/New() if(prob(75) && variable_charges) //25% chance of listed max charges, 50% chance of 1/2 max charges, 25% chance of 1/3 max charges if(prob(33)) - max_charges = Ceiling(max_charges / 3) + max_charges = CEILING(max_charges / 3, 1) else - max_charges = Ceiling(max_charges / 2) + max_charges = CEILING(max_charges / 2, 1) ..() /obj/item/gun/magic/wand/examine(mob/user) diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index f2ce54bbd52..17a20f82d59 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -112,7 +112,7 @@ /obj/item/gun/projectile/automatic/c20r/update_icon() ..() - icon_state = "c20r[magazine ? "-[Ceiling(get_ammo(0)/4)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" + icon_state = "c20r[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" //WT550// /obj/item/gun/projectile/automatic/wt550 @@ -134,7 +134,7 @@ /obj/item/gun/projectile/automatic/wt550/update_icon() ..() - icon_state = "wt550[magazine ? "-[Ceiling(get_ammo(0)/4)*4]" : ""]" + icon_state = "wt550[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""]" //Type-U3 Uzi// /obj/item/gun/projectile/automatic/mini_uzi @@ -194,8 +194,8 @@ overlays += "[initial(icon_state)]gren" icon_state = "[initial(icon_state)][magazine ? "" : "-e"]" if(magazine) - overlays += image(icon = icon, icon_state = "m90-[Ceiling(get_ammo(0)/6)*6]") - item_state = "m90-[Ceiling(get_ammo(0)/7.5)]" + overlays += image(icon = icon, icon_state = "m90-[CEILING(get_ammo(0)/6, 1)*6]") + item_state = "m90-[CEILING(get_ammo(0)/7.5, 1)]" else item_state = "m90-0" return @@ -303,4 +303,4 @@ /obj/item/gun/projectile/automatic/lasercarbine/update_icon() ..() - icon_state = "lasercarbine[magazine ? "-[Ceiling(get_ammo(0)/5)*5]" : ""]" + icon_state = "lasercarbine[magazine ? "-[CEILING(get_ammo(0)/5, 1)*5]" : ""]" diff --git a/code/modules/projectiles/guns/projectile/saw.dm b/code/modules/projectiles/guns/projectile/saw.dm index 5b70f2b3282..3c25bc30f93 100644 --- a/code/modules/projectiles/guns/projectile/saw.dm +++ b/code/modules/projectiles/guns/projectile/saw.dm @@ -23,7 +23,7 @@ update_icon() /obj/item/gun/projectile/automatic/l6_saw/update_icon() - icon_state = "l6[cover_open ? "open" : "closed"][magazine ? Ceiling(get_ammo(0)/12.5)*25 : "-empty"][suppressed ? "-suppressed" : ""]" + icon_state = "l6[cover_open ? "open" : "closed"][magazine ? CEILING(get_ammo(0)/12.5, 1)*25 : "-empty"][suppressed ? "-suppressed" : ""]" item_state = "l6[cover_open ? "openmag" : "closedmag"]" /obj/item/gun/projectile/automatic/l6_saw/afterattack(atom/target as mob|obj|turf, mob/living/user as mob|obj, flag, params) //what I tried to do here is just add a check to see if the cover is open or not and add an icon_state change because I can't figure out how c-20rs do it with overlays diff --git a/code/modules/projectiles/guns/throw/crossbow.dm b/code/modules/projectiles/guns/throw/crossbow.dm index dc03a76fb48..7613c335141 100644 --- a/code/modules/projectiles/guns/throw/crossbow.dm +++ b/code/modules/projectiles/guns/throw/crossbow.dm @@ -132,13 +132,13 @@ switch(choice) if(XBOW_TENSION_20) - drawtension = Ceiling(0.2 * maxtension) + drawtension = CEILING(0.2 * maxtension, 1) if(XBOW_TENSION_40) - drawtension = Ceiling(0.4 * maxtension) + drawtension = CEILING(0.4 * maxtension, 1) if(XBOW_TENSION_60) - drawtension = Ceiling(0.6 * maxtension) + drawtension = CEILING(0.6 * maxtension, 1) if(XBOW_TENSION_80) - drawtension = Ceiling(0.8 * maxtension) + drawtension = CEILING(0.8 * maxtension, 1) if(XBOW_TENSION_FULL) drawtension = maxtension diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 626bcaf05a8..f8c1e5f0582 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -175,7 +175,7 @@ /obj/item/projectile/proc/vol_by_damage() if(damage) - return Clamp((damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then clamp the value between 30 and 100 + return clamp((damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then clamp the value between 30 and 100 else return 50 //if the projectile doesn't do damage, play its hitsound at 50% volume @@ -199,7 +199,7 @@ def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use. if(isturf(A) && hitsound_wall) - var/volume = Clamp(vol_by_damage() + 20, 0, 100) + var/volume = clamp(vol_by_damage() + 20, 0, 100) if(suppressed) volume = 5 playsound(loc, hitsound_wall, volume, 1, -1) @@ -239,7 +239,7 @@ while(loc) if(!paused) if((!( current ) || loc == current)) - current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z) + current = locate(clamp(x+xo,1,world.maxx),clamp(y+yo,1,world.maxy),z) if(isnull(Angle)) Angle=round(Get_Angle(src,current)) if(spread) @@ -292,7 +292,7 @@ while(loc) if(!paused) if((!( current ) || loc == current)) - current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z) + current = locate(clamp(x+xo,1,world.maxx),clamp(y+yo,1,world.maxy),z) step_towards(src, current) if(original && (original.layer>=2.75) || ismob(original)) if(loc == get_turf(original)) @@ -311,7 +311,7 @@ obj/item/projectile/proc/reflect_back(atom/source, list/position_modifiers = lis firer = source // The reflecting mob will be the new firer else firer = null // Reflected by something other than a mob so firer will be null - + // redirect the projectile original = locate(new_x, new_y, z) starting = curloc diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index d18c9c1832b..d40c96b5381 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -13,7 +13,6 @@ var/list/datum/reagent/addiction_list = new/list() var/list/addiction_threshold_accumulated = new/list() var/flags - var/list/reagents_generated_per_cycle = new/list() /datum/reagents/New(maximum = 100, temperature_minimum, temperature_maximum) maximum_volume = maximum @@ -21,8 +20,6 @@ temperature_min = temperature_minimum if(temperature_maximum) temperature_max = temperature_maximum - if(!(flags & REAGENT_NOREACT)) - START_PROCESSING(SSobj, src) //I dislike having these here but map-objects are initialised before world/New() is called. >_> if(!GLOB.chemical_reagents_list) //Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id @@ -185,7 +182,7 @@ return amount /datum/reagents/proc/set_reagent_temp(new_temp = T0C, react = TRUE) - chem_temp = Clamp(new_temp, temperature_min, temperature_max) + chem_temp = clamp(new_temp, temperature_min, temperature_max) if(react) temperature_react() handle_reactions() @@ -331,6 +328,7 @@ M.update_canmove() if(update_flags & STATUS_UPDATE_STAMINA) M.update_stamina() + M.update_health_hud() if(update_flags & STATUS_UPDATE_BLIND) M.update_blind_effects() if(update_flags & STATUS_UPDATE_BLURRY) @@ -360,23 +358,10 @@ od_chems.Add(R.id) return od_chems -/datum/reagents/process() - if(flags & REAGENT_NOREACT) - STOP_PROCESSING(SSobj, src) - return - for(var/thing in reagents_generated_per_cycle) - add_reagent(thing, reagents_generated_per_cycle[thing]) - for(var/datum/reagent/R in reagent_list) - R.on_tick() - /datum/reagents/proc/set_reacting(react = TRUE) if(react) - // Order is important, process() can remove from processing if - // the flag is present flags &= ~(REAGENT_NOREACT) - START_PROCESSING(SSobj, src) else - STOP_PROCESSING(SSobj, src) flags |= REAGENT_NOREACT /* @@ -638,7 +623,7 @@ if(total_volume + amount > maximum_volume) amount = (maximum_volume - total_volume) //Doesnt fit in. Make it disappear. Shouldnt happen. Will happen. if(amount <= 0) return 0 - chem_temp = Clamp((chem_temp * total_volume + reagtemp * amount) / (total_volume + amount), temperature_min, temperature_max) //equalize with new chems + chem_temp = clamp((chem_temp * total_volume + reagtemp * amount) / (total_volume + amount), temperature_min, temperature_max) //equalize with new chems for(var/A in reagent_list) @@ -905,7 +890,6 @@ /datum/reagents/Destroy() . = ..() - STOP_PROCESSING(SSobj, src) QDEL_LIST(reagent_list) reagent_list = null QDEL_LIST(addiction_list) diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 79fc47d61a8..39aa91099c0 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -118,10 +118,10 @@ if(href_list["adjust_temperature"]) var/val = href_list["adjust_temperature"] if(isnum(val)) - desired_temp = Clamp(desired_temp+val, 0, 1000) + desired_temp = clamp(desired_temp+val, 0, 1000) else if(val == "input") var/target = input("Please input the target temperature", name) as num - desired_temp = Clamp(target, 0, 1000) + desired_temp = clamp(target, 0, 1000) else return FALSE . = 1 diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 8cdb69062ff..7f0ed2c91dc 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -120,8 +120,10 @@ return // Called every time reagent containers process. -/datum/reagent/proc/on_tick(data) - return +/datum/reagent/process() + if(!holder || holder.flags & REAGENT_NOREACT) + return FALSE + return TRUE // Called when the reagent container is hit by an explosion /datum/reagent/proc/on_ex_act(severity) @@ -203,9 +205,7 @@ return M.emote("deathgasp") M.status_flags |= FAKEDEATH - M.update_stat("fakedeath reagent") - M.med_hud_set_health() - M.med_hud_set_status() + M.updatehealth("fakedeath reagent") /datum/reagent/proc/fakerevive(mob/living/M) if(!(M.status_flags & FAKEDEATH)) @@ -215,10 +215,6 @@ if(M.resting) M.StopResting() M.status_flags &= ~(FAKEDEATH) - M.update_stat("fakedeath reagent end") - M.med_hud_set_status() - M.med_hud_set_health() if(M.healthdoll) M.healthdoll.cached_healthdoll_overlays.Cut() - if(M.dna.species) - M.dna.species.handle_hud_icons(M) + M.updatehealth("fakedeath reagent end") diff --git a/code/modules/reagents/chemistry/reagents/alcohol.dm b/code/modules/reagents/chemistry/reagents/alcohol.dm index 2dde295a70a..6e33184f2d0 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol.dm @@ -18,18 +18,18 @@ /datum/reagent/consumable/ethanol/reaction_obj(obj/O, volume) if(istype(O,/obj/item/paper)) if(istype(O,/obj/item/paper/contract/infernal)) - to_chat(usr, "The solution ignites on contact with the [O].") + O.visible_message("The solution ignites on contact with [O].") else var/obj/item/paper/paperaffected = O paperaffected.clearpaper() - to_chat(usr, "The solution melts away the ink on the paper.") + paperaffected.visible_message("The solution melts away the ink on the paper.") if(istype(O,/obj/item/book)) if(volume >= 5) var/obj/item/book/affectedbook = O affectedbook.dat = null - to_chat(usr, "The solution melts away the ink on the book.") + affectedbook.visible_message("The solution melts away the ink on the book.") else - to_chat(usr, "It wasn't enough...") + O.visible_message("It wasn't enough...") /datum/reagent/consumable/ethanol/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume)//Splashing people with ethanol isn't quite as good as fuel. if(method == REAGENT_TOUCH) @@ -1190,12 +1190,12 @@ taste_description = "motor oil" /datum/reagent/consumable/ethanol/synthanol/on_mob_life(mob/living/M) + metabolization_rate = REAGENTS_METABOLISM if(!(M.dna.species.reagent_tag & PROCESS_SYN)) - holder.remove_reagent(id, 3.6) //gets removed from organics very fast + metabolization_rate += 3.6 //gets removed from organics very fast if(prob(25)) - holder.remove_reagent(id, 15) + metabolization_rate += 15 M.fakevomit() - return ..() /datum/reagent/consumable/ethanol/synthanol/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume) diff --git a/code/modules/reagents/chemistry/reagents/blob.dm b/code/modules/reagents/chemistry/reagents/blob.dm index acf244a892d..7600fb25222 100644 --- a/code/modules/reagents/chemistry/reagents/blob.dm +++ b/code/modules/reagents/chemistry/reagents/blob.dm @@ -125,7 +125,7 @@ /datum/reagent/blob/proc/reagent_vortex(mob/living/M, setting_type, volume) var/turf/pull = get_turf(M) - var/range_power = Clamp(round(volume/5, 1), 1, 5) + var/range_power = clamp(round(volume/5, 1), 1, 5) for(var/atom/movable/X in range(range_power,pull)) if(istype(X, /obj/effect)) continue diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 262acae5f82..e90789f9d8b 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -173,6 +173,29 @@ metabolization_rate = 0.2 taste_description = "antibiotics" +/datum/reagent/medicine/spaceacillin/on_mob_life(mob/living/M) + var/list/organs_list = list() + if(iscarbon(M)) + var/mob/living/carbon/C = M + organs_list += C.internal_organs + + if(ishuman(M)) + var/mob/living/carbon/human/H = M + organs_list += H.bodyparts + + for(var/X in organs_list) + var/obj/item/organ/O = X + if(O.germ_level < INFECTION_LEVEL_ONE) + O.germ_level = 0 //cure instantly + else if(O.germ_level < INFECTION_LEVEL_TWO) + O.germ_level = max(M.germ_level - 25, 0) //at germ_level == 500, this should cure the infection in 34 seconds + else + O.germ_level = max(M.germ_level - 10, 0) // at germ_level == 1000, this will cure the infection in 1 minutes, 14 seconds + + organs_list.Cut() + M.germ_level = max(M.germ_level - 20, 0) // Reduces the mobs germ level, too + return ..() + /datum/reagent/medicine/silver_sulfadiazine name = "Silver Sulfadiazine" id = "silver_sulfadiazine" @@ -790,7 +813,7 @@ ..() return M.SetJitter(0) - var/needs_update = M.mutations.len > 0 || M.disabilities > 0 + var/needs_update = M.mutations.len > 0 if(needs_update) for(var/block = 1; block<=DNA_SE_LENGTH; block++) diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index d84ed59e6de..f9a6f974dcf 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -450,21 +450,18 @@ var/mob/living/carbon/C = holder.my_atom if(!istype(C)) return - var/mind_type = FALSE if(C.mind) if(C.mind.assigned_role == "Clown" || C.mind.assigned_role == SPECIAL_ROLE_HONKSQUAD) - mind_type = "Clown" to_chat(C, "Whatever that was, it feels great!") else if(C.mind.assigned_role == "Mime") - mind_type = "Mime" to_chat(C, "You feel nauseous.") C.AdjustDizzy(volume) else to_chat(C, "Something doesn't feel right...") C.AdjustDizzy(volume) - C.AddComponent(/datum/component/jestosterone, mind_type) + ADD_TRAIT(C, TRAIT_JESTER, id) C.AddComponent(/datum/component/squeak, null, null, null, null, null, TRUE) - C.AddComponent(/datum/component/waddling) + C.AddElement(/datum/element/waddling) /datum/reagent/jestosterone/on_mob_life(mob/living/carbon/M) if(!istype(M)) @@ -472,8 +469,7 @@ var/update_flags = STATUS_UPDATE_NONE if(prob(10)) M.emote("giggle") - GET_COMPONENT_FROM(jestosterone_component, /datum/component/jestosterone, M) - if(jestosterone_component.mind_type == "Clown") + if(M?.mind.assigned_role == "Clown" || M?.mind.assigned_role == SPECIAL_ROLE_HONKSQUAD) update_flags |= M.adjustBruteLoss(-1.5 * REAGENTS_EFFECT_MULTIPLIER) //Screw those pesky clown beatings! else M.AdjustDizzy(10, 0, 500) @@ -493,18 +489,15 @@ "Your legs feel like jelly.", "You feel like telling a pun.") to_chat(M, "[pick(clown_message)]") - if(jestosterone_component.mind_type == "Mime") + if(M?.mind.assigned_role == "Mime") update_flags |= M.adjustToxLoss(1.5 * REAGENTS_EFFECT_MULTIPLIER) return ..() | update_flags /datum/reagent/jestosterone/on_mob_delete(mob/living/M) ..() - GET_COMPONENT_FROM(remove_fun, /datum/component/jestosterone, M) - GET_COMPONENT_FROM(squeaking, /datum/component/squeak, M) - GET_COMPONENT_FROM(waddling, /datum/component/waddling, M) - remove_fun.Destroy() - squeaking.Destroy() - waddling.Destroy() + REMOVE_TRAIT(M, TRAIT_JESTER, id) + qdel(M.GetComponent(/datum/component/squeak)) + M.RemoveElement(/datum/element/waddling) /datum/reagent/royal_bee_jelly name = "royal bee jelly" diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm index dc79b5f4b3c..9d85459f465 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm @@ -333,19 +333,26 @@ process_flags = ORGANIC | SYNTHETIC taste_description = "bitterness" +/datum/reagent/cryostylane/on_new(data) + ..() + START_PROCESSING(SSprocessing, src) + +/datum/reagent/cryostylane/Destroy() + STOP_PROCESSING(SSprocessing, src) + return ..() + /datum/reagent/cryostylane/on_mob_life(mob/living/M) //TODO: code freezing into an ice cube if(M.reagents.has_reagent("oxygen")) M.reagents.remove_reagent("oxygen", 1) M.bodytemperature -= 30 return ..() -/datum/reagent/cryostylane/on_tick() - if(holder.has_reagent("oxygen")) - holder.remove_reagent("oxygen", 2) - holder.remove_reagent("cryostylane", 2) - holder.temperature_reagents(holder.chem_temp - 200) - holder.temperature_reagents(holder.chem_temp - 200) - ..() +/datum/reagent/cryostylane/process() + if(..()) + if(holder.has_reagent("oxygen")) + holder.remove_reagent("oxygen", 2) + holder.remove_reagent("cryostylane", 2) + holder.temperature_reagents(holder.chem_temp - 200) /datum/reagent/cryostylane/reaction_mob(mob/living/M, method = REAGENT_TOUCH, volume) if(method == REAGENT_TOUCH) @@ -368,19 +375,26 @@ process_flags = ORGANIC | SYNTHETIC taste_description = "bitterness" +/datum/reagent/pyrosium/on_new(data) + ..() + START_PROCESSING(SSprocessing, src) + +/datum/reagent/pyrosium/Destroy() + STOP_PROCESSING(SSprocessing, src) + return ..() + /datum/reagent/pyrosium/on_mob_life(mob/living/M) if(M.reagents.has_reagent("oxygen")) M.reagents.remove_reagent("oxygen", 1) M.bodytemperature += 30 return ..() -/datum/reagent/pyrosium/on_tick() - if(holder.has_reagent("oxygen")) - holder.remove_reagent("oxygen", 2) - holder.remove_reagent("pyrosium", 2) - holder.temperature_reagents(holder.chem_temp + 200) - holder.temperature_reagents(holder.chem_temp + 200) - ..() +/datum/reagent/pyrosium/process() + if(..()) + if(holder.has_reagent("oxygen")) + holder.remove_reagent("oxygen", 2) + holder.remove_reagent("pyrosium", 2) + holder.temperature_reagents(holder.chem_temp + 200) /datum/reagent/firefighting_foam name = "Firefighting foam" diff --git a/code/modules/reagents/chemistry/reagents/toxins.dm b/code/modules/reagents/chemistry/reagents/toxins.dm index 28ed544cb18..dec256ac455 100644 --- a/code/modules/reagents/chemistry/reagents/toxins.dm +++ b/code/modules/reagents/chemistry/reagents/toxins.dm @@ -192,6 +192,14 @@ color = "#7DFF00" taste_description = "slime" +/datum/reagent/stable_mutagen/on_new(data) + ..() + START_PROCESSING(SSprocessing, src) + +/datum/reagent/stable_mutagen/Destroy() + STOP_PROCESSING(SSprocessing, src) + return ..() + /datum/reagent/stable_mutagen/on_mob_life(mob/living/M) if(!ishuman(M) || !M.dna) return @@ -212,11 +220,11 @@ return ..() -/datum/reagent/stable_mutagen/on_tick() - var/datum/reagent/blood/B = locate() in holder.reagent_list - if(B && islist(B.data) && !data) - data = B.data.Copy() - ..() +/datum/reagent/stable_mutagen/process() + if(..()) + var/datum/reagent/blood/B = locate() in holder.reagent_list + if(B && islist(B.data) && !data) + data = B.data.Copy() /datum/reagent/romerol name = "romerol" diff --git a/code/modules/reagents/chemistry/reagents/water.dm b/code/modules/reagents/chemistry/reagents/water.dm index c6960aac916..f975cac7293 100644 --- a/code/modules/reagents/chemistry/reagents/water.dm +++ b/code/modules/reagents/chemistry/reagents/water.dm @@ -96,21 +96,21 @@ C.l_hand.clean_blood() if(C.wear_mask) if(C.wear_mask.clean_blood()) - C.update_inv_wear_mask(0) + C.update_inv_wear_mask() if(ishuman(M)) var/mob/living/carbon/human/H = C if(H.head) if(H.head.clean_blood()) - H.update_inv_head(0,0) + H.update_inv_head() if(H.wear_suit) if(H.wear_suit.clean_blood()) - H.update_inv_wear_suit(0,0) + H.update_inv_wear_suit() else if(H.w_uniform) if(H.w_uniform.clean_blood()) - H.update_inv_w_uniform(0,0) + H.update_inv_w_uniform() if(H.shoes) if(H.shoes.clean_blood()) - H.update_inv_shoes(0,0) + H.update_inv_shoes() M.clean_blood() ..() diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index e87e72d8750..8783d8a8c19 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -149,7 +149,7 @@ cut_overlays() var/rounded_vol if(reagents && reagents.total_volume) - rounded_vol = Clamp(round((reagents.total_volume / volume * 15), 5), 1, 15) + rounded_vol = clamp(round((reagents.total_volume / volume * 15), 5), 1, 15) var/image/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]") filling_overlay.icon += mix_color_from_reagents(reagents.reagent_list) add_overlay(filling_overlay) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index e16ce4a0824..27b9d2c4a45 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -272,7 +272,7 @@ /obj/machinery/disposal/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state) var/data[0] - var/pressure = Clamp(100* air_contents.return_pressure() / (SEND_PRESSURE), 0, 100) + var/pressure = clamp(100* air_contents.return_pressure() / (SEND_PRESSURE), 0, 100) var/pressure_round = round(pressure,1) data["isAI"] = isAI(user) @@ -330,7 +330,7 @@ // eject the contents of the disposal unit /obj/machinery/disposal/proc/eject() for(var/atom/movable/AM in src) - AM.loc = src.loc + AM.forceMove(loc) AM.pipe_eject(0) update() @@ -471,7 +471,7 @@ for(var/atom/movable/AM in H) target = get_offset_target_turf(src.loc, rand(5)-rand(5), rand(5)-rand(5)) - AM.loc = src.loc + AM.forceMove(loc) AM.pipe_eject(0) if(!istype(AM, /mob/living/silicon/robot/drone) && !istype(AM, /mob/living/silicon/robot/syndicate/saboteur)) //Poor drones kept smashing windows and taking system damage being fired out of disposals. ~Z spawn(1) @@ -487,7 +487,7 @@ if(istype(I, /obj/item/projectile)) return if(prob(75)) - I.loc = src + I.forceMove(src) for(var/mob/M in viewers(src)) M.show_message("\the [I] lands in \the [src].", 3) update() @@ -550,7 +550,7 @@ // now everything inside the disposal gets put into the holder // note AM since can contain mobs or objs for(var/atom/movable/AM in D) - AM.loc = src + AM.forceMove(src) SEND_SIGNAL(AM, COMSIG_MOVABLE_DISPOSING, src, D) if(istype(AM, /mob/living/carbon/human)) var/mob/living/carbon/human/H = AM @@ -582,7 +582,7 @@ D.expel(src) // no trunk connected, so expel immediately return - loc = D.trunk + forceMove(D.trunk) active = 1 dir = DOWN spawn(1) @@ -639,11 +639,10 @@ // used when a a holder meets a stuck holder /obj/structure/disposalholder/proc/merge(var/obj/structure/disposalholder/other) for(var/atom/movable/AM in other) - AM.loc = src // move everything in other holder to this one + AM.forceMove(src) // move everything in other holder to this one if(ismob(AM)) var/mob/M = AM - if(M.client) // if a client mob, update eye to follow this holder - M.client.eye = src + M.reset_perspective(src) // if a client mob, update eye to follow this holder if(other.has_fat_guy) has_fat_guy = 1 @@ -712,7 +711,7 @@ // this is unlikely, but just dump out everything into the turf in case for(var/atom/movable/AM in H) - AM.loc = T + AM.forceMove(T) AM.pipe_eject(0) qdel(H) ..() @@ -747,9 +746,9 @@ if(H2 && !H2.active) H.merge(H2) - H.loc = P + H.forceMove(P) else // if wasn't a pipe, then set loc to turf - H.loc = T + H.forceMove(T) return null return P @@ -791,7 +790,7 @@ if(T.density) // dense ouput turf, so stop holder H.active = 0 - H.loc = src + H.forceMove(src) return if(T.intact && istype(T,/turf/simulated/floor)) //intact floor, pop the tile var/turf/simulated/floor/F = T @@ -807,7 +806,7 @@ playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0) if(H) for(var/atom/movable/AM in H) - AM.loc = T + AM.forceMove(T) AM.pipe_eject(direction) spawn(1) if(AM) @@ -822,7 +821,7 @@ for(var/atom/movable/AM in H) target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5)) - AM.loc = T + AM.forceMove(T) AM.pipe_eject(0) spawn(1) if(AM) @@ -853,7 +852,7 @@ // this is unlikely, but just dump out everything into the turf in case for(var/atom/movable/AM in H) - AM.loc = T + AM.forceMove(T) AM.pipe_eject(0) qdel(H) return @@ -1070,9 +1069,9 @@ var/obj/structure/disposalholder/H2 = locate() in P if(H2 && !H2.active) H.merge(H2) - H.loc = P + H.forceMove(P) else // if wasn't a pipe, then set loc to turf - H.loc = T + H.forceMove(T) return null return P @@ -1129,9 +1128,9 @@ if(H2 && !H2.active) H.merge(H2) - H.loc = P + H.forceMove(P) else // if wasn't a pipe, then set loc to turf - H.loc = T + H.forceMove(T) return null return P @@ -1361,10 +1360,6 @@ /atom/movable/proc/pipe_eject(var/direction) return -// check if mob has client, if so restore client view on eject -/mob/pipe_eject(var/direction) - reset_perspective(null) - /obj/effect/decal/cleanable/blood/gibs/pipe_eject(var/direction) var/list/dirs if(direction) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 403df48be69..ecf6b9887fc 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -25,7 +25,7 @@ /obj/structure/bigDelivery/attack_hand(mob/user as mob) playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1) if(wrapped) - wrapped.loc = get_turf(src) + wrapped.forceMove(get_turf(src)) if(istype(wrapped, /obj/structure/closet)) var/obj/structure/closet/O = wrapped O.welded = init_welded diff --git a/code/modules/research/designs/autolathe_designs.dm b/code/modules/research/designs/autolathe_designs.dm index d907e46247e..1a57f2e2aee 100644 --- a/code/modules/research/designs/autolathe_designs.dm +++ b/code/modules/research/designs/autolathe_designs.dm @@ -880,14 +880,6 @@ build_path = /obj/item/assembly/mousetrap category = list("initial", "Miscellaneous") -/datum/design/logic_board - name = "Logic Circuit" - id = "logic_board" - build_type = AUTOLATHE - materials = list(MAT_METAL = 50, MAT_GLASS = 50) - build_path = /obj/item/circuitboard/logic_gate - category = list("initial", "Electronics") - /datum/design/vendor name = "Machine Board (Vendor)" desc = "The circuit board for a Vendor." diff --git a/code/modules/research/designs/comp_board_designs.dm b/code/modules/research/designs/comp_board_designs.dm index 67f797ee964..826bdbf16aa 100644 --- a/code/modules/research/designs/comp_board_designs.dm +++ b/code/modules/research/designs/comp_board_designs.dm @@ -332,16 +332,6 @@ build_path = /obj/item/circuitboard/large_tank_control category = list("Computer Boards") -/datum/design/AAC - name = "Console Board (Atmospheric Automations Console)" - desc = "Allows for the construction of circuit boards used to build an Atmospheric Automations Console." - id = "AAC" - req_tech = list("programming" = 4, "magnets" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/atmos_automation - category = list("Computer Boards") - /datum/design/xenobiocamera name = "Console Board (Xenobiology Console)" desc = "Allows for the construction of circuit boards used to build xenobiology camera computers." diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 3951cf23312..caa273594de 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -89,8 +89,8 @@ component_parts += new /obj/item/stock_parts/micro_laser(src) component_parts += new /obj/item/stock_parts/micro_laser(src) spawn(1) - trackedIan = locate(/mob/living/simple_animal/pet/dog/corgi/Ian) in GLOB.mob_list - trackedRuntime = locate(/mob/living/simple_animal/pet/cat/Runtime) in GLOB.mob_list + trackedIan = locate(/mob/living/simple_animal/pet/dog/corgi/Ian) in GLOB.mob_living_list + trackedRuntime = locate(/mob/living/simple_animal/pet/cat/Runtime) in GLOB.mob_living_list SetTypeReactions() RefreshParts() @@ -449,7 +449,7 @@ visible_message("[src]'s crushing mechanism slowly and smoothly descends, flattening the [exp_on]!") new /obj/item/stack/sheet/plasteel(get_turf(pick(oview(1,src)))) if(linked_console.linked_lathe) - GET_COMPONENT_FROM(linked_materials, /datum/component/material_container, linked_console.linked_lathe) + var/datum/component/material_container/linked_materials = linked_console.linked_lathe.GetComponent(/datum/component/material_container) for(var/material in exp_on.materials) linked_materials.insert_amount( min((linked_materials.max_amount - linked_materials.total_amount), (exp_on.materials[material])), material) if(prob(EFFECT_PROB_VERYLOW-badThingCoeff)) diff --git a/code/modules/research/message_server.dm b/code/modules/research/message_server.dm index 22b18534dbc..df3a7945e92 100644 --- a/code/modules/research/message_server.dm +++ b/code/modules/research/message_server.dm @@ -228,7 +228,15 @@ GLOBAL_DATUM(blackbox, /obj/machinery/blackbox_recorder) GLOB.blackbox = src /obj/machinery/blackbox_recorder/Destroy() - var/turf/T = locate(1,1,2) + // If the blackbox on station is destroyed, it is moved to the admin level + // It is very clear that the person who made this doesnt know what a datum is + // and thinks that an object which is vital for backend logging of when rounds end and begin + // should not only be destroyable, but also an on-station. Whoever designed this needs to be educated + // Thank you for coming to my ted talk, -aa + + // Hardcoded Zlevel numbers are bad, so we use the level name to grab the admin Z level + var/admin_zlevel = level_name_to_num(CENTCOMM) + var/turf/T = locate(1, 1, admin_zlevel) if(T) GLOB.blackbox = null var/obj/machinery/blackbox_recorder/BR = new/obj/machinery/blackbox_recorder(T) diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index d7bf071a8eb..822554549c9 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -131,7 +131,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, //Have it automatically push research to the centcom server so wild griffins can't fuck up R&D's work --NEO /obj/machinery/computer/rdconsole/proc/griefProtection() - for(var/obj/machinery/r_n_d/server/centcom/C in world) + for(var/obj/machinery/r_n_d/server/centcom/C in GLOB.machines) files.push_data(C.files) /obj/machinery/computer/rdconsole/proc/Maximize() @@ -148,7 +148,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, files = new /datum/research(src) //Setup the research data holder. matching_designs = list() if(!id) - for(var/obj/machinery/r_n_d/server/centcom/S in world) + for(var/obj/machinery/r_n_d/server/centcom/S in GLOB.machines) S.initialize_serv() break @@ -390,7 +390,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, spawn(SYNC_RESEARCH_DELAY) clear_wait_message() if(src) - for(var/obj/machinery/r_n_d/server/S in world) + for(var/obj/machinery/r_n_d/server/S in GLOB.machines) var/server_processed = 0 if(S.disabled) continue diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index 7acdc53ce3d..bd4e5528a9b 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -20,9 +20,7 @@ var/datum/component/material_container/materials //Store for hyper speed! /obj/machinery/r_n_d/New() - materials = AddComponent(/datum/component/material_container, - list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), 0, - TRUE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) + materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), 0, TRUE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) materials.precise_insertion = TRUE ..() wires["Red"] = 0 diff --git a/code/modules/research/research.dm b/code/modules/research/research.dm index b5fc9e9c879..444a2f9d017 100644 --- a/code/modules/research/research.dm +++ b/code/modules/research/research.dm @@ -117,7 +117,7 @@ research holder datum. AddDesign2Known(PD) for(var/v in known_tech) var/datum/tech/T = known_tech[v] - T.level = Clamp(T.level, 0, 20) + T.level = clamp(T.level, 0, 20) //Refreshes the levels of a given tech. //Input: Tech's ID and Level; Output: null diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index de9194953da..ab0461a8908 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -68,7 +68,7 @@ if(0 to T0C) health = min(100, health + 1) if(T0C to (T20C + 20)) - health = Clamp(health, 0, 100) + health = clamp(health, 0, 100) if((T20C + 20) to (T0C + 70)) health = max(0, health - 1) if(health <= 0) diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index c71c3f6f8d8..7c35730f4aa 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -319,7 +319,7 @@ return ..() to_chat(user, "You feed the slime the stabilizer. It is now less likely to mutate.") - M.mutation_chance = Clamp(M.mutation_chance-15,0,100) + M.mutation_chance = clamp(M.mutation_chance-15,0,100) qdel(src) /obj/item/slimepotion/slime/mutator @@ -343,7 +343,7 @@ return ..() to_chat(user, "You feed the slime the mutator. It is now more likely to mutate.") - M.mutation_chance = Clamp(M.mutation_chance+12,0,100) + M.mutation_chance = clamp(M.mutation_chance+12,0,100) M.mutator_used = TRUE qdel(src) diff --git a/code/modules/security_levels/keycard authentication.dm b/code/modules/security_levels/keycard authentication.dm index 06ebfaa3374..87723701281 100644 --- a/code/modules/security_levels/keycard authentication.dm +++ b/code/modules/security_levels/keycard authentication.dm @@ -117,7 +117,7 @@ /obj/machinery/keycard_auth/proc/broadcast_request() icon_state = "auth_on" - for(var/obj/machinery/keycard_auth/KA in world) + for(var/obj/machinery/keycard_auth/KA in GLOB.machines) if(KA == src) continue KA.reset() spawn() diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index c57cea9216e..18db87f6eb7 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -32,9 +32,9 @@ jumpto_ports += list("nav_z1" = 1) if(access_tcomms) jumpto_ports += list("nav_z3" = 1) - if(ACCESS_CONSTRUCTION) + if(access_construction) jumpto_ports += list("nav_z4" = 1) - if(ACCESS_MINING) + if(access_mining) jumpto_ports += list("nav_z5" = 1) if(access_derelict) jumpto_ports += list("nav_z6" = 1) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index f0394349f4d..1d9f6970135 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -3,6 +3,8 @@ var/turf/newT = get_turf(src) if(newT.z != oldT.z) onTransitZ(oldT.z, newT.z) + if(light) + update_light() if(rotation) shuttleRotate(rotation) forceMove(T1) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 0f872b599a1..5eb2f14ae50 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -463,7 +463,7 @@ var/rotation = dir2angle(S1.dir)-dir2angle(dir) if((rotation % 90) != 0) rotation += (rotation % 90) //diagonal rotations not allowed, round up - rotation = SimplifyDegrees(rotation) + rotation = SIMPLIFY_DEGREES(rotation) //remove area surrounding docking port if(areaInstance.contents.len) @@ -809,7 +809,8 @@ if(href_list["move"]) if(!options.Find(href_list["move"])) //I see you're trying Href exploits, I see you're failing, I SEE ADMIN WARNING. // Seriously, though, NEVER trust a Topic with something like this. Ever. - message_admins("move HREF ([src] attempted to move to: [href_list["move"]]) exploit attempted by [key_name_admin(usr)] on [src] (JMP)") + // Sidenote for whoever did this last. Why did you set it to echo whatever the user entered to admin chat? You solved one exploit and created another. + message_admins("EXPLOIT: [ADMIN_LOOKUPFLW(usr)] attempted to move [src] to an invalid location! [ADMIN_COORDJMP(src)]") return switch(SSshuttle.moveShuttle(shuttleId, href_list["move"], 1, usr)) if(0) diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index e1aa537f8a8..b1eeb07a6de 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -102,7 +102,10 @@ var/pointsEarned for(var/atom/movable/MA in areaInstance) - if(MA.anchored) continue + if(MA.anchored) + continue + if(istype(MA, /mob/dead)) + continue SSshuttle.sold_atoms += " [MA.name]" // Must be in a crate (or a critter crate)! @@ -484,7 +487,7 @@ var/num_input = input(usr, "Amount:", "How many crates?") as null|num if(!num_input || ..()) return 1 - crates = Clamp(round(num_input), 1, 20) + crates = clamp(round(num_input), 1, 20) var/timeout = world.time + 600 var/reason = input(usr,"Reason:","Why do you require this item?","") as null|text @@ -665,7 +668,7 @@ var/num_input = input(usr, "Amount:", "How many crates?") as null|num if(!num_input || !is_authorized(usr) || ..()) return 1 - crates = Clamp(round(num_input), 1, 20) + crates = clamp(round(num_input), 1, 20) var/timeout = world.time + 600 var/reason = input(usr,"Reason:","Why do you require this item?","") as null|text diff --git a/code/modules/space_management/zlevel_manager.dm b/code/modules/space_management/zlevel_manager.dm index eb84206eea3..5582288a813 100644 --- a/code/modules/space_management/zlevel_manager.dm +++ b/code/modules/space_management/zlevel_manager.dm @@ -107,6 +107,7 @@ GLOBAL_DATUM_INIT(space_manager, /datum/zlev_manager, new()) // Increments the max z-level by one // For convenience's sake returns the z-level added /datum/zlev_manager/proc/add_new_zlevel(name, linkage = SELFLOOPING, traits = list(BLOCK_TELEPORT)) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_Z, args) if(name in levels_by_name) throw EXCEPTION("Name already in use: [name]") world.maxz++ diff --git a/code/modules/spacepods/spacepod.dm b/code/modules/spacepods/spacepod.dm index de24c351c4a..2e3c89017ef 100644 --- a/code/modules/spacepods/spacepod.dm +++ b/code/modules/spacepods/spacepod.dm @@ -37,8 +37,6 @@ var/datum/gas_mixture/cabin_air var/obj/machinery/portable_atmospherics/canister/internal_tank var/use_internal_tank = 0 - var/datum/global_iterator/pr_int_temp_processor //normalizes internal air mixture temperature - var/datum/global_iterator/pr_give_air //moves air from tank to cabin var/datum/effect_system/trail_follow/ion/space_trail/ion_trail @@ -117,8 +115,6 @@ src.ion_trail.set_up(src) src.ion_trail.start() src.use_internal_tank = 1 - pr_int_temp_processor = new /datum/global_iterator/pod_preserve_temp(list(src)) - pr_give_air = new /datum/global_iterator/pod_tank_give_air(list(src)) equipment_system = new(src) equipment_system.installed_modules += battery GLOB.spacepods_list += src @@ -127,6 +123,7 @@ cargo_hold.storage_slots = 0 //You need to install cargo modules to use it. cargo_hold.max_w_class = 5 //fit almost anything cargo_hold.max_combined_w_class = 0 //you can optimize your stash with larger items + START_PROCESSING(SSobj, src) /obj/spacepod/Destroy() if(equipment_system.cargo_system) @@ -136,8 +133,6 @@ QDEL_NULL(battery) QDEL_NULL(cabin_air) QDEL_NULL(internal_tank) - QDEL_NULL(pr_int_temp_processor) - QDEL_NULL(pr_give_air) QDEL_NULL(ion_trail) occupant_sanity_check() if(pilot) @@ -148,13 +143,14 @@ M.forceMove(get_turf(src)) passengers -= M GLOB.spacepods_list -= src + STOP_PROCESSING(SSobj, src) return ..() /obj/spacepod/process() + give_air() + regulate_temp() if(src.empcounter > 0) src.empcounter-- - else - STOP_PROCESSING(SSobj, src) /obj/spacepod/proc/update_icons() if(!pod_overlays) @@ -288,7 +284,6 @@ deal_damage(80 / severity) if(empcounter < (40 / severity)) empcounter = 40 / severity - START_PROCESSING(SSobj, src) switch(severity) if(1) @@ -998,22 +993,17 @@ return 1 -/datum/global_iterator/pod_preserve_temp //normalizing cabin air temperature to 20 degrees celsium - delay = 20 - - process(var/obj/spacepod/spacepod) - if(spacepod.cabin_air && spacepod.cabin_air.return_volume() > 0) - var/delta = spacepod.cabin_air.temperature - T20C - spacepod.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1))) - -/datum/global_iterator/pod_tank_give_air - delay = 15 - -/datum/global_iterator/pod_tank_give_air/process(var/obj/spacepod/spacepod) - if(spacepod && spacepod.internal_tank) - var/datum/gas_mixture/tank_air = spacepod.internal_tank.return_air() - var/datum/gas_mixture/cabin_air = spacepod.cabin_air +// Fun fact, these procs are just copypastes from mech code +// And have been for the past 4 years +// Please send help +/obj/spacepod/proc/regulate_temp() + if(cabin_air && cabin_air.return_volume() > 0) + var/delta = cabin_air.temperature - T20C + cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1))) +/obj/spacepod/proc/give_air() + if(internal_tank) + var/datum/gas_mixture/tank_air = internal_tank.return_air() var/release_pressure = ONE_ATMOSPHERE var/cabin_pressure = cabin_air.return_pressure() var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2) @@ -1024,7 +1014,7 @@ var/datum/gas_mixture/removed = tank_air.remove(transfer_moles) cabin_air.merge(removed) else if(pressure_delta < 0) //cabin pressure higher than release pressure - var/datum/gas_mixture/t_air = spacepod.get_turf_air() + var/datum/gas_mixture/t_air = get_turf_air() pressure_delta = cabin_pressure - release_pressure if(t_air) pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta) @@ -1035,8 +1025,6 @@ t_air.merge(removed) else //just delete the cabin gas, we're in space or some shit qdel(removed) - else - return stop() /obj/spacepod/relaymove(mob/user, direction) if(user != src.pilot) diff --git a/code/modules/store/store.dm b/code/modules/store/store.dm index 2557008def0..d276edd547d 100644 --- a/code/modules/store/store.dm +++ b/code/modules/store/store.dm @@ -47,7 +47,7 @@ GLOBAL_DATUM_INIT(centcomm_store, /datum/store, new()) return 1 /datum/store/proc/reconnect_database() - for(var/obj/machinery/computer/account_database/DB in world) + for(var/obj/machinery/computer/account_database/DB in GLOB.machines) if(is_station_level(DB.z)) linked_db = DB break diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm index 510d3b32171..19ff7fa37d8 100644 --- a/code/modules/surgery/organs/augments_internal.dm +++ b/code/modules/surgery/organs/augments_internal.dm @@ -141,9 +141,11 @@ /obj/item/organ/internal/cyberimp/brain/anti_stun/emp_act(severity) if(crit_fail || emp_proof) return - crit_fail = 1 - spawn(90 / severity) - crit_fail = 0 + crit_fail = TRUE + addtimer(CALLBACK(src, .proc/reboot), 90 / severity) + +/obj/item/organ/internal/cyberimp/brain/anti_stun/proc/reboot() + crit_fail = FALSE /obj/item/organ/internal/cyberimp/brain/clown_voice name = "Comical implant" @@ -230,11 +232,13 @@ if(owner.stat == DEAD) return if(owner.nutrition <= hunger_threshold) - synthesizing = 1 + synthesizing = TRUE to_chat(owner, "You feel less hungry...") owner.adjust_nutrition(50) - spawn(50) - synthesizing = 0 + addtimer(CALLBACK(src, .proc/synth_cool), 50) + +/obj/item/organ/internal/cyberimp/chest/nutriment/proc/synth_cool() + synthesizing = FALSE /obj/item/organ/internal/cyberimp/chest/nutriment/emp_act(severity) if(!owner || emp_proof) @@ -309,10 +313,15 @@ var/mob/living/carbon/human/H = owner if(H.stat != DEAD && prob(50 / severity)) H.set_heartattack(TRUE) - spawn(600 / severity) - H.set_heartattack(FALSE) - if(H.stat == CONSCIOUS) - to_chat(H, "You feel your heart beating again!") + addtimer(CALLBACK(src, .proc/undo_heart_attack), 600 / severity) + +/obj/item/organ/internal/cyberimp/chest/reviver/proc/undo_heart_attack() + var/mob/living/carbon/human/H = owner + if(!istype(H)) + return + H.set_heartattack(FALSE) + if(H.stat == CONSCIOUS) + to_chat(H, "You feel your heart beating again!") //BOX O' IMPLANTS diff --git a/code/modules/surgery/organs/blood.dm b/code/modules/surgery/organs/blood.dm index 63a7f8a3590..e01c75dcbd0 100644 --- a/code/modules/surgery/organs/blood.dm +++ b/code/modules/surgery/organs/blood.dm @@ -72,7 +72,7 @@ bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects naturally decreases - var/additional_bleed = round(Clamp((reagents.get_reagent_amount("heparin") / 10), 0, 2), 1) //Heparin worsens existing bleeding + var/additional_bleed = round(clamp((reagents.get_reagent_amount("heparin") / 10), 0, 2), 1) //Heparin worsens existing bleeding if(internal_bleeding_rate && !(status_flags & FAKEDEATH)) bleed_internal(internal_bleeding_rate + additional_bleed) diff --git a/code/modules/surgery/organs/ears.dm b/code/modules/surgery/organs/ears.dm index 02b788eb7a5..bc57338dbbe 100644 --- a/code/modules/surgery/organs/ears.dm +++ b/code/modules/surgery/organs/ears.dm @@ -19,7 +19,7 @@ return var/mob/living/carbon/C = owner // genetic deafness prevents the body from using the ears, even if healthy - if(C.disabilities & DEAF) + if(DEAF in C.mutations) deaf = max(deaf, 1) else if(ishuman(C)) @@ -37,7 +37,7 @@ ear_damage = 0 var/mob/living/carbon/C = owner - if(istype(C) && C.disabilities & DEAF) + if(istype(C) && (DEAF in C.mutations)) deaf = 1 /obj/item/organ/internal/ears/proc/AdjustEarDamage(ddmg, ddeaf) diff --git a/code/modules/surgery/organs/eyes.dm b/code/modules/surgery/organs/eyes.dm index e2b70207532..1b205f957ce 100644 --- a/code/modules/surgery/organs/eyes.dm +++ b/code/modules/surgery/organs/eyes.dm @@ -9,7 +9,7 @@ var/list/colourmatrix = null var/list/colourblind_matrix = MATRIX_GREYSCALE //Special colourblindness parameters. By default, it's black-and-white. var/list/replace_colours = LIST_GREYSCALE_REPLACE - var/dependent_disabilities = null //Gets set by eye-dependent disabilities such as colourblindness so the eyes can transfer the disability during transplantation. + var/dependent_disabilities = list() //Gets set by eye-dependent disabilities such as colourblindness so the eyes can transfer the disability during transplantation. var/weld_proof = null //If set, the eyes will not take damage during welding. eg. IPC optical sensors do not take damage when they weld things while all other eyes will. var/vision_flags = 0 @@ -30,7 +30,7 @@ return eyes_icon /obj/item/organ/internal/eyes/proc/get_colourmatrix() //Returns a special colour matrix if the eyes are organic and the mob is colourblind, otherwise it uses the current one. - if(!is_robotic() && owner.disabilities & COLOURBLIND) + if(!is_robotic() && (COLOURBLIND in owner.mutations)) return colourblind_matrix else return colourmatrix @@ -44,16 +44,16 @@ if(istype(M) && eye_colour) M.update_body() //Apply our eye colour to the target. - if(!(M.disabilities & COLOURBLIND) && (dependent_disabilities & COLOURBLIND)) //If the eyes are colourblind and we're not, carry over the gene. - dependent_disabilities &= ~COLOURBLIND + if(!(COLOURBLIND in M.mutations) && (COLOURBLIND in dependent_disabilities)) //If the eyes are colourblind and we're not, carry over the gene. + dependent_disabilities -= COLOURBLIND M.dna.SetSEState(GLOB.colourblindblock,1) genemutcheck(M,GLOB.colourblindblock,null,MUTCHK_FORCED) else M.update_client_colour() //If we're here, that means the mob acquired the colourblindness gene while they didn't have eyes. Better handle it. /obj/item/organ/internal/eyes/remove(mob/living/carbon/human/M, special = 0) - if(!special && (M.disabilities & COLOURBLIND)) //If special is set, that means these eyes are getting deleted (i.e. during set_species()) - if(!(dependent_disabilities & COLOURBLIND)) //We only want to change COLOURBLINDBLOCK and such it the eyes are being surgically removed. + if(!special && (COLOURBLIND in M.mutations)) //If special is set, that means these eyes are getting deleted (i.e. during set_species()) + if(!(COLOURBLIND in dependent_disabilities)) //We only want to change COLOURBLINDBLOCK and such it the eyes are being surgically removed. dependent_disabilities |= COLOURBLIND M.dna.SetSEState(GLOB.colourblindblock,0) genemutcheck(M,GLOB.colourblindblock,null,MUTCHK_FORCED) diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm index 51175fd53be..8308a793ca9 100644 --- a/code/modules/surgery/organs/heart.dm +++ b/code/modules/surgery/organs/heart.dm @@ -23,9 +23,8 @@ Stop() return - spawn(120) - if(!owner) - Stop() + if(!special) + addtimer(CALLBACK(src, .proc/stop_if_unowned), 120) /obj/item/organ/internal/heart/emp_act(intensity) if(!is_robotic() || emp_proof) @@ -43,14 +42,16 @@ return if(!beating) Restart() - spawn(80) - if(!owner) - Stop() + addtimer(CALLBACK(src, .proc/stop_if_unowned), 80) /obj/item/organ/internal/heart/safe_replace(mob/living/carbon/human/target) Restart() ..() +/obj/item/organ/internal/heart/proc/stop_if_unowned() + if(!owner) + Stop() + /obj/item/organ/internal/heart/proc/Stop() beating = FALSE update_icon() diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index 782bcbe6ca6..34b83d9fe7f 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -110,6 +110,7 @@ var/N2_pp = breath.get_breath_partial_pressure(breath.nitrogen) var/Toxins_pp = breath.get_breath_partial_pressure(breath.toxins) var/CO2_pp = breath.get_breath_partial_pressure(breath.carbon_dioxide) + var/SA_pp = breath.get_breath_partial_pressure(breath.sleeping_agent) //-- OXY --// @@ -230,16 +231,14 @@ //-- TRACES --// - if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here. - for(var/datum/gas/sleeping_agent/SA in breath.trace_gases) - var/SA_pp = breath.get_breath_partial_pressure(SA.moles) - if(SA_pp > SA_para_min) - H.Paralyse(3) // 3 gives them one second to wake up and run away a bit! - if(SA_pp > SA_sleep_min) // Enough to make us sleep as well - H.AdjustSleeping(8, bound_lower = 0, bound_upper = 10) - else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning - if(prob(20)) - H.emote(pick("giggle", "laugh")) + if(breath.sleeping_agent) // If there's some other shit in the air lets deal with it here. + if(SA_pp > SA_para_min) + H.Paralyse(3) // 3 gives them one second to wake up and run away a bit! + if(SA_pp > SA_sleep_min) // Enough to make us sleep as well + H.AdjustSleeping(8, bound_lower = 0, bound_upper = 10) + else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning + if(prob(20)) + H.emote(pick("giggle", "laugh")) handle_breath_temperature(breath, H) diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm index a06cbf9456b..3dab4065f7d 100644 --- a/code/modules/surgery/organs/organ.dm +++ b/code/modules/surgery/organs/organ.dm @@ -116,18 +116,19 @@ necrotize() else if(owner.bodytemperature >= 170) //cryo stops germs from moving and doing their bad stuffs - //** Handle antibiotics and curing infections - handle_antibiotics() - handle_germ_effects() + // Handle antibiotics and curing infections + if(germ_level) + handle_germs() + return TRUE /obj/item/organ/proc/is_preserved() if(istype(loc,/obj/item/mmi)) germ_level = max(0, germ_level - 1) // So a brain can slowly recover from being left out of an MMI - return 1 + return TRUE if(is_found_within(/obj/structure/closet/crate/freezer)) - return 1 + return TRUE if(is_found_within(/obj/machinery/clonepod)) - return 1 + return TRUE if(isturf(loc)) if(world.time - last_freezer_update_time > freezer_update_period) // I don't want to loop through everything in the tile constantly, especially since it'll be a pile of organs @@ -142,7 +143,7 @@ return is_in_freezer // I'd like static varibles, please // You can do your cool location temperature organ preserving effects here! - return 0 + return FALSE /obj/item/organ/examine(mob/user) . = ..() @@ -152,33 +153,30 @@ else . += "It looks in need of repairs." -/obj/item/organ/proc/handle_germ_effects() - //** Handle the effects of infections - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") - - if(germ_level > 0 && germ_level < INFECTION_LEVEL_ONE/2 && prob(30)) +/obj/item/organ/proc/handle_germs() + if(germ_level > 0 && germ_level < INFECTION_LEVEL_ONE / 2 && prob(30)) germ_level-- - if(germ_level >= INFECTION_LEVEL_ONE/2) + if(germ_level >= INFECTION_LEVEL_ONE / 2) //aiming for germ level to go from ambient to INFECTION_LEVEL_TWO in an average of 15 minutes - if(antibiotics < 5 && prob(round(germ_level/6))) + if(prob(round(germ_level / 6))) germ_level++ if(germ_level >= INFECTION_LEVEL_ONE) - var/fever_temperature = (owner.dna.species.heat_level_1 - owner.dna.species.body_temperature - 5)* min(germ_level/INFECTION_LEVEL_TWO, 1) + owner.dna.species.body_temperature - owner.bodytemperature += between(0, (fever_temperature - T20C)/BODYTEMP_COLD_DIVISOR + 1, fever_temperature - owner.bodytemperature) + var/fever_temperature = (owner.dna.species.heat_level_1 - owner.dna.species.body_temperature - 5) * min(germ_level / INFECTION_LEVEL_TWO, 1) + owner.dna.species.body_temperature + owner.bodytemperature += between(0, (fever_temperature - T20C) / BODYTEMP_COLD_DIVISOR + 1, fever_temperature - owner.bodytemperature) if(germ_level >= INFECTION_LEVEL_TWO) var/obj/item/organ/external/parent = owner.get_organ(parent_organ) //spread germs - if(antibiotics < 5 && parent.germ_level < germ_level && ( parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30) )) + if(parent.germ_level < germ_level && ( parent.germ_level < INFECTION_LEVEL_ONE * 2 || prob(30))) parent.germ_level++ -/obj/item/organ/internal/handle_germ_effects() +/obj/item/organ/internal/handle_germs() ..() if(germ_level >= INFECTION_LEVEL_TWO) if(prob(3)) //about once every 30 seconds - receive_damage(1,silent=prob(30)) + receive_damage(1, silent = prob(30)) /obj/item/organ/proc/rejuvenate() damage = 0 @@ -200,21 +198,6 @@ /obj/item/organ/proc/is_broken() return (damage >= min_broken_damage || ((status & ORGAN_BROKEN) && !(status & ORGAN_SPLINTED))) -//Germs -/obj/item/organ/proc/handle_antibiotics() - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") - - if(!germ_level || antibiotics <= 0.4) - return - - if(germ_level < INFECTION_LEVEL_ONE) - germ_level = 0 //cure instantly - else if(germ_level < INFECTION_LEVEL_TWO) - germ_level -= 24 //at germ_level == 500, this should cure the infection in 15 seconds - else - germ_level -= 8 // at germ_level == 1000, this will cure the infection in 1 minute, 15 seconds - // Let's not drag this on, medbay has only so much antibiotics - //Adds autopsy data for used_weapon. /obj/item/organ/proc/add_autopsy_data(var/used_weapon = "Unknown", var/damage) var/datum/autopsy_data/W = autopsy_data[used_weapon] diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 1813a73cee1..143bf1d1ed6 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -68,7 +68,7 @@ icon_state = dead_icon if(owner) to_chat(owner, "You can't feel your [name] anymore...") - owner.update_body(update_sprite) + owner.update_body() if(vital) owner.death() @@ -305,10 +305,10 @@ This function completely restores a damaged organ to perfect condition. if(!(status & ORGAN_BROKEN)) perma_injury = 0 - //Infections - update_germs() - else - ..() + if(..()) + if(owner.germ_level > germ_level && infection_check()) + //Open wounds can become infected + germ_level++ //Updating germ levels. Handles organ germ levels and necrosis. /* @@ -325,40 +325,16 @@ the actual time is dependent on RNG. INFECTION_LEVEL_ONE below this germ level nothing happens, and the infection doesn't grow INFECTION_LEVEL_TWO above this germ level the infection will start to spread to internal and adjacent organs INFECTION_LEVEL_THREE above this germ level the player will take additional toxin damage per second, and will die in minutes without - antitox. also, above this germ level you will need to overdose on spaceacillin to reduce the germ_level. + antitox.. Note that amputating the affected organ does in fact remove the infection from the player's body. */ -/obj/item/organ/external/proc/update_germs() - if(is_robotic() || (NO_GERMS in owner.dna.species.species_traits)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs. - germ_level = 0 - return - - if(owner.bodytemperature >= 170) //cryo stops germs from moving and doing their bad stuffs - //** Syncing germ levels with external wounds - handle_germ_sync() - - //** Handle antibiotics and curing infections - handle_antibiotics() - - //** Handle the effects of infections - handle_germ_effects() - -/obj/item/organ/external/proc/handle_germ_sync() - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") - if(antibiotics < 5) - //Open wounds can become infected - if(owner.germ_level > germ_level && infection_check()) - germ_level++ - -/obj/item/organ/external/handle_germ_effects() +/obj/item/organ/external/handle_germs() if(germ_level < INFECTION_LEVEL_TWO) return ..() - var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") - if(germ_level >= INFECTION_LEVEL_TWO) //spread the infection to internal organs var/obj/item/organ/internal/target_organ = null //make internal organs become infected one at a time instead of all at once @@ -383,17 +359,16 @@ Note that amputating the affected organ does in fact remove the infection from t if(children) for(var/obj/item/organ/external/child in children) if(child.germ_level < germ_level && !child.is_robotic()) - if(child.germ_level < INFECTION_LEVEL_ONE*2 || prob(30)) + if(child.germ_level < INFECTION_LEVEL_ONE * 2 || prob(30)) child.germ_level++ if(parent) if(parent.germ_level < germ_level && !parent.is_robotic()) - if(parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30)) + if(parent.germ_level < INFECTION_LEVEL_ONE * 2 || prob(30)) parent.germ_level++ - if(germ_level >= INFECTION_LEVEL_THREE && antibiotics < 30) //overdosing is necessary to stop severe infections + if(germ_level >= INFECTION_LEVEL_THREE) necrotize() - germ_level++ owner.adjustToxLoss(1) @@ -672,12 +647,12 @@ Note that amputating the affected organ does in fact remove the infection from t /obj/item/organ/external/proc/mutate() src.status |= ORGAN_MUTATED if(owner) - owner.update_body(1, 1) //Forces all bodyparts to update in order to correctly render the deformed sprite. + owner.update_body(TRUE) //Forces all bodyparts to update in order to correctly render the deformed sprite. /obj/item/organ/external/proc/unmutate() src.status &= ~ORGAN_MUTATED if(owner) - owner.update_body(1, 1) //Forces all bodyparts to update in order to correctly return them to normal. + owner.update_body(TRUE) //Forces all bodyparts to update in order to correctly return them to normal. /obj/item/organ/external/proc/get_damage() //returns total damage return max(brute_dam + burn_dam - perma_injury, perma_injury) //could use health? diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index 5cab4dfafd8..53283ada95e 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -225,7 +225,6 @@ slot = "brain_tumor" var/organhonked = 0 var/suffering_delay = 900 - var/datum/component/waddle var/datum/component/squeak /obj/item/organ/internal/honktumor/insert(mob/living/carbon/M, special = 0) @@ -237,7 +236,7 @@ genemutcheck(M,GLOB.clumsyblock,null,MUTCHK_FORCED) genemutcheck(M,GLOB.comicblock,null,MUTCHK_FORCED) organhonked = world.time - waddle = M.AddComponent(/datum/component/waddling) + M.AddElement(/datum/element/waddling) squeak = M.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg' = 1), 50) /obj/item/organ/internal/honktumor/remove(mob/living/carbon/M, special = 0) @@ -249,7 +248,7 @@ M.dna.SetSEState(GLOB.comicblock,0) genemutcheck(M,GLOB.clumsyblock,null,MUTCHK_FORCED) genemutcheck(M,GLOB.comicblock,null,MUTCHK_FORCED) - QDEL_NULL(waddle) + M.RemoveElement(/datum/element/waddling) QDEL_NULL(squeak) qdel(src) diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm index b2bd8e6acd8..59274fb0c19 100644 --- a/code/modules/surgery/other.dm +++ b/code/modules/surgery/other.dm @@ -327,7 +327,7 @@ user.visible_message("[user] shines light onto the tumor in [target]'s [E]!", "You cleanse the contamination from [target]'s brain!") if(target.vision_type) //Turns off their darksight if it's still active. to_chat(target, "Your eyes are suddenly wrought with immense pain as your darksight is forcibly dismissed!") - target.vision_type = null + target.set_sight(null) SSticker.mode.remove_thrall(target.mind, 0) target.visible_message("A strange black mass falls from [target]'s [E]!") var/obj/item/organ/thing = new /obj/item/organ/internal/shadowtumor(get_turf(target)) diff --git a/code/modules/telesci/rcs.dm b/code/modules/telesci/rcs.dm new file mode 100644 index 00000000000..83dbe6cb8f0 --- /dev/null +++ b/code/modules/telesci/rcs.dm @@ -0,0 +1,121 @@ +#define RCS_MODE_CALIBRATED 0 +#define RCS_MODE_UNCALIBRATED 1 + +/obj/item/rcs + name = "rapid-crate-sender (RCS)" + desc = "A device used to teleport crates and closets to cargo telepads." + icon = 'icons/obj/telescience.dmi' + icon_state = "rcs" + item_state = "rcd" + flags = CONDUCT + force = 10.0 + throwforce = 10.0 + throw_speed = 2 + throw_range = 5 + toolspeed = 1 + usesound = 'sound/machines/click.ogg' + var/obj/item/stock_parts/cell/high/rcell = null + var/obj/machinery/pad = null + var/mode = RCS_MODE_CALIBRATED + var/rand_x = 0 + var/rand_y = 0 + var/emagged = FALSE + var/teleporting = FALSE + var/chargecost = 1000 + +/obj/item/rcs/get_cell() + return rcell + +/obj/item/rcs/New() + ..() + rcell = new(src) + +/obj/item/rcs/examine(mob/user) + . = ..() + . += "There are [round(rcell.charge/chargecost)] charge\s left." + +/obj/item/rcs/Destroy() + QDEL_NULL(rcell) + return ..() + +/obj/item/rcs/attack_self(mob/user) + if(!emagged) + return + if(mode == RCS_MODE_CALIBRATED) + mode = RCS_MODE_UNCALIBRATED + playsound(get_turf(src), 'sound/effects/pop.ogg', 50, 0) + to_chat(user, "The telepad locator has become uncalibrated.") + else + mode = RCS_MODE_CALIBRATED + playsound(get_turf(src), 'sound/effects/pop.ogg', 50, 0) + to_chat(user, "You calibrate the telepad locator.") + +/obj/item/rcs/emag_act(user as mob) + if(!emagged) + emagged = TRUE + do_sparks(5, 1, src) + to_chat(user, "You emag the RCS. Activate it to toggle between modes.") + return + +/obj/item/rcs/proc/try_send_container(mob/user, obj/structure/closet/C) + if(teleporting) + to_chat(user, "You're already using [src]!") + return + if(user in C.contents) //to prevent self-teleporting. + return + if(!rcell || (rcell.charge < chargecost)) + to_chat(user, "Out of charges.") + return + + if(!is_level_reachable(C.z)) + to_chat(user, "The rapid-crate-sender can't locate any telepads!") + return + + if(mode == RCS_MODE_CALIBRATED) + var/list/L = list() + var/list/areaindex = list() + for(var/obj/machinery/telepad_cargo/R in GLOB.machines) + if(R.stage) + continue + var/turf/T = get_turf(R) + var/tmpname = T.loc.name + if(areaindex[tmpname]) + tmpname = "[tmpname] ([++areaindex[tmpname]])" + else + areaindex[tmpname] = 1 + L[tmpname] = R + + var/desc = input("Please select a telepad.", "RCS") in L + pad = L[desc] + try_teleport(user, C, pad) + else + rand_x = rand(50,200) + rand_y = rand(50,200) + var/L = locate(rand_x, rand_y, 6) + try_teleport(user, C, L) + +/obj/item/rcs/proc/try_teleport(mob/user, obj/structure/closet/C, target) + if(!C.Adjacent(user)) + to_chat(user, "Unable to teleport, too far from [C].") + return + var/turf/ownTurf = get_turf(src) + playsound(ownTurf, usesound, 50, 1) + to_chat(user, "Teleporting [C]...") + teleporting = TRUE + if(!do_after(user, 50 * toolspeed, target = C)) + teleporting = FALSE + return + teleporting = FALSE + if(user in C.contents) + to_chat(user, "Error: User located in container--aborting for safety.") + playsound(ownTurf, 'sound/machines/buzz-sigh.ogg', 50, 1) + return + if(!(rcell && rcell.use(chargecost))) + to_chat(user, "Unable to teleport, insufficient charge.") + return + do_sparks(5, 1, C) + do_teleport(C, target) + to_chat(user, "Teleport successful. [round(rcell.charge/chargecost)] charge\s left.") + +#undef RCS_MODE_CALIBRATED +#undef RCS_MODE_UNCALIBRATED diff --git a/code/modules/telesci/telepad.dm b/code/modules/telesci/telepad.dm index 1ec94634b47..af73f65de87 100644 --- a/code/modules/telesci/telepad.dm +++ b/code/modules/telesci/telepad.dm @@ -88,7 +88,7 @@ /obj/machinery/telepad_cargo/wrench_act(mob/user, obj/item/I) . = TRUE default_unfasten_wrench(user, I) - + /obj/machinery/telepad_cargo/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) @@ -113,59 +113,3 @@ playsound(src, 'sound/effects/pop.ogg', 100, 1, 1) qdel(src) return - -///HANDHELD TELEPAD USER/// -/obj/item/rcs - name = "rapid-crate-sender (RCS)" - desc = "A device used to teleport crates and closets to cargo telepads." - icon = 'icons/obj/telescience.dmi' - icon_state = "rcs" - item_state = "rcd" - flags = CONDUCT - force = 10.0 - throwforce = 10.0 - throw_speed = 2 - throw_range = 5 - toolspeed = 1 - usesound = 'sound/machines/click.ogg' - var/obj/item/stock_parts/cell/high/rcell = null - var/obj/machinery/pad = null - var/mode = 0 - var/rand_x = 0 - var/rand_y = 0 - var/emagged = 0 - var/teleporting = 0 - var/chargecost = 1000 - -/obj/item/rcs/get_cell() - return rcell - -/obj/item/rcs/New() - ..() - rcell = new(src) - -/obj/item/rcs/examine(mob/user) - . = ..() - . += "There are [round(rcell.charge/chargecost)] charge\s left." - -/obj/item/rcs/Destroy() - QDEL_NULL(rcell) - return ..() - -/obj/item/rcs/attack_self(mob/user) - if(emagged) - if(mode == 0) - mode = 1 - playsound(src.loc, 'sound/effects/pop.ogg', 50, 0) - to_chat(user, " The telepad locator has become uncalibrated.") - else - mode = 0 - playsound(src.loc, 'sound/effects/pop.ogg', 50, 0) - to_chat(user, " You calibrate the telepad locator.") - -/obj/item/rcs/emag_act(user as mob) - if(!emagged) - emagged = 1 - do_sparks(5, 1, src) - to_chat(user, " You emag the RCS. Activate it to toggle between modes.") - return diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index 9d66758207f..d373e73f77b 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -169,15 +169,15 @@ if(telepad) - var/truePower = Clamp(power + power_off, 1, 1000) + var/truePower = clamp(power + power_off, 1, 1000) var/trueRotation = rotation + rotation_off - var/trueAngle = Clamp(angle, 1, 90) + var/trueAngle = clamp(angle, 1, 90) var/datum/projectile_data/proj_data = projectile_trajectory(telepad.x, telepad.y, trueRotation, trueAngle, truePower) last_tele_data = proj_data - var/trueX = Clamp(round(proj_data.dest_x, 1), 1, world.maxx) - var/trueY = Clamp(round(proj_data.dest_y, 1), 1, world.maxy) + var/trueX = clamp(round(proj_data.dest_x, 1), 1, world.maxx) + var/trueY = clamp(round(proj_data.dest_y, 1), 1, world.maxy) var/spawn_time = round(proj_data.time) * 10 var/turf/target = locate(trueX, trueY, z_co) @@ -291,12 +291,12 @@ return - var/truePower = Clamp(power + power_off, 1, 1000) + var/truePower = clamp(power + power_off, 1, 1000) var/trueRotation = rotation + rotation_off - var/trueAngle = Clamp(angle, 1, 90) + var/trueAngle = clamp(angle, 1, 90) var/datum/projectile_data/proj_data = projectile_trajectory(telepad.x, telepad.y, trueRotation, trueAngle, truePower) - var/turf/target = locate(Clamp(round(proj_data.dest_x, 1), 1, world.maxx), Clamp(round(proj_data.dest_y, 1), 1, world.maxy), z_co) + var/turf/target = locate(clamp(round(proj_data.dest_x, 1), 1, world.maxx), clamp(round(proj_data.dest_y, 1), 1, world.maxy), z_co) var/area/A = get_area(target) if(A.tele_proof == 1) @@ -336,14 +336,14 @@ var/new_rot = input("Please input desired bearing in degrees.", name, rotation) as num if(..()) // Check after we input a value, as they could've moved after they entered something return - rotation = Clamp(new_rot, -900, 900) + rotation = clamp(new_rot, -900, 900) rotation = round(rotation, 0.01) if(href_list["setangle"]) var/new_angle = input("Please input desired elevation in degrees.", name, angle) as num if(..()) return - angle = Clamp(round(new_angle, 0.1), 1, 9999) + angle = clamp(round(new_angle, 0.1), 1, 9999) if(href_list["setpower"]) var/index = href_list["setpower"] @@ -356,7 +356,7 @@ var/new_z = input("Please input desired sector.", name, z_co) as num if(..()) return - z_co = Clamp(round(new_z), 1, 10) + z_co = clamp(round(new_z), 1, 10) if(href_list["ejectGPS"]) if(inserted_gps) diff --git a/code/modules/tram/tram.dm b/code/modules/tram/tram.dm deleted file mode 100644 index ea43f3fd659..00000000000 --- a/code/modules/tram/tram.dm +++ /dev/null @@ -1,251 +0,0 @@ -/obj/tram/tram_controller - name = "" - desc = "tram controller" - anchored = 1 - - var/list/tram_floors = list() - var/list/tram_walls = list() - var/list/controllers = list() - - var/list/tram = list() - - var/list/collide_list = list() - - var/list/stored_anchor = list() - var/last_played_rail - - var/automode = 0 - var/fast_mode = 0 - - var/activated = 0 - var/looptick = 0 - - var/delay_timer = null - - var/list/blacklist = list(/obj/tram/rail) - var/list/ancwhitelist = list(/obj/tram, /obj/vehicle, /obj/structure/chair, /obj/structure/grille, /obj/structure/window) - -/obj/tram/tram_controller/New() - spawn(1) - init_floors() //Search and link floors - init_walls() //Search and link walls - spawn(1) - init_tram() //Combine walls and floors and anything inside the tram - init_controllers() //Find control pads - gen_collision() //Generate collision system - -/obj/tram/tram_controller/Destroy() - for(var/obj/tram/floor/F in tram_floors) - remove_floor(F) - for(var/obj/tram/wall/TW in tram_walls) - remove_wall(TW) - for(var/obj/tram/controlpad/CP in controllers) - remove_controller(CP) - killLoop() - return ..() - -/obj/tram/tram_controller/emp_act(severity) - if(automode) automode = 0 - ..() - -/obj/tram/tram_controller/proc/startLoop() - if(activated) return - activated = 1 - spawn(0) - while(activated) - process() - looptick++ - sleep(1) - -/obj/tram/tram_controller/proc/killLoop() - activated = 0 - looptick = 0 - -/obj/tram/tram_controller/process() - update_tram() //Update combine to account for new mobs and/or objects - if(automode) - tram_rail_follow() - if(fast_mode) - tram_rail_follow() - -/obj/tram/tram_controller/proc/update_tram() - tram.Cut() - init_tram() - -/obj/tram/tram_controller/proc/tram_rail_follow() - var/stored_rail = null - if(delay_timer >= world.time) return - for(var/obj/tram/rail/RT in get_turf(src)) - if(RT.stop_duration && !delay_timer) - delay_timer = world.time + RT.stop_duration - return - if(RT.godir) - handle_move(RT.godir) - last_played_rail = RT - return - stored_rail = RT - for(var/cdir in GLOB.cardinal) - for(var/obj/tram/rail/R in get_step(src,cdir)) - if(!istype(R)) continue - if(R != last_played_rail) - handle_move(get_dir(src,R)) - last_played_rail = stored_rail - return - -//INITIALIZATION PROCS - -/obj/tram/tram_controller/proc/init_floors() - var/turf/T = get_turf(src) - if(!T) return - var/obj/tram/floor/TTF = locate(/obj/tram/floor) in T - if(istype(TTF)) add_floor(TTF) //Find and link floor on controller turf - for(var/cdir in GLOB.cardinal) - var/turf/T2 = get_step(T,cdir) - var/obj/tram/floor/TF = locate(/obj/tram/floor) in T2 - if(istype(TF)) - if(TF in tram_floors) continue - add_floor(TF) //Find and link all cardinally surrounding floors - spawn(1) - TF.spread_floors() //Do the same thing over again from the floor itself - -/obj/tram/tram_controller/proc/init_walls() - var/turf/T = get_turf(src) - if(!T) return - if(!tram_floors.len) return - var/obj/tram/floor/TTW = locate(/obj/tram/wall) in T //Find and link wall on controller turf - if(istype(TTW)) add_wall(TTW) - for(var/obj/tram/floor/TF in tram_floors) - for(var/cdir in GLOB.cardinal) - var/obj/tram/wall/TW = locate(/obj/tram/wall) in get_step(TF,cdir) - if(istype(TW)) - if(TW in tram_walls) continue - add_wall(TW) //Find and link all cardinally surrounding walls - spawn(1) - TW.spread_walls() //Do the same thing over again from the wall itself - -/obj/tram/tram_controller/proc/init_tram() - tram = tram_floors + tram_walls //Tram is everything that makes up the tram - for(var/obj/tram/OT in tram) - var/turf/T = get_turf(OT) - for(var/atom/movable/AM in T) //Including anything inside of it - if(AM in tram) continue - if(!check_validity(AM)) continue - tram += AM - if(!(src in tram)) - tram += src - -/obj/tram/tram_controller/proc/check_validity(var/atom/movable/AM) - if(!AM) - return FALSE - - if(!AM.simulated) - return FALSE - - if(is_type_in_list(AM, blacklist)) - return FALSE - - if(AM.anchored) - if(is_type_in_list(AM, ancwhitelist)) - return TRUE - return FALSE - return TRUE - -/obj/tram/tram_controller/proc/init_controllers() - for(var/obj/tram/controlpad/CCP in tram) - add_controller(CCP) //Control pad not necessary until now, easiest to search through tram - -//SYNC PROCS -//These procs are used for un/linking floors, walls, and control pads to the central tram controller - -/obj/tram/tram_controller/proc/add_floor(var/obj/tram/floor/TF) - if(!istype(TF)) return - if(TF in tram_floors) return - tram_floors += TF - TF.controller = src - -/obj/tram/tram_controller/proc/remove_floor(var/obj/tram/floor/TF) - if(!istype(TF)) return - if(TF in tram_floors) - tram_floors -= TF - TF.controller = null - -/obj/tram/tram_controller/proc/add_wall(var/obj/tram/wall/TW) - if(!istype(TW)) return - if(TW in tram_walls) return - tram_walls += TW - TW.controller = src - -/obj/tram/tram_controller/proc/remove_wall(var/obj/tram/wall/TW) - if(!istype(TW)) return - if(TW in tram_walls) - tram_walls -= TW - TW.controller = null - -/obj/tram/tram_controller/proc/add_controller(var/obj/tram/controlpad/CCT) - if(!istype(CCT)) return - if(CCT in controllers) return - controllers += CCT - CCT.tram_linked = src - -/obj/tram/tram_controller/proc/remove_controller(var/obj/tram/controlpad/CCT) - if(!istype(CCT)) return - if(CCT in controllers) - controllers -= CCT - CCT.tram_linked = null - -//COLLISION & MOVEMENT -//Collision detection system to prevent going through walls -//Tram does not use built-in byond Move(), it uses it's own logic and then forceMove()s itself. - -/obj/tram/tram_controller/proc/gen_collision() - collide_list.Cut() - var/list/collisions = list() - for(var/obj/tram/wall/W in tram_walls) - for(var/cdir in GLOB.cardinal) - var/turf/T = get_step(W, cdir) - if(istype(T)) - if(T.density) - collisions += cdir - if(!T.density) - for(var/atom/movable/A in T) - if(A.density) - if(tram.Find(A)) continue - collisions += cdir - for(var/obj/tram/floor/F in tram_floors) - for(var/cdir in GLOB.cardinal) - var/turf/T = get_step(F, cdir) - if(istype(T)) - if(T.density) - collisions += cdir - if(!T.density) - for(var/atom/movable/A in T) - if(A.density) - if(tram.Find(A)) continue - collisions += cdir - collide_list = collisions - -/obj/tram/tram_controller/proc/handle_move(var/dir) - delay_timer = null //reset delay - gen_collision() //Look for collisions - if(dir in collide_list) //Prevent moving if there are collisions in that direction - return 0 - for(var/atom/movable/A in tram) - var/turf/T = get_step(A,dir) - A.forceMove(T) //Move everything inside the tram and the tram itself manually - if(A.light_range) - A.set_light() - gen_collision() //Generate collision again - return 1 - -/obj/tram/attack_animal(var/mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) return - if(prob(M.melee_damage_upper)) - qdel(src) - src.visible_message("[M] has [M.attacktext] [src]!") - M.create_attack_log("attacked [src.name]") - add_attack_logs(M, src, "attacked") - -/obj/tram/bullet_act(var/obj/item/projectile/proj) - if(prob(proj.damage)) - qdel(src) - ..() diff --git a/code/modules/tram/tram_control_pad.dm b/code/modules/tram/tram_control_pad.dm deleted file mode 100644 index 3bbb3811de2..00000000000 --- a/code/modules/tram/tram_control_pad.dm +++ /dev/null @@ -1,33 +0,0 @@ -/obj/tram/controlpad - name = "tram controller interface" - desc = "Controls a tram." - icon = 'icons/obj/airlock_machines.dmi' - icon_state = "airlock_control_standby" - anchored = 1 - var/obj/tram/tram_controller/tram_linked - -/obj/tram/controlpad/attack_hand(var/mob/user) - usr.set_machine(src) - if(!tram_linked) return - var/dat = "Tram Controller" - dat += "
Tram engine: [tram_linked.automode ? "On" : "Off"]" - dat += "
Close console" - user << browse(dat, "window=trampad") - onclose(user,"trampad") - -/obj/tram/controlpad/Topic(href, href_list) - if(..()) - usr << browse(null, "window=publiclibrary") - onclose(usr, "publiclibrary") - return - - if(href_list["engine_toggle"]) - tram_linked.automode = !tram_linked.automode - if(tram_linked.automode) tram_linked.startLoop() - else tram_linked.killLoop() - else if(href_list["close"]) - usr.unset_machine() - usr << browse(null, "window=trampad") - - src.add_fingerprint(usr) - src.updateUsrDialog() diff --git a/code/modules/tram/tram_floor.dm b/code/modules/tram/tram_floor.dm deleted file mode 100644 index ede3013567b..00000000000 --- a/code/modules/tram/tram_floor.dm +++ /dev/null @@ -1,20 +0,0 @@ -/obj/tram/floor - name = "tram platform" - desc = "A holding space for a tram system." - icon = 'icons/turf/floors.dmi' - icon_state = "floor" - var/obj/tram/tram_controller/controller - anchored = 1 - layer = TURF_LAYER + 0.2 - -/obj/tram/floor/proc/spread_floors() - var/turf/T = get_turf(src) - if(!T) return - if(!controller) return - for(var/cdir in GLOB.cardinal) - var/turf/T2 = get_step(T,cdir) - var/obj/tram/floor/TF = locate(/obj/tram/floor) in T2 - if(istype(TF)) - if(TF in controller.tram_floors) continue - controller.add_floor(TF) - TF.spread_floors() diff --git a/code/modules/tram/tram_rail.dm b/code/modules/tram/tram_rail.dm deleted file mode 100644 index 254f2e8636b..00000000000 --- a/code/modules/tram/tram_rail.dm +++ /dev/null @@ -1,8 +0,0 @@ -/obj/tram/rail - name = "tram rail" - desc = "A guiding rail for trams" - icon = 'icons/obj/tram/tram_rail.dmi' - icon_state = "rail" - var/godir = null - var/stop_duration = null - layer = TURF_LAYER + 0.1 diff --git a/code/modules/tram/tram_wall.dm b/code/modules/tram/tram_wall.dm deleted file mode 100644 index b39417f5f85..00000000000 --- a/code/modules/tram/tram_wall.dm +++ /dev/null @@ -1,21 +0,0 @@ -/obj/tram/wall - name = "reinforced tram wall" - desc = "A huge chunk of reinforced metal used to shield a tram system." - icon = 'icons/turf/walls.dmi' - icon_state = "r_wall" - var/obj/tram/tram_controller/controller - anchored = 1 - density = 1 - opacity = 1 - -/obj/tram/wall/proc/spread_walls() - var/turf/T = get_turf(src) - if(!T) return - if(!controller) return - for(var/cdir in GLOB.cardinal) - var/turf/T2 = get_step(T,cdir) - var/obj/tram/wall/TW = locate(/obj/tram/wall) in T2 - if(istype(TW)) - if(TW in controller.tram_walls) continue - controller.add_wall(TW) - TW.spread_walls() diff --git a/dreamchecker.exe b/dreamchecker.exe index 068a9f58a0c..abe378640c5 100644 Binary files a/dreamchecker.exe and b/dreamchecker.exe differ diff --git a/icons/mob/body_accessory_64.dmi b/icons/mob/body_accessory_64.dmi deleted file mode 100644 index 72d7f5e0d46..00000000000 Binary files a/icons/mob/body_accessory_64.dmi and /dev/null differ diff --git a/icons/mob/hud.dmi b/icons/mob/hud.dmi index bbe41ddbe22..df6b8f4de1f 100644 Binary files a/icons/mob/hud.dmi and b/icons/mob/hud.dmi differ diff --git a/icons/mob/screen_alien.dmi b/icons/mob/screen_alien.dmi index c254b276bc5..209ec839939 100644 Binary files a/icons/mob/screen_alien.dmi and b/icons/mob/screen_alien.dmi differ diff --git a/icons/obj/cloning.dmi b/icons/obj/cloning.dmi index 69abac9ee4f..83f5d6352d2 100644 Binary files a/icons/obj/cloning.dmi and b/icons/obj/cloning.dmi differ diff --git a/icons/obj/food/food.dmi b/icons/obj/food/food.dmi index 01295525b15..303ae139574 100644 Binary files a/icons/obj/food/food.dmi and b/icons/obj/food/food.dmi differ diff --git a/icons/obj/toy.dmi b/icons/obj/toy.dmi index 511b578ad4a..1ef7016307d 100644 Binary files a/icons/obj/toy.dmi and b/icons/obj/toy.dmi differ diff --git a/nano/assets/libraries.min.js b/nano/assets/libraries.min.js index d0c1ef9a46f..7dff02479a9 100644 --- a/nano/assets/libraries.min.js +++ b/nano/assets/libraries.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(d,e){function t(e,t){return t.toUpperCase()}var f=[],c=f.slice,g=f.concat,a=f.push,r=f.indexOf,n={},i=n.toString,m=n.hasOwnProperty,v={},o="1.11.3",C=function(e,t){return new C.fn.init(e,t)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,l=/^-ms-/,u=/-([\da-z])/gi;function p(e){var t="length"in e&&e.length,n=C.type(e);return"function"!==n&&!C.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&0>10|55296,1023&i|56320)}function i(){v()}var e,d,x,o,r,g,p,m,w,u,c,v,T,s,y,b,a,h,C,_="sizzle"+1*new Date,E=n.document,S=0,N=0,l=oe(),D=oe(),k=oe(),j=function(e,t){return e===t&&(c=!0),0},A={}.hasOwnProperty,t=[],P=t.pop,H=t.push,M=t.push,L=t.slice,O=function(e,t){for(var n=0,i=e.length;n+~]|"+F+")"+F+"*"),Y=new RegExp("="+F+"*([^\\]'\"]*?)"+F+"*\\]","g"),Q=new RegExp($),J=new RegExp("^"+q+"$"),V={ID:new RegExp("^#("+W+")"),CLASS:new RegExp("^\\.("+W+")"),TAG:new RegExp("^("+W.replace("w","w*")+")"),ATTR:new RegExp("^"+R),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+I+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,ee=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,te=/[+~]/,ne=/'|\\/g,ie=new RegExp("\\\\([\\da-f]{1,6}"+F+"?|("+F+")|.)","ig");try{M.apply(t=L.call(E.childNodes),E.childNodes),t[E.childNodes.length].nodeType}catch(e){M={apply:t.length?function(e,t){H.apply(e,L.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}function re(e,t,n,i){var r,o,s,a,l,u,c,f,p,h;if((t?t.ownerDocument||t:E)!==T&&v(t),n=n||[],a=(t=t||T).nodeType,"string"!=typeof e||!e||1!==a&&9!==a&&11!==a)return n;if(!i&&y){if(11!==a&&(r=ee.exec(e)))if(s=r[1]){if(9===a){if(!(o=t.getElementById(s))||!o.parentNode)return n;if(o.id===s)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&C(t,o)&&o.id===s)return n.push(o),n}else{if(r[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=r[3])&&d.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(d.qsa&&(!b||!b.test(e))){if(f=c=_,p=t,h=1!==a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(u=g(e),(c=t.getAttribute("id"))?f=c.replace(ne,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",l=u.length;l--;)u[l]=f+ge(u[l]);p=te.test(e)&&he(t.parentNode)||t,h=u.join(",")}if(h)try{return M.apply(n,p.querySelectorAll(h)),n}catch(e){}finally{c||t.removeAttribute("id")}}}return m(e.replace(z,"$1"),t,n,i)}function oe(){var i=[];return function e(t,n){return i.push(t+" ")>x.cacheLength&&delete e[i.shift()],e[t+" "]=n}}function se(e){return e[_]=!0,e}function ae(e){var t=T.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var n=e.split("|"),i=e.length;i--;)x.attrHandle[n[i]]=t}function ue(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||1<<31)-(~e.sourceIndex||1<<31);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ce(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function fe(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function pe(s){return se(function(o){return o=+o,se(function(e,t){for(var n,i=s([],e.length,o),r=i.length;r--;)e[n=i[r]]&&(e[n]=!(t[n]=e[n]))})})}function he(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in d=re.support={},r=re.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},v=re.setDocument=function(e){var t,n,l=e?e.ownerDocument||e:E;return l!==T&&9===l.nodeType&&l.documentElement?(s=(T=l).documentElement,(n=l.defaultView)&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",i,!1):n.attachEvent&&n.attachEvent("onunload",i)),y=!r(l),d.attributes=ae(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ae(function(e){return e.appendChild(l.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=Z.test(l.getElementsByClassName),d.getById=ae(function(e){return s.appendChild(e).id=_,!l.getElementsByName||!l.getElementsByName(_).length}),d.getById?(x.find.ID=function(e,t){if(void 0!==t.getElementById&&y){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},x.filter.ID=function(e){var t=e.replace(ie,f);return function(e){return e.getAttribute("id")===t}}):(delete x.find.ID,x.filter.ID=function(e){var n=e.replace(ie,f);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}}),x.find.TAG=d.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],r=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;n=o[r++];)1===n.nodeType&&i.push(n);return i},x.find.CLASS=d.getElementsByClassName&&function(e,t){if(y)return t.getElementsByClassName(e)},a=[],b=[],(d.qsa=Z.test(l.querySelectorAll))&&(ae(function(e){s.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&b.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||b.push("\\["+F+"*(?:value|"+I+")"),e.querySelectorAll("[id~="+_+"-]").length||b.push("~="),e.querySelectorAll(":checked").length||b.push(":checked"),e.querySelectorAll("a#"+_+"+*").length||b.push(".#.+[+~]")}),ae(function(e){var t=l.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&b.push("name"+F+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||b.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),b.push(",.*:")})),(d.matchesSelector=Z.test(h=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.oMatchesSelector||s.msMatchesSelector))&&ae(function(e){d.disconnectedMatch=h.call(e,"div"),h.call(e,"[s!='']:x"),a.push("!=",$)}),b=b.length&&new RegExp(b.join("|")),a=a.length&&new RegExp(a.join("|")),t=Z.test(s.compareDocumentPosition),C=t||Z.test(s.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return c=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===l||e.ownerDocument===E&&C(E,e)?-1:t===l||t.ownerDocument===E&&C(E,t)?1:u?O(u,e)-O(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,i=0,r=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!r||!o)return e===l?-1:t===l?1:r?-1:o?1:u?O(u,e)-O(u,t):0;if(r===o)return ue(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[i]===a[i];)i++;return i?ue(s[i],a[i]):s[i]===E?-1:a[i]===E?1:0},l):T},re.matches=function(e,t){return re(e,null,null,t)},re.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&v(e),t=t.replace(Y,"='$1']"),d.matchesSelector&&y&&(!a||!a.test(t))&&(!b||!b.test(t)))try{var n=h.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ie,f),e[3]=(e[3]||e[4]||e[5]||"").replace(ie,f),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||re.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&re.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Q.test(n)&&(t=g(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ie,f).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=l[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&l(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,i,r){return function(e){var t=re.attr(e,n);return null==t?"!="===i:!i||(t+="","="===i?t===r:"!="===i?t!==r:"^="===i?r&&0===t.indexOf(r):"*="===i?r&&-1(?:<\/\1>|)$/,x=/^.[^:#\[\.,]*$/;function w(e,n,i){if(C.isFunction(n))return C.grep(e,function(e,t){return!!n.call(e,t,e)!==i});if(n.nodeType)return C.grep(e,function(e){return e===n!==i});if("string"==typeof n){if(x.test(n))return C.filter(n,e,i);n=C.filter(n,e)}return C.grep(e,function(e){return 0<=C.inArray(e,n)!==i})}C.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?C.find.matchesSelector(i,e)?[i]:[]:C.find.matches(e,C.grep(t,function(e){return 1===e.nodeType}))},C.fn.extend({find:function(e){var t,n=[],i=this,r=i.length;if("string"!=typeof e)return this.pushStack(C(e).filter(function(){for(t=0;t)[^>]*|#([\w-]*))$/;(C.fn.init=function(e,t){var n,i;if(!e)return this;if("string"!=typeof e)return e.nodeType?(this.context=this[0]=e,this.length=1,this):C.isFunction(e)?void 0!==T.ready?T.ready(e):e(C):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),C.makeArray(e,this));if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&3<=e.length?[null,e,null]:E.exec(e))||!n[1]&&t)return!t||t.jquery?(t||T).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof C?t[0]:t,C.merge(this,C.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:_,!0)),b.test(n[1])&&C.isPlainObject(t))for(n in t)C.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((i=_.getElementById(n[2]))&&i.parentNode){if(i.id!==n[2])return T.find(e);this.length=1,this[0]=i}return this.context=_,this.selector=e,this}).prototype=C.fn,T=C(_);var S=/^(?:parents|prev(?:Until|All))/,N={children:!0,contents:!0,next:!0,prev:!0};function D(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.extend({dir:function(e,t,n){for(var i=[],r=e[t];r&&9!==r.nodeType&&(void 0===n||1!==r.nodeType||!C(r).is(n));)1===r.nodeType&&i.push(r),r=r[t];return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),C.fn.extend({has:function(e){var t,n=C(e,this),i=n.length;return this.filter(function(){for(t=0;t
KeyReal NameJobMins AFKSpecial RoleAreaPPNCryo
a",v.leadingWhitespace=3===t.firstChild.nodeType,v.tbody=!t.getElementsByTagName("tbody").length,v.htmlSerialize=!!t.getElementsByTagName("link").length,v.html5Clone="<:nav>"!==_.createElement("nav").cloneNode(!0).outerHTML,e.type="checkbox",e.checked=!0,n.appendChild(e),v.appendChecked=e.checked,t.innerHTML="",v.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,n.appendChild(t),t.innerHTML="",v.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,v.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){v.noCloneEvent=!1}),t.cloneNode(!0).click()),null==v.deleteExpando){v.deleteExpando=!0;try{delete t.test}catch(e){v.deleteExpando=!1}}}(),function(){var e,t,n=_.createElement("div");for(e in{submit:!0,change:!0,focusin:!0})t="on"+e,(v[e+"Bubbles"]=t in d)||(n.setAttribute(t,"t"),v[e+"Bubbles"]=!1===n.attributes[t].expando);n=null}();var Y=/^(?:input|select|textarea)$/i,Q=/^key/,J=/^(?:mouse|pointer|contextmenu)|click/,V=/^(?:focusinfocus|focusoutblur)$/,G=/^([^.]*)(?:\.(.+)|)$/;function K(){return!0}function Z(){return!1}function ee(){try{return _.activeElement}catch(e){}}function te(e){var t=ne.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}C.event={global:{},add:function(e,t,n,i,r){var o,s,a,l,u,c,f,p,h,d,g,m=C._data(e);if(m){for(n.handler&&(n=(l=n).handler,r=l.selector),n.guid||(n.guid=C.guid++),(s=m.events)||(s=m.events={}),(c=m.handle)||((c=m.handle=function(e){return typeof C===L||e&&C.event.triggered===e.type?void 0:C.event.dispatch.apply(c.elem,arguments)}).elem=e),a=(t=(t||"").match(j)||[""]).length;a--;)h=g=(o=G.exec(t[a])||[])[1],d=(o[2]||"").split(".").sort(),h&&(u=C.event.special[h]||{},h=(r?u.delegateType:u.bindType)||h,u=C.event.special[h]||{},f=C.extend({type:h,origType:g,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&C.expr.match.needsContext.test(r),namespace:d.join(".")},l),(p=s[h])||((p=s[h]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(e,i,d,c)||(e.addEventListener?e.addEventListener(h,c,!1):e.attachEvent&&e.attachEvent("on"+h,c))),u.add&&(u.add.call(e,f),f.handler.guid||(f.handler.guid=n.guid)),r?p.splice(p.delegateCount++,0,f):p.push(f),C.event.global[h]=!0);e=null}},remove:function(e,t,n,i,r){var o,s,a,l,u,c,f,p,h,d,g,m=C.hasData(e)&&C._data(e);if(m&&(c=m.events)){for(u=(t=(t||"").match(j)||[""]).length;u--;)if(h=g=(a=G.exec(t[u])||[])[1],d=(a[2]||"").split(".").sort(),h){for(f=C.event.special[h]||{},p=c[h=(i?f.delegateType:f.bindType)||h]||[],a=a[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=p.length;o--;)s=p[o],!r&&g!==s.origType||n&&n.guid!==s.guid||a&&!a.test(s.namespace)||i&&i!==s.selector&&("**"!==i||!s.selector)||(p.splice(o,1),s.selector&&p.delegateCount--,f.remove&&f.remove.call(e,s));l&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,d,m.handle)||C.removeEvent(e,h,m.handle),delete c[h])}else for(h in c)C.event.remove(e,h+t[u],n,i,!0);C.isEmptyObject(c)&&(delete m.handle,C._removeData(e,"events"))}},trigger:function(e,t,n,i){var r,o,s,a,l,u,c,f=[n||_],p=m.call(e,"type")?e.type:e,h=m.call(e,"namespace")?e.namespace.split("."):[];if(s=u=n=n||_,3!==n.nodeType&&8!==n.nodeType&&!V.test(p+C.event.triggered)&&(0<=p.indexOf(".")&&(p=(h=p.split(".")).shift(),h.sort()),o=p.indexOf(":")<0&&"on"+p,(e=e[C.expando]?e:new C.Event(p,"object"==typeof e&&e)).isTrigger=i?2:3,e.namespace=h.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:C.makeArray(t,[e]),l=C.event.special[p]||{},i||!l.trigger||!1!==l.trigger.apply(n,t))){if(!i&&!l.noBubble&&!C.isWindow(n)){for(a=l.delegateType||p,V.test(a+p)||(s=s.parentNode);s;s=s.parentNode)f.push(s),u=s;u===(n.ownerDocument||_)&&f.push(u.defaultView||u.parentWindow||d)}for(c=0;(s=f[c++])&&!e.isPropagationStopped();)e.type=1]","i"),oe=/^\s+/,se=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ae=/<([\w:]+)/,le=/\s*$/g,ge={option:[1,""],legend:[1,"

","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:v.htmlSerialize?[0,"",""]:[1,"X
","
"]},me=te(_).appendChild(_.createElement("div"));function ve(e,t){var n,i,r=0,o=typeof e.getElementsByTagName!==L?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==L?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(i=n[r]);r++)!t||C.nodeName(i,t)?o.push(i):C.merge(o,ve(i,t));return void 0===t||t&&C.nodeName(e,t)?C.merge([e],o):o}function ye(e){X.test(e.type)&&(e.defaultChecked=e.checked)}function be(e,t){return C.nodeName(e,"table")&&C.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function xe(e){return e.type=(null!==C.find.attr(e,"type"))+"/"+e.type,e}function we(e){var t=he.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Te(e,t){for(var n,i=0;null!=(n=e[i]);i++)C._data(n,"globalEval",!t||C._data(t[i],"globalEval"))}function Ce(e,t){if(1===t.nodeType&&C.hasData(e)){var n,i,r,o=C._data(e),s=C._data(t,o),a=o.events;if(a)for(n in delete s.handle,s.events={},a)for(i=0,r=a[n].length;i")?o=e.cloneNode(!0):(me.innerHTML=e.outerHTML,me.removeChild(o=me.firstChild)),!(v.noCloneEvent&&v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||C.isXMLDoc(e)))for(i=ve(o),a=ve(e),s=0;null!=(r=a[s]);++s)i[s]&&_e(r,i[s]);if(t)if(n)for(a=a||ve(e),i=i||ve(o),s=0;null!=(r=a[s]);s++)Ce(r,i[s]);else Ce(e,o);return 0<(i=ve(o,"script")).length&&Te(i,!l&&ve(e,"script")),i=a=r=null,o},buildFragment:function(e,t,n,i){for(var r,o,s,a,l,u,c,f=e.length,p=te(t),h=[],d=0;d")+c[2],r=c[0];r--;)a=a.lastChild;if(!v.leadingWhitespace&&oe.test(o)&&h.push(t.createTextNode(oe.exec(o)[0])),!v.tbody)for(r=(o="table"!==l||le.test(o)?""!==c[1]||le.test(o)?0:a:a.firstChild)&&o.childNodes.length;r--;)C.nodeName(u=o.childNodes[r],"tbody")&&!u.childNodes.length&&o.removeChild(u);for(C.merge(h,a.childNodes),a.textContent="";a.firstChild;)a.removeChild(a.firstChild);a=p.lastChild}else h.push(t.createTextNode(o));for(a&&p.removeChild(a),v.appendChecked||C.grep(ve(h,"input"),ye),d=0;o=h[d++];)if((!i||-1===C.inArray(o,i))&&(s=C.contains(o.ownerDocument,o),a=ve(p.appendChild(o),"script"),s&&Te(a),n))for(r=0;o=a[r++];)pe.test(o.type||"")&&n.push(o);return a=null,p},cleanData:function(e,t){for(var n,i,r,o,s=0,a=C.expando,l=C.cache,u=v.deleteExpando,c=C.event.special;null!=(n=e[s]);s++)if((t||C.acceptData(n))&&(o=(r=n[a])&&l[r])){if(o.events)for(i in o.events)c[i]?C.event.remove(n,i):C.removeEvent(n,i,o.handle);l[r]&&(delete l[r],u?delete n[a]:typeof n.removeAttribute!==L?n.removeAttribute(a):n[a]=null,f.push(r))}}}),C.fn.extend({text:function(e){return U(this,function(e){return void 0===e?C.text(this):this.empty().append((this[0]&&this[0].ownerDocument||_).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||be(this,e).appendChild(e)})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=be(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,i=e?C.filter(e,this):this,r=0;null!=(n=i[r]);r++)t||1!==n.nodeType||C.cleanData(ve(n)),n.parentNode&&(t&&C.contains(n.ownerDocument,n)&&Te(ve(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&C.cleanData(ve(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&C.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return C.clone(this,e,t)})},html:function(e){return U(this,function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(ie,""):void 0;if("string"==typeof e&&!ce.test(e)&&(v.htmlSerialize||!re.test(e))&&(v.leadingWhitespace||!oe.test(e))&&!ge[(ae.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(se,"<$1>");try{for(;n")).appendTo(t.documentElement))[0].contentWindow||Ee[0].contentDocument).document).write(),t.close(),n=De(e,t),Ee.detach()),Ne[e]=n),n}v.shrinkWrapBlocks=function(){return null!=Se?Se:(Se=!1,(t=_.getElementsByTagName("body")[0])&&t.style?(e=_.createElement("div"),(n=_.createElement("div")).style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",t.appendChild(n).appendChild(e),typeof e.style.zoom!==L&&(e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",e.appendChild(_.createElement("div")).style.width="5px",Se=3!==e.offsetWidth),t.removeChild(n),Se):void 0);var e,t,n};var je,Ae,Pe,He,Me,Le,Oe,Ie,Fe,We=/^margin/,qe=new RegExp("^("+B+")(?!px)[a-z%]+$","i"),Re=/^(top|right|bottom|left)$/;function $e(t,n){return{get:function(){var e=t();if(null!=e){if(!e)return(this.get=n).apply(this,arguments);delete this.get}}}}function Be(){var e,t,n,i;(t=_.getElementsByTagName("body")[0])&&t.style&&(e=_.createElement("div"),(n=_.createElement("div")).style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",t.appendChild(n).appendChild(e),e.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",Le=Oe=!1,Fe=!0,d.getComputedStyle&&(Le="1%"!==(d.getComputedStyle(e,null)||{}).top,Oe="4px"===(d.getComputedStyle(e,null)||{width:"4px"}).width,(i=e.appendChild(_.createElement("div"))).style.cssText=e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",e.style.width="1px",Fe=!parseFloat((d.getComputedStyle(i,null)||{}).marginRight),e.removeChild(i)),e.innerHTML="
t
",(i=e.getElementsByTagName("td"))[0].style.cssText="margin:0;border:0;padding:0;display:none",(Ie=0===i[0].offsetHeight)&&(i[0].style.display="",i[1].style.display="none",Ie=0===i[0].offsetHeight),t.removeChild(n))}d.getComputedStyle?(je=function(e){return e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):d.getComputedStyle(e,null)},Ae=function(e,t,n){var i,r,o,s,a=e.style;return s=(n=n||je(e))?n.getPropertyValue(t)||n[t]:void 0,n&&(""!==s||C.contains(e.ownerDocument,e)||(s=C.style(e,t)),qe.test(s)&&We.test(t)&&(i=a.width,r=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=i,a.minWidth=r,a.maxWidth=o)),void 0===s?s:s+""}):_.documentElement.currentStyle&&(je=function(e){return e.currentStyle},Ae=function(e,t,n){var i,r,o,s,a=e.style;return null==(s=(n=n||je(e))?n[t]:void 0)&&a&&a[t]&&(s=a[t]),qe.test(s)&&!Re.test(t)&&(i=a.left,(o=(r=e.runtimeStyle)&&r.left)&&(r.left=e.currentStyle.left),a.left="fontSize"===t?"1em":s,s=a.pixelLeft+"px",a.left=i,o&&(r.left=o)),void 0===s?s:s+""||"auto"}),(Pe=_.createElement("div")).innerHTML="
a",(He=(Me=Pe.getElementsByTagName("a")[0])&&Me.style)&&(He.cssText="float:left;opacity:.5",v.opacity="0.5"===He.opacity,v.cssFloat=!!He.cssFloat,Pe.style.backgroundClip="content-box",Pe.cloneNode(!0).style.backgroundClip="",v.clearCloneStyle="content-box"===Pe.style.backgroundClip,v.boxSizing=""===He.boxSizing||""===He.MozBoxSizing||""===He.WebkitBoxSizing,C.extend(v,{reliableHiddenOffsets:function(){return null==Ie&&Be(),Ie},boxSizingReliable:function(){return null==Oe&&Be(),Oe},pixelPosition:function(){return null==Le&&Be(),Le},reliableMarginRight:function(){return null==Fe&&Be(),Fe}})),C.swap=function(e,t,n,i){var r,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in r=n.apply(e,i||[]),t)e.style[o]=s[o];return r};var ze=/alpha\([^)]*\)/i,Ue=/opacity\s*=\s*([^)]*)/,Xe=/^(none|table(?!-c[ea]).+)/,Ye=new RegExp("^("+B+")(.*)$","i"),Qe=new RegExp("^([+-])=("+B+")","i"),Je={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","O","Moz","ms"];function Ke(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),i=t,r=Ge.length;r--;)if((t=Ge[r]+n)in e)return t;return i}function Ze(e,t){for(var n,i,r,o=[],s=0,a=e.length;s
a",ut=at.getElementsByTagName("a")[0],ct=(lt=_.createElement("select")).appendChild(_.createElement("option")),st=at.getElementsByTagName("input")[0],ut.style.cssText="top:1px",v.getSetAttribute="t"!==at.className,v.style=/top/.test(ut.getAttribute("style")),v.hrefNormalized="/a"===ut.getAttribute("href"),v.checkOn=!!st.value,v.optSelected=ct.selected,v.enctype=!!_.createElement("form").enctype,lt.disabled=!0,v.optDisabled=!ct.disabled,(st=_.createElement("input")).setAttribute("value",""),v.input=""===st.getAttribute("value"),st.value="t",st.setAttribute("type","radio"),v.radioValue="t"===st.value;var xt=/\r/g;C.fn.extend({val:function(n){var i,e,r,t=this[0];return arguments.length?(r=C.isFunction(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=r?n.call(this,e,C(this).val()):n)?t="":"number"==typeof t?t+="":C.isArray(t)&&(t=C.map(t,function(e){return null==e?"":e+""})),(i=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in i&&void 0!==i.set(this,t,"value")||(this.value=t))})):t?(i=C.valHooks[t.type]||C.valHooks[t.nodeName.toLowerCase()])&&"get"in i&&void 0!==(e=i.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),C.extend({valHooks:{option:{get:function(e){var t=C.find.attr(e,"value");return null!=t?t:C.trim(C.text(e))}},select:{get:function(e){for(var t,n,i=e.options,r=e.selectedIndex,o="select-one"===e.type||r<0,s=o?null:[],a=o?r+1:i.length,l=r<0?a:o?r:0;l").append(C.parseHTML(e)).find(i):e)}).complete(n&&function(e,t){s.each(n,r||[e.responseText,t,e])}),this},C.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){C.fn[t]=function(e){return this.on(t,e)}}),C.expr.filters.animated=function(t){return C.grep(C.timers,function(e){return t===e.elem}).length};var cn=d.document.documentElement;function fn(e){return C.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}C.offset={setOffset:function(e,t,n){var i,r,o,s,a,l,u=C.css(e,"position"),c=C(e),f={};"static"===u&&(e.style.position="relative"),a=c.offset(),o=C.css(e,"top"),l=C.css(e,"left"),r=("absolute"===u||"fixed"===u)&&-1").outerWidth(1).jquery||D.each(["Width","Height"],function(e,n){var r="Width"===n?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),o={innerWidth:D.fn.innerWidth,innerHeight:D.fn.innerHeight,outerWidth:D.fn.outerWidth,outerHeight:D.fn.outerHeight};function s(e,t,n,i){return D.each(r,function(){t-=parseFloat(D.css(e,"padding"+this))||0,n&&(t-=parseFloat(D.css(e,"border"+this+"Width"))||0),i&&(t-=parseFloat(D.css(e,"margin"+this))||0)}),t}D.fn["inner"+n]=function(e){return void 0===e?o["inner"+n].call(this):this.each(function(){D(this).css(i,s(this,e)+"px")})},D.fn["outer"+n]=function(e,t){return"number"!=typeof e?o["outer"+n].call(this,e):this.each(function(){D(this).css(i,s(this,e,!0,t)+"px")})}}),D.fn.addBack||(D.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),D("").data("a-b","a").removeData("a-b").data("a-b")&&(D.fn.removeData=(t=D.fn.removeData,function(e){return arguments.length?t.call(this,D.camelCase(e)):t.call(this)})),D.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),D.fn.extend({focus:(i=D.fn.focus,function(t,n){return"number"==typeof t?this.each(function(){var e=this;setTimeout(function(){D(e).focus(),n&&n.call(e)},t)}):i.apply(this,arguments)}),disableSelection:(n="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.bind(n+".ui-disableSelection",function(e){e.preventDefault()})}),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var t,n,i=D(this[0]);i.length&&i[0]!==document;){if(("absolute"===(t=i.css("position"))||"relative"===t||"fixed"===t)&&(n=parseInt(i.css("zIndex"),10),!isNaN(n)&&0!==n))return n;i=i.parent()}return 0}}),D.ui.plugin={add:function(e,t,n){var i,r=D.ui[e].prototype;for(i in n)r.plugins[i]=r.plugins[i]||[],r.plugins[i].push([t,n[i]])},call:function(e,t,n,i){var r,o=e.plugins[t];if(o&&(i||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(r=0;r",options:{disabled:!1,create:null},_createWidget:function(e,t){t=D(t||this.defaultElement||this)[0],this.element=D(t),this.uuid=a++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=D(),this.hoverable=D(),this.focusable=D(),t!==this&&(D.data(t,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===t&&this.destroy()}}),this.document=D(t.style?t.ownerDocument:t.document||t),this.window=D(this.document[0].defaultView||this.document[0].parentWindow)),this.options=D.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:D.noop,_getCreateEventData:D.noop,_create:D.noop,_init:D.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(D.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:D.noop,widget:function(){return this.element},option:function(e,t){var n,i,r,o=e;if(0===arguments.length)return D.widget.extend({},this.options);if("string"==typeof e)if(o={},e=(n=e.split(".")).shift(),n.length){for(i=o[e]=D.widget.extend({},this.options[e]),r=0;r=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}});!function(){D.ui=D.ui||{};var r,T,C=Math.max,_=Math.abs,E=Math.round,i=/left|center|right/,o=/top|center|bottom/,s=/[\+\-]\d+(\.[\d]+)?%?/,a=/^\w+/,l=/%$/,t=D.fn.position;function S(e,t,n){return[parseFloat(e[0])*(l.test(e[0])?t/100:1),parseFloat(e[1])*(l.test(e[1])?n/100:1)]}function N(e,t){return parseInt(D.css(e,t),10)||0}D.position={scrollbarWidth:function(){if(void 0!==r)return r;var e,t,n=D("
"),i=n.children()[0];return D("body").append(n),e=i.offsetWidth,n.css("overflow","scroll"),e===(t=i.offsetWidth)&&(t=n[0].clientWidth),n.remove(),r=e-t},getScrollInfo:function(e){var t=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),n=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),i="scroll"===t||"auto"===t&&e.widthC(_(i),_(r))?o.important="horizontal":o.important="vertical",f.using.call(this,e,o)}),s.offset(D.extend(u,{using:e}))})},D.ui.position={fit:{left:function(e,t){var n,i=t.within,r=i.isWindow?i.scrollLeft:i.offset.left,o=i.width,s=e.left-t.collisionPosition.marginLeft,a=r-s,l=s+t.collisionWidth-o-r;t.collisionWidth>o?0o?0").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var t=this.document[0];if(this.handleElement.is(e.target))try{t.activeElement&&"body"!==t.activeElement.nodeName.toLowerCase()&&D(t.activeElement).blur()}catch(e){}},_mouseStart:function(e){var t=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),D.ui.ddmanager&&(D.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0n[2]&&(l=n[2]+this.offset.click.left),e.pageY-this.offset.click.top>n[3]&&(u=n[3]+this.offset.click.top)),s.grid&&(r=s.grid[1]?this.originalPageY+Math.round((u-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,u=n?r-this.offset.click.top>=n[1]||r-this.offset.click.top>n[3]?r:r-this.offset.click.top>=n[1]?r-s.grid[1]:r+s.grid[1]:r,o=s.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,l=n?o-this.offset.click.left>=n[0]||o-this.offset.click.left>n[2]?o:o-this.offset.click.left>=n[0]?o-s.grid[0]:o+s.grid[0]:o),"y"===s.axis&&(l=this.originalPageX),"x"===s.axis&&(u=this.originalPageY)),{top:u-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:a?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:a?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(e,t,n){return n=n||this._uiHash(),D.ui.plugin.call(this,e,[t,n,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),n.offset=this.positionAbs),D.Widget.prototype._trigger.call(this,e,t,n)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),D.ui.plugin.add("draggable","connectToSortable",{start:function(t,e,n){var i=D.extend({},e,{item:n.element});n.sortables=[],D(n.options.connectToSortable).each(function(){var e=D(this).sortable("instance");e&&!e.options.disabled&&(n.sortables.push(e),e.refreshPositions(),e._trigger("activate",t,i))})},stop:function(t,e,n){var i=D.extend({},e,{item:n.element});n.cancelHelperRemoval=!1,D.each(n.sortables,function(){var e=this;e.isOver?(e.isOver=0,n.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,i))})},drag:function(n,i,r){D.each(r.sortables,function(){var e=!1,t=this;t.positionAbs=r.positionAbs,t.helperProportions=r.helperProportions,t.offset.click=r.offset.click,t._intersectsWith(t.containerCache)&&(e=!0,D.each(r.sortables,function(){return this.positionAbs=r.positionAbs,this.helperProportions=r.helperProportions,this.offset.click=r.offset.click,this!==t&&this._intersectsWith(this.containerCache)&&D.contains(t.element[0],this.element[0])&&(e=!1),e})),e?(t.isOver||(t.isOver=1,r._parent=i.helper.parent(),t.currentItem=i.helper.appendTo(t.element).data("ui-sortable-item",!0),t.options._helper=t.options.helper,t.options.helper=function(){return i.helper[0]},n.target=t.currentItem[0],t._mouseCapture(n,!0),t._mouseStart(n,!0,!0),t.offset.click.top=r.offset.click.top,t.offset.click.left=r.offset.click.left,t.offset.parent.left-=r.offset.parent.left-t.offset.parent.left,t.offset.parent.top-=r.offset.parent.top-t.offset.parent.top,r._trigger("toSortable",n),r.dropped=t.element,D.each(r.sortables,function(){this.refreshPositions()}),r.currentItem=r.element,t.fromOutside=r),t.currentItem&&(t._mouseDrag(n),i.position=t.position)):t.isOver&&(t.isOver=0,t.cancelHelperRemoval=!0,t.options._revert=t.options.revert,t.options.revert=!1,t._trigger("out",n,t._uiHash(t)),t._mouseStop(n,!0),t.options.revert=t.options._revert,t.options.helper=t.options._helper,t.placeholder&&t.placeholder.remove(),i.helper.appendTo(r._parent),r._refreshOffsets(n),i.position=r._generatePosition(n,!0),r._trigger("fromSortable",n),r.dropped=!1,D.each(r.sortables,function(){this.refreshPositions()}))})}}),D.ui.plugin.add("draggable","cursor",{start:function(e,t,n){var i=D("body"),r=n.options;i.css("cursor")&&(r._cursor=i.css("cursor")),i.css("cursor",r.cursor)},stop:function(e,t,n){var i=n.options;i._cursor&&D("body").css("cursor",i._cursor)}}),D.ui.plugin.add("draggable","opacity",{start:function(e,t,n){var i=D(t.helper),r=n.options;i.css("opacity")&&(r._opacity=i.css("opacity")),i.css("opacity",r.opacity)},stop:function(e,t,n){var i=n.options;i._opacity&&D(t.helper).css("opacity",i._opacity)}}),D.ui.plugin.add("draggable","scroll",{start:function(e,t,n){n.scrollParentNotHidden||(n.scrollParentNotHidden=n.helper.scrollParent(!1)),n.scrollParentNotHidden[0]!==n.document[0]&&"HTML"!==n.scrollParentNotHidden[0].tagName&&(n.overflowOffset=n.scrollParentNotHidden.offset())},drag:function(e,t,n){var i=n.options,r=!1,o=n.scrollParentNotHidden[0],s=n.document[0];o!==s&&"HTML"!==o.tagName?(i.axis&&"x"===i.axis||(n.overflowOffset.top+o.offsetHeight-e.pageY")[0],x=c.each,b.style.cssText="background-color:rgba(1,1,1,.5)",y.rgba=-1o.mod/2?i+=o.mod:i-r>o.mod/2&&(i-=o.mod)),u[n]=H((r-i)*s+i,t)))}),this[t](u)},blend:function(e){if(1===this._rgba[3])return this;var t=this._rgba.slice(),n=t.pop(),i=g(e)._rgba;return g(c.map(t,function(e,t){return(1-n)*i[t]+n*e}))},toRgbaString:function(){var e="rgba(",t=c.map(this._rgba,function(e,t){return null==e?2").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),t={width:n.width(),height:n.height()},r=document.activeElement;try{r.id}catch(e){r=document.body}return n.wrap(e),n[0]!==r&&!D.contains(n[0],r)||D(r).focus(),e=n.parent(),"static"===n.css("position")?(e.css({position:"relative"}),n.css({position:"relative"})):(D.extend(i,{position:n.css("position"),zIndex:n.css("z-index")}),D.each(["top","left","bottom","right"],function(e,t){i[t]=n.css(t),isNaN(parseInt(i[t],10))&&(i[t]="auto")}),n.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),n.css(t),e.css(i).show()},removeWrapper:function(e){var t=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),e[0]!==t&&!D.contains(e[0],t)||D(t).focus()),e},setTransition:function(i,e,r,o){return o=o||{},D.each(e,function(e,t){var n=i.cssUnit(t);0r&&0!==r||!1===i.call(e,o))&&jQuery.timer.remove(e,n,i)}a.timerID=i.timerID,s[n][i.timerID]||(s[n][i.timerID]=window.setInterval(a,t)),this.global.push(e)}},remove:function(e,t,n){var i,r=jQuery.data(e,this.dataKey);if(r){if(t){if(r[t]){if(n)n.timerID&&(window.clearInterval(r[t][n.timerID]),delete r[t][n.timerID]);else for(var n in r[t])window.clearInterval(r[t][n]),delete r[t][n];for(i in r[t])break;i||(i=null,delete r[t])}}else for(t in r)this.remove(e,t,n);for(i in r)break;i||jQuery.removeData(e,this.dataKey)}}}}),jQuery(window).bind("unload",function(){jQuery.each(jQuery.timer.global,function(e,t){jQuery.timer.remove(t)})}),function(){"use strict";var a={version:"1.0.1-nanoui",templateSettings:{evaluate:/\{\{([\s\S]+?)\}\}/g,interpolate:/\{\{:([\s\S]+?)\}\}/g,encode:/\{\{>([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,conditional:/\{\{\/?if\s*([\s\S]*?)\s*\}\}/g,conditionalElse:/\{\{else\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{\/?for\s*(?:\}\}|([\s\S]+?)\s*(?:\:\s*([\w$]+))?\s*(?:\:\s*([\w$]+))?\s*\}\})/g,props:/\{\{\/?props\s*(?:\}\}|([\s\S]+?)\s*(?:\:\s*([\w$]+))?\s*(?:\:\s*([\w$]+))?\s*\}\})/g,empty:/\{\{empty\}\}/g,varname:"data, config, helper",strip:!0,append:!0,selfcontained:!1},template:void 0,compile:void 0};function l(){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},e=/&(?!#?\w+;)|<|>|"|'|\//g;return function(){return this?this.replace(e,function(e){return t[e]||e}):this}}"undefined"!=typeof module&&module.exports?module.exports=a:"function"==typeof define&&define.amd?define(function(){return a}):function(){return this||(0,eval)("this")}().doT=a,String.prototype.encodeHTML=l();var u={append:{start:"'+(",end:")+'",endencode:"||'').toString().encodeHTML()+'"},split:{start:"';out+=(",end:");out+='",endencode:"||'').toString().encodeHTML();out+='"}},c=/$^/;function f(e){return e.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}a.template=function(e,t,n){var i,r=(t=t||a.templateSettings).append?u.append:u.split,o=0,s=t.use||t.define?function i(r,e,o){return("string"==typeof e?e:e.toString()).replace(r.define||c,function(e,i,t,n){return 0===i.indexOf("def.")&&(i=i.substring(4)),i in o||(":"===t?(r.defineParams&&n.replace(r.defineParams,function(e,t,n){o[i]={arg:t,text:n}}),i in o||(o[i]=n)):new Function("def","def['"+i+"']="+n)(o)),""}).replace(r.use||c,function(e,t){r.useParams&&(t=t.replace(r.useParams,function(e,t,n,i){if(o[n]&&o[n].arg&&i){var r=(n+":"+i).replace(/'|\\/g,"_");return o.__exp=o.__exp||{},o.__exp[r]=o[n].text.replace(new RegExp("(^|[^\\w$])"+o[n].arg+"([^\\w$])","g"),"$1"+i+"$2"),t+"def.__exp['"+r+"']"}}));var n=new Function("def","return "+t)(o);return n?i(r,n,o):n})}(t,e,n||{}):e;s=("var out='"+(t.strip?s.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):s).replace(/'|\\/g,"\\$&").replace(t.interpolate||c,function(e,t){return r.start+f(t)+r.end}).replace(t.encode||c,function(e,t){return i=!0,r.start+f(t)+r.endencode}).replace(t.conditional||c,function(e,t){return t?"';if("+f(t)+"){out+='":"';}out+='"}).replace(t.conditionalElse||c,function(e,t){return t?"';}else if("+f(t)+"){out+='":"';}else{out+='"}).replace(t.iterate||c,function(e,t,n,i){if(!t)return"';} } out+='";o+=1,n=n||"value",i=i||"index",t=f(t);var r="arr"+o;return"';var "+r+"="+t+";if("+r+" && "+r+".length > 0){var "+n+","+i+"=-1,l"+o+"="+r+".length-1;while("+i+" 0){var "+n+";for( var "+i+" in "+r+"){ if (!"+r+".hasOwnProperty("+i+")) continue; "+n+"="+r+"["+i+"];out+='"}).replace(t.empty||c,function(e){return"';}}else{if(true){out+='"}).replace(t.evaluate||c,function(e,t){return"';"+f(t)+"out+='"})+"';return out;").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/(\s|;|\}|^|\{)out\+='';/g,"$1").replace(/\+''/g,"").replace(/(\s|;|\}|^|\{)out\+=''\+/g,"$1out+="),i&&t.selfcontained&&(s="String.prototype.encodeHTML=("+l.toString()+"());"+s);try{return new Function(t.varname,s)}catch(e){throw"undefined"!=typeof console&&console.log("Could not create a template function: "+s),e}},a.compile=function(e,t){return a.template(e,null,t)}}(),function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.returnExports=t()}(this,function(){function n(e){try{var t=S.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return N.test(t)}catch(e){return!1}}function p(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(E)return function(e){try{return!n(e)&&(S.call(e),!0)}catch(e){return!1}}(e);if(n(e))return!1;var t=_.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}var h,d,l=Array,e=l.prototype,a=Object,t=a.prototype,u=Function,i=u.prototype,v=String,r=v.prototype,y=Number,o=y.prototype,c=e.slice,s=e.splice,g=e.push,f=e.unshift,m=e.concat,b=e.join,x=i.call,w=i.apply,T=Math.max,C=Math.min,_=t.toString,E="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,S=Function.prototype.toString,N=/^\s*class /,D=RegExp.prototype.exec;h=function(e){return"object"==typeof e&&(E?function(e){try{return D.call(e),!0}catch(e){return!1}}(e):"[object RegExp]"===_.call(e))};var k=String.prototype.valueOf;d=function(e){return"string"==typeof e||"object"==typeof e&&(E?function(e){try{return k.call(e),!0}catch(e){return!1}}(e):"[object String]"===_.call(e))};function j(e){var t=typeof e;return null===e||"object"!=t&&"function"!=t}function A(){}var P,H,M=a.defineProperty&&function(){try{var e={};for(var t in a.defineProperty(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),L=(P=t.hasOwnProperty,H=M?function(e,t,n,i){!i&&t in e||a.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(e,t,n,i){!i&&t in e||(e[t]=n)},function(e,t,n){for(var i in t)P.call(t,i)&&H(e,i,t[i],n)}),O=y.isNaN||function(e){return e!=e},I=function(e){var t=+e;return O(t)?t=0:0!==t&&t!==1/0&&t!==-1/0&&(t=(0>>0};L(i,{bind:function(t){var n=this;if(!p(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i,r=c.call(arguments,1),e=T(0,n.length-r.length),o=[],s=0;s=r)throw new TypeError("reduce of empty array with no initial value")}for(;s>10|55296,1023&i|56320)}function i(){v()}var e,d,x,o,r,g,p,m,w,u,c,v,T,s,y,b,a,h,C,_="sizzle"+ +new Date,E=n.document,S=0,N=0,l=oe(),D=oe(),k=oe(),j=function(e,t){return e===t&&(c=!0),0},A={}.hasOwnProperty,t=[],P=t.pop,H=t.push,M=t.push,L=t.slice,O=function(e,t){for(var n=0,i=e.length;n+~]|"+F+")"+F+"*"),Y=new RegExp("="+F+"*([^\\]'\"]*?)"+F+"*\\]","g"),Q=new RegExp($),J=new RegExp("^"+q+"$"),V={ID:new RegExp("^#("+W+")"),CLASS:new RegExp("^\\.("+W+")"),TAG:new RegExp("^("+W.replace("w","w*")+")"),ATTR:new RegExp("^"+R),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+I+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,ee=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,te=/[+~]/,ne=/'|\\/g,ie=new RegExp("\\\\([\\da-f]{1,6}"+F+"?|("+F+")|.)","ig");try{M.apply(t=L.call(E.childNodes),E.childNodes),t[E.childNodes.length].nodeType}catch(e){M={apply:t.length?function(e,t){H.apply(e,L.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}function re(e,t,n,i){var r,o,s,a,l,u,c,f,p,h;if((t?t.ownerDocument||t:E)!==T&&v(t),n=n||[],a=(t=t||T).nodeType,"string"!=typeof e||!e||1!==a&&9!==a&&11!==a)return n;if(!i&&y){if(11!==a&&(r=ee.exec(e)))if(s=r[1]){if(9===a){if(!(o=t.getElementById(s))||!o.parentNode)return n;if(o.id===s)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&C(t,o)&&o.id===s)return n.push(o),n}else{if(r[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=r[3])&&d.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(d.qsa&&(!b||!b.test(e))){if(f=c=_,p=t,h=1!==a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(u=g(e),(c=t.getAttribute("id"))?f=c.replace(ne,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",l=u.length;l--;)u[l]=f+ge(u[l]);p=te.test(e)&&he(t.parentNode)||t,h=u.join(",")}if(h)try{return M.apply(n,p.querySelectorAll(h)),n}catch(e){}finally{c||t.removeAttribute("id")}}}return m(e.replace(z,"$1"),t,n,i)}function oe(){var i=[];return function e(t,n){return i.push(t+" ")>x.cacheLength&&delete e[i.shift()],e[t+" "]=n}}function se(e){return e[_]=!0,e}function ae(e){var t=T.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var n=e.split("|"),i=e.length;i--;)x.attrHandle[n[i]]=t}function ue(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||1<<31)-(~e.sourceIndex||1<<31);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ce(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function fe(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function pe(s){return se(function(o){return o=+o,se(function(e,t){for(var n,i=s([],e.length,o),r=i.length;r--;)e[n=i[r]]&&(e[n]=!(t[n]=e[n]))})})}function he(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in d=re.support={},r=re.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},v=re.setDocument=function(e){var t,n,l=e?e.ownerDocument||e:E;return l!==T&&9===l.nodeType&&l.documentElement?(s=(T=l).documentElement,(n=l.defaultView)&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",i,!1):n.attachEvent&&n.attachEvent("onunload",i)),y=!r(l),d.attributes=ae(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ae(function(e){return e.appendChild(l.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=Z.test(l.getElementsByClassName),d.getById=ae(function(e){return s.appendChild(e).id=_,!l.getElementsByName||!l.getElementsByName(_).length}),d.getById?(x.find.ID=function(e,t){if(void 0!==t.getElementById&&y){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},x.filter.ID=function(e){var t=e.replace(ie,f);return function(e){return e.getAttribute("id")===t}}):(delete x.find.ID,x.filter.ID=function(e){var n=e.replace(ie,f);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}}),x.find.TAG=d.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],r=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;n=o[r++];)1===n.nodeType&&i.push(n);return i},x.find.CLASS=d.getElementsByClassName&&function(e,t){if(y)return t.getElementsByClassName(e)},a=[],b=[],(d.qsa=Z.test(l.querySelectorAll))&&(ae(function(e){s.appendChild(e).innerHTML="
",e.querySelectorAll("[msallowcapture^='']").length&&b.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||b.push("\\["+F+"*(?:value|"+I+")"),e.querySelectorAll("[id~="+_+"-]").length||b.push("~="),e.querySelectorAll(":checked").length||b.push(":checked"),e.querySelectorAll("a#"+_+"+*").length||b.push(".#.+[+~]")}),ae(function(e){var t=l.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&b.push("name"+F+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||b.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),b.push(",.*:")})),(d.matchesSelector=Z.test(h=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.oMatchesSelector||s.msMatchesSelector))&&ae(function(e){d.disconnectedMatch=h.call(e,"div"),h.call(e,"[s!='']:x"),a.push("!=",$)}),b=b.length&&new RegExp(b.join("|")),a=a.length&&new RegExp(a.join("|")),t=Z.test(s.compareDocumentPosition),C=t||Z.test(s.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return c=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===l||e.ownerDocument===E&&C(E,e)?-1:t===l||t.ownerDocument===E&&C(E,t)?1:u?O(u,e)-O(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,i=0,r=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!r||!o)return e===l?-1:t===l?1:r?-1:o?1:u?O(u,e)-O(u,t):0;if(r===o)return ue(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[i]===a[i];)i++;return i?ue(s[i],a[i]):s[i]===E?-1:a[i]===E?1:0},l):T},re.matches=function(e,t){return re(e,null,null,t)},re.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&v(e),t=t.replace(Y,"='$1']"),d.matchesSelector&&y&&(!a||!a.test(t))&&(!b||!b.test(t)))try{var n=h.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ie,f),e[3]=(e[3]||e[4]||e[5]||"").replace(ie,f),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||re.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&re.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Q.test(n)&&(t=g(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ie,f).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=l[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&l(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,i,r){return function(e){var t=re.attr(e,n);return null==t?"!="===i:!i||(t+="","="===i?t===r:"!="===i?t!==r:"^="===i?r&&0===t.indexOf(r):"*="===i?r&&-1(?:<\/\1>|)$/,x=/^.[^:#\[\.,]*$/;function w(e,n,i){if(C.isFunction(n))return C.grep(e,function(e,t){return!!n.call(e,t,e)!==i});if(n.nodeType)return C.grep(e,function(e){return e===n!==i});if("string"==typeof n){if(x.test(n))return C.filter(n,e,i);n=C.filter(n,e)}return C.grep(e,function(e){return 0<=C.inArray(e,n)!==i})}C.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?C.find.matchesSelector(i,e)?[i]:[]:C.find.matches(e,C.grep(t,function(e){return 1===e.nodeType}))},C.fn.extend({find:function(e){var t,n=[],i=this,r=i.length;if("string"!=typeof e)return this.pushStack(C(e).filter(function(){for(t=0;t)[^>]*|#([\w-]*))$/;(C.fn.init=function(e,t){var n,i;if(!e)return this;if("string"!=typeof e)return e.nodeType?(this.context=this[0]=e,this.length=1,this):C.isFunction(e)?void 0!==T.ready?T.ready(e):e(C):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),C.makeArray(e,this));if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&3<=e.length?[null,e,null]:E.exec(e))||!n[1]&&t)return!t||t.jquery?(t||T).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof C?t[0]:t,C.merge(this,C.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:_,!0)),b.test(n[1])&&C.isPlainObject(t))for(n in t)C.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((i=_.getElementById(n[2]))&&i.parentNode){if(i.id!==n[2])return T.find(e);this.length=1,this[0]=i}return this.context=_,this.selector=e,this}).prototype=C.fn,T=C(_);var S=/^(?:parents|prev(?:Until|All))/,N={children:!0,contents:!0,next:!0,prev:!0};function D(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.extend({dir:function(e,t,n){for(var i=[],r=e[t];r&&9!==r.nodeType&&(void 0===n||1!==r.nodeType||!C(r).is(n));)1===r.nodeType&&i.push(r),r=r[t];return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),C.fn.extend({has:function(e){var t,n=C(e,this),i=n.length;return this.filter(function(){for(t=0;t
a",v.leadingWhitespace=3===t.firstChild.nodeType,v.tbody=!t.getElementsByTagName("tbody").length,v.htmlSerialize=!!t.getElementsByTagName("link").length,v.html5Clone="<:nav>"!==_.createElement("nav").cloneNode(!0).outerHTML,e.type="checkbox",e.checked=!0,n.appendChild(e),v.appendChecked=e.checked,t.innerHTML="",v.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,n.appendChild(t),t.innerHTML="",v.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,v.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){v.noCloneEvent=!1}),t.cloneNode(!0).click()),null==v.deleteExpando){v.deleteExpando=!0;try{delete t.test}catch(e){v.deleteExpando=!1}}}(),function(){var e,t,n=_.createElement("div");for(e in{submit:!0,change:!0,focusin:!0})t="on"+e,(v[e+"Bubbles"]=t in d)||(n.setAttribute(t,"t"),v[e+"Bubbles"]=!1===n.attributes[t].expando);n=null}();var Y=/^(?:input|select|textarea)$/i,Q=/^key/,J=/^(?:mouse|pointer|contextmenu)|click/,V=/^(?:focusinfocus|focusoutblur)$/,G=/^([^.]*)(?:\.(.+)|)$/;function K(){return!0}function Z(){return!1}function ee(){try{return _.activeElement}catch(e){}}function te(e){var t=ne.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}C.event={global:{},add:function(e,t,n,i,r){var o,s,a,l,u,c,f,p,h,d,g,m=C._data(e);if(m){for(n.handler&&(n=(l=n).handler,r=l.selector),n.guid||(n.guid=C.guid++),(s=m.events)||(s=m.events={}),(c=m.handle)||((c=m.handle=function(e){return typeof C===L||e&&C.event.triggered===e.type?void 0:C.event.dispatch.apply(c.elem,arguments)}).elem=e),a=(t=(t||"").match(j)||[""]).length;a--;)h=g=(o=G.exec(t[a])||[])[1],d=(o[2]||"").split(".").sort(),h&&(u=C.event.special[h]||{},h=(r?u.delegateType:u.bindType)||h,u=C.event.special[h]||{},f=C.extend({type:h,origType:g,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&C.expr.match.needsContext.test(r),namespace:d.join(".")},l),(p=s[h])||((p=s[h]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(e,i,d,c)||(e.addEventListener?e.addEventListener(h,c,!1):e.attachEvent&&e.attachEvent("on"+h,c))),u.add&&(u.add.call(e,f),f.handler.guid||(f.handler.guid=n.guid)),r?p.splice(p.delegateCount++,0,f):p.push(f),C.event.global[h]=!0);e=null}},remove:function(e,t,n,i,r){var o,s,a,l,u,c,f,p,h,d,g,m=C.hasData(e)&&C._data(e);if(m&&(c=m.events)){for(u=(t=(t||"").match(j)||[""]).length;u--;)if(h=g=(a=G.exec(t[u])||[])[1],d=(a[2]||"").split(".").sort(),h){for(f=C.event.special[h]||{},p=c[h=(i?f.delegateType:f.bindType)||h]||[],a=a[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=p.length;o--;)s=p[o],!r&&g!==s.origType||n&&n.guid!==s.guid||a&&!a.test(s.namespace)||i&&i!==s.selector&&("**"!==i||!s.selector)||(p.splice(o,1),s.selector&&p.delegateCount--,f.remove&&f.remove.call(e,s));l&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,d,m.handle)||C.removeEvent(e,h,m.handle),delete c[h])}else for(h in c)C.event.remove(e,h+t[u],n,i,!0);C.isEmptyObject(c)&&(delete m.handle,C._removeData(e,"events"))}},trigger:function(e,t,n,i){var r,o,s,a,l,u,c,f=[n||_],p=m.call(e,"type")?e.type:e,h=m.call(e,"namespace")?e.namespace.split("."):[];if(s=u=n=n||_,3!==n.nodeType&&8!==n.nodeType&&!V.test(p+C.event.triggered)&&(0<=p.indexOf(".")&&(p=(h=p.split(".")).shift(),h.sort()),o=p.indexOf(":")<0&&"on"+p,(e=e[C.expando]?e:new C.Event(p,"object"==typeof e&&e)).isTrigger=i?2:3,e.namespace=h.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:C.makeArray(t,[e]),l=C.event.special[p]||{},i||!l.trigger||!1!==l.trigger.apply(n,t))){if(!i&&!l.noBubble&&!C.isWindow(n)){for(a=l.delegateType||p,V.test(a+p)||(s=s.parentNode);s;s=s.parentNode)f.push(s),u=s;u===(n.ownerDocument||_)&&f.push(u.defaultView||u.parentWindow||d)}for(c=0;(s=f[c++])&&!e.isPropagationStopped();)e.type=1]","i"),oe=/^\s+/,se=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ae=/<([\w:]+)/,le=/\s*$/g,ge={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:v.htmlSerialize?[0,"",""]:[1,"X
","
"]},me=te(_).appendChild(_.createElement("div"));function ve(e,t){var n,i,r=0,o=typeof e.getElementsByTagName!==L?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==L?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(i=n[r]);r++)!t||C.nodeName(i,t)?o.push(i):C.merge(o,ve(i,t));return void 0===t||t&&C.nodeName(e,t)?C.merge([e],o):o}function ye(e){X.test(e.type)&&(e.defaultChecked=e.checked)}function be(e,t){return C.nodeName(e,"table")&&C.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function xe(e){return e.type=(null!==C.find.attr(e,"type"))+"/"+e.type,e}function we(e){var t=he.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Te(e,t){for(var n,i=0;null!=(n=e[i]);i++)C._data(n,"globalEval",!t||C._data(t[i],"globalEval"))}function Ce(e,t){if(1===t.nodeType&&C.hasData(e)){var n,i,r,o=C._data(e),s=C._data(t,o),a=o.events;if(a)for(n in delete s.handle,s.events={},a)for(i=0,r=a[n].length;i")?o=e.cloneNode(!0):(me.innerHTML=e.outerHTML,me.removeChild(o=me.firstChild)),!(v.noCloneEvent&&v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||C.isXMLDoc(e)))for(i=ve(o),a=ve(e),s=0;null!=(r=a[s]);++s)i[s]&&_e(r,i[s]);if(t)if(n)for(a=a||ve(e),i=i||ve(o),s=0;null!=(r=a[s]);s++)Ce(r,i[s]);else Ce(e,o);return 0<(i=ve(o,"script")).length&&Te(i,!l&&ve(e,"script")),i=a=r=null,o},buildFragment:function(e,t,n,i){for(var r,o,s,a,l,u,c,f=e.length,p=te(t),h=[],d=0;d")+c[2],r=c[0];r--;)a=a.lastChild;if(!v.leadingWhitespace&&oe.test(o)&&h.push(t.createTextNode(oe.exec(o)[0])),!v.tbody)for(r=(o="table"!==l||le.test(o)?""!==c[1]||le.test(o)?0:a:a.firstChild)&&o.childNodes.length;r--;)C.nodeName(u=o.childNodes[r],"tbody")&&!u.childNodes.length&&o.removeChild(u);for(C.merge(h,a.childNodes),a.textContent="";a.firstChild;)a.removeChild(a.firstChild);a=p.lastChild}else h.push(t.createTextNode(o));for(a&&p.removeChild(a),v.appendChecked||C.grep(ve(h,"input"),ye),d=0;o=h[d++];)if((!i||-1===C.inArray(o,i))&&(s=C.contains(o.ownerDocument,o),a=ve(p.appendChild(o),"script"),s&&Te(a),n))for(r=0;o=a[r++];)pe.test(o.type||"")&&n.push(o);return a=null,p},cleanData:function(e,t){for(var n,i,r,o,s=0,a=C.expando,l=C.cache,u=v.deleteExpando,c=C.event.special;null!=(n=e[s]);s++)if((t||C.acceptData(n))&&(o=(r=n[a])&&l[r])){if(o.events)for(i in o.events)c[i]?C.event.remove(n,i):C.removeEvent(n,i,o.handle);l[r]&&(delete l[r],u?delete n[a]:typeof n.removeAttribute!==L?n.removeAttribute(a):n[a]=null,f.push(r))}}}),C.fn.extend({text:function(e){return U(this,function(e){return void 0===e?C.text(this):this.empty().append((this[0]&&this[0].ownerDocument||_).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||be(this,e).appendChild(e)})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=be(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,i=e?C.filter(e,this):this,r=0;null!=(n=i[r]);r++)t||1!==n.nodeType||C.cleanData(ve(n)),n.parentNode&&(t&&C.contains(n.ownerDocument,n)&&Te(ve(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&C.cleanData(ve(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&C.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return C.clone(this,e,t)})},html:function(e){return U(this,function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(ie,""):void 0;if("string"==typeof e&&!ce.test(e)&&(v.htmlSerialize||!re.test(e))&&(v.leadingWhitespace||!oe.test(e))&&!ge[(ae.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(se,"<$1>");try{for(;n")).appendTo(t.documentElement))[0].contentWindow||Ee[0].contentDocument).document).write(),t.close(),n=De(e,t),Ee.detach()),Ne[e]=n),n}v.shrinkWrapBlocks=function(){return null!=Se?Se:(Se=!1,(t=_.getElementsByTagName("body")[0])&&t.style?(e=_.createElement("div"),(n=_.createElement("div")).style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",t.appendChild(n).appendChild(e),typeof e.style.zoom!==L&&(e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",e.appendChild(_.createElement("div")).style.width="5px",Se=3!==e.offsetWidth),t.removeChild(n),Se):void 0);var e,t,n};var je,Ae,Pe,He,Me,Le,Oe,Ie,Fe,We=/^margin/,qe=new RegExp("^("+B+")(?!px)[a-z%]+$","i"),Re=/^(top|right|bottom|left)$/;function $e(t,n){return{get:function(){var e=t();if(null!=e){if(!e)return(this.get=n).apply(this,arguments);delete this.get}}}}function Be(){var e,t,n,i;(t=_.getElementsByTagName("body")[0])&&t.style&&(e=_.createElement("div"),(n=_.createElement("div")).style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",t.appendChild(n).appendChild(e),e.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",Le=Oe=!1,Fe=!0,d.getComputedStyle&&(Le="1%"!==(d.getComputedStyle(e,null)||{}).top,Oe="4px"===(d.getComputedStyle(e,null)||{width:"4px"}).width,(i=e.appendChild(_.createElement("div"))).style.cssText=e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",e.style.width="1px",Fe=!parseFloat((d.getComputedStyle(i,null)||{}).marginRight),e.removeChild(i)),e.innerHTML="
t
",(i=e.getElementsByTagName("td"))[0].style.cssText="margin:0;border:0;padding:0;display:none",(Ie=0===i[0].offsetHeight)&&(i[0].style.display="",i[1].style.display="none",Ie=0===i[0].offsetHeight),t.removeChild(n))}d.getComputedStyle?(je=function(e){return e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):d.getComputedStyle(e,null)},Ae=function(e,t,n){var i,r,o,s,a=e.style;return s=(n=n||je(e))?n.getPropertyValue(t)||n[t]:void 0,n&&(""!==s||C.contains(e.ownerDocument,e)||(s=C.style(e,t)),qe.test(s)&&We.test(t)&&(i=a.width,r=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=i,a.minWidth=r,a.maxWidth=o)),void 0===s?s:s+""}):_.documentElement.currentStyle&&(je=function(e){return e.currentStyle},Ae=function(e,t,n){var i,r,o,s,a=e.style;return null==(s=(n=n||je(e))?n[t]:void 0)&&a&&a[t]&&(s=a[t]),qe.test(s)&&!Re.test(t)&&(i=a.left,(o=(r=e.runtimeStyle)&&r.left)&&(r.left=e.currentStyle.left),a.left="fontSize"===t?"1em":s,s=a.pixelLeft+"px",a.left=i,o&&(r.left=o)),void 0===s?s:s+""||"auto"}),(Pe=_.createElement("div")).innerHTML="
a",(He=(Me=Pe.getElementsByTagName("a")[0])&&Me.style)&&(He.cssText="float:left;opacity:.5",v.opacity="0.5"===He.opacity,v.cssFloat=!!He.cssFloat,Pe.style.backgroundClip="content-box",Pe.cloneNode(!0).style.backgroundClip="",v.clearCloneStyle="content-box"===Pe.style.backgroundClip,v.boxSizing=""===He.boxSizing||""===He.MozBoxSizing||""===He.WebkitBoxSizing,C.extend(v,{reliableHiddenOffsets:function(){return null==Ie&&Be(),Ie},boxSizingReliable:function(){return null==Oe&&Be(),Oe},pixelPosition:function(){return null==Le&&Be(),Le},reliableMarginRight:function(){return null==Fe&&Be(),Fe}})),C.swap=function(e,t,n,i){var r,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in r=n.apply(e,i||[]),t)e.style[o]=s[o];return r};var ze=/alpha\([^)]*\)/i,Ue=/opacity\s*=\s*([^)]*)/,Xe=/^(none|table(?!-c[ea]).+)/,Ye=new RegExp("^("+B+")(.*)$","i"),Qe=new RegExp("^([+-])=("+B+")","i"),Je={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","O","Moz","ms"];function Ke(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),i=t,r=Ge.length;r--;)if((t=Ge[r]+n)in e)return t;return i}function Ze(e,t){for(var n,i,r,o=[],s=0,a=e.length;s
a",ut=at.getElementsByTagName("a")[0],ct=(lt=_.createElement("select")).appendChild(_.createElement("option")),st=at.getElementsByTagName("input")[0],ut.style.cssText="top:1px",v.getSetAttribute="t"!==at.className,v.style=/top/.test(ut.getAttribute("style")),v.hrefNormalized="/a"===ut.getAttribute("href"),v.checkOn=!!st.value,v.optSelected=ct.selected,v.enctype=!!_.createElement("form").enctype,lt.disabled=!0,v.optDisabled=!ct.disabled,(st=_.createElement("input")).setAttribute("value",""),v.input=""===st.getAttribute("value"),st.value="t",st.setAttribute("type","radio"),v.radioValue="t"===st.value;var xt=/\r/g;C.fn.extend({val:function(n){var i,e,r,t=this[0];return arguments.length?(r=C.isFunction(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=r?n.call(this,e,C(this).val()):n)?t="":"number"==typeof t?t+="":C.isArray(t)&&(t=C.map(t,function(e){return null==e?"":e+""})),(i=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in i&&void 0!==i.set(this,t,"value")||(this.value=t))})):t?(i=C.valHooks[t.type]||C.valHooks[t.nodeName.toLowerCase()])&&"get"in i&&void 0!==(e=i.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),C.extend({valHooks:{option:{get:function(e){var t=C.find.attr(e,"value");return null!=t?t:C.trim(C.text(e))}},select:{get:function(e){for(var t,n,i=e.options,r=e.selectedIndex,o="select-one"===e.type||r<0,s=o?null:[],a=o?r+1:i.length,l=r<0?a:o?r:0;l").append(C.parseHTML(e)).find(i):e)}).complete(n&&function(e,t){s.each(n,r||[e.responseText,t,e])}),this},C.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){C.fn[t]=function(e){return this.on(t,e)}}),C.expr.filters.animated=function(t){return C.grep(C.timers,function(e){return t===e.elem}).length};var cn=d.document.documentElement;function fn(e){return C.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}C.offset={setOffset:function(e,t,n){var i,r,o,s,a,l,u=C.css(e,"position"),c=C(e),f={};"static"===u&&(e.style.position="relative"),a=c.offset(),o=C.css(e,"top"),l=C.css(e,"left"),r=("absolute"===u||"fixed"===u)&&-1").outerWidth(1).jquery||D.each(["Width","Height"],function(e,n){var r="Width"===n?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),o={innerWidth:D.fn.innerWidth,innerHeight:D.fn.innerHeight,outerWidth:D.fn.outerWidth,outerHeight:D.fn.outerHeight};function s(e,t,n,i){return D.each(r,function(){t-=parseFloat(D.css(e,"padding"+this))||0,n&&(t-=parseFloat(D.css(e,"border"+this+"Width"))||0),i&&(t-=parseFloat(D.css(e,"margin"+this))||0)}),t}D.fn["inner"+n]=function(e){return void 0===e?o["inner"+n].call(this):this.each(function(){D(this).css(i,s(this,e)+"px")})},D.fn["outer"+n]=function(e,t){return"number"!=typeof e?o["outer"+n].call(this,e):this.each(function(){D(this).css(i,s(this,e,!0,t)+"px")})}}),D.fn.addBack||(D.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),D("").data("a-b","a").removeData("a-b").data("a-b")&&(D.fn.removeData=(t=D.fn.removeData,function(e){return arguments.length?t.call(this,D.camelCase(e)):t.call(this)})),D.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),D.fn.extend({focus:(i=D.fn.focus,function(t,n){return"number"==typeof t?this.each(function(){var e=this;setTimeout(function(){D(e).focus(),n&&n.call(e)},t)}):i.apply(this,arguments)}),disableSelection:(n="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.bind(n+".ui-disableSelection",function(e){e.preventDefault()})}),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var t,n,i=D(this[0]);i.length&&i[0]!==document;){if(("absolute"===(t=i.css("position"))||"relative"===t||"fixed"===t)&&(n=parseInt(i.css("zIndex"),10),!isNaN(n)&&0!==n))return n;i=i.parent()}return 0}}),D.ui.plugin={add:function(e,t,n){var i,r=D.ui[e].prototype;for(i in n)r.plugins[i]=r.plugins[i]||[],r.plugins[i].push([t,n[i]])},call:function(e,t,n,i){var r,o=e.plugins[t];if(o&&(i||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(r=0;r",options:{disabled:!1,create:null},_createWidget:function(e,t){t=D(t||this.defaultElement||this)[0],this.element=D(t),this.uuid=a++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=D(),this.hoverable=D(),this.focusable=D(),t!==this&&(D.data(t,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===t&&this.destroy()}}),this.document=D(t.style?t.ownerDocument:t.document||t),this.window=D(this.document[0].defaultView||this.document[0].parentWindow)),this.options=D.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:D.noop,_getCreateEventData:D.noop,_create:D.noop,_init:D.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(D.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:D.noop,widget:function(){return this.element},option:function(e,t){var n,i,r,o=e;if(0===arguments.length)return D.widget.extend({},this.options);if("string"==typeof e)if(o={},e=(n=e.split(".")).shift(),n.length){for(i=o[e]=D.widget.extend({},this.options[e]),r=0;r=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}});!function(){D.ui=D.ui||{};var r,T,C=Math.max,_=Math.abs,E=Math.round,i=/left|center|right/,o=/top|center|bottom/,s=/[\+\-]\d+(\.[\d]+)?%?/,a=/^\w+/,l=/%$/,u=D.fn.position;function S(e,t,n){return[parseFloat(e[0])*(l.test(e[0])?t/100:1),parseFloat(e[1])*(l.test(e[1])?n/100:1)]}function N(e,t){return parseInt(D.css(e,t),10)||0}D.position={scrollbarWidth:function(){if(void 0!==r)return r;var e,t,n=D("
"),i=n.children()[0];return D("body").append(n),e=i.offsetWidth,n.css("overflow","scroll"),e===(t=i.offsetWidth)&&(t=n[0].clientWidth),n.remove(),r=e-t},getScrollInfo:function(e){var t=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),n=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),i="scroll"===t||"auto"===t&&e.widthC(_(i),_(r))?o.important="horizontal":o.important="vertical",f.using.call(this,e,o)}),s.offset(D.extend(u,{using:e}))})},D.ui.position={fit:{left:function(e,t){var n,i=t.within,r=i.isWindow?i.scrollLeft:i.offset.left,o=i.width,s=e.left-t.collisionPosition.marginLeft,a=r-s,l=s+t.collisionWidth-o-r;t.collisionWidth>o?0o?0").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var t=this.document[0];if(this.handleElement.is(e.target))try{t.activeElement&&"body"!==t.activeElement.nodeName.toLowerCase()&&D(t.activeElement).blur()}catch(e){}},_mouseStart:function(e){var t=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),D.ui.ddmanager&&(D.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0n[2]&&(l=n[2]+this.offset.click.left),e.pageY-this.offset.click.top>n[3]&&(u=n[3]+this.offset.click.top)),s.grid&&(r=s.grid[1]?this.originalPageY+Math.round((u-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,u=!n||r-this.offset.click.top>=n[1]||r-this.offset.click.top>n[3]?r:r-this.offset.click.top>=n[1]?r-s.grid[1]:r+s.grid[1],o=s.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,l=!n||o-this.offset.click.left>=n[0]||o-this.offset.click.left>n[2]?o:o-this.offset.click.left>=n[0]?o-s.grid[0]:o+s.grid[0]),"y"===s.axis&&(l=this.originalPageX),"x"===s.axis&&(u=this.originalPageY)),{top:u-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:a?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:a?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(e,t,n){return n=n||this._uiHash(),D.ui.plugin.call(this,e,[t,n,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),n.offset=this.positionAbs),D.Widget.prototype._trigger.call(this,e,t,n)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),D.ui.plugin.add("draggable","connectToSortable",{start:function(t,e,n){var i=D.extend({},e,{item:n.element});n.sortables=[],D(n.options.connectToSortable).each(function(){var e=D(this).sortable("instance");e&&!e.options.disabled&&(n.sortables.push(e),e.refreshPositions(),e._trigger("activate",t,i))})},stop:function(t,e,n){var i=D.extend({},e,{item:n.element});n.cancelHelperRemoval=!1,D.each(n.sortables,function(){var e=this;e.isOver?(e.isOver=0,n.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,i))})},drag:function(n,i,r){D.each(r.sortables,function(){var e=!1,t=this;t.positionAbs=r.positionAbs,t.helperProportions=r.helperProportions,t.offset.click=r.offset.click,t._intersectsWith(t.containerCache)&&(e=!0,D.each(r.sortables,function(){return this.positionAbs=r.positionAbs,this.helperProportions=r.helperProportions,this.offset.click=r.offset.click,this!==t&&this._intersectsWith(this.containerCache)&&D.contains(t.element[0],this.element[0])&&(e=!1),e})),e?(t.isOver||(t.isOver=1,r._parent=i.helper.parent(),t.currentItem=i.helper.appendTo(t.element).data("ui-sortable-item",!0),t.options._helper=t.options.helper,t.options.helper=function(){return i.helper[0]},n.target=t.currentItem[0],t._mouseCapture(n,!0),t._mouseStart(n,!0,!0),t.offset.click.top=r.offset.click.top,t.offset.click.left=r.offset.click.left,t.offset.parent.left-=r.offset.parent.left-t.offset.parent.left,t.offset.parent.top-=r.offset.parent.top-t.offset.parent.top,r._trigger("toSortable",n),r.dropped=t.element,D.each(r.sortables,function(){this.refreshPositions()}),r.currentItem=r.element,t.fromOutside=r),t.currentItem&&(t._mouseDrag(n),i.position=t.position)):t.isOver&&(t.isOver=0,t.cancelHelperRemoval=!0,t.options._revert=t.options.revert,t.options.revert=!1,t._trigger("out",n,t._uiHash(t)),t._mouseStop(n,!0),t.options.revert=t.options._revert,t.options.helper=t.options._helper,t.placeholder&&t.placeholder.remove(),i.helper.appendTo(r._parent),r._refreshOffsets(n),i.position=r._generatePosition(n,!0),r._trigger("fromSortable",n),r.dropped=!1,D.each(r.sortables,function(){this.refreshPositions()}))})}}),D.ui.plugin.add("draggable","cursor",{start:function(e,t,n){var i=D("body"),r=n.options;i.css("cursor")&&(r._cursor=i.css("cursor")),i.css("cursor",r.cursor)},stop:function(e,t,n){var i=n.options;i._cursor&&D("body").css("cursor",i._cursor)}}),D.ui.plugin.add("draggable","opacity",{start:function(e,t,n){var i=D(t.helper),r=n.options;i.css("opacity")&&(r._opacity=i.css("opacity")),i.css("opacity",r.opacity)},stop:function(e,t,n){var i=n.options;i._opacity&&D(t.helper).css("opacity",i._opacity)}}),D.ui.plugin.add("draggable","scroll",{start:function(e,t,n){n.scrollParentNotHidden||(n.scrollParentNotHidden=n.helper.scrollParent(!1)),n.scrollParentNotHidden[0]!==n.document[0]&&"HTML"!==n.scrollParentNotHidden[0].tagName&&(n.overflowOffset=n.scrollParentNotHidden.offset())},drag:function(e,t,n){var i=n.options,r=!1,o=n.scrollParentNotHidden[0],s=n.document[0];o!==s&&"HTML"!==o.tagName?(i.axis&&"x"===i.axis||(n.overflowOffset.top+o.offsetHeight-e.pageY")[0],x=c.each,b.style.cssText="background-color:rgba(1,1,1,.5)",y.rgba=-1").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),t={width:n.width(),height:n.height()},r=document.activeElement;try{r.id}catch(e){r=document.body}return n.wrap(e),n[0]!==r&&!D.contains(n[0],r)||D(r).focus(),e=n.parent(),"static"===n.css("position")?(e.css({position:"relative"}),n.css({position:"relative"})):(D.extend(i,{position:n.css("position"),zIndex:n.css("z-index")}),D.each(["top","left","bottom","right"],function(e,t){i[t]=n.css(t),isNaN(parseInt(i[t],10))&&(i[t]="auto")}),n.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),n.css(t),e.css(i).show()},removeWrapper:function(e){var t=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),e[0]!==t&&!D.contains(e[0],t)||D(t).focus()),e},setTransition:function(i,e,r,o){return o=o||{},D.each(e,function(e,t){var n=i.cssUnit(t);0r&&0!==r||!1===i.call(e,o))&&jQuery.timer.remove(e,n,i)}a.timerID=i.timerID,s[n][i.timerID]||(s[n][i.timerID]=window.setInterval(a,t)),this.global.push(e)}},remove:function(e,t,n){var i,r=jQuery.data(e,this.dataKey);if(r){if(t){if(r[t]){if(n)n.timerID&&(window.clearInterval(r[t][n.timerID]),delete r[t][n.timerID]);else for(var n in r[t])window.clearInterval(r[t][n]),delete r[t][n];for(i in r[t])break;i||(i=null,delete r[t])}}else for(t in r)this.remove(e,t,n);for(i in r)break;i||jQuery.removeData(e,this.dataKey)}}}}),jQuery(window).bind("unload",function(){jQuery.each(jQuery.timer.global,function(e,t){jQuery.timer.remove(t)})}),function(){"use strict";var a={version:"1.0.1-nanoui",templateSettings:{evaluate:/\{\{([\s\S]+?)\}\}/g,interpolate:/\{\{:([\s\S]+?)\}\}/g,encode:/\{\{>([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,conditional:/\{\{\/?if\s*([\s\S]*?)\s*\}\}/g,conditionalElse:/\{\{else\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{\/?for\s*(?:\}\}|([\s\S]+?)\s*(?:\:\s*([\w$]+))?\s*(?:\:\s*([\w$]+))?\s*\}\})/g,props:/\{\{\/?props\s*(?:\}\}|([\s\S]+?)\s*(?:\:\s*([\w$]+))?\s*(?:\:\s*([\w$]+))?\s*\}\})/g,empty:/\{\{empty\}\}/g,varname:"data, config, helper",strip:!0,append:!0,selfcontained:!1},template:void 0,compile:void 0};function l(){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},e=/&(?!#?\w+;)|<|>|"|'|\//g;return function(){return this?this.replace(e,function(e){return t[e]||e}):this}}"undefined"!=typeof module&&module.exports?module.exports=a:"function"==typeof define&&define.amd?define(function(){return a}):function(){return this||(0,eval)("this")}().doT=a,String.prototype.encodeHTML=l();var u={append:{start:"'+(",end:")+'",endencode:"||'').toString().encodeHTML()+'"},split:{start:"';out+=(",end:");out+='",endencode:"||'').toString().encodeHTML();out+='"}},c=/$^/;function f(e){return e.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}a.template=function(e,t,n){var i,r=(t=t||a.templateSettings).append?u.append:u.split,o=0,s=t.use||t.define?function i(r,e,o){return("string"==typeof e?e:e.toString()).replace(r.define||c,function(e,i,t,n){return 0===i.indexOf("def.")&&(i=i.substring(4)),i in o||(":"===t?(r.defineParams&&n.replace(r.defineParams,function(e,t,n){o[i]={arg:t,text:n}}),i in o||(o[i]=n)):new Function("def","def['"+i+"']="+n)(o)),""}).replace(r.use||c,function(e,t){r.useParams&&(t=t.replace(r.useParams,function(e,t,n,i){if(o[n]&&o[n].arg&&i){var r=(n+":"+i).replace(/'|\\/g,"_");return o.__exp=o.__exp||{},o.__exp[r]=o[n].text.replace(new RegExp("(^|[^\\w$])"+o[n].arg+"([^\\w$])","g"),"$1"+i+"$2"),t+"def.__exp['"+r+"']"}}));var n=new Function("def","return "+t)(o);return n?i(r,n,o):n})}(t,e,n||{}):e;s=("var out='"+(t.strip?s.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):s).replace(/'|\\/g,"\\$&").replace(t.interpolate||c,function(e,t){return r.start+f(t)+r.end}).replace(t.encode||c,function(e,t){return i=!0,r.start+f(t)+r.endencode}).replace(t.conditional||c,function(e,t){return t?"';if("+f(t)+"){out+='":"';}out+='"}).replace(t.conditionalElse||c,function(e,t){return t?"';}else if("+f(t)+"){out+='":"';}else{out+='"}).replace(t.iterate||c,function(e,t,n,i){if(!t)return"';} } out+='";o+=1,n=n||"value",i=i||"index",t=f(t);var r="arr"+o;return"';var "+r+"="+t+";if("+r+" && "+r+".length > 0){var "+n+","+i+"=-1,l"+o+"="+r+".length-1;while("+i+" 0){var "+n+";for( var "+i+" in "+r+"){ if (!"+r+".hasOwnProperty("+i+")) continue; "+n+"="+r+"["+i+"];out+='"}).replace(t.empty||c,function(e){return"';}}else{if(true){out+='"}).replace(t.evaluate||c,function(e,t){return"';"+f(t)+"out+='"})+"';return out;").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/(\s|;|\}|^|\{)out\+='';/g,"$1").replace(/\+''/g,"").replace(/(\s|;|\}|^|\{)out\+=''\+/g,"$1out+="),i&&t.selfcontained&&(s="String.prototype.encodeHTML=("+l.toString()+"());"+s);try{return new Function(t.varname,s)}catch(e){throw"undefined"!=typeof console&&console.log("Could not create a template function: "+s),e}},a.compile=function(e,t){return a.template(e,null,t)}}(),function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.returnExports=t()}(this,function(){function n(e){try{var t=S.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return N.test(t)}catch(e){return}}function p(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(E)return function(e){try{return n(e)?!1:(S.call(e),!0)}catch(e){return!1}}(e);if(n(e))return!1;var t=_.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}var h,d,l=Array,e=l.prototype,a=Object,t=a.prototype,u=Function,i=u.prototype,v=String,r=v.prototype,y=Number,o=y.prototype,c=e.slice,s=e.splice,g=e.push,f=e.unshift,m=e.concat,b=e.join,x=i.call,w=i.apply,T=Math.max,C=Math.min,_=t.toString,E="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,S=Function.prototype.toString,N=/^\s*class /,D=RegExp.prototype.exec;h=function(e){return"object"==typeof e&&(E?function(e){try{return D.call(e),!0}catch(e){return!1}}(e):"[object RegExp]"===_.call(e))};var k=String.prototype.valueOf;d=function(e){return"string"==typeof e||"object"==typeof e&&(E?function(e){try{return k.call(e),!0}catch(e){return!1}}(e):"[object String]"===_.call(e))};function j(e){var t=typeof e;return null===e||"object"!=t&&"function"!=t}function A(){}var P,H,M=a.defineProperty&&function(){try{var e={};for(var t in a.defineProperty(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),L=(P=t.hasOwnProperty,H=M?function(e,t,n,i){!i&&t in e||a.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(e,t,n,i){!i&&t in e||(e[t]=n)},function(e,t,n){for(var i in t)P.call(t,i)&&H(e,i,t[i],n)}),O=y.isNaN||function(e){return e!=e},I=function(e){var t=+e;return O(t)?t=0:0!==t&&t!==1/0&&t!==-1/0&&(t=(0>>0};L(i,{bind:function(t){var n=this;if(!p(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i,r=c.call(arguments,1),e=T(0,n.length-r.length),o=[],s=0;s=r)throw new TypeError("reduce of empty array with no initial value")}for(;sError name: "+e.name+"
Error Message: "+e.message)}t.hasOwnProperty("data")||(a&&a.hasOwnProperty("data")?t.data=a.data:t.data={}),n?l(t):a=t}(e)},addBeforeUpdateCallback:function(e,t){r[e]=t},addBeforeUpdateCallbacks:function(e){for(var t in e)e.hasOwnProperty(t)&&NanoStateManager.addBeforeUpdateCallback(t,e[t])},removeBeforeUpdateCallback:function(e){r.hasOwnProperty(e)&&delete r[e]},executeBeforeUpdateCallbacks:function(e){return t(r,e)},addAfterUpdateCallback:function(e,t){o[e]=t},addAfterUpdateCallbacks:function(e){for(var t in e)e.hasOwnProperty(t)&&NanoStateManager.addAfterUpdateCallback(t,e[t])},removeAfterUpdateCallback:function(e){o.hasOwnProperty(e)&&delete o[e]},executeAfterUpdateCallbacks:function(e){return t(o,e)},addState:function(e){e instanceof NanoStateClass?e.key?i[e.key]=e:reportError("ERROR: Attempted to add a state with an invalid stateKey"):reportError("ERROR: Attempted to add a state which is not instanceof NanoStateClass")},setCurrentState:function(e){if(void 0===e||!e)return reportError("ERROR: No state key was passed!"),!1;if(!i.hasOwnProperty(e))return reportError("ERROR: Attempted to set a current state which does not exist: "+e),!1;var t=s;return s=i[e],null!=t&&t.onRemove(s),s.onAdd(t),!0},getCurrentState:function(){return s},getData:function(){return a}}}(),NanoBaseCallbacks=function(){var a=!0,t={},n={status:function(n){var e;return 2==n.config.status?(e="good",$(".linkActive").removeClass("inactive")):(e=1==n.config.status?"average":"bad",$(".linkActive").addClass("inactive")),$(".statusicon").removeClass("good bad average").addClass(e),$(".linkActive").stopTime("linkPending"),$(".linkActive").removeClass("linkPending"),$(".linkActive").off("click").on("click",function(e){e.preventDefault();var t=$(this).data("href");null!=t&&a&&(a=!1,$("body").oneTime(300,"enableClick",function(){a=!0}),2==n.config.status&&$(this).oneTime(300,"linkPending",function(){$(this).addClass("linkPending")}),window.location.href=t)}),n},nanomap:function(e){return $(".mapIcon").off("mouseenter mouseleave").on("mouseenter",function(e){$("#uiMapTooltip").html($(this).children(".tooltip").html()).show().stopTime().oneTime(5e3,"hideTooltip",function(){$(this).fadeOut(500)})}),$(".zoomLink").off("click").on("click",function(e){e.preventDefault();var t=$(this).data("zoomLevel"),n=$("#uiMap"),a=n.width()*t,r=n.height()*t;n.css({zoom:t,left:"50%",top:"50%",marginLeft:"-"+Math.floor(a/2)+"px",marginTop:"-"+Math.floor(r/2)+"px"})}),$("#uiMapImage").attr("src",e.config.map+"_nanomap_z"+e.config.mapZLevel+".png"),e}};return{addCallbacks:function(){NanoStateManager.addBeforeUpdateCallbacks(t),NanoStateManager.addAfterUpdateCallbacks(n)},removeCallbacks:function(){for(var e in t)t.hasOwnProperty(e)&&NanoStateManager.removeBeforeUpdateCallback(e);for(var e in n)n.hasOwnProperty(e)&&NanoStateManager.removeAfterUpdateCallback(e)}}}(),NanoBaseHelpers=function(){var t={syndicateMode:function(){return $(".mainBG").css("background","url('syndicate.png') no-repeat fixed center/50% 50%, linear-gradient(to bottom, #8f1414 0%, #4B0A0A 100%) no-repeat fixed center;"),$("#uiTitleFluff").css("background-image","url('uiTitleFluff-Syndicate.png')"),$("#uiTitleFluff").css("background-position","50% 50%"),$("#uiTitleFluff").css("background-repeat","no-repeat"),""},combine:function(e,t){return e&&t?e.concat(t):e||t},dump:function(e){return JSON.stringify(e)},link:function(e,t,n,a,r,o){var i="",s="noIcon";void 0!==t&&t&&(i='
',s="hasIcon"),void 0!==r&&r||(r="link");var l="";void 0!==o&&o&&(l='id="'+o+'"');var c=NanoTransition.allocID(l+"_"+e.toString().replace(/[^a-z0-9_]/gi,"_")+"_"+t);return void 0!==a&&a?'