diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm index 2ccfe0f2e8..ea604bc996 100644 --- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm +++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm @@ -42,7 +42,7 @@ obj/machinery/atmospherics/binary return null Destroy() - loc = null + . = ..() if(node1) node1.disconnect(src) @@ -54,8 +54,6 @@ obj/machinery/atmospherics/binary node1 = null node2 = null - ..() - initialize() if(node1 && node2) return diff --git a/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm b/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm index 5768def1ec..d0417e14dd 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm @@ -36,7 +36,7 @@ initialize_directions = NORTH|SOUTH Destroy() - loc = null + . = ..() if(node1) node1.disconnect(src) @@ -48,8 +48,6 @@ node1 = null node2 = null - ..() - process() ..() if(anchored && !(stat&BROKEN)) diff --git a/code/ATMOSPHERICS/components/omni_devices/filter.dm b/code/ATMOSPHERICS/components/omni_devices/filter.dm index b2966ef431..feb1b5cb93 100644 --- a/code/ATMOSPHERICS/components/omni_devices/filter.dm +++ b/code/ATMOSPHERICS/components/omni_devices/filter.dm @@ -28,7 +28,7 @@ input = null output = null filters.Cut() - ..() + return ..() /obj/machinery/atmospherics/omni/filter/sort_ports() for(var/datum/omni_port/P in ports) diff --git a/code/ATMOSPHERICS/components/portables_connector.dm b/code/ATMOSPHERICS/components/portables_connector.dm index 4f6473fccf..9668f7a5a3 100644 --- a/code/ATMOSPHERICS/components/portables_connector.dm +++ b/code/ATMOSPHERICS/components/portables_connector.dm @@ -61,7 +61,7 @@ return null /obj/machinery/atmospherics/portables_connector/Destroy() - loc = null + . = ..() if(connected_device) connected_device.disconnect() @@ -72,8 +72,6 @@ node = null - ..() - /obj/machinery/atmospherics/portables_connector/initialize() if(node) return diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm index fa066d978f..717540db69 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm @@ -51,7 +51,7 @@ obj/machinery/atmospherics/trinary return null Destroy() - loc = null + . = ..() if(node1) node1.disconnect(src) @@ -67,8 +67,6 @@ obj/machinery/atmospherics/trinary node2 = null node3 = null - ..() - initialize() if(node1 && node2 && node3) return diff --git a/code/ATMOSPHERICS/components/tvalve.dm b/code/ATMOSPHERICS/components/tvalve.dm index f93970a93f..a7deb70aba 100644 --- a/code/ATMOSPHERICS/components/tvalve.dm +++ b/code/ATMOSPHERICS/components/tvalve.dm @@ -100,7 +100,7 @@ return null /obj/machinery/atmospherics/tvalve/Destroy() - loc = null + . = ..() if(node1) node1.disconnect(src) @@ -116,8 +116,6 @@ node2 = null node3 = null - ..() - /obj/machinery/atmospherics/tvalve/proc/go_to_side() if(state) return 0 diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm index 20d37b309c..0372483c79 100644 --- a/code/ATMOSPHERICS/components/unary/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary/unary_base.dm @@ -31,7 +31,7 @@ return null Destroy() - loc = null + . = ..() if(node) node.disconnect(src) @@ -39,8 +39,6 @@ node = null - ..() - initialize() if(node) return diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 00bc7e5772..c6121dea31 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -80,7 +80,10 @@ /obj/machinery/atmospherics/unary/vent_pump/Destroy() unregister_radio(src, frequency) - ..() + if(initial_loc) + initial_loc.air_vent_info -= id_tag + initial_loc.air_vent_names -= id_tag + return ..() /obj/machinery/atmospherics/unary/vent_pump/high_volume name = "Large Air Vent" @@ -414,13 +417,6 @@ new /obj/item/pipe(loc, make_from=src) qdel(src) -/obj/machinery/atmospherics/unary/vent_pump/Destroy() - if(initial_loc) - initial_loc.air_vent_info -= id_tag - initial_loc.air_vent_names -= id_tag - ..() - return - #undef DEFAULT_PRESSURE_DELTA #undef EXTERNAL_PRESSURE_BOUND diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 06d1bce437..3fccbb50f3 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -44,8 +44,10 @@ /obj/machinery/atmospherics/unary/vent_scrubber/Destroy() unregister_radio(src, frequency) - ..() - + if(initial_loc) + initial_loc.air_scrub_info -= id_tag + initial_loc.air_scrub_names -= id_tag + return ..() /obj/machinery/atmospherics/unary/vent_scrubber/update_icon(var/safety = 0) if(!check_icon_cache()) @@ -285,10 +287,3 @@ user << "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W" else user << "You are too far away to read the gauge." - -/obj/machinery/atmospherics/unary/vent_scrubber/Destroy() - if(initial_loc) - initial_loc.air_scrub_info -= id_tag - initial_loc.air_scrub_names -= id_tag - ..() - return diff --git a/code/ATMOSPHERICS/components/valve.dm b/code/ATMOSPHERICS/components/valve.dm index 3cd77597b3..01e6e977bb 100644 --- a/code/ATMOSPHERICS/components/valve.dm +++ b/code/ATMOSPHERICS/components/valve.dm @@ -72,7 +72,7 @@ return null /obj/machinery/atmospherics/valve/Destroy() - loc = null + . = ..() if(node1) node1.disconnect(src) @@ -84,8 +84,6 @@ node1 = null node2 = null - ..() - /obj/machinery/atmospherics/valve/proc/open() if(open) return 0 diff --git a/code/ATMOSPHERICS/datum_pipe_network.dm b/code/ATMOSPHERICS/datum_pipe_network.dm index 7fe586733c..8441461342 100644 --- a/code/ATMOSPHERICS/datum_pipe_network.dm +++ b/code/ATMOSPHERICS/datum_pipe_network.dm @@ -16,6 +16,15 @@ datum/pipe_network ..() + Destroy() + pipe_networks -= src + for(var/datum/pipeline/line_member in line_members) + line_member.network = null + for(var/obj/machinery/atmospherics/normal_member in normal_members) + normal_member.reassign_network(src, null) + gases.Cut() // Do not qdel the gases, we don't own them + return ..() + proc/process() //Equalize gases amongst pipe if called for if(update) diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm index 44c7cd2590..0115c85c3d 100644 --- a/code/ATMOSPHERICS/datum_pipeline.dm +++ b/code/ATMOSPHERICS/datum_pipeline.dm @@ -10,14 +10,14 @@ datum/pipeline var/alert_pressure = 0 Destroy() - if(network) - qdel(network) + qdel_null(network) if(air && air.volume) temporarily_store_air() - qdel(air) + for(var/obj/machinery/atmospherics/pipe/P in members) + P.parent = null - ..() + . = ..() proc/process()//This use to be called called from the pipe networks diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index 105aaa8c8b..c23fc16555 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -63,11 +63,11 @@ return parent.return_network(reference) /obj/machinery/atmospherics/pipe/Destroy() - qdel(parent) + qdel_null(parent) if(air_temporary) loc.assume_air(air_temporary) - ..() + . = ..() /obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) if (istype(src, /obj/machinery/atmospherics/pipe/tank)) @@ -227,10 +227,12 @@ /obj/machinery/atmospherics/pipe/simple/Destroy() if(node1) node1.disconnect(src) + node1 = null if(node2) node2.disconnect(src) + node1 = null - ..() + . = ..() /obj/machinery/atmospherics/pipe/simple/pipeline_expansion() return list(node1, node2) @@ -461,12 +463,15 @@ /obj/machinery/atmospherics/pipe/manifold/Destroy() if(node1) node1.disconnect(src) + node1 = null if(node2) node2.disconnect(src) + node2 = null if(node3) node3.disconnect(src) + node3 = null - ..() + . = ..() /obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/reference) if(reference == node1) @@ -705,14 +710,18 @@ /obj/machinery/atmospherics/pipe/manifold4w/Destroy() if(node1) node1.disconnect(src) + node1 = null if(node2) node2.disconnect(src) + node2 = null if(node3) node3.disconnect(src) + node3 = null if(node4) node4.disconnect(src) + node4 = null - ..() + . = ..() /obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics/reference) if(reference == node1) @@ -967,8 +976,9 @@ /obj/machinery/atmospherics/pipe/cap/Destroy() if(node) node.disconnect(src) + node = null - ..() + . = ..() /obj/machinery/atmospherics/pipe/cap/disconnect(obj/machinery/atmospherics/reference) if(reference == node) @@ -1081,8 +1091,9 @@ /obj/machinery/atmospherics/pipe/tank/Destroy() if(node1) node1.disconnect(src) + node1 = null - ..() + . = ..() /obj/machinery/atmospherics/pipe/tank/pipeline_expansion() return list(node1) @@ -1251,8 +1262,9 @@ /obj/machinery/atmospherics/pipe/vent/Destroy() if(node1) node1.disconnect(src) + node1 = null - ..() + . = ..() /obj/machinery/atmospherics/pipe/vent/pipeline_expansion() return list(node1) diff --git a/code/ZAS/Phoron.dm b/code/ZAS/Phoron.dm index 4a4c29dcfb..acee6a8b65 100644 --- a/code/ZAS/Phoron.dm +++ b/code/ZAS/Phoron.dm @@ -103,19 +103,23 @@ obj/var/phoronproof = 0 //Burn eyes if exposed. if(vsc.plc.EYE_BURNS && (species.breath_type != "phoron")) - if(!head) - if(!wear_mask) - burn_eyes() - else - if(!(wear_mask.body_parts_covered & EYES)) - burn_eyes() - else - if(!(head.body_parts_covered & EYES)) - if(!wear_mask) - burn_eyes() - else - if(!(wear_mask.body_parts_covered & EYES)) - burn_eyes() + var/burn_eyes = 1 + + //Check for protective glasses + if(glasses && (glasses.body_parts_covered & EYES) && (glasses.item_flags & AIRTIGHT)) + burn_eyes = 0 + + //Check for protective maskwear + if(burn_eyes && wear_mask && (wear_mask.body_parts_covered & EYES) && (wear_mask.item_flags & AIRTIGHT)) + burn_eyes = 0 + + //Check for protective helmets + if(burn_eyes && head && (head.body_parts_covered & EYES) && (head.item_flags & AIRTIGHT)) + burn_eyes = 0 + + //If we still need to, burn their eyes + if(burn_eyes) + burn_eyes() //Genetic Corruption if(vsc.plc.GENETIC_CORRUPTION && (species.breath_type != "phoron")) diff --git a/code/ZAS/Turf.dm b/code/ZAS/Turf.dm index bb5eb5050e..a309cd3a08 100644 --- a/code/ZAS/Turf.dm +++ b/code/ZAS/Turf.dm @@ -5,9 +5,9 @@ /turf/var/datum/gas_mixture/air /turf/simulated/proc/update_graphic(list/graphic_add = null, list/graphic_remove = null) - if(graphic_add && graphic_add.len) + if(LAZYLEN(graphic_add)) overlays += graphic_add - if(graphic_remove && graphic_remove.len) + if(LAZYLEN(graphic_remove)) overlays -= graphic_remove /turf/proc/update_air_properties() diff --git a/code/ZAS/Zone.dm b/code/ZAS/Zone.dm index da39b868d3..18c5ab2899 100644 --- a/code/ZAS/Zone.dm +++ b/code/ZAS/Zone.dm @@ -77,7 +77,8 @@ Class Procs: fire_tiles.Add(T) air_master.active_fire_zones |= src if(fuel) fuel_objs += fuel - T.update_graphic(air.graphic) + if(air.graphic) + T.update_graphic(air.graphic) /zone/proc/remove(turf/simulated/T) #ifdef ZASDBG @@ -92,7 +93,8 @@ Class Procs: var/obj/effect/decal/cleanable/liquid_fuel/fuel = locate() in T fuel_objs -= fuel T.zone = null - T.update_graphic(graphic_remove = air.graphic) + if(air.graphic) + T.update_graphic(graphic_remove = air.graphic) if(contents.len) air.group_multiplier = contents.len else @@ -106,9 +108,11 @@ Class Procs: ASSERT(!into.invalid) #endif c_invalidate() + var/list/air_graphic = air.graphic // Cache for sanic speed for(var/turf/simulated/T in contents) into.add(T) - T.update_graphic(graphic_remove = air.graphic) + if(air_graphic) + T.update_graphic(graphic_remove = air_graphic) #ifdef ZASDBG T.dbg(merged) #endif @@ -131,8 +135,10 @@ Class Procs: /zone/proc/rebuild() if(invalid) return //Short circuit for explosions where rebuild is called many times over. c_invalidate() + var/list/air_graphic = air.graphic // Cache for sanic speed for(var/turf/simulated/T in contents) - T.update_graphic(graphic_remove = air.graphic) //we need to remove the overlays so they're not doubled when the zone is rebuilt + if(air_graphic) + T.update_graphic(graphic_remove = air_graphic) //we need to remove the overlays so they're not doubled when the zone is rebuilt //T.dbg(invalid_zone) T.needs_air_update = 0 //Reset the marker so that it will be added to the list. air_master.mark_for_update(T) diff --git a/code/__defines/MC.dm b/code/__defines/MC.dm new file mode 100644 index 0000000000..fb15a693bf --- /dev/null +++ b/code/__defines/MC.dm @@ -0,0 +1,69 @@ +#define MC_TICK_CHECK ( ( world.tick_usage > Master.current_ticklimit || src.state != SS_RUNNING ) ? pause() : 0 ) + +// Used for splitting up your remaining time into phases, if you want to evenly divide it. +#define MC_SPLIT_TICK_INIT(phase_count) var/original_tick_limit = Master.current_ticklimit; var/split_tick_phases = ##phase_count +#define MC_SPLIT_TICK \ + if(split_tick_phases > 1){\ + Master.current_ticklimit = ((original_tick_limit - world.tick_usage) / split_tick_phases) + world.tick_usage;\ + --split_tick_phases;\ + } else {\ + Master.current_ticklimit = original_tick_limit;\ + } + +// Used to smooth out costs to try and avoid oscillation. +#define MC_AVERAGE_FAST(average, current) (0.7 * (average) + 0.3 * (current)) +#define MC_AVERAGE(average, current) (0.8 * (average) + 0.2 * (current)) +#define MC_AVERAGE_SLOW(average, current) (0.9 * (average) + 0.1 * (current)) +#define NEW_SS_GLOBAL(varname) if(varname != src){if(istype(varname)){Recover();qdel(varname);}varname = src;} + +#define START_PROCESSING(Processor, Datum) if (!Datum.isprocessing) {Datum.isprocessing = 1;Processor.processing += Datum} +#define STOP_PROCESSING(Processor, Datum) Datum.isprocessing = 0;Processor.processing -= Datum + +//SubSystem flags (Please design any new flags so that the default is off, to make adding flags to subsystems easier) + +//subsystem does not initialize. +#define SS_NO_INIT 1 + +//subsystem does not fire. +// (like can_fire = 0, but keeps it from getting added to the processing subsystems list) +// (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 +#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) +// (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 + +//keep the subsystem's timing on point by firing early if it fired late last fire because of lag +// ie: if a 20ds subsystem fires say 5 ds late due to lag or what not, its next fire would be in 15ds, not 20ds. +#define SS_KEEP_TIMING 32 + +//Calculate its next fire after its fired. +// (IE: if a 5ds wait SS takes 2ds to run, its next fire should be 5ds away, not 3ds like it normally would be) +// This flag overrides SS_KEEP_TIMING +#define SS_POST_FIRE_TIMING 64 + +//SUBSYSTEM STATES +#define SS_IDLE 0 //aint doing shit. +#define SS_QUEUED 1 //queued to run +#define SS_RUNNING 2 //actively running +#define SS_PAUSED 3 //paused by mc_tick_check +#define SS_SLEEPING 4 //fire() slept. +#define SS_PAUSING 5 //in the middle of pausing + +// Standard way to define a global subsystem, keep boilerplate organized here! +#define SUBSYSTEM_DEF(X) var/datum/controller/subsystem/##X/SS##X;\ +/datum/controller/subsystem/##X/New(){\ + NEW_SS_GLOBAL(SS##X);\ + PreInit();\ +}\ +/datum/controller/subsystem/##X diff --git a/code/__defines/math.dm b/code/__defines/math.dm new file mode 100644 index 0000000000..0729a4526d --- /dev/null +++ b/code/__defines/math.dm @@ -0,0 +1,10 @@ +//"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(world.tick_usage-starting_tickusage)) + +//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 ( rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : midnight_rollovers ) diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index f85ac5e7d4..12deebbfc1 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -196,3 +196,5 @@ #define TSC_MORPH "Morpheus" #define TSC_XION "Xion" // Not really needed but consistancy I guess. #define TSC_GIL "Gilthari" + +#define MIDNIGHT_ROLLOVER 864000 //number of deciseconds in a day diff --git a/code/__defines/qdel.dm b/code/__defines/qdel.dm new file mode 100644 index 0000000000..168a6adf0c --- /dev/null +++ b/code/__defines/qdel.dm @@ -0,0 +1,17 @@ +//defines that give qdel hints. these can be given as a return in destory() or by calling + +#define QDEL_HINT_QUEUE 0 //qdel should queue the object for deletion. +#define QDEL_HINT_LETMELIVE 1 //qdel should let the object live after calling destory. +#define QDEL_HINT_IWILLGC 2 //functionally the same as the above. qdel should assume the object will gc on its own, and not check it. +#define QDEL_HINT_HARDDEL 3 //qdel should assume this object won't gc, and queue a hard delete using a hard reference. +#define QDEL_HINT_HARDDEL_NOW 4 //qdel should assume this object won't gc, and hard del it post haste. +#define QDEL_HINT_FINDREFERENCE 5 //functionally identical to QDEL_HINT_QUEUE if TESTING is not enabled in _compiler_options.dm. + //if TESTING is enabled, qdel will call this object's find_references() verb. +//defines for the gc_destroyed var + +#define GC_QUEUED_FOR_QUEUING -1 +#define GC_QUEUED_FOR_HARD_DEL -2 +#define GC_CURRENTLY_BEING_QDELETED -3 + +#define QDELETED(X) (!X || X.gc_destroyed) +#define QDESTROYING(X) (!X || X.gc_destroyed == GC_CURRENTLY_BEING_QDELETED) diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm new file mode 100644 index 0000000000..8c546c9135 --- /dev/null +++ b/code/__defines/subsystems.dm @@ -0,0 +1,13 @@ + +// SS runlevels + +#define RUNLEVEL_INIT 0 // "Initialize Only" - Used for subsystems that should never be fired (Should also have SS_NO_FIRE set) +#define RUNLEVEL_LOBBY 1 // Initial runlevel before setup. Returns to here if setup fails. +#define RUNLEVEL_SETUP 2 // While the gamemode setup is running. I.E gameticker.setup() +#define RUNLEVEL_GAME 4 // After successful game ticker setup, while the round is running. +#define RUNLEVEL_POSTGAME 8 // When round completes but before reboot + +#define RUNLEVELS_DEFAULT (RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME) + +var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_GAME, RUNLEVEL_POSTGAME) +#define RUNLEVEL_FLAG_TO_INDEX(flag) (log(2, flag) + 1) // Convert from the runlevel bitfield constants to index in runlevel_flags list diff --git a/code/__defines/tick.dm b/code/__defines/tick.dm new file mode 100644 index 0000000000..4c88fd643e --- /dev/null +++ b/code/__defines/tick.dm @@ -0,0 +1,7 @@ +#define TICK_LIMIT_RUNNING 80 +#define TICK_LIMIT_TO_RUN 78 +#define TICK_LIMIT_MC 70 +#define TICK_LIMIT_MC_INIT_DEFAULT 98 + +#define TICK_CHECK ( world.tick_usage > Master.current_ticklimit ) +#define CHECK_TICK if TICK_CHECK stoplag() diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index b59857c8f6..d7ee78ff8f 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -271,20 +271,22 @@ var/list/hear = dview(range,T,INVISIBILITY_MAXIMUM) var/list/hearturfs = list() - for(var/atom/movable/AM in hear) - if(ismob(AM)) - mobs += AM - hearturfs += AM.locs[1] - else if(isobj(AM)) - objs += AM - hearturfs += AM.locs[1] + for(var/thing in hear) + if(istype(thing,/obj)) + objs += thing + hearturfs += get_turf(thing) + else if(istype(thing,/mob)) + mobs += thing + hearturfs += get_turf(thing) //A list of every mob with a client - for(var/mob/M in player_list) - if(M.loc && M.locs[1] in hearturfs) - mobs |= M + for(var/mob in player_list) + if(get_turf(mob) in hearturfs) + mobs |= mob + continue - else if(M.stat == DEAD && !M.forbid_seeing_deadchat) + var/mob/M = mob + if(M.stat == DEAD && !M.forbid_seeing_deadchat) switch(type) if(1) //Audio messages use ghost_ears if(M.is_preference_enabled(/datum/client_preference/ghost_ears)) @@ -294,9 +296,9 @@ mobs |= M //For objects below the top level who still want to hear - for(var/obj/O in listening_objects) - if(O.loc && O.locs[1] in hearturfs) - objs |= O + for(var/obj in listening_objects) + if(get_turf(obj) in hearturfs) + objs |= obj return list("mobs" = mobs, "objs" = objs) diff --git a/code/_helpers/lists.dm b/code/_helpers/lists.dm index 30df4693db..e647cd1df7 100644 --- a/code/_helpers/lists.dm +++ b/code/_helpers/lists.dm @@ -599,3 +599,66 @@ proc/dd_sortedTextList(list/incoming) for(var/path in subtypesof(prototype)) L += new path() return L + +//creates every subtype of prototype (excluding prototype) and adds it to list L as a type/instance pair. +//if no list/L is provided, one is created. +/proc/init_subtypes_assoc(prototype, list/L) + if(!istype(L)) L = list() + for(var/path in subtypesof(prototype)) + L[path] = new path() + return L + +//Move a single element from position fromIndex within a list, to position toIndex +//All elements in the range [1,toIndex) before the move will be before the pivot afterwards +//All elements in the range [toIndex, L.len+1) before the move will be after the pivot afterwards +//In other words, it's as if the range [fromIndex,toIndex) have been rotated using a <<< operation common to other languages. +//fromIndex and toIndex must be in the range [1,L.len+1] +//This will preserve associations ~Carnie +/proc/moveElement(list/L, fromIndex, toIndex) + if(fromIndex == toIndex || fromIndex+1 == toIndex) //no need to move + return + if(fromIndex > toIndex) + ++fromIndex //since a null will be inserted before fromIndex, the index needs to be nudged right by one + + L.Insert(toIndex, null) + L.Swap(fromIndex, toIndex) + L.Cut(fromIndex, fromIndex+1) + +//Move elements [fromIndex,fromIndex+len) to [toIndex-len, toIndex) +//Same as moveElement but for ranges of elements +//This will preserve associations ~Carnie +/proc/moveRange(list/L, fromIndex, toIndex, len=1) + var/distance = abs(toIndex - fromIndex) + if(len >= distance) //there are more elements to be moved than the distance to be moved. Therefore the same result can be achieved (with fewer operations) by moving elements between where we are and where we are going. The result being, our range we are moving is shifted left or right by dist elements + if(fromIndex <= toIndex) + return //no need to move + fromIndex += len //we want to shift left instead of right + + for(var/i=0, i toIndex) + fromIndex += len + + for(var/i=0, i= 2) + fromIndex = fromIndex % L.len + toIndex = toIndex % (L.len+1) + if(fromIndex <= 0) + fromIndex += L.len + if(toIndex <= 0) + toIndex += L.len + 1 + + sortInstance.L = L + sortInstance.cmp = cmp + sortInstance.associative = associative + + sortInstance.timSort(fromIndex, toIndex) + + return L diff --git a/code/_helpers/sorts/__main.dm b/code/_helpers/sorts/__main.dm new file mode 100644 index 0000000000..622d88f147 --- /dev/null +++ b/code/_helpers/sorts/__main.dm @@ -0,0 +1,656 @@ + //These are macros used to reduce on proc calls +#define fetchElement(L, i) (associative) ? L[L[i]] : L[i] + + //Minimum sized sequence that will be merged. Anything smaller than this will use binary-insertion sort. + //Should be a power of 2 +#define MIN_MERGE 32 + + //When we get into galloping mode, we stay there until both runs win less often than MIN_GALLOP consecutive times. +#define MIN_GALLOP 7 + + //This is a global instance to allow much of this code to be reused. The interfaces are kept separately +var/datum/sortInstance/sortInstance = new() +/datum/sortInstance + //The array being sorted. + var/list/L + + //The comparator proc-reference + var/cmp = /proc/cmp_numeric_asc + + //whether we are sorting list keys (0: L[i]) or associated values (1: L[L[i]]) + var/associative = 0 + + //This controls when we get *into* galloping mode. It is initialized to MIN_GALLOP. + //The mergeLo and mergeHi methods nudge it higher for random data, and lower for highly structured data. + var/minGallop = MIN_GALLOP + + //Stores information regarding runs yet to be merged. + //Run i starts at runBase[i] and extends for runLen[i] elements. + //runBase[i] + runLen[i] == runBase[i+1] + //var/stackSize + var/list/runBases = list() + var/list/runLens = list() + + +/datum/sortInstance/proc/timSort(start, end) + runBases.Cut() + runLens.Cut() + + var/remaining = end - start + + //If array is small, do a 'mini-TimSort' with no merges + if(remaining < MIN_MERGE) + var/initRunLen = countRunAndMakeAscending(start, end) + binarySort(start, end, start+initRunLen) + return + + //March over the array finding natural runs + //Extend any short natural runs to runs of length minRun + var/minRun = minRunLength(remaining) + + do + //identify next run + var/runLen = countRunAndMakeAscending(start, end) + + //if run is short, extend to min(minRun, remaining) + if(runLen < minRun) + var/force = (remaining <= minRun) ? remaining : minRun + + binarySort(start, start+force, start+runLen) + runLen = force + + //add data about run to queue + runBases.Add(start) + runLens.Add(runLen) + + //maybe merge + mergeCollapse() + + //Advance to find next run + start += runLen + remaining -= runLen + + while(remaining > 0) + + + //Merge all remaining runs to complete sort + //ASSERT(start == end) + mergeForceCollapse(); + //ASSERT(runBases.len == 1) + + //reset minGallop, for successive calls + minGallop = MIN_GALLOP + + return L + +/* +Sorts the specified portion of the specified array using a binary +insertion sort. This is the best method for sorting small numbers +of elements. It requires O(n log n) compares, but O(n^2) data +movement (worst case). + +If the initial part of the specified range is already sorted, +this method can take advantage of it: the method assumes that the +elements in range [lo,start) are already sorted + +lo the index of the first element in the range to be sorted +hi the index after the last element in the range to be sorted +start the index of the first element in the range that is not already known to be sorted +*/ +/datum/sortInstance/proc/binarySort(lo, hi, start) + //ASSERT(lo <= start && start <= hi) + if(start <= lo) + start = lo + 1 + + for(,start < hi, ++start) + var/pivot = fetchElement(L,start) + + //set left and right to the index where pivot belongs + var/left = lo + var/right = start + //ASSERT(left <= right) + + //[lo, left) elements <= pivot < [right, start) elements + //in other words, find where the pivot element should go using bisection search + while(left < right) + var/mid = (left + right) >> 1 //round((left+right)/2) + if(call(cmp)(fetchElement(L,mid), pivot) > 0) + right = mid + else + left = mid+1 + + //ASSERT(left == right) + moveElement(L, start, left) //move pivot element to correct location in the sorted range + +/* +Returns the length of the run beginning at the specified position and reverses the run if it is back-to-front + +A run is the longest ascending sequence with: + a[lo] <= a[lo + 1] <= a[lo + 2] <= ... +or the longest descending sequence with: + a[lo] > a[lo + 1] > a[lo + 2] > ... + +For its intended use in a stable mergesort, the strictness of the +definition of "descending" is needed so that the call can safely +reverse a descending sequence without violating stability. +*/ +/datum/sortInstance/proc/countRunAndMakeAscending(lo, hi) + //ASSERT(lo < hi) + + var/runHi = lo + 1 + if(runHi >= hi) + return 1 + + var/last = fetchElement(L,lo) + var/current = fetchElement(L,runHi++) + + if(call(cmp)(current, last) < 0) + while(runHi < hi) + last = current + current = fetchElement(L,runHi) + if(call(cmp)(current, last) >= 0) + break + ++runHi + reverseRange(L, lo, runHi) + else + while(runHi < hi) + last = current + current = fetchElement(L,runHi) + if(call(cmp)(current, last) < 0) + break + ++runHi + + return runHi - lo + +//Returns the minimum acceptable run length for an array of the specified length. +//Natural runs shorter than this will be extended with binarySort +/datum/sortInstance/proc/minRunLength(n) + //ASSERT(n >= 0) + var/r = 0 //becomes 1 if any bits are shifted off + while(n >= MIN_MERGE) + r |= (n & 1) + n >>= 1 + return n + r + +//Examines the stack of runs waiting to be merged and merges adjacent runs until the stack invariants are reestablished: +// runLen[i-3] > runLen[i-2] + runLen[i-1] +// runLen[i-2] > runLen[i-1] +//This method is called each time a new run is pushed onto the stack. +//So the invariants are guaranteed to hold for i= 2) + var/n = runBases.len - 1 + if(n > 1 && runLens[n-1] <= runLens[n] + runLens[n+1]) + if(runLens[n-1] < runLens[n+1]) + --n + mergeAt(n) + else if(runLens[n] <= runLens[n+1]) + mergeAt(n) + else + break //Invariant is established + + +//Merges all runs on the stack until only one remains. +//Called only once, to finalise the sort +/datum/sortInstance/proc/mergeForceCollapse() + while(runBases.len >= 2) + var/n = runBases.len - 1 + if(n > 1 && runLens[n-1] < runLens[n+1]) + --n + mergeAt(n) + + +//Merges the two consecutive runs at stack indices i and i+1 +//Run i must be the penultimate or antepenultimate run on the stack +//In other words, i must be equal to stackSize-2 or stackSize-3 +/datum/sortInstance/proc/mergeAt(i) + //ASSERT(runBases.len >= 2) + //ASSERT(i >= 1) + //ASSERT(i == runBases.len - 1 || i == runBases.len - 2) + + var/base1 = runBases[i] + var/base2 = runBases[i+1] + var/len1 = runLens[i] + var/len2 = runLens[i+1] + + //ASSERT(len1 > 0 && len2 > 0) + //ASSERT(base1 + len1 == base2) + + //Record the legth of the combined runs. If i is the 3rd last run now, also slide over the last run + //(which isn't involved in this merge). The current run (i+1) goes away in any case. + runLens[i] += runLens[i+1] + runLens.Cut(i+1, i+2) + runBases.Cut(i+1, i+2) + + + //Find where the first element of run2 goes in run1. + //Prior elements in run1 can be ignored (because they're already in place) + var/k = gallopRight(fetchElement(L,base2), base1, len1, 0) + //ASSERT(k >= 0) + base1 += k + len1 -= k + if(len1 == 0) + return + + //Find where the last element of run1 goes in run2. + //Subsequent elements in run2 can be ignored (because they're already in place) + len2 = gallopLeft(fetchElement(L,base1 + len1 - 1), base2, len2, len2-1) + //ASSERT(len2 >= 0) + if(len2 == 0) + return + + //Merge remaining runs, using tmp array with min(len1, len2) elements + if(len1 <= len2) + mergeLo(base1, len1, base2, len2) + else + mergeHi(base1, len1, base2, len2) + + +/* + Locates the position to insert key within the specified sorted range + If the range contains elements equal to key, this will return the index of the LEFTMOST of those elements + + key the element to be inserted into the sorted range + base the index of the first element of the sorted range + len the length of the sorted range, must be greater than 0 + hint the offset from base at which to begin the search, such that 0 <= hint < len; i.e. base <= hint < base+hint + + Returns the index at which to insert element 'key' +*/ +/datum/sortInstance/proc/gallopLeft(key, base, len, hint) + //ASSERT(len > 0 && hint >= 0 && hint < len) + + var/lastOffset = 0 + var/offset = 1 + if(call(cmp)(key, fetchElement(L,base+hint)) > 0) + var/maxOffset = len - hint + while(offset < maxOffset && call(cmp)(key, fetchElement(L,base+hint+offset)) > 0) + lastOffset = offset + offset = (offset << 1) + 1 + + if(offset > maxOffset) + offset = maxOffset + + lastOffset += hint + offset += hint + + else + var/maxOffset = hint + 1 + while(offset < maxOffset && call(cmp)(key, fetchElement(L,base+hint-offset)) <= 0) + lastOffset = offset + offset = (offset << 1) + 1 + + if(offset > maxOffset) + offset = maxOffset + + var/temp = lastOffset + lastOffset = hint - offset + offset = hint - temp + + //ASSERT(-1 <= lastOffset && lastOffset < offset && offset <= len) + + //Now L[base+lastOffset] < key <= L[base+offset], so key belongs somewhere to the right of lastOffset but no farther than + //offset. Do a binary search with invariant L[base+lastOffset-1] < key <= L[base+offset] + ++lastOffset + while(lastOffset < offset) + var/m = lastOffset + ((offset - lastOffset) >> 1) + + if(call(cmp)(key, fetchElement(L,base+m)) > 0) + lastOffset = m + 1 + else + offset = m + + //ASSERT(lastOffset == offset) + return offset + +/** + * Like gallopLeft, except that if the range contains an element equal to + * key, gallopRight returns the index after the rightmost equal element. + * + * @param key the key whose insertion point to search for + * @param a the array in which to search + * @param base the index of the first element in the range + * @param len the length of the range; must be > 0 + * @param hint the index at which to begin the search, 0 <= hint < n. + * The closer hint is to the result, the faster this method will run. + * @param c the comparator used to order the range, and to search + * @return the int k, 0 <= k <= n such that a[b + k - 1] <= key < a[b + k] + */ +/datum/sortInstance/proc/gallopRight(key, base, len, hint) + //ASSERT(len > 0 && hint >= 0 && hint < len) + + var/offset = 1 + var/lastOffset = 0 + if(call(cmp)(key, fetchElement(L,base+hint)) < 0) //key <= L[base+hint] + var/maxOffset = hint + 1 //therefore we want to insert somewhere in the range [base,base+hint] = [base+,base+(hint+1)) + while(offset < maxOffset && call(cmp)(key, fetchElement(L,base+hint-offset)) < 0) //we are iterating backwards + lastOffset = offset + offset = (offset << 1) + 1 //1 3 7 15 + //if(offset <= 0) //int overflow, not an issue here since we are using floats + // offset = maxOffset + + if(offset > maxOffset) + offset = maxOffset + + var/temp = lastOffset + lastOffset = hint - offset + offset = hint - temp + + else //key > L[base+hint] + var/maxOffset = len - hint //therefore we want to insert somewhere in the range (base+hint,base+len) = [base+hint+1, base+hint+(len-hint)) + while(offset < maxOffset && call(cmp)(key, fetchElement(L,base+hint+offset)) >= 0) + lastOffset = offset + offset = (offset << 1) + 1 + //if(offset <= 0) //int overflow, not an issue here since we are using floats + // offset = maxOffset + + if(offset > maxOffset) + offset = maxOffset + + lastOffset += hint + offset += hint + + //ASSERT(-1 <= lastOffset && lastOffset < offset && offset <= len) + + ++lastOffset + while(lastOffset < offset) + var/m = lastOffset + ((offset - lastOffset) >> 1) + + if(call(cmp)(key, fetchElement(L,base+m)) < 0) //key <= L[base+m] + offset = m + else //key > L[base+m] + lastOffset = m + 1 + + //ASSERT(lastOffset == offset) + + return offset + + +//Merges two adjacent runs in-place in a stable fashion. +//For performance this method should only be called when len1 <= len2! +/datum/sortInstance/proc/mergeLo(base1, len1, base2, len2) + //ASSERT(len1 > 0 && len2 > 0 && base1 + len1 == base2) + + var/cursor1 = base1 + var/cursor2 = base2 + + //degenerate cases + if(len2 == 1) + moveElement(L, cursor2, cursor1) + return + + if(len1 == 1) + moveElement(L, cursor1, cursor2+len2) + return + + + //Move first element of second run + moveElement(L, cursor2++, cursor1++) + --len2 + + outer: + while(1) + var/count1 = 0 //# of times in a row that first run won + var/count2 = 0 // " " " " " " second run won + + //do the straightfoward thin until one run starts winning consistently + + do + //ASSERT(len1 > 1 && len2 > 0) + if(call(cmp)(fetchElement(L,cursor2), fetchElement(L,cursor1)) < 0) + moveElement(L, cursor2++, cursor1++) + --len2 + + ++count2 + count1 = 0 + + if(len2 == 0) + break outer + else + ++cursor1 + + ++count1 + count2 = 0 + + if(--len1 == 1) + break outer + + while((count1 | count2) < minGallop) + + + //one run is winning consistently so galloping may provide huge benifits + //so try galloping, until such time as the run is no longer consistently winning + do + //ASSERT(len1 > 1 && len2 > 0) + + count1 = gallopRight(fetchElement(L,cursor2), cursor1, len1, 0) + if(count1) + cursor1 += count1 + len1 -= count1 + + if(len1 <= 1) + break outer + + moveElement(L, cursor2, cursor1) + ++cursor2 + ++cursor1 + if(--len2 == 0) + break outer + + count2 = gallopLeft(fetchElement(L,cursor1), cursor2, len2, 0) + if(count2) + moveRange(L, cursor2, cursor1, count2) + + cursor2 += count2 + cursor1 += count2 + len2 -= count2 + + if(len2 == 0) + break outer + + ++cursor1 + if(--len1 == 1) + break outer + + --minGallop + + while((count1|count2) > MIN_GALLOP) + + if(minGallop < 0) + minGallop = 0 + minGallop += 2; // Penalize for leaving gallop mode + + + if(len1 == 1) + //ASSERT(len2 > 0) + moveElement(L, cursor1, cursor2+len2) + + //else + //ASSERT(len2 == 0) + //ASSERT(len1 > 1) + + +/datum/sortInstance/proc/mergeHi(base1, len1, base2, len2) + //ASSERT(len1 > 0 && len2 > 0 && base1 + len1 == base2) + + var/cursor1 = base1 + len1 - 1 //start at end of sublists + var/cursor2 = base2 + len2 - 1 + + //degenerate cases + if(len2 == 1) + moveElement(L, base2, base1) + return + + if(len1 == 1) + moveElement(L, base1, cursor2+1) + return + + moveElement(L, cursor1--, cursor2-- + 1) + --len1 + + outer: + while(1) + var/count1 = 0 //# of times in a row that first run won + var/count2 = 0 // " " " " " " second run won + + //do the straightfoward thing until one run starts winning consistently + do + //ASSERT(len1 > 0 && len2 > 1) + if(call(cmp)(fetchElement(L,cursor2), fetchElement(L,cursor1)) < 0) + moveElement(L, cursor1--, cursor2-- + 1) + --len1 + + ++count1 + count2 = 0 + + if(len1 == 0) + break outer + else + --cursor2 + --len2 + + ++count2 + count1 = 0 + + if(len2 == 1) + break outer + while((count1 | count2) < minGallop) + + //one run is winning consistently so galloping may provide huge benifits + //so try galloping, until such time as the run is no longer consistently winning + do + //ASSERT(len1 > 0 && len2 > 1) + + count1 = len1 - gallopRight(fetchElement(L,cursor2), base1, len1, len1-1) //should cursor1 be base1? + if(count1) + cursor1 -= count1 + + moveRange(L, cursor1+1, cursor2+1, count1) //cursor1+1 == cursor2 by definition + + cursor2 -= count1 + len1 -= count1 + + if(len1 == 0) + break outer + + --cursor2 + + if(--len2 == 1) + break outer + + count2 = len2 - gallopLeft(fetchElement(L,cursor1), cursor1+1, len2, len2-1) + if(count2) + cursor2 -= count2 + len2 -= count2 + + if(len2 <= 1) + break outer + + moveElement(L, cursor1--, cursor2-- + 1) + --len1 + + if(len1 == 0) + break outer + + --minGallop + while((count1|count2) > MIN_GALLOP) + + if(minGallop < 0) + minGallop = 0 + minGallop += 2 // Penalize for leaving gallop mode + + if(len2 == 1) + //ASSERT(len1 > 0) + + cursor1 -= len1 + moveRange(L, cursor1+1, cursor2+1, len1) + + //else + //ASSERT(len1 == 0) + //ASSERT(len2 > 0) + + +/datum/sortInstance/proc/mergeSort(start, end) + var/remaining = end - start + + //If array is small, do an insertion sort + if(remaining < MIN_MERGE) + //var/initRunLen = countRunAndMakeAscending(start, end) + binarySort(start, end, start/*+initRunLen*/) + return + + var/minRun = minRunLength(remaining) + + do + var/runLen = (remaining <= minRun) ? remaining : minRun + + binarySort(start, start+runLen, start) + + //add data about run to queue + runBases.Add(start) + runLens.Add(runLen) + + //Advance to find next run + start += runLen + remaining -= runLen + + while(remaining > 0) + + while(runBases.len >= 2) + var/n = runBases.len - 1 + if(n > 1 && runLens[n-1] <= runLens[n] + runLens[n+1]) + if(runLens[n-1] < runLens[n+1]) + --n + mergeAt2(n) + else if(runLens[n] <= runLens[n+1]) + mergeAt2(n) + else + break //Invariant is established + + while(runBases.len >= 2) + var/n = runBases.len - 1 + if(n > 1 && runLens[n-1] < runLens[n+1]) + --n + mergeAt2(n) + + return L + +/datum/sortInstance/proc/mergeAt2(i) + var/cursor1 = runBases[i] + var/cursor2 = runBases[i+1] + + var/end1 = cursor1+runLens[i] + var/end2 = cursor2+runLens[i+1] + + var/val1 = fetchElement(L,cursor1) + var/val2 = fetchElement(L,cursor2) + + while(1) + if(call(cmp)(val1,val2) < 0) + if(++cursor1 >= end1) + break + val1 = fetchElement(L,cursor1) + else + moveElement(L,cursor2,cursor1) + + ++cursor2 + if(++cursor2 >= end2) + break + ++end1 + ++cursor1 + //if(++cursor1 >= end1) + // break + + val2 = fetchElement(L,cursor2) + + + //Record the legth of the combined runs. If i is the 3rd last run now, also slide over the last run + //(which isn't involved in this merge). The current run (i+1) goes away in any case. + runLens[i] += runLens[i+1] + runLens.Cut(i+1, i+2) + runBases.Cut(i+1, i+2) + +#undef MIN_GALLOP +#undef MIN_MERGE + +#undef fetchElement diff --git a/code/_helpers/sorts/comparators.dm b/code/_helpers/sorts/comparators.dm new file mode 100644 index 0000000000..8c1f954a00 --- /dev/null +++ b/code/_helpers/sorts/comparators.dm @@ -0,0 +1,20 @@ +// +// Comparators for use with /datum/sortInstance (or wherever you want) +// They should return negative, zero, or positive numbers for a < b, a == b, and a > b respectively. +// + +// Sorts numeric ascending +/proc/cmp_numeric_asc(a,b) + return a - b + +// Sorts subsystems alphabetically +/proc/cmp_subsystem_display(datum/controller/subsystem/a, datum/controller/subsystem/b) + return sorttext(b.name, a.name) + +// Sorts subsystems by init_order +/proc/cmp_subsystem_init(datum/controller/subsystem/a, datum/controller/subsystem/b) + return b.init_order - a.init_order + +// Sorts subsystems by priority +/proc/cmp_subsystem_priority(datum/controller/subsystem/a, datum/controller/subsystem/b) + return a.priority - b.priority diff --git a/code/_helpers/time.dm b/code/_helpers/time.dm index 991d64e20b..3a6bcedcd1 100644 --- a/code/_helpers/time.dm +++ b/code/_helpers/time.dm @@ -100,4 +100,24 @@ var/round_start_time = 0 /hook/startup/proc/set_roundstart_hour() roundstart_hour = pick(2,7,12,17) - return 1 \ No newline at end of file + return 1 + +/var/midnight_rollovers = 0 +/var/rollovercheck_last_timeofday = 0 +/proc/update_midnight_rollover() + if (world.timeofday < rollovercheck_last_timeofday) //TIME IS GOING BACKWARDS! + return midnight_rollovers++ + return midnight_rollovers + +//Increases delay as the server gets more overloaded, +//as sleeps aren't cheap and sleeping only to wake up and sleep again is wasteful +#define DELTA_CALC max(((max(world.tick_usage, world.cpu) / 100) * max(Master.sleep_delta,1)), 1) + +/proc/stoplag() + . = 0 + var/i = 1 + do + . += round(i*DELTA_CALC) + sleep(i*world.tick_lag*DELTA_CALC) + i *= 2 + while (world.tick_usage > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit)) diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 6fa9d4ec0c..63bac6e134 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -1157,12 +1157,22 @@ proc/is_hot(obj/item/W as obj) istype(W, /obj/item/weapon/surgical/bonesetter) ) -//check if mob is lying down on something we can operate him on. +// check if mob is lying down on something we can operate him on. +// The RNG with table/rollerbeds comes into play in do_surgery() so that fail_step() can be used instead. /proc/can_operate(mob/living/carbon/M) - return (M.lying && \ - locate(/obj/machinery/optable, M.loc) || \ - (locate(/obj/structure/bed/roller, M.loc) && prob(75)) || \ - (locate(/obj/structure/table/, M.loc) && prob(66))) + return M.lying + +// Returns an instance of a valid surgery surface. +/mob/living/proc/get_surgery_surface() + if(!lying) + return null // Not lying down means no surface. + var/obj/surface = null + for(var/obj/O in loc) // Looks for the best surface. + if(O.surgery_odds) + if(!surface || surface.surgery_odds < O) + surface = O + if(surface) + return surface /proc/reverse_direction(var/dir) switch(dir) @@ -1284,6 +1294,13 @@ var/mob/dview/dview_mob = new else living_mob_list -= src +/mob/dview/Destroy(var/force) + crash_with("Attempt to delete the dview_mob: [log_info_line(src)]") + if (!force) + return QDEL_HINT_LETMELIVE + global.dview_mob = new + return ..() + // call to generate a stack trace and print to runtime logs /proc/crash_with(msg) CRASH(msg) diff --git a/code/_macros.dm b/code/_macros.dm index 463a7da26d..a3e4065544 100644 --- a/code/_macros.dm +++ b/code/_macros.dm @@ -49,5 +49,38 @@ #define RANDOM_BLOOD_TYPE pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+") #define to_chat(target, message) target << message +#define to_world(message) world << message +#define to_world_log(message) world.log << message +// TODO - Baystation has this log to crazy places. For now lets just world.log, but maybe look into it later. +#define log_world(message) world.log << message + #define CanInteract(user, state) (CanUseTopic(user, state) == STATUS_INTERACTIVE) + +#define qdel_null_list(x) if(x) { for(var/y in x) { qdel(y) } ; x = null } + +#define qdel_null(x) if(x) { qdel(x) ; x = null } + +#define ARGS_DEBUG log_debug("[__FILE__] - [__LINE__]") ; for(var/arg in args) { log_debug("\t[log_info_line(arg)]") } + +// Helper macros to aid in optimizing lazy instantiation of lists. +// All of these are null-safe, you can use them without knowing if the list var is initialized yet + +//Picks from the list, with some safeties, and returns the "default" arg if it fails +#define DEFAULTPICK(L, default) ((istype(L, /list) && L:len) ? pick(L) : default) +// Ensures L is initailized after this point +#define LAZYINITLIST(L) if (!L) L = list() +// Sets a L back to null iff it is empty +#define UNSETEMPTY(L) if (L && !L.len) L = null +// Removes I from list L, and sets I to null if it is now empty +#define LAZYREMOVE(L, I) if(L) { L -= I; if(!L.len) { L = null; } } +// Adds I to L, initalizing I if necessary +#define LAZYADD(L, I) if(!L) { L = list(); } L += I; +// Reads I from L safely - Works with both associative and traditional lists. +#define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= L.len ? L[I] : null) : L[I]) : null) +// Reads the length of L, returning 0 if null +#define LAZYLEN(L) length(L) +// Null-safe L.Cut() +#define LAZYCLEARLIST(L) if(L) L.Cut() +// Reads L or an empty list if L is not a list. Note: Does NOT assign, L may be an expression. +#define SANITIZE_LIST(L) ( islist(L) ? L : list() ) diff --git a/code/_onclick/drag_drop.dm b/code/_onclick/drag_drop.dm index 42a0574f4d..65974fe009 100644 --- a/code/_onclick/drag_drop.dm +++ b/code/_onclick/drag_drop.dm @@ -5,6 +5,16 @@ recieving object instead, so that's the default action. This allows you to drag almost anything into a trash can. */ + +/atom/proc/CanMouseDrop(atom/over, var/mob/user = usr) + if(!user || !over) + return FALSE + if(user.incapacitated()) + return FALSE + if(!src.Adjacent(user) || !over.Adjacent(user)) + return FALSE // should stop you from dragging through windows + return TRUE + /atom/MouseDrop(atom/over) if(!usr || !over) return if(!Adjacent(usr) || !over.Adjacent(usr)) return // should stop you from dragging through windows diff --git a/code/_onclick/hud/ability_screen_objects.dm b/code/_onclick/hud/ability_screen_objects.dm index 2081e011b3..d29ef9dd96 100644 --- a/code/_onclick/hud/ability_screen_objects.dm +++ b/code/_onclick/hud/ability_screen_objects.dm @@ -20,7 +20,7 @@ message_admins("ERROR: ability_master's New() was not given an owner argument. This is a bug.") /obj/screen/movable/ability_master/Destroy() - ..() + . = ..() //Get rid of the ability objects. remove_all_abilities() ability_objects.Cut() diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action.dm index 9781e9c236..7e03151fd6 100644 --- a/code/_onclick/hud/action.dm +++ b/code/_onclick/hud/action.dm @@ -30,6 +30,9 @@ /datum/action/Destroy() if(owner) Remove(owner) + target = null + qdel_null(button) + return ..() /datum/action/proc/Grant(mob/living/T) if(owner) @@ -45,7 +48,7 @@ if(button) if(T.client) T.client.screen -= button - del(button) + qdel_null(button) T.actions.Remove(src) T.update_action_buttons() owner = null diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 45c6f7e277..0f6990f681 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -155,7 +155,7 @@ datum/hud/New(mob/owner) ..() /datum/hud/Destroy() - ..() + . = ..() grab_intent = null hurt_intent = null disarm_intent = null diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index e55323fb3a..35ef300978 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -46,7 +46,7 @@ var/obj/item/owner /obj/screen/item_action/Destroy() - ..() + . = ..() owner = null /obj/screen/item_action/Click() diff --git a/code/_onclick/hud/spell_screen_objects.dm b/code/_onclick/hud/spell_screen_objects.dm index a599381730..e79db28713 100644 --- a/code/_onclick/hud/spell_screen_objects.dm +++ b/code/_onclick/hud/spell_screen_objects.dm @@ -13,7 +13,7 @@ var/mob/spell_holder /obj/screen/movable/spell_master/Destroy() - ..() + . = ..() for(var/obj/screen/spell/spells in spell_objects) spells.spellmaster = null spell_objects.Cut() @@ -156,7 +156,7 @@ var/icon/last_charged_icon /obj/screen/spell/Destroy() - ..() + . = ..() spell = null last_charged_icon = null if(spellmaster) diff --git a/code/controllers/ProcessScheduler/core/process.dm b/code/controllers/ProcessScheduler/core/process.dm index 323c5f7663..9f08241978 100644 --- a/code/controllers/ProcessScheduler/core/process.dm +++ b/code/controllers/ProcessScheduler/core/process.dm @@ -35,7 +35,6 @@ * Config vars */ // Process name - var/name // Process schedule interval // This controls how often the process would run under ideal conditions. @@ -388,6 +387,6 @@ exceptions[eid] = 0 /datum/controller/process/proc/catchBadType(var/datum/caught) - if(isnull(caught) || !istype(caught) || !isnull(caught.gcDestroyed)) + if(isnull(caught) || !istype(caught) || QDELETED(caught)) return // Only bother with types we can identify and that don't belong catchException("Type [caught.type] does not belong in process' queue") diff --git a/code/controllers/Processes/garbage.dm b/code/controllers/Processes/garbage.dm deleted file mode 100644 index 02f0411332..0000000000 --- a/code/controllers/Processes/garbage.dm +++ /dev/null @@ -1,254 +0,0 @@ -// The time a datum was destroyed by the GC, or null if it hasn't been -/datum/var/gcDestroyed - -#define GC_COLLECTIONS_PER_RUN 300 -#define GC_COLLECTION_TIMEOUT (30 SECONDS) -#define GC_FORCE_DEL_PER_RUN 30 - -var/datum/controller/process/garbage_collector/garbage_collector -var/list/delayed_garbage = list() - -/datum/controller/process/garbage_collector - var/garbage_collect = 1 // Whether or not to actually do work - var/total_dels = 0 // number of total del()'s - var/tick_dels = 0 // number of del()'s we've done this tick - var/soft_dels = 0 - var/hard_dels = 0 // number of hard dels in total - var/list/destroyed = list() // list of refID's of things that should be garbage collected - // refID's are associated with the time at which they time out and need to be manually del() - // we do this so we aren't constantly locating them and preventing them from being gc'd - - var/list/logging = list() // list of all types that have failed to GC associated with the number of times that's happened. - // the types are stored as strings - -/datum/controller/process/garbage_collector/setup() - name = "garbage" - schedule_interval = 5 SECONDS - start_delay = 3 - - if(!garbage_collector) - garbage_collector = src - - for(var/garbage in delayed_garbage) - qdel(garbage) - delayed_garbage.Cut() - delayed_garbage = null - -#ifdef GC_FINDREF -world/loop_checks = 0 -#endif - -/datum/controller/process/garbage_collector/doWork() - if(!garbage_collect) - return - - tick_dels = 0 - var/time_to_kill = world.time - GC_COLLECTION_TIMEOUT - var/checkRemain = GC_COLLECTIONS_PER_RUN - var/remaining_force_dels = GC_FORCE_DEL_PER_RUN - - - while(destroyed.len && --checkRemain >= 0) - if(remaining_force_dels <= 0) - #ifdef GC_DEBUG - testing("GC: Reached max force dels per tick [dels] vs [maxDels]") - #endif - break // Server's already pretty pounded, everything else can wait 2 seconds - var/refID = destroyed[1] - var/GCd_at_time = destroyed[refID] - if(GCd_at_time > time_to_kill) - #ifdef GC_DEBUG - testing("GC: [refID] not old enough, breaking at [world.time] for [GCd_at_time - time_to_kill] deciseconds until [GCd_at_time + collection_timeout]") - #endif - break // Everything else is newer, skip them - var/datum/A = locate(refID) - #ifdef GC_DEBUG - testing("GC: [refID] old enough to test: GCd_at_time: [GCd_at_time] time_to_kill: [time_to_kill] current: [world.time]") - #endif - if(A && A.gcDestroyed == GCd_at_time) // So if something else coincidently gets the same ref, it's not deleted by mistake - // Something's still referring to the qdel'd object. Kill it. - testing("GC: -- \ref[A] | [A.type] was unable to be GC'd and was deleted --") - logging["[A.type]"]++ - del(A) - - hard_dels++ - remaining_force_dels-- - else - #ifdef GC_DEBUG - testing("GC: [refID] properly GC'd at [world.time] with timeout [GCd_at_time]") - #endif - soft_dels++ - tick_dels++ - total_dels++ - destroyed.Cut(1, 2) - SCHECK - -#undef GC_FORCE_DEL_PER_TICK -#undef GC_COLLECTION_TIMEOUT -#undef GC_COLLECTIONS_PER_TICK - -#ifdef GC_FINDREF -/datum/controller/process/garbage_collector/proc/LookForRefs(var/datum/D, var/list/targ) - . = 0 - for(var/V in D.vars) - if(V == "contents") - continue - if(istype(D.vars[V], /atom)) - var/atom/A = D.vars[V] - if(A in targ) - testing("GC: [A] | [A.type] referenced by [D] | [D.type], var [V]") - . += 1 - else if(islist(D.vars[V])) - . += LookForListRefs(D.vars[V], targ, D, V) - -/datum/controller/process/garbage_collector/proc/LookForListRefs(var/list/L, var/list/targ, var/datum/D, var/V) - . = 0 - for(var/F in L) - if(istype(F, /atom)) - var/atom/A = F - if(A in targ) - testing("GC: [A] | [A.type] referenced by [D] | [D.type], list [V]") - . += 1 - if(islist(F)) - . += LookForListRefs(F, targ, D, "[F] in list [V]") -#endif - -/datum/controller/process/garbage_collector/proc/AddTrash(datum/A) - if(!istype(A) || !isnull(A.gcDestroyed)) - return - #ifdef GC_DEBUG - testing("GC: AddTrash(\ref[A] - [A.type])") - #endif - A.gcDestroyed = world.time - destroyed -= "\ref[A]" // Removing any previous references that were GC'd so that the current object will be at the end of the list. - destroyed["\ref[A]"] = world.time - -/datum/controller/process/garbage_collector/statProcess() - ..() - stat(null, "[garbage_collect ? "On" : "Off"], [destroyed.len] queued") - stat(null, "Dels: [total_dels], [soft_dels] soft, [hard_dels] hard, [tick_dels] last run") - - -// Tests if an atom has been deleted. -/proc/deleted(atom/A) - return !A || !isnull(A.gcDestroyed) - -// Should be treated as a replacement for the 'del' keyword. -// Datums passed to this will be given a chance to clean up references to allow the GC to collect them. -/proc/qdel(var/datum/A) - if(!A) - return - if(!istype(A)) - warning("qdel() passed object of type [A.type]. qdel() can only handle /datum types.") - crash_with("qdel() passed object of type [A.type]. qdel() can only handle /datum types.") - del(A) - if(garbage_collector) - garbage_collector.total_dels++ - garbage_collector.hard_dels++ - else if(isnull(A.gcDestroyed)) - // Let our friend know they're about to get collected - . = !A.Destroy() - if(. && A) - A.finalize_qdel() - -/datum/proc/finalize_qdel() - del(src) - -/atom/finalize_qdel() - if(garbage_collector) - garbage_collector.AddTrash(src) - else - delayed_garbage |= src - -/icon/finalize_qdel() - del(src) - -/image/finalize_qdel() - del(src) - -/mob/finalize_qdel() - del(src) - -/turf/finalize_qdel() - del(src) - -// Default implementation of clean-up code. -// This should be overridden to remove all references pointing to the object being destroyed. -// Return true if the the GC controller should allow the object to continue existing. -/datum/proc/Destroy() - nanomanager.close_uis(src) - tag = null - return - -#ifdef TESTING -/client/var/running_find_references - -/mob/verb/create_thing() - set category = "Debug" - set name = "Create Thing" - - var/path = input("Enter path") - var/atom/thing = new path(loc) - thing.find_references() - -/atom/verb/find_references() - set category = "Debug" - set name = "Find References" - set background = 1 - set src in world - - if(!usr || !usr.client) - return - - if(usr.client.running_find_references) - testing("CANCELLED search for references to a [usr.client.running_find_references].") - usr.client.running_find_references = null - return - - if(alert("Running this will create a lot of lag until it finishes. You can cancel it by running it again. Would you like to begin the search?", "Find References", "Yes", "No") == "No") - return - - // Remove this object from the list of things to be auto-deleted. - if(garbage_collector) - garbage_collector.destroyed -= "\ref[src]" - - usr.client.running_find_references = type - testing("Beginning search for references to a [type].") - var/list/things = list() - for(var/client/thing) - things += thing - for(var/datum/thing) - things += thing - for(var/atom/thing) - things += thing - testing("Collected list of things in search for references to a [type]. ([things.len] Thing\s)") - for(var/datum/thing in things) - if(!usr.client.running_find_references) return - for(var/varname in thing.vars) - var/variable = thing.vars[varname] - if(variable == src) - testing("Found [src.type] \ref[src] in [thing.type]'s [varname] var.") - else if(islist(variable)) - if(src in variable) - testing("Found [src.type] \ref[src] in [thing.type]'s [varname] list var.") - testing("Completed search for references to a [type].") - usr.client.running_find_references = null - -/client/verb/purge_all_destroyed_objects() - set category = "Debug" - if(garbage_collector) - while(garbage_collector.destroyed.len) - var/datum/o = locate(garbage_collector.destroyed[1]) - if(istype(o) && o.gcDestroyed) - del(o) - garbage_collector.dels++ - garbage_collector.destroyed.Cut(1, 2) -#endif - -#ifdef GC_DEBUG -#undef GC_DEBUG -#endif - -#ifdef GC_FINDREF -#undef GC_FINDREF -#endif \ No newline at end of file diff --git a/code/controllers/Processes/machinery.dm b/code/controllers/Processes/machinery.dm index 405615dc1f..1fd1f8ce45 100644 --- a/code/controllers/Processes/machinery.dm +++ b/code/controllers/Processes/machinery.dm @@ -20,7 +20,7 @@ /datum/controller/process/machinery/proc/internal_process_machinery() for(last_object in machines) var/obj/machinery/M = last_object - if(M && !M.gcDestroyed) + if(M && !QDELETED(M)) if(M.process() == PROCESS_KILL) //M.inMachineList = 0 We don't use this debugging function machines.Remove(M) @@ -34,7 +34,7 @@ /datum/controller/process/machinery/proc/internal_process_power() for(last_object in powernets) var/datum/powernet/powerNetwork = last_object - if(istype(powerNetwork) && isnull(powerNetwork.gcDestroyed)) + if(istype(powerNetwork) && !QDELETED(powerNetwork)) powerNetwork.reset() SCHECK continue @@ -52,7 +52,7 @@ /datum/controller/process/machinery/proc/internal_process_pipenets() for(last_object in pipe_networks) var/datum/pipe_network/pipeNetwork = last_object - if(istype(pipeNetwork) && isnull(pipeNetwork.gcDestroyed)) + if(istype(pipeNetwork) && !QDELETED(pipeNetwork)) pipeNetwork.process() SCHECK continue diff --git a/code/controllers/Processes/mob.dm b/code/controllers/Processes/mob.dm index 8681803ac4..6b623e7730 100644 --- a/code/controllers/Processes/mob.dm +++ b/code/controllers/Processes/mob.dm @@ -14,7 +14,7 @@ /datum/controller/process/mob/doWork() for(last_object in mob_list) var/mob/M = last_object - if(M && isnull(M.gcDestroyed)) + if(M && !QDELETED(M)) try M.Life() catch(var/exception/e) diff --git a/code/controllers/Processes/nanoui.dm b/code/controllers/Processes/nanoui.dm index 49b9048c07..21d2f8e5f0 100644 --- a/code/controllers/Processes/nanoui.dm +++ b/code/controllers/Processes/nanoui.dm @@ -9,7 +9,7 @@ /datum/controller/process/nanoui/doWork() for(last_object in nanomanager.processing_uis) var/datum/nanoui/NUI = last_object - if(istype(NUI) && isnull(NUI.gcDestroyed)) + if(istype(NUI) && !QDELETED(NUI)) try NUI.process() catch(var/exception/e) diff --git a/code/controllers/Processes/obj.dm b/code/controllers/Processes/obj.dm index 1010c8cc97..6032cbb541 100644 --- a/code/controllers/Processes/obj.dm +++ b/code/controllers/Processes/obj.dm @@ -11,7 +11,7 @@ /datum/controller/process/obj/doWork() for(last_object in processing_objects) var/datum/O = last_object - if(O && isnull(O.gcDestroyed)) + if(!QDELETED(O)) try O:process() catch(var/exception/e) diff --git a/code/controllers/Processes/radiation.dm b/code/controllers/Processes/radiation.dm new file mode 100644 index 0000000000..71d9c60233 --- /dev/null +++ b/code/controllers/Processes/radiation.dm @@ -0,0 +1,56 @@ +/datum/controller/process/radiation + var/repository/radiation/linked = null + +/datum/controller/process/radiation/setup() + name = "radiation controller" + schedule_interval = 20 // every 2 seconds + linked = radiation_repository + +/datum/controller/process/radiation/doWork() + sources_decay() + cache_expires() + irradiate_targets() + +// Step 1 - Sources Decay +/datum/controller/process/radiation/proc/sources_decay() + var/list/sources = linked.sources + for(var/thing in sources) + var/datum/radiation_source/S = thing + if(QDELETED(S)) + sources.Remove(S) + continue + if(S.decay) + S.update_rad_power(S.rad_power - config.radiation_decay_rate) + if(S.rad_power <= config.radiation_lower_limit) + sources.Remove(S) + SCHECK // This scheck probably just wastes resources, but better safe than sorry in this case. + +// Step 2 - Cache Expires +/datum/controller/process/radiation/proc/cache_expires() + var/list/resistance_cache = linked.resistance_cache + for(var/thing in resistance_cache) + var/turf/T = thing + if(QDELETED(T)) + resistance_cache.Remove(T) + continue + if((length(T.contents) + 1) != resistance_cache[T]) + resistance_cache.Remove(T) // If its stale REMOVE it! It will get added if its needed. + SCHECK + +// Step 3 - Registered irradiatable things are checked for radiation +/datum/controller/process/radiation/proc/irradiate_targets() + var/list/registered_listeners = living_mob_list // For now just use this. Nothing else is interested anyway. + if(length(linked.sources) > 0) + for(var/thing in registered_listeners) + var/atom/A = thing + if(QDELETED(A)) + continue + var/turf/T = get_turf(thing) + var/rads = linked.get_rads_at_turf(T) + if(rads) + A.rad_act(rads) + SCHECK + +/datum/controller/process/radiation/statProcess() + ..() + stat(null, "[linked.sources.len] sources, [linked.resistance_cache.len] cached turfs") diff --git a/code/controllers/Processes/scheduler.dm b/code/controllers/Processes/scheduler.dm index 276249bd55..6031f2f4fe 100644 --- a/code/controllers/Processes/scheduler.dm +++ b/code/controllers/Processes/scheduler.dm @@ -30,8 +30,8 @@ // Note: We won't be informed about tasks being destroyed, but this is the best we can do. /datum/controller/process/scheduler/copyStateFrom(var/datum/controller/process/scheduler/target) scheduled_tasks = list() - for(var/st in target.scheduled_tasks) - if(!deleted(st) && istype(st, /datum/scheduled_task)) + for(var/datum/scheduled_task/st in target.scheduled_tasks) + if(!QDELETED(st) && istype(st)) schedule(st) scheduler = src @@ -46,12 +46,9 @@ /datum/controller/process/scheduler/proc/schedule(var/datum/scheduled_task/st) scheduled_tasks += st - destroyed_event.register(st, src, /datum/controller/process/scheduler/proc/unschedule) /datum/controller/process/scheduler/proc/unschedule(var/datum/scheduled_task/st) - if(st in scheduled_tasks) - scheduled_tasks -= st - destroyed_event.unregister(st, src) + scheduled_tasks -= st /********** * Helpers * @@ -102,6 +99,7 @@ task_after_process_args += src /datum/scheduled_task/Destroy() + scheduler.unschedule(src) procedure = null arguments.Cut() task_after_process = null diff --git a/code/controllers/Processes/ticker.dm b/code/controllers/Processes/ticker.dm index b7c45ba91a..a70bb74c5f 100644 --- a/code/controllers/Processes/ticker.dm +++ b/code/controllers/Processes/ticker.dm @@ -33,3 +33,10 @@ var/global/datum/controller/process/ticker/tickerProcess /datum/controller/process/ticker/proc/getLastTickerTimeDuration() return lastTickerTimeDuration + +// Use these preferentially to directly examining ticker.current_state to help prepare for transition to ticker as subsystem! +/datum/controller/process/ticker/proc/HasRoundStarted() + return (ticker && ticker.current_state >= GAME_STATE_PLAYING) + +/datum/controller/process/ticker/proc/IsRoundInProgress() + return (ticker && ticker.current_state == GAME_STATE_PLAYING) diff --git a/code/controllers/communications.dm b/code/controllers/communications.dm index 796fb0b664..332ab9af52 100644 --- a/code/controllers/communications.dm +++ b/code/controllers/communications.dm @@ -314,7 +314,6 @@ var/global/datum/controller/radio/radio_controller devices_line -= null if (devices_line.len==0) devices -= devices_filter - del(devices_line) /datum/signal var/obj/source diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 5021453462..b985c5680b 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -46,7 +46,8 @@ var/list/gamemode_cache = list() var/continous_rounds = 0 // Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke. var/allow_Metadata = 0 // Metadata is supported. var/popup_admin_pm = 0 //adminPMs to non-admins show in a pop-up 'reply' window when set to 1. - var/Ticklag = 0.9 + var/fps = 20 + var/tick_limit_mc_init = TICK_LIMIT_MC_INIT_DEFAULT //SSinitialization throttling var/Tickcomp = 0 var/socket_talk = 0 // use socket_talk to communicate with other processes var/list/resource_urls = null @@ -219,6 +220,10 @@ var/list/gamemode_cache = list() var/show_human_death_message = 1 + var/radiation_decay_rate = 1 //How much radiation is reduced by each tick + var/radiation_resistance_multiplier = 6.5 + var/radiation_lower_limit = 0.35 //If the radiation level for a turf would be below this, ignore it. + /datum/configuration/New() var/list/L = typesof(/datum/game_mode) - /datum/game_mode for (var/T in L) @@ -564,7 +569,12 @@ var/list/gamemode_cache = list() irc_bot_export = 1 if("ticklag") - Ticklag = text2num(value) + var/ticklag = text2num(value) + if(ticklag > 0) + fps = 10 / ticklag + + if("tick_limit_mc_init") + tick_limit_mc_init = text2num(value) if("allow_antag_hud") config.antag_hud_allowed = 1 @@ -716,6 +726,9 @@ var/list/gamemode_cache = list() if(values.len > 0) language_prefixes = values + if("radiation_lower_limit") + radiation_lower_limit = text2num(value) + else log_misc("Unknown setting in configuration: '[name]'") diff --git a/code/controllers/controller.dm b/code/controllers/controller.dm new file mode 100644 index 0000000000..c9d5f1e565 --- /dev/null +++ b/code/controllers/controller.dm @@ -0,0 +1,19 @@ +/datum/controller + var/name + // The object used for the clickable stat() button. + var/obj/effect/statclick/statclick + +/datum/controller/proc/Initialize() + +//cleanup actions +/datum/controller/proc/Shutdown() + +//when we enter dmm_suite.load_map +/datum/controller/proc/StartLoadingMap() + +//when we exit dmm_suite.load_map +/datum/controller/proc/StopLoadingMap() + +/datum/controller/proc/Recover() + +/datum/controller/proc/stat_entry() diff --git a/code/controllers/emergency_shuttle_controller.dm b/code/controllers/emergency_shuttle_controller.dm index 5b1b6a60d1..7fb3a56c61 100644 --- a/code/controllers/emergency_shuttle_controller.dm +++ b/code/controllers/emergency_shuttle_controller.dm @@ -22,6 +22,10 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle var/datum/announcement/priority/emergency_shuttle_called = new(0, new_sound = sound('sound/AI/shuttlecalled.ogg')) var/datum/announcement/priority/emergency_shuttle_recalled = new(0, new_sound = sound('sound/AI/shuttlerecalled.ogg')) +/datum/emergency_shuttle_controller/New() + escape_pods = list() + ..() + /datum/emergency_shuttle_controller/proc/process() if (wait_for_launch) if (evac && auto_recall && world.time >= auto_recall_time) diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm new file mode 100644 index 0000000000..0589d5fa7f --- /dev/null +++ b/code/controllers/failsafe.dm @@ -0,0 +1,102 @@ + /** + * Failsafe + * + * Pretty much pokes the MC to make sure it's still alive. + **/ + +var/datum/controller/failsafe/Failsafe + +/datum/controller/failsafe // This thing pretty much just keeps poking the master controller + name = "Failsafe" + + // The length of time to check on the MC (in deciseconds). + // Set to 0 to disable. + var/processing_interval = 20 + // The alert level. For every failed poke, we drop a DEFCON level. Once we hit DEFCON 1, restart the MC. + var/defcon = 5 + //the world.time of the last check, so the mc can restart US if we hang. + // (Real friends look out for *eachother*) + var/lasttick = 0 + + // Track the MC iteration to make sure its still on track. + var/master_iteration = 0 + var/running = TRUE + +/datum/controller/failsafe/New() + // Highlander-style: there can only be one! Kill off the old and replace it with the new. + if(Failsafe != src) + if(istype(Failsafe)) + qdel(Failsafe) + Failsafe = src + Initialize() + +/datum/controller/failsafe/Initialize() + set waitfor = 0 + Failsafe.Loop() + if(!QDELETED(src)) + qdel(src) //when Loop() returns, we delete ourselves and let the mc recreate us + +/datum/controller/failsafe/Destroy() + running = FALSE + ..() + return QDEL_HINT_HARDDEL_NOW + +/datum/controller/failsafe/proc/Loop() + while(running) + lasttick = world.time + if(!Master) + // Replace the missing Master! This should never, ever happen. + new /datum/controller/master() + // Only poke it if overrides are not in effect. + if(processing_interval > 0) + if(Master.processing && Master.iteration) + // Check if processing is done yet. + if(Master.iteration == master_iteration) + switch(defcon) + if(4,5) + --defcon + if(3) + to_chat(admins, "Notice: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5-defcon) * processing_interval] ticks.") + --defcon + if(2) + to_chat(admins, "Warning: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5-defcon) * processing_interval] ticks. Automatic restart in [processing_interval] ticks.") + --defcon + if(1) + + to_chat(admins, "Warning: DEFCON [defcon_pretty()]. The Master Controller has still not fired within the last [(5-defcon) * processing_interval] ticks. Killing and restarting...") + --defcon + var/rtn = Recreate_MC() + if(rtn > 0) + defcon = 4 + master_iteration = 0 + to_chat(admins, "MC restarted successfully") + else if(rtn < 0) + log_game("FailSafe: Could not restart MC, runtime encountered. Entering defcon 0") + to_chat(admins, "ERROR: DEFCON [defcon_pretty()]. Could not restart MC, runtime encountered. I will silently keep retrying.") + //if the return number was 0, it just means the mc was restarted too recently, and it just needs some time before we try again + //no need to handle that specially when defcon 0 can handle it + if(0) //DEFCON 0! (mc failed to restart) + var/rtn = Recreate_MC() + if(rtn > 0) + defcon = 4 + master_iteration = 0 + to_chat(admins, "MC restarted successfully") + else + defcon = min(defcon + 1,5) + master_iteration = Master.iteration + if (defcon <= 1) + sleep(processing_interval*2) + else + sleep(processing_interval) + else + defcon = 5 + sleep(initial(processing_interval)) + +/datum/controller/failsafe/proc/defcon_pretty() + return defcon + +/datum/controller/failsafe/stat_entry() + if(!statclick) + statclick = new/obj/effect/statclick/debug(null, "Initializing...", src) + + stat("Failsafe Controller:", statclick.update("Defcon: [defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])")) diff --git a/code/controllers/master.dm b/code/controllers/master.dm new file mode 100644 index 0000000000..7c2bc86a65 --- /dev/null +++ b/code/controllers/master.dm @@ -0,0 +1,556 @@ + /** + * StonedMC + * + * Designed to properly split up a given tick among subsystems + * Note: if you read parts of this code and think "why is it doing it that way" + * Odds are, there is a reason + * + **/ +var/datum/controller/master/Master = new() + +/datum/controller/master + name = "Master" + + // Are we processing (higher values increase the processing delay by n ticks) + var/processing = 1 + // How many times have we ran + var/iteration = 0 + + // world.time of last fire, for tracking lag outside of the mc + var/last_run + + // List of subsystems to process(). + var/list/subsystems + + // Vars for keeping track of tick drift. + var/init_timeofday + var/init_time + var/tickdrift = 0 + + var/sleep_delta + + var/make_runtime = 0 + + var/initializations_finished_with_no_players_logged_in //I wonder what this could be? + + // The type of the last subsystem to be process()'d. + var/last_type_processed + + var/datum/controller/subsystem/queue_head //Start of queue linked list + var/datum/controller/subsystem/queue_tail //End of queue linked list (used for appending to the list) + var/queue_priority_count = 0 //Running total so that we don't have to loop thru the queue each run to split up the tick + var/queue_priority_count_bg = 0 //Same, but for background subsystems + var/map_loading = FALSE //Are we loading in a new map? + + var/current_runlevel //for scheduling different subsystems for different stages of the round + + var/static/restart_clear = 0 + var/static/restart_timeout = 0 + var/static/restart_count = 0 + + //current tick limit, assigned before running a subsystem. + //used by CHECK_TICK as well so that the procs subsystems call can obey that SS's tick limits + var/static/current_ticklimit = TICK_LIMIT_RUNNING + +/datum/controller/master/New() + // Highlander-style: there can only be one! Kill off the old and replace it with the new. + subsystems = list() + if (Master != src) + if (istype(Master)) + Recover() + qdel(Master) + else + init_subtypes(/datum/controller/subsystem, subsystems) + Master = src + +/datum/controller/master/Destroy() + ..() + // Tell qdel() to Del() this object. + return QDEL_HINT_HARDDEL_NOW + +/datum/controller/master/Shutdown() + processing = FALSE + sortTim(subsystems, /proc/cmp_subsystem_init) + reverseRange(subsystems) + for(var/datum/controller/subsystem/ss in subsystems) + ss.Shutdown() + +// Returns 1 if we created a new mc, 0 if we couldn't due to a recent restart, +// -1 if we encountered a runtime trying to recreate it +/proc/Recreate_MC() + . = -1 //so if we runtime, things know we failed + if (world.time < Master.restart_timeout) + return 0 + if (world.time < Master.restart_clear) + Master.restart_count *= 0.5 + + var/delay = 50 * ++Master.restart_count + Master.restart_timeout = world.time + delay + Master.restart_clear = world.time + (delay * 2) + Master.processing = 0 //stop ticking this one + try + new/datum/controller/master() + catch + return -1 + return 1 + + +/datum/controller/master/Recover() + var/msg = "## DEBUG: [time2text(world.timeofday)] MC restarted. Reports:\n" + for (var/varname in Master.vars) + switch (varname) + if("name", "tag", "bestF", "type", "parent_type", "vars", "statclick") // Built-in junk. + continue + else + var/varval = Master.vars[varname] + if (istype(varval, /datum)) // Check if it has a type var. + var/datum/D = varval + msg += "\t [varname] = [D]([D.type])\n" + else + msg += "\t [varname] = [varval]\n" + log_world(msg) + + var/datum/controller/subsystem/BadBoy = Master.last_type_processed + var/FireHim = FALSE + if(istype(BadBoy)) + msg = null + switch(++BadBoy.failure_strikes) + if(2) + msg = "The [BadBoy.name] subsystem was the last to fire for 2 controller restarts. It will be recovered now and disabled if it happens again." + FireHim = TRUE + if(3) + msg = "The [BadBoy.name] subsystem seems to be destabilizing the MC and will be offlined." + BadBoy.flags |= SS_NO_FIRE + if(msg) + log_game(msg) + message_admins("[msg]") + log_world(msg) + + if (istype(Master.subsystems)) + if(FireHim) + Master.subsystems += new BadBoy.type //NEW_SS_GLOBAL will remove the old one + subsystems = Master.subsystems + current_runlevel = Master.current_runlevel + StartProcessing(10) + else + to_chat(world, "The Master Controller is having some issues, we will need to re-initialize EVERYTHING") + Initialize(20, TRUE) + + +// Please don't stuff random bullshit here, +// Make a subsystem, give it the SS_NO_FIRE flag, and do your work in it's Initialize() +/datum/controller/master/Initialize(delay, init_sss) + set waitfor = 0 + + if(delay) + sleep(delay) + + if(init_sss) + init_subtypes(/datum/controller/subsystem, subsystems) + + to_chat(world, "Initializing subsystems...") + + // Sort subsystems by init_order, so they initialize in the correct order. + sortTim(subsystems, /proc/cmp_subsystem_init) + + var/start_timeofday = REALTIMEOFDAY + // Initialize subsystems. + current_ticklimit = config.tick_limit_mc_init + for (var/datum/controller/subsystem/SS in subsystems) + if (SS.flags & SS_NO_INIT) + continue + SS.Initialize(REALTIMEOFDAY) + CHECK_TICK + current_ticklimit = TICK_LIMIT_RUNNING + var/time = (REALTIMEOFDAY - start_timeofday) / 10 + + var/msg = "Initializations complete within [time] second[time == 1 ? "" : "s"]!" + to_chat(world, "[msg]") + log_world(msg) + + if (!current_runlevel) + SetRunLevel(RUNLEVEL_LOBBY) + + // Sort subsystems by display setting for easy access. + sortTim(subsystems, /proc/cmp_subsystem_display) + // Set world options. + #ifdef UNIT_TEST + world.sleep_offline = 0 + #else + world.sleep_offline = 1 + #endif + world.fps = config.fps + var/initialized_tod = REALTIMEOFDAY + sleep(1) + initializations_finished_with_no_players_logged_in = initialized_tod < REALTIMEOFDAY - 10 + // Loop. + Master.StartProcessing(0) + +/datum/controller/master/proc/SetRunLevel(new_runlevel) + var/old_runlevel = isnull(current_runlevel) ? "NULL" : runlevel_flags[current_runlevel] + testing("MC: Runlevel changed from [old_runlevel] to [new_runlevel]") + current_runlevel = RUNLEVEL_FLAG_TO_INDEX(new_runlevel) + if(current_runlevel < 1) + CRASH("Attempted to set invalid runlevel: [new_runlevel]") + +// Starts the mc, and sticks around to restart it if the loop ever ends. +/datum/controller/master/proc/StartProcessing(delay) + set waitfor = 0 + if(delay) + sleep(delay) + var/rtn = Loop() + if (rtn > 0 || processing < 0) + return //this was suppose to happen. + //loop ended, restart the mc + log_game("MC crashed or runtimed, restarting") + message_admins("MC crashed or runtimed, restarting") + var/rtn2 = Recreate_MC() + if (rtn2 <= 0) + log_game("Failed to recreate MC (Error code: [rtn2]), it's up to the failsafe now") + message_admins("Failed to recreate MC (Error code: [rtn2]), it's up to the failsafe now") + Failsafe.defcon = 2 + +// Main loop. +/datum/controller/master/proc/Loop() + . = -1 + //Prep the loop (most of this is because we want MC restarts to reset as much state as we can, and because + // local vars rock + + //all this shit is here so that flag edits can be refreshed by restarting the MC. (and for speed) + var/list/tickersubsystems = list() + var/list/runlevel_sorted_subsystems = list(list()) //ensure we always have at least one runlevel + var/timer = world.time + for (var/thing in subsystems) + var/datum/controller/subsystem/SS = thing + if (SS.flags & SS_NO_FIRE) + continue + SS.queued_time = 0 + SS.queue_next = null + SS.queue_prev = null + SS.state = SS_IDLE + if (SS.flags & SS_TICKER) + tickersubsystems += SS + timer += world.tick_lag * rand(1, 5) + SS.next_fire = timer + continue + + var/ss_runlevels = SS.runlevels + var/added_to_any = FALSE + for(var/I in 1 to global.runlevel_flags.len) + if(ss_runlevels & global.runlevel_flags[I]) + while(runlevel_sorted_subsystems.len < I) + runlevel_sorted_subsystems += list(list()) + runlevel_sorted_subsystems[I] += SS + added_to_any = TRUE + if(!added_to_any) + WARNING("[SS.name] subsystem is not SS_NO_FIRE but also does not have any runlevels set!") + + queue_head = null + queue_tail = null + //these sort by lower priorities first to reduce the number of loops needed to add subsequent SS's to the queue + //(higher subsystems will be sooner in the queue, adding them later in the loop means we don't have to loop thru them next queue add) + sortTim(tickersubsystems, /proc/cmp_subsystem_priority) + for(var/I in runlevel_sorted_subsystems) + sortTim(runlevel_sorted_subsystems, /proc/cmp_subsystem_priority) + I += tickersubsystems + + var/cached_runlevel = current_runlevel + var/list/current_runlevel_subsystems = runlevel_sorted_subsystems[cached_runlevel] + + init_timeofday = REALTIMEOFDAY + init_time = world.time + + iteration = 1 + var/error_level = 0 + var/sleep_delta = 0 + var/list/subsystems_to_check + //the actual loop. + while (1) + tickdrift = max(0, MC_AVERAGE_FAST(tickdrift, (((REALTIMEOFDAY - init_timeofday) - (world.time - init_time)) / world.tick_lag))) + if (processing <= 0) + current_ticklimit = TICK_LIMIT_RUNNING + sleep(10) + continue + + //if there are mutiple sleeping procs running before us hogging the cpu, we have to run later + // because sleeps are processed in the order received, so longer sleeps are more likely to run first + if (world.tick_usage > TICK_LIMIT_MC) + sleep_delta += 2 + current_ticklimit = TICK_LIMIT_RUNNING * 0.5 + sleep(world.tick_lag * (processing + sleep_delta)) + continue + + sleep_delta = MC_AVERAGE_FAST(sleep_delta, 0) + if (last_run + (world.tick_lag * processing) > world.time) + sleep_delta += 1 + if (world.tick_usage > (TICK_LIMIT_MC*0.5)) + sleep_delta += 1 + + if (make_runtime) + var/datum/controller/subsystem/SS + SS.can_fire = 0 + if (!Failsafe || (Failsafe.processing_interval > 0 && (Failsafe.lasttick+(Failsafe.processing_interval*5)) < world.time)) + new/datum/controller/failsafe() // (re)Start the failsafe. + if (!queue_head || !(iteration % 3)) + var/checking_runlevel = current_runlevel + if(cached_runlevel != checking_runlevel) + //resechedule subsystems + cached_runlevel = checking_runlevel + current_runlevel_subsystems = runlevel_sorted_subsystems[cached_runlevel] + var/stagger = world.time + for(var/I in current_runlevel_subsystems) + var/datum/controller/subsystem/SS = I + if(SS.next_fire <= world.time) + stagger += world.tick_lag * rand(1, 5) + SS.next_fire = stagger + + subsystems_to_check = current_runlevel_subsystems + else + subsystems_to_check = tickersubsystems + if (CheckQueue(subsystems_to_check) <= 0) + if (!SoftReset(tickersubsystems, runlevel_sorted_subsystems)) + log_world("MC: SoftReset() failed, crashing") + return + if (!error_level) + iteration++ + error_level++ + current_ticklimit = TICK_LIMIT_RUNNING + sleep(10) + continue + + if (queue_head) + if (RunQueue() <= 0) + if (!SoftReset(tickersubsystems, runlevel_sorted_subsystems)) + log_world("MC: SoftReset() failed, crashing") + return + if (!error_level) + iteration++ + error_level++ + current_ticklimit = TICK_LIMIT_RUNNING + sleep(10) + continue + error_level-- + if (!queue_head) //reset the counts if the queue is empty, in the off chance they get out of sync + queue_priority_count = 0 + queue_priority_count_bg = 0 + + iteration++ + last_run = world.time + src.sleep_delta = MC_AVERAGE_FAST(src.sleep_delta, sleep_delta) + current_ticklimit = TICK_LIMIT_RUNNING - (TICK_LIMIT_RUNNING * 0.25) //reserve the tail 1/4 of the next tick for the mc. + sleep(world.tick_lag * (processing + sleep_delta)) + + + + +// This is what decides if something should run. +/datum/controller/master/proc/CheckQueue(list/subsystemstocheck) + . = 0 //so the mc knows if we runtimed + + //we create our variables outside of the loops to save on overhead + var/datum/controller/subsystem/SS + var/SS_flags + + for (var/thing in subsystemstocheck) + if (!thing) + subsystemstocheck -= thing + SS = thing + if (SS.state != SS_IDLE) + continue + if (SS.can_fire <= 0) + continue + if (SS.next_fire > world.time) + continue + SS_flags = SS.flags + if (SS_flags & SS_NO_FIRE) + subsystemstocheck -= SS + continue + if (!(SS_flags & SS_TICKER) && (SS_flags & SS_KEEP_TIMING) && SS.last_fire + (SS.wait * 0.75) > world.time) + continue + SS.enqueue() + . = 1 + + +// Run thru the queue of subsystems to run, running them while balancing out their allocated tick precentage +/datum/controller/master/proc/RunQueue() + . = 0 + var/datum/controller/subsystem/queue_node + var/queue_node_flags + var/queue_node_priority + var/queue_node_paused + + var/current_tick_budget + var/tick_precentage + var/tick_remaining + var/ran = TRUE //this is right + var/ran_non_ticker = FALSE + var/bg_calc //have we swtiched current_tick_budget to background mode yet? + var/tick_usage + + //keep running while we have stuff to run and we haven't gone over a tick + // this is so subsystems paused eariler can use tick time that later subsystems never used + while (ran && queue_head && world.tick_usage < TICK_LIMIT_MC) + ran = FALSE + bg_calc = FALSE + current_tick_budget = queue_priority_count + queue_node = queue_head + while (queue_node) + if (ran && world.tick_usage > TICK_LIMIT_RUNNING) + break + + queue_node_flags = queue_node.flags + queue_node_priority = queue_node.queued_priority + + //super special case, subsystems where we can't make them pause mid way through + //if we can't run them this tick (without going over a tick) + //we bump up their priority and attempt to run them next tick + //(unless we haven't even ran anything this tick, since its unlikely they will ever be able run + // 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 - world.tick_usage && ran_non_ticker) + queue_node.queued_priority += queue_priority_count * 0.10 + 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) + current_tick_budget = queue_priority_count_bg + bg_calc = TRUE + + tick_remaining = TICK_LIMIT_RUNNING - world.tick_usage + + if (current_tick_budget > 0 && queue_node_priority > 0) + tick_precentage = tick_remaining / (current_tick_budget / queue_node_priority) + else + tick_precentage = tick_remaining + + current_ticklimit = world.tick_usage + tick_precentage + + if (!(queue_node_flags & SS_TICKER)) + ran_non_ticker = TRUE + ran = TRUE + tick_usage = world.tick_usage + queue_node_paused = (queue_node.state == SS_PAUSED || queue_node.state == SS_PAUSING) + last_type_processed = queue_node + + queue_node.state = SS_RUNNING + + var/state = queue_node.ignite(queue_node_paused) + if (state == SS_RUNNING) + state = SS_IDLE + current_tick_budget -= queue_node_priority + tick_usage = world.tick_usage - tick_usage + + if (tick_usage < 0) + tick_usage = 0 + + queue_node.state = state + + if (state == SS_PAUSED) + queue_node.paused_ticks++ + queue_node.paused_tick_usage += tick_usage + queue_node = queue_node.queue_next + continue + + queue_node.ticks = MC_AVERAGE(queue_node.ticks, queue_node.paused_ticks) + tick_usage += queue_node.paused_tick_usage + + queue_node.tick_usage = MC_AVERAGE_FAST(queue_node.tick_usage, tick_usage) + + queue_node.cost = MC_AVERAGE_FAST(queue_node.cost, TICK_DELTA_TO_MS(tick_usage)) + queue_node.paused_ticks = 0 + queue_node.paused_tick_usage = 0 + + if (queue_node_flags & SS_BACKGROUND) //update our running total + queue_priority_count_bg -= queue_node_priority + else + queue_priority_count -= queue_node_priority + + queue_node.last_fire = world.time + queue_node.times_fired++ + + if (queue_node_flags & SS_TICKER) + queue_node.next_fire = world.time + (world.tick_lag * queue_node.wait) + else if (queue_node_flags & SS_POST_FIRE_TIMING) + queue_node.next_fire = world.time + queue_node.wait + else if (queue_node_flags & SS_KEEP_TIMING) + queue_node.next_fire += queue_node.wait + else + queue_node.next_fire = queue_node.queued_time + queue_node.wait + + queue_node.queued_time = 0 + + //remove from queue + queue_node.dequeue() + + queue_node = queue_node.queue_next + + . = 1 + +//resets the queue, and all subsystems, while filtering out the subsystem lists +// called if any mc's queue procs runtime or exit improperly. +/datum/controller/master/proc/SoftReset(list/ticker_SS, list/runlevel_SS) + . = 0 + log_world("MC: SoftReset called, resetting MC queue state.") + if (!istype(subsystems) || !istype(ticker_SS) || !istype(runlevel_SS)) + log_world("MC: SoftReset: Bad list contents: '[subsystems]' '[ticker_SS]' '[runlevel_SS]'") + return + var/subsystemstocheck = subsystems + ticker_SS + for(var/I in runlevel_SS) + subsystemstocheck |= I + + for (var/thing in subsystemstocheck) + var/datum/controller/subsystem/SS = thing + if (!SS || !istype(SS)) + //list(SS) is so if a list makes it in the subsystem list, we remove the list, not the contents + subsystems -= list(SS) + ticker_SS -= list(SS) + for(var/I in runlevel_SS) + I -= list(SS) + log_world("MC: SoftReset: Found bad entry in subsystem list, '[SS]'") + continue + if (SS.queue_next && !istype(SS.queue_next)) + log_world("MC: SoftReset: Found bad data in subsystem queue, queue_next = '[SS.queue_next]'") + SS.queue_next = null + if (SS.queue_prev && !istype(SS.queue_prev)) + log_world("MC: SoftReset: Found bad data in subsystem queue, queue_prev = '[SS.queue_prev]'") + SS.queue_prev = null + SS.queued_priority = 0 + SS.queued_time = 0 + SS.state = SS_IDLE + if (queue_head && !istype(queue_head)) + log_world("MC: SoftReset: Found bad data in subsystem queue, queue_head = '[queue_head]'") + queue_head = null + if (queue_tail && !istype(queue_tail)) + log_world("MC: SoftReset: Found bad data in subsystem queue, queue_tail = '[queue_tail]'") + queue_tail = null + queue_priority_count = 0 + queue_priority_count_bg = 0 + log_world("MC: SoftReset: Finished.") + . = 1 + + + +/datum/controller/master/stat_entry() + if(!statclick) + statclick = new/obj/effect/statclick/debug(null, "Initializing...", src) + + stat("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))") + stat("Master Controller:", statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration])")) + +/datum/controller/master/StartLoadingMap() + //disallow more than one map to load at once, multithreading it will just cause race conditions + while(map_loading) + stoplag() + for(var/S in subsystems) + var/datum/controller/subsystem/SS = S + SS.StartLoadingMap() + map_loading = TRUE + +/datum/controller/master/StopLoadingMap(bounds = null) + map_loading = FALSE + for(var/S in subsystems) + var/datum/controller/subsystem/SS = S + SS.StopLoadingMap() diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 62209a1014..c2d04d9c93 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -2,6 +2,10 @@ //It ensures master_controller.process() is never doubled up by killing the MC (hence terminating any of its sleeping procs) //WIP, needs lots of work still +// +// TODO - This will be completely replaced by master.dm in time. +// + var/global/datum/controller/game_controller/master_controller //Set in world.New() var/global/controller_iteration = 0 @@ -31,8 +35,6 @@ datum/controller/game_controller/New() if(!syndicate_code_response) syndicate_code_response = generate_code_phrase() datum/controller/game_controller/proc/setup() - world.tick_lag = config.Ticklag - spawn(20) createRandomZlevel() @@ -47,7 +49,7 @@ datum/controller/game_controller/proc/setup_objects() admin_notice("Initializing objects", R_DEBUG) sleep(-1) for(var/atom/movable/object in world) - if(isnull(object.gcDestroyed)) + if(!QDELETED(object)) object.initialize() admin_notice("Initializing areas", R_DEBUG) @@ -78,8 +80,8 @@ datum/controller/game_controller/proc/setup_objects() admin_notice("Initializing turbolifts", R_DEBUG) for(var/thing in turbolifts) - if(!deleted(thing)) - var/obj/turbolift_map_holder/lift = thing + var/obj/turbolift_map_holder/lift = thing + if(!QDELETED(lift)) lift.initialize() sleep(-1) diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index c95e4f242f..d881a65a4a 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -15,8 +15,13 @@ var/global/datum/shuttle_controller/shuttle_controller //This is called by gameticker after all the machines and radio frequencies have been properly initialized /datum/shuttle_controller/proc/setup_shuttle_docks() - for(var/shuttle_tag in shuttles) - var/datum/shuttle/shuttle = shuttles[shuttle_tag] +// for(var/shuttle_tag in shuttles) +// var/datum/shuttle/shuttle = shuttles[shuttle_tag] + for(var/shuttle_type in subtypesof(/datum/shuttle)) + var/datum/shuttle/shuttle = shuttle_type + if(initial(shuttle.category) == shuttle_type) + continue + shuttle = new shuttle() shuttle.init_docking_controllers() shuttle.dock() //makes all shuttles docked to something at round start go into the docked state @@ -28,311 +33,3 @@ var/global/datum/shuttle_controller/shuttle_controller shuttles = list() process_shuttles = list() - var/datum/shuttle/ferry/shuttle - - // Escape shuttle and pods - shuttle = new/datum/shuttle/ferry/emergency() - shuttle.location = 1 - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/shuttle/escape/centcom) - shuttle.area_station = locate(/area/shuttle/escape/station) - shuttle.area_transition = locate(/area/shuttle/escape/transit) - shuttle.docking_controller_tag = "escape_shuttle" - shuttle.dock_target_station = "escape_dock" - shuttle.dock_target_offsite = "centcom_dock" - shuttle.transit_direction = NORTH - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN - //shuttle.docking_controller_tag = "supply_shuttle" - //shuttle.dock_target_station = "cargo_bay" - shuttles["Escape"] = shuttle - process_shuttles += shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/escape_pod1/station) - shuttle.area_offsite = locate(/area/shuttle/escape_pod1/centcom) - shuttle.area_transition = locate(/area/shuttle/escape_pod1/transit) - shuttle.docking_controller_tag = "escape_pod_1" - shuttle.dock_target_station = "escape_pod_1_berth" - shuttle.dock_target_offsite = "escape_pod_1_recovery" - shuttle.transit_direction = NORTH - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Escape Pod 1"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/escape_pod2/station) - shuttle.area_offsite = locate(/area/shuttle/escape_pod2/centcom) - shuttle.area_transition = locate(/area/shuttle/escape_pod2/transit) - shuttle.docking_controller_tag = "escape_pod_2" - shuttle.dock_target_station = "escape_pod_2_berth" - shuttle.dock_target_offsite = "escape_pod_2_recovery" - shuttle.transit_direction = NORTH - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Escape Pod 2"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/escape_pod3/station) - shuttle.area_offsite = locate(/area/shuttle/escape_pod3/centcom) - shuttle.area_transition = locate(/area/shuttle/escape_pod3/transit) - shuttle.docking_controller_tag = "escape_pod_3" - shuttle.dock_target_station = "escape_pod_3_berth" - shuttle.dock_target_offsite = "escape_pod_3_recovery" - shuttle.transit_direction = NORTH - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Escape Pod 3"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/escape_pod4/station) - shuttle.area_offsite = locate(/area/shuttle/escape_pod4/centcom) - shuttle.area_transition = locate(/area/shuttle/escape_pod4/transit) - shuttle.docking_controller_tag = "escape_pod_4" - shuttle.dock_target_station = "escape_pod_4_berth" - shuttle.dock_target_offsite = "escape_pod_4_recovery" - shuttle.transit_direction = NORTH //should this be SOUTH? I have no idea. - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Escape Pod 4"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/escape_pod5/station) - shuttle.area_offsite = locate(/area/shuttle/escape_pod5/centcom) - shuttle.area_transition = locate(/area/shuttle/escape_pod5/transit) - shuttle.docking_controller_tag = "escape_pod_5" - shuttle.dock_target_station = "escape_pod_5_berth" - shuttle.dock_target_offsite = "escape_pod_5_recovery" - shuttle.transit_direction = NORTH //should this be WEST? I have no idea. - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Escape Pod 5"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/escape_pod6/station) - shuttle.area_offsite = locate(/area/shuttle/escape_pod6/centcom) - shuttle.area_transition = locate(/area/shuttle/escape_pod6/transit) - shuttle.docking_controller_tag = "escape_pod_6" - shuttle.dock_target_station = "escape_pod_6_berth" - shuttle.dock_target_offsite = "escape_pod_6_recovery" - shuttle.transit_direction = NORTH //should this be WEST? I have no idea. - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Escape Pod 6"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/cryo/station) - shuttle.area_offsite = locate(/area/shuttle/cryo/centcom) - shuttle.area_transition = locate(/area/shuttle/cryo/transit) - shuttle.docking_controller_tag = "cryostorage_shuttle" - shuttle.dock_target_station = "cryostorage_shuttle_berth" - shuttle.dock_target_offsite = "cryostorage_shuttle_recovery" - shuttle.transit_direction = NORTH //should this be WEST? I have no idea. - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Cryostorage Shuttle"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/large_escape_pod1/station) - shuttle.area_offsite = locate(/area/shuttle/large_escape_pod1/centcom) - shuttle.area_transition = locate(/area/shuttle/large_escape_pod1/transit) - shuttle.docking_controller_tag = "large_escape_pod_1" - shuttle.dock_target_station = "large_escape_pod_1_berth" - shuttle.dock_target_offsite = "large_escape_pod_1_recovery" - shuttle.transit_direction = EAST //should this be WEST? I have no idea. - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Large Escape Pod 1"] = shuttle - - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/large_escape_pod2/station) - shuttle.area_offsite = locate(/area/shuttle/large_escape_pod2/centcom) - shuttle.area_transition = locate(/area/shuttle/large_escape_pod2/transit) - shuttle.docking_controller_tag = "large_escape_pod_2" - shuttle.dock_target_station = "large_escape_pod_2_berth" - shuttle.dock_target_offsite = "large_escape_pod_2_recovery" - shuttle.transit_direction = EAST //should this be WEST? I have no idea. - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Large Escape Pod 2"] = shuttle - - //give the emergency shuttle controller it's shuttles - emergency_shuttle.shuttle = shuttles["Escape"] - emergency_shuttle.escape_pods = list( - shuttles["Escape Pod 1"], - shuttles["Escape Pod 2"], - shuttles["Escape Pod 3"], - shuttles["Escape Pod 4"], - shuttles["Escape Pod 5"], - shuttles["Escape Pod 6"], - shuttles["Cryostorage Shuttle"], - shuttles["Large Escape Pod 1"], - shuttles["Large Escape Pod 2"], - ) - - // Supply shuttle - shuttle = new/datum/shuttle/ferry/supply() - shuttle.location = 1 - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/supply/dock) - shuttle.area_station = locate(/area/supply/station) - shuttle.docking_controller_tag = "supply_shuttle" - shuttle.dock_target_station = "cargo_bay" - shuttles["Supply"] = shuttle - process_shuttles += shuttle - - supply_controller.shuttle = shuttle - - // Admin shuttles. - shuttle = new() - shuttle.location = 1 - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/shuttle/transport1/centcom) - shuttle.area_station = locate(/area/shuttle/transport1/station) - shuttle.docking_controller_tag = "centcom_shuttle" - shuttle.dock_target_station = "centcom_shuttle_dock_airlock" - shuttle.dock_target_offsite = "centcom_shuttle_bay" - shuttles["CentCom"] = shuttle - process_shuttles += shuttle - - shuttle = new() - shuttle.location = 1 - shuttle.warmup_time = 10 //want some warmup time so people can cancel. - shuttle.area_offsite = locate(/area/shuttle/administration/centcom) - shuttle.area_station = locate(/area/shuttle/administration/station) - shuttle.docking_controller_tag = "admin_shuttle" - shuttle.dock_target_station = "admin_shuttle_dock_airlock" - shuttle.dock_target_offsite = "admin_shuttle_bay" - shuttles["Administration"] = shuttle - process_shuttles += shuttle - - shuttle = new() - shuttle.location = 1 - shuttle.warmup_time = 10 //want some warmup time so people can cancel. - shuttle.area_offsite = locate(/area/shuttle/trade/centcom) - shuttle.area_station = locate(/area/shuttle/trade/station) - shuttle.docking_controller_tag = "trade_shuttle" - shuttle.dock_target_station = "trade_shuttle_dock_airlock" - shuttle.dock_target_offsite = "trade_shuttle_bay" - shuttles["Trade"] = shuttle - process_shuttles += shuttle - - shuttle = new() - shuttle.area_offsite = locate(/area/shuttle/alien/base) - shuttle.area_station = locate(/area/shuttle/alien/mine) - shuttles["Alien"] = shuttle - //process_shuttles += shuttle //don't need to process this. It can only be moved using admin magic anyways. - - // Public shuttles - shuttle = new() - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/shuttle/constructionsite/site) - shuttle.area_station = locate(/area/shuttle/constructionsite/station) - shuttle.docking_controller_tag = "engineering_shuttle" - shuttle.dock_target_station = "engineering_dock_airlock" - shuttle.dock_target_offsite = "edock_airlock" - shuttles["Engineering"] = shuttle - process_shuttles += shuttle - - shuttle = new() - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/shuttle/mining/outpost) - shuttle.area_station = locate(/area/shuttle/mining/station) - shuttle.docking_controller_tag = "mining_shuttle" - shuttle.dock_target_station = "mining_dock_airlock" - shuttle.dock_target_offsite = "mining_outpost_airlock" - shuttles["Mining"] = shuttle - process_shuttles += shuttle - - shuttle = new() - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/shuttle/research/outpost) - shuttle.area_station = locate(/area/shuttle/research/station) - shuttle.docking_controller_tag = "research_shuttle" - shuttle.dock_target_station = "research_dock_airlock" - shuttle.dock_target_offsite = "research_outpost_dock" - shuttles["Research"] = shuttle - process_shuttles += shuttle - - // ERT Shuttle - var/datum/shuttle/ferry/multidock/specops/ERT = new() - ERT.location = 0 - ERT.warmup_time = 10 - ERT.area_offsite = locate(/area/shuttle/specops/station) //centcom is the home station, the player station is offsite - ERT.area_station = locate(/area/shuttle/specops/centcom) - ERT.docking_controller_tag = "specops_shuttle_port" - ERT.docking_controller_tag_station = "specops_shuttle_port" - ERT.docking_controller_tag_offsite = "specops_shuttle_fore" - ERT.dock_target_station = "specops_centcom_dock" - ERT.dock_target_offsite = "specops_dock_airlock" - shuttles["Special Operations"] = ERT - process_shuttles += ERT - - //Skipjack. - var/datum/shuttle/multi_shuttle/VS = new/datum/shuttle/multi_shuttle() - VS.origin = locate(/area/skipjack_station/start) - - VS.destinations = list( - "Fore Starboard Solars" = locate(/area/skipjack_station/northeast_solars), - "Fore Port Solars" = locate(/area/skipjack_station/northwest_solars), - "Aft Starboard Solars" = locate(/area/skipjack_station/southeast_solars), - "Aft Port Solars" = locate(/area/skipjack_station/southwest_solars), - "Mining Station" = locate(/area/skipjack_station/mining) - ) - - VS.announcer = "Colony Automated Radar Array" - VS.arrival_message = "Attention. Unidentified object approaching the colony." - VS.departure_message = "Attention. Unidentified object exiting local space. Unidentified object expected to escape Kara gravity well with current velocity." - VS.interim = locate(/area/skipjack_station/transit) - - VS.warmup_time = 0 - shuttles["Skipjack"] = VS - - //Nuke Ops shuttle. - var/datum/shuttle/multi_shuttle/MS = new/datum/shuttle/multi_shuttle() - MS.origin = locate(/area/syndicate_station/start) - MS.start_location = "Mercenary Base" - - MS.destinations = list( - "Northwest of the station" = locate(/area/syndicate_station/northwest), - "North of the station" = locate(/area/syndicate_station/north), - "Northeast of the station" = locate(/area/syndicate_station/northeast), - "Southwest of the station" = locate(/area/syndicate_station/southwest), - "South of the station" = locate(/area/syndicate_station/south), - "Southeast of the station" = locate(/area/syndicate_station/southeast), - "Telecomms Satellite" = locate(/area/syndicate_station/commssat), - "Mining Station" = locate(/area/syndicate_station/mining), - "Arrivals dock" = locate(/area/syndicate_station/arrivals_dock), - ) - - MS.docking_controller_tag = "merc_shuttle" - MS.destination_dock_targets = list( - "Mercenary Base" = "merc_base", - "Arrivals dock" = "nuke_shuttle_dock_airlock", - ) - - MS.announcer = "Automated Traffic Control" - MS.arrival_message = "Attention. A vessel is approaching the colony." - MS.departure_message = "Attention. A vessel is now leaving from the colony." - MS.interim = locate(/area/syndicate_station/transit) - - MS.warmup_time = 0 - shuttles["Mercenary"] = MS - diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm new file mode 100644 index 0000000000..7dff609c76 --- /dev/null +++ b/code/controllers/subsystem.dm @@ -0,0 +1,202 @@ +/datum/controller/subsystem + // Metadata; you should define these. + name = "fire coderbus" //name of the subsystem + var/init_order = 0 //order of initialization. Higher numbers are initialized first, lower numbers later. Can be decimal and negative values. + var/wait = 20 //time to wait (in deciseconds) between each call to fire(). Must be a positive integer. + var/priority = 50 //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 + + var/flags = 0 //see MC.dm in __DEFINES Most flags must be set on world start to take full effect. (You can also restart the mc to force them to process again) + var/runlevels = RUNLEVELS_DEFAULT //points of the game at which the SS can fire + + //set to 0 to prevent fire() calls, mostly for admin use or subsystems that may be resumed later + // use the SS_NO_FIRE flag instead for systems that never fire to keep it from even being added to the list + var/can_fire = TRUE + + // Bookkeeping variables; probably shouldn't mess with these. + var/last_fire = 0 //last world.time we called fire() + var/next_fire = 0 //scheduled world.time for next fire() + var/cost = 0 //average time to execute + var/tick_usage = 0 //average tick usage + var/state = SS_IDLE //tracks the current state of the ss, running, paused, etc. + var/paused_ticks = 0 //ticks this ss is taking to run right now. + var/paused_tick_usage //total tick_usage of all of our runs while pausing this run + var/ticks = 1 //how many ticks does this ss take to run on avg. + var/times_fired = 0 //number of times we have called fire() + var/queued_time = 0 //time we entered the queue, (for timing and priority reasons) + var/queued_priority //we keep a running total to make the math easier, if priority changes mid-fire that would break our running total, so we store it here + //linked list stuff for the queue + var/datum/controller/subsystem/queue_next + var/datum/controller/subsystem/queue_prev + + var/static/failure_strikes = 0 //How many times we suspect this subsystem has crashed the MC, 3 strikes and you're out! + +//Do not override +/datum/controller/subsystem/New() + return + +// Used to initialize the subsystem BEFORE the map has loaded +// Called AFTER Recover if that is called +// Prefer to use Initialize if possible +/datum/controller/subsystem/proc/PreInit() + return + +//This is used so the mc knows when the subsystem sleeps. do not override. +/datum/controller/subsystem/proc/ignite(resumed = 0) + set waitfor = 0 + . = SS_SLEEPING + fire(resumed) + . = state + if (state == SS_SLEEPING) + state = SS_IDLE + if (state == SS_PAUSING) + var/QT = queued_time + enqueue() + state = SS_PAUSED + queued_time = QT + +//previously, this would have been named 'process()' but that name is used everywhere for different things! +//fire() seems more suitable. This is the procedure that gets called every 'wait' deciseconds. +//Sleeping in here prevents future fires until returned. +/datum/controller/subsystem/proc/fire(resumed = 0) + flags |= SS_NO_FIRE + throw EXCEPTION("Subsystem [src]([type]) does not fire() but did not set the SS_NO_FIRE flag. Please add the SS_NO_FIRE flag to any subsystem that doesn't fire so it doesn't get added to the processing list and waste cpu.") + +/datum/controller/subsystem/Destroy() + dequeue() + can_fire = 0 + flags |= SS_NO_FIRE + Master.subsystems -= src + + +//Queue it to run. +// (we loop thru a linked list until we get to the end or find the right point) +// (this lets us sort our run order correctly without having to re-sort the entire already sorted list) +/datum/controller/subsystem/proc/enqueue() + var/SS_priority = priority + var/SS_flags = flags + var/datum/controller/subsystem/queue_node + var/queue_node_priority + var/queue_node_flags + + for (queue_node = Master.queue_head; queue_node; queue_node = queue_node.queue_next) + queue_node_priority = queue_node.queued_priority + queue_node_flags = queue_node.flags + + if (queue_node_flags & SS_TICKER) + if (!(SS_flags & SS_TICKER)) + continue + if (queue_node_priority < SS_priority) + break + + else if (queue_node_flags & SS_BACKGROUND) + if (!(SS_flags & SS_BACKGROUND)) + break + if (queue_node_priority < SS_priority) + break + + else + if (SS_flags & SS_BACKGROUND) + continue + if (SS_flags & SS_TICKER) + break + if (queue_node_priority < SS_priority) + break + + queued_time = world.time + queued_priority = SS_priority + state = SS_QUEUED + if (SS_flags & SS_BACKGROUND) //update our running total + Master.queue_priority_count_bg += SS_priority + else + Master.queue_priority_count += SS_priority + + queue_next = queue_node + if (!queue_node)//we stopped at the end, add to tail + queue_prev = Master.queue_tail + if (Master.queue_tail) + Master.queue_tail.queue_next = src + else //empty queue, we also need to set the head + Master.queue_head = src + Master.queue_tail = src + + else if (queue_node == Master.queue_head)//insert at start of list + Master.queue_head.queue_prev = src + Master.queue_head = src + queue_prev = null + else + queue_node.queue_prev.queue_next = src + queue_prev = queue_node.queue_prev + queue_node.queue_prev = src + + +/datum/controller/subsystem/proc/dequeue() + if (queue_next) + queue_next.queue_prev = queue_prev + if (queue_prev) + queue_prev.queue_next = queue_next + if (src == Master.queue_tail) + Master.queue_tail = queue_prev + if (src == Master.queue_head) + Master.queue_head = queue_next + queued_time = 0 + if (state == SS_QUEUED) + state = SS_IDLE + + +/datum/controller/subsystem/proc/pause() + . = 1 + switch(state) + if(SS_RUNNING) + state = SS_PAUSED + if(SS_SLEEPING) + state = SS_PAUSING + + +//used to initialize the subsystem AFTER the map has loaded +/datum/controller/subsystem/Initialize(start_timeofday) + var/time = (REALTIMEOFDAY - start_timeofday) / 10 + var/msg = "Initialized [name] subsystem within [time] second[time == 1 ? "" : "s"]!" + to_chat(world, "[msg]") + log_world(msg) + return time + +//hook for printing stats to the "MC" statuspanel for admins to see performance and related stats etc. +/datum/controller/subsystem/stat_entry(msg) + if(!statclick) + statclick = new/obj/effect/statclick/debug(null, "Initializing...", src) + + + + if(can_fire && !(SS_NO_FIRE in flags)) + msg = "[round(cost,1)]ms|[round(tick_usage,1)]%|[round(ticks,0.1)]\t[msg]" + else + msg = "OFFLINE\t[msg]" + + var/title = name + if (can_fire) + title = "\[[state_letter()]][title]" + + stat(title, statclick.update(msg)) + +/datum/controller/subsystem/proc/state_letter() + switch (state) + if (SS_RUNNING) + . = "R" + if (SS_QUEUED) + . = "Q" + if (SS_PAUSED, SS_PAUSING) + . = "P" + if (SS_SLEEPING) + . = "S" + if (SS_IDLE) + . = " " + +//could be used to postpone a costly subsystem for (default one) var/cycles, cycles +//for instance, during cpu intensive operations like explosions +/datum/controller/subsystem/proc/postpone(cycles = 1) + if(next_fire - world.time < wait) + next_fire += (wait*cycles) + +//usually called via datum/controller/subsystem/New() when replacing a subsystem (i.e. due to a recurring crash) +//should attempt to salvage what it can from the old instance of subsystem +/datum/controller/subsystem/Recover() diff --git a/code/controllers/subsystems.dm b/code/controllers/subsystems.dm deleted file mode 100644 index 11025d8d53..0000000000 --- a/code/controllers/subsystems.dm +++ /dev/null @@ -1,46 +0,0 @@ -#define NEW_SS_GLOBAL(varname) if(varname != src){if(istype(varname)){Recover();qdel(varname);}varname = src;} - -/datum/subsystem - //things you will want to define - var/name //name of the subsystem - var/priority = 0 //priority affects order of initialization. Higher priorities are initialized first, lower priorities later. Can be decimal and negative values. - var/wait = 20 //time to wait (in deciseconds) between each call to fire(). Must be a positive integer. - - //things you will probably want to leave alone - var/can_fire = 0 //prevent fire() calls - var/last_fire = 0 //last world.time we called fire() - var/next_fire = 0 //scheduled world.time for next fire() - var/cpu = 0 //cpu-usage stats (somewhat vague) - var/cost = 0 //average time to execute - var/times_fired = 0 //number of times we have called fire() - -//used to initialize the subsystem BEFORE the map has loaded -/datum/subsystem/New() - -//previously, this would have been named 'process()' but that name is used everywhere for different things! -//fire() seems more suitable. This is the procedure that gets called every 'wait' deciseconds. -//fire(), and the procs it calls, SHOULD NOT HAVE ANY SLEEP OPERATIONS in them! -//YE BE WARNED! -/datum/subsystem/proc/fire() - can_fire = 0 - -//used to initialize the subsystem AFTER the map has loaded -/datum/subsystem/proc/Initialize(start_timeofday) - var/time = (world.timeofday - start_timeofday) / 10 - var/msg = "Initialized [name] SubSystem within [time] seconds" - world << "[msg]" - world.log << msg - -//hook for printing stats to the "MC" statuspanel for admins to see performance and related stats etc. -/datum/subsystem/proc/stat_entry() - stat(name, "[round(cost,0.001)]ds\t(CPU:[round(cpu,1)]%)") - -//could be used to postpone a costly subsystem for one cycle -//for instance, during cpu intensive operations like explosions -/datum/subsystem/proc/postpone() - if(next_fire - world.time < wait) - next_fire += wait - -//usually called via datum/subsystem/New() when replacing a subsystem (i.e. due to a recurring crash) -//should attempt to salvage what it can from the old instance of subsystem -/datum/subsystem/proc/Recover() diff --git a/code/controllers/subsystems/garbage.dm b/code/controllers/subsystems/garbage.dm new file mode 100644 index 0000000000..d6db860d5d --- /dev/null +++ b/code/controllers/subsystems/garbage.dm @@ -0,0 +1,378 @@ +// +// Garbage Collector Subsystem - Implements qdel() and the GC queue +// +SUBSYSTEM_DEF(garbage) + name = "Garbage" + priority = 15 + wait = 5 + flags = SS_POST_FIRE_TIMING|SS_BACKGROUND|SS_NO_INIT + runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY + + var/collection_timeout = 3000// deciseconds to wait to let running procs finish before we just say fuck it and force del() the object + var/delslasttick = 0 // number of del()'s we've done this tick + var/gcedlasttick = 0 // number of things that gc'ed last tick + var/totaldels = 0 + var/totalgcs = 0 + + var/highest_del_time = 0 + var/highest_del_tickusage = 0 + + var/list/queue = list() // list of refID's of things that should be garbage collected + // refID's are associated with the time at which they time out and need to be manually del() + // we do this so we aren't constantly locating them and preventing them from being gc'd + + var/list/tobequeued = list() //We store the references of things to be added to the queue seperately so we can spread out GC overhead over a few ticks + + var/list/didntgc = list() // list of all types that have failed to GC associated with the number of times that's happened. + // the types are stored as strings + var/list/sleptDestroy = list() //Same as above but these are paths that slept during their Destroy call + + var/list/noqdelhint = list()// list of all types that do not return a QDEL_HINT + // all types that did not respect qdel(A, force=TRUE) and returned one + // of the immortality qdel hints + var/list/noforcerespect = list() + +#ifdef TESTING + var/list/qdel_list = list() // list of all types that have been qdel()eted +#endif + +/datum/controller/subsystem/garbage/stat_entry(msg) + msg += "Q:[queue.len]|D:[delslasttick]|G:[gcedlasttick]|" + msg += "GR:" + if (!(delslasttick+gcedlasttick)) + msg += "n/a|" + else + msg += "[round((gcedlasttick/(delslasttick+gcedlasttick))*100, 0.01)]%|" + + msg += "TD:[totaldels]|TG:[totalgcs]|" + if (!(totaldels+totalgcs)) + msg += "n/a|" + else + msg += "TGR:[round((totalgcs/(totaldels+totalgcs))*100, 0.01)]%" + ..(msg) + +/datum/controller/subsystem/garbage/Shutdown() + //Adds the del() log to world.log in a format condensable by the runtime condenser found in tools + if(didntgc.len || sleptDestroy.len) + var/list/dellog = list() + for(var/path in didntgc) + dellog += "Path : [path] \n" + dellog += "Failures : [didntgc[path]] \n" + if(path in sleptDestroy) + dellog += "Sleeps : [sleptDestroy[path]] \n" + sleptDestroy -= path + for(var/path in sleptDestroy) + dellog += "Path : [path] \n" + dellog += "Sleeps : [sleptDestroy[path]] \n" + log_misc(dellog.Join()) + +/datum/controller/subsystem/garbage/fire() + HandleToBeQueued() + if(state == SS_RUNNING) + HandleQueue() + + if (state == SS_PAUSED) //make us wait again before the next run. + state = SS_RUNNING + +//If you see this proc high on the profile, what you are really seeing is the garbage collection/soft delete overhead in byond. +//Don't attempt to optimize, not worth the effort. +/datum/controller/subsystem/garbage/proc/HandleToBeQueued() + var/list/tobequeued = src.tobequeued + var/starttime = world.time + var/starttimeofday = world.timeofday + while(tobequeued.len && starttime == world.time && starttimeofday == world.timeofday) + if (MC_TICK_CHECK) + break + var/ref = tobequeued[1] + Queue(ref) + tobequeued.Cut(1, 2) + +/datum/controller/subsystem/garbage/proc/HandleQueue() + delslasttick = 0 + gcedlasttick = 0 + var/time_to_kill = world.time - collection_timeout // Anything qdel() but not GC'd BEFORE this time needs to be manually del() + var/list/queue = src.queue + var/starttime = world.time + var/starttimeofday = world.timeofday + while(queue.len && starttime == world.time && starttimeofday == world.timeofday) + if (MC_TICK_CHECK) + break + var/refID = queue[1] + if (!refID) + queue.Cut(1, 2) + continue + + var/GCd_at_time = queue[refID] + if(GCd_at_time > time_to_kill) + break // Everything else is newer, skip them + queue.Cut(1, 2) + var/datum/A + A = locate(refID) + if (A && A.gc_destroyed == GCd_at_time) // So if something else coincidently gets the same ref, it's not deleted by mistake + #ifdef GC_FAILURE_HARD_LOOKUP + A.find_references() + #endif + + // Something's still referring to the qdel'd object. Kill it. + var/type = A.type + testing("GC: -- \ref[A] | [type] was unable to be GC'd and was deleted --") + didntgc["[type]"]++ + + HardDelete(A) + + ++delslasttick + ++totaldels + else + ++gcedlasttick + ++totalgcs + +/datum/controller/subsystem/garbage/proc/QueueForQueuing(datum/A) + if (istype(A) && A.gc_destroyed == GC_CURRENTLY_BEING_QDELETED) + tobequeued += A + A.gc_destroyed = GC_QUEUED_FOR_QUEUING + +/datum/controller/subsystem/garbage/proc/Queue(datum/A) + if (isnull(A) || (!isnull(A.gc_destroyed) && A.gc_destroyed >= 0)) + return + if (A.gc_destroyed == GC_QUEUED_FOR_HARD_DEL) + HardDelete(A) + return + var/gctime = world.time + var/refid = "\ref[A]" + + A.gc_destroyed = gctime + + if (queue[refid]) + queue -= refid // Removing any previous references that were GC'd so that the current object will be at the end of the list. + + queue[refid] = gctime + +//this is purely to seperate things profile wise. +/datum/controller/subsystem/garbage/proc/HardDelete(datum/A) + var/time = world.timeofday + var/tick = world.tick_usage + var/ticktime = world.time + + var/type = A.type + var/refID = "\ref[A]" + + del(A) + + tick = (world.tick_usage-tick+((world.time-ticktime)/world.tick_lag*100)) + if (tick > highest_del_tickusage) + highest_del_tickusage = tick + time = world.timeofday - time + if (!time && TICK_DELTA_TO_MS(tick) > 1) + time = TICK_DELTA_TO_MS(tick)/100 + if (time > highest_del_time) + highest_del_time = time + if (time > 10) + log_game("Error: [type]([refID]) took longer than 1 second to delete (took [time/10] seconds to delete)") + message_admins("Error: [type]([refID]) took longer than 1 second to delete (took [time/10] seconds to delete).") + postpone(time/5) + +/datum/controller/subsystem/garbage/proc/HardQueue(datum/A) + if (istype(A) && A.gc_destroyed == GC_CURRENTLY_BEING_QDELETED) + tobequeued += A + A.gc_destroyed = GC_QUEUED_FOR_HARD_DEL + +/datum/controller/subsystem/garbage/Recover() + if (istype(SSgarbage.queue)) + queue |= SSgarbage.queue + if (istype(SSgarbage.tobequeued)) + tobequeued |= SSgarbage.tobequeued + +// Should be treated as a replacement for the 'del' keyword. +// Datums passed to this will be given a chance to clean up references to allow the GC to collect them. +/proc/qdel(datum/D, force=FALSE) + if(!istype(D)) + del(D) + return +#ifdef TESTING + SSgarbage.qdel_list += D.type +#endif + if(isnull(D.gc_destroyed)) + D.gc_destroyed = GC_CURRENTLY_BEING_QDELETED + var/start_time = world.time + var/hint = D.Destroy(force) // Let our friend know they're about to get fucked up. + if(world.time != start_time) + SSgarbage.sleptDestroy[D.type]++ + if(!D) + return + switch(hint) + if (QDEL_HINT_QUEUE) //qdel should queue the object for deletion. + SSgarbage.QueueForQueuing(D) + if (QDEL_HINT_IWILLGC) + D.gc_destroyed = world.time + return + if (QDEL_HINT_LETMELIVE) //qdel should let the object live after calling destory. + if(!force) + D.gc_destroyed = null //clear the gc variable (important!) + return + // Returning LETMELIVE after being told to force destroy + // indicates the objects Destroy() does not respect force + if(!SSgarbage.noforcerespect[D.type]) + SSgarbage.noforcerespect[D.type] = D.type + crash_with("[D.type] has been force deleted, but is \ + returning an immortal QDEL_HINT, indicating it does \ + not respect the force flag for qdel(). It has been \ + placed in the queue, further instances of this type \ + will also be queued.") + SSgarbage.QueueForQueuing(D) + if (QDEL_HINT_HARDDEL) //qdel should assume this object won't gc, and queue a hard delete using a hard reference to save time from the locate() + SSgarbage.HardQueue(D) + if (QDEL_HINT_HARDDEL_NOW) //qdel should assume this object won't gc, and hard del it post haste. + SSgarbage.HardDelete(D) + if (QDEL_HINT_FINDREFERENCE)//qdel will, if TESTING is enabled, display all references to this object, then queue the object for deletion. + SSgarbage.QueueForQueuing(D) + #ifdef TESTING + D.find_references() + #endif + else + if(!SSgarbage.noqdelhint[D.type]) + SSgarbage.noqdelhint[D.type] = D.type + crash_with("[D.type] is not returning a qdel hint. It is being placed in the queue. Further instances of this type will also be queued.") + SSgarbage.QueueForQueuing(D) + else if(D.gc_destroyed == GC_CURRENTLY_BEING_QDELETED) + CRASH("[D.type] destroy proc was called multiple times, likely due to a qdel loop in the Destroy logic") + +// Default implementation of clean-up code. +// This should be overridden to remove all references pointing to the object being destroyed. +// Return the appropriate QDEL_HINT; in most cases this is QDEL_HINT_QUEUE. +/datum/proc/Destroy(force=FALSE) + tag = null + nanomanager.close_uis(src) + return QDEL_HINT_QUEUE + +/datum/var/gc_destroyed //Time when this object was destroyed. + +#ifdef TESTING +/datum/var/running_find_references +/datum/var/last_find_references = 0 + +/datum/verb/find_refs() + set category = "Debug" + set name = "Find References" + set background = 1 + set src in world + + find_references(FALSE) + +/datum/proc/find_references(skip_alert) + running_find_references = type + if(usr && usr.client) + if(usr.client.running_find_references) + testing("CANCELLED search for references to a [usr.client.running_find_references].") + usr.client.running_find_references = null + running_find_references = null + //restart the garbage collector + SSgarbage.can_fire = 1 + SSgarbage.next_fire = world.time + world.tick_lag + return + + if(!skip_alert) + if(alert("Running this will lock everything up for about 5 minutes. Would you like to begin the search?", "Find References", "Yes", "No") == "No") + running_find_references = null + return + + //this keeps the garbage collector from failing to collect objects being searched for in here + SSgarbage.can_fire = 0 + + if(usr && usr.client) + usr.client.running_find_references = type + + testing("Beginning search for references to a [type].") + last_find_references = world.time + find_references_in_globals() + for(var/datum/thing in world) + DoSearchVar(thing, "WorldRef: [thing]") + testing("Completed search for references to a [type].") + if(usr && usr.client) + usr.client.running_find_references = null + running_find_references = null + + //restart the garbage collector + SSgarbage.can_fire = 1 + SSgarbage.next_fire = world.time + world.tick_lag + +/client/verb/purge_all_destroyed_objects() + set category = "Debug" + if(SSgarbage) + while(SSgarbage.queue.len) + var/datum/o = locate(SSgarbage.queue[1]) + if(istype(o) && o.gc_destroyed) + del(o) + SSgarbage.totaldels++ + SSgarbage.queue.Cut(1, 2) + +/datum/verb/qdel_then_find_references() + set category = "Debug" + set name = "qdel() then Find References" + set background = 1 + set src in world + + qdel(src) + if(!running_find_references) + find_references(TRUE) + +/client/verb/show_qdeleted() + set category = "Debug" + set name = "Show qdel() Log" + set desc = "Render the qdel() log and display it" + + var/dat = "List of things that have been qdel()eted this round

" + + var/tmplist = list() + for(var/elem in SSgarbage.qdel_list) + if(!(elem in tmplist)) + tmplist[elem] = 0 + tmplist[elem]++ + + for(var/path in tmplist) + dat += "[path] - [tmplist[path]] times
" + + usr << browse(dat, "window=qdeletedlog") + +/datum/proc/DoSearchVar(X, Xname) + if(usr && usr.client && !usr.client.running_find_references) return + if(istype(X, /datum)) + var/datum/D = X + if(D.last_find_references == last_find_references) + return + D.last_find_references = last_find_references + for(var/V in D.vars) + for(var/varname in D.vars) + var/variable = D.vars[varname] + if(variable == src) + testing("Found [src.type] \ref[src] in [D.type]'s [varname] var. [Xname]") + else if(islist(variable)) + if(src in variable) + testing("Found [src.type] \ref[src] in [D.type]'s [varname] list var. Global: [Xname]") +#ifdef GC_FAILURE_HARD_LOOKUP + for(var/I in variable) + DoSearchVar(I, TRUE) + else + DoSearchVar(variable, "[Xname]: [varname]") +#endif + else if(islist(X)) + if(src in X) + testing("Found [src.type] \ref[src] in list [Xname].") +#ifdef GC_FAILURE_HARD_LOOKUP + for(var/I in X) + DoSearchVar(I, Xname + ": list") +#else + CHECK_TICK +#endif + +//if find_references isn't working for some datum +//update this list using tools/GenerateGlobalVarAccess +/datum/proc/find_references_in_globals() + // TODO - Impement Global Variable Access + // for(var/global_var in _all_globals) + // DoSearchVar(readglobal(global_var), "Global: [global_var]") +#endif + + +/image/Destroy() + ..() + return QDEL_HINT_HARDDEL_NOW diff --git a/code/controllers/verbs.dm b/code/controllers/verbs.dm index f0d3cc3341..fcf239c88f 100644 --- a/code/controllers/verbs.dm +++ b/code/controllers/verbs.dm @@ -1,19 +1,57 @@ //TODO: rewrite and standardise all controller datums to the datum/controller type //TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) - MC done - lighting done -/client/proc/restart_controller(controller in list("Supply")) + +// Clickable stat() button. +/obj/effect/statclick + name = "Initializing..." + var/target + +/obj/effect/statclick/New(loc, text, target) //Don't port this to Initialize it's too critical + ..() + name = text + src.target = target + +/obj/effect/statclick/proc/update(text) + name = text + return src + +/obj/effect/statclick/debug + var/class + +/obj/effect/statclick/debug/Click() + if(!usr.client.holder || !target) + return + if(!class) + if(istype(target, /datum/controller/subsystem)) + class = "subsystem" + else if(istype(target, /datum/controller)) + class = "controller" + else if(istype(target, /datum)) + class = "datum" + else + class = "unknown" + + usr.client.debug_variables(target) + message_admins("Admin [key_name_admin(usr)] is debugging the [target] [class].") + + +// Debug verbs. +/client/proc/restart_controller(controller in list("Master", "Failsafe")) set category = "Debug" set name = "Restart Controller" set desc = "Restart one of the various periodic loop controllers for the game (be careful!)" - if(!holder) return - usr = null - src = null + if(!holder) + return switch(controller) - if("Supply") - supply_controller.process() - feedback_add_details("admin_verb","RSupply") + if("Master") + Recreate_MC() + feedback_add_details("admin_verb","RMC") + if("Failsafe") + new /datum/controller/failsafe() + feedback_add_details("admin_verb","RFailsafe") + message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.") - return /client/proc/debug_antagonist_template(antag_type in all_antag_types) set category = "Debug" diff --git a/code/controllers/voting.dm b/code/controllers/voting.dm index aa06984f69..ba1bb23c33 100644 --- a/code/controllers/voting.dm +++ b/code/controllers/voting.dm @@ -23,9 +23,15 @@ var/global/list/round_voters = list() // Keeps track of the individuals voting f /datum/controller/vote/New() if(vote != src) if(istype(vote)) - del(vote) + Recover() + qdel(vote) vote = src +/datum/controller/vote/Destroy() + ..() + // Tell qdel() to Del() this object. + return QDEL_HINT_HARDDEL_NOW + /datum/controller/vote/proc/process() //called by master_controller if(mode) // No more change mode votes after the game has started. diff --git a/code/datums/autolathe/arms.dm b/code/datums/autolathe/arms.dm index efe5791b11..b40bf27e47 100644 --- a/code/datums/autolathe/arms.dm +++ b/code/datums/autolathe/arms.dm @@ -8,29 +8,29 @@ /datum/category_item/autolathe/arms/shotgun_blanks name = "ammunition (12g, blank)" - path =/obj/item/ammo_casing/shotgun/blank + path =/obj/item/ammo_casing/a12g/blank /datum/category_item/autolathe/arms/shotgun_beanbag name = "ammunition (12g, beanbag)" - path =/obj/item/ammo_casing/shotgun/beanbag + path =/obj/item/ammo_casing/a12g/beanbag /datum/category_item/autolathe/arms/shotgun_flash name = "ammunition (12g, flash)" - path =/obj/item/ammo_casing/shotgun/flash + path =/obj/item/ammo_casing/a12g/flash /datum/category_item/autolathe/arms/shotgun name = "ammunition (12g, slug)" - path =/obj/item/ammo_casing/shotgun + path =/obj/item/ammo_casing/a12g hidden = 1 /datum/category_item/autolathe/arms/shotgun_pellet name = "ammunition (12g, pellet)" - path =/obj/item/ammo_casing/shotgun/pellet + path =/obj/item/ammo_casing/a12g/pellet hidden = 1 /datum/category_item/autolathe/arms/stunshell name = "ammunition (stun cartridge, shotgun)" - path =/obj/item/ammo_casing/shotgun/stunshell + path =/obj/item/ammo_casing/a12g/stunshell hidden = 1 ////////////////// @@ -49,119 +49,119 @@ /////// .45 /datum/category_item/autolathe/arms/pistol_45 name = "pistol magazine (.45)" - path =/obj/item/ammo_magazine/c45m + path =/obj/item/ammo_magazine/m45 hidden = 1 /datum/category_item/autolathe/arms/pistol_45p name = "pistol magazine (.45 practice)" - path =/obj/item/ammo_magazine/c45m/practice + path =/obj/item/ammo_magazine/m45/practice /datum/category_item/autolathe/arms/pistol_45r name = "pistol magazine (.45 rubber)" - path =/obj/item/ammo_magazine/c45m/rubber + path =/obj/item/ammo_magazine/m45/rubber /datum/category_item/autolathe/arms/pistol_45f name = "pistol magazine (.45 flash)" - path =/obj/item/ammo_magazine/c45m/flash + path =/obj/item/ammo_magazine/m45/flash /datum/category_item/autolathe/arms/pistol_45uzi name = "uzi magazine (.45)" - path =/obj/item/ammo_magazine/c45uzi + path =/obj/item/ammo_magazine/m45uzi hidden = 1 /datum/category_item/autolathe/arms/tommymag name = "Tommygun magazine (.45)" - path =/obj/item/ammo_magazine/tommymag + path =/obj/item/ammo_magazine/m45tommy hidden = 1 /datum/category_item/autolathe/arms/tommydrum name = "Tommygun drum magazine (.45)" - path =/obj/item/ammo_magazine/tommydrum + path =/obj/item/ammo_magazine/m45tommydrum hidden = 1 /////// 9mm -/obj/item/ammo_magazine/mc9mm/flash - ammo_type =/obj/item/ammo_casing/c9mmf +/obj/item/ammo_magazine/m9mm/flash + ammo_type =/obj/item/ammo_casing/a9mmf -/obj/item/ammo_magazine/mc9mm/rubber +/obj/item/ammo_magazine/m9mm/rubber name = "magazine (9mm rubber)" - ammo_type =/obj/item/ammo_casing/c9mmr + ammo_type =/obj/item/ammo_casing/a9mmr -/obj/item/ammo_magazine/mc9mm/practice +/obj/item/ammo_magazine/m9mm/practice name = "magazine (9mm practice)" - ammo_type =/obj/item/ammo_casing/c9mmp + ammo_type =/obj/item/ammo_casing/a9mmp /datum/category_item/autolathe/arms/pistol_9mm name = "pistol magazine (9mm)" - path =/obj/item/ammo_magazine/mc9mm + path =/obj/item/ammo_magazine/m9mm hidden = 1 /datum/category_item/autolathe/arms/pistol_9mmr name = "pistol magazine (9mm rubber)" - path =/obj/item/ammo_magazine/mc9mm/rubber + path =/obj/item/ammo_magazine/m9mm/rubber /datum/category_item/autolathe/arms/pistol_9mmp name = "pistol magazine (9mm practice)" - path =/obj/item/ammo_magazine/mc9mm/practice + path =/obj/item/ammo_magazine/m9mm/practice /datum/category_item/autolathe/arms/pistol_9mmf name = "pistol magazine (9mm flash)" - path =/obj/item/ammo_magazine/mc9mm/flash + path =/obj/item/ammo_magazine/m9mm/flash /datum/category_item/autolathe/arms/smg_9mm name = "top-mounted SMG magazine (9mm)" - path =/obj/item/ammo_magazine/mc9mmt + path =/obj/item/ammo_magazine/m9mmt hidden = 1 /datum/category_item/autolathe/arms/smg_9mmr name = "top-mounted SMG magazine (9mm rubber)" - path =/obj/item/ammo_magazine/mc9mmt/rubber + path =/obj/item/ammo_magazine/m9mmt/rubber /datum/category_item/autolathe/arms/smg_9mmp name = "top-mounted SMG magazine (9mm practice)" - path =/obj/item/ammo_magazine/mc9mmt/practice + path =/obj/item/ammo_magazine/m9mmt/practice /datum/category_item/autolathe/arms/smg_9mmf name = "top-mounted SMG magazine (9mm flash)" - path =/obj/item/ammo_magazine/mc9mmt/flash + path =/obj/item/ammo_magazine/m9mmt/flash /////// 10mm /datum/category_item/autolathe/arms/smg_10mm name = "SMG magazine (10mm)" - path =/obj/item/ammo_magazine/a10mm + path =/obj/item/ammo_magazine/m10mm hidden = 1 /datum/category_item/autolathe/arms/pistol_50 name = "pistol magazine (.50AE)" - path =/obj/item/ammo_magazine/a50 + path =/obj/item/ammo_magazine/m50 hidden = 1 /////// 5.56mm /datum/category_item/autolathe/arms/rifle_556 name = "rifle magazine (5.56mm)" - path =/obj/item/ammo_magazine/c556 + path =/obj/item/ammo_magazine/m556 hidden = 1 /datum/category_item/autolathe/arms/rifle_556p name = "rifle magazine (5.56mm practice)" - path =/obj/item/ammo_magazine/c556/practice + path =/obj/item/ammo_magazine/m556/practice /datum/category_item/autolathe/arms/machinegun_556 name = "machinegun box magazine (5.56)" - path =/obj/item/ammo_magazine/a556 + path =/obj/item/ammo_magazine/m556saw hidden = 1 /////// 7.62 /datum/category_item/autolathe/arms/rifle_762 name = "rifle magazine (7.62mm)" - path =/obj/item/ammo_magazine/c762 + path =/obj/item/ammo_magazine/m762 hidden = 1 /datum/category_item/autolathe/arms/shotgun_magazine name = "24rnd shotgun magazine (12g)" - path =/obj/item/ammo_magazine/g12 + path =/obj/item/ammo_magazine/m12gdrum hidden = 1 /* @@ -188,57 +188,57 @@ /datum/category_item/autolathe/arms/pistol_45 name = "pistol magazine (.45)" - path =/obj/item/ammo_magazine/c45m/empty + path =/obj/item/ammo_magazine/m45/empty category = "Arms and Ammunition" /datum/category_item/autolathe/arms/pistol_45uzi name = "uzi magazine (.45)" - path =/obj/item/ammo_magazine/c45uzi/empty + path =/obj/item/ammo_magazine/m45uzi/empty category = "Arms and Ammunition" hidden = 1 /datum/category_item/autolathe/arms/tommymag name = "Tommygun magazine (.45)" - path =/obj/item/ammo_magazine/tommymag/empty + path =/obj/item/ammo_magazine/m45tommy/empty category = "Arms and Ammunition" hidden = 1 /datum/category_item/autolathe/arms/tommydrum name = "Tommygun drum magazine (.45)" - path =/obj/item/ammo_magazine/tommydrum/empty + path =/obj/item/ammo_magazine/m45tommydrum/empty category = "Arms and Ammunition" hidden = 1 /datum/category_item/autolathe/arms/pistol_9mm name = "pistol magazine (9mm)" - path =/obj/item/ammo_magazine/mc9mm/empty + path =/obj/item/ammo_magazine/m9mm/empty category = "Arms and Ammunition" /datum/category_item/autolathe/arms/smg_9mm name = "top-mounted SMG magazine (9mm)" - path =/obj/item/ammo_magazine/mc9mmt/empty + path =/obj/item/ammo_magazine/m9mmt/empty category = "Arms and Ammunition" /datum/category_item/autolathe/arms/smg_10mm name = "SMG magazine (10mm)" - path =/obj/item/ammo_magazine/a10mm/empty + path =/obj/item/ammo_magazine/m10mm/empty category = "Arms and Ammunition" hidden = 1 /datum/category_item/autolathe/arms/pistol_50 name = "pistol magazine (.50AE)" - path =/obj/item/ammo_magazine/a50/empty + path =/obj/item/ammo_magazine/m50/empty category = "Arms and Ammunition" hidden = 1 /datum/category_item/autolathe/arms/rifle_556 name = "10rnd rifle magazine (5.56mm)" - path =/obj/item/ammo_magazine/a556/empty + path =/obj/item/ammo_magazine/m556saw/empty category = "Arms and Ammunition" /datum/category_item/autolathe/arms/rifle_556m name = "20rnd rifle magazine (5.56mm)" - path =/obj/item/ammo_magazine/a556m/empty + path =/obj/item/ammo_magazine/m556sawm/empty category = "Arms and Ammunition" hidden = 1 @@ -250,7 +250,7 @@ /datum/category_item/autolathe/arms/rifle_762 name = "20rnd rifle magazine (7.62mm)" - path =/obj/item/ammo_magazine/c762/empty + path =/obj/item/ammo_magazine/m762/empty category = "Arms and Ammunition" hidden = 1 @@ -262,7 +262,7 @@ /datum/category_item/autolathe/arms/shotgun_magazine name = "24rnd shotgun magazine (12g)" - path =/obj/item/ammo_magazine/g12/empty + path =/obj/item/ammo_magazine/m12gdrum/empty category = "Arms and Ammunition" hidden = 1*/ @@ -272,17 +272,17 @@ /datum/category_item/autolathe/arms/speedloader_357 name = "speedloader (.357)" - path =/obj/item/ammo_magazine/a357 + path =/obj/item/ammo_magazine/s357 hidden = 1 /datum/category_item/autolathe/arms/speedloader_38 name = "speedloader (.38)" - path =/obj/item/ammo_magazine/c38 + path =/obj/item/ammo_magazine/s38 hidden = 1 /datum/category_item/autolathe/arms/speedloader_38r name = "speedloader (.38 rubber)" - path =/obj/item/ammo_magazine/c38/rubber + path =/obj/item/ammo_magazine/s38/rubber // Commented out until metal exploits with autolathe is fixed. /*/datum/category_item/autolathe/arms/pistol_clip_45 @@ -335,35 +335,35 @@ /datum/category_item/autolathe/arms/pistol_clip_10mm name = "ammo clip (10mm)" - path =/obj/item/ammo_magazine/clip/a10mm + path =/obj/item/ammo_magazine/clip/c10mm category = "Arms and Ammunition" hidden = 1 /datum/category_item/autolathe/arms/pistol_clip_50 name = "ammo clip (.50AE)" - path =/obj/item/ammo_magazine/clip/a50 + path =/obj/item/ammo_magazine/clip/c50 category = "Arms and Ammunition" hidden = 1 */ /datum/category_item/autolathe/arms/rifle_clip_556 name = "ammo clip (5.56mm)" - path =/obj/item/ammo_magazine/clip/a556 + path =/obj/item/ammo_magazine/clip/c556 category = "Arms and Ammunition" hidden = 1 /datum/category_item/autolathe/arms/rifle_clip_556_practice name = "ammo clip (5.56mm practice)" - path =/obj/item/ammo_magazine/clip/a556/practice + path =/obj/item/ammo_magazine/clip/c556/practice category = "Arms and Ammunition" /datum/category_item/autolathe/arms/rifle_clip_762 name = "ammo clip (7.62mm)" - path =/obj/item/ammo_magazine/clip/a762 + path =/obj/item/ammo_magazine/clip/c762 hidden = 1 /datum/category_item/autolathe/arms/rifle_clip_762_practice name = "ammo clip (7.62mm practice)" - path =/obj/item/ammo_magazine/clip/a762/practice + path =/obj/item/ammo_magazine/clip/c762/practice /datum/category_item/autolathe/arms/knuckledusters name = "knuckle dusters" diff --git a/code/datums/helper_datums/global_iterator.dm b/code/datums/helper_datums/global_iterator.dm index 3bf80f06d0..d511b5d233 100644 --- a/code/datums/helper_datums/global_iterator.dm +++ b/code/datums/helper_datums/global_iterator.dm @@ -155,4 +155,5 @@ Data storage vars: tag = null arg_list.Cut() stop() + return QDEL_HINT_LETMELIVE //Do not call ..() diff --git a/code/datums/repositories/decls.dm b/code/datums/repositories/decls.dm index e87be74f53..61b24c21e9 100644 --- a/code/datums/repositories/decls.dm +++ b/code/datums/repositories/decls.dm @@ -36,4 +36,4 @@ /decls/Destroy() crash_with("Prevented attempt to delete a decl instance: [log_info_line(src)]") - return 1 // Prevents Decl destruction \ No newline at end of file + return QDEL_HINT_LETMELIVE // Prevents Decl destruction diff --git a/code/datums/repositories/radiation.dm b/code/datums/repositories/radiation.dm new file mode 100644 index 0000000000..4e3259a6de --- /dev/null +++ b/code/datums/repositories/radiation.dm @@ -0,0 +1,138 @@ +var/global/repository/radiation/radiation_repository = new() + +/repository/radiation + var/list/sources = list() // all radiation source datums + var/list/sources_assoc = list() // Sources indexed by turf for de-duplication. + var/list/resistance_cache = list() // Cache of turf's radiation resistance. + +// Describes a point source of radiation. Created either in response to a pulse of radiation, or over an irradiated atom. +// Sources will decay over time, unless something is renewing their power! +/datum/radiation_source + var/turf/source_turf // Location of the radiation source. + var/rad_power // Strength of the radiation being emitted. + var/decay = TRUE // True for automatic decay. False if owner promises to handle it (i.e. supermatter) + var/respect_maint = FALSE // True for not affecting RAD_SHIELDED areas. + var/flat = FALSE // True for power falloff with distance. + var/range // Cached maximum range, used for quick checks against mobs. + +/datum/radiation_source/Destroy() + radiation_repository.sources -= src + if(radiation_repository.sources_assoc[src.source_turf] == src) + radiation_repository.sources -= src.source_turf + src.source_turf = null + . = ..() + +/datum/radiation_source/proc/update_rad_power(var/new_power = null) + if(new_power == null || new_power == rad_power) + return // No change + else if(new_power <= 0) + qdel(src) // Decayed to nothing + else + rad_power = new_power + if(!flat) + range = min(round(sqrt(rad_power / config.radiation_lower_limit)), 31) // R = rad_power / dist**2 - Solve for dist + +// Ray trace from all active radiation sources to T and return the strongest effect. +/repository/radiation/proc/get_rads_at_turf(var/turf/T) + if(!istype(T)) return 0 + + . = 0 + for(var/value in sources) + var/datum/radiation_source/source = value + if(source.rad_power < .) + continue // Already being affected by a stronger source + if(source.source_turf.z != T.z) + continue // Radiation is not multi-z + var/dist = get_dist(source.source_turf, T) + if(dist > source.range) + continue // Too far to possibly affect + if(source.respect_maint) + var/atom/A = T.loc + if(A.flags & RAD_SHIELDED) + continue // In shielded area + if(source.flat) + . = max(., source.rad_power) + continue // No need to ray trace for flat field + + // Okay, now ray trace to find resistence! + var/turf/origin = source.source_turf + var/working = source.rad_power + while(origin != T) + origin = get_step_towards(origin, T) //Raytracing + if(!(origin in resistance_cache)) //Only get the resistance if we don't already know it. + origin.calc_rad_resistance() + working = max((working - (origin.cached_rad_resistance * config.radiation_resistance_multiplier)), 0) + if(working <= .) + break // Already affected by a stronger source (or its zero...) + . = max((working * (1 / (dist ** 2))), .) //Butchered version of the inverse square law. Works for this purpose + +// Add a radiation source instance to the repository. It will override any existing source on the same turf. +/repository/radiation/proc/add_source(var/datum/radiation_source/S) + if(!isturf(S.source_turf)) + return + var/datum/radiation_source/existing = sources_assoc[S.source_turf] + if(existing) + qdel(existing) + sources += S + sources_assoc[S.source_turf] = S + +// Creates a temporary radiation source that will decay +/repository/radiation/proc/radiate(source, power) //Sends out a radiation pulse, taking walls into account + if(!(source && power)) //Sanity checking + return + var/datum/radiation_source/S = new() + S.source_turf = get_turf(source) + S.update_rad_power(power) + add_source(S) + +// Sets the radiation in a range to a constant value. +/repository/radiation/proc/flat_radiate(source, power, range, var/respect_maint = FALSE) + if(!(source && power && range)) + return + var/datum/radiation_source/S = new() + S.flat = TRUE + S.range = range + S.respect_maint = respect_maint + S.source_turf = get_turf(source) + S.update_rad_power(power) + add_source(S) + +// Irradiates a full Z-level. Hacky way of doing it, but not too expensive. +/repository/radiation/proc/z_radiate(var/atom/source, power, var/respect_maint = FALSE) + if(!(power && source)) + return + var/turf/epicentre = locate(round(world.maxx / 2), round(world.maxy / 2), source.z) + flat_radiate(epicentre, power, world.maxx, respect_maint) + +/turf + var/cached_rad_resistance = 0 + +/turf/proc/calc_rad_resistance() + cached_rad_resistance = 0 + for(var/obj/O in src.contents) + if(O.rad_resistance) //Override + cached_rad_resistance += O.rad_resistance + + else if(O.density) //So open doors don't get counted + var/material/M = O.get_material() + if(!M) continue + cached_rad_resistance += M.weight + // Looks like storing the contents length is meant to be a basic check if the cache is stale due to items enter/exiting. Better than nothing so I'm leaving it as is. ~Leshana + radiation_repository.resistance_cache[src] = (length(contents) + 1) + +/turf/simulated/wall/calc_rad_resistance() + radiation_repository.resistance_cache[src] = (length(contents) + 1) + cached_rad_resistance = (density ? material.weight : 0) + +/obj + var/rad_resistance = 0 // Allow overriding rad resistance + +// If people expand the system, this may be useful. Here as a placeholder until then +/atom/proc/rad_act(var/severity) + return 1 + +/mob/living/rad_act(var/severity) + if(severity) + src.apply_effect(severity, IRRADIATE, src.getarmor(null, "rad")) + for(var/atom/I in src) + I.rad_act(severity) diff --git a/code/datums/supplypacks/contraband.dm b/code/datums/supplypacks/contraband.dm index 0c7fd3f4ed..c200e2edda 100644 --- a/code/datums/supplypacks/contraband.dm +++ b/code/datums/supplypacks/contraband.dm @@ -47,7 +47,7 @@ name = "Surplus militia rifles" contains = list( /obj/item/weapon/gun/projectile/shotgun/pump/rifle/mosin = 3, - /obj/item/ammo_magazine/clip/a762 = 6 + /obj/item/ammo_magazine/clip/c762 = 6 ) cost = 50 contraband = 1 diff --git a/code/datums/supplypacks/munitions.dm b/code/datums/supplypacks/munitions.dm index e2df9609ad..d0635ffce6 100644 --- a/code/datums/supplypacks/munitions.dm +++ b/code/datums/supplypacks/munitions.dm @@ -27,7 +27,7 @@ name = "Flare guns crate" contains = list( /obj/item/weapon/gun/projectile/sec/flash, - /obj/item/ammo_magazine/c45m/flash, + /obj/item/ammo_magazine/m45/flash, /obj/item/weapon/gun/projectile/shotgun/doublebarrel/flare, /obj/item/weapon/storage/box/flashshells ) @@ -129,7 +129,7 @@ contains = list( /obj/item/device/assembly/timer, /obj/item/weapon/gun/projectile/shotgun/pump/rifle/practice = 2, - /obj/item/ammo_magazine/clip/a762/practice = 4, + /obj/item/ammo_magazine/clip/c762/practice = 4, /obj/item/target = 2, /obj/item/target/alien = 2, /obj/item/target/syndicate = 2 @@ -154,9 +154,9 @@ name = "Automatic weapon ammunition crate" num_contained = 6 contains = list( - /obj/item/ammo_magazine/mc9mmt, - /obj/item/ammo_magazine/mc9mmt/rubber, - /obj/item/ammo_magazine/a556 + /obj/item/ammo_magazine/m9mmt, + /obj/item/ammo_magazine/m9mmt/rubber, + /obj/item/ammo_magazine/m556saw ) cost = 25 containertype = /obj/structure/closet/crate/secure diff --git a/code/datums/uplink/ammunition.dm b/code/datums/uplink/ammunition.dm index 4aefe349fd..03f1296ad9 100644 --- a/code/datums/uplink/ammunition.dm +++ b/code/datums/uplink/ammunition.dm @@ -8,36 +8,36 @@ /datum/uplink_item/item/ammo/a357 name = ".357 Speedloader" - path = /obj/item/ammo_magazine/a357 + path = /obj/item/ammo_magazine/s357 /datum/uplink_item/item/ammo/mc9mm name = "Pistol Magazine (9mm)" - path = /obj/item/ammo_magazine/mc9mm + path = /obj/item/ammo_magazine/m9mm /datum/uplink_item/item/ammo/c45m name = "Pistol Magazine (.45)" - path = /obj/item/ammo_magazine/c45m + path = /obj/item/ammo_magazine/m45 /datum/uplink_item/item/ammo/c45map name = "Pistol Magazine (.45 AP)" - path = /obj/item/ammo_magazine/c45m/ap + path = /obj/item/ammo_magazine/m45/ap /datum/uplink_item/item/ammo/tommymag name = "Tommygun Magazine (.45)" - path = /obj/item/ammo_magazine/tommymag + path = /obj/item/ammo_magazine/m45tommy /datum/uplink_item/item/ammo/tommymagap name = "Tommygun Magazine (.45 AP)" - path = /obj/item/ammo_magazine/tommymag/ap + path = /obj/item/ammo_magazine/m45tommy/ap /datum/uplink_item/item/ammo/tommydrum name = "Tommygun Drum Magazine (.45)" - path = /obj/item/ammo_magazine/tommydrum + path = /obj/item/ammo_magazine/m45tommydrum item_cost = 40 /datum/uplink_item/item/ammo/tommydrumap name = "Tommygun Drum Magazine (.45 AP)" - path = /obj/item/ammo_magazine/tommydrum/ap + path = /obj/item/ammo_magazine/m45tommydrum/ap /datum/uplink_item/item/ammo/darts name = "Darts" @@ -50,39 +50,39 @@ /datum/uplink_item/item/ammo/c556 name = "Rifle Magazine (5.56mm)" - path = /obj/item/ammo_magazine/c556 + path = /obj/item/ammo_magazine/m556 /datum/uplink_item/item/ammo/c556/ext name = "Rifle Magazine (5.56mm Extended)" - path = /obj/item/ammo_magazine/c556/ext + path = /obj/item/ammo_magazine/m556/ext /datum/uplink_item/item/ammo/c556/ap name = "Rifle Magazine (5.56mm AP)" - path = /obj/item/ammo_magazine/c556/ap + path = /obj/item/ammo_magazine/m556/ap /datum/uplink_item/item/ammo/c556/ap/ext name = "Rifle Magazine (5.56mm AP Extended)" - path = /obj/item/ammo_magazine/c556/ap/ext + path = /obj/item/ammo_magazine/m556/ap/ext /datum/uplink_item/item/ammo/c762 name = "Rifle Magazine (7.62mm)" - path = /obj/item/ammo_magazine/c762 + path = /obj/item/ammo_magazine/m762 /datum/uplink_item/item/ammo/c762/ap name = "Rifle Magazine (7.62mm AP)" - path = /obj/item/ammo_magazine/c762/ap + path = /obj/item/ammo_magazine/m762/ap /datum/uplink_item/item/ammo/a10mm name = "SMG Magazine (10mm)" - path = /obj/item/ammo_magazine/a10mm + path = /obj/item/ammo_magazine/m10mm /datum/uplink_item/item/ammo/a556 name = "Machinegun Magazine (5.56mm)" - path = /obj/item/ammo_magazine/a556 + path = /obj/item/ammo_magazine/m556saw /datum/uplink_item/item/ammo/a556/ap name = "Machinegun Magazine (5.56mm AP)" - path = /obj/item/ammo_magazine/a556/ap + path = /obj/item/ammo_magazine/m556saw/ap /datum/uplink_item/item/ammo/g12 name = "12g Shotgun Ammo Box (Slug)" diff --git a/code/datums/weakref.dm b/code/datums/weakref.dm index 1a7d844ca8..348d73b0b2 100644 --- a/code/datums/weakref.dm +++ b/code/datums/weakref.dm @@ -7,7 +7,9 @@ //obtain a weak reference to a datum /proc/weakref(datum/D) - if(D.gcDestroyed) + if(!istype(D)) + return + if(QDELETED(D)) return if(!D.weakref) D.weakref = new/weakref(D) @@ -22,7 +24,7 @@ /weakref/Destroy() // A weakref datum should not be manually destroyed as it is a shared resource, // rather it should be automatically collected by the BYOND GC when all references are gone. - return 0 + return QDEL_HINT_LETMELIVE /weakref/proc/resolve() var/datum/D = locate(ref) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 066c357a22..c1ee225dce 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -48,6 +48,7 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown" /datum/wires/Destroy() holder = null + signallers.Cut() return ..() /datum/wires/proc/GenerateWires() diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index b98b2370ce..610e5577f6 100755 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -48,7 +48,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station var/obj/machinery/power/apc/apc = null var/no_air = null // var/list/lights // list of all lights on this area - var/list/all_doors = list() //Added by Strumpetplaya - Alarm Change - Contains a list of doors adjacent to this area + var/list/all_doors = null //Added by Strumpetplaya - Alarm Change - Contains a list of doors adjacent to this area var/firedoors_closed = 0 var/list/ambience = list('sound/ambience/ambigen1.ogg','sound/ambience/ambigen3.ogg','sound/ambience/ambigen4.ogg','sound/ambience/ambigen5.ogg','sound/ambience/ambigen6.ogg','sound/ambience/ambigen7.ogg','sound/ambience/ambigen8.ogg','sound/ambience/ambigen9.ogg','sound/ambience/ambigen10.ogg','sound/ambience/ambigen11.ogg','sound/ambience/ambigen12.ogg','sound/ambience/ambigen14.ogg') var/list/forced_ambience = null diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 4a77ec2c84..6ce2de18d3 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -75,6 +75,8 @@ /area/proc/firedoors_close() if(!firedoors_closed) firedoors_closed = TRUE + if(!all_doors) + return for(var/obj/machinery/door/firedoor/E in all_doors) if(!E.blocked) if(E.operating) @@ -87,6 +89,8 @@ /area/proc/firedoors_open() if(firedoors_closed) firedoors_closed = FALSE + if(!all_doors) + return for(var/obj/machinery/door/firedoor/E in all_doors) if(!E.blocked) if(E.operating) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index fe9f99b032..64ae0722f8 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -23,16 +23,6 @@ if(auto_init && ticker && ticker.current_state == GAME_STATE_PLAYING) initialize() -/atom/movable/Del() - if(isnull(gcDestroyed) && loc) - testing("GC: -- [type] was deleted via del() rather than qdel() --") - crash_with("GC: -- [type] was deleted via del() rather than qdel() --") // stick a stack trace in the runtime logs -// else if(isnull(gcDestroyed)) -// testing("GC: [type] was deleted via GC without qdel()") //Not really a huge issue but from now on, please qdel() -// else -// testing("GC: [type] was deleted via GC with qdel()") - ..() - /atom/movable/Destroy() . = ..() if(reagents) @@ -53,7 +43,7 @@ pulledby = null /atom/movable/proc/initialize() - if(!isnull(gcDestroyed)) + if(QDELETED(src)) crash_with("GC: -- [type] had initialize() called after qdel() --") /atom/movable/Bump(var/atom/A, yes) diff --git a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm index 6f549d15f4..90ac43379f 100644 --- a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm +++ b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm @@ -37,7 +37,6 @@ var/global/universe_has_ended = 0 // Apply changes when entering state /datum/universal_state/supermatter_cascade/OnEnter() set background = 1 - garbage_collector.garbage_collect = 0 world << "You are blinded by a brilliant flash of energy." world << sound('sound/effects/cascade.ogg') diff --git a/code/game/gamemodes/events/clang.dm b/code/game/gamemodes/events/clang.dm index 8ab197a1cb..e88492e5d1 100644 --- a/code/game/gamemodes/events/clang.dm +++ b/code/game/gamemodes/events/clang.dm @@ -41,6 +41,10 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 if(clong && prob(25)) src.loc = clong.loc + Destroy() + walk(src, 0) // Because we might have called walk_towards, we must stop the walk loop or BYOND keeps an internal reference to us forever. + return ..() + /proc/immovablerod() var/startx = 0 var/starty = 0 diff --git a/code/game/gamemodes/events/dust.dm b/code/game/gamemodes/events/dust.dm index 2397ae1a14..d7d551396e 100644 --- a/code/game/gamemodes/events/dust.dm +++ b/code/game/gamemodes/events/dust.dm @@ -90,6 +90,10 @@ The "dust" will damage the hull of the station causin minor hull breaches. walk_towards(src, goal, 1) return + Destroy() + walk(src, 0) // Because we might have called walk_towards, we must stop the walk loop or BYOND keeps an internal reference to us forever. + return ..() + touch_map_edge() qdel(src) diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 9e4dff2ce5..4567a1da51 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -62,6 +62,7 @@ var/global/datum/controller/gameticker/ticker vote.process() if(pregame_timeleft <= 0) current_state = GAME_STATE_SETTING_UP + Master.SetRunLevel(RUNLEVEL_SETUP) while (!setup()) @@ -74,6 +75,7 @@ var/global/datum/controller/gameticker/ticker if((master_mode=="random") || (master_mode=="secret")) if(!runnable_modes.len) current_state = GAME_STATE_PREGAME + Master.SetRunLevel(RUNLEVEL_LOBBY) world << "Unable to choose playable game mode. Reverting to pre-game lobby." return 0 if(secret_force_mode != "secret") @@ -88,6 +90,7 @@ var/global/datum/controller/gameticker/ticker if(!src.mode) current_state = GAME_STATE_PREGAME + Master.SetRunLevel(RUNLEVEL_LOBBY) world << "Serious error in mode setup! Reverting to pre-game lobby." return 0 @@ -99,6 +102,7 @@ var/global/datum/controller/gameticker/ticker if(!src.mode.can_start()) world << "Unable to start [mode.name]. Not enough players, [mode.required_players] players needed. Reverting to pre-game lobby." current_state = GAME_STATE_PREGAME + Master.SetRunLevel(RUNLEVEL_LOBBY) mode.fail_setup() mode = null job_master.ResetOccupations() @@ -127,6 +131,7 @@ var/global/datum/controller/gameticker/ticker shuttle_controller.setup_shuttle_docks() + // TODO - Leshana - Dear God Fix This. Fix all of this. Not just this line, this entire proc. This entire file! spawn(0)//Forking here so we dont have to wait for this to finish mode.post_setup() //Cleanup some stuff @@ -155,6 +160,7 @@ var/global/datum/controller/gameticker/ticker */ processScheduler.start() + Master.SetRunLevel(RUNLEVEL_GAME) if(config.sql_enabled) statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE @@ -319,6 +325,7 @@ var/global/datum/controller/gameticker/ticker if(!mode.explosion_in_progress && game_finished && (mode_finished || post_game)) current_state = GAME_STATE_FINISHED + Master.SetRunLevel(RUNLEVEL_POSTGAME) spawn declare_completion() diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index ad8b89ec80..f0135c5356 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -133,7 +133,7 @@ /obj/effect/meteor/Destroy() walk(src,0) //this cancels the walk_towards() proc - ..() + return ..() /obj/effect/meteor/New() ..() @@ -271,8 +271,7 @@ if(explode) explosion(src.loc, devastation_range = 0, heavy_impact_range = 0, light_impact_range = 4, flash_range = 6, adminlog = 0) new /obj/effect/decal/cleanable/greenglow(get_turf(src)) - for(var/mob/living/L in view(10, src)) - L.apply_effect(40, IRRADIATE) + radiation_repository.radiate(src, 50) // This meteor fries toasters. /obj/effect/meteor/emp diff --git a/code/game/machinery/CableLayer.dm b/code/game/machinery/CableLayer.dm index 2b4eae9a0d..2e10ed3b1b 100644 --- a/code/game/machinery/CableLayer.dm +++ b/code/game/machinery/CableLayer.dm @@ -73,7 +73,7 @@ visible_message("A red light flashes on \the [src].") return cable.use(amount) - if(deleted(cable)) + if(QDELETED(cable)) cable = null return 1 diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 4d56d6662d..5696892ddc 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -8,6 +8,7 @@ use_power = 1 idle_power_usage = 1 active_power_usage = 5 + surgery_odds = 100 var/mob/living/carbon/human/victim = null var/strapped = 0.0 var/obj/machinery/computer/operating/computer = null diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index b1cf9bac08..f980cfd0b1 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -287,8 +287,9 @@ var/bloodData[0] if(H.vessel) var/blood_volume = round(H.vessel.get_reagent_amount("blood")) + var/blood_max = H.species.blood_volume bloodData["volume"] = blood_volume - bloodData["percent"] = round(((blood_volume / 560)*100)) + bloodData["percent"] = round(((blood_volume / blood_max)*100)) occupantData["blood"] = bloodData @@ -459,7 +460,8 @@ if(occupant.vessel) var/blood_volume = round(occupant.vessel.get_reagent_amount("blood")) - var/blood_percent = blood_volume / 560 + var/blood_max = occupant.species.blood_volume + var/blood_percent = blood_volume / blood_max blood_percent *= 100 extra_font = " 448 ? "blue" : "red"]>" diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm index b7bcc53e91..deee8ed76b 100644 --- a/code/game/machinery/atmoalter/portable_atmospherics.dm +++ b/code/game/machinery/atmoalter/portable_atmospherics.dm @@ -21,9 +21,9 @@ return 1 /obj/machinery/portable_atmospherics/Destroy() - qdel(air_contents) - qdel(holding) - ..() + qdel_null(air_contents) + qdel_null(holding) + . = ..() /obj/machinery/portable_atmospherics/initialize() . = ..() @@ -40,11 +40,6 @@ else update_icon() -/obj/machinery/portable_atmospherics/Destroy() - qdel(air_contents) - - ..() - /obj/machinery/portable_atmospherics/proc/StandardAirMix() return list( "oxygen" = O2STANDARD * MolesForPressure(), diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 2953f0de87..50d6988e35 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -144,7 +144,7 @@ if(is_robot_module(O)) return 0 - if(istype(O,/obj/item/ammo_magazine/clip) || istype(O,/obj/item/ammo_magazine/a357) || istype(O,/obj/item/ammo_magazine/c38)) // Prevents ammo recycling exploit with speedloaders. + if(istype(O,/obj/item/ammo_magazine/clip) || istype(O,/obj/item/ammo_magazine/s357) || istype(O,/obj/item/ammo_magazine/s38)) // Prevents ammo recycling exploit with speedloaders. user << "\The [O] is too hazardous to recycle with the autolathe!" return /* ToDo: Make this actually check for ammo and change the value of the magazine if it's empty. -Spades @@ -262,7 +262,7 @@ stored_material[material] = max(0, stored_material[material] - round(making.resources[material] * mat_efficiency) * multiplier) update_icon() // So lid closes - + sleep(build_time) busy = 0 diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index b105222084..85d97a2b30 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -206,7 +206,7 @@ user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) if (W.force >= src.toughness) user.do_attack_animation(src) - visible_message("[src] has been [pick(W.attack_verb)] with [W] by [user]!") + visible_message("[src] has been [W.attack_verb.len? pick(W.attack_verb) : "attacked"] with [W] by [user]!") if (istype(W, /obj/item)) //is it even possible to get into attackby() with non-items? var/obj/item/I = W if (I.hitsound) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 1c3d957b98..1a1bd9a463 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -181,7 +181,7 @@ use_power(7500) //This might need tweaking. return - else if((occupant.health >= heal_level) && (!eject_wait)) + else if((occupant.health >= heal_level || occupant.health == occupant.maxHealth) && (!eject_wait)) playsound(src.loc, 'sound/machines/ding.ogg', 50, 1) audible_message("\The [src] signals that the cloning process is complete.") connected_message("Cloning Process Complete.") diff --git a/code/game/machinery/computer/ai_core.dm b/code/game/machinery/computer/ai_core.dm index 009c12403d..34a9ebd58c 100644 --- a/code/game/machinery/computer/ai_core.dm +++ b/code/game/machinery/computer/ai_core.dm @@ -189,7 +189,7 @@ /obj/structure/AIcore/deactivated/Destroy() if(src in empty_playable_ai_cores) empty_playable_ai_cores -= src - ..() + return ..() /obj/structure/AIcore/deactivated/proc/load_ai(var/mob/living/silicon/ai/transfer, var/obj/item/device/aicard/card, var/mob/user) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 672a6a425b..72c9ae47af 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -314,7 +314,7 @@ if(occupant) occupant.forceMove(loc) occupant.resting = 1 - ..() + return ..() /obj/machinery/cryopod/initialize() ..() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index e78cba3568..5e43231ed6 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -263,6 +263,7 @@ icon = 'icons/obj/doors/Dooruranium.dmi' mineral = "uranium" var/last_event = 0 + var/rad_power = 7.5 /obj/machinery/door/airlock/process() // Deliberate no call to parent. @@ -280,15 +281,10 @@ /obj/machinery/door/airlock/uranium/process() if(world.time > last_event+20) if(prob(50)) - radiate() + radiation_repository.radiate(src, rad_power) last_event = world.time ..() -/obj/machinery/door/airlock/uranium/proc/radiate() - for(var/mob/living/L in range (3,src)) - L.apply_effect(15,IRRADIATE,0) - return - /obj/machinery/door/airlock/phoron name = "Phoron Airlock" desc = "No way this can end badly." @@ -757,6 +753,9 @@ About the new airlock wires panel: update_icon() return 1 +/obj/machinery/door/airlock/proc/can_remove_electronics() + return src.p_open && (operating < 0 || (!operating && welded && !src.arePowerSystemsOn() && density && (!src.locked || (stat & BROKEN)))) + /obj/machinery/door/airlock/attackby(C as obj, mob/user as mob) //world << text("airlock attackby src [] obj [] mob []", src, C, user) if(!istype(usr, /mob/living/silicon)) @@ -801,7 +800,7 @@ About the new airlock wires panel: var/obj/item/weapon/pai_cable/cable = C cable.plugin(src, user) else if(!repairing && istype(C, /obj/item/weapon/crowbar)) - if(src.p_open && (operating < 0 || (!operating && welded && !src.arePowerSystemsOn() && density && (!src.locked || (stat & BROKEN)))) ) + if(can_remove_electronics()) playsound(src.loc, 'sound/items/Crowbar.ogg', 75, 1) user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to remove electronics from the airlock assembly.") if(do_after(user,40)) diff --git a/code/game/machinery/doors/airlock_control.dm b/code/game/machinery/doors/airlock_control.dm index 805bb7dba9..ba8aa85b2c 100644 --- a/code/game/machinery/doors/airlock_control.dm +++ b/code/game/machinery/doors/airlock_control.dm @@ -145,7 +145,7 @@ obj/machinery/door/airlock/New() obj/machinery/door/airlock/Destroy() if(frequency && radio_controller) radio_controller.remove_object(src,frequency) - ..() + return ..() obj/machinery/airlock_sensor icon = 'icons/obj/airlock_machines.dmi' @@ -220,7 +220,7 @@ obj/machinery/airlock_sensor/New() obj/machinery/airlock_sensor/Destroy() if(radio_controller) radio_controller.remove_object(src,frequency) - ..() + return ..() obj/machinery/airlock_sensor/airlock_interior command = "cycle_interior" @@ -292,7 +292,7 @@ obj/machinery/access_button/New() obj/machinery/access_button/Destroy() if(radio_controller) radio_controller.remove_object(src, frequency) - ..() + return ..() obj/machinery/access_button/airlock_interior frequency = 1379 diff --git a/code/game/machinery/doors/blast_door.dm b/code/game/machinery/doors/blast_door.dm index 3d899377cc..41680d3de7 100644 --- a/code/game/machinery/doors/blast_door.dm +++ b/code/game/machinery/doors/blast_door.dm @@ -13,7 +13,7 @@ icon = 'icons/obj/doors/rapid_pdoor.dmi' icon_state = null min_force = 20 //minimum amount of force needed to damage the door with a melee weapon - + var/material/implicit_material // Icon states for different shutter types. Simply change this instead of rewriting the update_icon proc. var/icon_state_open = null var/icon_state_opening = null @@ -29,6 +29,13 @@ //turning this off prevents awkward zone geometry in places like medbay lobby, for example. block_air_zones = 0 +/obj/machinery/door/blast/initialize() + ..() + implicit_material = get_material_by_name("plasteel") + +/obj/machinery/door/blast/get_material() + return implicit_material + // Proc: Bumped() // Parameters: 1 (AM - Atom that tried to walk through this object) // Description: If we are open returns zero, otherwise returns result of parent function. @@ -46,6 +53,7 @@ icon_state = icon_state_closed else icon_state = icon_state_open + radiation_repository.resistance_cache.Remove(get_turf(src)) return // Proc: force_open() diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 7a1d6abd02..240610358f 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -73,8 +73,7 @@ /obj/machinery/door/Destroy() density = 0 update_nearby_tiles() - ..() - return + . = ..() /obj/machinery/door/process() if(close_door_at && world.time >= close_door_at) @@ -362,6 +361,7 @@ icon_state = "door1" else icon_state = "door0" + radiation_repository.resistance_cache.Remove(get_turf(src)) return diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 1162264dd7..6ccbb46ac1 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -60,18 +60,18 @@ var/area/A = get_area(src) ASSERT(istype(A)) - A.all_doors.Add(src) + LAZYADD(A.all_doors, src) areas_added = list(A) for(var/direction in cardinal) A = get_area(get_step(src,direction)) if(istype(A) && !(A in areas_added)) - A.all_doors.Add(src) + LAZYADD(A.all_doors, src) areas_added += A /obj/machinery/door/firedoor/Destroy() for(var/area/A in areas_added) - A.all_doors.Remove(src) + LAZYREMOVE(A.all_doors, src) . = ..() /obj/machinery/door/firedoor/get_material() diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 13352a1645..32ad7a2aae 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -60,7 +60,7 @@ /obj/machinery/door/window/Destroy() density = 0 update_nearby_tiles() - ..() + return ..() /obj/machinery/door/window/Bumped(atom/movable/AM as mob|obj) if (!( ismob(AM) )) diff --git a/code/game/machinery/floor_light.dm b/code/game/machinery/floor_light.dm index a134e68e3f..fdaf284f3f 100644 --- a/code/game/machinery/floor_light.dm +++ b/code/game/machinery/floor_light.dm @@ -150,7 +150,7 @@ var/list/floor_light_cache = list() var/area/A = get_area(src) if(A) on = 0 - ..() + . = ..() /obj/machinery/floor_light/cultify() default_light_colour = "#FF0000" diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 158b718e83..e0156196d6 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -202,7 +202,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ /obj/machinery/hologram/holopad/Destroy() for (var/mob/living/silicon/ai/master in masters) clear_holo(master) - ..() + return ..() /* Holographic project of everything else. diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 4abdb685d0..06228dd86f 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -485,7 +485,7 @@ Buildable meters var/turf/T = P.loc P.level = !T.is_plating() ? 2 : 1 P.initialize() - if (deleted(P)) + if (QDELETED(P)) usr << pipefailtext return 1 P.build_network() @@ -504,7 +504,7 @@ Buildable meters var/turf/T = P.loc P.level = !T.is_plating() ? 2 : 1 P.initialize() - if (deleted(P)) + if (QDELETED(P)) usr << pipefailtext return 1 P.build_network() @@ -523,7 +523,7 @@ Buildable meters var/turf/T = P.loc P.level = !T.is_plating() ? 2 : 1 P.initialize() - if (deleted(P)) + if (QDELETED(P)) usr << pipefailtext return 1 P.build_network() @@ -542,7 +542,7 @@ Buildable meters var/turf/T = P.loc P.level = !T.is_plating() ? 2 : 1 P.initialize() - if (deleted(P)) + if (QDELETED(P)) usr << pipefailtext return 1 P.build_network() @@ -559,7 +559,7 @@ Buildable meters P.initialize_directions = pipe_dir //this var it's used to know if the pipe is bent or not P.initialize_directions_he = pipe_dir P.initialize() - if (deleted(P)) + if (QDELETED(P)) usr << pipefailtext return 1 P.build_network() @@ -594,7 +594,7 @@ Buildable meters var/turf/T = M.loc M.level = !T.is_plating() ? 2 : 1 M.initialize() - if (deleted(M)) + if (QDELETED(M)) usr << pipefailtext return 1 M.build_network() @@ -663,7 +663,7 @@ Buildable meters var/turf/T = M.loc M.level = !T.is_plating() ? 2 : 1 M.initialize() - if (deleted(M)) + if (QDELETED(M)) usr << pipefailtext return 1 M.build_network() @@ -740,7 +740,7 @@ Buildable meters P.initialize_directions = src.get_pdir() P.initialize_directions_he = src.get_hdir() P.initialize() - if (deleted(P)) + if (QDELETED(P)) usr << pipefailtext //"There's nothing to connect this pipe to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" return 1 P.build_network() @@ -922,7 +922,7 @@ Buildable meters var/turf/T = P.loc P.level = !T.is_plating() ? 2 : 1 P.initialize() - if (deleted(P)) + if (QDELETED(P)) usr << pipefailtext return 1 P.build_network() diff --git a/code/game/machinery/pipe/pipelayer.dm b/code/game/machinery/pipe/pipelayer.dm index 40726825a1..c960879e54 100644 --- a/code/game/machinery/pipe/pipelayer.dm +++ b/code/game/machinery/pipe/pipelayer.dm @@ -23,9 +23,8 @@ update_icon() /obj/machinery/pipelayer/Destroy() - qdel(W) - W = null - ..() + qdel_null(W) + . = ..() /obj/machinery/pipelayer/RefreshParts() var/mb_rating = 0 diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 2854d0ac25..64aecd9c0f 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -97,7 +97,7 @@ var/list/obj/machinery/requests_console/allConsoles = list() req_console_supplies -= department if(departmentType & RC_INFO) req_console_information -= department - ..() + return ..() /obj/machinery/requests_console/attack_hand(user as mob) if(..(user)) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 3d53a053f0..58bed70d07 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -1029,7 +1029,7 @@ icon_state = "engivend" icon_deny = "engivend-deny" req_access = list(access_engine_equip) - products = list(/obj/item/clothing/glasses/meson = 2,/obj/item/device/multitool = 4,/obj/item/weapon/cell/high = 10, + products = list(/obj/item/device/geiger = 4,/obj/item/clothing/glasses/meson = 2,/obj/item/device/multitool = 4,/obj/item/weapon/cell/high = 10, /obj/item/weapon/airlock_electronics = 10,/obj/item/weapon/module/power_control = 10, /obj/item/weapon/circuitboard/airalarm = 10,/obj/item/weapon/circuitboard/firealarm = 10,/obj/item/weapon/circuitboard/status_display = 2, /obj/item/weapon/circuitboard/ai_status_display = 2,/obj/item/weapon/circuitboard/newscaster = 2,/obj/item/weapon/circuitboard/holopad = 2, diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index cf96260358..f245682861 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -115,7 +115,7 @@ user << "You can't fit \the [W] inside." return - else if(istype(W, /obj/item/clothing)) + else if(istype(W, /obj/item/clothing) || istype(W, /obj/item/weapon/bedsheet)) if(washing.len < 5) if(state in list(1, 3)) user.drop_item() diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index 9b2e0aa26d..4d7ee902d8 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -973,11 +973,7 @@ process(var/obj/item/mecha_parts/mecha_equipment/generator/nuclear/EG) if(..()) - for(var/mob/living/carbon/M in view(EG.chassis)) - if(istype(M,/mob/living/carbon/human)) - M.apply_effect((EG.rad_per_cycle*3),IRRADIATE,0) - else - M.apply_effect(EG.rad_per_cycle, IRRADIATE) + radiation_repository.radiate(EG, (EG.rad_per_cycle * 3)) return 1 diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 09ff0075db..5d7d16a126 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -140,18 +140,14 @@ cell = null internal_tank = null - qdel(pr_int_temp_processor) - qdel(pr_inertial_movement) - qdel(pr_give_air) - qdel(pr_internal_damage) - qdel(spark_system) - pr_int_temp_processor = null - pr_give_air = null - pr_internal_damage = null - spark_system = null + qdel_null(pr_int_temp_processor) + qdel_null(pr_inertial_movement) + qdel_null(pr_give_air) + qdel_null(pr_internal_damage) + qdel_null(spark_system) mechas_list -= src //global mech list - ..() + . = ..() //////////////////////// ////// Helpers ///////// diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 8dfe627030..c963a902bb 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -21,11 +21,6 @@ if(can_buckle && istype(M)) user_buckle_mob(M, user) -//Cleanup -/obj/Del() - unbuckle_mob() - return ..() - /obj/Destroy() unbuckle_mob() return ..() diff --git a/code/game/objects/effects/chem/chemsmoke.dm b/code/game/objects/effects/chem/chemsmoke.dm index 45cfcc8348..be7e759a63 100644 --- a/code/game/objects/effects/chem/chemsmoke.dm +++ b/code/game/objects/effects/chem/chemsmoke.dm @@ -12,6 +12,10 @@ create_reagents(500) return +/obj/effect/effect/smoke/chem/Destroy() + walk(src, 0) // Because we might have called walk_to, we must stop the walk loop or BYOND keeps an internal reference to us forever. + return ..() + /datum/effect/effect/system/smoke_spread/chem smoke_type = /obj/effect/effect/smoke/chem var/obj/chemholder @@ -166,7 +170,7 @@ sleep(150+rand(0,20)) // turning it off before it is deleted results in cleaner smoke.set_opacity(0) // lighting and view range updates fadeOut(smoke) - qdel(src) + qdel(smoke) /datum/effect/effect/system/smoke_spread/chem/spores/spawnSmoke(var/turf/T, var/icon/I, var/dist = 1) var/obj/effect/effect/smoke/chem/spores = new /obj/effect/effect/smoke/chem(location) diff --git a/code/game/objects/effects/chem/foam.dm b/code/game/objects/effects/chem/foam.dm index 5f29bd6448..2c28dd7ecb 100644 --- a/code/game/objects/effects/chem/foam.dm +++ b/code/game/objects/effects/chem/foam.dm @@ -139,7 +139,7 @@ /obj/structure/foamedmetal/Destroy() density = 0 update_nearby_tiles(1) - ..() + return ..() /obj/structure/foamedmetal/proc/updateicon() if(metal == 1) diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 2343871b95..a3b3ab81cb 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -13,11 +13,6 @@ would spawn and follow the beaker, even if it is carried or thrown. unacidable = 1//So effect are not targeted by alien acid. pass_flags = PASSTABLE | PASSGRILLE -/obj/effect/Destroy() - if(reagents) - reagents.delete() - return ..() - /datum/effect/effect/system var/number = 3 var/cardinals = 0 @@ -184,8 +179,10 @@ steam.start() -- spawns the effect /obj/effect/effect/smoke/New() ..() - spawn (time_to_live) - qdel(src) + if(time_to_live) + spawn (time_to_live) + if(!QDELETED(src)) + qdel(src) /obj/effect/effect/smoke/Crossed(mob/living/carbon/M as mob ) ..() diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 4396465bc9..c38b07f402 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -94,7 +94,7 @@ var/obj/item/organ/external/O = loc O.implants -= src - ..() + return ..() /obj/effect/spider/eggcluster/process() amount_grown += rand(0,2) @@ -138,7 +138,8 @@ /obj/effect/spider/spiderling/Destroy() processing_objects -= src - ..() + walk(src, 0) // Because we might have called walk_to, we must stop the walk loop or BYOND keeps an internal reference to us forever. + return ..() /obj/effect/spider/spiderling/Bump(atom/user) if(istype(user, /obj/structure/table)) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 4d77da4ae9..16e27006b4 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -149,12 +149,9 @@ ..() /obj/structure/closet/body_bag/cryobag/Destroy() - if(syringe) - qdel(syringe) - syringe = null - qdel(tank) - tank = null - ..() + qdel_null(syringe) + qdel_null(tank) + return ..() /obj/structure/closet/body_bag/cryobag/open() . = ..() diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 88f69d8011..7f1d83cc4a 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -1470,8 +1470,12 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/Destroy() PDAs -= src if (src.id && prob(90)) //IDs are kept in 90% of the cases - src.id.loc = get_turf(src.loc) - ..() + src.id.forceMove(get_turf(src.loc)) + else + qdel_null(src.id) + qdel_null(src.cartridge) + qdel_null(src.pai) + return ..() /obj/item/device/pda/clown/Crossed(AM as mob|obj) //Clown PDA is slippery. if (istype(AM, /mob/living)) diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index 2c4368736e..c53ba712db 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -78,6 +78,10 @@ var/list/civilian_cartridges = list( var/message2 var/list/stored_data = list() +/obj/item/weapon/cartridge/Destroy() + qdel_null(radio) + return ..() + /obj/item/weapon/cartridge/engineering name = "\improper Power-ON cartridge" icon_state = "cart-e" @@ -164,10 +168,6 @@ var/list/civilian_cartridges = list( radio = new /obj/item/radio/integrated/signal(src) ..() -/obj/item/weapon/cartridge/signal/Destroy() - qdel(radio) - ..() - /obj/item/weapon/cartridge/quartermaster name = "\improper Space Parts & Space Vendors cartridge" desc = "Perfect for the Quartermaster on the go!" diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/game/objects/items/devices/PDA/radio.dm index 5e7d63e1e9..019425db0e 100644 --- a/code/game/objects/items/devices/PDA/radio.dm +++ b/code/game/objects/items/devices/PDA/radio.dm @@ -103,7 +103,7 @@ /obj/item/radio/integrated/beepsky/Destroy() if(radio_controller) radio_controller.remove_object(src, control_freq) - ..() + return ..() /* * Radio Cartridge, essentially a signaler. @@ -152,4 +152,4 @@ /obj/item/radio/integrated/signal/Destroy() if(radio_controller) radio_controller.remove_object(src, frequency) - ..() + return ..() diff --git a/code/game/objects/items/devices/communicator/communicator.dm b/code/game/objects/items/devices/communicator/communicator.dm index 018be58705..49999f12de 100644 --- a/code/game/objects/items/devices/communicator/communicator.dm +++ b/code/game/objects/items/devices/communicator/communicator.dm @@ -256,12 +256,12 @@ var/global/list/obj/item/device/communicator/all_communicators = list() if(exonet) exonet.remove_address() exonet = null - ..() + return ..() // Proc: ui_interact() // Parameters: 4 (standard NanoUI arguments) // Description: Uses a bunch of for loops to turn lists into lists of lists, so they can be displayed in nanoUI, then displays various buttons to the user. -/obj/item/device/communicator/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) +/obj/item/device/communicator/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/key_state = null) // this is the data which will be sent to the ui var/data[0] //General nanoUI information var/communicators[0] //List of communicators @@ -356,7 +356,7 @@ var/global/list/obj/item/device/communicator/all_communicators = list() if(!ui) // the ui does not exist, so we'll create a new() one // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm - ui = new(user, src, ui_key, "communicator.tmpl", "Communicator", 475, 700) + ui = new(user, src, ui_key, "communicator.tmpl", "Communicator", 475, 700, state = key_state) // when the ui is first opened this is the data it will use ui.set_initial_data(data) // open the new ui window @@ -803,7 +803,7 @@ var/global/list/obj/item/device/communicator/all_communicators = list() if(exonet) exonet.remove_address() exonet = null - ..() + return ..() // Proc: update_icon() // Parameters: None diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index c3cbf5f7ef..996f848849 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -37,7 +37,7 @@ /obj/item/device/flashlight/Destroy() if(power_use) processing_objects -= src - ..() + return ..() /obj/item/device/flashlight/verb/toggle() set name = "Toggle Flashlight Brightness" diff --git a/code/game/objects/items/devices/geiger.dm b/code/game/objects/items/devices/geiger.dm new file mode 100644 index 0000000000..62cb9d9862 --- /dev/null +++ b/code/game/objects/items/devices/geiger.dm @@ -0,0 +1,53 @@ +#define RAD_LEVEL_LOW 5 //10 // Around the level at which radiation starts to become harmful +#define RAD_LEVEL_MODERATE 15 //15 +#define RAD_LEVEL_HIGH 50 //50 +#define RAD_LEVEL_VERY_HIGH 100 //100 + +//Geiger counter +//Rewritten version of TG's geiger counter +//I opted to show exact radiation levels + +/obj/item/device/geiger + name = "geiger counter" + desc = "A handheld device used for detecting and measuring radiation in an area." + icon_state = "geiger_off" + item_state = "multitool" + w_class = ITEMSIZE_SMALL + var/scanning = 0 + var/radiation_count = 0 + +/obj/item/device/geiger/New() + processing_objects |= src + +/obj/item/device/geiger/process() + if(!scanning) + return + radiation_count = radiation_repository.get_rads_at_turf(get_turf(src)) + update_icon() + +/obj/item/device/geiger/examine(mob/user) + ..(user) + to_chat(user, "[scanning ? "ambient" : "stored"] radiation level: [radiation_count ? radiation_count : "0"]Bq.") + +/obj/item/device/geiger/attack_self(var/mob/user) + scanning = !scanning + update_icon() + to_chat(user, "\icon[src] You switch [scanning ? "on" : "off"] [src].") + +/obj/item/device/geiger/update_icon() + if(!scanning) + icon_state = "geiger_off" + return 1 + + switch(radiation_count) + if(null) icon_state = "geiger_on_1" + if(-INFINITY to RAD_LEVEL_LOW) icon_state = "geiger_on_1" + if(RAD_LEVEL_LOW + 1 to RAD_LEVEL_MODERATE) icon_state = "geiger_on_2" + if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH) icon_state = "geiger_on_3" + if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH) icon_state = "geiger_on_4" + if(RAD_LEVEL_VERY_HIGH + 1 to INFINITY) icon_state = "geiger_on_5" + +#undef RAD_LEVEL_LOW +#undef RAD_LEVEL_MODERATE +#undef RAD_LEVEL_HIGH +#undef RAD_LEVEL_VERY_HIGH \ No newline at end of file diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index e0e05ff467..8e1803ad40 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -27,7 +27,8 @@ //Will stop people throwing friend pAIs into the singularity so they can respawn if(!isnull(pai)) pai.death(0) - ..() + qdel_null(radio) + return ..() /obj/item/device/paicard/attack_self(mob/user) if (!in_range(src, user)) diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 8e9a72d203..106d144834 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -96,7 +96,7 @@ /obj/item/device/radio/intercom/Destroy() processing_objects -= src - ..() + return ..() /obj/item/device/radio/intercom/attack_ai(mob/user as mob) src.add_fingerprint(user) diff --git a/code/game/objects/items/devices/radio/jammer.dm b/code/game/objects/items/devices/radio/jammer.dm index 9e99e1837f..77879244d2 100644 --- a/code/game/objects/items/devices/radio/jammer.dm +++ b/code/game/objects/items/devices/radio/jammer.dm @@ -33,10 +33,8 @@ var/global/list/active_radio_jammers = list() /obj/item/device/radio_jammer/Destroy() if(on) turn_off() - if(power_source) - qdel(power_source) - power_source = null - ..() + qdel_null(power_source) + return ..() /obj/item/device/radio_jammer/proc/turn_off(mob/user) if(user) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 5d883784aa..cfd0693b15 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -99,6 +99,8 @@ REAGENT SCANNER if(M.status_flags & FAKEDEATH) OX = fake_oxy > 50 ? "Severe oxygen deprivation detected" : "Subject bloodstream oxygen level normal" user.show_message("[OX] | [TX] | [BU] | [BR]") + if(M.radiation) + user.show_message("Radiation detected.") if(istype(M, /mob/living/carbon)) var/mob/living/carbon/C = M if(C.reagents.total_volume) diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 88b53bd342..35697914ee 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -169,7 +169,7 @@ valve_open = 0 - if(deleted(tank_one) || deleted(tank_two)) + if(QDELETED(tank_one) || QDELETED(tank_two)) return var/ratio1 = tank_one.air_contents.volume/tank_two.air_contents.volume diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index 84bee72558..649b5677ca 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -27,15 +27,10 @@ /obj/item/weapon/flamethrower/Destroy() - if(weldtool) - qdel(weldtool) - if(igniter) - qdel(igniter) - if(ptank) - qdel(ptank) - ..() - return - + qdel_null(weldtool) + qdel_null(igniter) + qdel_null(ptank) + . = ..() /obj/item/weapon/flamethrower/process() if(!lit) diff --git a/code/game/objects/items/weapons/grenades/chem_grenade.dm b/code/game/objects/items/weapons/grenades/chem_grenade.dm index 0ec3dc13df..9d6b5d6bd3 100644 --- a/code/game/objects/items/weapons/grenades/chem_grenade.dm +++ b/code/game/objects/items/weapons/grenades/chem_grenade.dm @@ -19,6 +19,11 @@ New() create_reagents(1000) + Destroy() + qdel_null(detonator) + qdel_null_list(beakers) + return ..() + attack_self(mob/user as mob) if(!stage || stage==1) if(detonator) diff --git a/code/game/objects/items/weapons/grenades/flashbang.dm b/code/game/objects/items/weapons/grenades/flashbang.dm index d02ccf2185..940029e735 100644 --- a/code/game/objects/items/weapons/grenades/flashbang.dm +++ b/code/game/objects/items/weapons/grenades/flashbang.dm @@ -91,6 +91,10 @@ M << "Your ears start to ring!" M.update_icons() +/obj/item/weapon/grenade/flashbang/Destroy() + walk(src, 0) // Because we might have called walk_away, we must stop the walk loop or BYOND keeps an internal reference to us forever. + return ..() + /obj/item/weapon/grenade/flashbang/clusterbang//Created by Polymorph, fixed by Sieve desc = "Use of this weapon may constiute a war crime in your area, consult your local Colony Director." name = "clusterbang" diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index 6554e80f8b..806047ae37 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -52,7 +52,7 @@ /obj/item/weapon/implant/Destroy() if(part) part.implants.Remove(src) - ..() + return ..() /obj/item/weapon/implant/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/weapon/implanter)) @@ -452,11 +452,11 @@ the implant may become unstable and either pre-maturely inject the subject or si var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) if(istype(t, /area/syndicate_station) || istype(t, /area/syndicate_mothership) || istype(t, /area/shuttle/syndicate_elite) ) //give the syndies a bit of stealth - a.autosay("[mobname] has died in Space!", "[mobname]'s Death Alarm", "General") + a.autosay("[mobname] has died in Space!", "[mobname]'s Death Alarm") // a.autosay("[mobname] has died in Space!", "[mobname]'s Death Alarm", "Security") // a.autosay("[mobname] has died in Space!", "[mobname]'s Death Alarm", "Medical") else - a.autosay("[mobname] has died in [t.name]!", "[mobname]'s Death Alarm", "General") + a.autosay("[mobname] has died in [t.name]!", "[mobname]'s Death Alarm") // a.autosay("[mobname] has died in [t.name]!", "[mobname]'s Death Alarm", "Security") // a.autosay("[mobname] has died in [t.name]!", "[mobname]'s Death Alarm", "Medical") qdel(a) @@ -464,13 +464,13 @@ the implant may become unstable and either pre-maturely inject the subject or si if ("emp") var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) var/name = prob(50) ? t.name : pick(teleportlocs) - a.autosay("[mobname] has died in [name]!", "[mobname]'s Death Alarm", "General") + a.autosay("[mobname] has died in [name]!", "[mobname]'s Death Alarm") // a.autosay("[mobname] has died in [name]!", "[mobname]'s Death Alarm", "Security") // a.autosay("[mobname] has died in [name]!", "[mobname]'s Death Alarm", "Medical") qdel(a) else var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) - a.autosay("[mobname] has died-zzzzt in-in-in...", "[mobname]'s Death Alarm", "General") + a.autosay("[mobname] has died-zzzzt in-in-in...", "[mobname]'s Death Alarm") // a.autosay("[mobname] has died-zzzzt in-in-in...", "[mobname]'s Death Alarm", "Security") // a.autosay("[mobname] has died-zzzzt in-in-in...", "[mobname]'s Death Alarm", "Medical") qdel(a) diff --git a/code/game/objects/items/weapons/material/material_armor.dm b/code/game/objects/items/weapons/material/material_armor.dm index 1041fb5d1f..990ae37659 100644 --- a/code/game/objects/items/weapons/material/material_armor.dm +++ b/code/game/objects/items/weapons/material/material_armor.dm @@ -42,7 +42,7 @@ Protectiveness | Armor % /obj/item/clothing/Destroy() processing_objects -= src - ..() + return ..() /obj/item/clothing/get_material() return material diff --git a/code/game/objects/items/weapons/material/material_weapons.dm b/code/game/objects/items/weapons/material/material_weapons.dm index 31231964cb..c778ec07a9 100644 --- a/code/game/objects/items/weapons/material/material_weapons.dm +++ b/code/game/objects/items/weapons/material/material_weapons.dm @@ -71,7 +71,7 @@ /obj/item/weapon/material/Destroy() processing_objects -= src - ..() + . = ..() /obj/item/weapon/material/apply_hit_effect() ..() diff --git a/code/game/objects/items/weapons/mop_deploy.dm b/code/game/objects/items/weapons/mop_deploy.dm index 8baab87528..30a6991a53 100644 --- a/code/game/objects/items/weapons/mop_deploy.dm +++ b/code/game/objects/items/weapons/mop_deploy.dm @@ -26,7 +26,7 @@ T.dirt = 0 for(var/obj/effect/O in src) if(istype(O,/obj/effect/rune) || istype(O,/obj/effect/decal/cleanable) || istype(O,/obj/effect/overlay)) - del(O) + qdel(O) /* //Reagent code changed at some point and the below doesn't work. To be fixed later. source.reagents.reaction(src, TOUCH, 10) //10 is the multiplier for the reaction effect. probably needed to wet the floor properly. source.reagents.remove_any(1) //reaction() doesn't use up the reagents @@ -47,16 +47,16 @@ return ..() -/obj/item/weapon/mop_deploy/Del() +/obj/item/weapon/mop_deploy/Destroy() processing_objects -= src - ..() + . = ..() /obj/item/weapon/mop_deploy/attack_self(mob/user as mob) user.drop_from_inventory(src) - spawn(1) if(src) del(src) + spawn(1) if(!QDELETED(src)) qdel(src) /obj/item/weapon/mop_deploy/dropped() - spawn(1) if(src) del(src) + spawn(1) if(!QDELETED(src)) qdel(src) /obj/item/weapon/mop_deploy/process() if(!creator || loc != creator || !creator.item_is_in_hands(src)) @@ -71,4 +71,4 @@ host.pinned -= src host.embedded -= src host.drop_from_inventory(src) - spawn(1) if(src) del(src) \ No newline at end of file + spawn(1) if(!QDELETED(src)) qdel(src) \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/belt.dm b/code/game/objects/items/weapons/storage/belt.dm index 06fd49d0e3..dfa4f61ba1 100644 --- a/code/game/objects/items/weapons/storage/belt.dm +++ b/code/game/objects/items/weapons/storage/belt.dm @@ -124,7 +124,7 @@ /obj/item/weapon/handcuffs, /obj/item/device/flash, /obj/item/clothing/glasses, - /obj/item/ammo_casing/shotgun, + /obj/item/ammo_casing/a12g, /obj/item/ammo_magazine, /obj/item/weapon/cell/device, /obj/item/weapon/reagent_containers/food/snacks/donut/, diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index 8eab766dba..c33e26d809 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -136,12 +136,12 @@ /obj/item/weapon/storage/box/blanks/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/blank(src) + new /obj/item/ammo_casing/a12g/blank(src) /obj/item/weapon/storage/box/blanks/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/blank(src) + new /obj/item/ammo_casing/a12g/blank(src) /obj/item/weapon/storage/box/beanbags name = "box of beanbag shells" @@ -152,12 +152,12 @@ /obj/item/weapon/storage/box/beanbags/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/beanbag(src) + new /obj/item/ammo_casing/a12g/beanbag(src) /obj/item/weapon/storage/box/beanbags/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/beanbag(src) + new /obj/item/ammo_casing/a12g/beanbag(src) /obj/item/weapon/storage/box/shotgunammo name = "box of shotgun slugs" @@ -168,12 +168,12 @@ /obj/item/weapon/storage/box/shotgunammo/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun(src) + new /obj/item/ammo_casing/a12g(src) /obj/item/weapon/storage/box/shotgunammo/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun(src) + new /obj/item/ammo_casing/a12g(src) /obj/item/weapon/storage/box/shotgunshells name = "box of shotgun shells" @@ -184,12 +184,12 @@ /obj/item/weapon/storage/box/shotgunshells/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/pellet(src) + new /obj/item/ammo_casing/a12g/pellet(src) /obj/item/weapon/storage/box/shotgunshells/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/pellet(src) + new /obj/item/ammo_casing/a12g/pellet(src) /obj/item/weapon/storage/box/flashshells name = "box of illumination shells" @@ -200,12 +200,12 @@ /obj/item/weapon/storage/box/flashshells/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/flash(src) + new /obj/item/ammo_casing/a12g/flash(src) /obj/item/weapon/storage/box/flashshells/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/flash(src) + new /obj/item/ammo_casing/a12g/flash(src) /obj/item/weapon/storage/box/stunshells name = "box of stun shells" @@ -216,12 +216,12 @@ /obj/item/weapon/storage/box/stunshells/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/stunshell(src) + new /obj/item/ammo_casing/a12g/stunshell(src) /obj/item/weapon/storage/box/stunshells/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/stunshell(src) + new /obj/item/ammo_casing/a12g/stunshell(src) /obj/item/weapon/storage/box/practiceshells name = "box of practice shells" @@ -232,12 +232,12 @@ /obj/item/weapon/storage/box/practiceshells/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/practice(src) + new /obj/item/ammo_casing/a12g/practice(src) /obj/item/weapon/storage/box/practiceshells/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/practice(src) + new /obj/item/ammo_casing/a12g/practice(src) /obj/item/weapon/storage/box/empshells name = "box of emp shells" @@ -248,12 +248,12 @@ /obj/item/weapon/storage/box/empshells/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/emp(src) + new /obj/item/ammo_casing/a12g/emp(src) /obj/item/weapon/storage/box/empshells/large/New() ..() for(var/i = 1 to 8) - new /obj/item/ammo_casing/shotgun/emp(src) + new /obj/item/ammo_casing/a12g/emp(src) /obj/item/weapon/storage/box/sniperammo name = "box of 14.5mm shells" diff --git a/code/game/objects/items/weapons/storage/internal.dm b/code/game/objects/items/weapons/storage/internal.dm index 8d1898fe4b..1f1a5f6963 100644 --- a/code/game/objects/items/weapons/storage/internal.dm +++ b/code/game/objects/items/weapons/storage/internal.dm @@ -12,7 +12,7 @@ /obj/item/weapon/storage/internal/Destroy() master_item = null - ..() + . = ..() /obj/item/weapon/storage/internal/attack_hand() return //make sure this is never picked up diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 3846a44d2b..db55e95b44 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -38,15 +38,15 @@ /obj/item/weapon/storage/Destroy() close_all() - qdel(boxes) - qdel(src.storage_start) - qdel(src.storage_continue) - qdel(src.storage_end) - qdel(src.stored_start) - qdel(src.stored_continue) - qdel(src.stored_end) - qdel(closer) - ..() + qdel_null(boxes) + qdel_null(src.storage_start) + qdel_null(src.storage_continue) + qdel_null(src.storage_end) + qdel_null(src.stored_start) + qdel_null(src.stored_continue) + qdel_null(src.stored_end) + qdel_null(closer) + . = ..() /obj/item/weapon/storage/MouseDrop(obj/over_object as obj) if(!canremove) diff --git a/code/game/objects/items/weapons/storage/uplink_kits.dm b/code/game/objects/items/weapons/storage/uplink_kits.dm index 573325e079..d5ac595c1e 100644 --- a/code/game/objects/items/weapons/storage/uplink_kits.dm +++ b/code/game/objects/items/weapons/storage/uplink_kits.dm @@ -27,7 +27,7 @@ if("guns") new /obj/item/weapon/gun/projectile/revolver(src) - new /obj/item/ammo_magazine/a357(src) + new /obj/item/ammo_magazine/s357(src) new /obj/item/weapon/card/emag(src) new /obj/item/weapon/plastique(src) new /obj/item/weapon/plastique(src) diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm index 41c78ecd3b..b021424043 100644 --- a/code/game/objects/items/weapons/tanks/jetpack.dm +++ b/code/game/objects/items/weapons/tanks/jetpack.dm @@ -24,8 +24,8 @@ ion_trail.set_up(src) /obj/item/weapon/tank/jetpack/Destroy() - qdel(ion_trail) - ..() + qdel_null(ion_trail) + return ..() /obj/item/weapon/tank/jetpack/examine(mob/user) . = ..() diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index 57a5cf06a4..b8daa05d7f 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -44,8 +44,7 @@ var/list/global/tank_gauge_cache = list() return /obj/item/weapon/tank/Destroy() - if(air_contents) - qdel(air_contents) + qdel_null(air_contents) processing_objects.Remove(src) @@ -53,7 +52,7 @@ var/list/global/tank_gauge_cache = list() var/obj/item/device/transfer_valve/TTV = loc TTV.remove_tank(src) - ..() + return ..() /obj/item/weapon/tank/examine(mob/user) . = ..(user, 0) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 8c4067187f..8148f7e493 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -435,7 +435,7 @@ /obj/item/weapon/weldingtool/experimental/Destroy() processing_objects -= src - ..() + return ..() /obj/item/weapon/weldingtool/experimental/process() ..() diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm index 8dce565f2c..e8ce7430c9 100644 --- a/code/game/objects/items/weapons/weaponry.dm +++ b/code/game/objects/items/weapons/weaponry.dm @@ -116,7 +116,7 @@ unbuckle_mob() processing_objects -= src - ..() + return ..() /obj/effect/energy_net/process() if(isnull(buckled_mob) || buckled_mob.loc != loc) diff --git a/code/game/objects/random/random.dm b/code/game/objects/random/random.dm index 75c0d5830f..5dba97befb 100644 --- a/code/game/objects/random/random.dm +++ b/code/game/objects/random/random.dm @@ -285,11 +285,11 @@ prob(2);/obj/item/weapon/storage/box/shotgunammo, prob(4);/obj/item/weapon/storage/box/shotgunshells, prob(1);/obj/item/weapon/storage/box/stunshells, - prob(2);/obj/item/ammo_magazine/c45m, - prob(4);/obj/item/ammo_magazine/c45m/rubber, - prob(4);/obj/item/ammo_magazine/c45m/flash, - prob(2);/obj/item/ammo_magazine/mc9mmt, - prob(6);/obj/item/ammo_magazine/mc9mmt/rubber) + prob(2);/obj/item/ammo_magazine/m45, + prob(4);/obj/item/ammo_magazine/m45/rubber, + prob(4);/obj/item/ammo_magazine/m45/flash, + prob(2);/obj/item/ammo_magazine/m9mmt, + prob(6);/obj/item/ammo_magazine/m9mmt/rubber) /obj/random/action_figure diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 928246b2b5..b41743799b 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -10,7 +10,7 @@ /obj/structure/Destroy() if(parts) new parts(loc) - ..() + . = ..() /obj/structure/attack_hand(mob/user) if(breakable) @@ -49,9 +49,6 @@ if(climbable) verbs += /obj/structure/proc/climb_on -/obj/structure/Destroy() - ..() - /obj/structure/proc/climb_on() set name = "Climb structure" 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 dc80d17827..a80ceb3580 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/security.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/security.dm @@ -217,7 +217,7 @@ new /obj/item/clothing/accessory/storage/black_vest(src) new /obj/item/clothing/head/soft/sec/corp(src) new /obj/item/clothing/under/rank/security/corp(src) - new /obj/item/ammo_magazine/c45m/rubber(src) + new /obj/item/ammo_magazine/m45/rubber(src) new /obj/item/weapon/gun/energy/taser(src) new /obj/item/weapon/cell/device/weapon(src) new /obj/item/clothing/suit/storage/hooded/wintercoat/security(src) @@ -277,8 +277,8 @@ new /obj/item/device/radio/headset/headset_sec(src) new /obj/item/device/radio/headset/headset_sec/alt(src) new /obj/item/clothing/suit/storage/vest/detective(src) - new /obj/item/ammo_magazine/c45m/rubber(src) - new /obj/item/ammo_magazine/c45m/rubber(src) + new /obj/item/ammo_magazine/m45/rubber(src) + new /obj/item/ammo_magazine/m45/rubber(src) new /obj/item/taperoll/police(src) new /obj/item/weapon/gun/projectile/colt/detective(src) new /obj/item/clothing/accessory/holster/armpit(src) diff --git a/code/game/objects/structures/crates_lockers/closets/syndicate.dm b/code/game/objects/structures/crates_lockers/closets/syndicate.dm index 98f6138f68..906e46dbe1 100644 --- a/code/game/objects/structures/crates_lockers/closets/syndicate.dm +++ b/code/game/objects/structures/crates_lockers/closets/syndicate.dm @@ -42,11 +42,11 @@ /obj/structure/closet/syndicate/nuclear/New() ..() - new /obj/item/ammo_magazine/a10mm(src) - new /obj/item/ammo_magazine/a10mm(src) - new /obj/item/ammo_magazine/a10mm(src) - new /obj/item/ammo_magazine/a10mm(src) - new /obj/item/ammo_magazine/a10mm(src) + new /obj/item/ammo_magazine/m10mm(src) + new /obj/item/ammo_magazine/m10mm(src) + new /obj/item/ammo_magazine/m10mm(src) + new /obj/item/ammo_magazine/m10mm(src) + new /obj/item/ammo_magazine/m10mm(src) new /obj/item/weapon/storage/box/handcuffs(src) new /obj/item/weapon/storage/box/flashbangs(src) new /obj/item/weapon/gun/energy/gun(src) diff --git a/code/game/objects/structures/crates_lockers/closets/utility_closets.dm b/code/game/objects/structures/crates_lockers/closets/utility_closets.dm index 5c8aa2b2e0..67a4d3e788 100644 --- a/code/game/objects/structures/crates_lockers/closets/utility_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/utility_closets.dm @@ -155,6 +155,8 @@ new /obj/item/clothing/head/radiation(src) new /obj/item/clothing/suit/radiation(src) new /obj/item/clothing/head/radiation(src) + new /obj/item/device/geiger(src) + new /obj/item/device/geiger(src) /* * Bombsuit closet diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm index 7fd68c305a..065b637e10 100644 --- a/code/game/objects/structures/inflatable.dm +++ b/code/game/objects/structures/inflatable.dm @@ -38,7 +38,7 @@ /obj/structure/inflatable/Destroy() update_nearby_tiles() - ..() + return ..() /obj/structure/inflatable/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) return 0 diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index 96291ecd27..35b8571a11 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -37,9 +37,9 @@ if(istype(loc, /turf/simulated/open)) var/turf/simulated/open/O = loc spawn(1) - if(O) // If we built a new floor with the lattice, the open turf won't exist anymore. + if(istype(O)) // If we built a new floor with the lattice, the open turf won't exist anymore. O.update() // This lattice may be supporting things on top of it. If it's being deleted, they need to fall down. - ..() + . = ..() /obj/structure/lattice/ex_act(severity) switch(severity) diff --git a/code/game/objects/structures/simple_doors.dm b/code/game/objects/structures/simple_doors.dm index 58742c3b60..4e302e0e31 100644 --- a/code/game/objects/structures/simple_doors.dm +++ b/code/game/objects/structures/simple_doors.dm @@ -168,8 +168,7 @@ /obj/structure/simple_door/process() if(!material.radioactivity) return - for(var/mob/living/L in range(1,src)) - L.apply_effect(round(material.radioactivity/3),IRRADIATE,0) + radiation_repository.radiate(src, round(material.radioactivity/3)) /obj/structure/simple_door/iron/New(var/newloc,var/material_name) ..(newloc, "iron") diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 8f91f12b26..1b9d897b99 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -203,6 +203,7 @@ icon = 'icons/obj/rollerbed.dmi' icon_state = "down" anchored = 0 + surgery_odds = 75 /obj/structure/bed/roller/update_icon() return // Doesn't care about material or anything else. diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 809dd008a4..ffddffe022 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -355,12 +355,9 @@ density = 0 update_nearby_tiles() var/turf/location = loc - loc = null + . = ..() for(var/obj/structure/window/W in orange(location, 1)) W.update_icon() - loc = location - ..() - /obj/structure/window/Move() var/ini_dir = dir @@ -472,6 +469,11 @@ if (constructed) state = 0 +/obj/structure/window/reinforced/full + dir = 5 + icon_state = "fwindow" + maxhealth = 60 + /obj/structure/window/reinforced/tinted name = "tinted window" desc = "It looks rather strong and opaque. Might take a few good hits to shatter it." diff --git a/code/game/turfs/simulated/wall_attacks.dm b/code/game/turfs/simulated/wall_attacks.dm index 098782ebdf..25b4915408 100644 --- a/code/game/turfs/simulated/wall_attacks.dm +++ b/code/game/turfs/simulated/wall_attacks.dm @@ -7,6 +7,8 @@ if(can_open == WALL_OPENING) return + radiation_repository.resistance_cache.Remove(src) + if(density) can_open = WALL_OPENING //flick("[material.icon_base]fwall_opening", src) @@ -188,6 +190,7 @@ else user << "You need more welding fuel to complete this task." return + user.update_examine_panel(src) return // Basic dismantling. @@ -241,6 +244,7 @@ if (istype(W, /obj/item/weapon/wirecutters)) playsound(src, 'sound/items/Wirecutter.ogg', 100, 1) construction_stage = 5 + user.update_examine_panel(src) user << "You cut through the outer grille." update_icon() return @@ -251,11 +255,13 @@ if(!do_after(user,40) || !istype(src, /turf/simulated/wall) || construction_stage != 5) return construction_stage = 4 + user.update_examine_panel(src) update_icon() user << "You unscrew the support lines." return else if (istype(W, /obj/item/weapon/wirecutters)) construction_stage = 6 + user.update_examine_panel(src) user << "You mend the outer grille." update_icon() return @@ -278,6 +284,7 @@ if(!do_after(user, 60) || !istype(src, /turf/simulated/wall) || construction_stage != 4) return construction_stage = 3 + user.update_examine_panel(src) update_icon() user << "You press firmly on the cover, dislodging it." return @@ -287,6 +294,7 @@ if(!do_after(user,40) || !istype(src, /turf/simulated/wall) || construction_stage != 4) return construction_stage = 5 + user.update_examine_panel(src) update_icon() user << "You screw down the support lines." return @@ -297,6 +305,7 @@ if(!do_after(user,100) || !istype(src, /turf/simulated/wall) || construction_stage != 3) return construction_stage = 2 + user.update_examine_panel(src) update_icon() user << "You pry off the cover." return @@ -307,6 +316,7 @@ if(!do_after(user,40) || !istype(src, /turf/simulated/wall) || construction_stage != 2) return construction_stage = 1 + user.update_examine_panel(src) update_icon() user << "You remove the bolts anchoring the support rods." return @@ -327,6 +337,7 @@ if(!do_after(user,70) || !istype(src, /turf/simulated/wall) || construction_stage != 1) return construction_stage = 0 + user.update_examine_panel(src) update_icon() user << "The slice through the support rods." return diff --git a/code/game/turfs/simulated/wall_icon.dm b/code/game/turfs/simulated/wall_icon.dm index dc7874b2aa..eab99bfba7 100644 --- a/code/game/turfs/simulated/wall_icon.dm +++ b/code/game/turfs/simulated/wall_icon.dm @@ -26,6 +26,7 @@ else if(material.opacity < 0.5 && opacity) set_light(0) + radiation_repository.resistance_cache.Remove(src) update_connections(1) update_icon() diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index f8544e714d..376fb8e452 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -48,6 +48,9 @@ if(!radiate()) return PROCESS_KILL +/turf/simulated/wall/proc/get_material() + return material + /turf/simulated/wall/bullet_act(var/obj/item/projectile/Proj) if(istype(Proj,/obj/item/projectile/beam)) burn(2500) @@ -265,8 +268,7 @@ if(!total_radiation) return - for(var/mob/living/L in range(3,src)) - L.apply_effect(total_radiation, IRRADIATE,0) + radiation_repository.radiate(src, total_radiation) return total_radiation /turf/simulated/wall/proc/burn(temperature) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 3f2e0064f2..d34b210b99 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -47,6 +47,7 @@ /turf/Destroy() turfs -= src ..() + return QDEL_HINT_IWILLGC /turf/ex_act(severity) return 0 diff --git a/code/game/turfs/unsimulated/floor.dm b/code/game/turfs/unsimulated/floor.dm index b2e7836334..bd4fdca814 100644 --- a/code/game/turfs/unsimulated/floor.dm +++ b/code/game/turfs/unsimulated/floor.dm @@ -7,3 +7,6 @@ name = "mask" icon = 'icons/turf/walls.dmi' icon_state = "rockvault" + +/turf/unsimulated/floor/shuttle_ceiling + icon_state = "reinforced" \ No newline at end of file diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index aea165e063..2f9bca5f01 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -783,6 +783,7 @@ proc/admin_notice(var/message, var/rights) return if(ticker.current_state == GAME_STATE_PREGAME) ticker.current_state = GAME_STATE_SETTING_UP + Master.SetRunLevel(RUNLEVEL_SETUP) log_admin("[usr.key] has started the game.") message_admins("[usr.key] has started the game.") feedback_add_details("admin_verb","SN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 82206fdc30..bd6d1ea4d0 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -480,7 +480,7 @@ M.equip_to_slot_or_del(new /obj/item/clothing/head/det(M), slot_head) M.equip_to_slot_or_del(new /obj/item/weapon/gun/projectile/revolver(M), slot_r_hand) - M.equip_to_slot_or_del(new /obj/item/ammo_magazine/a357(M), slot_l_store) + M.equip_to_slot_or_del(new /obj/item/ammo_magazine/s357(M), slot_l_store) if ("tournament chef") //Steven Seagal FTW M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/chef(M), slot_w_uniform) @@ -592,7 +592,7 @@ sec_briefcase.contents += new /obj/item/weapon/spacecash/c1000 sec_briefcase.contents += new /obj/item/weapon/gun/energy/crossbow sec_briefcase.contents += new /obj/item/weapon/gun/projectile/revolver/mateba - sec_briefcase.contents += new /obj/item/ammo_magazine/a357 + sec_briefcase.contents += new /obj/item/ammo_magazine/s357 sec_briefcase.contents += new /obj/item/weapon/plastique M.equip_to_slot_or_del(sec_briefcase, slot_l_hand) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 51f1fbceb3..ecd26e9b56 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -4,7 +4,7 @@ var/list/forbidden_varedit_object_types = list( /datum/feedback_variable //Prevents people messing with feedback gathering, ) -var/list/VVlocked = list("vars", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "bound_x", "bound_y", "step_x", "step_y", "force_ending") +var/list/VVlocked = list("vars", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "bound_x", "bound_y", "step_x", "step_y", "force_ending", "queued_priority") var/list/VVicon_edit_lock = list("icon", "icon_state", "overlays", "underlays") var/list/VVckey_edit = list("key", "ckey") diff --git a/code/modules/admin/view_variables/helpers.dm b/code/modules/admin/view_variables/helpers.dm index 67eefc018d..95945f82e0 100644 --- a/code/modules/admin/view_variables/helpers.dm +++ b/code/modules/admin/view_variables/helpers.dm @@ -1,8 +1,4 @@ -// Keep these two together, they *must* be defined on both -// If /client ever becomes /datum/client or similar, they can be merged -/client/proc/get_view_variables_header() - return "[src]" /datum/proc/get_view_variables_header() return "[src]" @@ -31,9 +27,6 @@ "} -// Same for these as for get_view_variables_header() above -/client/proc/get_view_variables_options() - return "" /datum/proc/get_view_variables_options() return "" diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index 169ab9b6a0..1273b004a4 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -187,4 +187,4 @@ if(radio_controller) radio_controller.remove_object(src,frequency) frequency = 0 - ..() + . = ..() diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index b559652132..5e5a176128 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -1,4 +1,8 @@ /client + ////////////////////// + //BLACK MAGIC THINGS// + ////////////////////// + parent_type = /datum //////////////// //ADMIN THINGS// //////////////// diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 212e7a49e8..d6f9375e98 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -181,6 +181,9 @@ clients -= src return ..() +/client/Destroy() + ..() + return QDEL_HINT_HARDDEL_NOW // here because it's similar to below @@ -284,6 +287,18 @@ if(inactivity > duration) return inactivity return 0 +// Byond seemingly calls stat, each tick. +// Calling things each tick can get expensive real quick. +// So we slow this down a little. +// See: http://www.byond.com/docs/ref/info.html#/client/proc/Stat +/client/Stat() + . = ..() + if (holder) + sleep(1) + else + sleep(5) + stoplag() + /client/proc/last_activity_seconds() return inactivity / 10 diff --git a/code/modules/client/preference_setup/loadout/loadout_shoes.dm b/code/modules/client/preference_setup/loadout/loadout_shoes.dm index 4de90fed9f..3b3e528403 100644 --- a/code/modules/client/preference_setup/loadout/loadout_shoes.dm +++ b/code/modules/client/preference_setup/loadout/loadout_shoes.dm @@ -77,6 +77,38 @@ display_name = "flats, black" path = /obj/item/clothing/shoes/flats +/datum/gear/shoes/hitops/ + display_name = "high-top, white" + path = /obj/item/clothing/shoes/hitops/ + +/datum/gear/shoes/hitops/red + display_name = "high-top, red" + path = /obj/item/clothing/shoes/hitops/red + +/datum/gear/shoes/hitops/black + display_name = "high-top, black" + path = /obj/item/clothing/shoes/hitops/black + +/datum/gear/shoes/hitops/orange + display_name = "high-top, orange" + path = /obj/item/clothing/shoes/hitops/orange + +/datum/gear/shoes/hitops/blue + display_name = "high-top, blue" + path = /obj/item/clothing/shoes/hitops/blue + +/datum/gear/shoes/hitops/green + display_name = "high-top, green" + path = /obj/item/clothing/shoes/hitops/green + +/datum/gear/shoes/hitops/purple + display_name = "high-top, purple" + path = /obj/item/clothing/shoes/hitops/purple + +/datum/gear/shoes/hitops/yellow + display_name = "high-top, yellow" + path = /obj/item/clothing/shoes/hitops/yellow + /datum/gear/shoes/flats/blue display_name = "flats, blue" path = /obj/item/clothing/shoes/flats/blue diff --git a/code/modules/client/preference_setup/loadout/loadout_uniform.dm b/code/modules/client/preference_setup/loadout/loadout_uniform.dm index 8974cc004d..30b0a74f70 100644 --- a/code/modules/client/preference_setup/loadout/loadout_uniform.dm +++ b/code/modules/client/preference_setup/loadout/loadout_uniform.dm @@ -375,6 +375,10 @@ /datum/gear/uniform/dresses/janimaid display_name = "maid uniform" path = /obj/item/clothing/under/dress/janimaid + +/datum/gear/uniform/dresses/sexymaid + display_name = "sexy maid uniform" + path = /obj/item/clothing/under/dress/sexymaid /datum/gear/uniform/pt display_name = "pt uniform" @@ -458,4 +462,4 @@ /datum/gear/uniform/red_swept_dress display_name = "red swept dress" - path = /obj/item/clothing/under/dress/red_swept_dress \ No newline at end of file + path = /obj/item/clothing/under/dress/red_swept_dress diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 4fb748f73a..65d6697df4 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -89,11 +89,20 @@ BLIND // can't see anything item_state_slots = list(slot_r_hand_str = "glasses", slot_l_hand_str = "glasses") toggleable = 1 action_button_name = "Toggle Goggles" + item_flags = AIRTIGHT /obj/item/clothing/glasses/science/New() ..() overlay = global_hud.science +/obj/item/clothing/glasses/goggles + name = "Goggles" + desc = "Just some plain old goggles." + icon_state = "plaingoggles" + item_state_slots = list(slot_r_hand_str = "glasses", slot_l_hand_str = "glasses") + item_flags = AIRTIGHT + body_parts_covered = EYES + /obj/item/clothing/glasses/night name = "Night Vision Goggles" desc = "You can totally see in the dark now!" @@ -200,6 +209,7 @@ BLIND // can't see anything item_state_slots = list(slot_r_hand_str = "welding-g", slot_l_hand_str = "welding-g") action_button_name = "Flip Welding Goggles" matter = list(DEFAULT_WALL_MATERIAL = 1500, "glass" = 1000) + item_flags = AIRTIGHT var/up = 0 /obj/item/clothing/glasses/welding/attack_self() diff --git a/code/modules/clothing/shoes/colour.dm b/code/modules/clothing/shoes/colour.dm index 91703336e1..6b4b270f97 100644 --- a/code/modules/clothing/shoes/colour.dm +++ b/code/modules/clothing/shoes/colour.dm @@ -123,39 +123,39 @@ if (istype(H, /obj/item/weapon/handcuffs)) attach_cuffs(H, user) -/obj/item/clothing/shoes/hightops - name = "white high tops" +/obj/item/clothing/shoes/hitops + name = "white high-tops" desc = "A pair of shoes that extends past the ankle. Based on a centuries-old, timeless design." icon_state = "whitehi" -/obj/item/clothing/shoes/hightops/red - name = "red high tops" +/obj/item/clothing/shoes/hitops/red + name = "red high-tops" icon_state = "redhi" -/obj/item/clothing/shoes/hightops/brown - name = "brown high tops" +/obj/item/clothing/shoes/hitops/brown + name = "brown high-tops" icon_state = "brownhi" -/obj/item/clothing/shoes/hightops/black - name = "black high tops" +/obj/item/clothing/shoes/hitops/black + name = "black high-tops" icon_state = "blackhi" -/obj/item/clothing/shoes/hightops/orange - name = "orange high tops" +/obj/item/clothing/shoes/hitops/orange + name = "orange high-tops" icon_state = "orangehi" -/obj/item/clothing/shoes/hightops/blue - name = "blue high tops" +/obj/item/clothing/shoes/hitops/blue + name = "blue high-tops" icon_state = "bluehi" -/obj/item/clothing/shoes/hightops/green - name = "green high tops" +/obj/item/clothing/shoes/hitops/green + name = "green high-tops" icon_state = "greenhi" -/obj/item/clothing/shoes/hightops/purple - name = "purple high tops" +/obj/item/clothing/shoes/hitops/purple + name = "purple high-tops" icon_state = "purplehi" -/obj/item/clothing/shoes/hightops/yellow - name = "yellow high tops" +/obj/item/clothing/shoes/hitops/yellow + name = "yellow high-tops" icon_state = "yellowhi" \ No newline at end of file diff --git a/code/modules/clothing/spacesuits/rig/modules/utility.dm b/code/modules/clothing/spacesuits/rig/modules/utility.dm index cec738479e..583f491d5e 100644 --- a/code/modules/clothing/spacesuits/rig/modules/utility.dm +++ b/code/modules/clothing/spacesuits/rig/modules/utility.dm @@ -477,7 +477,7 @@ for(var/obj/item/weapon/mop_deploy/blade in M.contents) M.drop_from_inventory(blade) - del(blade) + qdel(blade) //Space Cleaner Launcher @@ -520,7 +520,7 @@ user << "You slot \the [input_device] into the suit module." user.drop_from_inventory(input_device) - del(input_device) + qdel(input_device) accepted_item.charges++ return 1 diff --git a/code/modules/clothing/spacesuits/rig/suits/station.dm b/code/modules/clothing/spacesuits/rig/suits/station.dm index 11dfbfb961..13eebc2e7d 100644 --- a/code/modules/clothing/spacesuits/rig/suits/station.dm +++ b/code/modules/clothing/spacesuits/rig/suits/station.dm @@ -100,6 +100,7 @@ req_access = list() req_one_access = list() + max_heat_protection_temperature = FIRE_HELMET_MAX_HEAT_PROTECTION_TEMPERATURE /obj/item/clothing/gloves/gauntlets/rig/eva name = "insulated gauntlets" @@ -135,6 +136,7 @@ req_access = list() req_one_access = list() + max_heat_protection_temperature = FIRE_HELMET_MAX_HEAT_PROTECTION_TEMPERATURE /obj/item/clothing/gloves/gauntlets/rig/ce name = "insulated gauntlets" diff --git a/code/modules/clothing/suits/storage.dm b/code/modules/clothing/suits/storage.dm index be7da66f84..ca630dae77 100644 --- a/code/modules/clothing/suits/storage.dm +++ b/code/modules/clothing/suits/storage.dm @@ -8,9 +8,8 @@ pockets.max_storage_space = ITEMSIZE_COST_SMALL * 2 /obj/item/clothing/suit/storage/Destroy() - qdel(pockets) - pockets = null - ..() + qdel_null(pockets) + return ..() /obj/item/clothing/suit/storage/attack_hand(mob/user as mob) if (pockets.handle_attack_hand(user)) diff --git a/code/modules/clothing/under/miscellaneous.dm b/code/modules/clothing/under/miscellaneous.dm index 6521bdf622..6a50570a2f 100644 --- a/code/modules/clothing/under/miscellaneous.dm +++ b/code/modules/clothing/under/miscellaneous.dm @@ -324,6 +324,11 @@ name = "maid uniform" desc = "A simple maid uniform for housekeeping." icon_state = "janimaid" + +/obj/item/clothing/under/dress/sexymaid + name = "sexy maid uniform" + desc = "You must be a bit risque teasing all of them in a maid uniform!" + icon_state = "sexymaid" /obj/item/clothing/under/dress/dress_fire name = "flame dress" @@ -764,4 +769,4 @@ desc = "A warm looking sweater and a pair of dark blue slacks." name = "sweater" icon_state = "turtleneck" - worn_state = "turtleneck" \ No newline at end of file + worn_state = "turtleneck" diff --git a/code/modules/detectivework/tools/rag.dm b/code/modules/detectivework/tools/rag.dm index 57af12525d..685f35d64b 100644 --- a/code/modules/detectivework/tools/rag.dm +++ b/code/modules/detectivework/tools/rag.dm @@ -35,7 +35,7 @@ /obj/item/weapon/reagent_containers/glass/rag/Destroy() processing_objects -= src //so we don't continue turning to ash while gc'd - ..() + return ..() /obj/item/weapon/reagent_containers/glass/rag/attack_self(mob/user as mob) if(on_fire) diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index b9435f25aa..bf2dec5e4e 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -2,7 +2,7 @@ var/const/enterBelt = 30 var/const/radIntervall = 5 // Enough time between enter/leave belt for 10 hits, as per original implementation var/const/leaveBelt = 80 - var/const/revokeAccess = 135 + var/const/revokeAccess = 165 startWhen = 2 announceWhen = 1 endWhen = revokeAccess @@ -27,23 +27,21 @@ radiate() else if(activeFor == leaveBelt) - command_announcement.Announce("The station has passed the radiation belt. Please report to medbay if you experience any unusual symptoms. Maintenance will lose all access again shortly.", "Anomaly Alert") - + command_announcement.Announce("The station has passed the radiation belt. Please allow for up to one minute while radiation levels dissipate, and report to medbay if you experience any unusual symptoms. Maintenance will lose all access again shortly.", "Anomaly Alert") /datum/event/radiation_storm/proc/radiate() + var/radiation_level = rand(15, 35) + for(var/z in using_map.station_levels) + radiation_repository.z_radiate(locate(1, 1, z), radiation_level, 1) + for(var/mob/living/carbon/C in living_mob_list) var/area/A = get_area(C) if(!A) continue - if(!(A.z in using_map.station_levels)) - continue if(A.flags & RAD_SHIELDED) continue - if(istype(C,/mob/living/carbon/human)) var/mob/living/carbon/human/H = C - H.apply_effect((rand(15,35)),IRRADIATE,0) if(prob(5)) - H.apply_effect((rand(40,70)),IRRADIATE,0) if (prob(75)) randmutb(H) // Applies bad mutation domutcheck(H,null,MUTCHK_FORCED) diff --git a/code/modules/events/solar_storm.dm b/code/modules/events/solar_storm.dm index 971e0418bc..afaa01ed95 100644 --- a/code/modules/events/solar_storm.dm +++ b/code/modules/events/solar_storm.dm @@ -27,6 +27,7 @@ radiate() /datum/event/solar_storm/proc/radiate() + // Note: Too complicated to be worth trying to use the radiation system for this. Its only in space anyway, so we make an exception in this case. for(var/mob/living/L in living_mob_list) var/turf/T = get_turf(L) if(!T) @@ -36,8 +37,7 @@ continue //Todo: Apply some burn damage from the heat of the sun. Until then, enjoy some moderate radiation. - L.apply_effect((rand(15,30)),IRRADIATE,blocked = L.getarmor(null, "rad")) - + L.rad_act(rand(15, 30)) /datum/event/solar_storm/end() command_announcement.Announce("The solar storm has passed the station. It is now safe to resume EVA activities. Please report to medbay if you experience any unusual symptoms. ", "Anomaly Alert") diff --git a/code/modules/examine/descriptions/engineering.dm b/code/modules/examine/descriptions/engineering.dm index c3f9b9b21f..37e69f16f9 100644 --- a/code/modules/examine/descriptions/engineering.dm +++ b/code/modules/examine/descriptions/engineering.dm @@ -25,11 +25,54 @@ Wires can be pulsed remotely with a signaler attached to it. A powersink will also drain any APCs connected to the same wire the powersink is on." /obj/item/inflatable - description_info = "Inflate by using it in your hand. The inflatable barrier will inflate on your tile. To deflate it, use the 'deflate' verb." + description_info = "Inflate by using it in your hand. The inflatable barrier will inflate on your tile. To deflate it, use the 'deflate' verb. \ + You can also inflate this on an adjacent tile by clicking the tile." /obj/structure/inflatable - description_info = "To remove these safely, use the 'deflate' verb. Hitting these with any objects will probably puncture and break it forever." + description_info = "To remove these safely, use the 'deflate' verb, or alt-click on it. Hitting these with any objects will probably puncture and break it forever." /obj/structure/inflatable/door description_info = "Click the door to open or close it. It only stops air while closed.
\ To remove these safely, use the 'deflate' verb. Hitting these with any objects will probably puncture and break it forever." + +/obj/machinery/door/get_description_interaction() + var/list/results = list() + if(!repairing && (health < maxhealth) && !(stat & BROKEN)) + results += "[desc_panel_image("metal sheet")]to start repairing damage (May require different material type)." + if(repairing && density) + results += "[desc_panel_image("welder")]to finish repairs." + results += "[desc_panel_image("crowbar")]to undo adding sheets for repairs." + + return results + +/obj/machinery/door/airlock/get_description_interaction() + var/list/results = list() + + if(can_remove_electronics()) + results += "[desc_panel_image("crowbar")]to remove the airlock electronics." + else + results += "[desc_panel_image("crowbar")]to open or close if unpowered/broken, and unbolted." + + if(welded) + results += "[desc_panel_image("welder")]to unweld, allowing it to open again." + else + results += "[desc_panel_image("welder")]to weld, preventing it from opening." + + if(p_open) + results += "[desc_panel_image("screwdriver")]to close the wire panel." + results += "[desc_panel_image("wirecutters")]to cut an internal wire while hacking." + results += "[desc_panel_image("multitool")]to pulse an internal wire while hacking." + else + results += "[desc_panel_image("screwdriver")]to open the wire panel, enabling the ability to hack." + + results += ..() + + return results + +/obj/machinery/portable_atmospherics/canister/get_description_interaction() + var/list/results = list() + + results += "[desc_panel_image("wrench")]to connect or disconnect from a connector port below." + results += "[desc_panel_image("air tank")]to fill the air tank from this canister." + + return results \ No newline at end of file diff --git a/code/modules/examine/descriptions/turfs.dm b/code/modules/examine/descriptions/turfs.dm index cccc43e073..4319c23ffe 100644 --- a/code/modules/examine/descriptions/turfs.dm +++ b/code/modules/examine/descriptions/turfs.dm @@ -1,3 +1,33 @@ /turf/simulated/wall - description_info = "You can deconstruct this by welding it, and then wrenching the girder.
\ - You can build a wall by using metal sheets and making a girder, then adding more metal or plasteel." \ No newline at end of file + description_info = "You can build a wall by using metal sheets and making a girder, then adding more metal or plasteel." + +/turf/simulated/wall/get_description_interaction() + var/list/results = list() + if(damage) + results += "[desc_panel_image("welder")]to repair." + + if(isnull(construction_stage) || !reinf_material) + results += "[desc_panel_image("welder")]to deconstruct if undamaged." + else + switch(construction_stage) + if(6) + results += "[desc_panel_image("wirecutters")]to begin deconstruction." + if(5) + results += list( + "[desc_panel_image("screwdriver")]to continue deconstruction.", + "[desc_panel_image("wirecutters")]to reverse deconstruction." + ) + if(4) + results += list( + "[desc_panel_image("welder")]to continue deconstruction.", + "[desc_panel_image("screwdriver")]to reverse deconstruction." + ) + if(3) + results += "[desc_panel_image("crowbar")]to continue deconstruction." + if(2) + results += "[desc_panel_image("wrench")]to continue deconstruction." + if(1) + results += "[desc_panel_image("welder")]to continue deconstruction." + if(0) + results += "[desc_panel_image("crowbar")]to finish deconstruction." + return results \ No newline at end of file diff --git a/code/modules/examine/examine.dm b/code/modules/examine/examine.dm index f09fce6cf3..6e2df0b1fa 100644 --- a/code/modules/examine/examine.dm +++ b/code/modules/examine/examine.dm @@ -5,6 +5,7 @@ This means that this file can be unchecked, along with the other examine files, and can be removed entirely with no effort. */ +#define EXAMINE_PANEL_PADDING " " /atom/ var/description_info = null //Helpful blue text. @@ -27,6 +28,14 @@ return description_antag return +// This one is slightly different, in that it must return a list. +/atom/proc/get_description_interaction() + return list() + +// Quickly adds the boilerplate code to add an image and padding for the image. +/proc/desc_panel_image(var/icon_state) + return "\icon[description_icons[icon_state]][EXAMINE_PANEL_PADDING]" + /mob/living/get_description_fluff() if(flavor_text) //Get flavor text for the green text. return flavor_text @@ -44,18 +53,23 @@ description_holders["info"] = A.get_description_info() description_holders["fluff"] = A.get_description_fluff() description_holders["antag"] = (update_antag_info)? A.get_description_antag() : "" + description_holders["interactions"] = A.get_description_interaction() description_holders["name"] = "[A.name]" description_holders["icon"] = "\icon[A]" description_holders["desc"] = A.desc -/client/Stat() +/mob/Stat() . = ..() - if(usr && statpanel("Examine")) + if(client && statpanel("Examine")) + var/description_holders = client.description_holders stat(null,"[description_holders["icon"]] [description_holders["name"]]") //The name, written in big letters. stat(null,"[description_holders["desc"]]") //the default examine text. if(description_holders["info"]) stat(null,"[description_holders["info"]]") //Blue, informative text. + if(description_holders["interactions"]) + for(var/line in description_holders["interactions"]) + stat(null, "[line]") if(description_holders["fluff"]) stat(null,"[description_holders["fluff"]]") //Yellow, fluff-related text. if(description_holders["antag"]) @@ -66,6 +80,9 @@ if(..()) return 1 - var/is_antag = ((mind && mind.special_role) || isobserver(src)) //ghosts don't have minds + update_examine_panel(A) + +/mob/proc/update_examine_panel(var/atom/A) if(client) + var/is_antag = ((mind && mind.special_role) || isobserver(src)) //ghosts don't have minds client.update_description_holders(A, is_antag) diff --git a/code/modules/examine/stat_icons.dm b/code/modules/examine/stat_icons.dm index 77d97fe0a1..ba09157d1c 100644 --- a/code/modules/examine/stat_icons.dm +++ b/code/modules/examine/stat_icons.dm @@ -6,5 +6,19 @@ var/global/list/description_icons = list( "energy_armor" = image(icon='icons/mob/screen1_stats.dmi',icon_state="energy_protection"), "bomb_armor" = image(icon='icons/mob/screen1_stats.dmi',icon_state="bomb_protection"), "radiation_armor" = image(icon='icons/mob/screen1_stats.dmi',icon_state="radiation_protection"), - "biohazard_armor" = image(icon='icons/mob/screen1_stats.dmi',icon_state="biohazard_protection") - ) \ No newline at end of file + "biohazard_armor" = image(icon='icons/mob/screen1_stats.dmi',icon_state="biohazard_protection"), + + "welder" = image(icon='icons/obj/items.dmi',icon_state="welder"), + "wirecutters" = image(icon='icons/obj/items.dmi',icon_state="cutters"), + "screwdriver" = image(icon='icons/obj/items.dmi',icon_state="screwdriver"), + "wrench" = image(icon='icons/obj/items.dmi',icon_state="wrench"), + "crowbar" = image(icon='icons/obj/items.dmi',icon_state="crowbar"), + "multitool" = image(icon='icons/obj/device.dmi',icon_state="multitool"), + + "metal sheet" = image(icon='icons/obj/items.dmi',icon_state="sheet-metal"), + "plasteel sheet" = image(icon='icons/obj/items.dmi',icon_state="sheet-plasteel"), + + "air tank" = image(icon='icons/obj/tank.dmi',icon_state="oxygen"), + + "connector" = image(icon='icons/obj/pipes.dmi',icon_state="connector") + ) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index a8987538ab..c887ff5b9b 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -332,7 +332,7 @@ proc/check_panel(mob/M) qdel(O) return -var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/item/ammo_magazine/a357,\ +var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/item/ammo_magazine/s357,\ /obj/item/weapon/gun/energy/crossbow, /obj/item/weapon/melee/energy/sword,\ /obj/item/weapon/storage/box/syndicate, /obj/item/weapon/storage/box/emps,\ /obj/item/weapon/cartridge/syndicate, /obj/item/clothing/under/chameleon,\ diff --git a/code/modules/holodeck/HolodeckObjects.dm b/code/modules/holodeck/HolodeckObjects.dm index a6273a7423..8889e8f0f5 100644 --- a/code/modules/holodeck/HolodeckObjects.dm +++ b/code/modules/holodeck/HolodeckObjects.dm @@ -127,9 +127,6 @@ ) item_state = "boxing" -/obj/structure/window/reinforced/holowindow/Destroy() - ..() - /obj/structure/window/reinforced/holowindow/attackby(obj/item/W as obj, mob/user as mob) if(!istype(W)) return//I really wish I did not need this if (istype(W, /obj/item/weapon/grab) && get_dist(src,user)<2) @@ -183,12 +180,6 @@ qdel(src) return -/obj/structure/window/reinforced/holowindow/disappearing/Destroy() - ..() - -/obj/machinery/door/window/holowindoor/Destroy() - ..() - /obj/machinery/door/window/holowindoor/attackby(obj/item/weapon/I as obj, mob/user as mob) if (src.operating == 1) @@ -224,9 +215,6 @@ visible_message("[src] fades away as it shatters!") qdel(src) -/obj/structure/bed/chair/holochair/Destroy() - ..() - /obj/structure/bed/chair/holochair/attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/wrench)) user << ("It's a holochair, you can't dismantle it!") @@ -419,6 +407,10 @@ for(var/mob/M in currentarea) M << "FIGHT!" +// A window that disappears when the ready button is pressed +/obj/structure/window/reinforced/holowindow/disappearing + name = "Event Window" + //Holocarp /mob/living/simple_animal/hostile/carp/holodeck diff --git a/code/modules/hydroponics/spreading/spreading.dm b/code/modules/hydroponics/spreading/spreading.dm index 1cff4314af..b66abd61da 100644 --- a/code/modules/hydroponics/spreading/spreading.dm +++ b/code/modules/hydroponics/spreading/spreading.dm @@ -77,7 +77,8 @@ plant_controller.remove_plant(src) for(var/obj/effect/plant/neighbor in range(1,src)) plant_controller.add_plant(neighbor) - ..() + return ..() + /obj/effect/plant/single spread_chance = 0 diff --git a/code/modules/hydroponics/spreading/spreading_growth.dm b/code/modules/hydroponics/spreading/spreading_growth.dm index fca9f3abaf..0dbe4c9eea 100644 --- a/code/modules/hydroponics/spreading/spreading_growth.dm +++ b/code/modules/hydroponics/spreading/spreading_growth.dm @@ -116,7 +116,7 @@ var/obj/effect/plant/child = new(get_turf(src),seed,parent) spawn(1) // This should do a little bit of animation. - if(deleted(child)) + if(QDELETED(child)) return //move out to the destination diff --git a/code/modules/integrated_electronics/subtypes/input_output.dm b/code/modules/integrated_electronics/subtypes/input_output.dm index 456fae889f..1a4fdb7c45 100644 --- a/code/modules/integrated_electronics/subtypes/input_output.dm +++ b/code/modules/integrated_electronics/subtypes/input_output.dm @@ -304,7 +304,8 @@ if(exonet) exonet.remove_address() qdel(exonet) - ..() + exonet = null + return ..() /obj/item/integrated_circuit/input/EPv2/do_work() var/target_address = get_pin_data(IC_INPUT, 1) @@ -370,7 +371,7 @@ /obj/item/integrated_circuit/input/microphone/Destroy() listening_objects -= src - ..() + return ..() /obj/item/integrated_circuit/input/microphone/hear_talk(mob/living/M, msg, var/verb="says", datum/language/speaking=null) var/translated = FALSE @@ -483,9 +484,6 @@ var/light_rgb = "#FFFFFF" power_draw_idle = 0 // Adjusted based on brightness. -/obj/item/integrated_circuit/output/light/Destroy() - ..() - /obj/item/integrated_circuit/output/light/do_work() light_toggled = !light_toggled update_lighting() @@ -644,8 +642,8 @@ on_data_written() /obj/item/integrated_circuit/output/video_camera/Destroy() - qdel(camera) - ..() + qdel_null(camera) + return ..() /obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(var/status) if(camera) diff --git a/code/modules/lighting/lighting_corner.dm b/code/modules/lighting/lighting_corner.dm index 63ce123253..088c53e521 100644 --- a/code/modules/lighting/lighting_corner.dm +++ b/code/modules/lighting/lighting_corner.dm @@ -131,3 +131,9 @@ /datum/lighting_corner/dummy/New() return + +/datum/lighting_corner/Destroy(var/force) + if (!force) + return QDEL_HINT_LETMELIVE + crash_with("Who decided to force qdel() a lighting corner? Why did you do this?") + return ..() diff --git a/code/modules/lighting/lighting_overlay.dm b/code/modules/lighting/lighting_overlay.dm index 60c684fd86..690eba9326 100644 --- a/code/modules/lighting/lighting_overlay.dm +++ b/code/modules/lighting/lighting_overlay.dm @@ -39,7 +39,7 @@ log_debug("A lighting overlay realised its loc was NOT a turf (actual loc: [loc][loc ? ", " + loc.type : "null"]) in update_overlay() and got qdel'ed!") else log_debug("A lighting overlay realised it was in nullspace in update_overlay() and got pooled!") - qdel(src) + qdel(src, force=TRUE) return // To the future coder who sees this and thinks @@ -121,14 +121,17 @@ /atom/movable/lighting_overlay/throw_at() return 0 -/atom/movable/lighting_overlay/Destroy() - total_lighting_overlays-- - global.lighting_update_overlays -= src - global.lighting_update_overlays_old -= src +/atom/movable/lighting_overlay/Destroy(var/force) + if (force) + total_lighting_overlays-- + global.lighting_update_overlays -= src + global.lighting_update_overlays_old -= src - var/turf/T = loc - if(istype(T)) - T.lighting_overlay = null - T.luminosity = 1 + var/turf/T = loc + if(istype(T)) + T.lighting_overlay = null + T.luminosity = 1 - return ..() + return ..() + else + return QDEL_HINT_LETMELIVE diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index bf59f3c382..a6a857c43b 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -482,7 +482,7 @@ var/list/mining_overlay_cache = list() M.flash_eyes() if(prob(50)) M.Stun(5) - M.apply_effect(25, IRRADIATE) + radiation_repository.flat_radiate(src, 25, 200) if(prob(25)) excavate_find(prob(5), finds[1]) else if(rand(1,500) == 1) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 4384151cbd..1928e8ea5d 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -132,7 +132,7 @@ var/global/list/image/ghost_sightless_images = list() //this is a list of images qdel(ghostimage) ghostimage = null updateallghostimages() - ..() + return ..() /mob/observer/dead/Topic(href, href_list) if (href_list["track"]) diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index b2748e6f06..4de1dcf595 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -34,11 +34,14 @@ var/list/m_viewers = in_range["mobs"] var/list/o_viewers = in_range["objs"] - for(var/mob/M in m_viewers) + for(var/mob in m_viewers) + var/mob/M = mob spawn(0) // It's possible that it could be deleted in the meantime, or that it runtimes. if(M) M.show_message(message, m_type) - for(var/obj/O in o_viewers) + + for(var/obj in o_viewers) + var/obj/O = obj spawn(0) if(O) O.see_emote(src, message, m_type) diff --git a/code/modules/mob/freelook/ai/eye.dm b/code/modules/mob/freelook/ai/eye.dm index 62f0d93152..a1c28a4af3 100644 --- a/code/modules/mob/freelook/ai/eye.dm +++ b/code/modules/mob/freelook/ai/eye.dm @@ -59,7 +59,7 @@ /mob/living/silicon/ai/Destroy() destroy_eyeobj() - ..() + return ..() /atom/proc/move_camera_by_click() if(istype(usr, /mob/living/silicon/ai)) diff --git a/code/modules/mob/freelook/ai/update_triggers.dm b/code/modules/mob/freelook/ai/update_triggers.dm index f4fea0aa58..5c21c6784d 100644 --- a/code/modules/mob/freelook/ai/update_triggers.dm +++ b/code/modules/mob/freelook/ai/update_triggers.dm @@ -59,7 +59,7 @@ /obj/machinery/camera/Destroy() clear_all_networks() cameranet.cameras -= src - ..() + return ..() // Mobs /mob/living/silicon/ai/rejuvenate() diff --git a/code/modules/mob/freelook/eye.dm b/code/modules/mob/freelook/eye.dm index 0c38ad8033..ff8681d128 100644 --- a/code/modules/mob/freelook/eye.dm +++ b/code/modules/mob/freelook/eye.dm @@ -38,7 +38,11 @@ mob/observer/eye/Destroy() qdel(ghostimage) ghostimage = null updateallghostimages() - ..() + if(owner) + if(owner.eyeobj == src) + owner.eyeobj = null + owner = null + . = ..() /mob/observer/eye/Move(n, direct) if(owner == src) diff --git a/code/modules/mob/freelook/mask/update_triggers.dm b/code/modules/mob/freelook/mask/update_triggers.dm index 1142367164..1dd520e7f1 100644 --- a/code/modules/mob/freelook/mask/update_triggers.dm +++ b/code/modules/mob/freelook/mask/update_triggers.dm @@ -25,7 +25,7 @@ /mob/living/Destroy() cultnet.updateVisibility(src, 0) - ..() + return ..() /mob/living/rejuvenate() var/was_dead = stat == DEAD diff --git a/code/modules/mob/freelook/update_triggers.dm b/code/modules/mob/freelook/update_triggers.dm index 8408083ba8..482025426e 100644 --- a/code/modules/mob/freelook/update_triggers.dm +++ b/code/modules/mob/freelook/update_triggers.dm @@ -15,7 +15,7 @@ /turf/simulated/Destroy() updateVisibility(src) - ..() + return ..() /turf/simulated/New() ..() @@ -26,7 +26,7 @@ /obj/structure/Destroy() updateVisibility(src) - ..() + return ..() /obj/structure/New() ..() diff --git a/code/modules/mob/freelook/visualnet.dm b/code/modules/mob/freelook/visualnet.dm index 24ad252eda..0d53d1e48a 100644 --- a/code/modules/mob/freelook/visualnet.dm +++ b/code/modules/mob/freelook/visualnet.dm @@ -14,7 +14,7 @@ /datum/visualnet/Destroy() visual_nets -= src - ..() + return ..() // Checks if a chunk has been Generated in x, y, z. /datum/visualnet/proc/chunkGenerated(x, y, z) diff --git a/code/modules/mob/holder.dm b/code/modules/mob/holder.dm index 1998e7fe65..5d0796f77c 100644 --- a/code/modules/mob/holder.dm +++ b/code/modules/mob/holder.dm @@ -27,7 +27,7 @@ var/list/holder_mob_icon_cache = list() /obj/item/weapon/holder/Destroy() processing_objects.Remove(src) - ..() + return ..() /obj/item/weapon/holder/process() update_state() diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm index e74d6dab90..687fb7626d 100644 --- a/code/modules/mob/living/carbon/brain/MMI.dm +++ b/code/modules/mob/living/carbon/brain/MMI.dm @@ -110,10 +110,8 @@ if(isrobot(loc)) var/mob/living/silicon/robot/borg = loc borg.mmi = null - if(brainmob) - qdel(brainmob) - brainmob = null - ..() + qdel_null(brainmob) + return ..() /obj/item/device/mmi/radio_enabled name = "radio-enabled man-machine interface" diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 2953591a5a..615a3ecf53 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -1,4 +1,5 @@ /mob/living/carbon/human/examine(mob/user) + var/skipgloves = 0 var/skipsuitstorage = 0 var/skipjumpsuit = 0 @@ -17,6 +18,18 @@ var/skiparms = 0 var/skipfeet = 0 + + var/cloaked = 0 // 0 for normal, 1 for cloaked close + + if(mind && mind.changeling && mind.changeling.cloaked && !istype(user, /mob/observer)) + var/distance = get_dist(user, src) + if(distance > 2) + src.loc.examine(user) + return + else + cloaked = 1 + + var/looks_synth = looksSynthetic() //exosuits and helmets obscure our view and stuff. @@ -79,9 +92,13 @@ var/list/msg = list("*---------*\nThis is ") + var/datum/gender/T = gender_datums[get_gender()] + if(skipjumpsuit && skipface) //big suits/masks/helmets make it hard to tell their gender T = gender_datums[PLURAL] + if(cloaked) + T = gender_datums[NEUTER] else if(species && species.ambiguous_genders) var/can_detect_gender = FALSE @@ -441,17 +458,25 @@ msg += "Medical records: \[View\] \[Add comment\]\n" - if(print_flavor_text()) msg += "[print_flavor_text()]\n" + if(print_flavor_text() && !cloaked) + msg += "[print_flavor_text()]\n" msg += "*---------*
" msg += applying_pressure - if (pose) + if (pose && !cloaked) if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) pose = addtext(pose,".") //Makes sure all emotes end with a period. msg += "[T.He] [pose]" user << jointext(msg, null) + +/mob/living/carbon/human/get_description_fluff() + if(mind && mind.changeling && mind.changeling.cloaked) + return "" + else + return ..() + //Helper procedure. Called by /mob/living/carbon/human/examine() and /mob/living/carbon/human/Topic() to determine HUD access to security and medical records. /proc/hasHUD(mob/M as mob, hudtype) if(istype(M, /mob/living/carbon/human)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 66abc50cab..ba7aed0250 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -261,7 +261,7 @@ var/obj/item/device/pda/pda = wear_id if (istype(pda)) if (pda.id) - return pda.id.rank + return pda.id.rank ? pda.id.rank : if_no_job else return pda.ownrank else @@ -305,6 +305,8 @@ //repurposed proc. Now it combines get_id_name() and get_face_name() to determine a mob's name variable. Made into a seperate proc as it'll be useful elsewhere /mob/living/carbon/human/proc/get_visible_name() + if( mind && mind.changeling && mind.changeling.cloaked) + return "Unknown" if( wear_mask && (wear_mask.flags_inv&HIDEFACE) ) //Wearing a mask which hides our face, use id-name if possible return get_id_name("Unknown") if( head && (head.flags_inv&HIDEFACE) ) @@ -1015,7 +1017,8 @@ gunshot_residue = null if(clean_feet && !shoes && istype(feet_blood_DNA, /list) && feet_blood_DNA.len) feet_blood_color = null - qdel(feet_blood_DNA) + feet_blood_DNA.Cut() + feet_blood_DNA = null update_inv_shoes(1) return 1 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 61b13316b8..8f7398e0a8 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -94,7 +94,7 @@ emp_act var/obj/item/organ/external/organ = organs_by_name[organ_name] if(organ) var/weight = organ_rel_size[organ_name] - armorval += getarmor_organ(organ, type) * weight + armorval += (getarmor_organ(organ, type) * weight) total += weight return (armorval/max(total, 1)) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 8a2513a54a..9c372cf2e7 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -443,7 +443,7 @@ var/global/list/damage_icon_parts = list() //For legacy support. /mob/living/carbon/human/regenerate_icons() ..() - if(transforming) return + if(transforming || QDELETED(src)) return update_mutations(0) update_body(0) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 8583521f85..a22011e8ab 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -215,20 +215,15 @@ var/list/ai_verbs_hidden = list( // For why this exists, refer to https://xkcd.c /mob/living/silicon/ai/Destroy() ai_list -= src - qdel(eyeobj) - eyeobj = null - - qdel(psupply) - psupply = null - - qdel(aiMulti) - aiMulti = null - - qdel(aiRadio) - aiRadio = null - - qdel(aiCamera) - aiCamera = null + qdel_null(announcement) + qdel_null(eyeobj) + qdel_null(psupply) + qdel_null(aiPDA) + qdel_null(aiCommunicator) + qdel_null(aiMulti) + qdel_null(aiRadio) + qdel_null(aiCamera) + hack = null return ..() diff --git a/code/modules/mob/living/silicon/robot/analyzer.dm b/code/modules/mob/living/silicon/robot/analyzer.dm index 671f61e29c..3e1564b0cf 100644 --- a/code/modules/mob/living/silicon/robot/analyzer.dm +++ b/code/modules/mob/living/silicon/robot/analyzer.dm @@ -16,14 +16,6 @@ matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 200) var/mode = 1; - -/obj/item/device/robotanalyzer/do_surgery(mob/living/M, mob/living/user) - if(user.a_intent != I_HELP) //in case it is ever used as a surgery tool - return ..() - do_scan(M, user) //default surgery behaviour is just to scan as usual - return 1 - - /obj/item/device/robotanalyzer/attack(mob/living/M as mob, mob/living/user as mob) do_scan(M, user) diff --git a/code/modules/mob/living/silicon/robot/drone/drone_items.dm b/code/modules/mob/living/silicon/robot/drone/drone_items.dm index c7fb1d6728..7d5c270f9b 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm @@ -184,7 +184,7 @@ wrapped.force = 0.0 wrapped.attack(M,user) M.attackby(wrapped, user) //attackby reportedly gets procced by being clicked on, at least according to Anewbe. - if(deleted(wrapped) || wrapped.loc != src.loc) + if(QDELETED(wrapped) || wrapped.loc != src.loc) wrapped = null return 1 return 0 diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 795e535ebf..1dc391f478 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -334,7 +334,8 @@ var/global/list/robot_modules = list( "Antique" = "engineerrobot", "Landmate" = "landmate", "Landmate - Treaded" = "engiborg+tread", - "Drone" = "drone-engineer" + "Drone" = "drone-engineer", + "Treadwell" = "treadwell" ) /obj/item/weapon/robot_module/robot/engineering/construction @@ -352,6 +353,7 @@ var/global/list/robot_modules = list( src.modules += new /obj/item/device/pipe_painter(src) src.modules += new /obj/item/device/floor_painter(src) src.modules += new /obj/item/weapon/gripper/no_use/loader(src) + src.modules += new /obj/item/device/geiger(src) var/datum/matter_synth/metal = new /datum/matter_synth/metal() var/datum/matter_synth/plasteel = new /datum/matter_synth/plasteel() @@ -396,6 +398,7 @@ var/global/list/robot_modules = list( src.modules += new /obj/item/device/pipe_painter(src) src.modules += new /obj/item/device/floor_painter(src) src.emag = new /obj/item/weapon/melee/baton/robot/arm(src) + src.modules += new /obj/item/device/geiger(src) var/datum/matter_synth/metal = new /datum/matter_synth/metal(40000) var/datum/matter_synth/glass = new /datum/matter_synth/glass(40000) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 40b1852528..b74b7d6cf7 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -41,7 +41,7 @@ silicon_mob_list -= src for(var/datum/alarm_handler/AH in alarm_manager.all_handlers) AH.unregister_alarm(src) - ..() + return ..() /mob/living/silicon/proc/init_id() if(idcard) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 3ad6260813..0e121e1481 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -195,7 +195,7 @@ friends.Cut() //This one is not walk_list.Cut() languages.Cut() - ..() + return ..() //Client attached /mob/living/simple_animal/Login() diff --git a/code/modules/mob/living/voice/voice.dm b/code/modules/mob/living/voice/voice.dm index a27b0ffc94..802db9d099 100644 --- a/code/modules/mob/living/voice/voice.dm +++ b/code/modules/mob/living/voice/voice.dm @@ -51,7 +51,7 @@ // Description: Removes reference to the communicator, so it can qdel() successfully. /mob/living/voice/Destroy() comm = null - ..() + return ..() // Proc: ghostize() // Parameters: None diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index f16af92a74..454b58a55c 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -14,6 +14,7 @@ spellremove(src) ghostize() ..() + return QDEL_HINT_HARDDEL_NOW /mob/proc/remove_screen_obj_references() hands = null @@ -672,6 +673,23 @@ if(processScheduler) processScheduler.statProcesses() + if(statpanel("MC")) + stat("CPU:","[world.cpu]") + stat("Instances:","[world.contents.len]") + stat(null) + if(Master) + Master.stat_entry() + else + stat("Master Controller:", "ERROR") + if(Failsafe) + Failsafe.stat_entry() + else + stat("Failsafe Controller:", "ERROR") + if(Master) + stat(null) + for(var/datum/controller/subsystem/SS in Master.subsystems) + SS.stat_entry() + if(listed_turf && client) if(!TurfAdjacent(listed_turf)) listed_turf = null diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index 80f68b979d..890ff2e873 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -83,7 +83,9 @@ //This makes sure that the grab screen object is displayed in the correct hand. -/obj/item/weapon/grab/proc/synch() +/obj/item/weapon/grab/proc/synch() //why is this needed? + if(QDELETED(src)) + return if(affecting) if(assailant.r_hand == src) hud.screen_loc = ui_rhand @@ -91,7 +93,7 @@ hud.screen_loc = ui_lhand /obj/item/weapon/grab/process() - if(gcDestroyed) // GC is trying to delete us, we'll kill our processing so we can cleanly GC + if(QDELETED(src)) // GC is trying to delete us, we'll kill our processing so we can cleanly GC return PROCESS_KILL confirm() @@ -221,6 +223,8 @@ animate(affecting, pixel_x =-shift, pixel_y = 0, 5, 1, LINEAR_EASING) /obj/item/weapon/grab/proc/s_click(obj/screen/S) + if(QDELETED(src)) + return if(!affecting) return if(state == GRAB_UPGRADING) @@ -291,6 +295,8 @@ return 1 /obj/item/weapon/grab/attack(mob/M, mob/living/user) + if(QDELETED(src)) + return if(!affecting) return if(world.time < (last_action + 20)) @@ -336,7 +342,7 @@ /obj/item/weapon/grab/dropped() loc = null - if(!destroying) + if(!QDELETED(src)) qdel(src) /obj/item/weapon/grab/proc/reset_kill_state() @@ -387,9 +393,6 @@ /obj/item/weapon/grab/proc/size_difference(mob/A, mob/B) return mob_size_difference(A.mob_size, B.mob_size) -/obj/item/weapon/grab - var/destroying = 0 - /obj/item/weapon/grab/Destroy() animate(affecting, pixel_x = 0, pixel_y = 0, 4, 1, LINEAR_EASING) affecting.layer = 4 @@ -402,5 +405,4 @@ assailant = null qdel(hud) hud = null - destroying = 1 // stops us calling qdel(src) on dropped() - ..() + return ..() diff --git a/code/modules/mob/modifiers.dm b/code/modules/mob/modifiers.dm index f67ffc374b..0b39c9e275 100644 --- a/code/modules/mob/modifiers.dm +++ b/code/modules/mob/modifiers.dm @@ -73,7 +73,7 @@ /mob/living/Destroy() remove_all_modifiers(TRUE) - ..() + return ..() // Called by Life(). /mob/living/proc/handle_modifiers() diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 4cf3499b8a..5fa306b7b9 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -224,12 +224,14 @@ var/datum/gear/G = gear_datums[thing] if(G) var/permitted = 0 - if(G.allowed_roles) + if(!G.allowed_roles) + permitted = 1 + else if(!previewJob) + permitted = 0 + else for(var/job_name in G.allowed_roles) if(previewJob.title == job_name) permitted = 1 - else - permitted = 1 if(G.whitelisted && (G.whitelisted != mannequin.species.name)) permitted = 0 diff --git a/code/modules/mob/new_player/sprite_accessories.dm b/code/modules/mob/new_player/sprite_accessories.dm index 04e45f93d0..470b4e1a00 100644 --- a/code/modules/mob/new_player/sprite_accessories.dm +++ b/code/modules/mob/new_player/sprite_accessories.dm @@ -627,7 +627,6 @@ /datum/sprite_accessory/facial_hair icon = 'icons/mob/Human_face.dmi' - gender = MALE shaved name = "Shaved" @@ -1309,4 +1308,4 @@ name = "Default skrell skin" icon_state = "default" icon = 'icons/mob/human_races/r_skrell.dmi' - species_allowed = list("Skrell") \ No newline at end of file + species_allowed = list("Skrell") diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index 122e1aa4cd..b54fc3efc1 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -23,12 +23,12 @@ if(!istype(start)) to_chat(src, "You are unable to move from here.") return 0 - + var/turf/destination = (direction == UP) ? GetAbove(src) : GetBelow(src) if(!destination) to_chat(src, "There is nothing of interest in this direction.") return 0 - + if(!start.CanZPass(src, direction)) to_chat(src, "\The [start] is in the way.") return 0 @@ -154,6 +154,28 @@ /obj/effect/decal/cleanable/can_fall() return TRUE +// These didn't fall anyways but better to nip this now just incase. +/atom/movable/lighting_overlay/can_fall() + return FALSE + +// Mechas are anchored, so we need to override. +/obj/mecha/can_fall() + var/obj/structure/lattice/lattice = locate(/obj/structure/lattice, loc) + if(lattice) + var/area/area = get_area(src) + if(area.has_gravity()) + // Lattices seem a bit too flimsy to hold up a massive exosuit. + lattice.visible_message("\The [lattice] collapses under the weight of \the [src]!") + qdel(lattice) + + // See if something prevents us from falling. + var/turf/below = GetBelow(src) + for(var/atom/A in below) + if(!A.CanPass(src, src.loc)) + return FALSE + + return TRUE + /obj/item/pipe/can_fall() var/turf/simulated/open/below = loc below = below.below @@ -195,4 +217,26 @@ apply_damage(rand(0, damage), BRUTE, BP_L_ARM) apply_damage(rand(0, damage), BRUTE, BP_R_ARM) Weaken(4) - updatehealth() \ No newline at end of file + updatehealth() + +/obj/mecha/handle_fall(var/turf/landing) + if(..()) + return + + // Tell the pilot that they just dropped down with a superheavy mecha. + if(occupant) + to_chat(occupant, "\The [src] crashed down onto \the [landing]!") + + // Anything on the same tile as the landing tile is gonna have a bad day. + for(var/mob/living/L in landing.contents) + L.visible_message("\The [src] crushes \the [L] as it lands on them!") + L.adjustBruteLoss(rand(70, 100)) + L.Weaken(8) + + // Now to hurt the mech. + take_damage(rand(15, 30)) + + // And hurt the floor. + if(istype(landing, /turf/simulated/floor)) + var/turf/simulated/floor/ground = landing + ground.break_tile() \ No newline at end of file diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm index 1390c89b29..e0809e32b5 100644 --- a/code/modules/organs/internal/brain.dm +++ b/code/modules/organs/internal/brain.dm @@ -67,10 +67,8 @@ brainmob.client.screen.len = null //clear the hud /obj/item/organ/internal/brain/Destroy() - if(brainmob) - qdel(brainmob) - brainmob = null - ..() + qdel_null(brainmob) + . = ..() /obj/item/organ/internal/brain/proc/transfer_identity(var/mob/living/carbon/H) diff --git a/code/modules/power/breaker_box.dm b/code/modules/power/breaker_box.dm index e133f82e6e..2b10a9017d 100644 --- a/code/modules/power/breaker_box.dm +++ b/code/modules/power/breaker_box.dm @@ -20,7 +20,7 @@ var/update_locked = 0 /obj/machinery/power/breakerbox/Destroy() - ..() + . = ..() for(var/datum/nano_module/rcon/R in world) R.FindDevices() diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 27bf4c0ab7..ebfa533086 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -108,7 +108,7 @@ var/list/possible_cable_coil_colours = list( if(powernet) cut_cable_from_powernet() // update the powernets cable_list -= src //remove it from global cable list - ..() // then go ahead and delete the cable + return ..() // then go ahead and delete the cable // Ghost examining the cable -> tells him the power /obj/structure/cable/attack_ghost(mob/user) @@ -526,9 +526,9 @@ obj/structure/cable/proc/cableColor(var/colorC) if(!S || S.robotic < ORGAN_ROBOT || S.open == 3) return ..() - var/use_amt = min(src.amount, ceil(S.burn_dam/3), 5) + var/use_amt = min(src.amount, ceil(S.burn_dam/5), 5) if(can_use(use_amt)) - if(S.robo_repair(3*use_amt, BURN, "some damaged wiring", src, user)) + if(S.robo_repair(5*use_amt, BURN, "some damaged wiring", src, user)) src.use(use_amt) else diff --git a/code/modules/power/grid_checker.dm b/code/modules/power/grid_checker.dm index 4d42d4ca3f..b8a123e02f 100644 --- a/code/modules/power/grid_checker.dm +++ b/code/modules/power/grid_checker.dm @@ -28,7 +28,7 @@ /obj/machinery/power/grid_checker/Destroy() qdel(wires) wires = null - ..() + return ..() /obj/machinery/power/grid_checker/update_icon() if(power_failing) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 09921cf58b..0609e18041 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -162,7 +162,7 @@ active_power_usage = 20 power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list var/on = 0 // 1 if on, 0 if off - var/brightness_range = 10 // luminosity when on, also used in power calculation + var/brightness_range = 6 // luminosity when on, also used in power calculation var/brightness_power = 3 var/brightness_color = null var/status = LIGHT_OK // LIGHT_OK, _EMPTY, _BURNED or _BROKEN @@ -180,7 +180,7 @@ icon_state = "bulb1" base_state = "bulb" fitting = "bulb" - brightness_range = 6 + brightness_range = 4 brightness_power = 2 brightness_color = "#FFF4E5" desc = "A small lighting fixture." @@ -199,7 +199,7 @@ var/lamp_shade = 1 /obj/machinery/light/small/emergency - brightness_range = 6 + brightness_range = 4 brightness_power = 2 brightness_color = "#da0205" @@ -248,7 +248,7 @@ if(A) on = 0 // A.update_lights() - ..() + return ..() /obj/machinery/light/update_icon() diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index f900f6fcf4..6a40cf3b8e 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -396,17 +396,13 @@ /obj/machinery/power/port_gen/pacman/super/UseFuel() //produces a tiny amount of radiation when in use if (prob(2*power_output)) - for (var/mob/living/L in range(src, 5)) - L.apply_effect(1, IRRADIATE) //should amount to ~5 rads per minute at max safe power + radiation_repository.radiate(src, 4) ..() /obj/machinery/power/port_gen/pacman/super/explode() //a nice burst of radiation var/rads = 50 + (sheets + sheet_left)*1.5 - for (var/mob/living/L in range(src, 10)) - //should really fall with the square of the distance, but that makes the rads value drop too fast - //I dunno, maybe physics works different when you live in 2D -- SM radiation also works like this, apparently - L.apply_effect(max(20, round(rads/get_dist(L,src))), IRRADIATE) + radiation_repository.radiate(src, (max(20, rads))) explosion(src.loc, 3, 3, 5, 3) qdel(src) diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 13213c2e7e..76320db479 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -19,7 +19,7 @@ disconnect_from_network() disconnect_terminal() - ..() + return ..() /////////////////////////////// // General procedures diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index dee15d9f14..53e3dc29c9 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -23,7 +23,7 @@ var/global/list/rad_collectors = list() /obj/machinery/power/rad_collector/Destroy() rad_collectors -= src - ..() + return ..() /obj/machinery/power/rad_collector/process() //so that we don't zero out the meter if the SM is processed first. @@ -31,6 +31,11 @@ var/global/list/rad_collectors = list() last_power_new = 0 + if(P && active) + var/rads = radiation_repository.get_rads_at_turf(get_turf(src)) + if(rads) + receive_pulse(rads * 5) //Maths is hard + if(P) if(P.air_contents.gas["phoron"] == 0) investigate_log("out of fuel.","singulo") diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 39090ceac5..9309c6bd3c 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -406,15 +406,13 @@ var/toxrange = 10 var/toxdamage = 4 var/radiation = 15 - var/radiationmin = 3 if (src.energy>200) toxdamage = round(((src.energy-150)/50)*4,1) radiation = round(((src.energy-150)/50)*5,1) - radiationmin = round((radiation/5),1)// + radiation_repository.radiate(src, radiation) //Always radiate at max, so a decent dose of radiation is applied for(var/mob/living/M in view(toxrange, src.loc)) if(M.status_flags & GODMODE) continue - M.apply_effect(rand(radiationmin,radiation), IRRADIATE) toxdamage = (toxdamage - (toxdamage*M.getarmor(null, "rad"))) M.apply_effect(toxdamage, TOX) return @@ -448,13 +446,13 @@ /obj/singularity/proc/smwave() for(var/mob/living/M in view(10, src.loc)) if(prob(67)) - M.apply_effect(rand(energy), IRRADIATE) - M << "You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat." - M << "Miraculously, it fails to kill you." + to_chat(M, "You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat.") + to_chat(M, "Miraculously, it fails to kill you.") else M << "You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat." M << "You don't even have a moment to react as you are reduced to ashes by the intense radiation." M.dust() + radiation_repository.radiate(src, rand(energy)) return /obj/singularity/proc/pulse() diff --git a/code/modules/projectiles/ammunition/boxes.dm b/code/modules/projectiles/ammunition/magazines.dm similarity index 57% rename from code/modules/projectiles/ammunition/boxes.dm rename to code/modules/projectiles/ammunition/magazines.dm index 8a259b6342..6202e03cde 100644 --- a/code/modules/projectiles/ammunition/boxes.dm +++ b/code/modules/projectiles/ammunition/magazines.dm @@ -1,493 +1,514 @@ -///////// .357 ///////// - -/obj/item/ammo_magazine/a357 - name = "speedloader (.357)" - desc = "A speedloader for .357 revolvers." - icon_state = "38" - caliber = "357" - ammo_type = /obj/item/ammo_casing/a357 - matter = list(DEFAULT_WALL_MATERIAL = 1260) - max_ammo = 6 - multiple_sprites = 1 - -///////// .38 ///////// - -/obj/item/ammo_magazine/c38 - name = "speedloader (.38)" - desc = "A speedloader for .38 revolvers." - icon_state = "38" - caliber = "38" - matter = list(DEFAULT_WALL_MATERIAL = 360) - ammo_type = /obj/item/ammo_casing/c38 - max_ammo = 6 - multiple_sprites = 1 - -/obj/item/ammo_magazine/c38/rubber - name = "speedloader (.38 rubber)" - ammo_type = /obj/item/ammo_casing/c38r - -/obj/item/ammo_magazine/c38/emp - name = "ammunition box (.38 haywire)" - ammo_type = /obj/item/ammo_casing/c38/emp - -///////// .45 ///////// - -/obj/item/ammo_magazine/c45m - name = "pistol magazine (.45)" - icon_state = "45" - mag_type = MAGAZINE - ammo_type = /obj/item/ammo_casing/c45 - matter = list(DEFAULT_WALL_MATERIAL = 525) //metal costs are very roughly based around 1 .45 casing = 75 metal - caliber = ".45" - max_ammo = 7 - multiple_sprites = 1 - -/obj/item/ammo_magazine/c45m/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/c45m/rubber - name = "magazine (.45 rubber)" - ammo_type = /obj/item/ammo_casing/c45r - -/obj/item/ammo_magazine/c45m/practice - name = "magazine (.45 practice)" - ammo_type = /obj/item/ammo_casing/c45p - -/obj/item/ammo_magazine/c45m/flash - name = "magazine (.45 flash)" - ammo_type = /obj/item/ammo_casing/c45f - -/obj/item/ammo_magazine/c45m/ap - name = "magazine (.45 AP)" - ammo_type = /obj/item/ammo_casing/c45ap - -/obj/item/ammo_magazine/box/emp/c45 - name = "ammunition box (.45 haywire)" - ammo_type = /obj/item/ammo_casing/c45/emp - -/obj/item/ammo_magazine/c45uzi - name = "stick magazine (.45)" - icon_state = "uzi45" - mag_type = MAGAZINE - ammo_type = /obj/item/ammo_casing/c45 - matter = list(DEFAULT_WALL_MATERIAL = 1200) - caliber = ".45" - max_ammo = 16 - multiple_sprites = 1 - -/obj/item/ammo_magazine/c45uzi/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/tommymag - name = "tommygun magazine (.45)" - icon_state = "tommy-mag" - mag_type = MAGAZINE - ammo_type = /obj/item/ammo_casing/c45 - matter = list(DEFAULT_WALL_MATERIAL = 1500) - caliber = ".45" - max_ammo = 20 - -/obj/item/ammo_magazine/tommymag/ap - name = "tommygun magazine (.45 AP)" - ammo_type = /obj/item/ammo_casing/c45ap - -/obj/item/ammo_magazine/tommymag/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/tommydrum - name = "tommygun drum magazine (.45)" - icon_state = "tommy-drum" - w_class = ITEMSIZE_NORMAL // Bulky ammo doesn't fit in your pockets! - mag_type = MAGAZINE - ammo_type = /obj/item/ammo_casing/c45 - matter = list(DEFAULT_WALL_MATERIAL = 3750) - caliber = ".45" - max_ammo = 50 - -/obj/item/ammo_magazine/tommydrum/ap - name = "tommygun drum magazine (.45 AP)" - ammo_type = /obj/item/ammo_casing/c45ap - -/obj/item/ammo_magazine/tommydrum/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/clip/c45 - name = "ammo clip (.45)" - icon_state = "clip_pistol" - desc = "A stripper clip for reloading .45 rounds into magazines." - caliber = ".45" - ammo_type = /obj/item/ammo_casing/c45 - matter = list(DEFAULT_WALL_MATERIAL = 675) // metal costs very roughly based around one .45 casing = 75 metal - max_ammo = 9 - multiple_sprites = 1 - -/obj/item/ammo_magazine/clip/c45/rubber - name = "ammo clip (.45 rubber)" - ammo_type = /obj/item/ammo_casing/c45r - -/obj/item/ammo_magazine/clip/c45/practice - name = "ammo clip (.45 practice)" - ammo_type = /obj/item/ammo_casing/c45p - -/obj/item/ammo_magazine/clip/c45/flash - name = "ammo clip (.45 flash)" - ammo_type = /obj/item/ammo_casing/c45f - -///////// 9mm ///////// - -/obj/item/ammo_magazine/mc9mm - name = "magazine (9mm)" - icon_state = "9x19p" - origin_tech = list(TECH_COMBAT = 2) - mag_type = MAGAZINE - matter = list(DEFAULT_WALL_MATERIAL = 480) - caliber = "9mm" - ammo_type = /obj/item/ammo_casing/c9mm - max_ammo = 8 - multiple_sprites = 1 - -/obj/item/ammo_magazine/mc9mm/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/mc9mm/flash - ammo_type = /obj/item/ammo_casing/c9mmf - -/obj/item/ammo_magazine/mc9mm/rubber - name = "magazine (9mm rubber)" - ammo_type = /obj/item/ammo_casing/c9mmr - -/obj/item/ammo_magazine/mc9mm/practice - name = "magazine (9mm practice)" - ammo_type = /obj/item/ammo_casing/c9mmp - -/obj/item/ammo_magazine/mc9mmt - name = "top mounted magazine (9mm)" - icon_state = "9mmt" - mag_type = MAGAZINE - ammo_type = /obj/item/ammo_casing/c9mm - matter = list(DEFAULT_WALL_MATERIAL = 1200) - caliber = "9mm" - max_ammo = 20 - multiple_sprites = 1 - -/obj/item/ammo_magazine/mc9mmt/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/mc9mmt/rubber - name = "top mounted magazine (9mm rubber)" - ammo_type = /obj/item/ammo_casing/c9mmr - -/obj/item/ammo_magazine/mc9mmt/flash - name = "top mounted magazine (9mm flash)" - ammo_type = /obj/item/ammo_casing/c9mmf - -/obj/item/ammo_magazine/mc9mmt/practice - name = "top mounted magazine (9mm practice)" - ammo_type = /obj/item/ammo_casing/c9mmp - -/obj/item/ammo_magazine/p90 - name = "high capacity top mounted magazine (9mm armor-piercing)" - icon_state = "p90" - mag_type = MAGAZINE - ammo_type = /obj/item/ammo_casing/c9mm/ap - matter = list(DEFAULT_WALL_MATERIAL = 3000) - caliber = "9mm" - max_ammo = 50 - multiple_sprites = 1 - -/obj/item/ammo_magazine/p90/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/clip/c9mm - name = "ammo clip (9mm)" - icon_state = "clip_pistol" - desc = "A stripper clip for reloading 9mm rounds into magazines." - caliber = "9mm" - ammo_type = /obj/item/ammo_casing/c9mm - matter = list(DEFAULT_WALL_MATERIAL = 540) // metal costs are very roughly based around one 9mm casing = 60 metal - max_ammo = 9 - multiple_sprites = 1 - -/obj/item/ammo_magazine/clip/c9mm/rubber - name = "ammo clip (.45 rubber)" - ammo_type = /obj/item/ammo_casing/c9mmr - -/obj/item/ammo_magazine/clip/c9mm/practice - name = "ammo clip (.45 practice)" - ammo_type = /obj/item/ammo_casing/c9mmp - -/obj/item/ammo_magazine/clip/c9mm/flash - name = "ammo clip (.45 flash)" - ammo_type = /obj/item/ammo_casing/c9mmf - -/obj/item/ammo_magazine/c9mm // Made by RnD for Prototype SMG and should probably be removed because why does it require DIAMONDS to make bullets? - name = "ammunition Box (9mm)" - icon_state = "9mm" - origin_tech = list(TECH_COMBAT = 2) - matter = list(DEFAULT_WALL_MATERIAL = 1800) - caliber = "9mm" - ammo_type = /obj/item/ammo_casing/c9mm - max_ammo = 30 - -/obj/item/ammo_magazine/c9mm/empty - initial_ammo = 0 - -///////// 5mm ///////// -/* -/obj/item/ammo_magazine/c5mm - name = "magazine (5mm)" - icon_state = "fiveseven" - mag_type = MAGAZINE - ammo_type = /obj/item/ammo_casing/c5mm - matter = list(DEFAULT_WALL_MATERIAL = 1200) - caliber = "5mm" - max_ammo = 20 - //multiple_sprites = 1 - -/obj/item/ammo_magazine/clip/c5mm - name = "ammo clip (5mm)" - icon_state = "clip_pistol" - desc = "A stripper clip for reloading 5mm rounds into magazines." - caliber = "5mm" - ammo_type = /obj/item/ammo_casing/c5mm - matter = list(DEFAULT_WALL_MATERIAL = 540) // metal costs are very roughly based around one 5mm casing = 60 metal - max_ammo = 9 - multiple_sprites = 1 -*/ -///////// 10mm ///////// - -/obj/item/ammo_magazine/a10mm - name = "magazine (10mm)" - icon_state = "10mm" - origin_tech = list(TECH_COMBAT = 2) - mag_type = MAGAZINE - caliber = "10mm" - matter = list(DEFAULT_WALL_MATERIAL = 1500) - ammo_type = /obj/item/ammo_casing/a10mm - max_ammo = 20 - multiple_sprites = 1 - -/obj/item/ammo_magazine/a10mm/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/clip/a10mm - name = "ammo clip (10mm)" - icon_state = "clip_pistol" - desc = "A stripper clip for reloading 5mm rounds into magazines." - caliber = "10mm" - ammo_type = /obj/item/ammo_casing/a10mm - matter = list(DEFAULT_WALL_MATERIAL = 675) // metal costs are very roughly based around one 10mm casing = 75 metal - max_ammo = 9 - multiple_sprites = 1 - -/obj/item/ammo_magazine/box/emp/a10mm - name = "ammunition box (10mm haywire)" - ammo_type = /obj/item/ammo_casing/a10mm/emp - -///////// 5.56mm ///////// - -/obj/item/ammo_magazine/c556 - name = "magazine (5.56mm)" - icon_state = "c5.56" - origin_tech = list(TECH_COMBAT = 2) - mag_type = MAGAZINE - caliber = "a556" - matter = list(DEFAULT_WALL_MATERIAL = 1800) - ammo_type = /obj/item/ammo_casing/a556 - max_ammo = 20 - multiple_sprites = 1 - -/obj/item/ammo_magazine/c556/ext - name = "extended magazine (5.56mm)" - matter = list(DEFAULT_WALL_MATERIAL = 2700) - max_ammo = 30 - -/obj/item/ammo_magazine/c556/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/c556/ext/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/c556/practice - name = "magazine (5.56mm practice)" - ammo_type = /obj/item/ammo_casing/a556p - -/obj/item/ammo_magazine/c556/practice/ext - name = "extended magazine (5.56mm practice)" - max_ammo = 30 - -/obj/item/ammo_magazine/c556/ap - name = "magazine (5.56mm armor-piercing)" - ammo_type = /obj/item/ammo_casing/a556/ap - -/obj/item/ammo_magazine/c556/ap/ext - name = "extended magazine (5.56mm armor-piercing)" - max_ammo = 30 - -/obj/item/ammo_magazine/clip/a556 - name = "ammo clip (5.56mm)" - icon_state = "clip_rifle" - caliber = "a556" - ammo_type = /obj/item/ammo_casing/a556 - matter = list(DEFAULT_WALL_MATERIAL = 450) // metal costs are very roughly based around one 10mm casing = 180 metal - max_ammo = 5 - multiple_sprites = 1 - -/obj/item/ammo_magazine/clip/a556/ap - name = "rifle clip (5.56mm armor-piercing)" - ammo_type = /obj/item/ammo_casing/a556/ap - -/obj/item/ammo_magazine/clip/a556/practice - name = "rifle clip (5.56mm practice)" - ammo_type = /obj/item/ammo_casing/a556 - -/obj/item/ammo_magazine/a556 - name = "magazine box (5.56mm)" - icon_state = "a556" - origin_tech = list(TECH_COMBAT = 2) - mag_type = MAGAZINE - caliber = "a556" - matter = list(DEFAULT_WALL_MATERIAL = 10000) - ammo_type = /obj/item/ammo_casing/a556 - w_class = ITEMSIZE_NORMAL // This should NOT fit in your pocket!! - max_ammo = 50 - multiple_sprites = 1 - -/obj/item/ammo_magazine/a556/ap - name = "magazine box (5.56mm armor-piercing)" - ammo_type = /obj/item/ammo_casing/a556/ap - -/obj/item/ammo_magazine/a556/empty - initial_ammo = 0 - -///////// .50 AE ///////// - -/obj/item/ammo_magazine/a50 - name = "magazine (.50 AE)" - icon_state = "50ae" - origin_tech = list(TECH_COMBAT = 2) - mag_type = MAGAZINE - caliber = ".50" - matter = list(DEFAULT_WALL_MATERIAL = 1260) - ammo_type = /obj/item/ammo_casing/a50 - max_ammo = 7 - multiple_sprites = 1 - -/obj/item/ammo_magazine/a50/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/clip/a50 - name = "ammo clip (.50 AE)" - icon_state = "clip_pistol" - desc = "A stripper clip for reloading .50 Action Express rounds into magazines." - caliber = ".50" - ammo_type = /obj/item/ammo_casing/a50 - matter = list(DEFAULT_WALL_MATERIAL = 1620) // metal costs are very roughly based around one .50 casing = 180 metal - max_ammo = 9 - multiple_sprites = 1 - -///////// 7.62mm ///////// - -/obj/item/ammo_magazine/c762 - name = "magazine (7.62mm)" - icon_state = "c7.62" - mag_type = MAGAZINE - caliber = "a762" - matter = list(DEFAULT_WALL_MATERIAL = 2000) - ammo_type = /obj/item/ammo_casing/a762 - max_ammo = 10 - multiple_sprites = 1 - -/obj/item/ammo_magazine/c762/ap - name = "magazine (7.62mm armor-piercing)" - ammo_type = /obj/item/ammo_casing/a762/ap - -/obj/item/ammo_magazine/c762/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/s762 // 's' for small! - name = "magazine (7.62mm)" - icon_state = "SVD" - mag_type = MAGAZINE - caliber = "a762" - matter = list(DEFAULT_WALL_MATERIAL = 1000) - ammo_type = /obj/item/ammo_casing/a762 - max_ammo = 10 - multiple_sprites = 1 - -/obj/item/ammo_magazine/s762/empty - initial_ammo = 0 - -/obj/item/ammo_magazine/s762/ap - name = "magazine (7.62mm armor-piercing)" - ammo_type = /obj/item/ammo_casing/a762/ap - -/obj/item/ammo_magazine/clip/a762 - name = "ammo clip (7.62mm)" - icon_state = "clip_rifle" - caliber = "a762" - ammo_type = /obj/item/ammo_casing/a762 - matter = list(DEFAULT_WALL_MATERIAL = 1000) // metal costs are very roughly based around one 7.62 casing = 200 metal - max_ammo = 5 - multiple_sprites = 1 - -/obj/item/ammo_magazine/clip/a762/ap - name = "rifle clip (7.62mm armor-piercing)" - ammo_type = /obj/item/ammo_casing/a762/ap - -/obj/item/ammo_magazine/clip/a762/practice - name = "rifle clip (7.62mm practice)" - ammo_type = /obj/item/ammo_casing/a762p - -///////// 12g ///////// - -/obj/item/ammo_magazine/g12 - name = "magazine (12 gauge)" - icon_state = "12g" - mag_type = MAGAZINE - caliber = "shotgun" - matter = list(DEFAULT_WALL_MATERIAL = 2200) - ammo_type = /obj/item/ammo_casing/shotgun - max_ammo = 24 - multiple_sprites = 1 - -/obj/item/ammo_magazine/g12/beanbag - name = "magazine (12 gauge beanbag)" - ammo_type = /obj/item/ammo_casing/shotgun/beanbag - -/obj/item/ammo_magazine/g12/pellet - name = "magazine (12 gauge pellet)" - ammo_type = /obj/item/ammo_casing/shotgun/pellet - -/obj/item/ammo_magazine/g12/flash - name = "magazine (12 gauge flash)" - ammo_type = /obj/item/ammo_casing/shotgun/flash - -/obj/item/ammo_magazine/g12/empty - initial_ammo = 0 - -///////// .75 Gyrojet ///////// - -/obj/item/ammo_magazine/a75 - name = "ammo magazine (.75 Gyrojet)" - icon_state = "75" - mag_type = MAGAZINE - caliber = "75" - ammo_type = /obj/item/ammo_casing/a75 - multiple_sprites = 1 - max_ammo = 4 - -/obj/item/ammo_magazine/a75/empty - initial_ammo = 0 - -///////// Misc. ///////// - -/obj/item/ammo_magazine/caps - name = "speedloader (caps)" - icon_state = "T38" - caliber = "caps" - color = "#FF0000" - ammo_type = /obj/item/ammo_casing/cap - matter = list(DEFAULT_WALL_MATERIAL = 600) - max_ammo = 7 +/************************************************************************/ +/* +# An explaination of the naming format for guns and ammo: +# +# a = Ammo, as in individual rounds of ammunition. +# b = Box, intended to have ammo taken out one at a time by hand. +# c = Clips, intended to reload magazines or guns quickly. +# m = Magazine, intended to hold rounds of ammo. +# s = Speedloaders, intended to reload guns quickly. +# +# Use this format, followed by the caliber. For example, a shotgun's caliber +# variable is "12g" as a result. Ergo, a shotgun round's path would have "a12g", +# or a magazine with shotgun shells would be "m12g" instead. To avoid confusion +# for developers and in-game admins spawning these items, stick to this format. +# Likewise, when creating new rounds, the caliber variable should match whatever +# the name says. +# +# This comment is copied in rounds.dm as well. +# +# Also, if a magazine is only meant for a specific gun, include the name +# of the specific gun in the path. Example: m45uzi is only for the Uzi. +*/ +/************************************************************************/ + + + +///////// .357 ///////// + +/obj/item/ammo_magazine/s357 + name = "speedloader (.357)" + desc = "A speedloader for .357 revolvers." + icon_state = "38" + caliber = "357" + ammo_type = /obj/item/ammo_casing/a357 + matter = list(DEFAULT_WALL_MATERIAL = 1260) + max_ammo = 6 + multiple_sprites = 1 + +///////// .38 ///////// + +/obj/item/ammo_magazine/s38 + name = "speedloader (.38)" + desc = "A speedloader for .38 revolvers." + icon_state = "38" + caliber = ".38" + matter = list(DEFAULT_WALL_MATERIAL = 360) + ammo_type = /obj/item/ammo_casing/a38 + max_ammo = 6 + multiple_sprites = 1 + +/obj/item/ammo_magazine/s38/rubber + name = "speedloader (.38 rubber)" + ammo_type = /obj/item/ammo_casing/a38r + +/obj/item/ammo_magazine/s38/emp + name = "speedloader (.38 haywire)" + ammo_type = /obj/item/ammo_casing/a38/emp + +///////// .45 ///////// + +/obj/item/ammo_magazine/m45 + name = "pistol magazine (.45)" + icon_state = "45" + mag_type = MAGAZINE + ammo_type = /obj/item/ammo_casing/a45 + matter = list(DEFAULT_WALL_MATERIAL = 525) //metal costs are very roughly based around 1 .45 casing = 75 metal + caliber = ".45" + max_ammo = 7 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m45/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m45/rubber + name = "magazine (.45 rubber)" + ammo_type = /obj/item/ammo_casing/a45r + +/obj/item/ammo_magazine/m45/practice + name = "magazine (.45 practice)" + ammo_type = /obj/item/ammo_casing/a45p + +/obj/item/ammo_magazine/m45/flash + name = "magazine (.45 flash)" + ammo_type = /obj/item/ammo_casing/a45f + +/obj/item/ammo_magazine/m45/ap + name = "magazine (.45 AP)" + ammo_type = /obj/item/ammo_casing/a45ap + +/obj/item/ammo_magazine/box/emp/b45 + name = "ammunition box (.45 haywire)" + ammo_type = /obj/item/ammo_casing/a45/emp + +/obj/item/ammo_magazine/m45uzi + name = "stick magazine (.45)" + icon_state = "uzi45" + mag_type = MAGAZINE + ammo_type = /obj/item/ammo_casing/a45 + matter = list(DEFAULT_WALL_MATERIAL = 1200) + caliber = ".45" + max_ammo = 16 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m45uzi/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m45tommy + name = "tommygun magazine (.45)" + icon_state = "tommy-mag" + mag_type = MAGAZINE + ammo_type = /obj/item/ammo_casing/a45 + matter = list(DEFAULT_WALL_MATERIAL = 1500) + caliber = ".45" + max_ammo = 20 + +/obj/item/ammo_magazine/m45tommy/ap + name = "tommygun magazine (.45 AP)" + ammo_type = /obj/item/ammo_casing/a45ap + +/obj/item/ammo_magazine/m45tommy/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m45tommydrum + name = "tommygun drum magazine (.45)" + icon_state = "tommy-drum" + w_class = ITEMSIZE_NORMAL // Bulky ammo doesn't fit in your pockets! + mag_type = MAGAZINE + ammo_type = /obj/item/ammo_casing/a45 + matter = list(DEFAULT_WALL_MATERIAL = 3750) + caliber = ".45" + max_ammo = 50 + +/obj/item/ammo_magazine/m45tommydrum/ap + name = "tommygun drum magazine (.45 AP)" + ammo_type = /obj/item/ammo_casing/a45ap + +/obj/item/ammo_magazine/m45tommydrum/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/clip/c45 + name = "ammo clip (.45)" + icon_state = "clip_pistol" + desc = "A stripper clip for reloading .45 rounds into magazines." + caliber = ".45" + ammo_type = /obj/item/ammo_casing/a45 + matter = list(DEFAULT_WALL_MATERIAL = 675) // metal costs very roughly based around one .45 casing = 75 metal + max_ammo = 9 + multiple_sprites = 1 + +/obj/item/ammo_magazine/clip/c45/rubber + name = "ammo clip (.45 rubber)" + ammo_type = /obj/item/ammo_casing/a45r + +/obj/item/ammo_magazine/clip/c45/practice + name = "ammo clip (.45 practice)" + ammo_type = /obj/item/ammo_casing/a45p + +/obj/item/ammo_magazine/clip/c45/flash + name = "ammo clip (.45 flash)" + ammo_type = /obj/item/ammo_casing/a45f + +///////// 9mm ///////// + +/obj/item/ammo_magazine/m9mm + name = "magazine (9mm)" + icon_state = "9x19p" + origin_tech = list(TECH_COMBAT = 2) + mag_type = MAGAZINE + matter = list(DEFAULT_WALL_MATERIAL = 480) + caliber = "9mm" + ammo_type = /obj/item/ammo_casing/a9mm + max_ammo = 8 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m9mm/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m9mm/flash + ammo_type = /obj/item/ammo_casing/a9mmf + +/obj/item/ammo_magazine/m9mm/rubber + name = "magazine (9mm rubber)" + ammo_type = /obj/item/ammo_casing/a9mmr + +/obj/item/ammo_magazine/m9mm/practice + name = "magazine (9mm practice)" + ammo_type = /obj/item/ammo_casing/a9mmp + +/obj/item/ammo_magazine/m9mmt + name = "top mounted magazine (9mm)" + icon_state = "9mmt" + mag_type = MAGAZINE + ammo_type = /obj/item/ammo_casing/a9mm + matter = list(DEFAULT_WALL_MATERIAL = 1200) + caliber = "9mm" + max_ammo = 20 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m9mmt/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m9mmt/rubber + name = "top mounted magazine (9mm rubber)" + ammo_type = /obj/item/ammo_casing/a9mmr + +/obj/item/ammo_magazine/m9mmt/flash + name = "top mounted magazine (9mm flash)" + ammo_type = /obj/item/ammo_casing/a9mmf + +/obj/item/ammo_magazine/m9mmt/practice + name = "top mounted magazine (9mm practice)" + ammo_type = /obj/item/ammo_casing/a9mmp + +/obj/item/ammo_magazine/m9mmp90 + name = "high capacity top mounted magazine (9mm armor-piercing)" + icon_state = "p90" + mag_type = MAGAZINE + ammo_type = /obj/item/ammo_casing/a9mm/ap + matter = list(DEFAULT_WALL_MATERIAL = 3000) + caliber = "9mm" + max_ammo = 50 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m9mmp90/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/clip/c9mm + name = "ammo clip (9mm)" + icon_state = "clip_pistol" + desc = "A stripper clip for reloading 9mm rounds into magazines." + caliber = "9mm" + ammo_type = /obj/item/ammo_casing/a9mm + matter = list(DEFAULT_WALL_MATERIAL = 540) // metal costs are very roughly based around one 9mm casing = 60 metal + max_ammo = 9 + multiple_sprites = 1 + +/obj/item/ammo_magazine/clip/c9mm/rubber + name = "ammo clip (.45 rubber)" + ammo_type = /obj/item/ammo_casing/a9mmr + +/obj/item/ammo_magazine/clip/c9mm/practice + name = "ammo clip (.45 practice)" + ammo_type = /obj/item/ammo_casing/a9mmp + +/obj/item/ammo_magazine/clip/c9mm/flash + name = "ammo clip (.45 flash)" + ammo_type = /obj/item/ammo_casing/a9mmf + +/obj/item/ammo_magazine/box/c9mm // Made by RnD for Prototype SMG and should probably be removed because why does it require DIAMONDS to make bullets? + name = "ammunition Box (9mm)" + icon_state = "9mm" + origin_tech = list(TECH_COMBAT = 2) + matter = list(DEFAULT_WALL_MATERIAL = 1800) + caliber = "9mm" + ammo_type = /obj/item/ammo_casing/a9mm + max_ammo = 30 + +/obj/item/ammo_magazine/box/c9mm/empty + initial_ammo = 0 + +///////// 10mm ///////// + +/obj/item/ammo_magazine/m10mm + name = "magazine (10mm)" + icon_state = "10mm" + origin_tech = list(TECH_COMBAT = 2) + mag_type = MAGAZINE + caliber = "10mm" + matter = list(DEFAULT_WALL_MATERIAL = 1500) + ammo_type = /obj/item/ammo_casing/a10mm + max_ammo = 20 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m10mm/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/clip/c10mm + name = "ammo clip (10mm)" + icon_state = "clip_pistol" + desc = "A stripper clip for reloading 5mm rounds into magazines." + caliber = "10mm" + ammo_type = /obj/item/ammo_casing/a10mm + matter = list(DEFAULT_WALL_MATERIAL = 675) // metal costs are very roughly based around one 10mm casing = 75 metal + max_ammo = 9 + multiple_sprites = 1 + +/obj/item/ammo_magazine/box/emp/b10 + name = "ammunition box (10mm haywire)" + ammo_type = /obj/item/ammo_casing/a10mm/emp + +///////// 5.56mm ///////// + +/obj/item/ammo_magazine/m556 + name = "magazine (5.56mm)" + icon_state = "m556" + origin_tech = list(TECH_COMBAT = 2) + mag_type = MAGAZINE + caliber = "5.56mm" + matter = list(DEFAULT_WALL_MATERIAL = 1800) + ammo_type = /obj/item/ammo_casing/a556 + max_ammo = 20 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m556/ext + name = "extended magazine (5.56mm)" + matter = list(DEFAULT_WALL_MATERIAL = 2700) + max_ammo = 30 + +/obj/item/ammo_magazine/m556/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m556/ext/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m556/practice + name = "magazine (5.56mm practice)" + ammo_type = /obj/item/ammo_casing/a556p + +/obj/item/ammo_magazine/m556/practice/ext + name = "extended magazine (5.56mm practice)" + max_ammo = 30 + +/obj/item/ammo_magazine/m556/ap + name = "magazine (5.56mm armor-piercing)" + ammo_type = /obj/item/ammo_casing/a556/ap + +/obj/item/ammo_magazine/m556/ap/ext + name = "extended magazine (5.56mm armor-piercing)" + max_ammo = 30 + +/obj/item/ammo_magazine/m556/small + name = "reduced magazine (5.56mm)" + icon_state = "m556-small" + matter = list(DEFAULT_WALL_MATERIAL = 900) + max_ammo = 10 + +/obj/item/ammo_magazine/m556/small/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m556/small/practice + name = "magazine (5.56mm practice)" + ammo_type = /obj/item/ammo_casing/a556p + +/obj/item/ammo_magazine/m556/small/ap + name = "magazine (5.56mm armor-piercing)" + ammo_type = /obj/item/ammo_casing/a556/ap + +/obj/item/ammo_magazine/clip/c556 + name = "ammo clip (5.56mm)" + icon_state = "clip_rifle" + caliber = "5.56mm" + ammo_type = /obj/item/ammo_casing/a556 + matter = list(DEFAULT_WALL_MATERIAL = 450) // metal costs are very roughly based around one 10mm casing = 180 metal + max_ammo = 5 + multiple_sprites = 1 + +/obj/item/ammo_magazine/clip/c556/ap + name = "rifle clip (5.56mm armor-piercing)" + ammo_type = /obj/item/ammo_casing/a556/ap + +/obj/item/ammo_magazine/clip/c556/practice + name = "rifle clip (5.56mm practice)" + ammo_type = /obj/item/ammo_casing/a556 + +/obj/item/ammo_magazine/m556saw + name = "magazine box (5.56mm)" + icon_state = "a556" + origin_tech = list(TECH_COMBAT = 2) + mag_type = MAGAZINE + caliber = "5.56mm" + matter = list(DEFAULT_WALL_MATERIAL = 10000) + ammo_type = /obj/item/ammo_casing/a556 + w_class = ITEMSIZE_NORMAL // This should NOT fit in your pocket!! + max_ammo = 50 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m556saw/ap + name = "magazine box (5.56mm armor-piercing)" + ammo_type = /obj/item/ammo_casing/a556/ap + +/obj/item/ammo_magazine/m556saw/empty + initial_ammo = 0 + +///////// .50 AE ///////// + +/obj/item/ammo_magazine/m50 + name = "magazine (.50 AE)" + icon_state = "50ae" + origin_tech = list(TECH_COMBAT = 2) + mag_type = MAGAZINE + caliber = ".50AE" + matter = list(DEFAULT_WALL_MATERIAL = 1260) + ammo_type = /obj/item/ammo_casing/a50ae + max_ammo = 7 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m50/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/clip/c50 + name = "ammo clip (.50 AE)" + icon_state = "clip_pistol" + desc = "A stripper clip for reloading .50 Action Express rounds into magazines." + caliber = ".50AE" + ammo_type = /obj/item/ammo_casing/a50ae + matter = list(DEFAULT_WALL_MATERIAL = 1620) // metal costs are very roughly based around one .50 casing = 180 metal + max_ammo = 9 + multiple_sprites = 1 + +///////// 7.62mm ///////// + +/obj/item/ammo_magazine/m762 + name = "magazine (7.62mm)" + icon_state = "m762-small" + mag_type = MAGAZINE + caliber = "7.62mm" + matter = list(DEFAULT_WALL_MATERIAL = 2000) + ammo_type = /obj/item/ammo_casing/a762 + max_ammo = 10 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m762/ap + name = "magazine (7.62mm armor-piercing)" + ammo_type = /obj/item/ammo_casing/a762/ap + +/obj/item/ammo_magazine/m762/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/m762m // Intentionally not a subtype of m762 because it's supposed to be incompatible with the Z8 Bulldog rifle. + name = "magazine (7.62mm)" + icon_state = "m762" + mag_type = MAGAZINE + caliber = "7.62mm" + matter = list(DEFAULT_WALL_MATERIAL = 4000) + ammo_type = /obj/item/ammo_casing/a762 + max_ammo = 20 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m762m/ap + name = "magazine (7.62mm armor-piercing)" + ammo_type = /obj/item/ammo_casing/a762/ap + +/obj/item/ammo_magazine/m762m/empty + initial_ammo = 0 + +/obj/item/ammo_magazine/clip/c762 + name = "ammo clip (7.62mm)" + icon_state = "clip_rifle" + caliber = "7.62mm" + ammo_type = /obj/item/ammo_casing/a762 + matter = list(DEFAULT_WALL_MATERIAL = 1000) // metal costs are very roughly based around one 7.62 casing = 200 metal + max_ammo = 5 + multiple_sprites = 1 + +/obj/item/ammo_magazine/clip/c762/ap + name = "rifle clip (7.62mm armor-piercing)" + ammo_type = /obj/item/ammo_casing/a762/ap + +/obj/item/ammo_magazine/clip/c762/practice + name = "rifle clip (7.62mm practice)" + ammo_type = /obj/item/ammo_casing/a762p + +///////// 12g ///////// + +/obj/item/ammo_magazine/m12gdrum + name = "magazine (12 gauge)" + icon_state = "12g" + mag_type = MAGAZINE + caliber = "12g" + matter = list(DEFAULT_WALL_MATERIAL = 2200) + ammo_type = /obj/item/ammo_casing/a12g + max_ammo = 24 + multiple_sprites = 1 + +/obj/item/ammo_magazine/m12gdrum/beanbag + name = "magazine (12 gauge beanbag)" + ammo_type = /obj/item/ammo_casing/a12g/beanbag + +/obj/item/ammo_magazine/m12gdrum/pellet + name = "magazine (12 gauge pellet)" + ammo_type = /obj/item/ammo_casing/a12g/pellet + +/obj/item/ammo_magazine/m12gdrum/flash + name = "magazine (12 gauge flash)" + ammo_type = /obj/item/ammo_casing/a12g/flash + +/obj/item/ammo_magazine/m12gdrum/empty + initial_ammo = 0 + +///////// .75 Gyrojet ///////// + +/obj/item/ammo_magazine/m75 + name = "ammo magazine (.75 Gyrojet)" + icon_state = "75" + mag_type = MAGAZINE + caliber = ".75" + ammo_type = /obj/item/ammo_casing/a75 + multiple_sprites = 1 + max_ammo = 4 + +/obj/item/ammo_magazine/m75/empty + initial_ammo = 0 + +///////// Misc. ///////// + +/obj/item/ammo_magazine/caps + name = "speedloader (caps)" + icon_state = "T38" + caliber = "caps" + color = "#FF0000" + ammo_type = /obj/item/ammo_casing/cap + matter = list(DEFAULT_WALL_MATERIAL = 600) + max_ammo = 7 multiple_sprites = 1 \ No newline at end of file diff --git a/code/modules/projectiles/ammunition/bullets.dm b/code/modules/projectiles/ammunition/rounds.dm similarity index 76% rename from code/modules/projectiles/ammunition/bullets.dm rename to code/modules/projectiles/ammunition/rounds.dm index dfbd721952..3230e6ed62 100644 --- a/code/modules/projectiles/ammunition/bullets.dm +++ b/code/modules/projectiles/ammunition/rounds.dm @@ -1,291 +1,323 @@ -/obj/item/ammo_casing/a357 - desc = "A .357 bullet casing." - caliber = "357" - projectile_type = /obj/item/projectile/bullet/pistol/strong - -/obj/item/ammo_casing/a50 - desc = "A .50AE bullet casing." - caliber = ".50" - projectile_type = /obj/item/projectile/bullet/pistol/strong - -/obj/item/ammo_casing/a75 - desc = "A .75 gyrojet rocket sheathe." - caliber = "75" - projectile_type = /obj/item/projectile/bullet/gyro - -/obj/item/ammo_casing/c38 - desc = "A .38 bullet casing." - caliber = "38" - projectile_type = /obj/item/projectile/bullet/pistol - -/obj/item/ammo_casing/c38r - desc = "A .38 rubber bullet casing." - caliber = "38" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/bullet/pistol/rubber - -/obj/item/ammo_casing/c38/emp - name = ".38 haywire round" - desc = "A .38 bullet casing fitted with a single-use ion pulse generator." - icon_state = "empcasing" - projectile_type = /obj/item/projectile/ion/small - matter = list(DEFAULT_WALL_MATERIAL = 130, "uranium" = 100) - -/* - * 9mm - */ - -/obj/item/ammo_casing/c9mm - desc = "A 9mm bullet casing." - caliber = "9mm" - projectile_type = /obj/item/projectile/bullet/pistol - -/obj/item/ammo_casing/c9mm/ap - desc = "A 9mm armor-piercing bullet casing." - projectile_type = /obj/item/projectile/bullet/pistol/ap - -/obj/item/ammo_casing/c9mmf - desc = "A 9mm flash shell casing." - caliber = "9mm" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/energy/flash - -/obj/item/ammo_casing/c9mmr - desc = "A 9mm rubber bullet casing." - caliber = "9mm" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/bullet/pistol/rubber - -/obj/item/ammo_casing/c9mmp - desc = "A 9mm practice bullet casing." - caliber = "9mm" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/bullet/pistol/practice - -/* -/obj/item/ammo_casing/c5mm - desc = "A 5mm bullet casing." - caliber = "5mm" - projectile_type = /obj/item/projectile/bullet/pistol/ap -*/ - -/* - * 45 ammo - */ - -/obj/item/ammo_casing/c45 - desc = "A .45 bullet casing." - caliber = ".45" - projectile_type = /obj/item/projectile/bullet/pistol/medium - -/obj/item/ammo_casing/c45ap - desc = "A .45 Armor-Piercing bullet casing." - caliber = ".45" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/bullet/pistol/medium/ap - -/obj/item/ammo_casing/c45p - desc = "A .45 practice bullet casing." - caliber = ".45" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/bullet/pistol/practice - -/obj/item/ammo_casing/c45r - desc = "A .45 rubber bullet casing." - caliber = ".45" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/bullet/pistol/rubber - -/obj/item/ammo_casing/c45f - desc = "A .45 flash shell casing." - caliber = ".45" - icon_state = "r-casing" - projectile_type = /obj/item/projectile/energy/flash - -/obj/item/ammo_casing/c45/emp - name = ".45 haywire round" - desc = "A .45 bullet casing fitted with a single-use ion pulse generator." - projectile_type = /obj/item/projectile/ion/small - icon_state = "empcasing" - matter = list(DEFAULT_WALL_MATERIAL = 130, "uranium" = 100) - -/obj/item/ammo_casing/c45/hp - desc = "A .45 hollow-point bullet casing." - projectile_type = /obj/item/projectile/bullet/pistol/medium/hollow - - -/* - * 10mm - */ - -/obj/item/ammo_casing/a10mm - desc = "A 10mm bullet casing." - caliber = "10mm" - projectile_type = /obj/item/projectile/bullet/pistol/medium - -/obj/item/ammo_casing/a10mm/emp - name = "10mm haywire round" - desc = "A 10mm bullet casing fitted with a single-use ion pulse generator." - projectile_type = /obj/item/projectile/ion/small - icon_state = "empcasing" - matter = list(DEFAULT_WALL_MATERIAL = 130, "uranium" = 100) - -/* - * Shotguns - */ - -/obj/item/ammo_casing/shotgun - name = "shotgun slug" - desc = "A 12 gauge slug." - icon_state = "slshell" - caliber = "shotgun" - projectile_type = /obj/item/projectile/bullet/shotgun - matter = list(DEFAULT_WALL_MATERIAL = 360) - -/obj/item/ammo_casing/shotgun/pellet - name = "shotgun shell" - desc = "A 12 gauge shell." - icon_state = "gshell" - projectile_type = /obj/item/projectile/bullet/pellet/shotgun - matter = list(DEFAULT_WALL_MATERIAL = 360) - -/obj/item/ammo_casing/shotgun/blank - name = "shotgun shell" - desc = "A blank shell." - icon_state = "blshell" - projectile_type = /obj/item/projectile/bullet/blank - matter = list(DEFAULT_WALL_MATERIAL = 90) - -/obj/item/ammo_casing/shotgun/practice - name = "shotgun shell" - desc = "A practice shell." - icon_state = "pshell" - projectile_type = /obj/item/projectile/bullet/shotgun/practice - matter = list("metal" = 90) - -/obj/item/ammo_casing/shotgun/beanbag - name = "beanbag shell" - desc = "A beanbag shell." - icon_state = "bshell" - projectile_type = /obj/item/projectile/bullet/shotgun/beanbag - matter = list(DEFAULT_WALL_MATERIAL = 180) - -//Can stun in one hit if aimed at the head, but -//is blocked by clothing that stops tasers and is vulnerable to EMP -/obj/item/ammo_casing/shotgun/stunshell - name = "stun shell" - desc = "A 12 gauge taser cartridge." - icon_state = "stunshell" - projectile_type = /obj/item/projectile/energy/electrode/stunshot - matter = list(DEFAULT_WALL_MATERIAL = 360, "glass" = 720) - -/obj/item/ammo_casing/shotgun/stunshell/emp_act(severity) - if(prob(100/severity)) BB = null - update_icon() - -//Does not stun, only blinds, but has area of effect. -/obj/item/ammo_casing/shotgun/flash - name = "flash shell" - desc = "A chemical shell used to signal distress or provide illumination." - icon_state = "fshell" - projectile_type = /obj/item/projectile/energy/flash/flare - matter = list(DEFAULT_WALL_MATERIAL = 90, "glass" = 90) - -/obj/item/ammo_casing/shotgun/emp - name = "ion shell" - desc = "An advanced shotgun round that creates a small EMP when it strikes a target." - icon_state = "empshell" - projectile_type = /obj/item/projectile/ion -// projectile_type = /obj/item/projectile/bullet/shotgun/ion - matter = list(DEFAULT_WALL_MATERIAL = 360, "uranium" = 240) - -/* - * 762mm - */ - -/obj/item/ammo_casing/a762 - desc = "A 7.62mm bullet casing." - caliber = "a762" - icon_state = "rifle-casing" - projectile_type = /obj/item/projectile/bullet/rifle/a762 - -/obj/item/ammo_casing/a762/ap - desc = "A 7.62mm armor-piercing bullet casing." - projectile_type = /obj/item/projectile/bullet/rifle/a762/ap - -/obj/item/ammo_casing/a762p - desc = "A 7.62mm practice bullet casing." - caliber = "a762" - icon_state = "rifle-casing" // Need to make an icon for these - projectile_type = /obj/item/projectile/bullet/rifle/practice - -/obj/item/ammo_casing/a762/blank - desc = "A blank 7.62mm bullet casing." - projectile_type = /obj/item/projectile/bullet/blank - matter = list(DEFAULT_WALL_MATERIAL = 90) - -/obj/item/ammo_casing/a762/hp - desc = "A 7.62mm hollow-point bullet casing." - projectile_type = /obj/item/projectile/bullet/rifle/a762/hollow - -//145mm - -/obj/item/ammo_casing/a145 - desc = "A 14.5mm shell." - icon_state = "lcasing" - caliber = "14.5mm" - projectile_type = /obj/item/projectile/bullet/rifle/a145 - matter = list(DEFAULT_WALL_MATERIAL = 1250) - -/* - * 556mm - */ - -/obj/item/ammo_casing/a556 - desc = "A 5.56mm bullet casing." - caliber = "a556" - icon_state = "rifle-casing" - projectile_type = /obj/item/projectile/bullet/rifle/a556 - -/obj/item/ammo_casing/a556/ap - desc = "A 5.56mm armor-piercing bullet casing." - projectile_type = /obj/item/projectile/bullet/rifle/a556/ap - -/obj/item/ammo_casing/a556p - desc = "A 5.56mm practice bullet casing." - caliber = "a556" - icon_state = "rifle-casing" // Need to make an icon for these - projectile_type = /obj/item/projectile/bullet/rifle/practice - -/obj/item/ammo_casing/a556/blank - desc = "A blank 5.56mm bullet casing." - projectile_type = /obj/item/projectile/bullet/blank - matter = list(DEFAULT_WALL_MATERIAL = 90) - -/obj/item/ammo_casing/a556/hp - desc = "A 5.56mm hollow-point bullet casing." - projectile_type = /obj/item/projectile/bullet/rifle/a556/hollow - -/* - * Misc - */ - -/obj/item/ammo_casing/rocket - name = "rocket shell" - desc = "A high explosive designed to be fired from a launcher." - icon_state = "rocketshell" - projectile_type = /obj/item/missile - caliber = "rocket" - -/obj/item/ammo_casing/cap - name = "cap" - desc = "A cap for children toys." - caliber = "caps" - icon_state = "r-casing" - color = "#FF0000" - projectile_type = /obj/item/projectile/bullet/pistol/cap - -/obj/item/ammo_casing/spent // For simple hostile mobs only, so they don't cough up usable bullets when firing. This is for literally nothing else. - icon_state = "s-casing-spent" - BB = null +/************************************************************************/ +/* +# An explaination of the naming format for guns and ammo: +# +# a = Ammo, as in individual rounds of ammunition. +# b = Box, intended to have ammo taken out one at a time by hand. +# c = Clips, intended to reload magazines or guns quickly. +# m = Magazine, intended to hold rounds of ammo. +# s = Speedloaders, intended to reload guns quickly. +# +# Use this format, followed by the caliber. For example, a shotgun's caliber +# variable is "12g" as a result. Ergo, a shotgun round's path would have "a12g", +# or a magazine with shotgun shells would be "m12g" instead. To avoid confusion +# for developers and in-game admins spawning these items, stick to this format. +# Likewise, when creating new rounds, the caliber variable should match whatever +# the name says. +# +# This comment is copied in magazines.dm as well. +*/ +/************************************************************************/ + +/* + * .357 + */ + +/obj/item/ammo_casing/a357 + desc = "A .357 bullet casing." + caliber = "357" + projectile_type = /obj/item/projectile/bullet/pistol/strong + +/* + * .38 + */ + +/obj/item/ammo_casing/a38 + desc = "A .38 bullet casing." + caliber = ".38" + projectile_type = /obj/item/projectile/bullet/pistol + +/obj/item/ammo_casing/a38r + desc = "A .38 rubber bullet casing." + caliber = ".38" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/bullet/pistol/rubber + +/obj/item/ammo_casing/a38/emp + name = ".38 haywire round" + desc = "A .38 bullet casing fitted with a single-use ion pulse generator." + icon_state = "empcasing" + projectile_type = /obj/item/projectile/ion/small + matter = list(DEFAULT_WALL_MATERIAL = 130, "uranium" = 100) + +/* + * .50 Action Express + */ + +/obj/item/ammo_casing/a50ae + desc = "A .50AE bullet casing." + caliber = ".50AE" + projectile_type = /obj/item/projectile/bullet/pistol/strong + +/* + * .75 (aka Gyrojet Rockets, aka admin abuse) + */ + +/obj/item/ammo_casing/a75 + desc = "A .75 gyrojet rocket sheathe." + caliber = ".75" + projectile_type = /obj/item/projectile/bullet/gyro + +/* + * 9mm + */ + +/obj/item/ammo_casing/a9mm + desc = "A 9mm bullet casing." + caliber = "9mm" + projectile_type = /obj/item/projectile/bullet/pistol + +/obj/item/ammo_casing/a9mm/ap + desc = "A 9mm armor-piercing bullet casing." + projectile_type = /obj/item/projectile/bullet/pistol/ap + +/obj/item/ammo_casing/a9mmf + desc = "A 9mm flash shell casing." + caliber = "9mm" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/energy/flash + +/obj/item/ammo_casing/a9mmr + desc = "A 9mm rubber bullet casing." + caliber = "9mm" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/bullet/pistol/rubber + +/obj/item/ammo_casing/a9mmp + desc = "A 9mm practice bullet casing." + caliber = "9mm" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/bullet/pistol/practice + +/* + * .45 + */ + +/obj/item/ammo_casing/a45 + desc = "A .45 bullet casing." + caliber = ".45" + projectile_type = /obj/item/projectile/bullet/pistol/medium + +/obj/item/ammo_casing/a45ap + desc = "A .45 Armor-Piercing bullet casing." + caliber = ".45" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/bullet/pistol/medium/ap + +/obj/item/ammo_casing/a45p + desc = "A .45 practice bullet casing." + caliber = ".45" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/bullet/pistol/practice + +/obj/item/ammo_casing/a45r + desc = "A .45 rubber bullet casing." + caliber = ".45" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/bullet/pistol/rubber + +/obj/item/ammo_casing/a45f + desc = "A .45 flash shell casing." + caliber = ".45" + icon_state = "r-casing" + projectile_type = /obj/item/projectile/energy/flash + +/obj/item/ammo_casing/a45/emp + name = ".45 haywire round" + desc = "A .45 bullet casing fitted with a single-use ion pulse generator." + projectile_type = /obj/item/projectile/ion/small + icon_state = "empcasing" + matter = list(DEFAULT_WALL_MATERIAL = 130, "uranium" = 100) + +/obj/item/ammo_casing/a45/hp + desc = "A .45 hollow-point bullet casing." + projectile_type = /obj/item/projectile/bullet/pistol/medium/hollow + + +/* + * 10mm + */ + +/obj/item/ammo_casing/a10mm + desc = "A 10mm bullet casing." + caliber = "10mm" + projectile_type = /obj/item/projectile/bullet/pistol/medium + +/obj/item/ammo_casing/a10mm/emp + name = "10mm haywire round" + desc = "A 10mm bullet casing fitted with a single-use ion pulse generator." + projectile_type = /obj/item/projectile/ion/small + icon_state = "empcasing" + matter = list(DEFAULT_WALL_MATERIAL = 130, "uranium" = 100) + +/* + * 12g (aka shotgun ammo) + */ + +/obj/item/ammo_casing/a12g + name = "shotgun slug" + desc = "A 12 gauge slug." + icon_state = "slshell" + caliber = "12g" + projectile_type = /obj/item/projectile/bullet/shotgun + matter = list(DEFAULT_WALL_MATERIAL = 360) + +/obj/item/ammo_casing/a12g/pellet + name = "shotgun shell" + desc = "A 12 gauge shell." + icon_state = "gshell" + projectile_type = /obj/item/projectile/bullet/pellet/shotgun + matter = list(DEFAULT_WALL_MATERIAL = 360) + +/obj/item/ammo_casing/a12g/blank + name = "shotgun shell" + desc = "A blank shell." + icon_state = "blshell" + projectile_type = /obj/item/projectile/bullet/blank + matter = list(DEFAULT_WALL_MATERIAL = 90) + +/obj/item/ammo_casing/a12g/practice + name = "shotgun shell" + desc = "A practice shell." + icon_state = "pshell" + projectile_type = /obj/item/projectile/bullet/shotgun/practice + matter = list("metal" = 90) + +/obj/item/ammo_casing/a12g/beanbag + name = "beanbag shell" + desc = "A beanbag shell." + icon_state = "bshell" + projectile_type = /obj/item/projectile/bullet/shotgun/beanbag + matter = list(DEFAULT_WALL_MATERIAL = 180) + +//Can stun in one hit if aimed at the head, but +//is blocked by clothing that stops tasers and is vulnerable to EMP +/obj/item/ammo_casing/a12g/stunshell + name = "stun shell" + desc = "A 12 gauge taser cartridge." + icon_state = "stunshell" + projectile_type = /obj/item/projectile/energy/electrode/stunshot + matter = list(DEFAULT_WALL_MATERIAL = 360, "glass" = 720) + +/obj/item/ammo_casing/a12g/stunshell/emp_act(severity) + if(prob(100/severity)) BB = null + update_icon() + +//Does not stun, only blinds, but has area of effect. +/obj/item/ammo_casing/a12g/flash + name = "flash shell" + desc = "A chemical shell used to signal distress or provide illumination." + icon_state = "fshell" + projectile_type = /obj/item/projectile/energy/flash/flare + matter = list(DEFAULT_WALL_MATERIAL = 90, "glass" = 90) + +/obj/item/ammo_casing/a12g/emp + name = "ion shell" + desc = "An advanced shotgun round that creates a small EMP when it strikes a target." + icon_state = "empshell" + projectile_type = /obj/item/projectile/ion +// projectile_type = /obj/item/projectile/bullet/shotgun/ion + matter = list(DEFAULT_WALL_MATERIAL = 360, "uranium" = 240) + +/* + * 7.62mm + */ + +/obj/item/ammo_casing/a762 + desc = "A 7.62mm bullet casing." + caliber = "7.62mm" + icon_state = "rifle-casing" + projectile_type = /obj/item/projectile/bullet/rifle/a762 + +/obj/item/ammo_casing/a762/ap + desc = "A 7.62mm armor-piercing bullet casing." + projectile_type = /obj/item/projectile/bullet/rifle/a762/ap + +/obj/item/ammo_casing/a762p + desc = "A 7.62mm practice bullet casing." + caliber = "7.62mm" + icon_state = "rifle-casing" // Need to make an icon for these + projectile_type = /obj/item/projectile/bullet/rifle/practice + +/obj/item/ammo_casing/a762/blank + desc = "A blank 7.62mm bullet casing." + projectile_type = /obj/item/projectile/bullet/blank + matter = list(DEFAULT_WALL_MATERIAL = 90) + +/obj/item/ammo_casing/a762/hp + desc = "A 7.62mm hollow-point bullet casing." + projectile_type = /obj/item/projectile/bullet/rifle/a762/hollow + +/* + * 14.5mm (anti-materiel rifle round) + */ + +/obj/item/ammo_casing/a145 + desc = "A 14.5mm shell." + icon_state = "lcasing" + caliber = "14.5mm" + projectile_type = /obj/item/projectile/bullet/rifle/a145 + matter = list(DEFAULT_WALL_MATERIAL = 1250) + +/* + * 5.56mm + */ + +/obj/item/ammo_casing/a556 + desc = "A 5.56mm bullet casing." + caliber = "5.56mm" + icon_state = "rifle-casing" + projectile_type = /obj/item/projectile/bullet/rifle/a556 + +/obj/item/ammo_casing/a556/ap + desc = "A 5.56mm armor-piercing bullet casing." + projectile_type = /obj/item/projectile/bullet/rifle/a556/ap + +/obj/item/ammo_casing/a556p + desc = "A 5.56mm practice bullet casing." + caliber = "5.56mm" + icon_state = "rifle-casing" // Need to make an icon for these + projectile_type = /obj/item/projectile/bullet/rifle/practice + +/obj/item/ammo_casing/a556/blank + desc = "A blank 5.56mm bullet casing." + projectile_type = /obj/item/projectile/bullet/blank + matter = list(DEFAULT_WALL_MATERIAL = 90) + +/obj/item/ammo_casing/a556/hp + desc = "A 5.56mm hollow-point bullet casing." + projectile_type = /obj/item/projectile/bullet/rifle/a556/hollow + +/* + * Misc + */ + +/obj/item/ammo_casing/rocket + name = "rocket shell" + desc = "A high explosive designed to be fired from a launcher." + icon_state = "rocketshell" + projectile_type = /obj/item/missile + caliber = "rocket" + +/obj/item/ammo_casing/cap + name = "cap" + desc = "A cap for children toys." + caliber = "caps" + icon_state = "r-casing" + color = "#FF0000" + projectile_type = /obj/item/projectile/bullet/pistol/cap + +/obj/item/ammo_casing/spent // For simple hostile mobs only, so they don't cough up usable bullets when firing. This is for literally nothing else. + icon_state = "s-casing-spent" + BB = null projectile_type = null \ No newline at end of file diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 5636b68b94..bddc1fe490 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -45,7 +45,7 @@ /obj/item/weapon/gun/energy/Destroy() if(self_recharge) processing_objects.Remove(src) - ..() + return ..() /obj/item/weapon/gun/energy/process() if(self_recharge) //Every [recharge_time] ticks, recharge a shot for the battery diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index bf30c19991..5abcead8f3 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -8,7 +8,7 @@ caliber = "9mm" origin_tech = list(TECH_COMBAT = 4, TECH_MATERIAL = 2) slot_flags = SLOT_BELT - ammo_type = /obj/item/ammo_casing/c9mm + ammo_type = /obj/item/ammo_casing/a9mm multi_aim = 1 burst_delay = 2 @@ -33,8 +33,8 @@ slot_flags = SLOT_BELT|SLOT_BACK fire_sound = 'sound/weapons/Gunshot_light.ogg' load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/a10mm - allowed_magazines = list(/obj/item/ammo_magazine/a10mm) + magazine_type = /obj/item/ammo_magazine/m10mm + allowed_magazines = list(/obj/item/ammo_magazine/m10mm) auto_eject = 1 auto_eject_sound = 'sound/weapons/smg_empty_alarm.ogg' @@ -56,12 +56,12 @@ item_state = null w_class = ITEMSIZE_LARGE force = 10 - caliber = "a556" + caliber = "5.56mm" origin_tech = list(TECH_COMBAT = 6, TECH_MATERIAL = 1, TECH_ILLEGAL = 4) slot_flags = SLOT_BACK load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/c556 - allowed_magazines = list(/obj/item/ammo_magazine/c556) + magazine_type = /obj/item/ammo_magazine/m556 + allowed_magazines = list(/obj/item/ammo_magazine/m556) one_handed_penalty = 4 @@ -73,8 +73,8 @@ /obj/item/weapon/gun/projectile/automatic/sts35/update_icon(var/ignore_inhands) ..() - if(istype(ammo_magazine,/obj/item/ammo_magazine/s762)) - icon_state = "arifle-small" + if(istype(ammo_magazine,/obj/item/ammo_magazine/m556/small)) + icon_state = "arifle-small" // If using the small magazines, use the small magazine sprite. else icon_state = (ammo_magazine)? "arifle" : "arifle-empty" if(!ignore_inhands) update_held_icon() @@ -88,11 +88,11 @@ caliber = "9mm" origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 2) slot_flags = SLOT_BELT - ammo_type = "/obj/item/ammo_casing/c9mmr" + ammo_type = "/obj/item/ammo_casing/a9mmr" fire_sound = 'sound/weapons/Gunshot_light.ogg' load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/mc9mmt/rubber - allowed_magazines = list(/obj/item/ammo_magazine/mc9mmt) + magazine_type = /obj/item/ammo_magazine/m9mmt/rubber + allowed_magazines = list(/obj/item/ammo_magazine/m9mmt) /obj/item/weapon/gun/projectile/automatic/wt550/update_icon() ..() @@ -109,14 +109,14 @@ item_state = "z8carbine" w_class = ITEMSIZE_LARGE force = 10 - caliber = "a762" + caliber = "7.62mm" origin_tech = list(TECH_COMBAT = 8, TECH_MATERIAL = 3) ammo_type = "/obj/item/ammo_casing/a556" // Is this really needed anymore? fire_sound = 'sound/weapons/Gunshot.ogg' slot_flags = SLOT_BACK load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/c762 - allowed_magazines = list(/obj/item/ammo_magazine/c762) + magazine_type = /obj/item/ammo_magazine/m762 + allowed_magazines = list(/obj/item/ammo_magazine/m762) auto_eject = 1 auto_eject_sound = 'sound/weapons/smg_empty_alarm.ogg' @@ -181,14 +181,14 @@ force = 10 slot_flags = 0 max_shells = 50 - caliber = "a556" + caliber = "5.56mm" origin_tech = list(TECH_COMBAT = 6, TECH_MATERIAL = 1, TECH_ILLEGAL = 2) slot_flags = SLOT_BACK ammo_type = "/obj/item/ammo_casing/a556" // Is this really needed anymore? fire_sound = 'sound/weapons/machinegun.ogg' load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/a556 - allowed_magazines = list(/obj/item/ammo_magazine/a556, /obj/item/ammo_magazine/c556) + magazine_type = /obj/item/ammo_magazine/m556saw + allowed_magazines = list(/obj/item/ammo_magazine/m556saw, /obj/item/ammo_magazine/m556) one_handed_penalty = 6 @@ -225,7 +225,7 @@ return ..() //once open, behave like normal /obj/item/weapon/gun/projectile/automatic/l6_saw/update_icon() - if(istype(ammo_magazine,/obj/item/ammo_magazine/c762)) + if(istype(ammo_magazine,/obj/item/ammo_magazine/m762)) icon_state = "l6[cover_open ? "open" : "closed"]mag" item_state = icon_state else @@ -252,13 +252,13 @@ item_state = null w_class = ITEMSIZE_LARGE force = 10 - caliber = "shotgun" + caliber = "12g" fire_sound = 'sound/weapons/shotgun.ogg' origin_tech = list(TECH_COMBAT = 6, TECH_MATERIAL = 1, TECH_ILLEGAL = 4) slot_flags = SLOT_BACK load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/g12 - allowed_magazines = list(/obj/item/ammo_magazine/g12) + magazine_type = /obj/item/ammo_magazine/m12gdrum + allowed_magazines = list(/obj/item/ammo_magazine/m12gdrum) one_handed_penalty = 4 @@ -284,8 +284,8 @@ load_method = MAGAZINE caliber = ".45" origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 2, TECH_ILLEGAL = 5) - magazine_type = /obj/item/ammo_magazine/c45uzi - allowed_magazines = list(/obj/item/ammo_magazine/c45uzi) + magazine_type = /obj/item/ammo_magazine/m45uzi + allowed_magazines = list(/obj/item/ammo_magazine/m45uzi) firemodes = list( list(mode_name="semiauto", burst=1, fire_delay=0), @@ -310,8 +310,8 @@ slot_flags = SLOT_BELT // ToDo: Belt sprite. fire_sound = 'sound/weapons/Gunshot_light.ogg' load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/p90 - allowed_magazines = list(/obj/item/ammo_magazine/p90, /obj/item/ammo_magazine/mc9mmt) // ToDo: New sprite for the different mag. + magazine_type = /obj/item/ammo_magazine/m9mmp90 + allowed_magazines = list(/obj/item/ammo_magazine/m9mmp90, /obj/item/ammo_magazine/m9mmt) // ToDo: New sprite for the different mag. firemodes = list( list(mode_name="semiauto", burst=1, fire_delay=0), @@ -330,8 +330,8 @@ origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 2, TECH_ILLEGAL = 5) slot_flags = SLOT_BELT // ToDo: Belt sprite. load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/tommymag - allowed_magazines = list(/obj/item/ammo_magazine/tommymag, /obj/item/ammo_magazine/tommydrum) + magazine_type = /obj/item/ammo_magazine/m45tommy + allowed_magazines = list(/obj/item/ammo_magazine/m45tommy, /obj/item/ammo_magazine/m45tommydrum) firemodes = list( list(mode_name="semiauto", burst=1, fire_delay=0), @@ -343,19 +343,19 @@ icon_state = (ammo_magazine)? "tommygun" : "tommygun-empty" // update_held_icon() -/obj/item/weapon/gun/projectile/automatic/carbine +/obj/item/weapon/gun/projectile/automatic/carbine // Admin abuse assault rifle. ToDo: Make this less shit. Maybe remove its autofire, and make it spawn with only 10 rounds at start. name = "assault carbine" desc = "The bullpup configured GP3000 is a lightweight, compact, military-grade assault rifle produced by Gurov Projectile Weapons LLC. It is sold almost exclusively to standing armies. The serial number on this one has been scratched off. Uses 5.56mm rounds." icon_state = "bullpup" item_state = "bullpup" w_class = ITEMSIZE_LARGE force = 10 - caliber = "a762" + caliber = "7.62mm" origin_tech = list(TECH_COMBAT = 6, TECH_MATERIAL = 1, TECH_ILLEGAL = 4) slot_flags = SLOT_BACK load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/c762 - allowed_magazines = list(/obj/item/ammo_magazine/c762) + magazine_type = /obj/item/ammo_magazine/m762m + allowed_magazines = list(/obj/item/ammo_magazine/m762, /obj/item/ammo_magazine/m762m) one_handed_penalty = 4 @@ -366,9 +366,9 @@ /obj/item/weapon/gun/projectile/automatic/carbine/update_icon(var/ignore_inhands) ..() - if(ammo_magazine) - icon_state = "bullpup" + if(istype(ammo_magazine,/obj/item/ammo_magazine/m762)) + icon_state = "bullpup-small" // If using the smaller magazines, use the small mag sprite. else icon_state = "bullpup-empty" item_state = (ammo_magazine)? "bullpup" : "bullpup-empty" - if(!ignore_inhands) update_held_icon() + if(!ignore_inhands) update_held_icon() \ No newline at end of file diff --git a/code/modules/projectiles/guns/projectile/boltaction.dm b/code/modules/projectiles/guns/projectile/boltaction.dm index cbc403c4e0..17e2fe1234 100644 --- a/code/modules/projectiles/guns/projectile/boltaction.dm +++ b/code/modules/projectiles/guns/projectile/boltaction.dm @@ -7,7 +7,7 @@ icon_state = "boltaction" fire_sound = 'sound/weapons/rifleshot.ogg' max_shells = 5 - caliber = "a762" + caliber = "7.62mm" origin_tech = list(TECH_COMBAT = 1)// Old as shit rifle doesn't have very good tech. ammo_type = /obj/item/ammo_casing/a762 load_method = SINGLE_CASING|SPEEDLOADER @@ -60,7 +60,7 @@ icon_state = "leveraction" fire_sound = 'sound/weapons/rifleshot.ogg' max_shells = 5 - caliber = "a762" + caliber = "7.62mm" origin_tech = list(TECH_COMBAT = 1)// Old as shit rifle doesn't have very good tech. ammo_type = /obj/item/ammo_casing/a762 load_method = SINGLE_CASING|SPEEDLOADER diff --git a/code/modules/projectiles/guns/projectile/pistol.dm b/code/modules/projectiles/guns/projectile/pistol.dm index fd46803c68..ba5f4f147d 100644 --- a/code/modules/projectiles/guns/projectile/pistol.dm +++ b/code/modules/projectiles/guns/projectile/pistol.dm @@ -2,8 +2,8 @@ var/unique_reskin name = ".45 pistol" desc = "A cheap Martian knock-off of a Colt M1911. Uses .45 rounds." - magazine_type = /obj/item/ammo_magazine/c45m - allowed_magazines = list(/obj/item/ammo_magazine/c45m) + magazine_type = /obj/item/ammo_magazine/m45 + allowed_magazines = list(/obj/item/ammo_magazine/m45) icon_state = "colt" caliber = ".45" origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2) @@ -12,7 +12,7 @@ /obj/item/weapon/gun/projectile/colt/detective desc = "A Martian recreation of an old Terran pistol. Uses .45 rounds." - magazine_type = /obj/item/ammo_magazine/c45m/rubber + magazine_type = /obj/item/ammo_magazine/m45/rubber /obj/item/weapon/gun/projectile/colt/detective/update_icon() if(ammo_magazine) @@ -71,7 +71,7 @@ name = ".45 pistol" desc = "The NT Mk58 is a cheap, ubiquitous sidearm, produced by a NanoTrasen subsidiary. Found pretty much everywhere humans are. Uses .45 rounds." icon_state = "secguncomp" - magazine_type = /obj/item/ammo_magazine/c45m/rubber + magazine_type = /obj/item/ammo_magazine/m45/rubber caliber = ".45" origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2) fire_sound = 'sound/weapons/semiauto.ogg' @@ -86,7 +86,7 @@ /obj/item/weapon/gun/projectile/sec/flash name = ".45 signal pistol" - magazine_type = /obj/item/ammo_magazine/c45m/flash + magazine_type = /obj/item/ammo_magazine/m45/flash /obj/item/weapon/gun/projectile/sec/wood desc = "The NT Mk58 is a cheap, ubiquitous sidearm, produced by a NanoTrasen subsidiary. This one has a sweet wooden grip. Uses .45 rounds." @@ -111,8 +111,8 @@ recoil = 0 origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2, TECH_ILLEGAL = 8) load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/c45m - allowed_magazines = list(/obj/item/ammo_magazine/c45m) + magazine_type = /obj/item/ammo_magazine/m45 + allowed_magazines = list(/obj/item/ammo_magazine/m45) /obj/item/weapon/gun/projectile/deagle name = "desert eagle" @@ -120,11 +120,11 @@ icon_state = "deagle" item_state = "deagle" force = 14.0 - caliber = ".50" + caliber = ".50AE" load_method = MAGAZINE fire_sound = 'sound/weapons/deagle.ogg' - magazine_type = /obj/item/ammo_magazine/a50 - allowed_magazines = list(/obj/item/ammo_magazine/a50) + magazine_type = /obj/item/ammo_magazine/m50 + allowed_magazines = list(/obj/item/ammo_magazine/m50) /obj/item/weapon/gun/projectile/deagle/update_icon() ..() @@ -168,13 +168,13 @@ desc = "Speak softly, and carry a big gun. Fires rare .75 caliber self-propelled exploding bolts--because fuck you and everything around you." icon_state = "gyropistol" max_shells = 8 - caliber = "75" + caliber = ".75" fire_sound = 'sound/weapons/rpg.ogg' origin_tech = list(TECH_COMBAT = 3) ammo_type = "/obj/item/ammo_casing/a75" load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/a75 - allowed_magazines = list(/obj/item/ammo_magazine/a75) + magazine_type = /obj/item/ammo_magazine/m75 + allowed_magazines = list(/obj/item/ammo_magazine/m75) auto_eject = 1 auto_eject_sound = 'sound/weapons/smg_empty_alarm.ogg' @@ -196,12 +196,12 @@ origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2, TECH_ILLEGAL = 2) fire_sound = 'sound/weapons/semiauto.ogg' load_method = MAGAZINE - magazine_type = /obj/item/ammo_magazine/mc9mm - allowed_magazines = list(/obj/item/ammo_magazine/mc9mm) + magazine_type = /obj/item/ammo_magazine/m9mm + allowed_magazines = list(/obj/item/ammo_magazine/m9mm) /obj/item/weapon/gun/projectile/pistol/flash name = "holdout signal pistol" - magazine_type = /obj/item/ammo_magazine/mc9mm/flash + magazine_type = /obj/item/ammo_magazine/m9mm/flash /obj/item/weapon/gun/projectile/pistol/attack_hand(mob/living/user as mob) if(user.get_inactive_hand() == src) @@ -256,17 +256,17 @@ var/global/list/ammo_types = list( /obj/item/ammo_casing/a357 = ".357", - /obj/item/ammo_casing/c9mmf = "9mm", - /obj/item/ammo_casing/c45f = ".45", + /obj/item/ammo_casing/a9mmf = "9mm", + /obj/item/ammo_casing/a45f = ".45", /obj/item/ammo_casing/a10mm = "10mm", - /obj/item/ammo_casing/shotgun = "12 gauge", - /obj/item/ammo_casing/shotgun = "12 gauge", - /obj/item/ammo_casing/shotgun/pellet = "12 gauge", - /obj/item/ammo_casing/shotgun/pellet = "12 gauge", - /obj/item/ammo_casing/shotgun/pellet = "12 gauge", - /obj/item/ammo_casing/shotgun/beanbag = "12 gauge", - /obj/item/ammo_casing/shotgun/stunshell = "12 gauge", - /obj/item/ammo_casing/shotgun/flash = "12 gauge", + /obj/item/ammo_casing/a12g = "12 gauge", + /obj/item/ammo_casing/a12g = "12 gauge", + /obj/item/ammo_casing/a12g/pellet = "12 gauge", + /obj/item/ammo_casing/a12g/pellet = "12 gauge", + /obj/item/ammo_casing/a12g/pellet = "12 gauge", + /obj/item/ammo_casing/a12g/beanbag = "12 gauge", + /obj/item/ammo_casing/a12g/stunshell = "12 gauge", + /obj/item/ammo_casing/a12g/flash = "12 gauge", /obj/item/ammo_casing/a762 = "7.62mm", /obj/item/ammo_casing/a556 = "5.56mm" ) @@ -299,8 +299,8 @@ caliber = "9mm" load_method = MAGAZINE fire_sound = 'sound/weapons/semiauto.ogg' - magazine_type = /obj/item/ammo_magazine/mc9mm - allowed_magazines = list(/obj/item/ammo_magazine/mc9mm) + magazine_type = /obj/item/ammo_magazine/m9mm + allowed_magazines = list(/obj/item/ammo_magazine/m9mm) /obj/item/weapon/gun/projectile/luger/update_icon() ..() diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index e7d31c0226..3886450fcf 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -43,10 +43,10 @@ name = "revolver" desc = "A cheap Martian knock-off of a Smith & Wesson Model 10. Uses .38-Special rounds." icon_state = "detective" - caliber = "38" + caliber = ".38" origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2) fire_sound = 'sound/weapons/Gunshot_light.ogg' - ammo_type = /obj/item/ammo_casing/c38 + ammo_type = /obj/item/ammo_casing/a38 /obj/item/weapon/gun/projectile/revolver/detective/verb/rename_gun() set name = "Name Gun" @@ -71,13 +71,13 @@ name = "Deckard .38" desc = "A custom-built revolver, based off the semi-popular Detective Special model." icon_state = "deckard-empty" - caliber = "38" + caliber = ".38" origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2) fire_sound = 'sound/weapons/Gunshot_light.ogg' - ammo_type = /obj/item/ammo_casing/c38 + ammo_type = /obj/item/ammo_casing/a38 /obj/item/weapon/gun/projectile/revolver/deckard/emp - ammo_type = /obj/item/ammo_casing/c38/emp + ammo_type = /obj/item/ammo_casing/a38/emp /obj/item/weapon/gun/projectile/revolver/deckard/update_icon() @@ -107,13 +107,13 @@ name = "\"The Judge\"" desc = "A revolving hand-shotgun by Cybersun Industries that packs the power of a 12 guage in the palm of your hand (if you don't break your wrist). Uses 12 shotgun rounds." icon_state = "judge" - caliber = "shotgun" + caliber = "12g" origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2, TECH_ILLEGAL = 4) max_shells = 5 fire_sound = 'sound/weapons/shotgun.ogg' recoil = 2 // ow my fucking hand accuracy = -1 // smooth bore + short barrel = shit accuracy - ammo_type = /obj/item/ammo_casing/shotgun + ammo_type = /obj/item/ammo_casing/a12g // ToDo: Remove accuracy debuf in exchange for slightly injuring your hand every time you fire it. /obj/item/weapon/gun/projectile/revolver/lemat @@ -124,11 +124,11 @@ origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2) handle_casings = CYCLE_CASINGS max_shells = 9 - caliber = "38" - ammo_type = /obj/item/ammo_casing/c38 + caliber = ".38" + ammo_type = /obj/item/ammo_casing/a38 var/secondary_max_shells = 1 - var/secondary_caliber = "shotgun" - var/secondary_ammo_type = /obj/item/ammo_casing/shotgun + var/secondary_caliber = "12g" + var/secondary_ammo_type = /obj/item/ammo_casing/a12g var/flipped_firing = 0 var/list/secondary_loaded = list() var/list/tertiary_loaded = list() diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 84ad0bc426..bc14bb9425 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -8,10 +8,10 @@ force = 10 flags = CONDUCT slot_flags = SLOT_BACK - caliber = "shotgun" + caliber = "12g" origin_tech = list(TECH_COMBAT = 4, TECH_MATERIAL = 2) load_method = SINGLE_CASING - ammo_type = /obj/item/ammo_casing/shotgun/beanbag + ammo_type = /obj/item/ammo_casing/a12g/beanbag handle_casings = HOLD_CASINGS fire_sound = 'sound/weapons/shotgun.ogg' var/recentpump = 0 // to prevent spammage @@ -48,7 +48,7 @@ item_state = "cshotgun" origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 2) max_shells = 7 //match the ammo box capacity, also it can hold a round in the chamber anyways, for a total of 8. - ammo_type = /obj/item/ammo_casing/shotgun + ammo_type = /obj/item/ammo_casing/a12g /obj/item/weapon/gun/projectile/shotgun/doublebarrel name = "double-barreled shotgun" @@ -64,9 +64,9 @@ force = 10 flags = CONDUCT slot_flags = SLOT_BACK - caliber = "shotgun" + caliber = "12g" origin_tech = list(TECH_COMBAT = 3, TECH_MATERIAL = 1) - ammo_type = /obj/item/ammo_casing/shotgun/beanbag + ammo_type = /obj/item/ammo_casing/a12g/beanbag burst_delay = 0 firemodes = list( @@ -75,12 +75,12 @@ ) /obj/item/weapon/gun/projectile/shotgun/doublebarrel/pellet - ammo_type = /obj/item/ammo_casing/shotgun/pellet + ammo_type = /obj/item/ammo_casing/a12g/pellet /obj/item/weapon/gun/projectile/shotgun/doublebarrel/flare name = "signal shotgun" desc = "A double-barreled shotgun meant to fire signal flash shells." - ammo_type = /obj/item/ammo_casing/shotgun/flash + ammo_type = /obj/item/ammo_casing/a12g/flash /obj/item/weapon/gun/projectile/shotgun/doublebarrel/unload_ammo(user, allow_dump) ..(user, allow_dump=1) @@ -115,6 +115,6 @@ icon_state = "sawnshotgun" item_state = "sawnshotgun" slot_flags = SLOT_BELT|SLOT_HOLSTER - ammo_type = /obj/item/ammo_casing/shotgun/pellet + ammo_type = /obj/item/ammo_casing/a12g/pellet w_class = ITEMSIZE_NORMAL force = 5 diff --git a/code/modules/projectiles/guns/projectile/sniper.dm b/code/modules/projectiles/guns/projectile/sniper.dm index be280c2f64..9a16f68a4c 100644 --- a/code/modules/projectiles/guns/projectile/sniper.dm +++ b/code/modules/projectiles/guns/projectile/sniper.dm @@ -80,7 +80,7 @@ slot_flags = SLOT_BACK // Needs a sprite. origin_tech = list(TECH_COMBAT = 8, TECH_MATERIAL = 2, TECH_ILLEGAL = 8) recoil = 2 //extra kickback - caliber = "a762" + caliber = "7.62mm" load_method = MAGAZINE accuracy = -3 //shooting at the hip scoped_accuracy = 0 @@ -88,11 +88,11 @@ one_handed_penalty = 4 // The weapon itself is heavy, and the long barrel makes it hard to hold steady with just one hand. fire_sound = 'sound/weapons/SVD_shot.ogg' magazine_type = /obj/item/ammo_magazine/SVD - allowed_magazines = list(/obj/item/ammo_magazine/SVD, /obj/item/ammo_magazine/c762) + allowed_magazines = list(/obj/item/ammo_magazine/SVD, /obj/item/ammo_magazine/m762) /obj/item/weapon/gun/projectile/SVD/update_icon() ..() -// if(istype(ammo_magazine,/obj/item/ammo_magazine/c762) +// if(istype(ammo_magazine,/obj/item/ammo_magazine/m762) // icon_state = "SVD-bigmag" //No icon for this exists yet. if(ammo_magazine) icon_state = "SVD" diff --git a/code/modules/random_map/drop/drop_types.dm b/code/modules/random_map/drop/drop_types.dm index 43f89b4ec7..8fb02007b4 100644 --- a/code/modules/random_map/drop/drop_types.dm +++ b/code/modules/random_map/drop/drop_types.dm @@ -62,16 +62,16 @@ var/global/list/datum/supply_drop_loot/supply_drop /obj/item/weapon/storage/box/emps, /obj/item/weapon/storage/box/flashbangs, /obj/item/weapon/gun/projectile/automatic/sts35, - /obj/item/ammo_magazine/c762/ap, - /obj/item/ammo_magazine/c762/ap, + /obj/item/ammo_magazine/m762/ap, + /obj/item/ammo_magazine/m762/ap, /obj/item/weapon/gun/projectile/colt, - /obj/item/ammo_magazine/c45m, + /obj/item/ammo_magazine/m45, /obj/item/weapon/material/hatchet/tacknife/combatknife) /datum/supply_drop_loot/heavy_warfare name = "Heavy Warfare" container = /obj/structure/largecrate -/datum/supply_drop_loot/armour/New() +/datum/supply_drop_loot/heavy_warfare/New() ..() contents = list( /obj/item/clothing/head/helmet/combat, @@ -83,8 +83,8 @@ var/global/list/datum/supply_drop_loot/supply_drop /obj/item/clothing/accessory/storage/black_drop_pouches, /obj/item/weapon/storage/backpack/dufflebag/sec, /obj/item/weapon/gun/projectile/automatic/carbine, - /obj/item/ammo_magazine/c762/ap, - /obj/item/ammo_magazine/c762, + /obj/item/ammo_magazine/m762/ap, + /obj/item/ammo_magazine/m762, /obj/item/weapon/shield/energy, /obj/item/weapon/grenade/frag, /obj/item/weapon/grenade/frag, @@ -99,7 +99,7 @@ var/global/list/datum/supply_drop_loot/supply_drop datum/supply_drop_loot/riot name = "Riot Gear" container = /obj/structure/largecrate -/datum/supply_drop_loot/armour/New() +/datum/supply_drop_loot/riot/New() ..() contents = list( /obj/item/clothing/head/helmet/riot, diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 49c1099184..d634711379 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -23,7 +23,7 @@ chemical_reagents_list[D.id] = D /datum/reagents/Destroy() - ..() + . = ..() if(chemistryProcess) chemistryProcess.active_holders -= src @@ -79,12 +79,6 @@ total_volume += R.volume return -/datum/reagents/proc/delete() - for(var/datum/reagent/R in reagent_list) - R.holder = null - if(my_atom) - my_atom.reagents = null - /datum/reagents/proc/handle_reactions() if(chemistryProcess) chemistryProcess.mark_for_update(src) diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index 78b33ef36e..ccf7c62ac1 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -488,7 +488,7 @@ var/amount_to_take = max(0,min(stack.amount,round(remaining_volume/REAGENTS_PER_SHEET))) if(amount_to_take) stack.use(amount_to_take) - if(deleted(stack)) + if(QDELETED(stack)) holdingitems -= stack beaker.reagents.add_reagent(sheet_reagents[stack.type], (amount_to_take*REAGENTS_PER_SHEET)) continue diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index 723db2ace7..f23e37f516 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -118,8 +118,8 @@ return null /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references - ..() holder = null + . = ..() /* DEPRECATED - TODO: REMOVE EVERYWHERE */ diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm index 12540c2d04..b6c45475cc 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm @@ -205,7 +205,7 @@ if(holder && holder.my_atom && ismob(holder.my_atom)) var/mob/M = holder.my_atom M.status_flags &= ~FAKEDEATH - ..() + return ..() /datum/reagent/toxin/fertilizer //Reagents used for plant fertilizers. name = "fertilizer" diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 16a1cb3b26..d585effc91 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -35,7 +35,7 @@ /obj/item/weapon/reagent_containers/borghypo/Destroy() processing_objects.Remove(src) - ..() + return ..() /obj/item/weapon/reagent_containers/borghypo/process() //Every [recharge_time] seconds, recharge some reagents for the cyborg+ if(++charge_tick < recharge_time) diff --git a/code/modules/reagents/reagent_containers/food/lunch.dm b/code/modules/reagents/reagent_containers/food/lunch.dm index 1c82f6cded..9d97f528e3 100644 --- a/code/modules/reagents/reagent_containers/food/lunch.dm +++ b/code/modules/reagents/reagent_containers/food/lunch.dm @@ -58,7 +58,7 @@ var/list/lunchables_drink_reagents_ = list(/datum/reagent/drink/nothing, /datum/reagent/drink/dry_ramen, /datum/reagent/drink/hell_ramen, /datum/reagent/drink/hot_ramen, - /datum/reagent/drink/nuka_cola,) + /datum/reagent/drink/nuka_cola) // This default list is a bit different, it contains items we don't want var/list/lunchables_ethanol_reagents_ = list(/datum/reagent/ethanol/acid_spit, diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 3191442be8..ef07b03c4f 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -210,8 +210,8 @@ /obj/item/weapon/reagent_containers/food/snacks/Destroy() if(contents) for(var/atom/movable/something in contents) - something.loc = get_turf(src) - ..() + something.dropInto(loc) + . = ..() //////////////////////////////////////////////////////////////////////////////// /// FOOD END diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index 427d08d141..1c3151fee9 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -28,12 +28,6 @@ update_icon() return -/obj/item/weapon/reagent_containers/hypospray/do_surgery(mob/living/carbon/M, mob/living/user) - if(user.a_intent != I_HELP) //in case it is ever used as a surgery tool - return ..() - attack(M, user) - return 1 - /obj/item/weapon/reagent_containers/hypospray/attack(mob/living/M as mob, mob/user as mob) if(!reagents.total_volume) user << "[src] is empty." diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 464e066264..e21baa48e2 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -19,13 +19,6 @@ if(!icon_state) icon_state = "pill[rand(1, 20)]" - -/obj/item/weapon/reagent_containers/pill/do_surgery(mob/M, mob/user) - if(user.a_intent != I_HELP) //in case it is ever used as a surgery tool - return ..() - attack(M, user) //default surgery behaviour is just to scan as usual - return 1 - /obj/item/weapon/reagent_containers/pill/attack(mob/M as mob, mob/user as mob) if(M == user) if(istype(M, /mob/living/carbon/human)) diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 058e09c6f7..dfe5dd0349 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -53,13 +53,6 @@ /obj/item/weapon/reagent_containers/syringe/attackby(obj/item/I as obj, mob/user as mob) return -/obj/item/weapon/reagent_containers/syringe/do_surgery(mob/living/carbon/M, mob/living/user) - if(user.a_intent == I_HURT) - return 0 - if(user.a_intent != I_HELP) //in case it is ever used as a surgery tool - return ..() - return 1 - /obj/item/weapon/reagent_containers/syringe/afterattack(obj/target, mob/user, proximity) if(!proximity || !target.reagents) return diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 49d251d311..e84a963446 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -227,7 +227,7 @@ src.add_fingerprint(user) if(bottle) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - if(do_after(user, 20)) + if(do_after(user, 20) && bottle) user << "You unfasten the jug." var/obj/item/weapon/reagent_containers/glass/cooler_bottle/G = new /obj/item/weapon/reagent_containers/glass/cooler_bottle( src.loc ) for(var/datum/reagent/R in reagents.reagent_list) @@ -262,7 +262,7 @@ if(!bottle && !cupholder) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You start taking the water-cooler apart." - if(do_after(user, 20)) + if(do_after(user, 20) && !bottle && !cupholder) user << "You take the water-cooler apart." new /obj/item/stack/material/plastic( src.loc, 4 ) qdel(src) @@ -274,7 +274,7 @@ if(anchored) var/obj/item/weapon/reagent_containers/glass/cooler_bottle/G = I user << "You start to screw the bottle onto the water-cooler." - if(do_after(user, 20)) + if(do_after(user, 20) && !bottle && anchored) bottle = 1 update_icon() user << "You screw the bottle onto the water-cooler!" @@ -286,7 +286,7 @@ user << "You need to wrench down the cooler first." else user << "There is already a bottle there!" - return + return 1 if(istype(I, /obj/item/stack/material/plastic)) if(!cupholder) @@ -295,7 +295,7 @@ src.add_fingerprint(user) user << "You start to attach a cup dispenser onto the water-cooler." playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) - if(do_after(user, 20)) + if(do_after(user, 20) && !cupholder && anchored) if (P.use(1)) user << "You attach a cup dispenser onto the water-cooler." cupholder = 1 diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index be3cfa72a8..2e29fdcad3 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -18,11 +18,7 @@ unwrap() proc/unwrap() - if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - wrapped.loc = (get_turf(src.loc)) - if(istype(wrapped, /obj/structure/closet)) - var/obj/structure/closet/O = wrapped - O.welded = 0 + // Destroy will drop our wrapped object on the turf, so let it. qdel(src) attackby(obj/item/W as obj, mob/user as mob) @@ -312,14 +308,15 @@ /obj/structure/bigDelivery/Destroy() if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0 - wrapped.loc = (get_turf(loc)) + wrapped.forceMove(get_turf(src)) if(istype(wrapped, /obj/structure/closet)) var/obj/structure/closet/O = wrapped O.welded = 0 + wrapped = null var/turf/T = get_turf(src) for(var/atom/movable/AM in contents) - AM.loc = T - ..() + AM.forceMove(T) + return ..() /obj/item/device/destTagger name = "destination tagger" diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 49678c966c..6f1add522a 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -545,7 +545,7 @@ other types of metals and chemistry for reagents). id = "ammo_9mm" req_tech = list(TECH_COMBAT = 4, TECH_MATERIAL = 3) materials = list(DEFAULT_WALL_MATERIAL = 3750, "silver" = 100) - build_path = /obj/item/ammo_magazine/c9mm + build_path = /obj/item/ammo_magazine/box/c9mm sort_string = "TAACA" /datum/design/item/weapon/stunshell @@ -553,7 +553,7 @@ other types of metals and chemistry for reagents). id = "stunshell" req_tech = list(TECH_COMBAT = 3, TECH_MATERIAL = 3) materials = list(DEFAULT_WALL_MATERIAL = 4000) - build_path = /obj/item/ammo_casing/shotgun/stunshell + build_path = /obj/item/ammo_casing/a12g/stunshell sort_string = "TAACB" /datum/design/item/weapon/chemsprayer diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm index 4872131429..d7ce2063b2 100644 --- a/code/modules/shieldgen/emergency_shield.dm +++ b/code/modules/shieldgen/emergency_shield.dm @@ -55,7 +55,7 @@ check_failure() set_opacity(1) - spawn(20) if(!deleted(src)) set_opacity(0) + spawn(20) if(!QDELETED(src)) set_opacity(0) ..() @@ -64,7 +64,7 @@ ..() check_failure() set_opacity(1) - spawn(20) if(!deleted(src)) set_opacity(0) + spawn(20) if(!QDELETED(src)) set_opacity(0) /obj/machinery/shield/ex_act(severity) switch(severity) @@ -114,7 +114,7 @@ //The shield becomes dense to absorb the blow.. purely asthetic. set_opacity(1) - spawn(20) if(!deleted(src)) set_opacity(0) + spawn(20) if(!QDELETED(src)) set_opacity(0) ..() return diff --git a/code/modules/shieldgen/energy_field.dm b/code/modules/shieldgen/energy_field.dm index 59f2f02ab6..5dc6af651d 100644 --- a/code/modules/shieldgen/energy_field.dm +++ b/code/modules/shieldgen/energy_field.dm @@ -32,13 +32,12 @@ my_gen.field.Remove(src) my_gen = null var/turf/current_loc = get_turf(src) - spawn(1) // Updates neightbors after we're gone. - for(var/direction in cardinal) - var/turf/T = get_step(current_loc, direction) - if(T) - for(var/obj/effect/energy_field/F in T) - F.update_icon() - ..() + . = ..() + for(var/direction in cardinal) + var/turf/T = get_step(current_loc, direction) + if(T) + for(var/obj/effect/energy_field/F in T) + F.update_icon() /obj/effect/energy_field/ex_act(var/severity) adjust_strength(-(4 - severity) * 4) diff --git a/code/modules/shieldgen/shield_gen.dm b/code/modules/shieldgen/shield_gen.dm index 1b50407be5..4592140d0d 100644 --- a/code/modules/shieldgen/shield_gen.dm +++ b/code/modules/shieldgen/shield_gen.dm @@ -38,10 +38,8 @@ ..() /obj/machinery/shield_gen/Destroy() - for(var/obj/effect/energy_field/D in field) - field.Remove(D) - D.loc = null - ..() + qdel_null_list(field) + return ..() /obj/machinery/shield_gen/emag_act(var/remaining_charges, var/mob/user) if(prob(75)) diff --git a/code/modules/shuttles/_defines.dm b/code/modules/shuttles/_defines.dm new file mode 100644 index 0000000000..ad8c39466b --- /dev/null +++ b/code/modules/shuttles/_defines.dm @@ -0,0 +1,4 @@ +#define SHUTTLE_FLAGS_NONE 0 +#define SHUTTLE_FLAGS_PROCESS 1 +#define SHUTTLE_FLAGS_SUPPLY 2 +#define SHUTTLE_FLAGS_ALL (~SHUTTLE_FLAGS_NONE) \ No newline at end of file diff --git a/code/modules/shuttles/escape_pods.dm b/code/modules/shuttles/escape_pods.dm index fd6aabc4a2..b832e94dbd 100644 --- a/code/modules/shuttles/escape_pods.dm +++ b/code/modules/shuttles/escape_pods.dm @@ -1,16 +1,24 @@ /datum/shuttle/ferry/escape_pod var/datum/computer/file/embedded_program/docking/simple/escape_pod/arming_controller + category = /datum/shuttle/ferry/escape_pod + +/datum/shuttle/ferry/escape_pod/New() + move_time = move_time + rand(-30, 60) + if(name in emergency_shuttle.escape_pods) + CRASH("An escape pod with the name '[name]' has already been defined.") + emergency_shuttle.escape_pods[name] = src + ..() /datum/shuttle/ferry/escape_pod/init_docking_controllers() ..() arming_controller = locate(dock_target_station) if(!istype(arming_controller)) - world << "warning: escape pod with station dock tag [dock_target_station] could not find it's dock target!" - + warning("warning: escape pod with station dock tag [dock_target_station] could not find it's dock target!") + if(docking_controller) var/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/controller_master = docking_controller.master if(!istype(controller_master)) - world << "warning: escape pod with docking tag [docking_controller_tag] could not find it's controller master!" + warning("warning: escape pod with docking tag [docking_controller_tag] could not find it's controller master!") else controller_master.pod = src @@ -29,7 +37,7 @@ /datum/shuttle/ferry/escape_pod/can_cancel() return 0 - + //This controller goes on the escape pod itself /obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod name = "escape pod controller" @@ -58,7 +66,7 @@ /obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/Topic(href, href_list) if(..()) return 1 - + if("manual_arm") pod.arming_controller.arm() if("force_launch") @@ -87,7 +95,7 @@ if (istype(docking_program, /datum/computer/file/embedded_program/docking/simple/escape_pod)) var/datum/computer/file/embedded_program/docking/simple/escape_pod/P = docking_program armed = P.armed - + data = list( "docking_status" = docking_program.get_docking_status(), "override_enabled" = docking_program.override_enabled, diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 8c6e611886..f7f655ba4d 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -4,6 +4,7 @@ //shuttle moving state defines are in setup.dm /datum/shuttle + var/name = "" var/warmup_time = 0 var/moving_status = SHUTTLE_IDLE @@ -12,6 +13,28 @@ var/arrive_time = 0 //the time at which the shuttle arrives when long jumping + var/flags = SHUTTLE_FLAGS_PROCESS + var/category = /datum/shuttle + +/datum/shuttle/New() + ..() + if(src.name in shuttle_controller.shuttles) + CRASH("A shuttle with the name '[name]' is already defined.") + shuttle_controller.shuttles[src.name] = src + if(flags & SHUTTLE_FLAGS_PROCESS) + shuttle_controller.process_shuttles += src + if(flags & SHUTTLE_FLAGS_SUPPLY) + if(supply_controller.shuttle) + CRASH("A supply shuttle is already defined.") + supply_controller.shuttle = src + +/datum/shuttle/Destroy() + shuttle_controller.shuttles -= src.name + shuttle_controller.process_shuttles -= src + if(supply_controller.shuttle == src) + supply_controller.shuttle = null + . = ..() + /datum/shuttle/proc/init_docking_controllers() if(docking_controller_tag) docking_controller = locate(docking_controller_tag) diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index beea1781b4..347243ae5c 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -1,5 +1,11 @@ /datum/shuttle/ferry/emergency - //pass + category = /datum/shuttle/ferry/emergency + +/datum/shuttle/ferry/emergency/New() + if(emergency_shuttle.shuttle) + CRASH("An emergency shuttle has already been defined.") + emergency_shuttle.shuttle = src + ..() /datum/shuttle/ferry/emergency/arrived() if (istype(in_use, /obj/machinery/computer/shuttle_control/emergency)) diff --git a/code/modules/shuttles/shuttle_ferry.dm b/code/modules/shuttles/shuttle_ferry.dm index 0a288a1ba9..d076357735 100644 --- a/code/modules/shuttles/shuttle_ferry.dm +++ b/code/modules/shuttles/shuttle_ferry.dm @@ -11,13 +11,21 @@ var/move_time = 0 //the time spent in the transition area var/transit_direction = null //needed for area/move_contents_to() to properly handle shuttle corners - not exactly sure how it works. - var/area_station - var/area_offsite + var/area/area_station + var/area/area_offsite //TODO: change location to a string and use a mapping for area and dock targets. var/dock_target_station var/dock_target_offsite var/last_dock_attempt_time = 0 + category = /datum/shuttle/ferry + +/datum/shuttle/ferry/New() + area_offsite = locate(area_offsite) + area_station = locate(area_station) + if(area_transition) + area_transition = locate(area_transition) + ..() /datum/shuttle/ferry/short_jump(var/area/origin,var/area/destination) if(isnull(location)) diff --git a/code/modules/shuttles/shuttle_specops.dm b/code/modules/shuttles/shuttle_specops.dm index 434bb37f42..d9cc121f79 100644 --- a/code/modules/shuttles/shuttle_specops.dm +++ b/code/modules/shuttles/shuttle_specops.dm @@ -13,16 +13,17 @@ var/docking_controller_tag_offsite var/datum/computer/file/embedded_program/docking/docking_controller_station var/datum/computer/file/embedded_program/docking/docking_controller_offsite + category = /datum/shuttle/ferry/multidock /datum/shuttle/ferry/multidock/init_docking_controllers() if(docking_controller_tag_station) docking_controller_station = locate(docking_controller_tag_station) if(!istype(docking_controller_station)) - world << "warning: shuttle with docking tag [docking_controller_station] could not find it's controller!" + warning("warning: shuttle with docking tag [docking_controller_station] could not find it's controller!") if(docking_controller_tag_offsite) docking_controller_offsite = locate(docking_controller_tag_offsite) if(!istype(docking_controller_offsite)) - world << "warning: shuttle with docking tag [docking_controller_offsite] could not find it's controller!" + warning("warning: shuttle with docking tag [docking_controller_offsite] could not find it's controller!") if (!location) docking_controller = docking_controller_station else @@ -43,6 +44,7 @@ var/reset_time = 0 //the world.time at which the shuttle will be ready to move again. var/launch_prep = 0 var/cancel_countdown = 0 + category = /datum/shuttle/ferry/multidock/specops /datum/shuttle/ferry/multidock/specops/New() ..() diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm index c4122434e7..9a6b7f3380 100644 --- a/code/modules/shuttles/shuttle_supply.dm +++ b/code/modules/shuttles/shuttle_supply.dm @@ -2,11 +2,12 @@ var/away_location = 1 //the location to hide at while pretending to be in-transit var/late_chance = 80 var/max_late_time = 300 + category = /datum/shuttle/ferry/supply /datum/shuttle/ferry/supply/short_jump(var/area/origin,var/area/destination) if(moving_status != SHUTTLE_IDLE) return - + if(isnull(location)) return @@ -18,21 +19,21 @@ //it would be cool to play a sound here moving_status = SHUTTLE_WARMUP spawn(warmup_time*10) - if (moving_status == SHUTTLE_IDLE) + if (moving_status == SHUTTLE_IDLE) return //someone cancelled the launch - + if (at_station() && forbidden_atoms_check()) //cancel the launch because of forbidden atoms. announce over supply channel? moving_status = SHUTTLE_IDLE return - + if (!at_station()) //at centcom supply_controller.buy() - + //We pretend it's a long_jump by making the shuttle stay at centcom for the "in-transit" period. var/area/away_area = get_location_area(away_location) moving_status = SHUTTLE_INTRANSIT - + //If we are at the away_area then we are just pretending to move, otherwise actually do the move if (origin != away_area) move(origin, away_area) @@ -46,11 +47,11 @@ //late if (prob(late_chance)) sleep(rand(0,max_late_time)) - + move(away_area, destination) - + moving_status = SHUTTLE_IDLE - + if (!at_station()) //at centcom supply_controller.sell() @@ -58,7 +59,7 @@ /datum/shuttle/ferry/supply/proc/forbidden_atoms_check() if (!at_station()) return 0 //if badmins want to send mobs or a nuke on the supply shuttle from centcom we don't care - + return supply_controller.forbidden_atoms_check(get_location_area()) /datum/shuttle/ferry/supply/proc/at_station() diff --git a/code/modules/shuttles/shuttles_multi.dm b/code/modules/shuttles/shuttles_multi.dm index 47b430329a..9dc7e4312e 100644 --- a/code/modules/shuttles/shuttles_multi.dm +++ b/code/modules/shuttles/shuttles_multi.dm @@ -1,6 +1,7 @@ //This is a holder for things like the Skipjack and Nuke shuttle. /datum/shuttle/multi_shuttle + flags = SHUTTLE_FLAGS_NONE var/cloaked = 1 var/at_origin = 1 var/returned_home = 0 @@ -22,8 +23,13 @@ var/list/destination_dock_targets = list() var/area/origin var/return_warning = 0 + category = /datum/shuttle/multi_shuttle /datum/shuttle/multi_shuttle/New() + origin = locate(origin) + interim = locate(interim) + for(var/destination in destinations) + destinations[destination] = locate(destinations[destination]) ..() /datum/shuttle/multi_shuttle/init_docking_controllers() @@ -36,7 +42,7 @@ var/datum/computer/file/embedded_program/docking/C = locate(controller_tag) if(!istype(C)) - world << "warning: shuttle with docking tag [controller_tag] could not find it's controller!" + warning("warning: shuttle with docking tag [controller_tag] could not find it's controller!") else destination_dock_controllers[destination] = C diff --git a/code/modules/supermatter/supermatter.dm b/code/modules/supermatter/supermatter.dm index 1ebd8207e0..046c315ec9 100644 --- a/code/modules/supermatter/supermatter.dm +++ b/code/modules/supermatter/supermatter.dm @@ -23,8 +23,11 @@ #define DAMAGE_RATE_LIMIT 3 //damage rate cap at power = 300, scales linearly with power -//These would be what you would get at point blank, decreases with distance -#define DETONATION_RADS 200 +// Base variants are applied to everyone on the same Z level +// Range variants are applied on per-range basis: numbers here are on point blank, it scales with the map size (assumes square shaped Z levels) +#define DETONATION_RADS 20 +#define DETONATION_HALLUCINATION_BASE 300 +#define DETONATION_HALLUCINATION_RANGE 300 #define DETONATION_HALLUCINATION 600 @@ -95,6 +98,11 @@ anchored = 1 grav_pulling = 1 exploded = 1 + var/turf/TS = get_turf(src) // The turf supermatter is on. SM being in a locker, mecha, or other container shouldn't block it's effects that way. + if(!TS) + return + for(var/z in GetConnectedZlevels(TS.z)) + radiation_repository.z_radiate(locate(1, 1, z), DETONATION_RADS, 1) for(var/mob/living/mob in living_mob_list) var/turf/T = get_turf(mob) if(T && (loc.z == T.z)) @@ -102,8 +110,6 @@ //Hilariously enough, running into a closet should make you get hit the hardest. var/mob/living/carbon/human/H = mob H.hallucination += max(50, min(300, DETONATION_HALLUCINATION * sqrt(1 / (get_dist(mob, src) + 1)) ) ) - var/rads = DETONATION_RADS * sqrt( 1 / (get_dist(mob, src) + 1) ) - mob.apply_effect(rads, IRRADIATE) spawn(pull_time) explosion(get_turf(src), explosion_power, explosion_power * 2, explosion_power * 3, explosion_power * 4, 1) qdel(src) @@ -258,12 +264,15 @@ if(eye_shield < 1) l.hallucination = max(0, min(200, l.hallucination + power * config_hallucination_power * sqrt( 1 / max(1,get_dist(l, src)) ) ) ) +/* //adjusted range so that a power of 170 (pretty high) results in 9 tiles, roughly the distance from the core to the engine monitoring room. //note that the rads given at the maximum range is a constant 0.2 - as power increases the maximum range merely increases. for(var/mob/living/l in range(src, round(sqrt(power / 2)))) var/radius = max(get_dist(l, src), 1) var/rads = (power / 10) * ( 1 / (radius**2) ) l.apply_effect(rads, IRRADIATE) +*/ + radiation_repository.radiate(src, power * 1.5) //Better close those shutters! power -= (power/DECAY_FACTOR)**3 //energy losses due to radiation @@ -377,9 +386,8 @@ "The unearthly ringing subsides and you notice you have new radiation burns.", 2) else l.show_message("You hear an uneartly ringing and notice your skin is covered in fresh radiation burns.", 2) - var/rads = 500 * sqrt( 1 / (get_dist(l, src) + 1) ) - l.apply_effect(rads, IRRADIATE) - + var/rads = 500 + radiation_repository.radiate(src, rads) /obj/machinery/power/supermatter/proc/supermatter_pull() //following is adapted from singulo code diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm index 3e49482c75..48aca377ee 100644 --- a/code/modules/surgery/implant.dm +++ b/code/modules/surgery/implant.dm @@ -13,22 +13,22 @@ return affected && affected.open == (affected.encased ? 3 : 2) && !(affected.status & ORGAN_BLEEDING) proc/get_max_wclass(var/obj/item/organ/external/affected) - switch (affected.name) - if ("head") - return 1 - if ("upper body") - return 3 - if ("lower body") - return 2 + switch (affected.organ_tag) + if (BP_HEAD) + return ITEMSIZE_TINY + if (BP_TORSO) + return ITEMSIZE_NORMAL + if (BP_GROIN) + return ITEMSIZE_SMALL return 0 proc/get_cavity(var/obj/item/organ/external/affected) - switch (affected.name) - if ("head") + switch (affected.organ_tag) + if (BP_HEAD) return "cranial" - if ("upper body") + if (BP_TORSO) return "thoracic" - if ("lower body") + if (BP_GROIN) return "abdominal" return "" diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 38b919823f..19007addae 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -1,5 +1,8 @@ /* SURGERY STEPS */ +/obj/ + var/surgery_odds = 0 // Used for tables/etc which can have surgery done of them. + /datum/surgery_step var/priority = 0 //steps with higher priority would be attempted first @@ -111,13 +114,28 @@ return 1 M.op_stage.in_progress += zone S.begin_step(user, M, zone, src) //start on it - //We had proper tools! (or RNG smiled.) and user did not move or change hands. - if(prob(S.tool_quality(src)) && do_mob(user, M, rand(S.min_duration, S.max_duration))) - S.end_step(user, M, zone, src) //finish successfully - else if ((src in user.contents) && user.Adjacent(M)) //or - S.fail_step(user, M, zone, src) //malpractice~ - else // This failing silently was a pain. - user << "You must remain close to your patient to conduct surgery." + var/success = TRUE + + // Bad tools make it less likely to succeed. + if(!prob(S.tool_quality(src))) + success = FALSE + + // Bad or no surface may mean failure as well. + var/obj/surface = M.get_surgery_surface() + if(!surface || !prob(surface.surgery_odds)) + success = FALSE + + // Not staying still fails you too. + if(success) + if(!do_mob(user, M, rand(S.min_duration, S.max_duration))) + success = FALSE + to_chat(user, "You must remain close to your patient to conduct surgery.") + + if(success) + S.end_step(user, M, zone, src) + else + S.fail_step(user, M, zone, src) + M.op_stage.in_progress -= zone // Clear the in-progress flag. if (ishuman(M)) var/mob/living/carbon/human/H = M diff --git a/code/modules/tables/tables.dm b/code/modules/tables/tables.dm index 72cc6dbf8b..cea2c93559 100644 --- a/code/modules/tables/tables.dm +++ b/code/modules/tables/tables.dm @@ -8,6 +8,7 @@ climbable = 1 layer = 2.8 throwpass = 1 + surgery_odds = 66 var/flipped = 0 var/maxhealth = 10 var/health = 10 @@ -78,7 +79,7 @@ update_connections(1) // Update tables around us to ignore us (material=null forces no connections) for(var/obj/structure/table/T in oview(src, 1)) T.update_icon() - ..() + . = ..() /obj/structure/table/examine(mob/user) . = ..() diff --git a/code/modules/tables/update_triggers.dm b/code/modules/tables/update_triggers.dm index a90e3eeb8a..b7c087f9c0 100644 --- a/code/modules/tables/update_triggers.dm +++ b/code/modules/tables/update_triggers.dm @@ -6,12 +6,10 @@ /obj/structure/window/Destroy() var/oldloc = loc - loc=null + . = ..() for(var/obj/structure/table/T in view(oldloc, 1)) T.update_connections() T.update_icon() - loc=oldloc - ..() /obj/structure/window/Move() var/oldloc = loc diff --git a/code/modules/xenoarcheaology/anomaly_container.dm b/code/modules/xenoarcheaology/anomaly_container.dm new file mode 100644 index 0000000000..616b04b10d --- /dev/null +++ b/code/modules/xenoarcheaology/anomaly_container.dm @@ -0,0 +1,43 @@ +/obj/structure/anomaly_container + name = "anomaly container" + desc = "Used to safely contain and move anomalies." + icon = 'icons/obj/xenoarchaeology.dmi' + icon_state = "anomaly_container" + density = 1 + + var/obj/machinery/artifact/contained + +/obj/structure/anomaly_container/initialize() + ..() + + var/obj/machinery/artifact/A = locate() in loc + if(A) + contain(A) + +/obj/structure/anomaly_container/attack_hand(var/mob/user) + release() + +/obj/structure/anomaly_container/attack_robot(var/mob/user) + if(Adjacent(user)) + release() + +/obj/structure/anomaly_container/proc/contain(var/obj/machinery/artifact/artifact) + if(contained) + return + contained = artifact + artifact.forceMove(src) + underlays += image(artifact) + desc = "Used to safely contain and move anomalies. \The [contained] is kept inside." + +/obj/structure/anomaly_container/proc/release() + if(!contained) + return + contained.dropInto(src) + contained = null + underlays.Cut() + desc = initial(desc) + +/obj/machinery/artifact/MouseDrop(var/obj/structure/anomaly_container/over_object) + if(istype(over_object) && Adjacent(over_object) && CanMouseDrop(over_object, usr)) + Bumped(usr) + over_object.contain(src) \ No newline at end of file diff --git a/code/modules/xenoarcheaology/effects/radiate.dm b/code/modules/xenoarcheaology/effects/radiate.dm index 7816409757..6c8d37838a 100644 --- a/code/modules/xenoarcheaology/effects/radiate.dm +++ b/code/modules/xenoarcheaology/effects/radiate.dm @@ -15,16 +15,10 @@ /datum/artifact_effect/radiate/DoEffectAura() if(holder) - var/turf/T = get_turf(holder) - for (var/mob/living/M in range(src.effectrange,T)) - M.apply_effect(radiation_amount,IRRADIATE,0) - M.updatehealth() + radiation_repository.flat_radiate(holder, radiation_amount, src.effectrange) return 1 /datum/artifact_effect/radiate/DoEffectPulse() if(holder) - var/turf/T = get_turf(holder) - for (var/mob/living/M in range(src.effectrange,T)) - M.apply_effect(radiation_amount * 25,IRRADIATE,0) - M.updatehealth() + radiation_repository.radiate(holder, ((radiation_amount * 25) * (sqrt(src.effectrange)))) //Need to get feedback on this return 1 diff --git a/code/modules/xenoarcheaology/tools/geosample_scanner.dm b/code/modules/xenoarcheaology/tools/geosample_scanner.dm index 9d6450a839..9e3343b680 100644 --- a/code/modules/xenoarcheaology/tools/geosample_scanner.dm +++ b/code/modules/xenoarcheaology/tools/geosample_scanner.dm @@ -198,8 +198,7 @@ radiation = rand() * 15 + 85 if(!rad_shield) //irradiate nearby mobs - for(var/mob/living/M in view(7,src)) - M.apply_effect(radiation / 25, IRRADIATE, 0) + radiation_repository.radiate(src, radiation / 25) else t_left_radspike = pick(10,15,25) @@ -361,4 +360,4 @@ scanned_item = null add_fingerprint(usr) - return 1 // update UIs attached to this object + return 1 // update UIs attached to this object \ No newline at end of file diff --git a/code/modules/xgm/xgm_gas_mixture.dm b/code/modules/xgm/xgm_gas_mixture.dm index cb600f254f..7fe1a96d0d 100644 --- a/code/modules/xgm/xgm_gas_mixture.dm +++ b/code/modules/xgm/xgm_gas_mixture.dm @@ -1,7 +1,7 @@ /datum/gas_mixture //Associative list of gas moles. //Gases with 0 moles are not tracked and are pruned by update_values() - var/list/gas = list() + var/list/gas //Temperature in Kelvin of this gas mix. var/temperature = 0 @@ -13,10 +13,11 @@ var/group_multiplier = 1 //List of active tile overlays for this gas_mixture. Updated by check_tile_graphic() - var/list/graphic = list() + var/list/graphic /datum/gas_mixture/New(vol = CELL_VOLUME) volume = vol + gas = list() //Takes a gas string and the amount of moles to adjust by. Calls update_values() if update isn't 0. /datum/gas_mixture/proc/adjust_gas(gasid, moles, update = 1) @@ -329,27 +330,24 @@ //Rechecks the gas_mixture and adjusts the graphic list if needed. //Two lists can be passed by reference if you need know specifically which graphics were added and removed. /datum/gas_mixture/proc/check_tile_graphic(list/graphic_add = null, list/graphic_remove = null) + var/list/cur_graphic = graphic // Cache for sanic speed for(var/g in gas_data.overlay_limit) - if(graphic.Find(gas_data.tile_overlay[g])) + if(cur_graphic && cur_graphic.Find(gas_data.tile_overlay[g])) //Overlay is already applied for this gas, check if it's still valid. if(gas[g] <= gas_data.overlay_limit[g]) - if(!graphic_remove) - graphic_remove = list() - graphic_remove += gas_data.tile_overlay[g] + LAZYADD(graphic_remove, gas_data.tile_overlay[g]) else //Overlay isn't applied for this gas, check if it's valid and needs to be added. if(gas[g] > gas_data.overlay_limit[g]) - if(!graphic_add) - graphic_add = list() - graphic_add += gas_data.tile_overlay[g] + LAZYADD(graphic_add, gas_data.tile_overlay[g]) . = 0 //Apply changes - if(graphic_add && graphic_add.len) - graphic += graphic_add + if(LAZYLEN(graphic_add)) + LAZYADD(graphic, graphic_add) . = 1 - if(graphic_remove && graphic_remove.len) - graphic -= graphic_remove + if(LAZYLEN(graphic_remove)) + LAZYREMOVE(graphic, graphic_remove) . = 1 diff --git a/code/unit_tests/unit_test.dm b/code/unit_tests/unit_test.dm index f05514ce74..605cf8fcac 100644 --- a/code/unit_tests/unit_test.dm +++ b/code/unit_tests/unit_test.dm @@ -45,6 +45,7 @@ var/total_unit_tests = 0 sleep(1) ticker.current_state = GAME_STATE_SETTING_UP + Master.SetRunLevel(RUNLEVEL_SETUP) log_unit_test("Round has been started. Waiting 10 seconds to start tests.") sleep(100) diff --git a/code/world.dm b/code/world.dm index 02ec2669a9..9a031dda0f 100644 --- a/code/world.dm +++ b/code/world.dm @@ -26,7 +26,8 @@ var/global/datum/global_init/init = new () qdel(src) //we're done /datum/global_init/Destroy() - return 1 + global.init = null + return 2 // QDEL_HINT_IWILLGC /world mob = /mob/new_player @@ -70,8 +71,6 @@ var/global/datum/global_init/init = new () #if UNIT_TEST log_unit_test("Unit Tests Enabled. This will destroy the world when testing is complete.") log_unit_test("If you did not intend to enable this please check code/__defines/unit_testing.dm") -#else - sleep_offline = 1 #endif // Set up roundstart seed list. @@ -116,6 +115,7 @@ var/global/datum/global_init/init = new () processScheduler = new master_controller = new /datum/controller/game_controller() + Master.Initialize(10, FALSE) spawn(1) processScheduler.deferSetupFor(/datum/controller/process/ticker) processScheduler.setup() @@ -433,6 +433,7 @@ var/world_topic_spam_protect_time = world.timeofday */ processScheduler.stop() + Master.Shutdown() //run SS shutdowns for(var/client/C in clients) if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite diff --git a/config/example/config.txt b/config/example/config.txt index 232d3c66ad..52892bc14a 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -36,6 +36,9 @@ JOBS_HAVE_MINIMAL_ACCESS Configure how fast explosion strength diminishes when travelling up/down z levels. All explosion distances are multiplied by this each time they go up/down z-levels. #MULTI_Z_EXPLOSION_SCALAR 0.5 +# Radiation weakens with distance from the source; stop calculating when the strength falls below this value. Lower values mean radiation reaches smaller (with increasingly trivial damage) at the cost of more CPU usage. Max range = DISTANCE^2 * POWER / RADIATION_LOWER_LIMIT +# RADIATION_LOWER_LIMIT 0.35 + ## log OOC channel LOG_OOC diff --git a/html/changelogs/Leshana-Radiation.yml b/html/changelogs/Leshana-Radiation.yml new file mode 100644 index 0000000000..d4d9c3589d --- /dev/null +++ b/html/changelogs/Leshana-Radiation.yml @@ -0,0 +1,5 @@ +author: Leshana +delete-after: True +changes: + - tweak: "Optimized the unified radiation system. Made the radiation cutoff level configurable." + - bugfix: "Standing still won't save you from radiation storms." diff --git a/html/changelogs/Leshana-smol-fixes.yml b/html/changelogs/Leshana-smol-fixes.yml new file mode 100644 index 0000000000..9d972dec1a --- /dev/null +++ b/html/changelogs/Leshana-smol-fixes.yml @@ -0,0 +1,4 @@ +author: Leshana +delete-after: True +changes: + - bugfix: "Bedsheets can be put into washing machines again." diff --git a/html/changelogs/cirra-Radiation.yml b/html/changelogs/cirra-Radiation.yml new file mode 100644 index 0000000000..53038532cd --- /dev/null +++ b/html/changelogs/cirra-Radiation.yml @@ -0,0 +1,37 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Cirra + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added a unified radiation system. Radiation is lessened by obstacles, and distance." + - rscadd: "Added a geiger counter for measuring radiation levels, which can be found in certain vending machines and radiation closets." diff --git a/icons/mob/eyes.dmi b/icons/mob/eyes.dmi index 1f4bd4a68f..763ce78990 100644 Binary files a/icons/mob/eyes.dmi and b/icons/mob/eyes.dmi differ diff --git a/icons/mob/robots.dmi b/icons/mob/robots.dmi index 2b3dfe51d8..e742bdc804 100644 Binary files a/icons/mob/robots.dmi and b/icons/mob/robots.dmi differ diff --git a/icons/mob/species/seromi/eyes.dmi b/icons/mob/species/seromi/eyes.dmi index 17a41de747..94d8f6d000 100644 Binary files a/icons/mob/species/seromi/eyes.dmi and b/icons/mob/species/seromi/eyes.dmi differ diff --git a/icons/mob/species/vox/eyes.dmi b/icons/mob/species/vox/eyes.dmi index 6e15b3e58c..c81f6217a2 100644 Binary files a/icons/mob/species/vox/eyes.dmi and b/icons/mob/species/vox/eyes.dmi differ diff --git a/icons/mob/uniform.dmi b/icons/mob/uniform.dmi index 37c85a0837..3aef9384f4 100644 Binary files a/icons/mob/uniform.dmi and b/icons/mob/uniform.dmi differ diff --git a/icons/obj/ammo.dmi b/icons/obj/ammo.dmi index 0e0959705e..dcdb20e070 100644 Binary files a/icons/obj/ammo.dmi and b/icons/obj/ammo.dmi differ diff --git a/icons/obj/clothing/glasses.dmi b/icons/obj/clothing/glasses.dmi index 0e86367473..920880e155 100644 Binary files a/icons/obj/clothing/glasses.dmi and b/icons/obj/clothing/glasses.dmi differ diff --git a/icons/obj/clothing/uniforms.dmi b/icons/obj/clothing/uniforms.dmi index a7fed692ad..7c33803ebc 100644 Binary files a/icons/obj/clothing/uniforms.dmi and b/icons/obj/clothing/uniforms.dmi differ diff --git a/icons/obj/device.dmi b/icons/obj/device.dmi index 336f8dfe9c..1198dc0314 100644 Binary files a/icons/obj/device.dmi and b/icons/obj/device.dmi differ diff --git a/icons/obj/gun.dmi b/icons/obj/gun.dmi index ba02b5a324..75f5005aa5 100644 Binary files a/icons/obj/gun.dmi and b/icons/obj/gun.dmi differ diff --git a/icons/obj/lighting.dmi b/icons/obj/lighting.dmi index 736308440d..cb4d4042c6 100644 Binary files a/icons/obj/lighting.dmi and b/icons/obj/lighting.dmi differ diff --git a/icons/obj/xenoarchaeology.dmi b/icons/obj/xenoarchaeology.dmi index a074f17c3f..24ebc6ef6c 100644 Binary files a/icons/obj/xenoarchaeology.dmi and b/icons/obj/xenoarchaeology.dmi differ diff --git a/maps/RandomZLevels/stationCollision.dm b/maps/RandomZLevels/stationCollision.dm index fa20f440ec..0ebf12f169 100644 --- a/maps/RandomZLevels/stationCollision.dm +++ b/maps/RandomZLevels/stationCollision.dm @@ -54,7 +54,7 @@ B.item_state = "melted" new /obj/item/weapon/paper/sc_safehint_paper_bible(B) new /obj/item/weapon/pen(B) - del(src) + qdel(src) /* * Guns - I'm making these specifically so that I dont spawn a pile of fully loaded weapons on the map. @@ -189,7 +189,7 @@ var/sc_safecode5 = "[rand(0,9)]" else if(istype(A,/obj/)) var/obj/O = A O.ex_act(1.0) - if(O) del(O) + if(O) qdel(O) else if(isturf(A)) var/turf/T = A if(T.intact) diff --git a/maps/RandomZLevels/wildwest.dm b/maps/RandomZLevels/wildwest.dm index b3ae83b9d7..51ac498fb2 100644 --- a/maps/RandomZLevels/wildwest.dm +++ b/maps/RandomZLevels/wildwest.dm @@ -133,7 +133,7 @@ s.start() explosion(mob, 1, 0, 0, 0) spawn(0) - del(src) + qdel(src) /obj/effect/meatgrinder name = "Meat Grinder" diff --git a/maps/northern_star/northern_star.dm b/maps/northern_star/northern_star.dm index 2212774657..fe95bbaeb6 100644 --- a/maps/northern_star/northern_star.dm +++ b/maps/northern_star/northern_star.dm @@ -7,6 +7,7 @@ #include "polaris-5.dmm" #include "northern_star_defines.dm" + #include "northern_star_shuttles.dm" #define USING_MAP_DATUM /datum/map/northern_star diff --git a/maps/northern_star/northern_star_shuttles.dm b/maps/northern_star/northern_star_shuttles.dm new file mode 100644 index 0000000000..44a5e1a5bd --- /dev/null +++ b/maps/northern_star/northern_star_shuttles.dm @@ -0,0 +1,272 @@ +// Escape shuttle and pods +/datum/shuttle/ferry/emergency/centcom + name = "Escape" + location = 1 + warmup_time = 10 + area_offsite = /area/shuttle/escape/centcom + area_station = /area/shuttle/escape/station + area_transition = /area/shuttle/escape/transit + docking_controller_tag = "escape_shuttle" + dock_target_station = "escape_dock" + dock_target_offsite = "centcom_dock" + transit_direction = NORTH + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/escape_pod_one + name = "Escape Pod 1" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/escape_pod1/station + area_offsite = /area/shuttle/escape_pod1/centcom + area_transition = /area/shuttle/escape_pod1/transit + docking_controller_tag = "escape_pod_1" + dock_target_station = "escape_pod_1_berth" + dock_target_offsite = "escape_pod_1_recovery" + transit_direction = NORTH + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/escape_pod_two + name = "Escape Pod 2" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/escape_pod2/station + area_offsite = /area/shuttle/escape_pod2/centcom + area_transition = /area/shuttle/escape_pod2/transit + docking_controller_tag = "escape_pod_2" + dock_target_station = "escape_pod_2_berth" + dock_target_offsite = "escape_pod_2_recovery" + transit_direction = NORTH + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/escape_pod_three + name = "Escape Pod 3" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/escape_pod3/station + area_offsite = /area/shuttle/escape_pod3/centcom + area_transition = /area/shuttle/escape_pod3/transit + docking_controller_tag = "escape_pod_3" + dock_target_station = "escape_pod_3_berth" + dock_target_offsite = "escape_pod_3_recovery" + transit_direction = NORTH + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/escape_pod_four + name = "Escape Pod 4" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/escape_pod4/station + area_offsite = /area/shuttle/escape_pod4/centcom + area_transition = /area/shuttle/escape_pod4/transit + docking_controller_tag = "escape_pod_4" + dock_target_station = "escape_pod_4_berth" + dock_target_offsite = "escape_pod_4_recovery" + transit_direction = NORTH //should this be SOUTH? I have no idea. + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/escape_pod_five + name = "Escape Pod 5" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/escape_pod5/station + area_offsite = /area/shuttle/escape_pod5/centcom + area_transition = /area/shuttle/escape_pod5/transit + docking_controller_tag = "escape_pod_5" + dock_target_station = "escape_pod_5_berth" + dock_target_offsite = "escape_pod_5_recovery" + transit_direction = NORTH //should this be WEST? I have no idea. + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/escape_pod_six + name = "Escape Pod 6" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/escape_pod6/station + area_offsite = /area/shuttle/escape_pod6/centcom + area_transition = /area/shuttle/escape_pod6/transit + docking_controller_tag = "escape_pod_6" + dock_target_station = "escape_pod_6_berth" + dock_target_offsite = "escape_pod_6_recovery" + transit_direction = NORTH //should this be WEST? I have no idea. + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/escape_pod_cryo + name = "Cryostorage Shuttle" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/cryo/station + area_offsite = /area/shuttle/cryo/centcom + area_transition = /area/shuttle/cryo/transit + docking_controller_tag = "cryostorage_shuttle" + dock_target_station = "cryostorage_shuttle_berth" + dock_target_offsite = "cryostorage_shuttle_recovery" + transit_direction = NORTH + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/large_escape_pod1 + name = "Large Escape Pod 1" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/large_escape_pod1/station + area_offsite = /area/shuttle/large_escape_pod1/centcom + area_transition = /area/shuttle/large_escape_pod1/transit + docking_controller_tag = "large_escape_pod_1" + dock_target_station = "large_escape_pod_1_berth" + dock_target_offsite = "large_escape_pod_1_recovery" + transit_direction = EAST + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +/datum/shuttle/ferry/escape_pod/large_escape_pod2 + name = "Large Escape Pod 2" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/large_escape_pod2/station + area_offsite = /area/shuttle/large_escape_pod2/centcom + area_transition = /area/shuttle/large_escape_pod2/transit + docking_controller_tag = "large_escape_pod_2" + dock_target_station = "large_escape_pod_2_berth" + dock_target_offsite = "large_escape_pod_2_recovery" + transit_direction = EAST + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +// Cargo shuttle. +/datum/shuttle/ferry/supply/cargo + name = "Supply" + location = 1 + warmup_time = 10 + area_offsite = /area/supply/dock + area_station = /area/supply/station + docking_controller_tag = "supply_shuttle" + dock_target_station = "cargo_bay" + flags = SHUTTLE_FLAGS_PROCESS|SHUTTLE_FLAGS_SUPPLY + +// The "Elevators" +/datum/shuttle/ferry/engineering + name = "Engineering" + warmup_time = 10 + area_offsite = /area/shuttle/constructionsite/site + area_station = /area/shuttle/constructionsite/station + docking_controller_tag = "engineering_shuttle" + dock_target_station = "engineering_dock_airlock" + dock_target_offsite = "edock_airlock" + +/datum/shuttle/ferry/mining + name = "Mining" + warmup_time = 10 + area_offsite = /area/shuttle/mining/outpost + area_station = /area/shuttle/mining/station + docking_controller_tag = "mining_shuttle" + dock_target_station = "mining_dock_airlock" + dock_target_offsite = "mining_outpost_airlock" + +/datum/shuttle/ferry/research + name = "Research" + warmup_time = 10 + area_offsite = /area/shuttle/research/outpost + area_station = /area/shuttle/research/station + docking_controller_tag = "research_shuttle" + dock_target_station = "research_dock_airlock" + dock_target_offsite = "research_outpost_dock" + +// Admin shuttles. +/datum/shuttle/ferry/centcom + name = "Centcom" + location = 1 + warmup_time = 10 + area_offsite = /area/shuttle/transport1/centcom + area_station = /area/shuttle/transport1/station + docking_controller_tag = "centcom_shuttle" + dock_target_station = "centcom_shuttle_dock_airlock" + dock_target_offsite = "centcom_shuttle_bay" + +/datum/shuttle/ferry/administration + name = "Administration" + location = 1 + warmup_time = 10 //want some warmup time so people can cancel. + area_offsite = /area/shuttle/administration/centcom + area_station = /area/shuttle/administration/station + docking_controller_tag = "admin_shuttle" + dock_target_station = "admin_shuttle_dock_airlock" + dock_target_offsite = "admin_shuttle_bay" + +// Traders +/datum/shuttle/ferry/trade + name = "Trade" + location = 1 + warmup_time = 10 //want some warmup time so people can cancel. + area_offsite = /area/shuttle/trade/centcom + area_station = /area/shuttle/trade/station + docking_controller_tag = "trade_shuttle" + dock_target_station = "trade_shuttle_dock_airlock" + dock_target_offsite = "trade_shuttle_bay" + +// Is this even used? +/datum/shuttle/ferry/alien + name = "Alien" + area_offsite = /area/shuttle/alien/base + area_station = /area/shuttle/alien/mine + flags = SHUTTLE_FLAGS_NONE + +// Mercenary +/datum/shuttle/multi_shuttle/mercenary + name = "Mercenary" + warmup_time = 0 + origin = /area/syndicate_station/start + interim = /area/syndicate_station/transit + start_location = "Mercenary Base" + destinations = list( + "Northwest of the station" = /area/syndicate_station/northwest, + "North of the station" = /area/syndicate_station/north, + "Northeast of the station" = /area/syndicate_station/northeast, + "Southwest of the station" = /area/syndicate_station/southwest, + "South of the station" = /area/syndicate_station/south, + "Southeast of the station" = /area/syndicate_station/southeast, + "Telecomms Satellite" = /area/syndicate_station/commssat, + "Mining Station" = /area/syndicate_station/mining, + "Arrivals dock" = /area/syndicate_station/arrivals_dock, + ) + docking_controller_tag = "merc_shuttle" + destination_dock_targets = list( + "Mercenary Base" = "merc_base", + "Arrivals dock" = "nuke_shuttle_dock_airlock", + ) + announcer = "Automated Traffic Control" + +/datum/shuttle/multi_shuttle/mercenary/New() + arrival_message = "Attention. A vessel is approaching the colony." + departure_message = "Attention. A vessel is now leaving from the colony." + ..() + +// Heist +/datum/shuttle/multi_shuttle/skipjack + name = "Skipjack" + warmup_time = 0 + origin = /area/skipjack_station/start + interim = /area/skipjack_station/transit + destinations = list( + "Fore Starboard Solars" = /area/skipjack_station/northeast_solars, + "Fore Port Solars" = /area/skipjack_station/northwest_solars, + "Aft Starboard Solars" = /area/skipjack_station/southeast_solars, + "Aft Port Solars" = /area/skipjack_station/southwest_solars, + "Mining Station" = /area/skipjack_station/mining + ) + announcer = "Automated Traffic Control" + +/datum/shuttle/multi_shuttle/skipjack/New() + arrival_message = "Attention. Unidentified object approaching the colony." + departure_message = "Attention. Unidentified object exiting local space. Unidentified object expected to escape Kara gravity well with current velocity." + ..() + +/datum/shuttle/ferry/multidock/specops/ert + name = "Special Operations" + location = 0 + warmup_time = 10 + area_offsite = /area/shuttle/specops/station //centcom is the home station, the Exodus is offsite + area_station = /area/shuttle/specops/centcom + docking_controller_tag = "specops_shuttle_port" + docking_controller_tag_station = "specops_shuttle_port" + docking_controller_tag_offsite = "specops_shuttle_fore" + dock_target_station = "specops_centcom_dock" + dock_target_offsite = "specops_dock_airlock" + + diff --git a/maps/northern_star/polaris-1.dmm b/maps/northern_star/polaris-1.dmm index 2b58fe7175..faa4589659 100644 --- a/maps/northern_star/polaris-1.dmm +++ b/maps/northern_star/polaris-1.dmm @@ -2311,7 +2311,7 @@ "aSw" = (/obj/structure/bed/chair{dir = 1},/obj/structure/closet/walllocker/emerglocker{pixel_x = 0; pixel_y = -32},/turf/simulated/shuttle/floor,/area/shuttle/large_escape_pod2/station) "aSx" = (/turf/simulated/wall/r_wall,/area/maintenance/substation/security) "aSy" = (/obj/structure/cable/green{d1 = 1; d2 = 2; icon_state = "1-2"},/obj/machinery/atmospherics/pipe/simple/hidden/supply,/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers,/obj/effect/floor_decal/industrial/warning{dir = 1},/obj/machinery/light/small{dir = 8},/turf/simulated/floor,/area/maintenance/security_port) -"aSz" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 2; health = 1e+006},/obj/structure/window/reinforced{dir = 8},/obj/effect/floor_decal/corner/red/full,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/machinery/door/window/brigdoor/northleft{name = "Ammo"; req_access = list(2)},/turf/simulated/floor/tiled/dark,/area/security/armoury) +"aSz" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 2; health = 1e+006},/obj/structure/window/reinforced{dir = 8},/obj/effect/floor_decal/corner/red/full,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/machinery/door/window/brigdoor/northleft{name = "Ammo"; req_access = list(2)},/turf/simulated/floor/tiled/dark,/area/security/armoury) "aSA" = (/obj/structure/grille,/obj/structure/window/reinforced{dir = 8},/obj/structure/window/reinforced{dir = 4},/obj/machinery/door/firedoor/border_only,/turf/simulated/floor/plating,/area/hallway/primary/central_one) "aSB" = (/obj/effect/floor_decal/industrial/warning{dir = 1},/obj/machinery/atmospherics/unary/vent_pump/on{dir = 4},/obj/machinery/light{dir = 8},/turf/simulated/floor/tiled,/area/hallway/primary/central_one) "aSC" = (/obj/effect/floor_decal/industrial/warning{dir = 1},/obj/machinery/atmospherics/pipe/simple/hidden/supply{dir = 10},/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{dir = 6},/turf/simulated/floor/tiled,/area/hallway/primary/central_one) @@ -5255,7 +5255,7 @@ "bXc" = (/obj/effect/floor_decal/corner/pink{dir = 10},/obj/machinery/atmospherics/unary/vent_scrubber/on{dir = 1},/obj/structure/closet/secure_closet/personal/patient,/turf/simulated/floor/tiled/white,/area/medical/patient_b) "bXd" = (/obj/effect/floor_decal/corner/pink{dir = 10},/obj/structure/table/glass,/obj/item/weapon/paper_bin,/obj/item/weapon/clipboard,/obj/item/weapon/pen,/turf/simulated/floor/tiled/white,/area/medical/patient_b) "bXe" = (/obj/machinery/computer/med_data/laptop,/obj/structure/table/glass,/obj/effect/floor_decal/corner/pink/full{dir = 4},/obj/machinery/light,/obj/item/device/radio/intercom{dir = 4; name = "Station Intercom (General)"; pixel_x = 21},/turf/simulated/floor/tiled/white,/area/medical/patient_b) -"bXf" = (/obj/structure/table/reinforced,/obj/machinery/light{dir = 4},/obj/item/ammo_magazine/mc9mmt/practice,/obj/item/ammo_magazine/mc9mmt/practice,/obj/item/ammo_magazine/c45m/practice,/obj/item/ammo_magazine/c45m/practice,/obj/item/ammo_magazine/c45m/practice,/obj/item/ammo_magazine/c45m/practice,/obj/item/ammo_magazine/c45m/practice,/obj/item/ammo_magazine/c45m/practice,/turf/simulated/floor/tiled,/area/security/range) +"bXf" = (/obj/structure/table/reinforced,/obj/machinery/light{dir = 4},/obj/item/ammo_magazine/m9mmt/practice,/obj/item/ammo_magazine/m9mmt/practice,/obj/item/ammo_magazine/m45/practice,/obj/item/ammo_magazine/m45/practice,/obj/item/ammo_magazine/m45/practice,/obj/item/ammo_magazine/m45/practice,/obj/item/ammo_magazine/m45/practice,/obj/item/ammo_magazine/m45/practice,/turf/simulated/floor/tiled,/area/security/range) "bXg" = (/obj/item/weapon/storage/box/lights/mixed,/obj/item/device/flashlight,/obj/item/device/flashlight,/obj/structure/table/steel,/obj/machinery/power/apc{dir = 2; name = "south bump"; pixel_y = -24},/obj/structure/cable/green,/obj/item/device/radio{frequency = 1487; icon_state = "med_walkietalkie"; name = "Medbay Emergency Radio Link"},/turf/simulated/floor/tiled/dark,/area/medical/biostorage) "bXh" = (/obj/structure/closet/crate{icon_state = "crateopen"; name = "Grenade Crate"; opened = 1},/obj/item/weapon/grenade/chem_grenade,/obj/item/weapon/grenade/chem_grenade,/obj/item/weapon/grenade/chem_grenade,/obj/item/weapon/grenade/chem_grenade,/obj/item/device/assembly/igniter,/obj/item/device/assembly/igniter,/obj/item/device/assembly/igniter,/obj/item/device/assembly/timer,/obj/item/device/assembly/timer,/obj/item/device/assembly/timer,/turf/simulated/floor/tiled/dark,/area/medical/biostorage) "bXi" = (/obj/structure/bed/chair/comfy/brown{dir = 1},/obj/item/device/radio/intercom{broadcasting = 0; canhear_range = 5; dir = 8; frequency = 1487; icon_state = "intercom"; listening = 0; name = "Station Intercom (Medbay)"; pixel_x = -21; pixel_y = 0},/turf/simulated/floor/carpet/blue,/area/medical/psych) @@ -6167,7 +6167,7 @@ "coE" = (/obj/machinery/atmospherics/unary/vent_pump/on{dir = 8},/obj/machinery/alarm{dir = 1; pixel_y = -22},/obj/item/device/radio/intercom{dir = 4; name = "Station Intercom (General)"; pixel_x = 26},/turf/simulated/floor/tiled/dark,/area/hallway/primary/central_three) "coF" = (/obj/structure/disposalpipe/segment{dir = 4},/obj/machinery/power/apc{dir = 2; name = "south bump"; pixel_y = -24},/obj/structure/cable/green,/turf/simulated/floor/tiled,/area/crew_quarters/heads/hop) "coG" = (/obj/structure/grille,/obj/structure/window/reinforced{dir = 1},/obj/structure/window/reinforced,/obj/structure/window/reinforced{dir = 8},/obj/machinery/door/firedoor/border_only,/obj/structure/cable/green{d1 = 1; d2 = 2; icon_state = "1-2"},/turf/simulated/floor/plating,/area/crew_quarters/sleep/elevator) -"coH" = (/obj/effect/floor_decal/corner/green/full{dir = 4},/obj/structure/window/reinforced{dir = 2; health = 1e+006},/obj/structure/window/reinforced{dir = 4},/obj/structure/table/rack,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/machinery/door/window/brigdoor/northright{name = "Ammo"},/turf/simulated/floor/tiled/dark,/area/security/tactical) +"coH" = (/obj/effect/floor_decal/corner/green/full{dir = 4},/obj/structure/window/reinforced{dir = 2; health = 1e+006},/obj/structure/window/reinforced{dir = 4},/obj/structure/table/rack,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/machinery/door/window/brigdoor/northright{name = "Ammo"},/turf/simulated/floor/tiled/dark,/area/security/tactical) "coI" = (/obj/machinery/atmospherics/pipe/simple/hidden/supply{dir = 6},/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{dir = 6},/obj/structure/disposalpipe/segment{dir = 4; icon_state = "pipe-c"},/turf/simulated/floor,/area/maintenance/medbay_aft) "coJ" = (/obj/machinery/atmospherics/pipe/simple/hidden/supply{dir = 4},/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{dir = 4},/obj/structure/disposalpipe/segment{dir = 4},/turf/simulated/floor,/area/maintenance/medbay_aft) "coK" = (/obj/structure/cable{d1 = 1; d2 = 4; icon_state = "1-4"},/obj/machinery/atmospherics/pipe/simple/hidden/supply{dir = 9; pixel_y = 0},/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{dir = 9},/obj/structure/disposalpipe/segment{dir = 8; icon_state = "pipe-c"},/turf/simulated/floor,/area/maintenance/medbay_aft) diff --git a/maps/northern_star/polaris-2.dmm b/maps/northern_star/polaris-2.dmm index 3f14b89489..edead8f198 100644 --- a/maps/northern_star/polaris-2.dmm +++ b/maps/northern_star/polaris-2.dmm @@ -859,7 +859,7 @@ "aqA" = (/obj/structure/table/rack,/obj/item/weapon/plastique,/obj/item/weapon/plastique,/obj/item/weapon/plastique,/obj/item/weapon/plastique,/obj/item/weapon/plastique,/obj/item/weapon/plastique,/obj/structure/window/reinforced{dir = 8},/obj/structure/window/reinforced{dir = 1},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqB" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 4},/obj/item/weapon/gun/energy/ionrifle,/obj/structure/window/reinforced{dir = 1},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqC" = (/obj/structure/window/reinforced{dir = 8},/obj/structure/table/rack,/obj/item/weapon/gun/projectile/automatic/wt550,/obj/item/weapon/gun/projectile/automatic/wt550,/obj/item/weapon/gun/projectile/automatic/wt550,/obj/structure/window/reinforced{dir = 1},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) -"aqD" = (/obj/structure/table/rack,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/item/ammo_magazine/mc9mmt/rubber,/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced{dir = 1},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) +"aqD" = (/obj/structure/table/rack,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m9mmt/rubber,/obj/item/ammo_magazine/m9mmt/rubber,/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced{dir = 1},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqE" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 8},/obj/item/weapon/gun/launcher/grenade,/obj/item/weapon/gun/launcher/grenade,/obj/structure/window/reinforced{dir = 1},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqF" = (/obj/structure/table/rack,/obj/item/weapon/storage/box/flashbangs,/obj/item/weapon/storage/box/flashbangs,/obj/item/weapon/storage/box/emps{pixel_x = 4; pixel_y = 4},/obj/structure/window/reinforced{dir = 1},/obj/structure/window/reinforced{dir = 4},/obj/item/weapon/storage/box/frags,/obj/item/weapon/storage/box/smokes,/obj/item/weapon/storage/box/smokes,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqG" = (/obj/machinery/vending/security,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) @@ -869,11 +869,11 @@ "aqK" = (/obj/machinery/door/blast/regular{icon_state = "pdoor1"; id = "ASSAULT"; name = "Assault Weapon Storage"; p_open = 0},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqL" = (/obj/structure/sign/securearea,/turf/simulated/shuttle/wall/dark/hard_corner,/area/centcom/specops) "aqM" = (/obj/machinery/door/airlock/centcom,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) -"aqN" = (/obj/structure/table/rack,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) +"aqN" = (/obj/structure/table/rack,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqO" = (/obj/structure/table/rack,/obj/item/weapon/gun/projectile/automatic/z8,/obj/item/weapon/gun/projectile/automatic/z8,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqP" = (/obj/structure/table/rack,/obj/item/weapon/gun/energy/sniperrifle,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) -"aqQ" = (/obj/structure/table/rack,/obj/item/ammo_magazine/p90,/obj/item/ammo_magazine/p90,/obj/item/ammo_magazine/p90,/obj/item/ammo_magazine/p90,/obj/item/weapon/gun/projectile/automatic/p90,/obj/item/weapon/gun/projectile/automatic/p90,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) -"aqR" = (/obj/structure/table/rack,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/item/weapon/gun/projectile/automatic/l6_saw,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) +"aqQ" = (/obj/structure/table/rack,/obj/item/ammo_magazine/m9mmp90,/obj/item/ammo_magazine/m9mmp90,/obj/item/ammo_magazine/m9mmp90,/obj/item/ammo_magazine/m9mmp90,/obj/item/weapon/gun/projectile/automatic/p90,/obj/item/weapon/gun/projectile/automatic/p90,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) +"aqR" = (/obj/structure/table/rack,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/item/weapon/gun/projectile/automatic/l6_saw,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqS" = (/obj/effect/wingrille_spawn/reinforced/crescent,/turf/unsimulated/floor{icon_state = "plating"; name = "plating"},/area/centcom/specops) "aqT" = (/obj/structure/closet/crate,/obj/item/clothing/shoes/magboots,/obj/item/clothing/shoes/magboots,/obj/item/clothing/shoes/magboots,/obj/item/clothing/shoes/magboots,/obj/item/clothing/shoes/magboots,/obj/item/clothing/shoes/magboots,/obj/item/weapon/storage/box,/obj/item/weapon/storage/box,/obj/item/weapon/storage/box,/obj/item/weapon/storage/box,/obj/item/weapon/storage/box,/obj/item/weapon/storage/box,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "aqU" = (/obj/machinery/autolathe{desc = "Your typical Autolathe. It appears to have much more options than your regular one, however..."; hacked = 1; name = "Unlocked Autolathe"},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) @@ -896,7 +896,7 @@ "arl" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 8},/obj/structure/window/reinforced,/obj/item/weapon/storage/box/shotgunshells,/obj/item/weapon/storage/box/shotgunshells,/obj/item/weapon/storage/box/shotgunammo,/obj/item/weapon/storage/box/shotgunammo,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "arm" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced,/obj/item/weapon/gun/projectile/shotgun/pump/combat,/obj/item/weapon/gun/projectile/shotgun/pump/combat,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "arn" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 8},/obj/structure/window/reinforced,/obj/item/weapon/gun/projectile/automatic/z8,/obj/item/weapon/gun/projectile/automatic/z8,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) -"aro" = (/obj/structure/table/rack,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/obj/structure/window/reinforced,/obj/structure/window/reinforced{dir = 4},/obj/item/ammo_magazine/a556,/obj/item/ammo_magazine/a556,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) +"aro" = (/obj/structure/table/rack,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/obj/structure/window/reinforced,/obj/structure/window/reinforced{dir = 4},/obj/item/ammo_magazine/m556saw,/obj/item/ammo_magazine/m556saw,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "arp" = (/obj/machinery/deployable/barrier,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "arq" = (/obj/structure/table/reinforced,/obj/item/device/pda/ert,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "arr" = (/obj/effect/floor_decal/corner/purple{dir = 9},/turf/unsimulated/floor{icon_state = "vault"; dir = 5},/area/centcom/specops) @@ -953,7 +953,7 @@ "asq" = (/obj/structure/table/rack,/obj/item/weapon/melee/energy/sword/blue,/obj/item/weapon/melee/energy/sword/blue,/obj/item/weapon/melee/energy/sword/blue,/obj/item/weapon/melee/energy/sword/blue,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "asr" = (/obj/structure/table/rack,/obj/item/weapon/gun/energy/xray,/obj/item/weapon/gun/energy/xray,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "ass" = (/obj/structure/table/rack,/obj/item/weapon/gun/energy/laser,/obj/item/weapon/gun/energy/laser,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) -"ast" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 8},/obj/structure/window/reinforced,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/rubber,/obj/item/ammo_magazine/c45m/flash,/obj/item/ammo_magazine/c45m/flash,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/obj/item/ammo_magazine/c45m,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) +"ast" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 8},/obj/structure/window/reinforced,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/rubber,/obj/item/ammo_magazine/m45/flash,/obj/item/ammo_magazine/m45/flash,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/obj/item/ammo_magazine/m45,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "asu" = (/obj/structure/table/rack,/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced,/obj/item/weapon/gun/projectile/sec,/obj/item/weapon/gun/projectile/sec,/obj/item/weapon/gun/projectile/sec,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "asv" = (/obj/structure/table/reinforced,/obj/item/weapon/storage/belt/security/tactical,/obj/item/weapon/storage/belt/security/tactical,/obj/item/weapon/storage/belt/security/tactical,/obj/item/weapon/storage/belt/security/tactical,/obj/item/weapon/storage/belt/security/tactical,/obj/item/weapon/storage/belt/security/tactical,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) "asw" = (/obj/structure/table/reinforced,/obj/item/clothing/glasses/sunglasses/sechud/tactical,/obj/item/clothing/glasses/sunglasses/sechud/tactical,/obj/item/clothing/glasses/sunglasses/sechud/tactical,/obj/item/clothing/glasses/sunglasses/sechud/tactical,/obj/item/clothing/glasses/sunglasses/sechud/tactical,/obj/item/clothing/glasses/sunglasses/sechud/tactical,/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/specops) @@ -1179,7 +1179,7 @@ "awI" = (/obj/structure/bed/chair{dir = 8},/turf/simulated/shuttle/floor/darkred,/area/syndicate_station/start) "awJ" = (/obj/structure/bed/chair{dir = 4},/obj/machinery/light{dir = 1},/turf/simulated/shuttle/floor/darkred,/area/syndicate_station/start) "awK" = (/obj/structure/closet/hydrant{pixel_y = 32},/turf/simulated/shuttle/floor/darkred,/area/syndicate_station/start) -"awL" = (/obj/structure/table/rack,/obj/item/weapon/storage/belt/security,/obj/item/weapon/storage/belt/security,/obj/item/ammo_magazine/mc9mm/flash,/obj/item/weapon/gun/projectile/pistol/flash,/turf/simulated/shuttle/floor/darkred,/area/syndicate_station/start) +"awL" = (/obj/structure/table/rack,/obj/item/weapon/storage/belt/security,/obj/item/weapon/storage/belt/security,/obj/item/ammo_magazine/m9mm/flash,/obj/item/weapon/gun/projectile/pistol/flash,/turf/simulated/shuttle/floor/darkred,/area/syndicate_station/start) "awM" = (/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced{dir = 8},/obj/structure/grille,/obj/structure/window/reinforced{dir = 1},/turf/unsimulated/floor{icon_state = "plating"; name = "plating"},/area/syndicate_mothership) "awN" = (/obj/machinery/door/airlock/centcom{name = "Bathroom"; opacity = 1},/turf/unsimulated/floor{icon_state = "freezerfloor"; dir = 2},/area/syndicate_mothership) "awO" = (/obj/machinery/shower{dir = 1},/turf/unsimulated/floor{icon_state = "freezerfloor"; dir = 2},/area/syndicate_mothership) @@ -1207,8 +1207,8 @@ "axk" = (/obj/structure/table/rack,/obj/item/device/megaphone,/obj/item/device/megaphone,/obj/item/device/megaphone,/obj/item/device/megaphone,/obj/item/device/megaphone,/obj/item/device/megaphone,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) "axl" = (/obj/structure/table/rack,/obj/item/device/flashlight/maglight,/obj/item/device/flashlight/maglight,/obj/item/device/flashlight/maglight,/obj/item/device/flashlight/maglight,/obj/item/device/flashlight/maglight,/obj/item/device/flashlight/maglight,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) "axm" = (/obj/structure/table/rack,/obj/item/device/camera_film,/obj/item/device/camera_film,/obj/item/device/camera_film,/obj/item/device/camera_film,/obj/item/device/camera_film,/obj/item/device/camera_film,/obj/item/device/camera,/obj/item/device/camera,/obj/item/device/camera,/obj/item/device/camera,/obj/item/device/camera,/obj/item/device/camera,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) -"axn" = (/obj/structure/table/rack,/obj/item/ammo_magazine/a10mm,/obj/item/ammo_magazine/a10mm,/obj/item/ammo_magazine/a10mm,/obj/item/ammo_magazine/a10mm,/obj/item/ammo_magazine/a10mm,/obj/item/ammo_magazine/a10mm,/obj/item/weapon/gun/projectile/automatic/c20r,/obj/item/weapon/gun/projectile/automatic/c20r,/obj/item/weapon/gun/projectile/automatic/c20r,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) -"axo" = (/obj/structure/table/rack,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/ammo_magazine/c762,/obj/item/weapon/gun/projectile/automatic/sts35,/obj/item/weapon/gun/projectile/automatic/sts35,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) +"axn" = (/obj/structure/table/rack,/obj/item/ammo_magazine/m10mm,/obj/item/ammo_magazine/m10mm,/obj/item/ammo_magazine/m10mm,/obj/item/ammo_magazine/m10mm,/obj/item/ammo_magazine/m10mm,/obj/item/ammo_magazine/m10mm,/obj/item/weapon/gun/projectile/automatic/c20r,/obj/item/weapon/gun/projectile/automatic/c20r,/obj/item/weapon/gun/projectile/automatic/c20r,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) +"axo" = (/obj/structure/table/rack,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/ammo_magazine/m762,/obj/item/weapon/gun/projectile/automatic/sts35,/obj/item/weapon/gun/projectile/automatic/sts35,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) "axp" = (/turf/unsimulated/floor{icon_state = "steel"},/area/centcom/specops) "axq" = (/obj/machinery/vending/boozeomat,/turf/simulated/shuttle/wall/dark,/area/shuttle/administration/centcom) "axr" = (/obj/machinery/vending/coffee,/turf/simulated/shuttle/floor/red,/area/shuttle/administration/centcom) diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index 1a575b3578..65797ebafa 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -161,5 +161,10 @@ var/list/all_maps = list() if(transit_chance) map.accessible_z_levels["[z]"] = transit_chance -/datum/map_z_level/Destroy() - return TRUE // No. +/datum/map_z_level/Destroy(var/force) + crash_with("Attempt to delete a map_z_level instance [log_info_line(src)]") + if(!force) + return QDEL_HINT_LETMELIVE // No. + if (using_map.zlevels["[z]"] == src) + using_map.zlevels -= "[z]" + return ..() diff --git a/nano/templates/communicator.tmpl b/nano/templates/communicator.tmpl index 58b86a30d7..6157f45d61 100644 --- a/nano/templates/communicator.tmpl +++ b/nano/templates/communicator.tmpl @@ -152,7 +152,10 @@ Used In File(s): code\game\objects\items\devices\communicator\communicator.dm {{:value.name}}
-
{{:value.address}}
{{:helper.link('Copy', 'pencil', {'copy' : value.address, 'switch_tab' : 2})}} +
{{:value.address}}
+ {{:helper.link('Copy', 'pencil', {'copy' : value.address, 'switch_tab' : 2})}} + {{:helper.link('Call', 'phone', {'dial' : value.address, 'copy' : value.address, 'switch_tab' : 2})}} + {{:helper.link('Msg', 'mail-closed', {'copy' : value.address, 'copy_name' : value.name, 'switch_tab' : 40})}}
{{/for}} diff --git a/nano/templates/guest_pass.tmpl b/nano/templates/guest_pass.tmpl index 80525f5331..821ba0a474 100644 --- a/nano/templates/guest_pass.tmpl +++ b/nano/templates/guest_pass.tmpl @@ -19,7 +19,7 @@ {{else}}

Guest pass terminal #{{:data.uid}}

- {{:helper.link('View activity log', 'list', {'mode' : 1})}} {{:helper.link('Issure Pass', 'eject', {'action' : 'issue'})}} + {{:helper.link('View activity log', 'list', {'mode' : 1})}} {{:helper.link('Issue Pass', 'eject', {'action' : 'issue'})}}

diff --git a/polaris.dme b/polaris.dme index 9f075b1d76..f79f9616e1 100644 --- a/polaris.dme +++ b/polaris.dme @@ -30,14 +30,19 @@ #include "code\__defines\lighting.dm" #include "code\__defines\machinery.dm" #include "code\__defines\map.dm" +#include "code\__defines\math.dm" #include "code\__defines\math_physics.dm" +#include "code\__defines\MC.dm" #include "code\__defines\misc.dm" #include "code\__defines\mobs.dm" #include "code\__defines\planets.dm" #include "code\__defines\process_scheduler.dm" +#include "code\__defines\qdel.dm" #include "code\__defines\research.dm" #include "code\__defines\species_languages.dm" +#include "code\__defines\subsystems.dm" #include "code\__defines\targeting.dm" +#include "code\__defines\tick.dm" #include "code\__defines\turfs.dm" #include "code\__defines\unit_tests.dm" #include "code\__defines\xenoarcheaology.dm" @@ -66,6 +71,9 @@ #include "code\_helpers\type2type.dm" #include "code\_helpers\unsorted.dm" #include "code\_helpers\vector.dm" +#include "code\_helpers\sorts\__main.dm" +#include "code\_helpers\sorts\comparators.dm" +#include "code\_helpers\sorts\TimSort.dm" #include "code\_onclick\_defines.dm" #include "code\_onclick\adjacent.dm" #include "code\_onclick\ai.dm" @@ -128,12 +136,15 @@ #include "code\controllers\autotransfer.dm" #include "code\controllers\communications.dm" #include "code\controllers\configuration.dm" +#include "code\controllers\controller.dm" #include "code\controllers\emergency_shuttle_controller.dm" +#include "code\controllers\failsafe.dm" #include "code\controllers\hooks-defs.dm" #include "code\controllers\hooks.dm" +#include "code\controllers\master.dm" #include "code\controllers\master_controller.dm" #include "code\controllers\shuttle_controller.dm" -#include "code\controllers\subsystems.dm" +#include "code\controllers\subsystem.dm" #include "code\controllers\verbs.dm" #include "code\controllers\voting.dm" #include "code\controllers\observer_listener\atom\observer.dm" @@ -143,7 +154,6 @@ #include "code\controllers\Processes\emergencyShuttle.dm" #include "code\controllers\Processes\event.dm" #include "code\controllers\Processes\game_master.dm" -#include "code\controllers\Processes\garbage.dm" #include "code\controllers\Processes\inactivity.dm" #include "code\controllers\Processes\lighting.dm" #include "code\controllers\Processes\machinery.dm" @@ -151,6 +161,7 @@ #include "code\controllers\Processes\nanoui.dm" #include "code\controllers\Processes\obj.dm" #include "code\controllers\Processes\planet.dm" +#include "code\controllers\Processes\radiation.dm" #include "code\controllers\Processes\scheduler.dm" #include "code\controllers\Processes\Shuttle.dm" #include "code\controllers\Processes\sun.dm" @@ -160,6 +171,7 @@ #include "code\controllers\Processes\vote.dm" #include "code\controllers\ProcessScheduler\core\process.dm" #include "code\controllers\ProcessScheduler\core\processScheduler.dm" +#include "code\controllers\subsystems\garbage.dm" #include "code\datums\ai_law_sets.dm" #include "code\datums\ai_laws.dm" #include "code\datums\browser.dm" @@ -213,6 +225,7 @@ #include "code\datums\repositories\cameras.dm" #include "code\datums\repositories\crew.dm" #include "code\datums\repositories\decls.dm" +#include "code\datums\repositories\radiation.dm" #include "code\datums\repositories\repository.dm" #include "code\datums\supplypacks\atmospherics.dm" #include "code\datums\supplypacks\contraband.dm" @@ -769,6 +782,7 @@ #include "code\game\objects\items\devices\flash.dm" #include "code\game\objects\items\devices\flashlight.dm" #include "code\game\objects\items\devices\floor_painter.dm" +#include "code\game\objects\items\devices\geiger.dm" #include "code\game\objects\items\devices\hacktool.dm" #include "code\game\objects\items\devices\lightreplacer.dm" #include "code\game\objects\items\devices\locker_painter.dm" @@ -1876,8 +1890,8 @@ #include "code\modules\projectiles\effects.dm" #include "code\modules\projectiles\gun.dm" #include "code\modules\projectiles\projectile.dm" -#include "code\modules\projectiles\ammunition\boxes.dm" -#include "code\modules\projectiles\ammunition\bullets.dm" +#include "code\modules\projectiles\ammunition\magazines.dm" +#include "code\modules\projectiles\ammunition\rounds.dm" #include "code\modules\projectiles\guns\energy.dm" #include "code\modules\projectiles\guns\launcher.dm" #include "code\modules\projectiles\guns\projectile.dm" @@ -2026,6 +2040,7 @@ #include "code\modules\shieldgen\shield_diffuser.dm" #include "code\modules\shieldgen\shield_gen.dm" #include "code\modules\shieldgen\shield_gen_external.dm" +#include "code\modules\shuttles\_defines.dm" #include "code\modules\shuttles\antagonist.dm" #include "code\modules\shuttles\departmental.dm" #include "code\modules\shuttles\escape_pods.dm" @@ -2117,6 +2132,7 @@ #include "code\modules\virus2\helpers.dm" #include "code\modules\virus2\isolator.dm" #include "code\modules\virus2\items_devices.dm" +#include "code\modules\xenoarcheaology\anomaly_container.dm" #include "code\modules\xenoarcheaology\boulder.dm" #include "code\modules\xenoarcheaology\effect.dm" #include "code\modules\xenoarcheaology\manuals.dm"