From 5dc271107cf3074b07e95c524018e7893add9212 Mon Sep 17 00:00:00 2001 From: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Date: Sat, 2 Sep 2023 00:08:43 -0400 Subject: [PATCH] Saves more init time + fixes a minor SSshuttle bug (#445) * Micro-optimize GetIdFromArguments to be 48% faster, gaining 0.48s of init time on local (likely more in prod) (#69659) About The Pull Request Avoids stringifying key unless its necessary. This was done redundantly twice, but I locked it to just the isnum path, as REF will always return a string, and the other path passes istext. Use sortTim directly instead of sort_list. sort_list is just sortTim but it copies the list, so it's just wasted cost. I still would like the bespoke element key option, as that's the only way to drastically cut down costs on things like item descriptions and decals, but this is good for the general use case, and makes it marginally less pressing. I also want to test if we'd be better off inserting into the list in sorted order rather than sorting it all in the end, but I suspect not. * Load circuit components from USB ports on demand, saving 0.5s of init time (0.7s on prod) (#69664) We create 2,383 circuit components (on whatever map I was looking at on Sybil at the time, don't know) from USB ports every round, quite pricey. This makes them initialize once when a USB is first plugged in. * speed * big ports * this has been annoying me * Add defines for byond-tracy support (#70931) Adds `USE_BYOND_TRACY`, which automatically loads a given prof.dll/libprof.so using https://github.com/mafemergency/byond-tracy/. Not intended for use in production, and we do not ship a copy of byond-tracy. It is extremely easy to compile yourself, but if you're someone interesting enough to play around with this then let me know and I can just give you a build. I'm going to be using this for init profiling. * optimize icon smoothing * cleanup windows and fix compile * fix it for real * fix alot of bugs * fix mineral turrfs * debug time * remove debug code --------- Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> --- code/__DEFINES/dcs/flags.dm | 5 +- code/__DEFINES/mapswitch.dm | 8 ++ code/__DEFINES/matrices.dm | 1 + code/__HELPERS/icon_smoothing.dm | 87 +++++++-------- code/controllers/subsystem/dcs.dm | 28 +++-- code/controllers/subsystem/shuttle.dm | 2 +- code/datums/components/twohanded.dm | 4 +- code/datums/components/usb_port.dm | 5 +- code/datums/elements/ELEMENT_TEMPLATE.md | 2 +- code/datums/elements/art.dm | 2 +- code/datums/elements/bane.dm | 2 +- code/datums/elements/bed_tucking.dm | 2 +- code/datums/elements/bump_click.dm | 2 +- code/datums/elements/chemical_transfer.dm | 2 +- code/datums/elements/climbable.dm | 2 +- code/datums/elements/crackable.dm | 2 +- code/datums/elements/curse_announcement.dm | 2 +- code/datums/elements/cursed.dm | 1 - code/datums/elements/delete_on_drop.dm | 1 - code/datums/elements/deliver_first.dm | 2 +- code/datums/elements/drag_pickup.dm | 1 - code/datums/elements/easily_fragmented.dm | 2 +- code/datums/elements/empprotection.dm | 2 +- code/datums/elements/eyestab.dm | 2 +- code/datums/elements/frozen.dm | 1 - code/datums/elements/haunted.dm | 1 - code/datums/elements/honkspam.dm | 1 - code/datums/elements/kneecapping.dm | 1 - code/datums/elements/kneejerk.dm | 1 - code/datums/elements/light_eaten.dm | 2 +- code/datums/elements/light_eater.dm | 1 - code/datums/elements/movement_turf_changer.dm | 2 +- .../elements/openspace_item_click_handler.dm | 1 - code/datums/elements/pet_bonus.dm | 2 +- .../elements/prevent_attacking_of_types.dm | 2 +- .../elements/radiation_protected_clothing.dm | 1 - code/datums/elements/ranged_attacks.dm | 2 +- code/datums/elements/ridable.dm | 2 +- code/datums/elements/rust.dm | 2 +- .../contextual_screentip_item_typechecks.dm | 2 +- .../screentips/contextual_screentip_tools.dm | 2 +- code/datums/elements/series.dm | 2 +- code/datums/elements/simple_flying.dm | 1 - code/datums/elements/skittish.dm | 1 - code/datums/elements/soft_landing.dm | 2 +- code/datums/elements/spooky.dm | 2 +- code/datums/elements/tenacious.dm | 1 - code/datums/elements/venomous.dm | 2 +- code/datums/elements/wall_engraver.dm | 1 - code/game/atoms.dm | 4 +- code/game/atoms_movable.dm | 3 +- code/game/machinery/camera/presets.dm | 20 ++-- .../computer/chef_orders/chef_order.dm | 2 +- .../computer/chef_orders/order_datum.dm | 101 +++++++++--------- code/game/machinery/doors/windowdoor.dm | 22 ++-- .../embedded_controller/access_controller.dm | 4 +- code/game/machinery/slotmachine.dm | 13 ++- .../machinery/telecomms/telecomunications.dm | 5 +- .../objects/structures/beds_chairs/chair.dm | 7 +- code/game/objects/structures/false_walls.dm | 4 +- code/game/objects/structures/low_wall.dm | 4 +- code/game/objects/structures/window.dm | 1 - code/game/turfs/closed/minerals.dm | 57 ++++------ code/game/turfs/closed/walls.dm | 4 +- .../asset_cache/assets/research_designs.dm | 2 + code/modules/asset_cache/assets/vending.dm | 18 ++-- .../lavalandruin_code/elephantgraveyard.dm | 2 +- code/modules/projectiles/guns/ballistic.dm | 8 +- code/modules/shuttle/supply.dm | 2 +- code/modules/tables/tables_racks.dm | 44 +++----- code/modules/unit_tests/_unit_tests.dm | 1 + .../unit_tests/dcs_get_id_from_elements.dm | 46 ++++++++ .../unit_tests/orderable_item_descriptions.dm | 16 +++ daedalus.dme | 2 + 74 files changed, 323 insertions(+), 276 deletions(-) create mode 100644 code/__DEFINES/mapswitch.dm create mode 100644 code/__DEFINES/matrices.dm create mode 100644 code/modules/unit_tests/dcs_get_id_from_elements.dm create mode 100644 code/modules/unit_tests/orderable_item_descriptions.dm diff --git a/code/__DEFINES/dcs/flags.dm b/code/__DEFINES/dcs/flags.dm index 2657b95f3b38..687a0e13428b 100644 --- a/code/__DEFINES/dcs/flags.dm +++ b/code/__DEFINES/dcs/flags.dm @@ -9,7 +9,10 @@ #define ELEMENT_INCOMPATIBLE 1 // /datum/element flags -/// Causes the detach proc to be called when the host object is being deleted +/// Causes the detach proc to be called when the host object is being deleted. +/// Should only be used if you need to perform cleanup not related to the host object. +/// You do not need this if you are only unregistering signals, for instance. +/// You would need it if you are doing something like removing the target from a processing list. #define ELEMENT_DETACH (1 << 0) /** * Only elements created with the same arguments given after `id_arg_index` share an element instance diff --git a/code/__DEFINES/mapswitch.dm b/code/__DEFINES/mapswitch.dm new file mode 100644 index 000000000000..dbb0059786ee --- /dev/null +++ b/code/__DEFINES/mapswitch.dm @@ -0,0 +1,8 @@ +/// Uses the left operator when compiling, uses the right operator when not compiling. +// Currently uses the CBT macro, but if http://www.byond.com/forum/post/2831057 is ever added, +// or if map tools ever agree on a standard, this should switch to use that. +#ifdef CBT +#define MAP_SWITCH(compile_time, map_time) ##compile_time +#else +#define MAP_SWITCH(compile_time, map_time) ##map_time +#endif diff --git a/code/__DEFINES/matrices.dm b/code/__DEFINES/matrices.dm new file mode 100644 index 000000000000..ae16554b7064 --- /dev/null +++ b/code/__DEFINES/matrices.dm @@ -0,0 +1 @@ +#define TRANSLATE_MATRIX(offset_x, offset_y) matrix(1, 0, (offset_x), 0, 1, (offset_y)) diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index 2a19c6b0c61e..e363ca8b6955 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -22,27 +22,25 @@ #define DEFAULT_UNDERLAY_ICON 'icons/turf/floors.dmi' #define DEFAULT_UNDERLAY_ICON_STATE "plating" - -/** - * Checks if `src` can smooth with `target`, based on the [/area/var/area_limited_icon_smoothing] variable of their areas. - * - * * If `target` doesn't have an area (E.g. the edge of the z level), return `FALSE`. - * * If one area has `area_limited_icon_smoothing` set, and the other area's type doesn't match it, return `FALSE`. - * * Else, return `TRUE`. - * - * Arguments: - * * target - The atom we're trying to smooth with. - */ -/atom/proc/can_area_smooth(atom/target) - var/area/target_area = get_area(target) - var/area/source_area = get_area(src) - if(!target_area) - return FALSE - if(target_area.area_limited_icon_smoothing && !istype(source_area, target_area.area_limited_icon_smoothing)) - return FALSE - if(source_area.area_limited_icon_smoothing && !istype(target_area, source_area.area_limited_icon_smoothing)) - return FALSE - return TRUE +/// Test if thing (an atom) can smooth with an adjacent turf. This is a macro because it is a very very hot proc. +#define CAN_AREAS_SMOOTH(thing, turf, val) \ + do{ \ + if(isnull(turf)) { \ + break; \ + }; \ + var/area/source_area = get_step(thing, 0)?.loc; \ + var/area/target_area = turf:loc; \ + if(isnull(target_area)) { \ + break; \ + };\ + if(target_area.area_limited_icon_smoothing && !istype(source_area, target_area.area_limited_icon_smoothing)) { \ + break; \ + }; \ + if(source_area.area_limited_icon_smoothing && !istype(target_area, source_area.area_limited_icon_smoothing)) { \ + break; \ + }; \ + val = TRUE; \ + }while(FALSE) ///Scans all adjacent turfs to find targets to smooth with. /atom/proc/calculate_adjacencies() @@ -210,7 +208,9 @@ if(!target_turf) return NULLTURF_BORDER - if(!can_area_smooth(target_turf)) + var/can_area_smooth + CAN_AREAS_SMOOTH(src, target_turf, can_area_smooth) + if(isnull(can_area_smooth)) return NO_ADJ_FOUND if(isnull(canSmoothWith)) //special case in which it will only smooth with itself @@ -255,36 +255,39 @@ set_adj_in_dir: { \ do { \ var/turf/neighbor = get_step(src, direction); \ - if(neighbor && can_area_smooth(neighbor)) { \ - var/neighbor_smoothing_groups = neighbor.smoothing_groups; \ - if(neighbor_smoothing_groups) { \ - for(var/target in canSmoothWith) { \ - if(canSmoothWith[target] & neighbor_smoothing_groups[target]) { \ - new_junction |= direction_flag; \ - break set_adj_in_dir; \ - }; \ - }; \ - }; \ - if(smooth_obj) { \ - for(var/atom/movable/thing as anything in neighbor) { \ - var/thing_smoothing_groups = thing.smoothing_groups; \ - if(!thing.anchored || isnull(thing_smoothing_groups)) { \ - continue; \ - }; \ + var/can_area_smooth; \ + CAN_AREAS_SMOOTH(src, neighbor, can_area_smooth); \ + if(neighbor && can_area_smooth) { \ + var/neighbor_smoothing_groups = neighbor.smoothing_groups; \ + if(neighbor_smoothing_groups) { \ for(var/target in canSmoothWith) { \ - if(canSmoothWith[target] & thing_smoothing_groups[target]) { \ + if(canSmoothWith[target] & neighbor_smoothing_groups[target]) { \ new_junction |= direction_flag; \ break set_adj_in_dir; \ }; \ }; \ }; \ + if(smooth_obj) { \ + for(var/atom/movable/thing as anything in neighbor) { \ + var/thing_smoothing_groups = thing.smoothing_groups; \ + if(!thing.anchored || isnull(thing_smoothing_groups)) { \ + continue; \ + }; \ + for(var/target in canSmoothWith) { \ + if(canSmoothWith[target] & thing_smoothing_groups[target]) { \ + new_junction |= direction_flag; \ + break set_adj_in_dir; \ + }; \ + }; \ + }; \ + }; \ + } else if (smooth_border) { \ + new_junction |= direction_flag; \ }; \ - } else if (smooth_border) { \ - new_junction |= direction_flag; \ - }; \ } while(FALSE) \ } + for(var/direction in GLOB.cardinals) //Cardinal case first. SET_ADJ_IN_DIR(direction, direction) diff --git a/code/controllers/subsystem/dcs.dm b/code/controllers/subsystem/dcs.dm index 8d745fbd0e2c..faf9c96f2828 100644 --- a/code/controllers/subsystem/dcs.dm +++ b/code/controllers/subsystem/dcs.dm @@ -33,22 +33,28 @@ PROCESSING_SUBSYSTEM_DEF(dcs) var/datum/element/eletype = arguments[1] var/list/fullid = list("[eletype]") var/list/named_arguments = list() + for(var/i in initial(eletype.id_arg_index) to length(arguments)) var/key = arguments[i] - var/value + if(istext(key)) - value = arguments[key] - if(!(istext(key) || isnum(key))) - key = REF(key) - key = "[key]" // Key is stringified so numbers dont break things - if(!isnull(value)) - if(!(istext(value) || isnum(value))) - value = REF(value) - named_arguments["[key]"] = value - else + var/value = arguments[key] + if (isnull(value)) + fullid += key + else + if (!istext(value) && !isnum(value)) + value = REF(value) + named_arguments[key] = value + + continue + + if (isnum(key)) fullid += "[key]" + else + fullid += REF(key) if(length(named_arguments)) - named_arguments = sort_list(named_arguments) + named_arguments = sortTim(named_arguments, /proc/cmp_text_asc) fullid += named_arguments + return list2params(fullid) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index 0f18eaf95a62..698abd4a2e88 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -165,7 +165,7 @@ SUBSYSTEM_DEF(shuttle) if(!supply) log_mapping("No /obj/docking_port/mobile/supply placed on the map!") - if(CONFIG_GET(flag/arrivals_shuttle_require_undocked)) + if(CONFIG_GET(flag/arrivals_shuttle_require_undocked) && arrivals) arrivals.Launch(TRUE) return ..() diff --git a/code/datums/components/twohanded.dm b/code/datums/components/twohanded.dm index 6577c699ffeb..4e0cef366995 100644 --- a/code/datums/components/twohanded.dm +++ b/code/datums/components/twohanded.dm @@ -158,7 +158,7 @@ if(SEND_SIGNAL(parent, COMSIG_TWOHANDED_WIELD, user) & COMPONENT_TWOHANDED_BLOCK_WIELD) return // blocked wield from item wielded = TRUE - ADD_TRAIT(parent,TRAIT_WIELDED,src) + ADD_TRAIT(parent,TRAIT_WIELDED, REF(src)) RegisterSignal(user, COMSIG_MOB_SWAP_HANDS, PROC_REF(on_swap_hands)) // update item stats and name @@ -206,7 +206,7 @@ wielded = FALSE UnregisterSignal(user, COMSIG_MOB_SWAP_HANDS) SEND_SIGNAL(parent, COMSIG_TWOHANDED_UNWIELD, user) - REMOVE_TRAIT(parent,TRAIT_WIELDED,src) + REMOVE_TRAIT(parent,TRAIT_WIELDED, REF(src)) // update item stats var/obj/item/parent_item = parent diff --git a/code/datums/components/usb_port.dm b/code/datums/components/usb_port.dm index db947dfcc077..09c3080107c5 100644 --- a/code/datums/components/usb_port.dm +++ b/code/datums/components/usb_port.dm @@ -24,7 +24,7 @@ circuit_components = list() - set_circuit_components(circuit_component_types) + src.circuit_component_types = circuit_component_types /datum/component/usb_port/proc/set_circuit_components(list/components) var/should_register = FALSE @@ -136,6 +136,9 @@ /datum/component/usb_port/proc/on_atom_usb_cable_try_attach(datum/source, obj/item/usb_cable/connecting_cable, mob/user) SIGNAL_HANDLER + if (!length(circuit_components)) + set_circuit_components(circuit_component_types) + var/atom/atom_parent = parent if (!isnull(attached_circuit)) diff --git a/code/datums/elements/ELEMENT_TEMPLATE.md b/code/datums/elements/ELEMENT_TEMPLATE.md index 333375b3508d..ce6ab0a3c6b2 100644 --- a/code/datums/elements/ELEMENT_TEMPLATE.md +++ b/code/datums/elements/ELEMENT_TEMPLATE.md @@ -5,7 +5,7 @@ See _element.dm for detailed explanations ```dm /datum/element/myelement - element_flags = ELEMENT_BESPOKE | ELEMENT_COMPLEX_DETACH | ELEMENT_DETACH | ELEMENT_NOTAREALFLAG // code/__DEFINES/dcs/flags.dm + element_flags = ELEMENT_BESPOKE | ELEMENT_COMPLEX_DETACH | ELEMENT_DETACH_ON_HOST_DESTROY | ELEMENT_NOTAREALFLAG // code/__DEFINES/dcs/flags.dm //id_arg_index = 2 // Use with ELEMENT_BESPOKE var/list/myvar = list() diff --git a/code/datums/elements/art.dm b/code/datums/elements/art.dm index 025de7794995..7046d481e743 100644 --- a/code/datums/elements/art.dm +++ b/code/datums/elements/art.dm @@ -1,5 +1,5 @@ /datum/element/art - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 var/impressiveness = 0 diff --git a/code/datums/elements/bane.dm b/code/datums/elements/bane.dm index 6d146d005e26..377ba8a7242e 100644 --- a/code/datums/elements/bane.dm +++ b/code/datums/elements/bane.dm @@ -1,6 +1,6 @@ /// Deals extra damage to mobs of a certain type or species. /datum/element/bane - element_flags = ELEMENT_DETACH|ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE id_arg_index = 2 /// can be a mob or a species. var/target_type diff --git a/code/datums/elements/bed_tucking.dm b/code/datums/elements/bed_tucking.dm index 53a95ab2c055..569825725d38 100644 --- a/code/datums/elements/bed_tucking.dm +++ b/code/datums/elements/bed_tucking.dm @@ -1,6 +1,6 @@ /// Tucking element, for things that can be tucked into bed. /datum/element/bed_tuckable - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 /// our pixel_x offset - how much the item moves x when in bed (+x is closer to the pillow) var/x_offset = 0 diff --git a/code/datums/elements/bump_click.dm b/code/datums/elements/bump_click.dm index 25f2d58e7511..ac8fc0d7289e 100644 --- a/code/datums/elements/bump_click.dm +++ b/code/datums/elements/bump_click.dm @@ -4,7 +4,7 @@ * Simulates a click on the attached atom when it's bumped, if the bumper and their active object meet certain criteria. */ /datum/element/bump_click - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 ///Tool behaviours to check for on the bumper's active held item before clicking the attached atom with it. var/list/tool_behaviours diff --git a/code/datums/elements/chemical_transfer.dm b/code/datums/elements/chemical_transfer.dm index 4c8ac3267b0d..cf6f5e82f746 100644 --- a/code/datums/elements/chemical_transfer.dm +++ b/code/datums/elements/chemical_transfer.dm @@ -12,7 +12,7 @@ * victim_message uses %ATTACKER for the same. */ /datum/element/chemical_transfer - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 ///chance for the chemical transfer to proc. var/transfer_prob diff --git a/code/datums/elements/climbable.dm b/code/datums/elements/climbable.dm index 7fbfbcf1f3a5..247b1d1863f7 100644 --- a/code/datums/elements/climbable.dm +++ b/code/datums/elements/climbable.dm @@ -1,5 +1,5 @@ /datum/element/climbable - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 ///Time it takes to climb onto the object var/climb_time = (2 SECONDS) diff --git a/code/datums/elements/crackable.dm b/code/datums/elements/crackable.dm index e2ab7c7f0728..1907bea30246 100644 --- a/code/datums/elements/crackable.dm +++ b/code/datums/elements/crackable.dm @@ -1,6 +1,6 @@ /// Adds crack overlays to an object when integrity gets low /datum/element/crackable - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 var/list/icon/crack_appearances /// The level at which the object starts showing cracks, 1 being at full health and 0.5 being at half health diff --git a/code/datums/elements/curse_announcement.dm b/code/datums/elements/curse_announcement.dm index c29616590be7..952124cc22b2 100644 --- a/code/datums/elements/curse_announcement.dm +++ b/code/datums/elements/curse_announcement.dm @@ -6,7 +6,7 @@ * Possible improvements for the future: add an option to allow the cursed affix to be a prefix. right now only coded for suffixes */ /datum/element/curse_announcement - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 ///message sent on announce var/announcement_message diff --git a/code/datums/elements/cursed.dm b/code/datums/elements/cursed.dm index 686ce3851396..f8742fe61b2d 100644 --- a/code/datums/elements/cursed.dm +++ b/code/datums/elements/cursed.dm @@ -4,7 +4,6 @@ *Attaching this element to something will make it float, and get a special ai controller! */ /datum/element/cursed - element_flags = ELEMENT_DETACH /datum/element/cursed/Attach(datum/target, slot) . = ..() diff --git a/code/datums/elements/delete_on_drop.dm b/code/datums/elements/delete_on_drop.dm index b3db3bf60844..afb39f97fb94 100644 --- a/code/datums/elements/delete_on_drop.dm +++ b/code/datums/elements/delete_on_drop.dm @@ -2,7 +2,6 @@ * Attaches to an item, if that item is dropped on the floor delete it */ /datum/element/delete_on_drop - element_flags = ELEMENT_DETACH var/list/myvar = list() /datum/element/delete_on_drop/Attach(datum/target) diff --git a/code/datums/elements/deliver_first.dm b/code/datums/elements/deliver_first.dm index e4f5399c33e9..4b1d430df74a 100644 --- a/code/datums/elements/deliver_first.dm +++ b/code/datums/elements/deliver_first.dm @@ -9,7 +9,7 @@ #define DENY_SOUND_COOLDOWN (2 SECONDS) /datum/element/deliver_first - element_flags = ELEMENT_DETACH | ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE id_arg_index = 2 ///typepath of the area we will be allowed to be opened in var/goal_area_type diff --git a/code/datums/elements/drag_pickup.dm b/code/datums/elements/drag_pickup.dm index c33216d43e70..48264c308d82 100644 --- a/code/datums/elements/drag_pickup.dm +++ b/code/datums/elements/drag_pickup.dm @@ -4,7 +4,6 @@ * Used for paper bins. */ /datum/element/drag_pickup - element_flags = ELEMENT_DETACH /datum/element/drag_pickup/Attach(datum/target) if(!ismovable(target)) diff --git a/code/datums/elements/easily_fragmented.dm b/code/datums/elements/easily_fragmented.dm index 4eb5d09f2000..f5e8e244d8a3 100644 --- a/code/datums/elements/easily_fragmented.dm +++ b/code/datums/elements/easily_fragmented.dm @@ -4,7 +4,7 @@ */ /datum/element/easily_fragmented - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 var/break_chance diff --git a/code/datums/elements/empprotection.dm b/code/datums/elements/empprotection.dm index 8d5d798c3cb8..0c8912ec3ed3 100644 --- a/code/datums/elements/empprotection.dm +++ b/code/datums/elements/empprotection.dm @@ -1,5 +1,5 @@ /datum/element/empprotection - element_flags = ELEMENT_DETACH | ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 var/flags = NONE diff --git a/code/datums/elements/eyestab.dm b/code/datums/elements/eyestab.dm index 83cdc5878849..432a52191fa6 100644 --- a/code/datums/elements/eyestab.dm +++ b/code/datums/elements/eyestab.dm @@ -3,7 +3,7 @@ /// An element that lets you stab people in the eyes when targeting them /datum/element/eyestab - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 /// The amount of damage to do per eyestab diff --git a/code/datums/elements/frozen.dm b/code/datums/elements/frozen.dm index 1504175208ec..00eee9a1b62f 100644 --- a/code/datums/elements/frozen.dm +++ b/code/datums/elements/frozen.dm @@ -2,7 +2,6 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0 ///simple element to handle frozen obj's /datum/element/frozen - element_flags = ELEMENT_DETACH /datum/element/frozen/Attach(datum/target) . = ..() diff --git a/code/datums/elements/haunted.dm b/code/datums/elements/haunted.dm index 1f0c3570a532..d2f3c8530e46 100644 --- a/code/datums/elements/haunted.dm +++ b/code/datums/elements/haunted.dm @@ -1,6 +1,5 @@ ///Attaching this element to something will make it float, get a special ai controller, and gives it a spooky outline. /datum/element/haunted - element_flags = ELEMENT_DETACH /datum/element/haunted/Attach(datum/target) . = ..() diff --git a/code/datums/elements/honkspam.dm b/code/datums/elements/honkspam.dm index 05f4592e8ac9..9b4c649ca1ce 100644 --- a/code/datums/elements/honkspam.dm +++ b/code/datums/elements/honkspam.dm @@ -1,6 +1,5 @@ /// Attachable to items. Plays a bikehorn sound whenever attack_self is called (with a cooldown). /datum/element/honkspam - element_flags = ELEMENT_DETACH /datum/element/honkspam/Attach(datum/target) . = ..() diff --git a/code/datums/elements/kneecapping.dm b/code/datums/elements/kneecapping.dm index 949d7fd3d836..75940f8f59cb 100644 --- a/code/datums/elements/kneecapping.dm +++ b/code/datums/elements/kneecapping.dm @@ -15,7 +15,6 @@ * Passing all the checks will cancel the entire attack chain. */ /datum/element/kneecapping - element_flags = ELEMENT_DETACH /datum/element/kneecapping/Attach(datum/target) if(!isitem(target)) diff --git a/code/datums/elements/kneejerk.dm b/code/datums/elements/kneejerk.dm index dbf30ba2a386..839431da5cee 100644 --- a/code/datums/elements/kneejerk.dm +++ b/code/datums/elements/kneejerk.dm @@ -1,6 +1,5 @@ /// An element which enables certain items to tap people on their knees to measure brain health /datum/element/kneejerk - element_flags = ELEMENT_DETACH /datum/element/kneejerk/Attach(datum/target) . = ..() diff --git a/code/datums/elements/light_eaten.dm b/code/datums/elements/light_eaten.dm index 8d1d1337bb8c..340caa8178da 100644 --- a/code/datums/elements/light_eaten.dm +++ b/code/datums/elements/light_eaten.dm @@ -2,7 +2,7 @@ * Makes anything that it attaches to incapable of producing light */ /datum/element/light_eaten - element_flags = ELEMENT_DETACH + element_flags = ELEMENT_DETACH // Detach for turfs /datum/element/light_eaten/Attach(atom/target) if(!isatom(target)) diff --git a/code/datums/elements/light_eater.dm b/code/datums/elements/light_eater.dm index 963d42729ccd..ec38658bc033 100644 --- a/code/datums/elements/light_eater.dm +++ b/code/datums/elements/light_eater.dm @@ -4,7 +4,6 @@ * The temporary equivalent is [/datum/component/light_eater] */ /datum/element/light_eater - element_flags = ELEMENT_DETACH /datum/element/light_eater/Attach(datum/target) if(isatom(target)) diff --git a/code/datums/elements/movement_turf_changer.dm b/code/datums/elements/movement_turf_changer.dm index 34593dd7a65b..a5de3d2356d3 100644 --- a/code/datums/elements/movement_turf_changer.dm +++ b/code/datums/elements/movement_turf_changer.dm @@ -4,7 +4,7 @@ * Used for moonicorns! */ /datum/element/movement_turf_changer - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 ///Path of the turf added on top var/turf_type diff --git a/code/datums/elements/openspace_item_click_handler.dm b/code/datums/elements/openspace_item_click_handler.dm index 9f8db60858ac..c20751196443 100644 --- a/code/datums/elements/openspace_item_click_handler.dm +++ b/code/datums/elements/openspace_item_click_handler.dm @@ -3,7 +3,6 @@ * having to pixelhunt for portions not occupied by object or mob visuals. */ /datum/element/openspace_item_click_handler - element_flags = ELEMENT_DETACH /datum/element/openspace_item_click_handler/Attach(datum/target) . = ..() diff --git a/code/datums/elements/pet_bonus.dm b/code/datums/elements/pet_bonus.dm index 574b6ffe2367..62a4daaab1a6 100644 --- a/code/datums/elements/pet_bonus.dm +++ b/code/datums/elements/pet_bonus.dm @@ -5,7 +5,7 @@ * I may have been able to make this work for carbons, but it would have been interjecting on some help mode interactions anyways. */ /datum/element/pet_bonus - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 ///optional cute message to send when you pet your pet! diff --git a/code/datums/elements/prevent_attacking_of_types.dm b/code/datums/elements/prevent_attacking_of_types.dm index 8c3b65bdbada..d4fb750e2224 100644 --- a/code/datums/elements/prevent_attacking_of_types.dm +++ b/code/datums/elements/prevent_attacking_of_types.dm @@ -1,7 +1,7 @@ /// This hostile will not be able to attack a given typecache, and will receive /// a balloon alert when it tries to. /datum/element/prevent_attacking_of_types - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 /// The typecache of things this hostile can't attack diff --git a/code/datums/elements/radiation_protected_clothing.dm b/code/datums/elements/radiation_protected_clothing.dm index a759923a0890..e0ebb351eae5 100644 --- a/code/datums/elements/radiation_protected_clothing.dm +++ b/code/datums/elements/radiation_protected_clothing.dm @@ -2,7 +2,6 @@ /// Adds the TRAIT_RADIATION_PROTECTED_CLOTHING trait, as well as adding an /// extra bit to the examine descrpition. /datum/element/radiation_protected_clothing - element_flags = ELEMENT_DETACH /datum/element/radiation_protected_clothing/Attach(datum/target) . = ..() diff --git a/code/datums/elements/ranged_attacks.dm b/code/datums/elements/ranged_attacks.dm index d430bb1a0c4e..6b45ff9dfd22 100644 --- a/code/datums/elements/ranged_attacks.dm +++ b/code/datums/elements/ranged_attacks.dm @@ -1,6 +1,6 @@ ///This proc is used by basic mobs to give them a simple ranged attack! In theory this could be extended to /datum/element/ranged_attacks - element_flags = ELEMENT_DETACH | ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE id_arg_index = 2 var/casingtype = /obj/item/ammo_casing/glockroach var/projectilesound = 'sound/weapons/gun/pistol/shot.ogg' diff --git a/code/datums/elements/ridable.dm b/code/datums/elements/ridable.dm index 2f4d85404206..be2593dee91e 100644 --- a/code/datums/elements/ridable.dm +++ b/code/datums/elements/ridable.dm @@ -7,7 +7,7 @@ * just having the variables, behavior, and procs be standardized is still a big improvement. */ /datum/element/ridable - element_flags = ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH id_arg_index = 2 /// The specific riding component subtype we're loading our instructions from, don't leave this as default please! diff --git a/code/datums/elements/rust.dm b/code/datums/elements/rust.dm index 01b4e2496dd7..c4905ba4bf57 100644 --- a/code/datums/elements/rust.dm +++ b/code/datums/elements/rust.dm @@ -3,7 +3,7 @@ * The overlay can be specified in new as the first paramter; if not set it defaults to rust_overlay's rust_default */ /datum/element/rust - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 /// The rust image itself, since the icon and icon state are only used as an argument var/image/rust_overlay diff --git a/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm b/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm index 10d5ac6b8276..3591d7834b65 100644 --- a/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm +++ b/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm @@ -2,7 +2,7 @@ /// A "Type B" interaction. /// This stacks with other contextual screentip elements, though you may want to register the signal/flag manually at that point for performance. /datum/element/contextual_screentip_item_typechecks - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 /// Map of item paths to contexts to usages diff --git a/code/datums/elements/screentips/contextual_screentip_tools.dm b/code/datums/elements/screentips/contextual_screentip_tools.dm index a6c358ef2f63..a205b9a47ec4 100644 --- a/code/datums/elements/screentips/contextual_screentip_tools.dm +++ b/code/datums/elements/screentips/contextual_screentip_tools.dm @@ -2,7 +2,7 @@ /// A "Type B" interaction. /// This stacks with other contextual screentip elements, though you may want to register the signal/flag manually at that point for performance. /datum/element/contextual_screentip_tools - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 /// Map of tool behaviors to contexts to usages diff --git a/code/datums/elements/series.dm b/code/datums/elements/series.dm index 88cbd8bc184c..0b34b24ae551 100644 --- a/code/datums/elements/series.dm +++ b/code/datums/elements/series.dm @@ -5,7 +5,7 @@ * used for mechas and rare collectable hats, should totally be used for way more ;) */ /datum/element/series - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH // Detach for turfs id_arg_index = 2 var/list/subtype_list var/series_name diff --git a/code/datums/elements/simple_flying.dm b/code/datums/elements/simple_flying.dm index 6b991998e388..263942b7a5e3 100644 --- a/code/datums/elements/simple_flying.dm +++ b/code/datums/elements/simple_flying.dm @@ -5,7 +5,6 @@ * Note: works for carbons and above, but please do something better. humans have wings got dangit! */ /datum/element/simple_flying - element_flags = ELEMENT_DETACH /datum/element/simple_flying/Attach(datum/target) . = ..() diff --git a/code/datums/elements/skittish.dm b/code/datums/elements/skittish.dm index 2bb2bc61c56f..b3152224beec 100644 --- a/code/datums/elements/skittish.dm +++ b/code/datums/elements/skittish.dm @@ -3,7 +3,6 @@ */ /datum/element/skittish - element_flags = ELEMENT_DETACH /datum/element/skittish/Attach(datum/target) . = ..() diff --git a/code/datums/elements/soft_landing.dm b/code/datums/elements/soft_landing.dm index 56fedf6b3741..e1665f61bbdb 100644 --- a/code/datums/elements/soft_landing.dm +++ b/code/datums/elements/soft_landing.dm @@ -4,7 +4,7 @@ * Non bespoke element (1 in existence) that makes objs provide a soft landing when you fall on them! */ /datum/element/soft_landing - element_flags = ELEMENT_DETACH + element_flags = ELEMENT_DETACH // Detach for turfs /datum/element/soft_landing/Attach(datum/target) . = ..() diff --git a/code/datums/elements/spooky.dm b/code/datums/elements/spooky.dm index 3a6115a8147a..8d21b925b9b4 100644 --- a/code/datums/elements/spooky.dm +++ b/code/datums/elements/spooky.dm @@ -1,5 +1,5 @@ /datum/element/spooky - element_flags = ELEMENT_DETACH|ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE id_arg_index = 2 var/too_spooky = TRUE //will it spawn a new instrument? diff --git a/code/datums/elements/tenacious.dm b/code/datums/elements/tenacious.dm index feb74a579d7b..4d906812c13a 100644 --- a/code/datums/elements/tenacious.dm +++ b/code/datums/elements/tenacious.dm @@ -4,7 +4,6 @@ * Used by sparring sect! */ /datum/element/tenacious - element_flags = ELEMENT_DETACH /datum/element/tenacious/Attach(datum/target) . = ..() diff --git a/code/datums/elements/venomous.dm b/code/datums/elements/venomous.dm index a0e92f2feb9b..a1b5fc763739 100644 --- a/code/datums/elements/venomous.dm +++ b/code/datums/elements/venomous.dm @@ -4,7 +4,7 @@ * Used for spiders and bees! */ /datum/element/venomous - element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + element_flags = ELEMENT_BESPOKE id_arg_index = 2 ///Path of the reagent added var/poison_type diff --git a/code/datums/elements/wall_engraver.dm b/code/datums/elements/wall_engraver.dm index c3ca321430f4..c25d2631a34d 100644 --- a/code/datums/elements/wall_engraver.dm +++ b/code/datums/elements/wall_engraver.dm @@ -1,6 +1,5 @@ /// An element that lets you engrave walls when right click is used /datum/element/wall_engraver - element_flags = ELEMENT_DETACH /datum/element/wall_engraver/Attach(datum/target) . = ..() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 83b7e9a61dd4..05d4dc49b0ad 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -318,7 +318,9 @@ check_exit = null orbiters = null // The component is attached to us normaly and will be deleted elsewhere - LAZYCLEARLIST(overlays) + if(length(overlays)) + overlays.Cut() + LAZYNULL(managed_overlays) QDEL_NULL(light) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index e025b54c8b92..0fb778adbada 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -200,7 +200,8 @@ vis_locs = null //clears this atom out of all viscontents - vis_contents.Cut() + if(length(vis_contents)) + vis_contents.Cut() /atom/movable/proc/update_emissive_block() if(!blocks_emissive) diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index cc7adfd11cc9..5119b17c284d 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -56,17 +56,15 @@ /obj/machinery/camera/autoname/LateInitialize() . = ..() - number = 1 - var/area/A = get_area(src) - if(A) - for(var/obj/machinery/camera/autoname/C in GLOB.machines) - if(C == src) - continue - var/area/CA = get_area(C) - if(CA.type == A.type) - if(C.number) - number = max(number, C.number+1) - c_tag = "[strip_improper(A.name)] #[number]" //...How long was this a bug????? + + var/static/list/autonames_in_areas = list() + + var/area/camera_area = get_area(src) + + number = autonames_in_areas[camera_area] + 1 + autonames_in_areas[camera_area] = number + + c_tag = "[format_text(camera_area.name)] #[number]" // UPGRADE PROCS diff --git a/code/game/machinery/computer/chef_orders/chef_order.dm b/code/game/machinery/computer/chef_orders/chef_order.dm index 9b1fec4fcabe..09c0e062f29e 100644 --- a/code/game/machinery/computer/chef_orders/chef_order.dm +++ b/code/game/machinery/computer/chef_orders/chef_order.dm @@ -114,7 +114,7 @@ var/list/ordered_paths = list() for(var/datum/orderable_item/item as anything in grocery_list)//every order for(var/amt in 1 to grocery_list[item])//every order amount - ordered_paths += item.item_instance.type + ordered_paths += item.item_path podspawn(list( "target" = get_turf(chef), "style" = STYLE_BLUESPACE, diff --git a/code/game/machinery/computer/chef_orders/order_datum.dm b/code/game/machinery/computer/chef_orders/order_datum.dm index c0743f08074a..32f097340aaa 100644 --- a/code/game/machinery/computer/chef_orders/order_datum.dm +++ b/code/game/machinery/computer/chef_orders/order_datum.dm @@ -9,212 +9,207 @@ //description set automatically unless it's hard set by the subtype var/desc var/category_index = CATEGORY_FRUITS_VEGGIES - var/obj/item/item_instance + var/obj/item/item_path var/cost_per_order = 10 /datum/orderable_item/New() . = ..() if(type == /datum/orderable_item) return - if(!item_instance) + if(!item_path) CRASH("[type] orderable item datum has NO ITEM PATH!") - item_instance = new item_instance if(!desc) - desc = item_instance.desc - -/datum/orderable_item/Destroy(force, ...) - . = ..() - qdel(item_instance) + desc = initial(item_path.desc) //Fruits and Veggies /datum/orderable_item/potato name = "Potato" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/potato + item_path = /obj/item/food/grown/potato /datum/orderable_item/tomato name = "Tomato" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/tomato + item_path = /obj/item/food/grown/tomato /datum/orderable_item/carrot name = "Carrot" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/carrot + item_path = /obj/item/food/grown/carrot /datum/orderable_item/eggplant name = "Eggplant" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/eggplant + item_path = /obj/item/food/grown/eggplant /datum/orderable_item/mushroom name = "Plump Helmet" desc = "Plumus Hellmus: Plump, soft and s-so inviting~" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/mushroom/plumphelmet + item_path = /obj/item/food/grown/mushroom/plumphelmet /datum/orderable_item/cabbage name = "Cabbage" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/cabbage + item_path = /obj/item/food/grown/cabbage /datum/orderable_item/beets name = "Onion" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/onion + item_path = /obj/item/food/grown/onion /datum/orderable_item/apple name = "Apple" category_index = CATEGORY_FRUITS_VEGGIES - item_instance =/obj/item/food/grown/apple + item_path =/obj/item/food/grown/apple /datum/orderable_item/pumpkin name = "Pumpkin" category_index = CATEGORY_FRUITS_VEGGIES - item_instance =/obj/item/food/grown/pumpkin + item_path =/obj/item/food/grown/pumpkin /datum/orderable_item/watermelon name = "Watermelon" category_index = CATEGORY_FRUITS_VEGGIES - item_instance =/obj/item/food/grown/watermelon + item_path =/obj/item/food/grown/watermelon /datum/orderable_item/corn name = "Corn" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/corn + item_path = /obj/item/food/grown/corn /datum/orderable_item/soybean name = "Soybeans" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/soybeans + item_path = /obj/item/food/grown/soybeans /datum/orderable_item/garlic name = "Garlic" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/garlic + item_path = /obj/item/food/grown/garlic /datum/orderable_item/cherries name = "Cherries" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/cherries + item_path = /obj/item/food/grown/cherries /datum/orderable_item/chanterelle name = "Chanterelle" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/mushroom/chanterelle + item_path = /obj/item/food/grown/mushroom/chanterelle /datum/orderable_item/cocoa name = "Cocoa" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/cocoapod + item_path = /obj/item/food/grown/cocoapod /datum/orderable_item/herbs name = "Bundle of Herbs" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/herbs + item_path = /obj/item/food/grown/herbs cost_per_order = 5 /datum/orderable_item/bell_pepper name = "Bell Pepper" category_index = CATEGORY_FRUITS_VEGGIES - item_instance = /obj/item/food/grown/bell_pepper + item_path = /obj/item/food/grown/bell_pepper //Milk and Eggs /datum/orderable_item/milk name = "Milk" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/reagent_containers/food/condiment/milk + item_path = /obj/item/reagent_containers/food/condiment/milk cost_per_order = 30 /datum/orderable_item/soymilk name = "Soy Milk" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/reagent_containers/food/condiment/soymilk + item_path = /obj/item/reagent_containers/food/condiment/soymilk cost_per_order = 30 /datum/orderable_item/cream name = "Cream" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/reagent_containers/food/drinks/bottle/cream + item_path = /obj/item/reagent_containers/food/drinks/bottle/cream cost_per_order = 40 /datum/orderable_item/yoghurt name = "Yoghurt" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/reagent_containers/food/condiment/yoghurt + item_path = /obj/item/reagent_containers/food/condiment/yoghurt cost_per_order = 40 /datum/orderable_item/eggs name = "Egg Carton" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/storage/fancy/egg_box + item_path = /obj/item/storage/fancy/egg_box cost_per_order = 40 /datum/orderable_item/fillet name = "Fish Fillet" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/fishmeat + item_path = /obj/item/food/fishmeat cost_per_order = 12 /datum/orderable_item/spider_eggs name = "Spider Eggs" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/spidereggs + item_path = /obj/item/food/spidereggs /datum/orderable_item/moonfish_eggs name = "Moonfish Eggs" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/moonfish_eggs + item_path = /obj/item/food/moonfish_eggs cost_per_order = 30 /datum/orderable_item/desert_snails name = "Canned Desert Snails" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/desert_snails + item_path = /obj/item/food/desert_snails cost_per_order = 20 /datum/orderable_item/canned_jellyfish name = "Canned Gunner Jellyfish" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/canned_jellyfish + item_path = /obj/item/food/canned_jellyfish cost_per_order = 20 /datum/orderable_item/canned_larvae name = "Canned Larvae" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/larvae + item_path = /obj/item/food/larvae cost_per_order = 20 /datum/orderable_item/canned_tomatoes name = "Canned San Marzano Tomatoes" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/canned/tomatoes + item_path = /obj/item/food/canned/tomatoes cost_per_order = 30 /datum/orderable_item/canned_pine_nuts name = "Canned Pine Nuts" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/canned/pine_nuts + item_path = /obj/item/food/canned/pine_nuts cost_per_order = 20 /datum/orderable_item/ready_donk name = "Ready-Donk Meal: Bachelor Chow" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/ready_donk + item_path = /obj/item/food/ready_donk cost_per_order = 40 /datum/orderable_item/ready_donk_mac name = "Ready-Donk Meal: Donk-a-Roni" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/ready_donk/mac_n_cheese + item_path = /obj/item/food/ready_donk/mac_n_cheese cost_per_order = 40 /datum/orderable_item/ready_donk_mex name = "Ready-Donk Meal: Donkhiladas" category_index = CATEGORY_MILK_EGGS - item_instance = /obj/item/food/ready_donk/donkhiladas + item_path = /obj/item/food/ready_donk/donkhiladas cost_per_order = 40 //Reagents @@ -222,65 +217,65 @@ /datum/orderable_item/flour name = "Flour Sack" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/flour + item_path = /obj/item/reagent_containers/food/condiment/flour cost_per_order = 30 /datum/orderable_item/sugar name = "Sugar Sack" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/sugar + item_path = /obj/item/reagent_containers/food/condiment/sugar cost_per_order = 30 /datum/orderable_item/rice name = "Rice Sack" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/rice + item_path = /obj/item/reagent_containers/food/condiment/rice cost_per_order = 30 /datum/orderable_item/cornmeal name = "Cornmeal Box" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/cornmeal + item_path = /obj/item/reagent_containers/food/condiment/cornmeal cost_per_order = 30 /datum/orderable_item/enzyme name = "Universal Enzyme" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/enzyme + item_path = /obj/item/reagent_containers/food/condiment/enzyme cost_per_order = 40 /datum/orderable_item/salt name = "Salt Shaker" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/saltshaker + item_path = /obj/item/reagent_containers/food/condiment/saltshaker cost_per_order = 15 /datum/orderable_item/pepper name = "Pepper Mill" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/peppermill + item_path = /obj/item/reagent_containers/food/condiment/peppermill cost_per_order = 15 /datum/orderable_item/soysauce name = "Soy Sauce" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/soysauce + item_path = /obj/item/reagent_containers/food/condiment/soysauce cost_per_order = 15 /datum/orderable_item/bbqsauce name = "BBQ Sauce" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/bbqsauce + item_path = /obj/item/reagent_containers/food/condiment/bbqsauce cost_per_order = 60 /datum/orderable_item/vinegar name = "Vinegar" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/vinegar + item_path = /obj/item/reagent_containers/food/condiment/vinegar cost_per_order = 30 /datum/orderable_item/quality_oil name = "Quality Oil" category_index = CATEGORY_SAUCES_REAGENTS - item_instance = /obj/item/reagent_containers/food/condiment/quality_oil + item_path = /obj/item/reagent_containers/food/condiment/quality_oil cost_per_order = 120 //Extra Virgin, just like you, the reader diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index d7466e01986a..617774486cd8 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -25,7 +25,6 @@ var/shards = 2 var/rods = 2 var/cable = 1 - var/list/debris = list() /obj/machinery/door/window/Initialize(mapload, set_dir, unres_sides) . = ..() @@ -35,12 +34,6 @@ if(LAZYLEN(req_access)) icon_state = "[icon_state]" base_state = icon_state - for(var/i in 1 to shards) - debris += new /obj/item/shard(src) - if(rods) - debris += new /obj/item/stack/rods(src, rods) - if(cable) - debris += new /obj/item/stack/cable_coil(src, cable) if(unres_sides) //remove unres_sides from directions it can't be bumped from @@ -60,7 +53,6 @@ /obj/machinery/door/window/Destroy() set_density(FALSE) - QDEL_LIST(debris) if(atom_integrity == 0) playsound(src, SFX_SHATTER, 70, TRUE) electronics = null @@ -244,12 +236,18 @@ /obj/machinery/door/window/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1) && !disassembled) - for(var/obj/fragment in debris) - fragment.forceMove(get_turf(src)) - transfer_fingerprints_to(fragment) - debris -= fragment + for(var/i in 1 to shards) + drop_debris(new /obj/item/shard(src)) + if(rods) + drop_debris(new /obj/item/stack/rods(src, rods)) + if(cable) + drop_debris(new /obj/item/stack/cable_coil(src, cable)) qdel(src) +/obj/machinery/door/window/proc/drop_debris(obj/item/debris) + debris.forceMove(loc) + transfer_fingerprints_to(debris) + /obj/machinery/door/window/narsie_act() add_atom_colour("#7D1919", FIXED_COLOUR_PRIORITY) diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index eced35e44cf7..f204e09e60b8 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -53,7 +53,7 @@ if(A.idSelf == idSelf) controller = A break - for(var/obj/machinery/door/airlock/I in GLOB.machines) + for(var/obj/machinery/door/airlock/I in GLOB.airlocks) if(I.id_tag == idDoor) door = I break @@ -240,7 +240,7 @@ lostPower = FALSE /obj/machinery/door_buttons/airlock_controller/findObjsByTag() - for(var/obj/machinery/door/airlock/A in GLOB.machines) + for(var/obj/machinery/door/airlock/A in GLOB.airlocks) if(A.id_tag == idInterior) interiorAirlock = A else if(A.id_tag == idExterior) diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index e4d24050a798..c11004db4f50 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -31,7 +31,7 @@ var/jackpots = 0 var/paymode = HOLOCHIP //toggles between HOLOCHIP/COIN, defined above var/cointype = /obj/item/coin/iron //default cointype - var/list/coinvalues = list() + var/static/list/coinvalues = list() var/list/reels = list(list("", "", "") = 0, list("", "", "") = 0, list("", "", "") = 0, list("", "", "") = 0, list("", "", "") = 0) var/list/symbols = list(SEVEN = 1, "&" = 2, "@" = 2, "$" = 2, "?" = 2, "#" = 2, "!" = 2, "%" = 2) //if people are winning too much, multiply every number in this list by 2 and see if they are still winning too much. @@ -49,10 +49,13 @@ INVOKE_ASYNC(src, PROC_REF(toggle_reel_spin), FALSE) - for(cointype in typesof(/obj/item/coin)) - var/obj/item/coin/C = new cointype - coinvalues["[cointype]"] = C.get_item_credit_value() - qdel(C) //Sigh + if (isnull(coinvalues)) + coinvalues = list() + + for(cointype in typesof(/obj/item/coin)) + var/obj/item/coin/C = new cointype + coinvalues["[cointype]"] = C.get_item_credit_value() + qdel(C) //Sigh /obj/machinery/computer/slot_machine/Destroy() if(balance) diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 59e6a23eebdc..fbeddd92f940 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -111,8 +111,9 @@ GLOBAL_LIST_EMPTY(telecomms_list) /obj/machinery/telecomms/LateInitialize() ..() - for(var/obj/machinery/telecomms/T in (long_range_link ? GLOB.telecomms_list : urange(20, src, 1))) - add_automatic_link(T) + for(var/obj/machinery/telecomms/telecomms_machine in GLOB.telecomms_list) + if (long_range_link || IN_GIVEN_RANGE(src, telecomms_machine, 20)) + add_automatic_link(telecomms_machine) /obj/machinery/telecomms/Destroy() GLOB.telecomms_list -= src diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index 168b3375d8b5..e4e450ce7271 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -24,8 +24,6 @@ /obj/structure/chair/Initialize(mapload) . = ..() - if(!anchored) //why would you put these on the shuttle? - addtimer(CALLBACK(src, PROC_REF(RemoveFromLatejoin)), 0) if(prob(0.2)) name = "tactical [name]" MakeRotate() @@ -35,11 +33,8 @@ AddComponent(/datum/component/simple_rotation, ROTATION_IGNORE_ANCHORED|ROTATION_GHOSTS_ALLOWED) /obj/structure/chair/Destroy() - RemoveFromLatejoin() - return ..() - -/obj/structure/chair/proc/RemoveFromLatejoin() SSjob.latejoin_trackers -= src //These may be here due to the arrivals shuttle + return ..() /obj/structure/chair/deconstruct(disassembled) // If we have materials, and don't have the NOCONSTRUCT flag diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index c8ce2e31866f..3d1223fec947 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -136,7 +136,9 @@ for(var/cardinal in GLOB.cardinals) var/turf/step_turf = get_step(src, cardinal) - if(!can_area_smooth(step_turf)) + var/can_area_smooth + CAN_AREAS_SMOOTH(src, step_turf, can_area_smooth) + if(isnull(can_area_smooth)) continue for(var/atom/movable/movable_thing as anything in step_turf) if(neighbor_typecache[movable_thing.type]) diff --git a/code/game/objects/structures/low_wall.dm b/code/game/objects/structures/low_wall.dm index bfda866aa231..5465055fcc0a 100644 --- a/code/game/objects/structures/low_wall.dm +++ b/code/game/objects/structures/low_wall.dm @@ -75,7 +75,9 @@ var/obj/structure/low_wall/neighbor = locate() in step_turf if(neighbor) continue - if(!can_area_smooth(step_turf)) + var/can_area_smooth + CAN_AREAS_SMOOTH(src, step_turf, can_area_smooth) + if(isnull(can_area_smooth)) continue for(var/atom/movable/movable_thing as anything in step_turf) if(airlock_typecache[movable_thing.type]) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 40f76c4b68f2..b929aa597c7f 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -65,7 +65,6 @@ zas_update_loc() - if(fulltile) setDir() diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm index 5216766a5952..e8d270dca87a 100644 --- a/code/game/turfs/closed/minerals.dm +++ b/code/game/turfs/closed/minerals.dm @@ -1,11 +1,11 @@ #define MINING_MESSAGE_COOLDOWN 20 - /**********************Mineral deposits**************************/ /turf/closed/mineral //wall piece name = "rock" - icon = 'icons/turf/mining.dmi' + icon = MAP_SWITCH('icons/turf/smoothrocks.dmi', 'icons/turf/mining.dmi') icon_state = "rock" + smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER smoothing_groups = SMOOTH_GROUP_CLOSED_TURFS + SMOOTH_GROUP_MINERAL_WALLS canSmoothWith = SMOOTH_GROUP_MINERAL_WALLS @@ -15,13 +15,12 @@ density = TRUE base_icon_state = "smoothrocks" temperature = TCMB - base_pixel_x = -4 - base_pixel_y = -4 - /* Here as a note: these are set in Initialize for the purposes of the map viewer - pixel_y = -4 - pixel_x = -4 - */ - var/smooth_icon = 'icons/turf/smoothrocks.dmi' + + // This is static + // Done like this to avoid needing to make it dynamic and save cpu time + // 4 to the left, 4 down + transform = MAP_SWITCH(TRANSLATE_MATRIX(-4, -4), matrix()) + var/turf/open/floor/plating/turf_type = /turf/open/misc/asteroid/airless var/obj/item/stack/ore/mineralType = null var/mineralAmt = 3 @@ -87,13 +86,6 @@ if(uses_integrity) atom_integrity = max_integrity - /// UNIQUE MINERAL BEHAVIOR - icon = smooth_icon - pixel_x = -4 - pixel_y = -4 - var/static/list/behaviors = list(TOOL_MINING) - ///END MINERAL BEHAVIOR - return INITIALIZE_HINT_NORMAL // Inlined version of the bump click element. way faster this way, the element's nice but it's too much overhead @@ -327,8 +319,7 @@ /turf/closed/mineral/random/snow name = "snowy mountainside" - icon = 'icons/turf/mining.dmi' - smooth_icon = 'icons/turf/walls/legacy/mountain_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/mountain_wall.dmi', 'icons/turf/mining.dmi') icon_state = "mountainrock" base_icon_state = "mountain_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER @@ -342,7 +333,6 @@ /turf/closed/mineral/random/snow/Change_Ore(ore_type, random = 0) . = ..() if(mineralType) - smooth_icon = 'icons/turf/walls/legacy/icerock_wall.dmi' icon = 'icons/turf/walls/legacy/icerock_wall.dmi' icon_state = "icerock_wall-0" base_icon_state = "icerock_wall" @@ -388,8 +378,7 @@ // Subtypes for mappers placing ores manually. /turf/closed/mineral/random/labormineral/ice name = "snowy mountainside" - icon = 'icons/turf/mining.dmi' - smooth_icon = 'icons/turf/walls/legacy/mountain_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/mountain_wall.dmi', 'icons/turf/mining.dmi') icon_state = "mountainrock" base_icon_state = "mountain_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER @@ -407,7 +396,6 @@ /turf/closed/mineral/random/labormineral/ice/Change_Ore(ore_type, random = 0) . = ..() if(mineralType) - smooth_icon = 'icons/turf/walls/legacy/icerock_wall.dmi' icon = 'icons/turf/walls/legacy/icerock_wall.dmi' icon_state = "icerock_wall-0" base_icon_state = "icerock_wall" @@ -419,7 +407,7 @@ /turf/closed/mineral/iron/ice icon_state = "icerock_iron" - smooth_icon = 'icons/turf/walls/legacy/icerock_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/icerock_wall.dmi', 'icons/turf/mining.dmi') base_icon_state = "icerock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER turf_type = /turf/open/misc/asteroid/snow/ice @@ -437,7 +425,7 @@ /turf/closed/mineral/diamond/ice icon_state = "icerock_iron" - smooth_icon = 'icons/turf/walls/legacy/icerock_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/icerock_wall.dmi', 'icons/turf/mining.dmi') base_icon_state = "icerock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER turf_type = /turf/open/misc/asteroid/snow/ice @@ -474,7 +462,7 @@ /turf/closed/mineral/plasma/ice icon_state = "icerock_plasma" - smooth_icon = 'icons/turf/walls/legacy/icerock_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/icerock_wall.dmi', 'icons/turf/mining.dmi') base_icon_state = "icerock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER turf_type = /turf/open/misc/asteroid/snow/ice @@ -510,8 +498,7 @@ /turf/closed/mineral/ash_rock //wall piece name = "rock" - icon = 'icons/turf/mining.dmi' - smooth_icon = 'icons/turf/walls/legacy/rock_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/rock_wall.dmi', 'icons/turf/mining.dmi') icon_state = "rock2" base_icon_state = "rock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER @@ -523,8 +510,7 @@ /turf/closed/mineral/snowmountain name = "snowy mountainside" - icon = 'icons/turf/mining.dmi' - smooth_icon = 'icons/turf/walls/legacy/mountain_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/mountain_wall.dmi', 'icons/turf/mining.dmi') icon_state = "mountainrock" base_icon_state = "mountain_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER @@ -541,8 +527,7 @@ /turf/closed/mineral/snowmountain/cavern name = "ice cavern rock" - icon = 'icons/turf/mining.dmi' - smooth_icon = 'icons/turf/walls/legacy/icerock_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/icerock_wall.dmi', 'icons/turf/mining.dmi') icon_state = "icerock" base_icon_state = "icerock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER @@ -558,15 +543,13 @@ /turf/closed/mineral/asteroid name = "iron rock" - icon = 'icons/turf/mining.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/red_wall.dmi', 'icons/turf/mining.dmi') icon_state = "redrock" - smooth_icon = 'icons/turf/walls/legacy/red_wall.dmi' base_icon_state = "red_wall" /turf/closed/mineral/random/stationside/asteroid name = "iron rock" - icon = 'icons/turf/mining.dmi' - smooth_icon = 'icons/turf/walls/legacy/red_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/red_wall.dmi', 'icons/turf/mining.dmi') base_icon_state = "red_wall" /turf/closed/mineral/random/stationside/asteroid/porus @@ -679,7 +662,7 @@ /turf/closed/mineral/gibtonite/ice icon_state = "icerock_Gibtonite" - smooth_icon = 'icons/turf/walls/legacy/icerock_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/icerock_wall.dmi', 'icons/turf/mining.dmi') base_icon_state = "icerock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER turf_type = /turf/open/misc/asteroid/snow/ice @@ -699,7 +682,7 @@ baseturfs = /turf/open/misc/asteroid/basalt/lava_land_surface initial_gas = LAVALAND_DEFAULT_ATMOS defer_change = 1 - smooth_icon = 'icons/turf/walls/legacy/rock_wall.dmi' + icon = MAP_SWITCH('icons/turf/walls/legacy/rock_wall.dmi', 'icons/turf/mining.dmi') base_icon_state = "rock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER diff --git a/code/game/turfs/closed/walls.dm b/code/game/turfs/closed/walls.dm index 8e00e5bb494a..327a45970e5d 100644 --- a/code/game/turfs/closed/walls.dm +++ b/code/game/turfs/closed/walls.dm @@ -113,7 +113,9 @@ GLOBAL_REAL_VAR(wall_overlays_cache) = list() var/neighbor_stripe = NONE for (var/cardinal = NORTH; cardinal <= WEST; cardinal *= 2) //No list copy please good sir var/turf/step_turf = get_step(src, cardinal) - if(!can_area_smooth(step_turf)) + var/can_area_smooth + CAN_AREAS_SMOOTH(src, step_turf, can_area_smooth) + if(isnull(can_area_smooth)) continue for(var/atom/movable/movable_thing as anything in step_turf) if(global.neighbor_typecache[movable_thing.type]) diff --git a/code/modules/asset_cache/assets/research_designs.dm b/code/modules/asset_cache/assets/research_designs.dm index 506c3d50d9f1..7768875fa658 100644 --- a/code/modules/asset_cache/assets/research_designs.dm +++ b/code/modules/asset_cache/assets/research_designs.dm @@ -25,9 +25,11 @@ icon_file = initial(item.icon) icon_state = initial(item.icon_state) + #ifdef UNIT_TESTS if(!icon_exists(icon_file, icon_state, FALSE)) warning("design [D] with icon '[icon_file]' missing state '[icon_state]'") continue + #endif I = icon(icon_file, icon_state, SOUTH) Insert(initial(D.id), I) diff --git a/code/modules/asset_cache/assets/vending.dm b/code/modules/asset_cache/assets/vending.dm index 87fddfc1132c..01a6afcf5247 100644 --- a/code/modules/asset_cache/assets/vending.dm +++ b/code/modules/asset_cache/assets/vending.dm @@ -13,23 +13,25 @@ else icon_file = initial(item.icon) var/icon_state = initial(item.icon_state) - var/icon/I + #ifdef UNIT_TESTS var/icon_states_list = icon_states(icon_file) - if(icon_state in icon_states_list) - I = icon(icon_file, icon_state, SOUTH) - var/c = initial(item.color) - if (!isnull(c) && c != "#FFFFFF") - I.Blend(c, ICON_MULTIPLY) - else + if (!(icon_state in icon_states_list)) var/icon_states_string for (var/an_icon_state in icon_states_list) if (!icon_states_string) icon_states_string = "[json_encode(an_icon_state)](\ref[an_icon_state])" else icon_states_string += ", [json_encode(an_icon_state)](\ref[an_icon_state])" + stack_trace("[item] does not have a valid icon state, icon=[icon_file], icon_state=[json_encode(icon_state)](\ref[icon_state]), icon_states=[icon_states_string]") - I = icon('icons/turf/floors.dmi', "", SOUTH) + continue + #endif + + var/icon/I = icon(icon_file, icon_state, SOUTH) + var/c = initial(item.color) + if (!isnull(c) && c != "#FFFFFF") + I.Blend(c, ICON_MULTIPLY) var/imgid = replacetext(replacetext("[item]", "/obj/item/", ""), "/", "-") diff --git a/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm b/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm index 34295dff1563..62dcb06fccc4 100644 --- a/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm +++ b/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm @@ -57,7 +57,7 @@ color = "#B5651D" turf_type = /turf/open/misc/asteroid/basalt/wasteland baseturfs = /turf/open/misc/asteroid/basalt/wasteland - smooth_icon = 'icons/turf/walls/legacy/rock_wall.dmi' + icon = 'icons/turf/walls/legacy/rock_wall.dmi' base_icon_state = "rock_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_BORDER diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index 4916464a4fe7..659e2a906414 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -48,7 +48,7 @@ ///Whether the gun will spawn loaded with a magazine var/spawnwithmagazine = TRUE ///Compatible magazines with the gun - var/mag_type = /obj/item/ammo_box/magazine/m10mm //Removes the need for max_ammo and caliber info + var/obj/item/ammo_box/magazine/mag_type = /obj/item/ammo_box/magazine/m10mm //Removes the need for max_ammo and caliber info ///Whether the sprite has a visible magazine or not var/mag_display = TRUE ///Whether the sprite has a visible ammo display or not @@ -145,9 +145,11 @@ return ..() /obj/item/gun/ballistic/fire_sounds() - var/frequency_to_use = sin((90/magazine?.max_ammo) * get_ammo()) + var/max_ammo = magazine?.max_ammo || initial(mag_type.max_ammo) + var/current_ammo = get_ammo() + var/frequency_to_use = sin((90 / max_ammo) * current_ammo) var/click_frequency_to_use = 1 - frequency_to_use * 0.75 - var/play_click = round(sqrt(magazine?.max_ammo * 2)) > get_ammo() + var/play_click = round(sqrt(max_ammo * 2)) > get_ammo() if(suppressed) playsound(src, suppressed_sound, suppressed_volume, vary_fire_sound, ignore_walls = FALSE, extrarange = SILENCED_SOUND_EXTRARANGE, falloff_distance = 0) if(play_click) diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index beb0eedd77b6..d4a5ae4467c6 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -112,7 +112,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list( investigate_log("Chef's [SSshuttle.chef_groceries.len] sized produce order arrived. Cost was deducted from orderer, not cargo.", INVESTIGATE_CARGO) for(var/datum/orderable_item/item as anything in SSshuttle.chef_groceries)//every order for(var/amt in 1 to SSshuttle.chef_groceries[item])//every order amount - new item.item_instance.type(grocery_crate) + new item.item_path(grocery_crate) SSshuttle.chef_groceries.Cut() //This lets the console know it can order another round. if(!SSshuttle.shopping_list.len) diff --git a/code/modules/tables/tables_racks.dm b/code/modules/tables/tables_racks.dm index 1bcf7bd377bf..e4c6c842e20b 100644 --- a/code/modules/tables/tables_racks.dm +++ b/code/modules/tables/tables_racks.dm @@ -512,19 +512,7 @@ max_integrity = 70 resistance_flags = ACID_PROOF armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 80, ACID = 100) - var/list/debris = list() - -/obj/structure/table/glass/Initialize(mapload) - . = ..() - debris += new frame - if(buildstack == /obj/item/stack/sheet/plasmaglass) - debris += new /obj/item/shard/plasma - else - debris += new /obj/item/shard - -/obj/structure/table/glass/Destroy() - QDEL_LIST(debris) - . = ..() + var/glass_shard_type = /obj/item/shard /obj/structure/table/glass/CanAllowThrough(atom/movable/mover, border_dir) . = ..() @@ -560,18 +548,18 @@ if(M.has_gravity() && M.mob_size > MOB_SIZE_SMALL && !(M.movement_type & FLYING)) table_shatter(M) -/obj/structure/table/glass/proc/table_shatter(mob/living/L) +/obj/structure/table/glass/proc/table_shatter(mob/living/victim) visible_message(span_warning("[src] breaks!"), span_danger("You hear breaking glass.")) - var/turf/T = get_turf(src) - playsound(T, SFX_SHATTER, 50, TRUE) - for(var/I in debris) - var/atom/movable/AM = I - AM.forceMove(T) - debris -= AM - if(istype(AM, /obj/item/shard)) - AM.throw_impact(L) - L.Paralyze(100) + + playsound(loc, SFX_SHATTER, 50, TRUE) + + new frame(loc) + + var/obj/item/shard/shard = new glass_shard_type(loc) + shard.throw_impact(victim) + + victim.Paralyze(100) qdel(src) /obj/structure/table/glass/deconstruct(disassembled = TRUE, wrench_disassembly = 0) @@ -582,16 +570,13 @@ else var/turf/T = get_turf(src) playsound(T, SFX_SHATTER, 50, TRUE) - for(var/X in debris) - var/atom/movable/AM = X - AM.forceMove(T) - debris -= AM + new frame(loc) + var/obj/item/shard = new glass_shard_type(loc) + shard.color = color qdel(src) /obj/structure/table/glass/narsie_act() color = NARSIE_WINDOW_COLOUR - for(var/obj/item/shard/S in debris) - S.color = NARSIE_WINDOW_COLOUR /obj/structure/table/glass/plasmaglass name = "plasma glass table" @@ -602,6 +587,7 @@ custom_materials = list(/datum/material/alloy/plasmaglass = 2000) buildstack = /obj/item/stack/sheet/plasmaglass max_integrity = 100 + glass_shard_type = /obj/item/shard/plasma /* * Wooden tables diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 09488c9986ff..b494717a4319 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -87,6 +87,7 @@ #include "connect_loc.dm" #include "crayons.dm" #include "create_and_destroy.dm" +#include "dcs_get_id_from_elements.dm" #include "designs.dm" #include "dummy_spawn.dm" #include "dynamic_ruleset_sanity.dm" diff --git a/code/modules/unit_tests/dcs_get_id_from_elements.dm b/code/modules/unit_tests/dcs_get_id_from_elements.dm new file mode 100644 index 000000000000..3a6e1447657c --- /dev/null +++ b/code/modules/unit_tests/dcs_get_id_from_elements.dm @@ -0,0 +1,46 @@ +/// Tests that DCS' GetIdFromArguments works as expected with standard and odd cases +/datum/unit_test/dcs_get_id_from_arguments + +/datum/unit_test/dcs_get_id_from_arguments/Run() + assert_equal(list(1), list(1)) + assert_equal(list(1, 2), list(1, 2)) + assert_equal(list(src), list(src)) + + assert_equal( + list(a = "x", b = "y", c = "z"), + list(b = "y", a = "x", c = "z"), + list(c = "z", a = "x", b = "y"), + ) + + TEST_ASSERT_NOTEQUAL(get_id_from_arguments(list(1, 2)), get_id_from_arguments(list(2, 1)), "Swapped arguments should not return the same id") + TEST_ASSERT_NOTEQUAL(get_id_from_arguments(list(1, a = "x")), get_id_from_arguments(list(1)), "Named arguments were ignored when creating ids") + TEST_ASSERT_NOTEQUAL(get_id_from_arguments(list(1, a = "x")), get_id_from_arguments(list(a = "x")), "Unnamed arguments were ignored when creating ids") + TEST_ASSERT_NOTEQUAL(get_id_from_arguments(list(src)), get_id_from_arguments(list(world)), "References to different datums should not return the same id") + + TEST_ASSERT_NOTEQUAL(get_id_from_arguments(list()), SSdcs.GetIdFromArguments(list(/datum/element/dcs_get_id_from_arguments_mock_element2)), "Different elements should not match the same id") + +/datum/unit_test/dcs_get_id_from_arguments/proc/assert_equal(reference, ...) + var/result = get_id_from_arguments(reference) + + // Start at 1 so the 2nd argument is 2 + var/index = 1 + + for (var/other_case in args) + index += 1 + + var/other_result = get_id_from_arguments(other_case) + + if (other_result == result) + continue + + TEST_FAIL("Case #[index] produces a different GetIdFromArguments result from the first. [other_result] != [result]") + +/datum/unit_test/dcs_get_id_from_arguments/proc/get_id_from_arguments(list/arguments) + return SSdcs.GetIdFromArguments(list(/datum/element/dcs_get_id_from_arguments_mock_element) + arguments) + +// Necessary because GetIdFromArguments uses id_arg_index from an element type +/datum/element/dcs_get_id_from_arguments_mock_element + id_arg_index = 2 + +/datum/element/dcs_get_id_from_arguments_mock_element2 + id_arg_index = 2 diff --git a/code/modules/unit_tests/orderable_item_descriptions.dm b/code/modules/unit_tests/orderable_item_descriptions.dm new file mode 100644 index 000000000000..877824546c2e --- /dev/null +++ b/code/modules/unit_tests/orderable_item_descriptions.dm @@ -0,0 +1,16 @@ +/// Makes sure that no orderable items have dynamic descriptions, if they +/// don't explicitly set a description. +/datum/unit_test/orderable_item_descriptions + +/datum/unit_test/orderable_item_descriptions/Run() + for (var/datum/orderable_item/orderable_item as anything in subtypesof(/datum/orderable_item)) + if (!isnull(initial(orderable_item.desc))) + continue + + var/item_path = initial(orderable_item.item_path) + + var/obj/item/item_instance = new item_path + var/initial_desc = initial(item_instance.desc) + + if (item_instance.desc != initial_desc) + Fail("[orderable_item] has an item ([item_path]) that has a dynamic description. [item_instance.desc] (dynamic description) != [initial_desc] (initial description)") diff --git a/daedalus.dme b/daedalus.dme index 060cfcde24d9..92844ec67120 100644 --- a/daedalus.dme +++ b/daedalus.dme @@ -120,8 +120,10 @@ #include "code\__DEFINES\machines.dm" #include "code\__DEFINES\magic.dm" #include "code\__DEFINES\maps.dm" +#include "code\__DEFINES\mapswitch.dm" #include "code\__DEFINES\materials.dm" #include "code\__DEFINES\maths.dm" +#include "code\__DEFINES\matrices.dm" #include "code\__DEFINES\MC.dm" #include "code\__DEFINES\mecha.dm" #include "code\__DEFINES\mechcomp.dm"