diff --git a/.editorconfig b/.editorconfig index ad578927262d..2643d9b63442 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,3 +20,8 @@ indent_size = 4 indent_style = space indent_size = 2 +[*.txt] +end_of_line = crlf + +[*.md] +end_of_line = crlf diff --git a/.gitattributes b/.gitattributes index add01d675f96..e9d52dc929b5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,3 +12,5 @@ html/changelog.html merge=union # Declare files that will always have CRLF line endings on checkout. *.dm text eol=crlf *.dmm text eol=crlf +*.txt text eol=crlf +*.md text eol=crlf \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 414e78d92ae6..1c76565bc261 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,8 +15,8 @@ on: env: BYOND_MAJOR: "515" - BYOND_MINOR: "1643" - SPACEMAN_DMM_VERSION: suite-1.8 + BYOND_MINOR: "1647" + SPACEMAN_DMM_VERSION: suite-1.9 jobs: DreamChecker: @@ -26,7 +26,7 @@ jobs: - name: Setup Cache uses: actions/cache@v3 with: - path: $HOME/spaceman_dmm/$SPACEMAN_DMM_VERSION + path: ~/spaceman_dmm/${{ env.SPACEMAN_DMM_VERSION }} key: ${{ runner.os }}-spacemandmm-${{ env.SPACEMAN_DMM_VERSION }} - name: Install Dreamchecker run: scripts/install-spaceman-dmm.sh dreamchecker @@ -34,6 +34,7 @@ jobs: run: | set -o pipefail ~/dreamchecker 2>&1 | tee ${GITHUB_WORKSPACE}/output-annotations.txt + ./test/lint-all-modpacks.sh nebula.dme - name: Annotate Lints uses: yogstation13/DreamAnnotate@v2 if: always() @@ -74,7 +75,7 @@ jobs: - name: Setup Cache uses: actions/cache@v3 with: - path: $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} + path: ~/BYOND-${{ env.BYOND_MAJOR }}.${{ env.BYOND_MINOR }} key: ${{ runner.os }}-byond-${{ env.BYOND_MAJOR }}-${{ env.BYOND_MINOR }} - name: Install Dependencies run: sudo apt-get install -y uchardet @@ -103,7 +104,7 @@ jobs: - name: Setup Cache uses: actions/cache@v3 with: - path: $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} + path: ~/BYOND-${{ env.BYOND_MAJOR }}.${{ env.BYOND_MINOR }} key: ${{ runner.os }}-byond-${{ env.BYOND_MAJOR }}-${{ env.BYOND_MINOR }} - name: Run Tests env: diff --git a/code/___opendream_linting.dm b/code/___opendream_linting.dm index 446ad58ad57b..e9fe9369d681 100644 --- a/code/___opendream_linting.dm +++ b/code/___opendream_linting.dm @@ -1,6 +1,7 @@ #ifdef OPENDREAM //1000-1999 -#pragma FileAlreadyIncluded error +// FileAlreadyIncluded trips up on modpack DMEs +#pragma FileAlreadyIncluded disabled #pragma MissingIncludedFile error #pragma MisplacedDirective error #pragma UndefineMissingDirective error diff --git a/code/__defines/_planes+layers.dm b/code/__defines/_planes+layers.dm index 7e207ad9f5ea..a93d92514259 100644 --- a/code/__defines/_planes+layers.dm +++ b/code/__defines/_planes+layers.dm @@ -117,6 +117,7 @@ What is the naming convention for planes or layers? #define TABLE_LAYER TURF_OVER_EDGE_LAYER + 0.20 #define BELOW_OBJ_LAYER TURF_OVER_EDGE_LAYER + 0.21 #define STRUCTURE_LAYER TURF_OVER_EDGE_LAYER + 0.22 + #define ABOVE_STRUCTURE_LAYER TURF_OVER_EDGE_LAYER + 0.23 // OBJ_LAYER 3 #define ABOVE_OBJ_LAYER 3.01 #define CLOSED_DOOR_LAYER 3.02 diff --git a/code/__defines/backgrounds.dm b/code/__defines/backgrounds.dm index f9fbe1bb6efc..c24f9fa371fa 100644 --- a/code/__defines/backgrounds.dm +++ b/code/__defines/backgrounds.dm @@ -5,3 +5,15 @@ #define BACKGROUND_FLAG_LOCATION BITFLAG(4) #define BACKGROUND_FLAG_RESIDENCE BITFLAG(5) #define BACKGROUND_FLAG_HOMEWORLD BITFLAG(6) + +#ifdef UNIT_TEST +var/global/list/all_background_flags = list( + "BACKGROUND_FLAG_NAMING" = (BACKGROUND_FLAG_NAMING), + "BACKGROUND_FLAG_CITIZENSHIP" = (BACKGROUND_FLAG_CITIZENSHIP), + "BACKGROUND_FLAG_IDEOLOGY" = (BACKGROUND_FLAG_IDEOLOGY), + "BACKGROUND_FLAG_RELIGION" = (BACKGROUND_FLAG_RELIGION), + "BACKGROUND_FLAG_LOCATION" = (BACKGROUND_FLAG_LOCATION), + "BACKGROUND_FLAG_RESIDENCE" = (BACKGROUND_FLAG_RESIDENCE), + "BACKGROUND_FLAG_HOMEWORLD" = (BACKGROUND_FLAG_HOMEWORLD) +) +#endif \ No newline at end of file diff --git a/code/__defines/chemistry.dm b/code/__defines/chemistry.dm index 670021178c35..5e70c1e79047 100644 --- a/code/__defines/chemistry.dm +++ b/code/__defines/chemistry.dm @@ -81,12 +81,12 @@ #define REAGENT_LIST(R) (R.reagents?.get_reagents() || "No reagent holder") #define REAGENTS_FREE_SPACE(R) (R?.maximum_volume - R?.total_volume) -#define REAGENT_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.reagent_volumes && REAGENT_HOLDER.reagent_volumes[REAGENT_TYPE]) +#define REAGENT_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.reagent_volumes && REAGENT_HOLDER.reagent_volumes[RESOLVE_TO_DECL(REAGENT_TYPE)]) +#define LIQUID_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.liquid_volumes && REAGENT_HOLDER.liquid_volumes[RESOLVE_TO_DECL(REAGENT_TYPE)]) +#define SOLID_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.solid_volumes && REAGENT_HOLDER.solid_volumes[RESOLVE_TO_DECL(REAGENT_TYPE)]) +#define REAGENT_DATA(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.reagent_data && REAGENT_HOLDER.reagent_data[RESOLVE_TO_DECL(REAGENT_TYPE)]) -#define LIQUID_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.liquid_volumes && REAGENT_HOLDER.liquid_volumes[REAGENT_TYPE]) -#define SOLID_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.solid_volumes && REAGENT_HOLDER.solid_volumes[REAGENT_TYPE]) - -#define REAGENT_DATA(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.reagent_data && REAGENT_HOLDER.reagent_data[REAGENT_TYPE]) +#define CHEM_DOSE(M, R) LAZYACCESS(M._chem_doses, RESOLVE_TO_DECL(R)) #define MAT_SOLVENT_NONE 0 #define MAT_SOLVENT_MILD 1 diff --git a/code/__defines/colors.dm b/code/__defines/colors.dm index 7477331b43e5..cb5a5ee32bf1 100644 --- a/code/__defines/colors.dm +++ b/code/__defines/colors.dm @@ -236,3 +236,5 @@ var/global/list/telecomms_colours = list( #define COLOR_DARKMODE_TEXT "#a4bad6" #define COLORED_SQUARE(COLOR) "___" + +#define hsv(args...) rgb(args, space = COLORSPACE_HSV) \ No newline at end of file diff --git a/code/__defines/fluids.dm b/code/__defines/fluids.dm index 96ebc2a93398..926a89950e37 100644 --- a/code/__defines/fluids.dm +++ b/code/__defines/fluids.dm @@ -40,11 +40,11 @@ if(!QDELETED(TURF) && TURF._fluid_turf_is_active) { \ #define UPDATE_FLUID_BLOCKED_DIRS(TURF) \ if(isnull(TURF.fluid_blocked_dirs)) { \ TURF.fluid_blocked_dirs = 0; \ - for(var/obj/structure/window/W in TURF) { \ - if(W.density) TURF.fluid_blocked_dirs |= W.dir; \ + for(var/obj/structure/window/window in TURF) { \ + if(window.density) TURF.fluid_blocked_dirs |= window.dir; \ } \ - for(var/obj/machinery/door/window/D in TURF) { \ - if(D.density) TURF.fluid_blocked_dirs |= D.dir; \ + for(var/obj/machinery/door/window/windoor in TURF) { \ + if(windoor.density) TURF.fluid_blocked_dirs |= windoor.dir; \ } \ } diff --git a/code/__defines/hud.dm b/code/__defines/hud.dm index 3353b89d20ae..edd1ff5ea4d5 100644 --- a/code/__defines/hud.dm +++ b/code/__defines/hud.dm @@ -24,6 +24,7 @@ #define HUD_FIRE /decl/hud_element/fire #define HUD_CHARGE /decl/hud_element/charge #define HUD_ROBOT_MODULE /decl/hud_element/module_selection +#define HUD_MODIFIERS /decl/hud_element/modifiers #define GET_HUD_ALERT(M, A) ((istype(M?.hud_used, /datum/hud) && (A in M.hud_used.alerts)) ? M.hud_used.alerts[A] : 0) #define CLEAR_HUD_ALERTS(M) if(istype(M?.hud_used, /datum/hud) && M.hud_used.alerts) { M.hud_used.alerts = null; } diff --git a/code/__defines/items_clothing.dm b/code/__defines/items_clothing.dm index b2a5c347ddfd..ffd20f690f91 100644 --- a/code/__defines/items_clothing.dm +++ b/code/__defines/items_clothing.dm @@ -266,3 +266,10 @@ var/global/list/all_hand_slots = list( BP_R_HAND_UPPER, BP_MOUTH ) + +/// If this item conflicts with a loadout item, simply delete it. +#define LOADOUT_CONFLICT_DELETE 0 +/// If this item conflicts with a loadout item, place this item in storage. +#define LOADOUT_CONFLICT_STORAGE 1 +/// If this item conflicts with a loadout item, place THE LOADOUT ITEM in storage. +#define LOADOUT_CONFLICT_KEEP 2 \ No newline at end of file diff --git a/code/__defines/lighting.dm b/code/__defines/lighting.dm index c02fc243ba77..d9c934a0fb5f 100644 --- a/code/__defines/lighting.dm +++ b/code/__defines/lighting.dm @@ -10,7 +10,8 @@ #define LIGHTING_DARKNESS_ICON_STATE "black" // icon_state used for lighting overlays with no luminosity. #define LIGHTING_TRANSPARENT_ICON_STATE "blank" -#define LIGHTING_SOFT_THRESHOLD 0.001 // If the max of the lighting lumcounts of each spectrum drops below this, disable luminosity on the lighting overlays. +// This is purely used as a threshold for 'is this turf probably dark' to avoid floating point nonsense. +#define LIGHTING_SOFT_THRESHOLD 0.001 #define LIGHTING_BLOCKED_FACTOR 0.5 // How much the range of a directional light will be reduced while facing a wall. // If defined, instant updates will be used whenever server load permits. Otherwise queued updates are always used. @@ -20,6 +21,10 @@ #define TURF_IS_DYNAMICALLY_LIT_UNSAFE(T) ((T:dynamic_lighting && T:loc:dynamic_lighting)) #define TURF_IS_DYNAMICALLY_LIT(T) (isturf(T) && TURF_IS_DYNAMICALLY_LIT_UNSAFE(T)) +// Note: this does not imply the above, a turf can have ambient light without being dynamically lit. +#define TURF_IS_AMBIENT_LIT_UNSAFE(T) (T:ambient_active) +#define TURF_IS_AMBIENT_LIT(T) (isturf(T) && TURF_IS_AMBIENT_LIT_UNSAFE(T)) + // If I were you I'd leave this alone. #define LIGHTING_BASE_MATRIX \ list \ diff --git a/code/__defines/lists.dm b/code/__defines/lists.dm index b77ba2f90dc3..c29a24a164d7 100644 --- a/code/__defines/lists.dm +++ b/code/__defines/lists.dm @@ -4,7 +4,7 @@ // 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) +#define DEFAULTPICK(L, default) ((islist(L) && length(L)) ? pick(L) : default) //Supplies null as the default to DEFAULTPICK #define SAFEPICK(L) DEFAULTPICK(L, null) // Ensures L is initailized after this point diff --git a/code/__defines/machinery.dm b/code/__defines/machinery.dm index b7018659403b..787488e127f9 100644 --- a/code/__defines/machinery.dm +++ b/code/__defines/machinery.dm @@ -4,9 +4,8 @@ var/global/defer_powernet_rebuild = 0 // True if net rebuild will be called #define MEGAWATTS *1000000 #define GIGAWATTS *1000000000 -#define MACHINERY_TICKRATE 2 // Tick rate for machinery in seconds. As it affects CELLRATE calculation it is kept as define here - -#define CELLRATE (1 / ( 3600 / MACHINERY_TICKRATE )) // Multiplier for charge units. Converts cell charge units(watthours) to joules. Takes into consideration that our machinery ticks once per two seconds. +/// Multiplier for charge units. Converts cell charge units(watthours) to joules. Takes into consideration that our machinery ticks once per two seconds. +#define CELLRATE (/datum/controller/subsystem/machines::wait / (1 HOUR)) // Doors! #define DOOR_CRUSH_DAMAGE 40 @@ -44,7 +43,7 @@ var/global/defer_powernet_rebuild = 0 // True if net rebuild will be called // Camera channels // Station channels #define CAMERA_CHANNEL_PUBLIC "Public" -#define CAMERA_CAMERA_CHANNEL_ENGINEERING "Engineering" +#define CAMERA_CHANNEL_ENGINEERING "Engineering" #define CAMERA_CHANNEL_MEDICAL "Medical" #define CAMERA_CHANNEL_RESEARCH "Research" #define CAMERA_CHANNEL_SECURITY "Security" diff --git a/code/__defines/maths.dm b/code/__defines/maths.dm index 0307b2952197..c24aac93d039 100644 --- a/code/__defines/maths.dm +++ b/code/__defines/maths.dm @@ -1,5 +1,5 @@ // Macro functions. -#define RAND_F(LOW, HIGH) (rand() * (HIGH - LOW) + LOW) +#define RAND_F(LOW, HIGH) (rand() * ((HIGH) - (LOW)) + (LOW)) // Float-aware floor and ceiling since round() will round upwards when given a second arg. #define NONUNIT_FLOOR(x, y) (floor((x) / (y)) * (y)) diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index 85583c6cedf8..a4e64c8e07dc 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -383,10 +383,22 @@ #define CRAYON_DRAW_ARROW "arrow" // Enum for results of is_space_movement_permitted() -#define SPACE_MOVE_SUPPORTED (-1) -#define SPACE_MOVE_FORBIDDEN 0 -#define SPACE_MOVE_PERMITTED 1 +// Note that it may also return an instance of /atom/movable, which acts as SPACE_MOVE_SUPPORTED. +#define SPACE_MOVE_SUPPORTED (-1) //! Mob should run space-slipping checks. +#define SPACE_MOVE_FORBIDDEN 0 //! Mob should begin spacedrift. +#define SPACE_MOVE_PERMITTED 1 //! Mob should stop/prevent spacedrift. // Default UI style applied to client prefs. #define DEFAULT_UI_STYLE /decl/ui_style/midnight +// Indicates a modifier will never expire. +#define MOB_MODIFIER_INDEFINITE (-1) + +// Indicators for attack checking proc. +#define MM_ATTACK_TYPE_WEAPON 0 +#define MM_ATTACK_TYPE_THROWN 1 +#define MM_ATTACK_TYPE_PROJECTILE 2 + +#define MM_ATTACK_RESULT_NONE 0 +#define MM_ATTACK_RESULT_DEFLECTED BITFLAG(0) +#define MM_ATTACK_RESULT_BLOCKED BITFLAG(1) diff --git a/code/__defines/mob_status.dm b/code/__defines/mob_status.dm index 42bc8854a7a4..238ac560411c 100644 --- a/code/__defines/mob_status.dm +++ b/code/__defines/mob_status.dm @@ -1,5 +1,5 @@ #define PENDING_STATUS(MOB, COND) (LAZYACCESS(MOB.pending_status_counters, COND) || LAZYACCESS(MOB.status_counters, COND)) #define GET_STATUS(MOB, COND) (LAZYACCESS(MOB.status_counters, COND)) #define HAS_STATUS(MOB, COND) (GET_STATUS(MOB, COND) > 0) -#define ADJ_STATUS(MOB, COND, AMT) (MOB.set_status(COND, PENDING_STATUS(MOB, COND) + AMT)) -#define SET_STATUS_MAX(MOB, COND, AMT) (MOB.set_status(COND, max(PENDING_STATUS(MOB, COND), AMT))) \ No newline at end of file +#define ADJ_STATUS(MOB, COND, AMT) (MOB.set_status_condition(COND, PENDING_STATUS(MOB, COND) + AMT)) +#define SET_STATUS_MAX(MOB, COND, AMT) (MOB.set_status_condition(COND, max(PENDING_STATUS(MOB, COND), AMT))) \ No newline at end of file diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index 00633e438b2f..55874616e038 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -3,7 +3,7 @@ #define UNCONSCIOUS 1 #define DEAD 2 -// Bitflags defining which status effects could be or are inflicted on a mob. +// Bitflags defining which status conditions could be or are inflicted on a mob. #define CANSTUN BITFLAG(0) #define CANWEAKEN BITFLAG(1) #define CANPARALYSE BITFLAG(2) @@ -246,6 +246,10 @@ #define DATA_BLOOD_DOSE_CHEM /decl/reagent_data_field/blood_dose_chem #define DATA_BLOOD_HAS_OXY /decl/reagent_data_field/blood_has_oxy +// Misc general data. +#define DATA_COOLDOWN_TIME /decl/reagent_data_field/cooldown_time +#define DATA_WATER_HOLINESS /decl/reagent_data_field/holy + //Used by show_message() and emotes #define VISIBLE_MESSAGE 1 #define AUDIBLE_MESSAGE 2 @@ -270,25 +274,11 @@ #define CORPSE_CAN_REENTER BITFLAG(0) #define CORPSE_CAN_RESPAWN BITFLAG(1) -#define SPECIES_HUMAN "Human" -#define SPECIES_MONKEY "Monkey" - #define SURGERY_CLOSED 0 #define SURGERY_OPEN 1 #define SURGERY_RETRACTED 2 #define SURGERY_ENCASED 3 -#define STASIS_MISC "misc" -#define STASIS_CRYOBAG "cryobag" -#define STASIS_COLD "cold" - -#define AURA_CANCEL 1 -#define AURA_FALSE 2 -#define AURA_TYPE_BULLET "Bullet" -#define AURA_TYPE_WEAPON "Weapon" -#define AURA_TYPE_THROWN "Thrown" -#define AURA_TYPE_LIFE "Life" - #define SPECIES_BLOOD_DEFAULT 560 #define SLIME_EVOLUTION_THRESHOLD 15 @@ -357,7 +347,10 @@ var/global/list/dexterity_levels = list( #define MOB_ICON_HAS_GIB_STATE BITFLAG(5) #define MOB_ICON_HAS_DUST_STATE BITFLAG(6) #define MOB_ICON_HAS_PARALYZED_STATE BITFLAG(7) + +// Additional pronoun sets. #define NEUTER_ANIMATE "animate singular neutral" +#define SECOND_PERSON_SINGULAR "second person singular" // Equipment Overlays Indices // #define HO_CONDITION_LAYER 1 @@ -387,7 +380,8 @@ var/global/list/dexterity_levels = list( #define HO_HANDCUFF_LAYER 25 #define HO_INHAND_LAYER 26 #define HO_FIRE_LAYER 27 //If you're on fire -#define TOTAL_OVER_LAYERS 27 +#define HO_EFFECT_LAYER 28 +#define TOTAL_OVER_LAYERS 28 ////////////////////////////////// // Underlay defines; vestigal implementation currently. diff --git a/code/__defines/observ.dm b/code/__defines/observ.dm index cada27347b25..1eeb9bf65d31 100644 --- a/code/__defines/observ.dm +++ b/code/__defines/observ.dm @@ -1,4 +1 @@ -// This also works, and removes the need for the _REPEAT variant, but the linter hates it: -// #define RAISE_EVENT(OBS, args...) (GET_DECL(OBS))?.raise_event(args); -#define RAISE_EVENT(OBS, args...) var/decl/observ/__event = GET_DECL(OBS); __event?.raise_event(args); -#define RAISE_EVENT_REPEAT(OBS, args...) __event = GET_DECL(OBS); __event?.raise_event(args); +#define RAISE_EVENT(OBS, args...) UNLINT((GET_DECL(OBS))?.raise_event(args)); diff --git a/code/__defines/reagent_data_fields.dm b/code/__defines/reagent_data_fields.dm index 0caef07d2252..04998150bd8d 100644 --- a/code/__defines/reagent_data_fields.dm +++ b/code/__defines/reagent_data_fields.dm @@ -62,3 +62,9 @@ /decl/reagent_data_field/blood_has_oxy uid = "rdf_blood_has_oxy" + +/decl/reagent_data_field/cooldown_time + uid = "rdf_cooldown_time" + +/decl/reagent_data_field/holy + uid = "rdf_water_holy" \ No newline at end of file diff --git a/code/__defines/subsystem-priority.dm b/code/__defines/subsystem-priority.dm index cd44840622aa..f0625f099a76 100644 --- a/code/__defines/subsystem-priority.dm +++ b/code/__defines/subsystem-priority.dm @@ -47,7 +47,6 @@ #define SS_PRIORITY_PROCESSING 95 // Generic datum processor. Replaces objects processor. #define SS_PRIORITY_PLANTS 90 // Plant processing, slow ticks. #define SS_PRIORITY_VINES 50 // Spreading vine effects. -#define SS_PRIORITY_PSYCHICS 45 // Psychic complexus processing. #define SS_PRIORITY_MOB_AI 45 // Mob AI logic; finding targets, attacking, etc. #define SS_PRIORITY_AUTO_MOVE 42 // Automated atom movement, fires much more frequently than MOB_AI. #define SS_PRIORITY_NANO 40 // Updates to nanoui uis. diff --git a/code/__defines/xenoarcheaology.dm b/code/__defines/xenoarcheaology.dm index 52667268b7d6..488ff4790670 100644 --- a/code/__defines/xenoarcheaology.dm +++ b/code/__defines/xenoarcheaology.dm @@ -1,16 +1,3 @@ #define XENOFIND_APPLY_PREFIX BITFLAG(0) #define XENOFIND_APPLY_DECOR BITFLAG(1) #define XENOFIND_REPLACE_ICON BITFLAG(2) - -#define EFFECT_TOUCH 0 -#define EFFECT_AURA 1 -#define EFFECT_PULSE 2 -#define MAX_EFFECT 2 - -#define EFFECT_UNKNOWN 0 -#define EFFECT_ENERGY 1 -#define EFFECT_PSIONIC 2 -#define EFFECT_ELECTRO 3 -#define EFFECT_PARTICLE 4 -#define EFFECT_ORGANIC 5 -#define EFFECT_SYNTH 6 \ No newline at end of file diff --git a/code/__globals.dm b/code/__globals.dm index 7c9e5ed5dbea..ecb9b3eb1fc1 100644 --- a/code/__globals.dm +++ b/code/__globals.dm @@ -1,6 +1,7 @@ // Defined here due to being used immediately below. #define GET_DECL(D) (ispath(D, /decl) ? (decls_repository.fetched_decls[D] || decls_repository.get_decl(D)) : null) #define IMPLIED_DECL GET_DECL(__IMPLIED_TYPE__) +#define RESOLVE_TO_DECL(D) (istype(D, /decl) ? D : GET_DECL(D)) // Defined here due to compile order; overrides in macros make the compiler complain. /decl/global_vars diff --git a/code/_global_vars/client.dm b/code/_global_vars/client.dm index 1a3545fed8d0..5a8b7f1b1c5c 100644 --- a/code/_global_vars/client.dm +++ b/code/_global_vars/client.dm @@ -1,6 +1,3 @@ -var/global/list/hotkey_keybinding_list_by_key = list() -var/global/list/keybindings_by_name = list() - // This is a mapping from JS keys to Byond - ref: https://keycode.info/ var/global/list/_kbMap = list( "UP" = "North", diff --git a/code/_global_vars/configuration.dm b/code/_global_vars/configuration.dm index c9347417bba6..377c65a2aa30 100644 --- a/code/_global_vars/configuration.dm +++ b/code/_global_vars/configuration.dm @@ -6,10 +6,6 @@ var/global/join_motd = null var/global/secret_force_mode = "secret" // if this is anything but "secret", the secret rotation will forceably choose this mode. -var/global/Debug2 = 0 - -var/global/gravity_is_on = 1 - // Database connections. A connection is established on world creation. // Ideally, the connection dies when the server restarts (After feedback logging.). var/global/DBConnection/dbcon // General-purpose record database. diff --git a/code/_global_vars/lists/flavor.dm b/code/_global_vars/lists/flavor.dm index b2096edc0a4f..80c11924a919 100644 --- a/code/_global_vars/lists/flavor.dm +++ b/code/_global_vars/lists/flavor.dm @@ -71,6 +71,8 @@ var/global/list/numbers_as_words = list("One", "Two", "Three", "Four", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen") +// This is, for some reason, used exclusively for headphones, jukeboxes, and boomboxes. +// It also seems to exist mostly for the purpose of allowing admins to upload their own songs to those at runtime? var/global/list/music_tracks = list( "Beyond" = /decl/music_track/ambispace, "Clouds of Fire" = /decl/music_track/clouds_of_fire, diff --git a/code/_global_vars/lists/jewellery.dm b/code/_global_vars/lists/jewellery.dm index 7364bff8b607..9ec4cded16c0 100644 --- a/code/_global_vars/lists/jewellery.dm +++ b/code/_global_vars/lists/jewellery.dm @@ -5,7 +5,7 @@ var/global/list/random_jewellery_material_types = list( /decl/material/solid/metal/platinum, /decl/material/solid/metal/steel, /decl/material/solid/organic/bone, - /decl/material/solid/organic/wood + /decl/material/solid/organic/wood/oak ) var/global/list/random_jewellery_gem_types = list( /obj/item/gemstone/baguette/topaz, diff --git a/code/_global_vars/lists/logs.dm b/code/_global_vars/lists/logs.dm index 44b16a6dbacb..8face994fe93 100644 --- a/code/_global_vars/lists/logs.dm +++ b/code/_global_vars/lists/logs.dm @@ -1,4 +1,3 @@ var/global/list/bombers = list() var/global/list/admin_log = list() -var/global/list/lastsignalers = list() // Keeps last 100 signals here in format: "[src] used \ref[src] @ location [src.loc]: [freq]/[code]" var/global/list/lawchanges = list() // Stores who uploaded laws to which silicon-based lifeform, and what the law was. diff --git a/code/_global_vars/lists/names.dm b/code/_global_vars/lists/names.dm index efb1b85ba2b3..78cd73fe25b0 100644 --- a/code/_global_vars/lists/names.dm +++ b/code/_global_vars/lists/names.dm @@ -1,28 +1,10 @@ // All variables here use double quotes to able load information on every startup. var/global/list/ai_names = file2list("config/names/ai.txt") -var/global/list/wizard_first = file2list("config/names/wizardfirst.txt") -var/global/list/wizard_second = file2list("config/names/wizardsecond.txt") var/global/list/verbs = file2list("config/names/verbs.txt") var/global/list/adjectives = file2list("config/names/adjectives.txt") -var/global/list/descriptive_slot_names = list( - slot_back_str = "Back", - slot_w_uniform_str = "Uniform", - slot_head_str = "Head", - slot_wear_suit_str = "Suit", - slot_l_ear_str = "Left Ear", - slot_r_ear_str = "Right Ear", - slot_belt_str = "Belt", - slot_shoes_str = "Shoes", - slot_wear_mask_str = "Mask", - slot_handcuffed_str = "Handcuffs", - slot_wear_id_str = "ID", - slot_gloves_str = "Gloves", - slot_glasses_str = "Glasses", - slot_l_store_str = "Left Pocket", - slot_r_store_str = "Right Pocket", - slot_s_store_str = "Suit Storage", +var/global/list/abstract_slot_names = list( slot_in_backpack_str = "In Backpack" ) diff --git a/code/_global_vars/lists/objects.dm b/code/_global_vars/lists/objects.dm index f6e27d7c419b..97d7e3490ce3 100644 --- a/code/_global_vars/lists/objects.dm +++ b/code/_global_vars/lists/objects.dm @@ -3,7 +3,6 @@ var/global/list/sec_hud_users = list() // List of all entities using a var/global/list/jani_hud_users = list() var/global/list/hud_icon_reference = list() var/global/list/listening_objects = list() // List of objects that need to be able to hear, used to avoid recursive searching through contents. -var/global/list/global_map = list() var/global/datum/universal_state/universe = new diff --git a/code/_global_vars/misc.dm b/code/_global_vars/misc.dm deleted file mode 100644 index 2ade2236e1a0..000000000000 --- a/code/_global_vars/misc.dm +++ /dev/null @@ -1 +0,0 @@ -var/global/list/all_observable_events = list() \ No newline at end of file diff --git a/code/_global_vars/sound.dm b/code/_global_vars/sound.dm index 9525f1b0b2b3..bab80ae12bee 100644 --- a/code/_global_vars/sound.dm +++ b/code/_global_vars/sound.dm @@ -1,3 +1,4 @@ +// TODO: make a code/game/sound folder to store these and playsound code? var/global/list/shatter_sound = list( 'sound/effects/Glassbr1.ogg', 'sound/effects/Glassbr2.ogg', diff --git a/code/_helpers/areas.dm b/code/_helpers/areas.dm index e985579e0abe..c26f3d2e9969 100644 --- a/code/_helpers/areas.dm +++ b/code/_helpers/areas.dm @@ -42,7 +42,7 @@ continue valid_areas[candidate_area] = TRUE if(!length(valid_areas)) // no turfs at all have that flag - return FALSE + return null // Each area contents loop is an in-world loop, so we just do one here. for(var/turf/turf_candidate in world) var/area/candidate_area = get_area(turf_candidate) @@ -50,8 +50,7 @@ continue if(!predicates || all_predicates_true(list(turf_candidate), predicates)) LAZYADD(turfs, turf_candidate) - if(LAZYLEN(turfs)) - return pick(turfs) + return SAFEPICK(turfs) /proc/pick_area_turf(var/areatype, var/list/predicates) var/list/turfs = get_area_turfs(areatype, predicates) diff --git a/code/_helpers/cmp.dm b/code/_helpers/cmp.dm index 3a04928449ee..70bb6dc061fa 100644 --- a/code/_helpers/cmp.dm +++ b/code/_helpers/cmp.dm @@ -57,6 +57,8 @@ /proc/cmp_qdel_item_time(datum/qdel_item/A, datum/qdel_item/B) . = B.hard_delete_time - A.hard_delete_time + if (!. && B.qdels && A.qdels) // sort by time per call + . = (B.destroy_time / B.qdels) - (A.destroy_time / A.qdels) if (!.) . = B.destroy_time - A.destroy_time if (!.) @@ -84,6 +86,9 @@ /proc/cmp_fusion_reaction_des(var/decl/fusion_reaction/A, var/decl/fusion_reaction/B) return B.priority - A.priority +/proc/cmp_human_examine_priority(decl/human_examination/a, decl/human_examination/b) + return a.priority - b.priority + /proc/cmp_program(var/datum/computer_file/program/A, var/datum/computer_file/program/B) return cmp_text_asc(A.filedesc, B.filedesc) diff --git a/code/__datastructures/priority_queue.dm b/code/_helpers/datastructures/priority_queue.dm similarity index 74% rename from code/__datastructures/priority_queue.dm rename to code/_helpers/datastructures/priority_queue.dm index 1c29024a1ca7..f75f71dabbb7 100644 --- a/code/__datastructures/priority_queue.dm +++ b/code/_helpers/datastructures/priority_queue.dm @@ -1,58 +1,60 @@ /// An automatically ordered list, using the cmp proc to weight the list items /datum/priority_queue /// The actual queue - var/list/L + VAR_PRIVATE/list/my_queue = list() /// The weight function used to order the queue - var/cmp + VAR_PRIVATE/cmp /// Takes a proc `comparer` that will be used to compare the items inserted /// * Param `comparer` take two arguments and return the difference in their weight /// * For example: /proc/CompareItems(atom/A, atom/B) return A.size - B.size /datum/priority_queue/New(comparer) - L = new() cmp = comparer /// * Returns: `TRUE` if the queue is empty, otherwise `FALSE` /datum/priority_queue/proc/IsEmpty() - return !L.len + return !my_queue.len /// Add an `item` to the list, immediatly ordering it to its position using dichotomic search /datum/priority_queue/proc/Enqueue(item) - ADD_SORTED(L, item, cmp) + ADD_SORTED(my_queue, item, cmp) /// Removes and returns the first item in the queue /// * Returns: The first `item` in the queue, otherwise `FALSE` /datum/priority_queue/proc/Dequeue() - if(!L.len) + if(!my_queue.len) return FALSE - . = L[1] + . = my_queue[1] Remove(.) /// Removes an `item` from the list /// * Returns: `TRUE` if succesfully removed, otherwise `FALSE` /datum/priority_queue/proc/Remove(item) - . = L.Remove(item) + . = my_queue.Remove(item) /// * Returns: A copy of the item list /datum/priority_queue/proc/List() - . = L.Copy() + . = my_queue.Copy() /// Finds an `item` in the list /// * Returns: The position of the `item`, or `0` if not found /datum/priority_queue/proc/Seek(item) - . = L.Find(item) + . = my_queue.Find(item) /// Gets the item at the positon `index` /// * Returns: The `item` at the index, or `0` if outside the range of the queue /datum/priority_queue/proc/Get(index) - if(index > L.len || index < 1) + if(index > my_queue.len || index < 1) return 0 - return L[index] + return my_queue[index] /// * Returns: The length of the queue /datum/priority_queue/proc/Length() - . = L.len + . = my_queue.len + +/datum/priority_queue/proc/GetQueue() + return my_queue /// Resorts the `item` to its correct position in the queue. /// * For example: The queue is sorted based on weight and atom A changes weight after being added @@ -60,9 +62,9 @@ var/i = Seek(item) if(i == 0) return - while(i < L.len && call(cmp)(L[i],L[i+1]) > 0) - L.Swap(i,i+1) + while(i < my_queue.len && call(cmp)(my_queue[i],my_queue[i+1]) > 0) + my_queue.Swap(i,i+1) i++ - while(i > 1 && call(cmp)(L[i],L[i-1]) <= 0) // Last inserted element being first in case of ties (optimization) - L.Swap(i,i-1) + while(i > 1 && call(cmp)(my_queue[i],my_queue[i-1]) <= 0) // Last inserted element being first in case of ties (optimization) + my_queue.Swap(i,i-1) i-- diff --git a/code/__datastructures/stack.dm b/code/_helpers/datastructures/stack.dm similarity index 100% rename from code/__datastructures/stack.dm rename to code/_helpers/datastructures/stack.dm diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index c33ecb8a33a8..f084ad999bbb 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -99,6 +99,11 @@ //turfs += centerturf return atoms +/// Despite what the ref says, get_dist does not factor in the Z axis. +/// This is just get_dist() but Z-aware. +/proc/get_dist_3d(atom/Loc1, atom/Loc2) + return max(abs(Loc1.x-Loc2.x), abs(Loc1.y-Loc2.y), abs(Loc1.z-Loc2.z)) + /proc/get_dist_euclidian(atom/Loc1, atom/Loc2) var/dx = Loc1.x - Loc2.x var/dy = Loc1.y - Loc2.y @@ -171,8 +176,8 @@ return L -// Returns a list of mobs and/or objects in range of R from source. Used in radio and say code. -/proc/get_mobs_or_objects_in_view(var/R, var/atom/source, var/include_mobs = 1, var/include_objects = 1) +// Returns a list of mobs and/or objects in range of get_range from source. Used in radio and say code. +/proc/get_mobs_or_objects_in_view(var/get_range, var/atom/source, var/include_mobs = 1, var/include_objects = 1) var/turf/T = get_turf(source) var/list/hear = list() @@ -180,7 +185,7 @@ if(!T) return hear - var/list/range = hear(R, T) + var/list/range = hear(get_range, T) for(var/I in range) if(ismob(I)) hear |= recursive_content_check(I, hear, 3, 1, 0, include_mobs, include_objects) @@ -292,7 +297,7 @@ if(1) return colors[1] if(2) - return BlendRGBasHSV(colors[1], colors[2], 0.5) + return BlendHSV(colors[1], colors[2], 0.5) var/list/reds = list() var/list/blues = list() var/list/greens = list() diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index 7b98b5f58af5..7bb01c2778df 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -1,22 +1,9 @@ -//Since it didn't really belong in any other category, I'm putting this here -//This is for procs to replace all the goddamn 'in world's that are chilling around the code -//Nine years later, we can report we've killed most of them! +// I really don't like having miscellaneous 'collection of definitions' files floating around in the codebase. +// I've already found a lot of the lists that used to be here a new forever home (or taken them out back and shot them), +// but hopefully we can do the same for the rest eventually. +// Either find a better spot for them that's related to their uses/function/etc., or delete them. -var/global/list/cable_list = list() //Index for all cables, so that powernets don't have to look through the entire world all the time -var/global/list/landmarks_list = list() //list of all landmarks created -var/global/list/mannequins_ - -// Uplinks -var/global/list/obj/item/uplink/world_uplinks = list() - -//Preferences stuff -var/global/datum/category_collection/underwear/underwear = new() - -// Visual nets -var/global/list/datum/visualnet/visual_nets = list() -var/global/datum/visualnet/camera/cameranet = new() - -// Strings which corraspond to bodypart covering flags, useful for outputting what something covers. +// Strings which correspond to bodypart covering flags, useful for outputting what something covers. var/global/list/string_part_flags = list( "head" = SLOT_HEAD, "face" = SLOT_FACE, @@ -31,7 +18,8 @@ var/global/list/string_part_flags = list( "hands" = SLOT_HANDS ) -// Strings which corraspond to slot flags, useful for outputting what slot something is. +// TODO: These should probably be able to be generated automatically from inventory slot subtype definitions, maybe? +/// Strings which correspond to slot flags, useful for outputting what slot something is. var/global/list/string_slot_flags = list( "back" = SLOT_BACK, "face" = SLOT_FACE, @@ -48,72 +36,37 @@ var/global/list/string_slot_flags = list( "holster" = SLOT_HOLSTER ) -////////////////////////// -/////Initial Building///// -////////////////////////// - -/proc/get_mannequin(var/ckey) - if(SSatoms.atom_init_stage < INITIALIZATION_INNEW_REGULAR) - return - if(!mannequins_) - mannequins_ = new() - . = mannequins_[ckey] - if(!.) - . = new /mob/living/human/dummy/mannequin() - mannequins_[ckey] = . +// Used to avoid constantly generating new lists during movement. +var/global/list/all_stance_limbs = list( + ORGAN_CATEGORY_STANCE, + ORGAN_CATEGORY_STANCE_ROOT +) +var/global/list/child_stance_limbs = list( + ORGAN_CATEGORY_STANCE +) +// TODO: Replace keybinding datums with keybinding decls to make this unnecessary. +var/global/list/hotkey_keybinding_list_by_key = list() // Replace this with just looping over all keybinding decls (as below) in a 'reset hotkeys' proc. +var/global/list/keybindings_by_name = list() // Replace this with just decl lookups. /proc/makeDatumRefLists() // Keybindings for(var/KB in subtypesof(/datum/keybinding)) var/datum/keybinding/keybinding = KB - if(!initial(keybinding.name)) + if(TYPE_IS_ABSTRACT(keybinding)) continue + ASSERT(keybinding.name) var/datum/keybinding/instance = new keybinding global.keybindings_by_name[instance.name] = instance if(length(instance.hotkey_keys)) for(var/bound_key in instance.hotkey_keys) global.hotkey_keybinding_list_by_key[bound_key] += list(instance.name) - return 1 - -// This is all placeholder procs for an eventual PR to change them to use decls. -var/global/list/all_species -var/global/list/playable_species // A list of ALL playable species, whitelisted, latejoin or otherwise. -var/global/list/bodytype_species_pairs = list() // A list of bodytypes -> species, used for mainly unit testing. -/proc/build_species_lists() - if(global.all_species) - return - global.all_species = list() - global.playable_species = list() - var/list/species_decls = decls_repository.get_decls_of_subtype(/decl/species) - for(var/species_type in species_decls) - var/decl/species/species = species_decls[species_type] - if(species.name) - global.all_species[species.name] = species - for(var/decl/bodytype/bodytype in species.available_bodytypes) - global.bodytype_species_pairs[GET_DECL(bodytype)] = species - if(!(species.spawn_flags & SPECIES_IS_RESTRICTED)) - global.playable_species += species.name - if(global.using_map.default_species) - global.playable_species |= global.using_map.default_species -/proc/get_species_by_key(var/species_key) - build_species_lists() - . = global.all_species[species_key] -/proc/get_all_species() - build_species_lists() - . = global.all_species /proc/get_playable_species() - build_species_lists() - . = global.playable_species -/proc/get_bodytype_species_pairs() - build_species_lists() - . = global.bodytype_species_pairs - -// Used to avoid constantly generating new lists during movement. -var/global/list/all_stance_limbs = list( - ORGAN_CATEGORY_STANCE, - ORGAN_CATEGORY_STANCE_ROOT -) -var/global/list/child_stance_limbs = list( - ORGAN_CATEGORY_STANCE -) + var/static/list/_playable_species // A list of ALL playable species, whitelisted, latejoin or otherwise. (read: non-restricted) + if(!_playable_species) + _playable_species = list() + for(var/decl/species/species in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) + if(species.spawn_flags & SPECIES_IS_RESTRICTED) + continue + _playable_species += species.uid + return _playable_species diff --git a/code/_helpers/icons.dm b/code/_helpers/icons.dm index 927bb8c195f1..38aaf7af68be 100644 --- a/code/_helpers/icons.dm +++ b/code/_helpers/icons.dm @@ -77,40 +77,24 @@ More than one HSV color can match the same RGB color. Here are some procs you can use for color management: -ReadRGB(rgb) - Takes an RGB string like "#ffaa55" and converts it to a list such as list(255,170,85). If an RGBA format is used - that includes alpha, the list will have a fourth item for the alpha value. -hsv(hue, sat, val, apha) +hsv(hue, sat, val) Counterpart to rgb(), this takes the values you input and converts them to a string in "#hhhssvv" or "#hhhssvvaa" format. Alpha is not included in the result if null. -ReadHSV(rgb) - Takes an HSV string like "#100ff80" and converts it to a list such as list(256,255,128). If an HSVA format is used that - includes alpha, the list will have a fourth item for the alpha value. -RGBtoHSV(rgb) - Takes an RGB or RGBA string like "#ffaa55" and converts it into an HSV or HSVA color such as "#080aaff". -HSVtoRGB(hsv) - Takes an HSV or HSVA string like "#080aaff" and converts it into an RGB or RGBA color such as "#ff55aa". BlendRGB(rgb1, rgb2, amount) Blends between two RGB or RGBA colors using regular RGB blending. If amount is 0, the first color is the result; if 1, the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well. The returned value is an RGB or RGBA color. BlendHSV(hsv1, hsv2, amount) - Blends between two HSV or HSVA colors using HSV blending, which tends to produce nicer results than regular RGB + Blends between two RGB or RGBA colors using HSV blending, which tends to produce nicer results than regular RGB blending because the brightness of the color is left intact. If amount is 0, the first color is the result; if 1, the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well. - The returned value is an HSV or HSVA color. -BlendRGBasHSV(rgb1, rgb2, amount) - Like BlendHSV(), but the colors used and the return value are RGB or RGBA colors. The blending is done in HSV form. -HueToAngle(hue) - Converts a hue to an angle range of 0 to 360. Angle 0 is red, 120 is green, and 240 is blue. -AngleToHue(hue) - Converts an angle to a hue in the valid range. + The returned value is an RGB or RGBA color. RotateHue(hsv, angle) Takes an HSV or HSVA value and rotates the hue forward through red, green, and blue by an angle from 0 to 360. (Rotating red by 60 degrees produces yellow.) The result is another HSV or HSVA color with the same saturation and value as the original, but a different hue. GrayScale(rgb) - Takes an RGB or RGBA color and converts it to grayscale. Returns an RGB or RGBA string. + Takes an RGB or RGBA color and converts it to grayscale, preserving perceptual lightness. Returns an RGB or RGBA string. ColorTone(rgb, tone) Similar to GrayScale(), this proc converts an RGB or RGBA color to a range of black -> tone -> white instead of using strict shades of gray. The tone value is an RGB color; any alpha value is ignored. @@ -232,7 +216,7 @@ world /icon/proc/ColorTone(tone) GrayScale() - var/list/TONE = ReadRGB(tone) + var/list/TONE = rgb2num(tone) var/gray = round(TONE[1]*0.3 + TONE[2]*0.59 + TONE[3]*0.11, 1) var/icon/upper = (255-gray) ? new(src) : null @@ -312,56 +296,6 @@ world Higher value means brighter color */ -/proc/ReadRGB(rgb) - if(!rgb) return - - // interpret the HSV or HSVA value - var/i=1,start=1 - if(text2ascii(rgb) == 35) ++start // skip opening # - var/ch,which=0,r=0,g=0,b=0,alpha=0,usealpha - var/digits=0 - for(i=start, i<=length(rgb), ++i) - ch = text2ascii(rgb, i) - if(ch < 48 || (ch > 57 && ch < 65) || (ch > 70 && ch < 97) || ch > 102) break - ++digits - if(digits == 8) break - - var/single = digits < 6 - if(digits != 3 && digits != 4 && digits != 6 && digits != 8) return - if(digits == 4 || digits == 8) usealpha = 1 - for(i=start, digits>0, ++i) - ch = text2ascii(rgb, i) - if(ch >= 48 && ch <= 57) ch -= 48 - else if(ch >= 65 && ch <= 70) ch -= 55 - else if(ch >= 97 && ch <= 102) ch -= 87 - else break - --digits - switch(which) - if(0) - r = BITSHIFT_LEFT(r, 4) | ch - if(single) - r |= BITSHIFT_LEFT(r, 4) - ++which - else if(!(digits & 1)) ++which - if(1) - g = BITSHIFT_LEFT(g, 4) | ch - if(single) - g |= BITSHIFT_LEFT(g, 4) - ++which - else if(!(digits & 1)) ++which - if(2) - b = BITSHIFT_LEFT(b, 4) | ch - if(single) - b |= BITSHIFT_LEFT(b, 4) - ++which - else if(!(digits & 1)) ++which - if(3) - alpha = BITSHIFT_LEFT(alpha, 4) | ch - if(single) alpha |= BITSHIFT_LEFT(alpha, 4) - - . = list(r, g, b) - if(usealpha) . += alpha - /proc/ReadHSV(hsv) if(!hsv) return @@ -401,220 +335,34 @@ world . = list(hue, sat, val) if(usealpha) . += alpha -/proc/HSVtoRGB(hsv) - if(!hsv) return "#000000" - var/list/HSV = ReadHSV(hsv) - if(!HSV) return "#000000" - - var/hue = HSV[1] - var/sat = HSV[2] - var/val = HSV[3] - - // Compress hue into easier-to-manage range - hue -= BITSHIFT_RIGHT(hue, 8) - if(hue >= 0x5fa) hue -= 0x5fa - - var/hi,mid,lo,r,g,b - hi = val - lo = round((255 - sat) * val / 255, 1) - mid = lo + round(abs(round(hue, 510) - hue) * (hi - lo) / 255, 1) - if(hue >= 765) - if(hue >= 1275) {r=hi; g=lo; b=mid} - else if(hue >= 1020) {r=mid; g=lo; b=hi } - else {r=lo; g=mid; b=hi } - else - if(hue >= 510) {r=lo; g=hi; b=mid} - else if(hue >= 255) {r=mid; g=hi; b=lo } - else {r=hi; g=mid; b=lo } - - return (HSV.len > 3) ? rgb(r,g,b,HSV[4]) : rgb(r,g,b) - -/proc/RGBtoHSV(rgb) - if(!rgb) return "#0000000" - var/list/RGB = ReadRGB(rgb) - if(!RGB) return "#0000000" - - var/r = RGB[1] - var/g = RGB[2] - var/b = RGB[3] - var/hi = max(r,g,b) - var/lo = min(r,g,b) - - var/val = hi - var/sat = hi ? round((hi-lo) * 255 / hi, 1) : 0 - var/hue = 0 - - if(sat) - var/dir - var/mid - if(hi == r) - if(lo == b) {hue=0; dir=1; mid=g} - else {hue=1535; dir=-1; mid=b} - else if(hi == g) - if(lo == r) {hue=512; dir=1; mid=b} - else {hue=511; dir=-1; mid=r} - else if(hi == b) - if(lo == g) {hue=1024; dir=1; mid=r} - else {hue=1023; dir=-1; mid=g} - hue += dir * round((mid-lo) * 255 / (hi-lo), 1) - - return hsv(hue, sat, val, (RGB.len>3 ? RGB[4] : null)) - -/proc/hsv(hue, sat, val, alpha) - if(hue < 0 || hue >= 1536) hue %= 1536 - if(hue < 0) hue += 1536 - if((hue & 0xFF) == 0xFF) - ++hue - if(hue >= 1536) hue = 0 - if(sat < 0) sat = 0 - if(sat > 255) sat = 255 - if(val < 0) val = 0 - if(val > 255) val = 255 - . = "#" - . += TO_HEX_DIGIT(BITSHIFT_RIGHT(hue, 8)) - . += TO_HEX_DIGIT(BITSHIFT_RIGHT(hue, 4)) - . += TO_HEX_DIGIT(hue) - . += TO_HEX_DIGIT(BITSHIFT_RIGHT(sat, 4)) - . += TO_HEX_DIGIT(sat) - . += TO_HEX_DIGIT(BITSHIFT_RIGHT(val, 4)) - . += TO_HEX_DIGIT(val) - if(!isnull(alpha)) - if(alpha < 0) alpha = 0 - if(alpha > 255) alpha = 255 - . += TO_HEX_DIGIT(BITSHIFT_RIGHT(alpha, 4)) - . += TO_HEX_DIGIT(alpha) - -/* - Smooth blend between HSV colors - - amount=0 is the first color - amount=1 is the second color - amount=0.5 is directly between the two colors - - amount<0 or amount>1 are allowed - */ -/proc/BlendHSV(hsv1, hsv2, amount) - var/list/HSV1 = ReadHSV(hsv1) - var/list/HSV2 = ReadHSV(hsv2) - - // add missing alpha if needed - if(HSV1.len < HSV2.len) HSV1 += 255 - else if(HSV2.len < HSV1.len) HSV2 += 255 - var/usealpha = HSV1.len > 3 - - // normalize hsv values in case anything is screwy - if(HSV1[1] > 1536) HSV1[1] %= 1536 - if(HSV2[1] > 1536) HSV2[1] %= 1536 - if(HSV1[1] < 0) HSV1[1] += 1536 - if(HSV2[1] < 0) HSV2[1] += 1536 - if(!HSV1[3]) {HSV1[1] = 0; HSV1[2] = 0} - if(!HSV2[3]) {HSV2[1] = 0; HSV2[2] = 0} - - // no value for one color means don't change saturation - if(!HSV1[3]) HSV1[2] = HSV2[2] - if(!HSV2[3]) HSV2[2] = HSV1[2] - // no saturation for one color means don't change hues - if(!HSV1[2]) HSV1[1] = HSV2[1] - if(!HSV2[2]) HSV2[1] = HSV1[1] - - // Compress hues into easier-to-manage range - HSV1[1] -= BITSHIFT_RIGHT(HSV1[1], 8) - HSV2[1] -= BITSHIFT_RIGHT(HSV2[1], 8) - - var/hue_diff = HSV2[1] - HSV1[1] - if(hue_diff > 765) hue_diff -= 1530 - else if(hue_diff <= -765) hue_diff += 1530 - - var/hue = round(HSV1[1] + hue_diff * amount, 1) - var/sat = round(HSV1[2] + (HSV2[2] - HSV1[2]) * amount, 1) - var/val = round(HSV1[3] + (HSV2[3] - HSV1[3]) * amount, 1) - var/alpha = usealpha ? round(HSV1[4] + (HSV2[4] - HSV1[4]) * amount, 1) : null - - // normalize hue - if(hue < 0 || hue >= 1530) hue %= 1530 - if(hue < 0) hue += 1530 - // decompress hue - hue += round(hue / 255) - - return hsv(hue, sat, val, alpha) - /* - Smooth blend between RGB colors + Blend two RGB colors in RGB color space amount=0 is the first color amount=1 is the second color amount=0.5 is directly between the two colors - - amount<0 or amount>1 are allowed */ /proc/BlendRGB(rgb1, rgb2, amount) - var/list/RGB1 = ReadRGB(rgb1) - var/list/RGB2 = ReadRGB(rgb2) - - // add missing alpha if needed - if(RGB1.len < RGB2.len) RGB1 += 255 - else if(RGB2.len < RGB1.len) RGB2 += 255 - var/usealpha = RGB1.len > 3 - - var/r = round(RGB1[1] + (RGB2[1] - RGB1[1]) * amount, 1) - var/g = round(RGB1[2] + (RGB2[2] - RGB1[2]) * amount, 1) - var/b = round(RGB1[3] + (RGB2[3] - RGB1[3]) * amount, 1) - var/alpha = usealpha ? round(RGB1[4] + (RGB2[4] - RGB1[4]) * amount, 1) : null - - return isnull(alpha) ? rgb(r, g, b) : rgb(r, g, b, alpha) - -/proc/BlendRGBasHSV(rgb1, rgb2, amount) - return HSVtoRGB(RGBtoHSV(rgb1), RGBtoHSV(rgb2), amount) - -/proc/HueToAngle(hue) - // normalize hsv in case anything is screwy - if(hue < 0 || hue >= 1536) hue %= 1536 - if(hue < 0) hue += 1536 - // Compress hue into easier-to-manage range - hue -= BITSHIFT_RIGHT(hue, 8) - return hue / (1530/360) - -/proc/AngleToHue(angle) - // normalize hsv in case anything is screwy - if(angle < 0 || angle >= 360) angle -= 360 * round(angle / 360) - var/hue = angle * (1530/360) - // Decompress hue - hue += round(hue / 255) - return hue + return gradient(rgb1, rgb2, index = amount) +/// Blend two RGB colors in HSV space +/proc/BlendHSV(rgb1, rgb2, amount) + return gradient(rgb1, rgb2, index = amount, space = COLORSPACE_HSV) // positive angle rotates forward through red->green->blue -/proc/RotateHue(hsv, angle) - var/list/HSV = ReadHSV(hsv) - - // normalize hsv in case anything is screwy - if(HSV[1] >= 1536) HSV[1] %= 1536 - if(HSV[1] < 0) HSV[1] += 1536 +/proc/RotateHue(rgb, angle) + . = rgb2num(rgb, COLORSPACE_HSV) + .[1] = (.[1] + angle) % 360 - // Compress hue into easier-to-manage range - HSV[1] -= BITSHIFT_RIGHT(HSV[1], 8) - - if(angle < 0 || angle >= 360) angle -= 360 * round(angle / 360) - HSV[1] = round(HSV[1] + angle * (1530/360), 1) - - // normalize hue - if(HSV[1] < 0 || HSV[1] >= 1530) HSV[1] %= 1530 - if(HSV[1] < 0) HSV[1] += 1530 - // decompress hue - HSV[1] += round(HSV[1] / 255) - - return hsv(HSV[1], HSV[2], HSV[3], (HSV.len > 3 ? HSV[4] : null)) - -// Convert an rgb color to grayscale -/proc/GrayScale(rgb) //#FIXME: This isn't true grayscale. Its from an example on the Byond ref on how to manipulate colors... - var/list/RGB = ReadRGB(rgb) - var/gray = RGB[1]*0.3 + RGB[2]*0.59 + RGB[3]*0.11 - return (RGB.len > 3) ? rgb(gray, gray, gray, RGB[4]) : rgb(gray, gray, gray) +// Convert an rgb color to grayscale, preserving luminance +/proc/GrayScale(rgb) + var/list/HCY = rgb2num(rgb, COLORSPACE_HCY) + return rgb(hue = HCY[1], chroma = 0, y = HCY[3]) // Change grayscale color to black->tone->white range /proc/ColorTone(rgb, tone) - var/list/RGB = ReadRGB(rgb) - var/list/TONE = ReadRGB(tone) + var/list/RGB = rgb2num(rgb) + var/list/TONE = rgb2num(tone) var/gray = RGB[1]*0.3 + RGB[2]*0.59 + RGB[3]*0.11 var/tone_gray = TONE[1]*0.3 + TONE[2]*0.59 + TONE[3]*0.11 @@ -818,7 +566,7 @@ The _flatIcons list is a cache for generated icon files. if (!color) return "#ffffff" if (!value) return color - var/list/RGB = ReadRGB(color) + var/list/RGB = rgb2num(color) RGB[1] = clamp(RGB[1]+value,0,255) RGB[2] = clamp(RGB[2]+value,0,255) RGB[3] = clamp(RGB[3]+value,0,255) diff --git a/code/_helpers/lists.dm b/code/_helpers/lists.dm index 074d04728d4d..b9d16ba65ab1 100644 --- a/code/_helpers/lists.dm +++ b/code/_helpers/lists.dm @@ -114,7 +114,7 @@ return TRUE return FALSE -//returns a new list with only atoms that are in typecache L +//returns a new list with only atoms that are in typecache atoms /proc/typecache_filter_list(list/atoms, list/typecache) . = list() for(var/thing in atoms) @@ -150,37 +150,36 @@ types = list(path) else types = ignore_root_path ? subtypesof(path) : typesof(path) - var/list/L = list() + var/list/typelist = list() for(var/T in types) - L[T] = TRUE - return L + typelist[T] = TRUE + return typelist else if(islist(path)) var/list/pathlist = path - var/list/L = list() + var/list/typelist = list() if(ignore_root_path) for(var/P in pathlist) for(var/T in subtypesof(P)) - L[T] = TRUE + typelist[T] = TRUE else for(var/P in pathlist) if(only_root_path) - L[P] = TRUE + typelist[P] = TRUE else for(var/T in typesof(P)) - L[T] = TRUE - return L + typelist[T] = TRUE + return typelist //Checks for specific types in specifically structured (Assoc "type" = TRUE) lists ('typecaches') -/proc/is_type_in_typecache(atom/A, list/L) - if(!L || !L.len || !A) - +/proc/is_type_in_typecache(atom/A, list/cache) + if(!cache || !cache.len || !A) return 0 - return L[A.type] + return cache[A.type] -/proc/instances_of_type_in_list(var/atom/A, var/list/L) +/proc/instances_of_type_in_list(var/atom/A, var/list/target_list) var/instances = 0 - for(var/type in L) + for(var/type in target_list) if(istype(A, type)) instances++ return instances @@ -270,17 +269,17 @@ Checks if a list has the same entries and values as an element of big. .[key] = call(merge_method)(.[key], b_value) //Pretends to pick an element based on its weight but really just seems to pick a random element. -/proc/pickweight(list/L) +/proc/pickweight(list/target_list) var/total = 0 var/item - for (item in L) - if (!L[item]) - L[item] = 1 - total += L[item] + for (item in target_list) + if (!target_list[item]) + target_list[item] = 1 + total += target_list[item] total = rand(1, total) - for (item in L) - total -=L [item] + for (item in target_list) + total -= target_list[item] if (total <= 0) return item @@ -303,87 +302,87 @@ Checks if a list has the same entries and values as an element of big. return null //Returns the first element from the list and removes it from the list -/proc/popleft(list/L) - if(length(L)) - . = L[1] - L.Cut(1,2) +/proc/popleft(list/target_list) + if(length(target_list)) + . = target_list[1] + target_list.Cut(1,2) //Returns the next element in parameter list after first appearance of parameter element. If it is the last element of the list or not present in list, returns first element. -/proc/next_in_list(element, list/L) - for(var/i = 1 to L.len) - if(L[i] == element) - if(i >= L.len) - return L[1] - return L[i+1] - return L[1] +/proc/next_in_list(element, list/target_list) + for(var/i = 1 to target_list.len) + if(target_list[i] == element) + if(i >= target_list.len) + return target_list[1] + return target_list[i+1] + return target_list[1] //Returns the previous element in parameter list after first appearance of parameter element. If it is the first element of the list or not present in list, returns first element. -/proc/previous_in_list(element, list/L) - for(var/i = 1 to L.len) - if(L[i] == element) +/proc/previous_in_list(element, list/target_list) + for(var/i = 1 to target_list.len) + if(target_list[i] == element) if(i <= 1) - return L[L.len] - return L[i-1] - return L[L.len] + return target_list[target_list.len] + return target_list[i-1] + return target_list[target_list.len] /* * Sorting */ //Reverses the order of items in the list -/proc/reverselist(list/L) +/proc/reverselist(list/target_list) var/list/output = list() - if(L) - for(var/i = L.len; i >= 1; i--) - output += L[i] + if(target_list) + for(var/i = target_list.len; i >= 1; i--) + output += target_list[i] return output //Randomize: Return the list in a random order -/proc/shuffle(var/list/L) - if(!L) +/proc/shuffle(var/list/target_list) + if(!target_list) return - L = L.Copy() + target_list = target_list.Copy() - for(var/i=1; i 0) ? i : i+1 + if(i == 1 || i == target_list.len) // Edge cases + return (call(cmp)(target_list[i],A) > 0) ? i : i+1 else return i -/proc/dd_sortedObjectList(var/list/L, var/cache=list()) - if(L.len < 2) - return L - var/middle = L.len / 2 + 1 // Copy is first,second-1 - return dd_mergeObjectList(dd_sortedObjectList(L.Copy(0,middle), cache), dd_sortedObjectList(L.Copy(middle), cache), cache) //second parameter null = to end of list +/proc/dd_sortedObjectList(var/list/target_list, var/cache=list()) + if(target_list.len < 2) + return target_list + var/middle = target_list.len / 2 + 1 // Copy is first,second-1 + return dd_mergeObjectList(dd_sortedObjectList(target_list.Copy(0,middle), cache), dd_sortedObjectList(target_list.Copy(middle), cache), cache) //second parameter null = to end of list -/proc/dd_mergeObjectList(var/list/L, var/list/R, var/list/cache) - var/Li=1 - var/Ri=1 +/proc/dd_mergeObjectList(var/list/target_list, var/list/right, var/list/cache) + var/left_index=1 + var/right_index=1 var/list/result = new() - while(Li <= L.len && Ri <= R.len) - var/LLi = L[Li] - var/RRi = R[Ri] + while(left_index <= target_list.len && right_index <= right.len) + var/LLi = target_list[left_index] + var/RRi = right[right_index] var/LLiV = cache[LLi] var/RRiV = cache[RRi] if(!LLiV) @@ -484,31 +483,31 @@ Checks if a list has the same entries and values as an element of big. RRiV = RRi:dd_SortValue() cache[RRi] = RRiV if(LLiV < RRiV) - result += L[Li++] + result += target_list[left_index++] else - result += R[Ri++] + result += right[right_index++] - if(Li <= L.len) - return (result + L.Copy(Li, 0)) - return (result + R.Copy(Ri, 0)) + if(left_index <= target_list.len) + return (result + target_list.Copy(left_index, 0)) + return (result + right.Copy(right_index, 0)) // Insert an object into a sorted list, preserving sortedness -/proc/dd_insertObjectList(var/list/L, var/O) +/proc/dd_insertObjectList(var/list/target_list, var/O) var/min = 1 - var/max = L.len + 1 + var/max = target_list.len + 1 var/Oval = O:dd_SortValue() while(1) var/mid = min+round((max-min)/2) if(mid == max) - L.Insert(mid, O) + target_list.Insert(mid, O) return - var/Lmid = L[mid] + var/Lmid = target_list[mid] var/midval = Lmid:dd_SortValue() if(Oval == midval) - L.Insert(mid, O) + target_list.Insert(mid, O) return else if(Oval < midval) max = mid @@ -644,27 +643,29 @@ proc/dd_sortedObjectList(list/incoming) /datum/alarm/dd_SortValue() return "[sanitize_old(last_name)]" -//creates every subtype of prototype (excluding prototype) and adds it to list L. -//if no list/L is provided, one is created. -/proc/init_subtypes(prototype, list/L) - if(!istype(L)) L = list() +//creates every subtype of prototype (excluding prototype) and adds it to list target_list. +//if no list/target_list is provided, one is created. +/proc/init_subtypes(prototype, list/target_list) + if(!islist(target_list)) + target_list = list() 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() + target_list += new path() + return target_list + +//creates every subtype of prototype (excluding prototype) and adds it to list target_list as a type/instance pair. +//if no list/target_list is provided, one is created. +/proc/init_subtypes_assoc(prototype, list/target_list) + if(!islist(target_list)) + target_list = list() for(var/path in subtypesof(prototype)) - L[path] = new path() - return L + target_list[path] = new path() + return target_list #define listequal(A, B) (A.len == B.len && !length(A^B)) -/proc/filter_list(var/list/L, var/type) +/proc/filter_list(var/list/target_list, var/type) . = list() - for(var/entry in L) + for(var/entry in target_list) if(istype(entry, type)) . += entry @@ -676,10 +677,10 @@ proc/dd_sortedObjectList(list/incoming) values += value -/proc/duplicates(var/list/L) +/proc/duplicates(var/list/target_list) . = list() var/list/checked = list() - for(var/value in L) + for(var/value in target_list) if(value in checked) . |= value else @@ -687,24 +688,24 @@ proc/dd_sortedObjectList(list/incoming) //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 +//All elements in the range [toIndex, target_list.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] +//fromIndex and toIndex must be in the range [1,target_list.len+1] //This will preserve associations ~Carnie -/proc/moveElement(list/L, fromIndex, toIndex) +/proc/moveElement(list/target_list, 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) + target_list.Insert(toIndex, null) + target_list.Swap(fromIndex, toIndex) + target_list.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) +/proc/moveRange(list/target_list, 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) @@ -712,33 +713,33 @@ proc/dd_sortedObjectList(list/incoming) fromIndex += len //we want to shift left instead of right for(var/i=0, i toIndex) fromIndex += len for(var/i=0, i 0 && index <= list.len) // Returns the first key where T fulfills ispath -/proc/get_ispath_key(var/list/L, var/T) - for(var/key in L) +/proc/get_ispath_key(var/list/target_list, var/T) + for(var/key in target_list) if(ispath(T, key)) return key // Gets the first instance that is of the given type (strictly) -/proc/get_instance_of_strict_type(var/list/L, var/T) - for(var/key in L) +/proc/get_instance_of_strict_type(var/list/target_list, var/T) + for(var/key in target_list) var/atom/A = key if(A.type == T) return A @@ -865,5 +866,5 @@ var/global/list/json_cache = list() ) /// Is this a dense (all keys have non-null values) associative list with at least one entry? -/proc/is_dense_assoc(var/list/L) - return length(L) > 0 && !isnull(L[L[1]]) +/proc/is_dense_assoc(var/list/target_list) + return length(target_list) > 0 && !isnull(target_list[target_list[1]]) diff --git a/code/_helpers/logging.dm b/code/_helpers/logging.dm index 5c1744b0178f..7e476912b248 100644 --- a/code/_helpers/logging.dm +++ b/code/_helpers/logging.dm @@ -214,4 +214,4 @@ var/global/log_end= world.system_type == UNIX ? ascii2text(13) : "" /proc/report_progress(var/progress_message) admin_notice("[progress_message]", R_DEBUG) - to_world_log(progress_message) + log_world(progress_message) diff --git a/code/_helpers/matrices.dm b/code/_helpers/matrices.dm index e705300c4f30..230966857bb3 100644 --- a/code/_helpers/matrices.dm +++ b/code/_helpers/matrices.dm @@ -94,12 +94,12 @@ /// Changes distance hues have from grey while maintaining the overall lightness. Greys are unaffected. /// * 1 is identity, 0 is greyscale, >1 oversaturates colors /proc/color_matrix_saturation(value) - var/inv = 1 - value - var/R = round(LUMA_R * inv, 0.001) - var/G = round(LUMA_G * inv, 0.001) - var/B = round(LUMA_B * inv, 0.001) + var/inv = 1 - value + var/red = round(LUMA_R * inv, 0.001) + var/green = round(LUMA_G * inv, 0.001) + var/blue = round(LUMA_B * inv, 0.001) - return list(R + value,R,R,0, G,G + value,G,0, B,B,B + value,0, 0,0,0,1, 0,0,0,0) + return list(red + value,red,red,0, green,green + value,green,0, blue,blue,blue + value,0, 0,0,0,1, 0,0,0,0) #define LUMR 0.2126 #define LUMG 0.7152 @@ -111,11 +111,13 @@ if(value > 0) value *= 3 var/x = 1 + value / 100 - var/inv = 1 - x - var/R = LUMR * inv - var/G = LUMG * inv - var/B = LUMB * inv - return list(R + x,R,R, G,G + x,G, B,B,B + x) + + var/inv = 1 - x + var/red = LUMR * inv + var/green = LUMG * inv + var/blue = LUMB * inv + return list(red + x,red,red, green,green + x,green, blue,blue,blue + x) + #undef LUMR #undef LUMG #undef LUMB @@ -189,7 +191,7 @@ /// Converts RGB shorthands into RGBA matrices complete of constants rows (ergo a 20 keys list in byond). /proc/color_to_full_rgba_matrix(color) if(istext(color)) - var/list/L = ReadRGB(color) + var/list/L = rgb2num(color) if(!L) CRASH("Invalid/unsupported color format argument in color_to_full_rgba_matrix()") return list(L[1]/255,0,0,0, 0,L[2]/255,0,0, 0,0,L[3]/255,0, 0,0,0,L.len>3?L[4]/255:1, 0,0,0,0) @@ -200,7 +202,7 @@ if(3 to 5) // row-by-row hexadecimals . = list() for(var/a in 1 to L.len) - var/list/rgb = ReadRGB(L[a]) + var/list/rgb = rgb2num(L[a]) for(var/b in rgb) . += b/255 if(length(rgb) % 4) // RGB has no alpha instruction diff --git a/code/_helpers/medical_scans.dm b/code/_helpers/medical_scans.dm index 8e26d3d74db2..5d4b84e8df90 100644 --- a/code/_helpers/medical_scans.dm +++ b/code/_helpers/medical_scans.dm @@ -43,21 +43,19 @@ .["reagents"] = list() if(reagents?.total_volume) - for(var/liquid_type in reagents.liquid_volumes) - var/decl/material/R = GET_DECL(liquid_type) - var/list/reagent = list() - reagent["name"]= R.get_reagent_name(reagents, MAT_PHASE_LIQUID) - reagent["quantity"] = round(REAGENT_VOLUME(reagents, R.type),1) - reagent["scannable"] = R.scannable - .["reagents"] += list(reagent) - - for(var/solid_type in reagents.solid_volumes) - var/decl/material/R = GET_DECL(solid_type) - var/list/reagent = list() - reagent["name"]= R.get_reagent_name(reagents, MAT_PHASE_SOLID) - reagent["quantity"] = round(REAGENT_VOLUME(reagents, R.type),1) - reagent["scannable"] = R.scannable - .["reagents"] += list(reagent) + for(var/decl/material/reagent as anything in reagents.liquid_volumes) + var/list/reagent_data = list() + reagent_data["name"] = reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID) + reagent_data["quantity"] = round(REAGENT_VOLUME(reagents, reagent),1) + reagent_data["scannable"] = reagent.scannable + .["reagents"] += list(reagent_data) + + for(var/decl/material/reagent as anything in reagents.solid_volumes) + var/list/reagent_data = list() + reagent_data["name"] = reagent.get_reagent_name(reagents, MAT_PHASE_SOLID) + reagent_data["quantity"] = round(REAGENT_VOLUME(reagents, reagent),1) + reagent_data["scannable"] = reagent.scannable + .["reagents"] += list(reagent_data) .["external_organs"] = list() for(var/obj/item/organ/external/limb in get_external_organs()) @@ -241,9 +239,9 @@ dat += "Antibody levels and immune system perfomance are at [scan["immune_system"]*100]% of baseline." var/other_reagent = FALSE - for(var/list/R in scan["reagents"]) - if(R["scannable"]) - subdat += "[R["quantity"]]u [R["name"]]" + for(var/list/reagent_data in scan["reagents"]) + if(reagent_data["scannable"]) + subdat += "[reagent_data["quantity"]]u [reagent_data["name"]]" else other_reagent = TRUE if(subdat) diff --git a/code/_helpers/mobs.dm b/code/_helpers/mobs.dm index 6c040f5a57c9..269e7b986da1 100644 --- a/code/_helpers/mobs.dm +++ b/code/_helpers/mobs.dm @@ -9,7 +9,7 @@ /proc/random_name(gender, species) if(species) - var/decl/species/current_species = get_species_by_key(species) + var/decl/species/current_species = decls_repository.get_decl_by_id(species) if(current_species) var/decl/background_detail/background = current_species.get_default_background_datum_by_flag(BACKGROUND_FLAG_NAMING) if(background) @@ -28,13 +28,13 @@ return FALSE if(!isrobot(thing.loc)) return FALSE - var/mob/living/silicon/robot/R = thing.loc - return (thing in R.module.equipment) + var/mob/living/silicon/robot/robot = thing.loc + return (thing in robot.module.equipment) /proc/get_exposed_defense_zone(var/atom/movable/target) return pick(BP_HEAD, BP_L_HAND, BP_R_HAND, BP_L_FOOT, BP_R_FOOT, BP_L_ARM, BP_R_ARM, BP_L_LEG, BP_R_LEG, BP_CHEST, BP_GROIN) -/proc/do_mob(mob/user , mob/target, time = 30, target_zone = 0, uninterruptible = 0, progress = 1, incapacitation_flags = INCAPACITATION_DEFAULT, check_holding = TRUE) +/proc/do_mob(mob/user, mob/target, time = 30, target_zone = 0, uninterruptible = 0, progress = 1, incapacitation_flags = INCAPACITATION_DEFAULT, check_holding = TRUE) if(!user || !target) return 0 var/user_loc = user.loc diff --git a/code/_helpers/profiling.dm b/code/_helpers/profiling.dm index 0c4785568368..f02138db049f 100644 --- a/code/_helpers/profiling.dm +++ b/code/_helpers/profiling.dm @@ -110,7 +110,8 @@ var/init = call_ext(lib, "init")() if("0" != init) CRASH("[lib] init error: [init]") -/world/New() +var/global/datum/profiler/_profiler = new +/datum/profiler/New() prof_init() - . = ..() + ..() #endif diff --git a/code/_helpers/text.dm b/code/_helpers/text.dm index adccbbc543df..a264a7fff67a 100644 --- a/code/_helpers/text.dm +++ b/code/_helpers/text.dm @@ -614,9 +614,9 @@ var/global/regex/starts_lowercase_regex = regex(@"^[a-z]") // If char isn't part of the text the entire text is returned /proc/copytext_after_last(var/text, var/char) - var/regex/R = regex("(\[^[char]\]*)$") - R.Find(text) - return R.group[1] + var/regex/copytext_regex = regex("(\[^[char]\]*)$") + copytext_regex.Find(text) + return copytext_regex.group[1] /proc/sql_sanitize_text(var/text) text = replacetext(text, "'", "''") diff --git a/code/_macros.dm b/code/_macros.dm index 11e6c146b5d5..62f7629af378 100644 --- a/code/_macros.dm +++ b/code/_macros.dm @@ -147,9 +147,9 @@ #define JOINTEXT(X) jointext(X, null) -#define SPAN_STYLE(S, X) "[X]" +#define SPAN_STYLE(S, X) "" + X + "" +#define SPAN_CLASS(C, X) "" + X + "" -#define SPAN_CLASS(C, X) "[X]" #define SPAN_ITALIC(X) SPAN_CLASS("italic", X) #define SPAN_BOLD(X) SPAN_CLASS("bold", X) #define SPAN_NOTICE(X) SPAN_CLASS("notice", X) @@ -174,6 +174,7 @@ #define SPAN_PALEPINK(X) SPAN_CLASS("font_palepink", X) #define SPAN_SINISTER(X) SPAN_CLASS("sinister", X) #define SPAN_MODERATE(X) SPAN_CLASS("moderate", X) +#define SPAN_DEADSAY(X) SPAN_CLASS("deadsay", X) // placeholders #define SPAN_GOOD(X) SPAN_GREEN(X) #define SPAN_NEUTRAL(X) SPAN_BLUE(X) diff --git a/code/_onclick/adjacent.dm b/code/_onclick/adjacent.dm index 328becddbbfe..8aea97cf30db 100644 --- a/code/_onclick/adjacent.dm +++ b/code/_onclick/adjacent.dm @@ -144,8 +144,8 @@ Quick adjacency (to turf): if(O.atom_flags & ATOM_FLAG_CHECKS_BORDER) // windows have throwpass but are on border, check them first if( O.dir & target_dir || O.dir&(O.dir-1) ) // full tile windows are just diagonals mechanically - var/obj/structure/window/W = target_atom - if(istype(W) && W.is_fulltile()) //exception for breaking full tile windows on top of single pane windows + var/obj/structure/window/window = target_atom + if(istype(window) && window.is_fulltile()) //exception for breaking full tile windows on top of single pane windows return 1 if(target_atom && (target_atom.atom_flags & ATOM_FLAG_ADJACENT_EXCEPTION)) // exception for atoms that should always be reachable return 1 diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index 56e4ee39cc83..36fc54d2f3fc 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -72,7 +72,7 @@ The below is only really for safety, or you can alter the way it functions and re-insert it above. */ -/mob/living/silicon/ai/UnarmedAttack(atom/A) +/mob/living/silicon/ai/ResolveUnarmedAttack(atom/A) return A.attack_ai(src) /mob/living/silicon/ai/RangedAttack(atom/A, var/params) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index d3692ea62f06..a7dc5af566af 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -44,7 +44,7 @@ is receiving it. The most common are: * mob/UnarmedAttack(atom,adjacent) - used here only when adjacent, with no item in hand; in the case of humans, checks gloves - * atom/attackby(item,user) - used only when adjacent + * atom/attackby(used_item,user) - used only when adjacent * item/afterattack(atom,user,adjacent,params) - used both ranged and adjacent * mob/RangedAttack(atom,params) - used only ranged, only used for tk and laser eyes but could be changed */ @@ -187,8 +187,12 @@ /mob/proc/UnarmedAttack(var/atom/A, var/proximity_flag) return -/mob/living/UnarmedAttack(var/atom/A, var/proximity_flag) +/// Handles per-mob unarmed attack functionality after shared checks, e.g. maneuvers and abilities. +/mob/living/proc/ResolveUnarmedAttack(var/atom/A) + return A.attack_hand(src) +/mob/living/UnarmedAttack(var/atom/A, var/proximity_flag) + SHOULD_NOT_OVERRIDE(TRUE) if(GAME_STATE < RUNLEVEL_GAME) to_chat(src, "You cannot attack people before the game has started.") return TRUE @@ -204,11 +208,11 @@ // Special glove functions: // If the gloves do anything, have them return 1 to stop // normal attack_hand() here. - var/obj/item/clothing/gloves/G = get_equipped_item(slot_gloves_str) // not typecast specifically enough in defines - if(istype(G) && G.Touch(A,1)) + var/obj/item/clothing/gloves/G = get_equipped_item(slot_gloves_str) + if(istype(G) && G.Touch(A, proximity_flag)) return TRUE - return A.attack_hand(src) + return ResolveUnarmedAttack(A) /* Ranged unarmed attack: diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 2ad7f9d7c98f..ee1eba20b7cf 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -86,11 +86,6 @@ holding.afterattack(A, src, 0, params) return -//Middle click cycles through selected modules. -/mob/living/silicon/robot/MiddleClickOn(var/atom/A) - cycle_modules() - return - //Give cyborgs hotkey clicks without breaking existing uses of hotkey clicks // for non-doors/apcs /mob/living/silicon/robot/CtrlShiftClickOn(var/atom/A) @@ -156,7 +151,7 @@ clicks, you can do so here, but you will have to change attack_robot() above to the proper function */ -/mob/living/silicon/robot/UnarmedAttack(atom/A) +/mob/living/silicon/robot/ResolveUnarmedAttack(atom/A) return A.attack_robot(src) /mob/living/silicon/robot/RangedAttack(atom/A, var/params) diff --git a/code/_onclick/ghost.dm b/code/_onclick/ghost.dm index d36410ef6aea..a47458ff2f18 100644 --- a/code/_onclick/ghost.dm +++ b/code/_onclick/ghost.dm @@ -61,15 +61,3 @@ /obj/effect/portal/attack_ghost(mob/user) if(target) user.forceMove(get_turf(target)) - -/obj/machinery/gateway/centerstation/attack_ghost(mob/user) - if(awaygate) - user.forceMove(awaygate.loc) - else - to_chat(user, "[src] has no destination.") - -/obj/machinery/gateway/centeraway/attack_ghost(mob/user) - if(stationgate) - user.forceMove(stationgate.loc) - else - to_chat(user, "[src] has no destination.") diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index 41016eea0b09..51398a81da00 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -52,12 +52,9 @@ #define ui_movi "RIGHT-2:24,BOTTOM:5" #define ui_attack_selector "RIGHT-2:27,BOTTOM+2:9" #define ui_zonesel "RIGHT-1:28,BOTTOM:5" -#define ui_acti_alt "RIGHT-1:28,BOTTOM:5" //alternative intent switcher for when the interface is hidden #define ui_stamina "RIGHT-2:24,BOTTOM:8" -#define ui_borg_pull "RIGHT-3:24,BOTTOM+1:7" -#define ui_borg_module "RIGHT-2:26,BOTTOM+1:7" -#define ui_borg_panel "RIGHT-1:28,BOTTOM+1:7" +#define ui_borg_module "RIGHT-1:28,BOTTOM+1:7" //Gun buttons #define ui_gun1 "RIGHT-1:28,BOTTOM+3:7" diff --git a/code/_onclick/hud/hud_elements/hud_auxilliary.dm b/code/_onclick/hud/hud_elements/hud_auxilliary.dm index 42ae7a89178c..bcf8503f5a4b 100644 --- a/code/_onclick/hud/hud_elements/hud_auxilliary.dm +++ b/code/_onclick/hud/hud_elements/hud_auxilliary.dm @@ -25,6 +25,9 @@ /decl/hud_element/attack elem_type = /obj/screen/default_attack_selector +/decl/hud_element/modifiers + elem_type = /obj/screen/mob_modifiers + /decl/hud_element/stamina elem_type = /obj/screen/stamina elem_updates_in_life = TRUE diff --git a/code/_onclick/hud/hud_elements/hud_robot.dm b/code/_onclick/hud/hud_elements/hud_robot.dm index a47c9c7866f0..687d673f3a27 100644 --- a/code/_onclick/hud/hud_elements/hud_robot.dm +++ b/code/_onclick/hud/hud_elements/hud_robot.dm @@ -1,4 +1,5 @@ /datum/hud/robot + offset_hands_vertically = FALSE gun_mode_toggle_type = /obj/screen/gun/mode omit_hud_elements = list( /decl/hud_element/health, @@ -23,7 +24,6 @@ /decl/hud_element/module_selection, /decl/hud_element/robot_inventory, /decl/hud_element/robot_radio, - /decl/hud_element/robot_panel, /decl/hud_element/robot_store, /decl/hud_element/robot_drop_grab ) @@ -45,15 +45,12 @@ elem_is_auxilliary = FALSE /decl/hud_element/module_selection - elem_type = /obj/screen/robot/module/select + elem_type = /obj/screen/robot/module elem_is_auxilliary = FALSE /decl/hud_element/robot_radio elem_type = /obj/screen/robot/radio -/decl/hud_element/robot_panel - elem_type = /obj/screen/robot/panel - /decl/hud_element/robot_store elem_type = /obj/screen/robot/store diff --git a/code/_onclick/hud/hud_types/_hud.dm b/code/_onclick/hud/hud_types/_hud.dm index d0a95fe197f5..c14dcf7c378e 100644 --- a/code/_onclick/hud/hud_types/_hud.dm +++ b/code/_onclick/hud/hud_types/_hud.dm @@ -25,11 +25,10 @@ hud_used = new hud_used(src) if(istype(hud_used)) hud_used.refresh_hud_icons() - refresh_lighting_master() /datum/hud /// A reference to our owning mob. - var/mob/mymob + VAR_PRIVATE/weakref/owner /// Used for the HUD toggle (F12) VAR_PRIVATE/hud_shown = TRUE // Used for showing or hiding the equipment buttons on the left. @@ -79,7 +78,8 @@ /decl/hud_element/oxygen, /decl/hud_element/toxins, /decl/hud_element/bodytemp, - /decl/hud_element/pressure + /decl/hud_element/pressure, + /decl/hud_element/modifiers ) /// /decl/hud_element types to be inserted into hud_elements_to_create during init. VAR_PROTECTED/list/additional_hud_elements @@ -99,10 +99,12 @@ VAR_PRIVATE/obj/screen/gun/item/gun_item_use_toggle VAR_PRIVATE/obj/screen/gun/radio/gun_radio_use_toggle + var/offset_hands_vertically = TRUE -/datum/hud/New(mob/owner) - mymob = owner - instantiate() +/datum/hud/New(mob/_owner) + if(istype(_owner)) + owner = weakref(_owner) + instantiate(_owner) ..() /datum/hud/Destroy() @@ -117,10 +119,11 @@ LAZYCLEARLIST(hud_elem_decl_to_object) QDEL_NULL_LIST(all_hud_elements) - if(mymob) + var/mob/mymob = owner?.resolve() + if(istype(mymob)) if(mymob.hud_used == src) mymob.hud_used = null - mymob = null + QDEL_NULL(owner) /datum/hud/proc/is_hud_shown() return hud_shown @@ -133,8 +136,10 @@ return elem?.update_icon() || FALSE /datum/hud/proc/refresh_hud_icons() - for(var/obj/screen/elem in mymob?.client?.screen) - elem.queue_icon_update() + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) + for(var/obj/screen/elem in mymob.client.screen) + elem.queue_icon_update() /datum/hud/proc/is_inventory_shown() return inventory_shown @@ -142,29 +147,39 @@ /datum/hud/proc/hide_inventory() inventory_shown = FALSE if(LAZYLEN(hud_elements_hidable)) - mymob?.client?.screen -= hud_elements_hidable + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) + mymob.client.screen -= hud_elements_hidable hidden_inventory_update() persistent_inventory_update() /datum/hud/proc/show_inventory() inventory_shown = TRUE if(LAZYLEN(hud_elements_hidable)) - mymob?.client?.screen += hud_elements_hidable + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) + mymob.client.screen += hud_elements_hidable hidden_inventory_update() persistent_inventory_update() /datum/hud/proc/hidden_inventory_update() - var/decl/species/species = mymob?.get_species() + var/mob/mymob = owner?.resolve() + var/decl/species/species = istype(mymob) && mymob.get_species() if(istype(species?.species_hud)) refresh_inventory_slots(species.species_hud.hidden_slots, (inventory_shown && hud_shown)) /datum/hud/proc/persistent_inventory_update() - var/decl/species/species = mymob?.get_species() + var/mob/mymob = owner?.resolve() + var/decl/species/species = istype(mymob) && mymob.get_species() if(istype(species?.species_hud)) refresh_inventory_slots(species.species_hud.persistent_slots, hud_shown) /datum/hud/proc/refresh_inventory_slots(var/list/checking_slots, var/show_hud) + var/mob/mymob = owner?.resolve() + if(!istype(mymob)) + return FALSE + for(var/slot in checking_slots) var/datum/inventory_slot/inv_slot = mymob.get_inventory_slot_datum(slot) @@ -183,18 +198,36 @@ else inv_slot.show_slot() -/datum/hud/proc/instantiate() - if(ismob(mymob) && mymob.client) - finalize_instantiation() + return TRUE + +/datum/hud/proc/instantiate(mob/_owner) + if(ismob(_owner) && _owner.client) + finalize_instantiation(_owner) refresh_hud_icons() return TRUE return FALSE /datum/hud/proc/handle_life_hud_update() + + var/mob/mymob = owner?.resolve() + if(!istype(mymob)) + return FALSE + + if(mymob.buckled || mymob.restrained()) + mymob.add_mob_modifier(/decl/mob_modifier/restrained, source = mymob) + else + mymob.remove_mob_modifier(/decl/mob_modifier/restrained, source = mymob) + + if(mymob.current_posture?.prone) + mymob.add_mob_modifier(/decl/mob_modifier/prone, source = mymob) + else + mymob.remove_mob_modifier(/decl/mob_modifier/prone, source = mymob) + for(var/obj/screen/elem as anything in hud_elements_update_in_life) elem.update_icon() + return TRUE -/datum/hud/proc/finalize_instantiation() +/datum/hud/proc/finalize_instantiation(mob/_owner) SHOULD_CALL_PARENT(TRUE) @@ -215,11 +248,11 @@ //Handle the gun settings buttons if(!gun_mode_toggle && gun_mode_toggle_type) - gun_mode_toggle = new gun_mode_toggle_type(null, mymob, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) + gun_mode_toggle = new gun_mode_toggle_type(null, _owner, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) LAZYADD(hud_elements_auxilliary, gun_mode_toggle) - gun_item_use_toggle = new(null, mymob, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) - gun_move_toggle = new(null, mymob, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) - gun_radio_use_toggle = new(null, mymob, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) + gun_item_use_toggle = new(null, _owner, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) + gun_move_toggle = new(null, _owner, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) + gun_radio_use_toggle = new(null, _owner, ui_style, ui_color, ui_alpha, HUD_FIRE_INTENT) build_inventory_ui() build_hands_ui() @@ -239,16 +272,17 @@ all_hud_elements |= hud_elements_auxilliary UNSETEMPTY(all_hud_elements) - if(mymob.client) - mymob.client.screen = list() + if(_owner.client) + _owner.client.screen = list() if(LAZYLEN(all_hud_elements)) - mymob.client.screen |= all_hud_elements + _owner.client.screen |= all_hud_elements hide_inventory() /datum/hud/proc/get_ui_style_data() RETURN_TYPE(/decl/ui_style) - . = GET_DECL(mymob?.client?.prefs?.UI_style) || GET_DECL(default_ui_style) + var/mob/mymob = owner?.resolve() + . = (istype(mymob) && GET_DECL(mymob.client?.prefs?.UI_style)) || GET_DECL(default_ui_style) if(!.) var/list/available_styles = get_ui_styles() if(length(available_styles)) @@ -258,13 +292,19 @@ var/decl/ui_style/ui_style = get_ui_style_data() if(!ui_style?.use_ui_color) return COLOR_WHITE - return mymob?.client?.prefs?.UI_style_color || COLOR_WHITE + var/mob/mymob = owner?.resolve() + return (istype(mymob) && mymob.client?.prefs?.UI_style_color) || COLOR_WHITE /datum/hud/proc/get_ui_alpha() - return mymob?.client?.prefs?.UI_style_alpha || 255 + var/mob/mymob = owner?.resolve() + return (istype(mymob) && mymob.client?.prefs?.UI_style_alpha) || 255 /datum/hud/proc/rebuild_hands() + var/mob/mymob = owner?.resolve() + if(!istype(mymob)) + return FALSE + var/decl/ui_style/ui_style = get_ui_style_data() var/ui_color = get_ui_color() var/ui_alpha = get_ui_alpha() @@ -315,20 +355,28 @@ // Rebuild offsets for the hand elements. var/hand_y_offset = 21 var/list/elements = hud_elements_hands?.Copy() - while(length(elements)) - var/copy_index = min(length(elements), 2)+1 - var/list/sublist = elements.Copy(1, copy_index) - elements.Cut(1, copy_index) - var/obj/screen/inventory/inv_box - if(length(sublist) == 1) - inv_box = sublist[1] - inv_box.screen_loc = "CENTER,BOTTOM:[hand_y_offset]" + if(length(elements)) + if(offset_hands_vertically) + while(length(elements)) + var/copy_index = min(length(elements), 2)+1 + var/list/sublist = elements.Copy(1, copy_index) + elements.Cut(1, copy_index) + var/obj/screen/inventory/inv_box + if(length(sublist) == 1) + inv_box = sublist[1] + inv_box.screen_loc = "CENTER,BOTTOM:[hand_y_offset]" + else + inv_box = sublist[1] + inv_box.screen_loc = "CENTER:-[world.icon_size/2],BOTTOM:[hand_y_offset]" + inv_box = sublist[2] + inv_box.screen_loc = "CENTER:[world.icon_size/2],BOTTOM:[hand_y_offset]" + hand_y_offset += world.icon_size else - inv_box = sublist[1] - inv_box.screen_loc = "CENTER:-[world.icon_size/2],BOTTOM:[hand_y_offset]" - inv_box = sublist[2] - inv_box.screen_loc = "CENTER:[world.icon_size/2],BOTTOM:[hand_y_offset]" - hand_y_offset += world.icon_size + var/hand_x_offset = -((length(elements) * world.icon_size) / 2) + (world.icon_size/2) + for(var/obj/screen/inventory/inv_box in elements) + inv_box.screen_loc = "CENTER:[hand_x_offset],BOTTOM:[hand_y_offset]" + hand_x_offset += world.icon_size + hand_y_offset += world.icon_size if(mymob.client && islist(hud_elements_hands) && length(hud_elements_hands)) mymob.client.screen |= hud_elements_hands @@ -355,8 +403,16 @@ if(mymob.client) mymob.client.screen |= swap_elem + update_hand_elements() + + return TRUE + /datum/hud/proc/build_inventory_ui() + var/mob/mymob = owner?.resolve() + if(!istype(mymob)) + return FALSE + var/decl/ui_style/ui_style = get_ui_style_data() var/ui_color = get_ui_color() var/ui_alpha = get_ui_alpha() @@ -392,11 +448,17 @@ if(has_hidden_gear) hud_elements_auxilliary += new /obj/screen/toggle(null, mymob, ui_style, ui_color, ui_alpha, HUD_INVENTORY) + return TRUE + /datum/hud/proc/build_hands_ui() + var/mob/mymob = owner?.resolve() + if(!istype(mymob)) + return FALSE + var/list/held_slots = mymob.get_held_item_slots() if(length(held_slots) <= 0) - return + return FALSE var/decl/ui_style/ui_style = get_ui_style_data() var/ui_color = get_ui_color() @@ -414,6 +476,7 @@ // Actual hand elems. rebuild_hands() + return TRUE /datum/hud/proc/toggle_show_inventory() if(inventory_shown) @@ -427,57 +490,63 @@ return action_buttons_hidden /datum/hud/proc/toggle_minimize(var/full) - if(hud_shown) - hud_shown = FALSE - if(hud_elements_auxilliary) - mymob?.client?.screen -= hud_elements_auxilliary - if(hud_elements_hidable) - mymob?.client?.screen -= hud_elements_hidable - if(hud_elements_hotkeys) - mymob?.client?.screen -= hud_elements_hotkeys - if(!full) - if(LAZYLEN(hud_elements_hands)) - mymob?.client?.screen += hud_elements_hands // we want the hands to be visible - if(LAZYLEN(hud_elements_swap)) - mymob?.client?.screen += hud_elements_swap // we want the hands swap thingy to be visible - else - hud_shown = TRUE - if(LAZYLEN(hud_elements_auxilliary)) - mymob?.client?.screen |= hud_elements_auxilliary - if(LAZYLEN(hud_elements_hidable) && inventory_shown) - mymob?.client?.screen |= hud_elements_hidable - if(LAZYLEN(hud_elements_hotkeys) && !hotkey_ui_hidden) - mymob?.client?.screen |= hud_elements_hotkeys + hud_shown = !hud_shown + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) + if(hud_shown) + if(LAZYLEN(hud_elements_auxilliary)) + mymob.client.screen |= hud_elements_auxilliary + if(LAZYLEN(hud_elements_hidable) && inventory_shown) + mymob.client.screen |= hud_elements_hidable + if(LAZYLEN(hud_elements_hotkeys) && !hotkey_ui_hidden) + mymob.client.screen |= hud_elements_hotkeys + else + if(hud_elements_auxilliary) + mymob.client.screen -= hud_elements_auxilliary + if(hud_elements_hidable) + mymob.client.screen -= hud_elements_hidable + if(hud_elements_hotkeys) + mymob.client.screen -= hud_elements_hotkeys + if(!full) + if(LAZYLEN(hud_elements_hands)) + mymob.client.screen += hud_elements_hands // we want the hands to be visible + if(LAZYLEN(hud_elements_swap)) + mymob.client.screen += hud_elements_swap // we want the hands swap thingy to be visible + hidden_inventory_update() persistent_inventory_update() + return TRUE /datum/hud/proc/toggle_zoom_hud() - if(hud_shown) - hud_shown = FALSE - if(LAZYLEN(hud_elements_auxilliary)) - mymob?.client?.screen -= hud_elements_auxilliary - if(LAZYLEN(hud_elements_hidable)) - mymob?.client?.screen -= hud_elements_hidable - if(LAZYLEN(hud_elements_hotkeys)) - mymob?.client?.screen -= hud_elements_hotkeys - else - hud_shown = TRUE - if(LAZYLEN(hud_elements_auxilliary)) - mymob?.client?.screen += hud_elements_auxilliary - if(LAZYLEN(hud_elements_hidable) && inventory_shown) - mymob?.client?.screen += hud_elements_hidable - if(LAZYLEN(hud_elements_hotkeys) && !hotkey_ui_hidden) - mymob?.client?.screen += hud_elements_hotkeys + hud_shown = !hud_shown + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) + if(hud_shown) + if(LAZYLEN(hud_elements_auxilliary)) + mymob.client.screen += hud_elements_auxilliary + if(LAZYLEN(hud_elements_hidable) && inventory_shown) + mymob.client.screen += hud_elements_hidable + if(LAZYLEN(hud_elements_hotkeys) && !hotkey_ui_hidden) + mymob.client.screen += hud_elements_hotkeys + else + if(LAZYLEN(hud_elements_auxilliary)) + mymob.client.screen -= hud_elements_auxilliary + if(LAZYLEN(hud_elements_hidable)) + mymob.client.screen -= hud_elements_hidable + if(LAZYLEN(hud_elements_hotkeys)) + mymob.client.screen -= hud_elements_hotkeys + hidden_inventory_update() persistent_inventory_update() /datum/hud/proc/toggle_hotkeys() - if(hotkey_ui_hidden) - mymob?.client?.screen += hud_elements_hotkeys - hotkey_ui_hidden = 0 - else - mymob?.client?.screen -= hud_elements_hotkeys - hotkey_ui_hidden = TRUE + hotkey_ui_hidden = !hotkey_ui_hidden + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) + if(hotkey_ui_hidden) + mymob.client.screen -= hud_elements_hotkeys + else + mymob.client.screen += hud_elements_hotkeys /mob/verb/toggle_hotkey_verbs() set category = "OOC" @@ -537,13 +606,15 @@ // This can runtime if someone manages to throw a gun out of their hand before the proc is called. if(!gun_item_use_toggle) return TRUE - if(mymob?.client) + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) mymob.client.screen |= gun_item_use_toggle mymob.client.screen |= gun_move_toggle mymob.client.screen |= gun_radio_use_toggle /datum/hud/proc/remove_gun_icons() - if(mymob?.client) + var/mob/mymob = owner?.resolve() + if(istype(mymob) && mymob.client) mymob.client.screen -= gun_item_use_toggle mymob.client.screen -= gun_move_toggle mymob.client.screen -= gun_radio_use_toggle @@ -574,8 +645,11 @@ gun_radio_use_toggle.update_icon() /datum/hud/proc/create_and_register_element(decl/hud_element/ui_elem, decl/ui_style/ui_style, ui_color, ui_alpha) - if(!istype(ui_elem) || !ui_elem.elem_type) + + var/mob/mymob = owner?.resolve() + if(!istype(mymob) || !istype(ui_elem) || !ui_elem.elem_type) return FALSE + var/obj/screen/elem = new ui_elem.elem_type(null, mymob, ui_style, ui_color, ui_alpha, ui_elem.elem_reference_type) if(ui_elem.elem_is_hotkey) LAZYDISTINCTADD(hud_elements_hotkeys, elem) diff --git a/code/_onclick/hud/hud_types/robot.dm b/code/_onclick/hud/hud_types/robot.dm index 9dd085ffe9c3..a84112549ad1 100644 --- a/code/_onclick/hud/hud_types/robot.dm +++ b/code/_onclick/hud/hud_types/robot.dm @@ -9,86 +9,3 @@ /datum/hud/robot/get_ui_alpha() return 255 - -// TODO: Convert robots to use inventory slots. -/datum/hud/robot/finalize_instantiation() - var/mob/living/silicon/robot/R = mymob - if(!istype(R)) - return ..() - R.inv1 = new(null, mymob) - R.inv2 = new(null, mymob) - R.inv3 = new(null, mymob) - LAZYINITLIST(hud_elements_auxilliary) - hud_elements_auxilliary += R.inv1 - hud_elements_auxilliary += R.inv2 - hud_elements_auxilliary += R.inv3 - ..() - -/datum/hud/proc/toggle_show_robot_modules() - if(!isrobot(mymob)) - return - var/mob/living/silicon/robot/r = mymob - r.shown_robot_modules = !r.shown_robot_modules - update_robot_modules_display() - -/datum/hud/proc/update_robot_modules_display() - if(!isrobot(mymob) || !mymob.client) - return - - var/mob/living/silicon/robot/R = mymob - - if(R.shown_robot_modules) - if(R.active_storage) - R.active_storage.close(R) //Closes the inventory ui. - - if(!R.module) - to_chat(R, SPAN_WARNING("No module selected.")) - return - - if(!R.module.equipment) - to_chat(R, SPAN_WARNING("Selected module has no equipment available.")) - return - - if(!R.robot_modules_background) - return - - var/display_rows = ceil(R.module.equipment.len / 8) - R.robot_modules_background.screen_loc = "CENTER-4:16,BOTTOM+1:7 to CENTER+3:16,BOTTOM+[display_rows]:7" - R.client.screen += R.robot_modules_background - - var/x = -4 //Start at CENTER-4,SOUTH+1 - var/y = 1 - - //Unfortunately adding the emag module to the list of modules has to be here. This is because a borg can - //be emagged before they actually select a module. - or some situation can cause them to get a new module - // - or some situation might cause them to get de-emagged or something. - if(R.emagged) - if(!(R.module.emag in R.module.equipment)) - R.module.equipment.Add(R.module.emag) - else - if(R.module.emag in R.module.equipment) - R.module.equipment.Remove(R.module.emag) - - for(var/atom/movable/A in R.module.equipment) - if( (A != R.module_state_1) && (A != R.module_state_2) && (A != R.module_state_3) ) - //Module is not currently active - R.client.screen += A - if(x < 0) - A.screen_loc = "CENTER[x]:[WORLD_ICON_SIZE/2],BOTTOM+[y]:7" - else - A.screen_loc = "CENTER+[x]:[WORLD_ICON_SIZE/2],BOTTOM+[y]:7" - A.hud_layerise() - - x++ - if(x == 4) - x = -4 - y++ - - else - //Modules display is hidden - for(var/atom/A in R.module.equipment) - if( (A != R.module_state_1) && (A != R.module_state_2) && (A != R.module_state_3) ) - //Module is not currently active - R.client.screen -= A - R.shown_robot_modules = 0 - R.client.screen -= R.robot_modules_background diff --git a/code/_onclick/hud/screen/robot/screen_robot_drop_grab.dm b/code/_onclick/hud/screen/robot/screen_robot_drop_grab.dm index c3e71cef3d06..bff32e2bc888 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_drop_grab.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_drop_grab.dm @@ -8,8 +8,8 @@ /obj/screen/robot/drop_grab/handle_click(mob/user, params) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - R.drop_item() + var/mob/living/silicon/robot/robot = user + robot.drop_item() update_icon() /obj/screen/robot/drop_grab/on_update_icon() diff --git a/code/_onclick/hud/screen/robot/screen_robot_inventory.dm b/code/_onclick/hud/screen/robot/screen_robot_inventory.dm index a6360e2eaaab..ab8d4815f9f8 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_inventory.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_inventory.dm @@ -5,8 +5,8 @@ /obj/screen/robot/inventory/handle_click(mob/user, params) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - if(R.module) - R.hud_used.toggle_show_robot_modules() - return 1 - to_chat(R, "You haven't selected a module yet.") + var/mob/living/silicon/robot/robot = user + if(robot.module) + robot.module.storage?.open(user) + else + to_chat(robot, "You haven't selected a module yet.") diff --git a/code/_onclick/hud/screen/robot/screen_robot_module.dm b/code/_onclick/hud/screen/robot/screen_robot_module.dm index 95e662167ec2..69c0fde190f3 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_module.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_module.dm @@ -1,17 +1,17 @@ -/obj/screen/robot/module/select +/obj/screen/robot/module name = "module" icon = 'icons/mob/screen/styles/robot/module.dmi' icon_state = "nomod" screen_loc = ui_borg_module -/obj/screen/robot/module/select/on_update_icon() +/obj/screen/robot/module/on_update_icon() . = ..() icon_state = initial(icon_state) var/mob/living/silicon/robot/owner = owner_ref?.resolve() if(istype(owner) && owner.modtype) icon_state = lowertext(owner.modtype) -/obj/screen/robot/module/select/handle_click(mob/user, params) +/obj/screen/robot/module/handle_click(mob/user, params) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - R.pick_module() + var/mob/living/silicon/robot/robot = user + robot.pick_module() diff --git a/code/_onclick/hud/screen/robot/screen_robot_modules.dm b/code/_onclick/hud/screen/robot/screen_robot_modules.dm index 0e82b4fe44f6..09029a035fde 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_modules.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_modules.dm @@ -2,33 +2,3 @@ name = "module" icon_state = "block" icon = 'icons/mob/screen/styles/robot/modules_background.dmi' - -/obj/screen/robot/module - dir = SOUTHWEST - icon = 'icons/mob/screen/styles/robot/modules_inventory.dmi' - var/module_index - -/obj/screen/robot/module/handle_click(mob/user, params) - if(isrobot(user) && !isnull(module_index)) - var/mob/living/silicon/robot/robot = user - robot.toggle_module(module_index) - return TRUE - return ..() - -/obj/screen/robot/module/one - name = "module1" - icon_state = "inv1" - screen_loc = ui_inv1 - module_index = 1 - -/obj/screen/robot/module/two - name = "module2" - icon_state = "inv2" - screen_loc = ui_inv2 - module_index = 2 - -/obj/screen/robot/module/three - name = "module3" - icon_state = "inv3" - screen_loc = ui_inv3 - module_index = 3 diff --git a/code/_onclick/hud/screen/robot/screen_robot_panel.dm b/code/_onclick/hud/screen/robot/screen_robot_panel.dm deleted file mode 100644 index 9f39909a52f9..000000000000 --- a/code/_onclick/hud/screen/robot/screen_robot_panel.dm +++ /dev/null @@ -1,9 +0,0 @@ -/obj/screen/robot/panel - name = "panel" - icon_state = "panel" - screen_loc = ui_borg_panel - -/obj/screen/robot/panel/handle_click(mob/user, params) - if(isrobot(user)) - var/mob/living/silicon/robot/R = user - R.installed_modules() diff --git a/code/_onclick/hud/screen/robot/screen_robot_radio.dm b/code/_onclick/hud/screen/robot/screen_robot_radio.dm index 5207edef2b47..96f2364ca600 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_radio.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_radio.dm @@ -6,5 +6,5 @@ /obj/screen/robot/radio/handle_click(mob/user, params) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - R.radio_menu() \ No newline at end of file + var/mob/living/silicon/robot/robot = user + robot.radio_menu() \ No newline at end of file diff --git a/code/_onclick/hud/screen/robot/screen_robot_store.dm b/code/_onclick/hud/screen/robot/screen_robot_store.dm index 93f1a652b96e..90b46cae00c5 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_store.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_store.dm @@ -4,10 +4,10 @@ screen_loc = ui_borg_store /obj/screen/robot/store/handle_click(mob/user, params) - if(isrobot(user)) - var/mob/living/silicon/robot/R = user - if(R.module) - R.uneq_active() - R.hud_used.update_robot_modules_display() - else - to_chat(R, "You haven't selected a module yet.") + var/mob/living/silicon/robot/robot = user + if(istype(robot) && robot.module) + var/obj/item/active_item = robot.get_active_held_item() + if(active_item) + user.try_unequip(active_item, robot.module, FALSE) + else + to_chat(robot, "You haven't selected a module yet.") diff --git a/code/_onclick/hud/screen/screen_drop.dm b/code/_onclick/hud/screen/screen_drop.dm index 085922329c75..716c451252a9 100644 --- a/code/_onclick/hud/screen/screen_drop.dm +++ b/code/_onclick/hud/screen/screen_drop.dm @@ -2,6 +2,8 @@ name = "drop" icon_state = "act_drop" screen_loc = ui_drop_throw + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE /obj/screen/drop/handle_click(mob/user, params) if(user.client) diff --git a/code/_onclick/hud/screen/screen_equip.dm b/code/_onclick/hud/screen/screen_equip.dm index 39ca9349ad81..589edc66a05d 100644 --- a/code/_onclick/hud/screen/screen_equip.dm +++ b/code/_onclick/hud/screen/screen_equip.dm @@ -1,6 +1,8 @@ /obj/screen/equip name = "equip" icon_state = "act_equip" + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE /obj/screen/equip/handle_click(mob/user, params) if(ishuman(user)) diff --git a/code/_onclick/hud/screen/screen_gun.dm b/code/_onclick/hud/screen/screen_gun.dm index e0bc13fee624..4cb1eee5886f 100644 --- a/code/_onclick/hud/screen/screen_gun.dm +++ b/code/_onclick/hud/screen/screen_gun.dm @@ -2,6 +2,8 @@ icon = 'icons/mob/screen/styles/midnight/fire_intent.dmi' dir = SOUTH abstract_type = /obj/screen/gun + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE var/base_icon_state var/toggle_flag diff --git a/code/_onclick/hud/screen/screen_inventory.dm b/code/_onclick/hud/screen/screen_inventory.dm index 3714bc5fb107..09f921ed552e 100644 --- a/code/_onclick/hud/screen/screen_inventory.dm +++ b/code/_onclick/hud/screen/screen_inventory.dm @@ -59,11 +59,17 @@ MA.plane = HUD_PLANE MA.alpha = 80 MA.color = mouse_over_atom.mob_can_equip(owner, slot_id, TRUE) ? COLOR_GREEN : COLOR_RED - MA.pixel_x = mouse_over_atom.default_pixel_x - MA.pixel_y = mouse_over_atom.default_pixel_y - MA.pixel_w = mouse_over_atom.default_pixel_w - MA.pixel_z = mouse_over_atom.default_pixel_z + // We don't respect default_pixel_x or similar here because items should always be centered in their slots; defaults are for world-space. + MA.pixel_x = 0 + MA.pixel_y = 0 + MA.pixel_w = 0 + MA.pixel_z = 0 MA.appearance_flags |= (KEEP_TOGETHER | RESET_COLOR) + // We need to color the entire thing, overlays and underlays included. + for(var/image/overlay in MA.overlays) + overlay.appearance_flags &= ~(KEEP_TOGETHER | RESET_COLOR) + for(var/image/underlay in MA.underlays) + underlay.appearance_flags &= ~(KEEP_TOGETHER | RESET_COLOR) add_overlay(MA) else mouse_over_atom_ref = null diff --git a/code/_onclick/hud/screen/screen_maneuver.dm b/code/_onclick/hud/screen/screen_maneuver.dm index ddfdf15d7d6c..4052a690a53c 100644 --- a/code/_onclick/hud/screen/screen_maneuver.dm +++ b/code/_onclick/hud/screen/screen_maneuver.dm @@ -2,6 +2,8 @@ name = "Prepare Maneuver" icon_state = "maneuver_off" screen_loc = ui_pull_resist + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE /obj/screen/maneuver/handle_click(mob/user, params) if(isliving(user)) diff --git a/code/_onclick/hud/screen/screen_mob_modifier.dm b/code/_onclick/hud/screen/screen_mob_modifier.dm new file mode 100644 index 000000000000..d8d32bd3c586 --- /dev/null +++ b/code/_onclick/hud/screen/screen_mob_modifier.dm @@ -0,0 +1,158 @@ +/obj/screen/mob_modifiers + screen_loc = "CENTER,TOP" + icon_state = "blank" + requires_ui_style = FALSE + + // Disable these due to vis_contents behaving oddly with them. + use_supplied_ui_color = FALSE + use_supplied_ui_alpha = FALSE + + // TODO: consider pooling these. + var/list/elements + var/const/modifier_size = 18 + +/obj/screen/mob_modifiers/Initialize(mapload, mob/_owner, decl/ui_style/ui_style, ui_color, ui_alpha, ui_cat) + . = ..() + START_PROCESSING(SSprocessing, src) + +/obj/screen/mob_modifiers/Destroy() + STOP_PROCESSING(SSprocessing, src) + QDEL_NULL_LIST(elements) + return ..() + +/obj/screen/mob_modifiers/Process() + if(QDELETED(src)) + return PROCESS_KILL + var/mob/living/owner = owner_ref?.resolve() + if(!istype(owner)) + return PROCESS_KILL + for(var/obj/screen/mob_modifier/element in elements) + var/expire_time = MOB_MODIFIER_INDEFINITE + for(var/datum/mob_modifier/modifier in LAZYACCESS(owner._mob_modifiers, element.archetype)) + if(modifier.expire_time == MOB_MODIFIER_INDEFINITE) + expire_time = MOB_MODIFIER_INDEFINITE + break + expire_time = max(expire_time, modifier.expire_time) + if(istype(element)) + element.update_maptext(expire_time == MOB_MODIFIER_INDEFINITE ? MOB_MODIFIER_INDEFINITE : (expire_time - world.time)) + +/obj/screen/mob_modifiers/on_update_icon() + + if(QDELETED(src)) + return + + var/mob/living/owner = owner_ref?.resolve() + if(!istype(owner) || !istype(owner.hud_used)) + return + + var/list/seen_archetypes + var/list/elements_to_keep + var/list/elements_to_add + var/list/elements_to_remove + + // Track deltas for keeping/removing existing elements. + for(var/obj/screen/mob_modifier/element in elements) + var/list/modifiers = LAZYACCESS(owner._mob_modifiers, element.archetype) + if(length(modifiers)) + LAZYADD(elements_to_keep, element) + else + LAZYADD(elements_to_remove, element) + LAZYDISTINCTADD(seen_archetypes, element.archetype) + + var/decl/ui_style/ui_style = owner.hud_used.get_ui_style_data() + var/ui_color = owner.hud_used.get_ui_color() + var/ui_alpha = owner.hud_used.get_ui_alpha() + + // Create elements for new modifiers. + for(var/decl/mob_modifier/archetype in owner._mob_modifiers) + if(archetype in seen_archetypes) + continue + var/obj/screen/mob_modifier/element = new(null, owner, ui_style, ui_color, ui_alpha, HUD_MODIFIERS) + element.archetype = archetype + element.holder = src + element.pixel_y = 32 + element.alpha = 0 + element.update_icon() + LAZYADD(elements_to_add, element) + + // Fade out and delete expired markers. + if(LAZYLEN(elements_to_remove)) + LAZYREMOVE(elements, elements_to_remove) + for(var/obj/screen/mob_modifier/element in elements_to_remove) + animate(element, alpha = 0, pixel_y = 32, time = 5) + QDEL_IN(element, 5) + + // Add our new records. + if(LAZYLEN(elements_to_add)) + LAZYADD(elements, elements_to_add) + add_vis_contents(elements_to_add) + + // Adjust positions and fade in new elements. + if(length(elements)) + var/offset_x = -(((length(elements)-1) * modifier_size) / 2) + for(var/obj/screen/element in elements) + if(element in elements_to_add) + pixel_x = offset_x + animate(element, alpha = 255, pixel_x = offset_x, pixel_y = 0, time = 5) + offset_x += modifier_size + +/obj/screen/mob_modifier + alpha = 0 + screen_loc = null // not handled via screen loc, but via vis contents of the holder object. + maptext_x = -8 + maptext_y = -3 + icon_state = "modifier_base" + // these must be enabled + use_supplied_ui_alpha = TRUE + use_supplied_ui_color = TRUE + var/decl/mob_modifier/archetype + var/obj/screen/mob_modifiers/holder + +/obj/screen/mob_modifier/Destroy() + if(holder) + LAZYREMOVE(holder.elements, src) + holder.remove_vis_contents(src) + holder = null + return ..() + +/obj/screen/mob_modifier/rebuild_screen_overlays() + . = ..() + if(archetype) + add_overlay(overlay_image(archetype.hud_icon, archetype.hud_icon_state, COLOR_WHITE, RESET_COLOR)) + +/obj/screen/mob_modifier/proc/update_maptext(duration) + if(archetype.hide_expiry) + maptext = null + return + + if(duration == MOB_MODIFIER_INDEFINITE) + if(archetype.show_indefinite_duration) + maptext = STYLE_SMALLFONTS_OUTLINE("
∞
", 12, COLOR_WHITE, COLOR_BLACK) + else + maptext = null + else if(duration <= 0) + maptext = STYLE_SMALLFONTS_OUTLINE("
0
", 7, COLOR_WHITE, COLOR_BLACK) + else + maptext = STYLE_SMALLFONTS_OUTLINE("
[ticks2shortreadable(duration) || 0]
", 7, COLOR_WHITE, COLOR_BLACK) + +/obj/screen/mob_modifier/handle_click(mob/user, params) + if((. = ..())) + var/mob/living/owner = owner_ref?.resolve() + if(istype(owner) && archetype) + var/list/modifiers = LAZYACCESS(owner._mob_modifiers, archetype) + for(var/datum/mob_modifier/modifier in modifiers) + modifier.on_modifier_click(params) + return + +/obj/screen/mob_modifier/MouseEntered(location, control, params) + if(archetype && (archetype.name || archetype.desc)) + openToolTip(user = usr, tip_src = src, params = params, title = archetype.name, content = archetype.desc) + ..() + +/obj/screen/mob_modifier/MouseDown() + closeToolTip(usr) + ..() + +/obj/screen/mob_modifier/MouseExited() + closeToolTip(usr) + ..() diff --git a/code/_onclick/hud/screen/screen_resist.dm b/code/_onclick/hud/screen/screen_resist.dm index 9bdb07a9a0b9..ff781aa09c7a 100644 --- a/code/_onclick/hud/screen/screen_resist.dm +++ b/code/_onclick/hud/screen/screen_resist.dm @@ -2,6 +2,8 @@ name = "resist" icon_state = "act_resist" screen_loc = ui_pull_resist + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE /obj/screen/resist/handle_click(mob/user, params) if(isliving(user)) diff --git a/code/_onclick/hud/screen/screen_stamina.dm b/code/_onclick/hud/screen/screen_stamina.dm index b70d9e743618..5d4f34b32da9 100644 --- a/code/_onclick/hud/screen/screen_stamina.dm +++ b/code/_onclick/hud/screen/screen_stamina.dm @@ -4,6 +4,9 @@ icon_state = "prog_bar_100" invisibility = INVISIBILITY_MAXIMUM screen_loc = ui_stamina + use_supplied_ui_color = FALSE + use_supplied_ui_alpha = FALSE + use_supplied_ui_icon = FALSE requires_ui_style = FALSE layer = HUD_BASE_LAYER + 0.1 // needs to layer over the movement intent element diff --git a/code/_onclick/hud/screen/screen_throw.dm b/code/_onclick/hud/screen/screen_throw.dm index 1b4de10e6e87..5d2d9888ec02 100644 --- a/code/_onclick/hud/screen/screen_throw.dm +++ b/code/_onclick/hud/screen/screen_throw.dm @@ -2,6 +2,8 @@ name = "throw" icon_state = "act_throw_off" screen_loc = ui_drop_throw + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE /obj/screen/throw_toggle/handle_click(mob/user, params) if(!user.stat && isturf(user.loc) && !user.restrained()) diff --git a/code/_onclick/hud/screen/screen_toggle.dm b/code/_onclick/hud/screen/screen_toggle.dm index 4f534e230f33..ddcf626e8c26 100644 --- a/code/_onclick/hud/screen/screen_toggle.dm +++ b/code/_onclick/hud/screen/screen_toggle.dm @@ -2,6 +2,8 @@ name = "toggle" icon_state = "other" screen_loc = ui_inventory + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE /obj/screen/toggle/handle_click(mob/user, params) if(!user.hud_used) diff --git a/code/_onclick/hud/screen/screen_warning_oxygen.dm b/code/_onclick/hud/screen/screen_warning_oxygen.dm index f964f7017a6c..507e80dea53d 100644 --- a/code/_onclick/hud/screen/screen_warning_oxygen.dm +++ b/code/_onclick/hud/screen/screen_warning_oxygen.dm @@ -23,7 +23,7 @@ var/datum/gas_mixture/environment = owner.loc?.return_air() if(!environment) return - var/decl/species/species = get_species_by_key(global.using_map.default_species) + var/decl/species/species = decls_repository.get_decl_by_id(global.using_map.default_species) if(!species.breath_type || environment.gas[species.breath_type] > species.breath_pressure) for(var/gas in species.poison_types) if(environment.gas[gas]) diff --git a/code/_onclick/hud/screen/screen_zone_selector.dm b/code/_onclick/hud/screen/screen_zone_selector.dm index 51b36db21255..567b5645da3d 100644 --- a/code/_onclick/hud/screen/screen_zone_selector.dm +++ b/code/_onclick/hud/screen/screen_zone_selector.dm @@ -2,6 +2,8 @@ name = "damage zone" icon_state = "zone_sel_tail" screen_loc = ui_zonesel + use_supplied_ui_color = TRUE + use_supplied_ui_alpha = TRUE /obj/screen/zone_selector/handle_click(mob/user, params) var/list/PL = params2list(params) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index b92356b4a145..f38f1a25e243 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -48,10 +48,10 @@ avoid code duplication. This includes items that may sometimes act as a standard return FALSE -/atom/movable/attackby(obj/item/W, mob/user) +/atom/movable/attackby(obj/item/used_item, mob/user) . = ..() if(!.) - return bash(W,user) + return bash(used_item,user) // Return TRUE if further actions (afterattack, etc) should be prevented, FALSE if they can proceed. /atom/movable/proc/bash(obj/item/weapon, mob/user) @@ -154,7 +154,8 @@ avoid code duplication. This includes items that may sometimes act as a standard user.setClickCooldown(attack_cooldown + w_class) if(animate) user.do_attack_animation(target) - if(!user.aura_check(AURA_TYPE_WEAPON, src, user)) + + if(target.mob_modifiers_block_attack(MM_ATTACK_TYPE_WEAPON, user, src)) return FALSE var/hit_zone = target.resolve_item_attack(src, user, user.get_target_zone()) diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 04f398c519aa..1cc25ce2b5e3 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -55,7 +55,7 @@ return climb_up(A) var/obj/item/clothing/gloves/G = get_equipped_item(slot_gloves_str) - if(istype(G) && G.Touch(A,0)) // for magic gloves + if(istype(G) && G.Touch(A, FALSE)) // for magic gloves return TRUE . = ..() @@ -96,13 +96,8 @@ /* Animals */ - -/mob/living/simple_animal/UnarmedAttack(var/atom/A, var/proximity) - - . = ..() - if(.) - return - +/// Make unarmed attacks use natural weapons on harm intent. +/mob/living/simple_animal/ResolveUnarmedAttack(atom/A) var/attacking_with = get_natural_weapon() if(check_intent(I_FLAG_HELP) || !attacking_with) return A.attack_animal(src) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index f5f59fe940ca..7c24faa29d7e 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -187,7 +187,6 @@ var/global/datum/controller/master/Master = new var/msg = "Initializations complete within [time] second\s!" report_progress(msg) - log_world(msg) initializing = FALSE diff --git a/code/controllers/subsystems/holomap.dm b/code/controllers/subsystems/holomap.dm index ac6662184f62..0d2cc7371e49 100644 --- a/code/controllers/subsystems/holomap.dm +++ b/code/controllers/subsystems/holomap.dm @@ -104,4 +104,5 @@ SUBSYSTEM_DEF(minimap) if(!areas[areaToPaint]) areas[areaToPaint] = icon(HOLOMAP_ICON, "blank") areas[areaToPaint].DrawBox(HOLOMAP_AREACOLOR_BASE, x + offset_x, y + offset_y) //We draw white because we want a generic version to use later. However if there is no colour we ignore it + CHECK_TICK return areas \ No newline at end of file diff --git a/code/controllers/subsystems/initialization/codex_dump.dm b/code/controllers/subsystems/initialization/codex_dump.dm index c417e887a572..b12dd686d78b 100644 --- a/code/controllers/subsystems/initialization/codex_dump.dm +++ b/code/controllers/subsystems/initialization/codex_dump.dm @@ -127,7 +127,7 @@ TODO: work out how to implement an external search function. address_to_body[address] = convert.convert_body(codex_entry.name, codex_entry.get_codex_body(include_header = FALSE, include_footer = FALSE)) // Copied from del_the_world UT exceptions list. - var/static/list/skip_types = list( + var/static/list/skip_types = typesof( /obj/item/organ/external/chest, /obj/machinery/power/apc, /obj/machinery/alarm, @@ -144,7 +144,7 @@ TODO: work out how to implement an external search function. if(!TYPE_IS_SPAWNABLE(atom) || !initial(atom.simulated)) continue try - atom = atom_info_repository.get_instance_of(atom) + atom = new atom_type if(!istype(atom)) // Something went wrong, possibly a runtime in the atom info repo. continue var/datum/codex_entry/codex_entry = atom.get_specific_codex_entry() @@ -161,6 +161,8 @@ TODO: work out how to implement an external search function. address_to_entry[address] = codex_entry entry_to_address[codex_entry] = address address_to_body[address] = convert.convert_body(codex_entry.name, codex_entry.get_codex_body(include_header = FALSE, include_footer = FALSE)) + if(!QDELETED(atom)) + qdel(atom, force = TRUE) // clean up after yourself, goddang catch(var/exception/E) PRINT_STACK_TRACE("Exception when performing codex dump for [atom_type]: [E]") diff --git a/code/controllers/subsystems/initialization/fabrication.dm b/code/controllers/subsystems/initialization/fabrication.dm index 37a6d57dfae0..6fd2b5c28dbd 100644 --- a/code/controllers/subsystems/initialization/fabrication.dm +++ b/code/controllers/subsystems/initialization/fabrication.dm @@ -15,8 +15,7 @@ SUBSYSTEM_DEF(fabrication) /datum/controller/subsystem/fabrication/Initialize() // Fab recipes. - for(var/R in subtypesof(/datum/fabricator_recipe)) - var/datum/fabricator_recipe/recipe = R + for(var/datum/fabricator_recipe/recipe as anything in subtypesof(/datum/fabricator_recipe)) if(!initial(recipe.path)) continue recipe = new recipe diff --git a/code/controllers/subsystems/initialization/materials.dm b/code/controllers/subsystems/initialization/materials.dm index d82b3df641bb..9ce2feb2c266 100644 --- a/code/controllers/subsystems/initialization/materials.dm +++ b/code/controllers/subsystems/initialization/materials.dm @@ -6,8 +6,6 @@ SUBSYSTEM_DEF(materials) priority = SS_PRIORITY_MATERIALS // Material vars. - var/list/materials - var/list/strata var/list/fusion_reactions var/list/weighted_minerals_sparse = list() var/list/weighted_minerals_rich = list() @@ -54,9 +52,8 @@ SUBSYSTEM_DEF(materials) sortTim(cocktails_by_primary_ingredient[reagent], /proc/cmp_cocktail_des) // Various other material functions. - build_material_lists() // Build core material lists. + build_mineral_weight_lists() build_fusion_reaction_list() // Build fusion reaction tree. - materials = sortTim(SSmaterials.materials, /proc/cmp_name_asc) var/alpha_inc = 256 / DAMAGE_OVERLAY_COUNT for(var/i = 1; i <= DAMAGE_OVERLAY_COUNT; i++) @@ -65,18 +62,11 @@ SUBSYSTEM_DEF(materials) img.alpha = (i * alpha_inc) - 1 LAZYADD(wall_damage_overlays, img) - strata = decls_repository.get_decls_of_subtype(/decl/strata) // for debug VV purposes - . = ..() -/datum/controller/subsystem/materials/proc/build_material_lists() - if(LAZYLEN(materials)) - return - materials = list() - var/list/material_decls = decls_repository.get_decls_of_subtype(/decl/material) - for(var/mtype in material_decls) - var/decl/material/new_mineral = material_decls[mtype] - materials += new_mineral +/datum/controller/subsystem/materials/proc/build_mineral_weight_lists() + var/list/material_decls = decls_repository.get_decls_of_subtype_unassociated(/decl/material) + for(var/decl/material/new_mineral as anything in material_decls) if(new_mineral.sparse_material_weight) weighted_minerals_sparse[new_mineral.type] = new_mineral.sparse_material_weight if(new_mineral.rich_material_weight) diff --git a/code/controllers/subsystems/jobs.dm b/code/controllers/subsystems/jobs.dm index 311b9f487c0f..722dd50bee4c 100644 --- a/code/controllers/subsystems/jobs.dm +++ b/code/controllers/subsystems/jobs.dm @@ -438,14 +438,14 @@ SUBSYSTEM_DEF(jobs) var/list/spawn_in_storage = list() if(H.client.prefs.Gear() && job.loadout_allowed) for(var/thing in H.client.prefs.Gear()) - var/decl/loadout_option/G = decls_repository.get_decl_by_id_or_var(thing, /decl/loadout_option) - if(!istype(G)) + var/decl/loadout_option/gear = decls_repository.get_decl_by_id_or_var(thing, /decl/loadout_option) + if(!istype(gear)) continue - if(!G.is_permitted(H, job)) + if(!gear.is_permitted(H, job)) to_chat(H, SPAN_WARNING("Your current species, job, branch, skills or whitelist status does not permit you to spawn with [thing]!")) continue - if(!G.slot || !G.spawn_on_mob(H, H.client.prefs.Gear()[G.uid])) - spawn_in_storage.Add(G) + if(!gear.slot || !gear.spawn_on_mob(H, H.client.prefs.Gear()[gear.uid])) + spawn_in_storage.Add(gear) // do accessories last so they don't attach to a suit that will be replaced if(H.char_rank && H.char_rank.accessory) @@ -537,8 +537,8 @@ SUBSYSTEM_DEF(jobs) return other_mob if(spawn_in_storage) - for(var/decl/loadout_option/G in spawn_in_storage) - G.spawn_in_storage_or_drop(H, H.client.prefs.Gear()[G.uid]) + for(var/decl/loadout_option/gear in spawn_in_storage) + gear.spawn_in_storage_or_drop(H, H.client.prefs.Gear()[gear.uid]) var/article = job.total_positions == 1 ? "the" : "a" to_chat(H, "You are [article] [alt_title || job_title].") @@ -573,7 +573,7 @@ SUBSYSTEM_DEF(jobs) return positions_by_department[dept] || list() /datum/controller/subsystem/jobs/proc/spawn_empty_ai() - for(var/obj/abstract/landmark/start/S in global.landmarks_list) + for(var/obj/abstract/landmark/start/S in global.all_landmarks) if(S.name != "AI") continue if(locate(/mob/living) in S.loc) diff --git a/code/controllers/subsystems/lighting.dm b/code/controllers/subsystems/lighting.dm index 068353abbe0c..43e79dea97ef 100644 --- a/code/controllers/subsystems/lighting.dm +++ b/code/controllers/subsystems/lighting.dm @@ -8,13 +8,16 @@ SUBSYSTEM_DEF(lighting) var/total_lighting_overlays = 0 var/total_lighting_sources = 0 var/total_ambient_turfs = 0 - var/list/lighting_corners = list() // List of all lighting corners in the world. + var/total_lighting_corners = 0 - var/list/light_queue = list() // lighting sources queued for update. + /// lighting sources queued for update. + var/list/light_queue = list() var/lq_idex = 1 - var/list/corner_queue = list() // lighting corners queued for update. + /// lighting corners queued for update. + var/list/corner_queue = list() var/cq_idex = 1 - var/list/overlay_queue = list() // lighting overlays queued for update. + /// lighting overlays queued for update. + var/list/overlay_queue = list() var/oq_idex = 1 var/tmp/processed_lights = 0 @@ -25,18 +28,20 @@ SUBSYSTEM_DEF(lighting) var/total_instant_updates = 0 #ifdef USE_INTELLIGENT_LIGHTING_UPDATES + var/instant_ctr = 0 var/force_queued = TRUE - var/force_override = FALSE // For admins. + /// For admins. + var/force_override = FALSE #endif /datum/controller/subsystem/lighting/stat_entry() var/list/out = list( #ifdef USE_INTELLIGENT_LIGHTING_UPDATES - "IUR: [total_ss_updates ? round(total_instant_updates/(total_instant_updates+total_ss_updates)*100, 0.1) : "NaN"]%\n", + "IUR: [total_ss_updates ? round(total_instant_updates/(total_instant_updates+total_ss_updates)*100, 0.1) : "NaN"]% Instant: [force_queued ? "Disabled" : "Allowed"]\n", #endif - "\tT:{L:[total_lighting_sources] C:[lighting_corners.len] O:[total_lighting_overlays] A:[total_ambient_turfs]}\n", - "\tP:{L:[light_queue.len - (lq_idex - 1)]|C:[corner_queue.len - (cq_idex - 1)]|O:[overlay_queue.len - (oq_idex - 1)]}\n", - "\tL:{L:[processed_lights]|C:[processed_corners]|O:[processed_overlays]}\n" + "\tT: { L: [total_lighting_sources] C: [total_lighting_corners] O:[total_lighting_overlays] A: [total_ambient_turfs] }\n", + "\tP: { L: [light_queue.len - (lq_idex - 1)] C: [corner_queue.len - (cq_idex - 1)] O: [overlay_queue.len - (oq_idex - 1)] }\n", + "\tL: { L: [processed_lights] C: [processed_corners] O: [processed_overlays]}\n" ) ..(out.Join()) @@ -46,6 +51,32 @@ SUBSYSTEM_DEF(lighting) force_queued = FALSE total_ss_updates = 0 total_instant_updates = 0 + +/// Disable instant updates, relying entirely on the (slower, but less laggy) queued pathway. Use if changing a *lot* of lights. +/datum/controller/subsystem/lighting/proc/pause_instant() + if (force_override) + return + + instant_ctr += 1 + if (instant_ctr == 1) + force_queued = TRUE + +/// Resume instant updates. +/datum/controller/subsystem/lighting/proc/resume_instant() + if (force_override) + return + + instant_ctr = max(instant_ctr - 1, 0) + + if (!instant_ctr) + force_queued = FALSE + +#else + +/datum/controller/subsystem/lighting/proc/pause_instant() + +/datum/controller/subsystem/lighting/proc/resume_instant() + #endif /datum/controller/subsystem/lighting/Initialize(timeofday) @@ -157,7 +188,7 @@ SUBSYSTEM_DEF(lighting) oq_idex = 1 /datum/controller/subsystem/lighting/Recover() - lighting_corners = SSlighting.lighting_corners + total_lighting_corners = SSlighting.total_lighting_corners total_lighting_overlays = SSlighting.total_lighting_overlays total_lighting_sources = SSlighting.total_lighting_sources diff --git a/code/controllers/subsystems/machines.dm b/code/controllers/subsystems/machines.dm index 19a5202daa38..ca54acb3d7d3 100644 --- a/code/controllers/subsystems/machines.dm +++ b/code/controllers/subsystems/machines.dm @@ -94,7 +94,7 @@ if(current_step == this_step || (check_resumed && !resumed)) {\ for(var/datum/powernet/PN in powernets) qdel(PN) powernets.Cut() - setup_powernets_for_cables(global.cable_list) + setup_powernets_for_cables(global.all_cables) /datum/controller/subsystem/machines/proc/setup_powernets_for_cables(list/cables) for(var/obj/structure/cable/PC in cables) diff --git a/code/controllers/subsystems/supply.dm b/code/controllers/subsystems/supply.dm index baf6e4c614de..69bde2c28c2d 100644 --- a/code/controllers/subsystems/supply.dm +++ b/code/controllers/subsystems/supply.dm @@ -40,13 +40,10 @@ SUBSYSTEM_DEF(supply) ordernum = rand(1,9000) //Build master supply list - var/decl/hierarchy/supply_pack/root = GET_DECL(/decl/hierarchy/supply_pack) - for(var/decl/hierarchy/supply_pack/sp in root.children) - if(sp.is_category()) - for(var/decl/hierarchy/supply_pack/spc in sp.get_descendants()) - spc.setup() - master_supply_list += spc - CHECK_TICK + var/decl/hierarchy/supply_pack/root = IMPLIED_DECL + for(var/decl/hierarchy/supply_pack/pack in root.get_descendants()) + if(!pack.is_category()) + master_supply_list += pack // Just add points over time. /datum/controller/subsystem/supply/fire() @@ -62,68 +59,63 @@ SUBSYSTEM_DEF(supply) point_sources[source] += amount point_sources["total"] += amount - //To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types. -/datum/controller/subsystem/supply/proc/forbidden_atoms_check(atom/A) - if(isliving(A)) - return 1 - if(istype(A,/obj/item/disk/nuclear)) - return 1 - if(istype(A,/obj/machinery/nuclearbomb)) - return 1 - if(istype(A,/obj/item/radio/beacon)) - return 1 - - for(var/i=1, i<=A.contents.len, i++) - var/atom/B = A.contents[i] - if(.(B)) - return 1 +/// To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types. +/datum/controller/subsystem/supply/proc/forbidden_atoms_check(atom/checking) + if(isliving(checking)) // You can't send a mob to the admin level. + return TRUE + if(istype(checking, /obj/item/disk/nuclear)) // Keep it somewhere nuclear operatives can reach it. + return TRUE + if(istype(checking, /obj/machinery/nuclearbomb)) // Don't nuke the admin level. + return TRUE + if(istype(checking, /obj/item/radio/beacon)) // Because these can be used for teleportation, I guess? + return TRUE + + for(var/atom/child in checking.contents) + if(forbidden_atoms_check(child)) + return TRUE + return FALSE /datum/controller/subsystem/supply/proc/sell() - for(var/area/subarea in shuttle.shuttle_area) - for(var/atom/movable/AM in subarea) - if(AM.anchored) + for(var/obj/structure/closet/crate/sold_crate in subarea) + if(sold_crate.anchored) continue - if(istype(AM, /obj/structure/closet/crate)) - var/obj/structure/closet/crate/CR = AM - RAISE_EVENT(/decl/observ/crate_sold, subarea, CR) - add_points_from_source(CR.get_single_monetary_worth() * crate_return_rebate * 0.1, "crate") - var/find_slip = 1 - - for(var/atom/atom as anything in CR) - // Sell manifests - if(find_slip && istype(atom, /obj/item/paper/manifest)) - var/obj/item/paper/manifest/slip = atom - if(!LAZYACCESS(slip.metadata, "is_copy") && LAZYLEN(slip.applied_stamps)) - add_points_from_source(LAZYACCESS(slip.metadata, "order_total") * slip_return_rebate, "manifest") - find_slip = 0 - continue - - // Sell materials - if(is_type_in_list(atom, saleable_materials)) - add_points_from_source(atom.get_combined_monetary_worth() * goods_sale_modifier * 0.1, "goods") - // Must sell ore detector disks in crates - else if(istype(atom, /obj/item/disk/survey)) - add_points_from_source(atom.get_combined_monetary_worth() * 0.005, "data") - - qdel(AM) + RAISE_EVENT(/decl/observ/crate_sold, subarea, sold_crate) + add_points_from_source(sold_crate.get_single_monetary_worth() * crate_return_rebate * 0.1, "crate") + var/find_slip = TRUE + + for(var/atom/movable/subcontent as anything in sold_crate) + // Sell manifests + if(find_slip && istype(subcontent, /obj/item/paper/manifest)) + var/obj/item/paper/manifest/slip = subcontent + if(!LAZYACCESS(slip.metadata, "is_copy") && LAZYLEN(slip.applied_stamps)) + add_points_from_source(LAZYACCESS(slip.metadata, "order_total") * slip_return_rebate, "manifest") + find_slip = FALSE + continue + + // Sell materials + if(is_type_in_list(subcontent, saleable_materials)) + add_points_from_source(subcontent.get_combined_monetary_worth() * goods_sale_modifier * 0.1, "goods") + // Must sell ore detector disks in crates + else if(istype(subcontent, /obj/item/disk/survey)) + add_points_from_source(subcontent.get_combined_monetary_worth() * 0.005, "data") + + qdel(sold_crate) /datum/controller/subsystem/supply/proc/get_clear_turfs() var/list/clear_turfs = list() - for(var/area/subarea in shuttle.shuttle_area) - for(var/turf/T in subarea) - if(T.density) + for(var/turf/candidate_turf in subarea) + if(candidate_turf.density) continue - var/occupied = 0 - for(var/atom/A in T.contents) - if(!A.simulated) + var/occupied = FALSE + for(var/atom/movable/child as anything in candidate_turf.contents) + if(!child.simulated || !child.density) continue - occupied = 1 + occupied = TRUE break if(!occupied) - clear_turfs += T - + clear_turfs += candidate_turf return clear_turfs //Buyin @@ -133,56 +125,55 @@ SUBSYSTEM_DEF(supply) var/list/clear_turfs = get_clear_turfs() - for(var/S in shoppinglist) + for(var/datum/supply_order/order in shoppinglist) if(!clear_turfs.len) break var/turf/pickedloc = pick_n_take(clear_turfs) - shoppinglist -= S - donelist += S + shoppinglist -= order + donelist += order - var/datum/supply_order/SO = S - var/decl/hierarchy/supply_pack/SP = SO.object + var/decl/hierarchy/supply_pack/supplypack = order.object - var/obj/A = new SP.containertype(pickedloc) - A.SetName("[SP.containername][SO.comment ? " ([SO.comment])":"" ]") + var/obj/result = new supplypack.containertype(pickedloc) + result.SetName("[supplypack.containername][order.comment ? " ([order.comment])":"" ]") //supply manifest generation begin var/obj/item/paper/manifest/slip - if(!SP.contraband) + if(!supplypack.contraband) var/info = list() info +="

[global.using_map.boss_name] Shipping Manifest



" - info +="Order #[SO.ordernum]
" + info +="Order #[order.ordernum]
" info +="Destination: [global.using_map.station_name]
" info +="[shoppinglist.len] PACKAGES IN THIS SHIPMENT
" info +="CONTENTS:
    " - slip = new /obj/item/paper/manifest(A, null, JOINTEXT(info)) - LAZYSET(slip.metadata, "order_total", SP.cost) + slip = new /obj/item/paper/manifest(result, null, JOINTEXT(info)) + LAZYSET(slip.metadata, "order_total", supplypack.cost) LAZYSET(slip.metadata, "is_copy", FALSE) //spawn the stuff, finish generating the manifest while you're at it - if(SP.access) - if(!islist(SP.access)) - A.req_access = list(SP.access) - else if(islist(SP.access)) - var/list/L = SP.access // access var is a plain var, we need a list - A.req_access = L.Copy() - - var/list/spawned = SP.spawn_contents(A) + if(supplypack.access) + if(!islist(supplypack.access)) + result.req_access = list(supplypack.access) + else if(islist(supplypack.access)) + var/list/supplypack_access = supplypack.access // access var is a plain var, we need a list + result.req_access = supplypack_access.Copy() + + var/list/spawned = supplypack.spawn_contents(result) if(slip) for(var/atom/content in spawned) slip.info += "
  • [content.name]
  • " //add the item to the manifest slip.info += "

CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS
" // Adds any given item to the supply shuttle -/datum/controller/subsystem/supply/proc/addAtom(var/atom/movable/A) +/datum/controller/subsystem/supply/proc/addAtom(var/atom/movable/added) var/list/clear_turfs = get_clear_turfs() if(!clear_turfs.len) return FALSE var/turf/pickedloc = pick(clear_turfs) - A.forceMove(pickedloc) + added.forceMove(pickedloc) return TRUE diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 89122cad2f97..5c097d91ba2b 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -315,7 +315,7 @@ Helpers /datum/controller/subsystem/ticker/proc/attempt_late_antag_spawn(var/list/antag_choices) var/decl/special_role/antag = antag_choices[1] while(antag_choices.len && antag) - var/needs_ghost = antag.flags & (ANTAG_OVERRIDE_JOB | ANTAG_OVERRIDE_MOB) + var/needs_ghost = antag.is_latejoin_template() if (needs_ghost) looking_for_antags = 1 antag_pool.Cut() diff --git a/code/controllers/subsystems/zcopy.dm b/code/controllers/subsystems/zcopy.dm index 1f550d0aeeb1..e0dfe3f0b1cb 100644 --- a/code/controllers/subsystems/zcopy.dm +++ b/code/controllers/subsystems/zcopy.dm @@ -494,6 +494,8 @@ SUBSYSTEM_DEF(zcopy) // return: is-invalid /datum/controller/subsystem/zcopy/proc/discover_movable(atom/movable/object) ASSERT(!QDELETED(object)) + if(init_state < SS_INITSTATE_STARTED) + return FALSE // no-op, discover_movable is only valid during or after zcopy init var/turf/Tloc = object.loc if (!isturf(Tloc) || !MOVABLE_SHALL_MIMIC(object)) @@ -503,12 +505,13 @@ SUBSYSTEM_DEF(zcopy) ZM_RECORD_START + var/above_needs_discovery = FALSE if (!object.bound_overlay) var/atom/movable/openspace/mimic/M = new(T) object.bound_overlay = M + M.z_flags = object.z_flags // Necessary to ensure MOVABLE_IS_ON_ZTURF works M.associated_atom = object - if (TURF_IS_MIMICKING(M.loc)) - .(M) + above_needs_discovery = TRUE var/override_depth var/original_type = object.type @@ -559,6 +562,9 @@ SUBSYSTEM_DEF(zcopy) ZM_RECORD_STOP ZM_RECORD_WRITE(discovery_stats, "Depth [OO.depth] on [OO.z]") + if (above_needs_discovery && MOVABLE_IS_ON_ZTURF(OO)) + discover_movable(OO) // recursion! + return FALSE /datum/controller/subsystem/zcopy/proc/flush_z_state(turf/T) diff --git a/code/datums/ai/beast.dm b/code/datums/ai/beast.dm index 9090698f55aa..f730e939e913 100644 --- a/code/datums/ai/beast.dm +++ b/code/datums/ai/beast.dm @@ -41,8 +41,8 @@ if(!length(.)) if(LAZYLEN(prey)) . = list() - for(var/weakref/W in prey) - var/mob/M = W.resolve() + for(var/weakref/prey_ref in prey) + var/mob/M = prey_ref.resolve() if(M) . |= M else if(body.get_nutrition() < body.get_max_nutrition() * 0.75) //time to look for some food diff --git a/code/datums/appearances/appearance_manager.dm b/code/datums/appearances/appearance_manager.dm index d196a89303dc..be42ee3bd184 100644 --- a/code/datums/appearances/appearance_manager.dm +++ b/code/datums/appearances/appearance_manager.dm @@ -23,7 +23,7 @@ /decl/appearance_manager/proc/remove_appearances(var/mob/viewer) var/datum/priority_queue/pq = appearances_[viewer] - for(var/entry in pq.L) + for(var/entry in pq.GetQueue()) var/datum/appearance_data/ad = entry ad.RemoveViewer(viewer, FALSE) if(viewer in appearances_) @@ -39,7 +39,7 @@ var/datum/priority_queue/pq = appearances_[viewer] if(!pq) return - for(var/entry in pq.L) + for(var/entry in pq.GetQueue()) var/datum/appearance_data/ad = entry viewer.client.images -= ad.images @@ -49,6 +49,6 @@ var/datum/priority_queue/pq = appearances_[viewer] if(!pq) return - for(var/entry in pq.L) + for(var/entry in pq.GetQueue()) var/datum/appearance_data/ad = entry viewer.client.images |= ad.images diff --git a/code/datums/appearances/automatic/cardborg.dm b/code/datums/appearances/automatic/cardborg.dm index 52ad0031f3bb..dcc909286344 100644 --- a/code/datums/appearances/automatic/cardborg.dm +++ b/code/datums/appearances/automatic/cardborg.dm @@ -34,19 +34,19 @@ var/obj/item/back = H.get_equipped_item(slot_back_str) if(!istype(back)) return - var/decl/cardborg_appearance/ca = appearances[back.type] - if(!ca) ca = appearances[/obj/item/backpack] + var/decl/cardborg_appearance/disguise = appearances[back.type] + if(!disguise) disguise = appearances[/obj/item/backpack] - var/image/I = image(icon = ca.icon, icon_state = ca.icon_state, loc = H) + var/image/I = image(icon = disguise.icon, icon_state = disguise.icon_state, loc = H) I.override = 1 - I.overlays += image(icon = ca.icon, icon_state = "[ca.icon_state]-eyes") //gotta look realistic + I.overlays += image(icon = disguise.icon, icon_state = "[disguise.icon_state]-eyes") //gotta look realistic return I /decl/appearance_handler/cardborg/proc/init_appearances() if(!appearances) appearances = list() - for(var/decl/cardborg_appearance/ca in init_subtypes(/decl/cardborg_appearance)) - appearances[ca.backpack_type] = ca + for(var/decl/cardborg_appearance/disguise in init_subtypes(/decl/cardborg_appearance)) + appearances[disguise.backpack_type] = disguise /decl/cardborg_appearance var/backpack_type diff --git a/code/datums/category.dm b/code/datums/category.dm index 1c2688ff57d3..d345573374c9 100644 --- a/code/datums/category.dm +++ b/code/datums/category.dm @@ -12,16 +12,16 @@ categories_by_name = new() for(var/category_type in typesof(category_group_type)) var/datum/category_group/category = category_type - if(initial(category.name)) - category = new category(src) - categories += category - categories_by_name[category.name] = category + if(TYPE_IS_ABSTRACT(category)) + continue + category = new category(src) + categories += category + ASSERT(category.name) + categories_by_name[category.name] = category categories = sortTim(categories, /proc/cmp_category_groups) /datum/category_collection/Destroy() - for(var/category in categories) - qdel(category) - categories.Cut() + QDEL_LIST(categories) return ..() /****************** @@ -43,10 +43,12 @@ for(var/item_type in typesof(category_item_type)) var/datum/category_item/item = item_type - if(initial(item.name)) - item = new item(src) - items += item - items_by_name[item.name] = item + if(TYPE_IS_ABSTRACT(item)) + continue + item = new item(src) + items += item + ASSERT(item.name) + items_by_name[item.name] = item // For whatever reason dd_insertObjectList(items, item) doesn't insert in the correct order // If you change this, confirm that character setup doesn't become completely unordered. @@ -67,6 +69,7 @@ * Category Items * *****************/ /datum/category_item + abstract_type = /datum/category_item var/name = "" var/datum/category_group/category // The group this item belongs to diff --git a/code/datums/cinematic.dm b/code/datums/cinematic.dm index 86ddc55b91f6..bf03370505e8 100644 --- a/code/datums/cinematic.dm +++ b/code/datums/cinematic.dm @@ -27,7 +27,7 @@ var/global/datum/cinematic/cinematic = new if(M.client) M.client.screen += cinematic_screen //show every client the cinematic viewers[M.client] = GET_STATUS(M, STAT_STUN) - M.set_status(STAT_STUN, 8000) + M.set_status_condition(STAT_STUN, 8000) override.nuke_act(cinematic_screen, station_missed) //cinematic happens here, as does mob death. //If it's actually the end of the round, wait for it to end. @@ -36,6 +36,6 @@ var/global/datum/cinematic/cinematic = new for(var/client/C in viewers) if(C.mob) - C.mob.set_status(STAT_STUN, viewers[C]) + C.mob.set_status_condition(STAT_STUN, viewers[C]) C.screen -= cinematic_screen QDEL_NULL(cinematic_screen) \ No newline at end of file diff --git a/code/datums/datum.dm b/code/datums/datum.dm index d4d9d3f5a1b5..881b69bb4e36 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -50,10 +50,8 @@ qdel(extension) extensions = null - var/decl/observ/destroyed/destroyed_event = GET_DECL(/decl/observ/destroyed) - // Typecheck is needed (rather than nullchecking) due to oddness with new() ordering during world creation. - if(istype(events_repository) && destroyed_event.event_sources[src]) - RAISE_EVENT(/decl/observ/destroyed, src) + if(event_listeners?[/decl/observ/destroyed]) + raise_event_non_global(/decl/observ/destroyed) if (!isturf(src)) // Not great, but the 'correct' way to do it would add overhead for little benefit. cleanup_events(src) diff --git a/code/datums/daycycle/time_of_day.dm b/code/datums/daycycle/time_of_day.dm index 5411dba4b076..fbe3f6330d7b 100644 --- a/code/datums/daycycle/time_of_day.dm +++ b/code/datums/daycycle/time_of_day.dm @@ -24,7 +24,7 @@ name = "daytime" announcement = "The sun rises over the horizon, beginning another day." period = 0.4 - power = 1 + power = 0.8 color = COLOR_DAYLIGHT /datum/daycycle_period/sunset diff --git a/code/datums/extensions/abilities/ability_handler.dm b/code/datums/extensions/abilities/ability_handler.dm index d215868a4c58..5ac742b00384 100644 --- a/code/datums/extensions/abilities/ability_handler.dm +++ b/code/datums/extensions/abilities/ability_handler.dm @@ -21,7 +21,7 @@ if(!istype(owner)) CRASH("Ability handler received invalid owner!") ..() - refresh_login() + refresh_login(being_created = TRUE) /datum/ability_handler/Process() @@ -211,7 +211,7 @@ stat(stat_strings[1], stat_strings[2]) /// Individual ability methods/disciplines (psioncs, etc.) so that mobs can have multiple. -/datum/ability_handler/proc/refresh_login() +/datum/ability_handler/proc/refresh_login(being_created = FALSE) SHOULD_CALL_PARENT(TRUE) if(LAZYLEN(screen_elements)) var/list/add_elements = list() diff --git a/code/datums/extensions/assembly/assembly_interaction.dm b/code/datums/extensions/assembly/assembly_interaction.dm index a4c4c8b2f920..7987ee9f8fd6 100644 --- a/code/datums/extensions/assembly/assembly_interaction.dm +++ b/code/datums/extensions/assembly/assembly_interaction.dm @@ -1,5 +1,5 @@ -/datum/extension/assembly/proc/attackby(var/obj/item/W, var/mob/user) - if(IS_WRENCH(W)) +/datum/extension/assembly/proc/attackby(var/obj/item/used_item, var/mob/user) + if(IS_WRENCH(used_item)) if(parts.len) to_chat(user, "Remove all components from \the [holder] before disassembling it.") return TRUE @@ -9,10 +9,10 @@ qdel(holder) return TRUE - if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W - if(!WT.isOn()) - to_chat(user, "\The [W] is off.") + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(!welder.isOn()) + to_chat(user, "\The [used_item] is off.") return TRUE if(!damage) @@ -20,12 +20,12 @@ return TRUE to_chat(user, "You begin repairing damage to \the [holder]...") - if(WT.weld(round(damage/75)) && do_after(user, damage/10)) + if(welder.weld(round(damage/75)) && do_after(user, damage/10)) damage = 0 to_chat(user, "You repair \the [holder].") return TRUE - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) if(!parts.len) to_chat(user, "This device doesn't have any components installed.") return TRUE @@ -47,24 +47,24 @@ uninstall_component(user, H) return TRUE - if(istype(W, /obj/item/card/id)) // ID Card, try to insert it. + if(istype(used_item, /obj/item/card/id)) // ID Card, try to insert it. var/obj/item/stock_parts/computer/card_slot/card_slot = get_component(PART_CARD) if(!card_slot) - to_chat(user, SPAN_WARNING("You try to insert [W] into [holder], but it does not have an ID card slot installed.")) + to_chat(user, SPAN_WARNING("You try to insert [used_item] into [holder], but it does not have an ID card slot installed.")) return TRUE - card_slot.insert_id(W, user) + card_slot.insert_id(used_item, user) return TRUE - if(istype(W, /obj/item/charge_stick)) // Try to insert charge stick. + if(istype(used_item, /obj/item/charge_stick)) // Try to insert charge stick. var/obj/item/stock_parts/computer/charge_stick_slot/mstick_slot = get_component(PART_MSTICK) if(!mstick_slot) - to_chat(user, SPAN_WARNING("You try to insert [W] into [holder], but it does not have a charge-stick slot installed.")) + to_chat(user, SPAN_WARNING("You try to insert [used_item] into [holder], but it does not have a charge-stick slot installed.")) return TRUE - mstick_slot.insert_stick(W, user) + mstick_slot.insert_stick(used_item, user) return TRUE - if(istype(W, PART_DRIVE)) // Portable HDD, try to insert it. - var/obj/item/stock_parts/computer/hard_drive/portable/I = W + if(istype(used_item, PART_DRIVE)) // Portable HDD, try to insert it. + var/obj/item/stock_parts/computer/hard_drive/portable/I = used_item var/obj/item/stock_parts/computer/drive_slot/drive_slot = get_component(PART_D_SLOT) if(!drive_slot) to_chat(user, SPAN_WARNING("You try to insert [I] into [holder], but it does not have a drive slot installed.")) @@ -72,8 +72,8 @@ drive_slot.insert_drive(I, user) return TRUE - if(istype(W, /obj/item/disk)) - var/obj/item/disk/disk = W + if(istype(used_item, /obj/item/disk)) + var/obj/item/disk/disk = used_item var/obj/item/stock_parts/computer/data_disk_drive/disk_drive = get_component(PART_DSKSLOT) if(!disk_drive) to_chat(user, SPAN_WARNING("You try to insert [disk] into [holder], but it does not have a disk slot installed.")) @@ -81,26 +81,26 @@ disk_drive.insert_disk(disk, user) return TRUE - if(istype(W, /obj/item/paper)) - var/obj/item/paper/paper = W + if(istype(used_item, /obj/item/paper)) + var/obj/item/paper/paper = used_item if(paper.info) var/obj/item/stock_parts/computer/scanner/scanner = get_component(PART_SCANNER) if(scanner) - scanner.attackby(user, W) + scanner.attackby(user, used_item) return TRUE - if(istype(W, /obj/item/paper) || istype(W, /obj/item/paper_bundle)) + if(istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/paper_bundle)) var/obj/item/stock_parts/computer/scanner/scanner = get_component(PART_SCANNER) if(scanner) - scanner.attackby(W, user) + scanner.attackby(used_item, user) return TRUE - if(istype(W, /obj/item/aicard)) + if(istype(used_item, /obj/item/aicard)) var/obj/item/stock_parts/computer/ai_slot/ai_slot = get_component(PART_AI) if(ai_slot) - ai_slot.attackby(W, user) + ai_slot.attackby(used_item, user) return TRUE - if(istype(W, /obj/item/stock_parts)) - return try_install_component(user, W) + if(istype(used_item, /obj/item/stock_parts)) + return try_install_component(user, used_item) return FALSE \ No newline at end of file diff --git a/code/datums/extensions/lockable.dm b/code/datums/extensions/lockable.dm index 095522d2f9b3..12fd928839ba 100644 --- a/code/datums/extensions/lockable.dm +++ b/code/datums/extensions/lockable.dm @@ -395,13 +395,13 @@ /** Called when a multitool is used on the holder to hack the device. */ -/datum/extension/lockable/proc/try_hack(obj/item/multitool/W, mob/user) +/datum/extension/lockable/proc/try_hack(obj/item/multitool/multitool, mob/user) //Don't do anything if the panel isn't opened, or if we're already hacking it. if(!open || l_hacking) return FALSE //Show a message to let the user know how likely this is to even succeed. - var/fail_chance = hack_fail_chance(W, user) + var/fail_chance = hack_fail_chance(multitool, user) var/skill_msg if(fail_chance >= 90) skill_msg = SPAN_WARNING("But, you struggle to make sense of this thing..") @@ -436,7 +436,7 @@ /** Returns a percent chance of the given user failing at hacking this lock. */ -/datum/extension/lockable/proc/hack_fail_chance(obj/item/multitool/W, mob/user) +/datum/extension/lockable/proc/hack_fail_chance(obj/item/multitool/multitool, mob/user) //In order to make the lock actually any use at all, make sure not just anybody with a multitool can open it. return user.skill_fail_chance(SKILL_DEVICES, 99, SKILL_MAX, 0.35) diff --git a/code/datums/hierarchy.dm b/code/datums/hierarchy.dm index 1186dcebc939..361295e09ae3 100644 --- a/code/datums/hierarchy.dm +++ b/code/datums/hierarchy.dm @@ -4,6 +4,8 @@ var/name = "Hierarchy" var/decl/hierarchy/parent var/list/decl/hierarchy/children + /// The cached result of get_descendants(). Should not be mutated. + VAR_PRIVATE/list/decl/hierarchy/_descendants var/expected_type /decl/hierarchy/Initialize() @@ -22,10 +24,13 @@ /decl/hierarchy/proc/get_descendants() if(!children) return - . = children.Copy() + if(_descendants) + return _descendants + _descendants = children.Copy() for(var/decl/hierarchy/child in children) if(child.children) - . |= child.get_descendants() + _descendants |= child.get_descendants() + return _descendants /decl/hierarchy/dd_SortValue() return name diff --git a/code/datums/inventory_slots/inventory_gripper.dm b/code/datums/inventory_slots/inventory_gripper.dm index 08d90f5bd49e..2f87394ca74e 100644 --- a/code/datums/inventory_slots/inventory_gripper.dm +++ b/code/datums/inventory_slots/inventory_gripper.dm @@ -1,13 +1,12 @@ /datum/inventory_slot/gripper + // For reference, grippers do not use ui_loc, they have it set dynamically during /datum/hud/proc/rebuild_hands() + quick_equip_priority = null // you quick-equip stuff by holding it in a gripper, so this ought to be skipped + fluid_height = (FLUID_SHALLOW + FLUID_OVER_MOB_HEAD) / 2 // halfway between waist and top of head, so roughly chest level, reasoning that you can just hold it up out of the water var/hand_sort_priority = 1 var/dexterity = DEXTERITY_FULL var/covering_slot_flags /// If set, use this icon_state for the hand slot overlay; otherwise, use slot_id. var/hand_overlay - quick_equip_priority = null // you quick-equip stuff by holding it in a gripper, so this ought to be skipped - fluid_height = (FLUID_SHALLOW + FLUID_OVER_MOB_HEAD) / 2 // halfway between waist and top of head, so roughly chest level, reasoning that you can just hold it up out of the water - - // For reference, grippers do not use ui_loc, they have it set dynamically during /datum/hud/proc/rebuild_hands() /datum/inventory_slot/gripper/proc/get_dexterity(var/silent) return dexterity @@ -32,16 +31,3 @@ /datum/inventory_slot/gripper/can_equip_to_slot(var/mob/user, var/obj/item/prop, var/disable_warning) return ..() && user.check_dexterity(DEXTERITY_EQUIP_ITEM, silent = disable_warning) - -// Stub definitions for future work and to pass CI. -/datum/inventory_slot/gripper/robot - abstract_type = /datum/inventory_slot/gripper/robot - -/datum/inventory_slot/gripper/robot/one - ui_label = "1" - -/datum/inventory_slot/gripper/robot/two - ui_label = "2" - -/datum/inventory_slot/gripper/robot/three - ui_label = "3" diff --git a/code/datums/inventory_slots/inventory_gripper_robot.dm b/code/datums/inventory_slots/inventory_gripper_robot.dm new file mode 100644 index 000000000000..11e521a8612f --- /dev/null +++ b/code/datums/inventory_slots/inventory_gripper_robot.dm @@ -0,0 +1,24 @@ +// Stub definitions for future work and to pass CI. +/datum/inventory_slot/gripper/robot + abstract_type = /datum/inventory_slot/gripper/robot + +/datum/inventory_slot/gripper/robot/can_equip_to_slot(var/mob/user, var/obj/item/prop, var/disable_warning) + var/mob/living/silicon/robot/robot = user + if(!istype(robot) || !robot.module || !(prop in robot.module.equipment)) + return FALSE + return ..() + +/datum/inventory_slot/gripper/robot/one + slot_name = "Primary Hardpoint" + slot_id = "slot_robot_one" + ui_label = "1" + +/datum/inventory_slot/gripper/robot/two + slot_name = "Secondary Hardpoint" + slot_id = "slot_robot_two" + ui_label = "2" + +/datum/inventory_slot/gripper/robot/three + slot_name = "Tertiary Hardpoint" + slot_id = "slot_robot_three" + ui_label = "3" diff --git a/code/datums/mind/memory.dm b/code/datums/mind/memory.dm index 34dacf9ef8a3..0089d7d8dfc9 100644 --- a/code/datums/mind/memory.dm +++ b/code/datums/mind/memory.dm @@ -7,8 +7,8 @@ . = mind.StoreMemory(memory, options) /datum/mind/proc/StoreMemory(var/memory, var/options) - var/decl/memory_options/MO = GET_DECL(options || /decl/memory_options/default) - return MO.Create(src, memory) + var/decl/memory_options/memory_option = GET_DECL(options || /decl/memory_options/default) + return memory_option.Create(src, memory) /datum/mind/proc/RemoveMemory(var/datum/memory/memory, var/mob/remover) if(!memory) @@ -20,20 +20,18 @@ ShowMemory(remover) /datum/mind/proc/ClearMemories(var/list/tags) - for(var/mem in memories) - var/datum/memory/M = mem + for(var/datum/memory/mem as anything in memories) // If no tags were supplied OR if there is any union between the given tags and memory tags // then remove the memory - if(!length(tags) || length(tags & M.tags)) - LAZYREMOVE(memories, M) + if(!length(tags) || length(tags & mem.tags)) + LAZYREMOVE(memories, mem) /datum/mind/proc/CopyMemories(var/datum/mind/target) if(!istype(target)) return - for(var/mem in memories) - var/datum/memory/M = mem - M.Copy(target) + for(var/datum/memory/mem in memories) + mem.Copy(target) /datum/mind/proc/MemoryTags() . = list() @@ -50,13 +48,12 @@ var/list/output = list() var/last_owner_name // We pretend that memories are stored in some semblance of an order - for(var/mem in memories) - var/datum/memory/M = mem - var/owner_name = M.OwnerName() + for(var/datum/memory/mem in memories) + var/owner_name = mem.OwnerName() if(owner_name != last_owner_name) output += "[current.real_name]'s Memories
" last_owner_name = owner_name - output += "[M.memory] \[Remove\]" + output += "[mem.memory] \[Remove\]" if(objectives.len > 0) output += "
Objectives:" @@ -161,9 +158,8 @@ return var/relevant_memories = 0 - for(var/mem in target.memories) - var/datum/memory/M = mem - if(M.type == memory_type) + for(var/datum/memory/mem in target.memories) + if(mem.type == memory_type) relevant_memories++ if(relevant_memories > memory_limit) diff --git a/code/datums/mind/mind.dm b/code/datums/mind/mind.dm index 1db348880015..27a740428272 100644 --- a/code/datums/mind/mind.dm +++ b/code/datums/mind/mind.dm @@ -46,12 +46,8 @@ var/list/datum/objective/objectives = list() - var/has_been_rev = 0//Tracks if this mind has been a rev or not - - var/rev_cooldown = 0 - - // the world.time since the mob has been brigged, or -1 if not at all - var/brigged_since = -1 + /// The world.time value after which another conversion can be attempted. + var/conversion_cooldown = 0 //put this here for easier tracking ingame var/datum/money_account/initial_account @@ -142,8 +138,8 @@ if(href_list["add_goal"]) - var/mob/calling_proc = locate(href_list["add_goal_caller"]) - if(calling_proc && calling_proc == current) can_modify = TRUE + var/mob/goal_user = locate(href_list["add_goal_user"]) + if(goal_user && goal_user == current) can_modify = TRUE if(can_modify) if(is_admin) @@ -161,8 +157,8 @@ if(href_list["abandon_goal"]) var/datum/goal/goal = get_goal_from_href(href_list["abandon_goal"]) - var/mob/calling_proc = locate(href_list["abandon_goal_caller"]) - if(calling_proc && calling_proc == current) can_modify = TRUE + var/mob/goal_user = locate(href_list["abandon_goal_user"]) + if(goal_user && goal_user == current) can_modify = TRUE if(goal && can_modify) if(usr == current) @@ -176,8 +172,8 @@ if(href_list["reroll_goal"]) var/datum/goal/goal = get_goal_from_href(href_list["reroll_goal"]) - var/mob/calling_proc = locate(href_list["reroll_goal_caller"]) - if(calling_proc && calling_proc == current) can_modify = TRUE + var/mob/goal_user = locate(href_list["reroll_goal_user"]) + if(goal_user && goal_user == current) can_modify = TRUE if(goal && (goal in goals) && can_modify) qdel(goal) @@ -394,46 +390,30 @@ switch(href_list["silicon"]) if("unemag") - var/mob/living/silicon/robot/R = current - if (istype(R)) - R.emagged = 0 - if (R.activated(R.module.emag)) - R.module_active = null - if(R.module_state_1 == R.module.emag) - R.module_state_1 = null - R.module.emag.forceMove(null) - else if(R.module_state_2 == R.module.emag) - R.module_state_2 = null - R.module.emag.forceMove(null) - else if(R.module_state_3 == R.module.emag) - R.module_state_3 = null - R.module.emag.forceMove(null) - log_admin("[key_name_admin(usr)] has unemag'ed [R].") + var/mob/living/silicon/robot/robot = current + if (istype(robot)) + if(robot.module?.emag) + robot.drop_from_inventory(robot.module.emag) + robot.module.emag.forceMove(null) + robot.emagged = FALSE + log_admin("[key_name_admin(usr)] has unemag'ed [robot].") if("unemagcyborgs") if (isAI(current)) var/mob/living/silicon/ai/ai = current - for (var/mob/living/silicon/robot/R in ai.connected_robots) - R.emagged = 0 - if (R.module) - if (R.activated(R.module.emag)) - R.module_active = null - if(R.module_state_1 == R.module.emag) - R.module_state_1 = null - R.module.emag.forceMove(null) - else if(R.module_state_2 == R.module.emag) - R.module_state_2 = null - R.module.emag.forceMove(null) - else if(R.module_state_3 == R.module.emag) - R.module_state_3 = null - R.module.emag.forceMove(null) + for (var/mob/living/silicon/robot/robot in ai.connected_robots) + robot.emagged = FALSE + if(robot.module?.emag) + robot.drop_from_inventory(robot.module.emag) + robot.module.emag.forceMove(null) + log_admin("[key_name_admin(usr)] has unemag'ed [ai]'s Cyborgs.") else if (href_list["common"]) switch(href_list["common"]) if("undress") - for(var/obj/item/W in current) - current.drop_from_inventory(W) + for(var/obj/item/undressing in current) + current.drop_from_inventory(undressing) if("takeuplink") take_uplink() if("crystals") @@ -465,20 +445,6 @@ if(H) qdel(H) - -// check whether this mind's mob has been brigged for the given duration -// have to call this periodically for the duration to work properly -/datum/mind/proc/is_brigged(duration) - var/area/A = get_area(current) - if(!isturf(current.loc) || !istype(A) || !(A.area_flags & AREA_FLAG_PRISON) || current.GetIdCard()) - brigged_since = -1 - return 0 - - if(brigged_since == -1) - brigged_since = world.time - - return (duration <= world.time - brigged_since) - /datum/mind/proc/reset() assigned_role = null assigned_special_role = null @@ -486,9 +452,7 @@ assigned_job = null initial_account = null objectives = list() - has_been_rev = 0 - rev_cooldown = 0 - brigged_since = -1 + conversion_cooldown = 0 //Initialisation procs /mob/living/proc/mind_initialize() diff --git a/code/datums/movement/movement.dm b/code/datums/movement/movement.dm index ffe142f72310..a4f79e092ffc 100644 --- a/code/datums/movement/movement.dm +++ b/code/datums/movement/movement.dm @@ -90,10 +90,7 @@ if(LAZYLEN(movement_handlers) && ispath(movement_handlers[1])) { \ var/oldloc = loc var/turf/T = get_step(loc, direction) if(istype(T)) - if(direction in global.cornerdirs) // Diagonal movement with step() currently breaks - forceMove(T) // grabs, remove these lines when that is fixed. - else - step(src, direction) + step(src, direction) return loc != oldloc for(var/datum/movement_handler/movement_handler as anything in movement_handlers) diff --git a/code/datums/music_tracks/fantasy.dm b/code/datums/music_tracks/fantasy.dm index 6f1f6e05f279..521a9e5aa5d0 100644 --- a/code/datums/music_tracks/fantasy.dm +++ b/code/datums/music_tracks/fantasy.dm @@ -25,3 +25,10 @@ song = 'sound/music/Miris-Magic-Dance.ogg' license = /decl/license/cc_by_3_0 url = "https://incompetech.com/music/royalty-free/index.html?isrc=USUAN1100157" + +/decl/music_track/adventure + artist = "Alexander Nakarada" + title = "Adventure" + song = 'sound/music/winter/alexander-nakarada-adventure.ogg' + license = /decl/license/cc_by_4_0 + url = "https://creatorchords.com/music/adventure/" \ No newline at end of file diff --git a/code/datums/observation/density_set.dm b/code/datums/observation/density_set.dm index 9a022b893257..0eaeb65e56e3 100644 --- a/code/datums/observation/density_set.dm +++ b/code/datums/observation/density_set.dm @@ -11,3 +11,4 @@ /decl/observ/density_set name = "Density Set" expected_type = /atom + flags = OBSERVATION_NO_GLOBAL_REGISTRATIONS diff --git a/code/datums/observation/entered.dm b/code/datums/observation/entered.dm index d52829d6c7df..3512ed616173 100644 --- a/code/datums/observation/entered.dm +++ b/code/datums/observation/entered.dm @@ -12,6 +12,7 @@ /decl/observ/entered name = "Entered" expected_type = /atom + flags = OBSERVATION_NO_GLOBAL_REGISTRATIONS /******************* * Entered Handling * @@ -19,4 +20,5 @@ /atom/Entered(atom/movable/enterer, atom/old_loc) ..() - RAISE_EVENT(/decl/observ/entered, src, enterer, old_loc) + if(event_listeners?[/decl/observ/entered]) + raise_event_non_global(/decl/observ/entered, enterer, old_loc) diff --git a/code/datums/observation/exited.dm b/code/datums/observation/exited.dm index b00e30c79f68..6e8bc2ac80fc 100644 --- a/code/datums/observation/exited.dm +++ b/code/datums/observation/exited.dm @@ -12,6 +12,7 @@ /decl/observ/exited name = "Exited" expected_type = /atom + flags = OBSERVATION_NO_GLOBAL_REGISTRATIONS /****************** * Exited Handling * @@ -19,4 +20,5 @@ /atom/Exited(atom/movable/exitee, atom/new_loc) . = ..() - RAISE_EVENT(/decl/observ/exited, src, exitee, new_loc) + if(event_listeners?[/decl/observ/exited]) + raise_event_non_global(/decl/observ/exited, exitee, new_loc) diff --git a/code/datums/observation/helpers.dm b/code/datums/observation/helpers.dm index 89330ecc50b0..b404f2372635 100644 --- a/code/datums/observation/helpers.dm +++ b/code/datums/observation/helpers.dm @@ -1,5 +1,6 @@ /atom/movable/proc/recursive_move(var/atom/movable/am, var/old_loc, var/new_loc) - RAISE_EVENT(/decl/observ/moved, src, old_loc, new_loc) + if(event_listeners?[/decl/observ/moved]) + raise_event_non_global(/decl/observ/moved, old_loc, new_loc) /atom/movable/proc/move_to_turf(var/atom/movable/am, var/old_loc, var/new_loc) var/turf/T = get_turf(new_loc) diff --git a/code/datums/observation/moved.dm b/code/datums/observation/moved.dm index 101dd5b756fa..340779227b99 100644 --- a/code/datums/observation/moved.dm +++ b/code/datums/observation/moved.dm @@ -33,12 +33,13 @@ /atom/Entered(var/atom/movable/am, var/atom/old_loc) . = ..() - RAISE_EVENT(/decl/observ/moved, am, old_loc, am.loc) + if(am.event_listeners?[/decl/observ/moved]) + am.raise_event_non_global(/decl/observ/moved, old_loc, am.loc) /atom/movable/Entered(var/atom/movable/am, atom/old_loc) . = ..() - var/decl/observ/moved/moved_event = GET_DECL(/decl/observ/moved) - if(moved_event.has_listeners(am)) + // We inline and simplify has_listeners here since we know this event can never have global registrations. + if(am.event_listeners?[/decl/observ/moved]) events_repository.register(/decl/observ/moved, src, am, TYPE_PROC_REF(/atom/movable, recursive_move)) /atom/movable/Exited(var/atom/movable/am, atom/new_loc) diff --git a/code/datums/observation/name_set.dm b/code/datums/observation/name_set.dm index b3d216e6686a..f0f75e0c684c 100644 --- a/code/datums/observation/name_set.dm +++ b/code/datums/observation/name_set.dm @@ -11,6 +11,7 @@ /decl/observ/name_set name = "Name Set" expected_type = /atom + flags = OBSERVATION_NO_GLOBAL_REGISTRATIONS /********************* * Name Set Handling * @@ -23,5 +24,6 @@ if(has_extension(src, /datum/extension/labels)) var/datum/extension/labels/L = get_extension(src, /datum/extension/labels) name = L.AppendLabelsToName(name) - RAISE_EVENT(/decl/observ/name_set, src, old_name, new_name) + if(event_listeners?[/decl/observ/name_set]) + raise_event_non_global(/decl/observ/name_set, old_name, new_name) update_above() \ No newline at end of file diff --git a/code/datums/observation/observation.dm b/code/datums/observation/observation.dm index 892e97ce7c93..ee87ba09d524 100644 --- a/code/datums/observation/observation.dm +++ b/code/datums/observation/observation.dm @@ -59,29 +59,30 @@ /decl/observ var/name = "Unnamed Event" // The name of this event, used mainly for debug/VV purposes. The list of event managers can be reached through the "Debug Controller" verb, selecting the "Observation" entry. var/expected_type = /datum // The expected event source for this event. register() will CRASH() if it receives an unexpected type. - var/list/list/list/event_sources = list() // Associative list of event sources, each with their own associative list. This associative list contains an instance/list of procs to call when the event is raised. var/list/global_listeners = list() // Associative list of instances that listen to all events of this type (as opposed to events belonging to a specific source) and the proc to call. VAR_PROTECTED/flags // See _defines.dm for available flags and what they do -/decl/observ/Initialize() - . = ..() - global.all_observable_events += src +/datum + /// Associative list of observ type -> associative list of listeners -> an instance/list of procs to call on the listener when the event is raised. + var/list/list/list/event_listeners + /// Associative list of observ type -> datums we're listening to; contains no information about callbacks as that's already stored on their event_listeners list. + var/list/_listening_to -/decl/observ/proc/is_listening(var/event_source, var/datum/listener, var/proc_call) +/decl/observ/proc/is_listening(var/datum/event_source, var/datum/listener, var/proc_call) // Return whether there are global listeners unless the event source is given. if (!event_source) return !!global_listeners.len + var/list/listeners = event_source.event_listeners?[type] // Return whether anything is listening to a source, if no listener is given. if (!listener) - return global_listeners.len || !!event_sources[event_source] + return length(global_listeners) || !!listeners // Return false if nothing is associated with that source. - if (!event_sources[event_source]) + if (!listeners) return FALSE - // Get and check the listeners for the reuqested event. - var/listeners = event_sources[event_source] + // Get and check the listeners for the requested event. if (!listeners[listener]) return FALSE @@ -96,7 +97,7 @@ return (proc_call in callback) -/decl/observ/proc/has_listeners(var/event_source) +/decl/observ/proc/has_listeners(var/datum/event_source) return is_listening(event_source) /decl/observ/proc/register(var/datum/event_source, var/datum/listener, var/proc_call) @@ -111,16 +112,16 @@ CRASH("Unexpected type. Expected [expected_type], was [event_source.type]") // Setup the listeners for this source if needed. - var/list/listeners = event_sources[event_source] - if (!listeners) - listeners = list() - event_sources[event_source] = listeners - + LAZYINITLIST(event_source.event_listeners) + LAZYINITLIST(event_source.event_listeners[type]) + var/list/listeners = event_source.event_listeners[type] // Make sure the callbacks are a list. var/list/callbacks = listeners[listener] if (!callbacks) callbacks = list() listeners[listener] = callbacks + LAZYINITLIST(listener._listening_to) + LAZYADD(listener._listening_to[type], event_source) // If the proc_call is already registered skip if(proc_call in callbacks) @@ -130,25 +131,24 @@ callbacks += proc_call return TRUE -/decl/observ/proc/unregister(var/event_source, var/datum/listener, var/proc_call) +/decl/observ/proc/unregister(var/datum/event_source, var/datum/listener, var/proc_call) // Sanity. - if (!event_source || !listener || !event_sources[event_source]) - return 0 - - // Return zero if nothing is listening for this event. - var/list/listeners = event_sources[event_source] - if (!length(listeners)) - event_sources -= event_source + if (!event_source || !listener || !event_source.event_listeners?[type]) return 0 + var/list/list/listeners = event_source.event_listeners[type] // Remove all callbacks if no specific one is given. if (!proc_call) // Return the number of callbacks removed. . = length(listeners[listener]) if(listeners.Remove(listener)) + LAZYREMOVE(listener._listening_to?[type], event_source) + UNSETEMPTY(listener._listening_to) // Perform some cleanup and return true. - if (!listeners.len) - event_sources -= event_source + if (!length(listeners)) // No one is listening to us on this source anymore. + LAZYREMOVE(event_source.event_listeners, type) + UNSETEMPTY(event_source.event_listeners?[type]) + UNSETEMPTY(event_source.event_listeners) return . return 0 @@ -161,10 +161,13 @@ if(!callbacks.Remove(proc_call)) return 0 - if (!callbacks.len) - listeners -= listener - if (!listeners.len) - event_sources -= event_source + if(!LAZYLEN(callbacks)) // the above Remove() took our last callback away, so remove our callbacks list for this listener + LAZYREMOVE(event_source.event_listeners[type], listener) // note that UNSETEMPTY would just give it a null value + LAZYREMOVE(listener._listening_to[type], event_source) + if(!LAZYLEN(listener._listening_to[type])) + LAZYREMOVE(listener._listening_to, type) + if(!LAZYLEN(event_source.event_listeners[type])) + LAZYREMOVE(event_source.event_listeners, type) return 1 /decl/observ/proc/register_global(var/datum/listener, var/proc_call) @@ -210,9 +213,27 @@ global_listeners -= listener return 1 -/decl/observ/proc/raise_event() +/// A variant of raise_event for extra-fast processing, for observs that are certain to never have any global registrations. +/datum/proc/raise_event_non_global(event_type) + // Call the listeners for this specific event source, if they exist. + var/list/listeners = event_listeners?[event_type] + if(length(listeners)) + args[1] = src // replace event_type with src for the call + for (var/listener in listeners) + var/list/callbacks = listeners[listener] + for (var/proc_call in callbacks) + // If the callback crashes, record the error and remove it. + try + call(listener, proc_call)(arglist(args)) + catch (var/exception/e) + error(EXCEPTION_TEXT(e)) + var/decl/observ/event = GET_DECL(event_type) + event.unregister(src, listener, proc_call) + return TRUE + +/decl/observ/proc/raise_event(datum/source) // Sanity - if(!length(args)) + if(!source) return FALSE if(length(global_listeners)) @@ -229,8 +250,7 @@ unregister_global(listener, proc_call) // Call the listeners for this specific event source, if they exist. - var/source = args[1] - var/list/listeners = event_sources[source] + var/list/listeners = source.event_listeners?[type] if(length(listeners)) for (var/listener in listeners) var/list/callbacks = listeners[listener] diff --git a/code/datums/observation/updated_icon.dm b/code/datums/observation/updated_icon.dm index 19e43b88cb50..021b8bca092e 100644 --- a/code/datums/observation/updated_icon.dm +++ b/code/datums/observation/updated_icon.dm @@ -11,3 +11,4 @@ /decl/observ/updated_icon name = "Updated Icon" expected_type = /atom + flags = OBSERVATION_NO_GLOBAL_REGISTRATIONS \ No newline at end of file diff --git a/code/datums/observation/~cleanup.dm b/code/datums/observation/~cleanup.dm index 9685f39741a3..39c9dc8152c2 100644 --- a/code/datums/observation/~cleanup.dm +++ b/code/datums/observation/~cleanup.dm @@ -1,18 +1,20 @@ -var/global/list/global_listen_count = list() - +/// This variable is used only for sanity checks during unit tests. It contains a list of all datums with global event registrations. +var/global/list/_all_global_event_listeners = list() /datum /// Tracks how many event registrations are listening to us. Used in cleanup to prevent dangling references. var/event_source_count = 0 /// Tracks how many event registrations we are listening to. Used in cleanup to prevent dangling references. var/event_listen_count = 0 + /// Tracks how many global event registrations we are listening to. Used in cleanup to prevent dangling references. + var/global_listen_count = 0 /proc/cleanup_events(var/datum/source) - if(global.global_listen_count && global.global_listen_count[source]) - cleanup_global_listener(source, global.global_listen_count[source]) + if(source?.global_listen_count > 0) + cleanup_global_listener(source) if(source?.event_source_count > 0) - cleanup_source_listeners(source, source?.event_source_count) + cleanup_source_listeners(source) if(source?.event_listen_count > 0) - cleanup_event_listener(source, source?.event_listen_count) + cleanup_event_listener(source) /decl/observ/register(var/datum/event_source, var/datum/listener, var/proc_call) . = ..() @@ -29,58 +31,55 @@ var/global/list/global_listen_count = list() /decl/observ/register_global(var/datum/listener, var/proc_call) . = ..() if(.) - global.global_listen_count[listener] += 1 + listener.global_listen_count += 1 +// This variable is used only for sanity checks during unit tests. +#ifdef UNIT_TEST + global._all_global_event_listeners += listener +#endif /decl/observ/unregister_global(var/datum/listener, var/proc_call) . = ..() if(.) - global.global_listen_count[listener] -= . - if(global.global_listen_count[listener] <= 0) - global.global_listen_count -= listener + listener.global_listen_count -= . +#ifdef UNIT_TEST + if(!listener.global_listen_count) + global._all_global_event_listeners -= listener +#endif -/proc/cleanup_global_listener(listener, listen_count) - global.global_listen_count -= listener - var/events_removed - for(var/entry in global.all_observable_events) - var/decl/observ/event = entry - if((events_removed = event.unregister_global(listener))) - log_debug("[event] ([event.type]) - [log_info_line(listener)] was deleted while still registered to global events.") - listen_count -= events_removed - if(!listen_count) +/proc/cleanup_global_listener(datum/listener) + for(var/decl/observ/event as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/observ)) + if(event.unregister_global(listener)) + log_debug("[event] ([event.type]) - [log_info_line(listener)] was deleted while still globally registered to an event.") + if(!listener.global_listen_count) return - if(listen_count > 0) + if(listener.global_listen_count > 0) CRASH("Failed to clean up all global listener entries!") -/proc/cleanup_source_listeners(datum/event_source, source_listener_count) - event_source.event_source_count = 0 - var/events_removed - for(var/entry in global.all_observable_events) - var/decl/observ/event = entry - var/list/list/proc_owners = event.event_sources[event_source] +// This might actually be fast enough now that there's no point in logging it? +/proc/cleanup_source_listeners(datum/event_source) + for(var/event_type in event_source.event_listeners) + var/list/list/proc_owners = event_source.event_listeners[event_type] if(proc_owners) + var/decl/observ/event = GET_DECL(event_type) for(var/proc_owner in proc_owners) var/list/callbacks_cached = proc_owners[proc_owner]?.Copy() - if((events_removed = event.unregister(event_source, proc_owner))) + if(event.unregister(event_source, proc_owner)) log_debug("[event] ([event.type]) - [log_info_line(event_source)] was deleted while still being listened to by [log_info_line(proc_owner)]. Callbacks: [json_encode(callbacks_cached)]") - source_listener_count -= events_removed - if(!source_listener_count) + if(!event_source.event_source_count) return - if(source_listener_count > 0) + if(event_source.event_source_count > 0) CRASH("Failed to clean up all event source entries!") -/proc/cleanup_event_listener(datum/listener, listener_count) - listener.event_listen_count = 0 - var/events_removed - for(var/entry in global.all_observable_events) - var/decl/observ/event = entry - for(var/event_source in event.event_sources) - if(isnull(event.event_sources[event_source])) - log_debug("[event] ([event.type]) - [log_info_line(event_source)] had null listeners list!") - var/list/callbacks_cached = event.event_sources[event_source]?[listener]?.Copy() - if((events_removed = event.unregister(event_source, listener))) - log_debug("[event] ([event.type]) - [log_info_line(listener)] was deleted while still listening to [log_info_line(event_source)]. Callbacks: [json_encode(callbacks_cached)]") - listener_count -= events_removed - if(!listener_count) - return - if(listener_count > 0) +/proc/cleanup_event_listener(datum/listener) + for(var/event_type in listener._listening_to) + var/list/listened_sources = listener._listening_to[event_type] + if(listened_sources) + for(var/datum/event_source in listened_sources) + var/list/callbacks_cached = event_source.event_listeners[event_type]?[listener]?.Copy() + var/decl/observ/event = GET_DECL(event_type) + if(event.unregister(event_source, listener)) + log_debug("[event] ([event.type]) - [log_info_line(listener)] was deleted while still listening to [log_info_line(event_source)]. Callbacks: [json_encode(callbacks_cached)]") + if(!listener.event_listen_count) + return + if(listener.event_listen_count > 0) CRASH("Failed to clean up all listener entries!") diff --git a/code/datums/outfits/equipment/backpacks.dm b/code/datums/outfits/equipment/backpacks.dm index 2a4aed715eab..8e6c68468285 100644 --- a/code/datums/outfits/equipment/backpacks.dm +++ b/code/datums/outfits/equipment/backpacks.dm @@ -190,9 +190,9 @@ /proc/get_default_outfit_backpack() var backpacks = global.using_map.get_available_backpacks() for(var/backpack in backpacks) - var/decl/backpack_outfit/bo = backpacks[backpack] - if(bo.is_default) - return bo + var/decl/backpack_outfit/backpack_option = backpacks[backpack] + if(backpack_option.is_default) + return backpack_option #undef BACKPACK_HAS_TYPE_SELECTION #undef BACKPACK_HAS_SUBTYPE_SELECTION diff --git a/code/datums/outfits/outfit.dm b/code/datums/outfits/outfit.dm index c3728f48a2a5..fa1c3f9627b9 100644 --- a/code/datums/outfits/outfit.dm +++ b/code/datums/outfits/outfit.dm @@ -205,17 +205,17 @@ wearer.put_in_hands(new hand(wearer)) if((outfit_flags & OUTFIT_HAS_BACKPACK) && !(OUTFIT_ADJUSTMENT_SKIP_BACKPACK & equip_adjustments)) - var/decl/backpack_outfit/bo + var/decl/backpack_outfit/backpack_option var/metadata if(wearer.backpack_setup) - bo = wearer.backpack_setup.backpack + backpack_option = wearer.backpack_setup.backpack metadata = wearer.backpack_setup.metadata else - bo = get_default_outfit_backpack() + backpack_option = get_default_outfit_backpack() - var/override_type = backpack_overrides[bo.type] - var/backpack = bo.spawn_backpack(wearer, metadata, override_type) + var/override_type = backpack_overrides[backpack_option.type] + var/backpack = backpack_option.spawn_backpack(wearer, metadata, override_type) if(backpack) if(back) @@ -241,22 +241,22 @@ return if(OUTFIT_ADJUSTMENT_SKIP_ID_PDA & equip_adjustments) return - var/obj/item/card/id/W = new id_type(wearer) + var/obj/item/card/id/id_card = new id_type(wearer) if(id_desc) - W.desc = id_desc + id_card.desc = id_desc if(assignment) - W.assignment = assignment + id_card.assignment = assignment if(job) - W.position = job.title - LAZYDISTINCTADD(W.access, job.get_access()) - if(!W.detail_color) - W.detail_color = job.selection_color - W.update_icon() + id_card.position = job.title + LAZYDISTINCTADD(id_card.access, job.get_access()) + if(!id_card.detail_color) + id_card.detail_color = job.selection_color + id_card.update_icon() wearer.update_icon() - wearer.set_id_info(W) + wearer.set_id_info(id_card) equip_pda(wearer, id_pda_assignment || assignment, equip_adjustments) - if(wearer.equip_to_slot_or_store_or_drop(W, id_slot)) - return W + if(wearer.equip_to_slot_or_store_or_drop(id_card, id_slot)) + return id_card /decl/outfit/proc/equip_pda(var/mob/living/wearer, var/label_assignment, var/equip_adjustments) if(!pda_slot || !pda_type) diff --git a/code/datums/outfits/tournament.dm b/code/datums/outfits/tournament.dm index 37560506ddd5..19ce1a32b9be 100644 --- a/code/datums/outfits/tournament.dm +++ b/code/datums/outfits/tournament.dm @@ -36,7 +36,7 @@ suit = /obj/item/clothing/suit/chef hands = list( /obj/item/knife/combat, - /obj/item/kitchen/rollingpin + /obj/item/rollingpin ) l_pocket = /obj/item/knife/combat r_pocket = /obj/item/knife/combat diff --git a/code/datums/repositories/atom_info.dm b/code/datums/repositories/atom_info.dm index 4bfb7a4b8233..9e842cf2feb0 100644 --- a/code/datums/repositories/atom_info.dm +++ b/code/datums/repositories/atom_info.dm @@ -5,14 +5,15 @@ var/global/repository/atom_info/atom_info_repository = new() var/list/combined_worth_cache = list() var/list/single_worth_cache = list() var/list/name_cache = list() + var/list/description_cache = list() var/list/matter_mult_cache = list() var/list/origin_tech_cache = list() /repository/atom_info/proc/create_key_for(var/path, var/material, var/amount) . = "[path]" - if(material) + if(ispath(path, /obj) && material) // only objects take material as an arg . = "[.]-[material]" - if(!isnull(amount)) + if(ispath(path, /obj/item/stack) && !isnull(amount)) // similarly for stacks and amount . = "[.]-[amount]" /repository/atom_info/proc/get_instance_of(var/path, var/material, var/amount) @@ -37,6 +38,9 @@ var/global/repository/atom_info/atom_info_repository = new() if(!name_cache[key]) instance = instance || get_instance_of(path, material, amount) name_cache[key] = instance.name + if(!description_cache[key]) + instance = instance || get_instance_of(path, material, amount) + description_cache[key] = instance.desc if(!matter_mult_cache[key] && ispath(path, /obj)) var/obj/obj_instance = instance || get_instance_of(path, material, amount) matter_mult_cache[key] = obj_instance.get_matter_amount_modifier() @@ -67,6 +71,11 @@ var/global/repository/atom_info/atom_info_repository = new() update_cached_info_for(path, material, amount, key) . = name_cache[key] +/repository/atom_info/proc/get_description_for(var/path, var/material, var/amount) + var/key = create_key_for(path, material, amount) + update_cached_info_for(path, material, amount, key) + . = description_cache[key] + /repository/atom_info/proc/get_matter_multiplier_for(var/path, var/material, var/amount) var/key = create_key_for(path, material, amount) update_cached_info_for(path, material, amount, key) diff --git a/code/datums/repositories/crew/crew.dm b/code/datums/repositories/crew/crew.dm index 35bd0ecfb515..4a0e5b2c53a7 100644 --- a/code/datums/repositories/crew/crew.dm +++ b/code/datums/repositories/crew/crew.dm @@ -98,7 +98,7 @@ var/global/datum/repository/crew/crew_repository = new() var/current_priority = INFINITY var/list/modifiers_of_this_priority = list() - for(var/crew_sensor_modifier/csm in modifiers.L) + for(var/crew_sensor_modifier/csm in modifiers.GetQueue()) if(csm.priority < current_priority) . = check_queue(modifiers_of_this_priority, H, S, pos, crew_data) if(. != MOD_SUIT_SENSORS_NONE) @@ -123,7 +123,7 @@ var/global/datum/repository/crew/crew_repository = new() var/datum/priority_queue/pq = modifier_queues_by_type[base_type] if(!pq) CRASH("The given base type was not a valid base type.") - if(csm in pq.L) + if(csm in pq.GetQueue()) CRASH("This crew sensor modifier has already been supplied.") pq.Enqueue(csm) return TRUE diff --git a/code/datums/repositories/decls.dm b/code/datums/repositories/decls.dm index 73a9f14fb610..28dea46d5cd1 100644 --- a/code/datums/repositories/decls.dm +++ b/code/datums/repositories/decls.dm @@ -144,6 +144,20 @@ var/global/repository/decls/decls_repository = new . = get_decls(subtypesof(decl_prototype)) fetched_decl_subtypes[decl_prototype] = . +/// Gets the path of any concrete (non-abstract) decl of the provided type. +/// If decl_prototype is not abstract it will return that type. +/// Otherwise, it returns the first (in compile order) non-abstract child of this type, +/// or null otherwise. +/// This doesn't respect DECL_FLAG_ALLOW_ABSTRACT_INIT, but that flag should probably be deprecated someday +/// and replaced with a better solution to avoid instantiating abstract decls. +/// This is mostly used for recipe validation in unit tests and such. +/repository/decls/proc/get_first_concrete_decl_path_of_type(decl_prototype) + RETURN_TYPE(/decl) + . = fetched_decl_paths_by_type[decl_prototype] + if(!.) + . = get_decl_paths_of_type(decl_prototype) + return LAZYACCESS(., 1) // gets the first key (type) if it exists, else null if index is out of range + /decl abstract_type = /decl var/uid diff --git a/code/datums/repositories/follow.dm b/code/datums/repositories/follow.dm index fb12909997cb..14787fb97b63 100644 --- a/code/datums/repositories/follow.dm +++ b/code/datums/repositories/follow.dm @@ -158,11 +158,11 @@ var/global/repository/follow/follow_repository = new() followed_type = /mob/living/silicon/robot /datum/follow_holder/robot/show_entry() - var/mob/living/silicon/robot/R = followed_instance - return ..() && R.braintype + var/mob/living/silicon/robot/robot = followed_instance + return ..() && robot.braintype -/datum/follow_holder/robot/get_suffix(var/mob/living/silicon/robot/R) - suffix = "\[[R.braintype]\][R.module ? " \[[R.module.name]\]" : ""]" +/datum/follow_holder/robot/get_suffix(var/mob/living/silicon/robot/robot) + suffix = "\[[robot.braintype]\][robot.module ? " \[[robot.module.name]\]" : ""]" return ..() /datum/follow_holder/human @@ -211,11 +211,6 @@ var/global/repository/follow/follow_repository = new() followed_type = /mob/living // List all other (living) mobs we haven't given a special suffix suffix = "Mob" -/datum/follow_holder/blob - sort_order = 9 - followed_type = /obj/effect/blob/core - suffix = "Blob" - /datum/follow_holder/singularity sort_order = 10 followed_type = /obj/effect/singularity diff --git a/code/datums/storage/_storage.dm b/code/datums/storage/_storage.dm index 07d0d0871521..cead225909e9 100644 --- a/code/datums/storage/_storage.dm +++ b/code/datums/storage/_storage.dm @@ -90,11 +90,6 @@ var/global/list/_test_storage_items = list() play_open_sound() holder?.queue_icon_update() play_use_sound() - if (isrobot(user) && user.hud_used) - var/mob/living/silicon/robot/robot = user - if(robot.shown_robot_modules) //The robot's inventory is open, need to close it first. - robot.hud_used.toggle_show_robot_modules() - prepare_ui() if(storage_ui) storage_ui.on_open(user) @@ -121,13 +116,13 @@ var/global/list/_test_storage_items = list() //This proc return 1 if the item can be picked up and 0 if it can't. //Set the stop_messages to stop it from printing messages -/datum/storage/proc/can_be_inserted(obj/item/W, mob/user, stop_messages = 0, click_params = null) - if(!istype(W)) return //Not an item +/datum/storage/proc/can_be_inserted(obj/item/inserting, mob/user, stop_messages = 0, click_params = null) + if(!istype(inserting)) return //Not an item - if(user && !user.canUnEquip(W)) + if(user && !user.can_unequip_item(inserting)) return 0 - if(!holder || holder.loc == W) + if(!holder || holder.loc == inserting) return 0 //Means the item is already in the storage item if(storage_slots != null && length(get_contents()) >= storage_slots) @@ -135,51 +130,51 @@ var/global/list/_test_storage_items = list() to_chat(user, SPAN_WARNING("\The [holder] is full, make some space.")) return 0 //Storage item is full - if(W.anchored) + if(inserting.anchored) return 0 if(can_hold.len) - if(!is_type_in_list(W, can_hold)) - if(!stop_messages && ! istype(W, /obj/item/hand_labeler)) - to_chat(user, SPAN_WARNING("\The [holder] cannot hold \the [W].")) + if(!is_type_in_list(inserting, can_hold)) + if(!stop_messages && ! istype(inserting, /obj/item/hand_labeler)) + to_chat(user, SPAN_WARNING("\The [holder] cannot hold \the [inserting].")) return 0 - var/max_instances = can_hold[W.type] - if(max_instances && instances_of_type_in_list(W, get_contents()) >= max_instances) - if(!stop_messages && !istype(W, /obj/item/hand_labeler)) - to_chat(user, SPAN_WARNING("\The [holder] has no more space specifically for \the [W].")) + var/max_instances = can_hold[inserting.type] + if(max_instances && instances_of_type_in_list(inserting, get_contents()) >= max_instances) + if(!stop_messages && !istype(inserting, /obj/item/hand_labeler)) + to_chat(user, SPAN_WARNING("\The [holder] has no more space specifically for \the [inserting].")) return 0 //If attempting to lable the storage item, silently fail to allow it - if(istype(W, /obj/item/hand_labeler) && !user?.check_intent(I_FLAG_HELP)) + if(istype(inserting, /obj/item/hand_labeler) && !user?.check_intent(I_FLAG_HELP)) return FALSE //Prevent package wrapper from being inserted by default - if(istype(W, /obj/item/stack/package_wrap) && !user?.check_intent(I_FLAG_HELP)) + if(istype(inserting, /obj/item/stack/package_wrap) && !user?.check_intent(I_FLAG_HELP)) return FALSE // Don't allow insertion of unsafed compressed matter implants // Since they are sucking something up now, their afterattack will delete the storage - if(istype(W, /obj/item/implanter/compressed)) - var/obj/item/implanter/compressed/impr = W + if(istype(inserting, /obj/item/implanter/compressed)) + var/obj/item/implanter/compressed/impr = inserting if(!impr.safe) stop_messages = 1 return 0 - if(cant_hold.len && is_type_in_list(W, cant_hold)) + if(cant_hold.len && is_type_in_list(inserting, cant_hold)) if(!stop_messages) - to_chat(user, SPAN_WARNING("\The [holder] cannot hold \the [W].")) + to_chat(user, SPAN_WARNING("\The [holder] cannot hold \the [inserting].")) return 0 - if (max_w_class != null && W.w_class > max_w_class) + if (max_w_class != null && inserting.w_class > max_w_class) if(!stop_messages) - to_chat(user, SPAN_WARNING("\The [W] is too big for \the [holder].")) + to_chat(user, SPAN_WARNING("\The [inserting] is too big for \the [holder].")) return 0 - if(W.obj_flags & OBJ_FLAG_NO_STORAGE) + if(inserting.obj_flags & OBJ_FLAG_NO_STORAGE) if(!stop_messages) - to_chat(user, SPAN_WARNING("\The [W] cannot be placed in \the [holder].")) + to_chat(user, SPAN_WARNING("\The [inserting] cannot be placed in \the [holder].")) return 0 - var/total_storage_space = W.get_storage_cost() + storage_space_used() //Adds up the combined w_classes which will be in the storage item if the item is added to it. + var/total_storage_space = inserting.get_storage_cost() + storage_space_used() //Adds up the combined w_classes which will be in the storage item if the item is added to it. if(total_storage_space > max_storage_space) if(!stop_messages) to_chat(user, SPAN_WARNING("\The [holder] is too full, make some space.")) @@ -190,35 +185,35 @@ var/global/list/_test_storage_items = list() //This proc handles items being inserted. It does not perform any checks of whether an item can or can't be inserted. That's done by can_be_inserted() //The stop_warning parameter will stop the insertion message from being displayed. It is intended for cases where you are inserting multiple items at once, //such as when picking up all the items on a tile with one click. -/datum/storage/proc/handle_item_insertion(mob/user, obj/item/W, prevent_warning, skip_update, click_params) - if(!istype(W)) +/datum/storage/proc/handle_item_insertion(mob/user, obj/item/inserting, prevent_warning, skip_update, click_params) + if(!istype(inserting)) return FALSE - if(ismob(W.loc)) - var/mob/M = W.loc - if(!M.try_unequip(W)) + if(ismob(inserting.loc)) + var/mob/M = inserting.loc + if(!M.try_unequip(inserting)) return FALSE if(holder.reagents?.total_volume) - W.fluid_act(holder.reagents) - if(QDELETED(W)) + inserting.fluid_act(holder.reagents) + if(QDELETED(inserting)) return FALSE - W.forceMove(holder) - W.on_enter_storage(src) + inserting.forceMove(holder) + inserting.on_enter_storage(src) if(user) holder.add_fingerprint(user) if(!prevent_warning) for(var/mob/M in viewers(user, null)) if (M == user) - to_chat(user, SPAN_NOTICE("You put \the [W] into [holder].")) + to_chat(user, SPAN_NOTICE("You put \the [inserting] into [holder].")) else if (get_dist(holder, M) <= 1) //If someone is standing close enough, they can tell what it is... - M.show_message(SPAN_NOTICE("\The [user] puts [W] into [holder]."), VISIBLE_MESSAGE) - else if (W && W.w_class >= ITEM_SIZE_NORMAL) //Otherwise they can only see large or normal items from a distance... - M.show_message(SPAN_NOTICE("\The [user] puts [W] into [holder]."), VISIBLE_MESSAGE) + M.show_message(SPAN_NOTICE("\The [user] puts [inserting] into [holder]."), VISIBLE_MESSAGE) + else if (inserting && inserting.w_class >= ITEM_SIZE_NORMAL) //Otherwise they can only see large or normal items from a distance... + M.show_message(SPAN_NOTICE("\The [user] puts [inserting] into [holder]."), VISIBLE_MESSAGE) // Run this regardless of update flag, as it impacts our remaining storage space. consolidate_stacks() if(!skip_update) - update_ui_after_item_insertion(W, click_params) + update_ui_after_item_insertion(inserting, click_params) holder.storage_inserted() if(!skip_update) holder.update_icon() @@ -249,43 +244,42 @@ var/global/list/_test_storage_items = list() /datum/storage/proc/update_ui_after_item_insertion(obj/item/inserted, click_params) prepare_ui() - storage_ui?.on_insertion() + storage_ui?.on_insertion(inserted) /datum/storage/proc/update_ui_after_item_removal(obj/item/removed) if(QDELETED(holder)) return prepare_ui() - storage_ui?.on_post_remove() + storage_ui?.on_post_remove(removed) //Call this proc to handle the removal of an item from the storage item. The item will be moved to the atom sent as new_target -/datum/storage/proc/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) - if(!istype(W)) +/datum/storage/proc/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) + if(!istype(removing)) return FALSE new_location = new_location || get_turf(holder) - storage_ui?.on_pre_remove(W) - if(ismob(holder?.loc)) - W.dropped(user) - if(ismob(new_location)) - W.hud_layerise() - else - W.reset_plane_and_layer() - W.forceMove(new_location) + storage_ui?.on_pre_remove(removing) + // This doesn't call dropped anymore because it's not leaving a mob slot directly. + // If something needs to duplicate dropped() functionality on removal from a storage object, + // it should be done in on_exit_storage instead. + removing.forceMove(new_location) + if(!ismob(new_location)) // inventory slot equipped() already handles hud_layerise + removing.reset_plane_and_layer() // this should be done post-move to avoid wasting an icon update if(!skip_update) - update_ui_after_item_removal(W) - if(W.maptext) - W.maptext = "" - W.on_exit_storage(src) + update_ui_after_item_removal(removing) + if(removing.maptext) + removing.maptext = "" + removing.on_exit_storage(src) if(!skip_update && holder) holder.update_icon() return TRUE // Only do ui functions for now; the obj is responsible for anything else. -/datum/storage/proc/on_item_pre_deletion(obj/item/W) - storage_ui?.on_pre_remove(W) // Supposed to be able to handle null user. +/datum/storage/proc/on_item_pre_deletion(obj/item/deleting) + storage_ui?.on_pre_remove(deleting) // Supposed to be able to handle null user. // Only do ui functions for now; the obj is responsible for anything else. -/datum/storage/proc/on_item_post_deletion(obj/item/W) - update_ui_after_item_removal(W) +/datum/storage/proc/on_item_post_deletion(obj/item/deleting) + update_ui_after_item_removal(deleting) holder?.queue_icon_update() //Run once after using remove_from_storage with skip_update = 1 diff --git a/code/datums/storage/_storage_ui.dm b/code/datums/storage/_storage_ui.dm index a3e1f23bfcb5..27807cb9e239 100644 --- a/code/datums/storage/_storage_ui.dm +++ b/code/datums/storage/_storage_ui.dm @@ -32,18 +32,21 @@ /datum/storage_ui/proc/after_close(mob/user) return -/datum/storage_ui/proc/on_insertion() +/datum/storage_ui/proc/on_insertion(obj/item/inserted) return -/datum/storage_ui/proc/on_pre_remove(obj/item/W) +/datum/storage_ui/proc/on_pre_remove(obj/item/removing) return -/datum/storage_ui/proc/on_post_remove(obj/item/W) +/datum/storage_ui/proc/on_post_remove(obj/item/removing) return /datum/storage_ui/proc/on_hand_attack(mob/user) return +/datum/storage_ui/proc/get_displayed_contents() + return + // Default subtype /datum/storage_ui/default var/obj/screen/storage/boxes/boxes @@ -93,26 +96,35 @@ /datum/storage_ui/default/on_insertion() refresh_viewers() -/datum/storage_ui/default/on_post_remove(obj/item/W) +/datum/storage_ui/default/on_post_remove(obj/item/removing) refresh_viewers() -/datum/storage_ui/default/on_pre_remove(obj/item/W) +/datum/storage_ui/default/on_pre_remove(obj/item/removing) for(var/mob/user in is_seeing) - user.client?.screen -= W + user.client?.screen -= removing + // if being moved to an inventory slot or other storage item, this will be re-set after the transfer is done + removing.screen_loc = null /datum/storage_ui/default/on_hand_attack(mob/user) for(var/mob/other_user in is_seeing) if (other_user.active_storage == _storage) _storage.close(other_user) +/datum/storage_ui/default/get_displayed_contents() + return _storage?.get_contents() + /datum/storage_ui/default/show_to(mob/user) if(!istype(user)) return + // TODO: move this to the interaction that opens the storage object rather than handling it on the UI + // because i really hate calling get_contents followed by get_displayed_contents + // the issue is that some things call atom.storage.show_to() directly rather than using open() var/list/contents = _storage?.get_contents() if(user.active_storage != _storage) for(var/obj/item/I in contents) if(I.on_found(user)) return + var/list/displayed_contents = get_displayed_contents() if(user.active_storage) user.active_storage.hide_from(user) if(user.client) @@ -123,8 +135,8 @@ user.client.screen -= closer user.client.screen -= contents user.client.screen += closer - if(length(contents)) - user.client.screen += contents + if(length(displayed_contents)) + user.client.screen += displayed_contents if(_storage.storage_slots) user.client.screen += boxes else @@ -306,6 +318,17 @@ row_num = round((adjusted_contents-1) / 7) // 7 is the maximum allowed width. arrange_item_slots(row_num, clamp(adjusted_contents - 1, 0, 6)) +// Only display one item for each key. +/datum/storage_ui/default/produce_bin/get_displayed_contents() + . = list() + var/list/displayed = list() + for(var/obj/item/food/grown/produce in _storage.get_contents()) + var/produce_key = get_key_for_object(produce) + if(displayed[produce_key]) + continue + displayed[produce_key] = TRUE + . += produce + //This proc draws out the inventory and places the items on it. It uses the standard position. /datum/storage_ui/default/produce_bin/arrange_item_slots(rows, cols) var/cx = SCREEN_LOC_MOD_FIRST @@ -313,12 +336,9 @@ boxes.screen_loc = "LEFT+[SCREEN_LOC_MOD_FIRST]:[SCREEN_LOC_MOD_DIVIDED],BOTTOM+[SCREEN_LOC_MOD_SECOND]:[SCREEN_LOC_MOD_DIVIDED] to LEFT+[SCREEN_LOC_MOD_FIRST + cols]:[SCREEN_LOC_MOD_DIVIDED],BOTTOM+[SCREEN_LOC_MOD_SECOND + rows]:[SCREEN_LOC_MOD_DIVIDED]" var/list/counts = get_seed_counts() - var/list/displayed = list() - for(var/obj/item/food/grown/produce in _storage.get_contents()) + // get_displayed_contents already handles deduplication + for(var/obj/item/food/grown/produce in get_displayed_contents()) var/produce_key = get_key_for_object(produce) - if(displayed[produce_key]) - continue - displayed[produce_key] = TRUE produce.screen_loc = "LEFT+[cx]:[SCREEN_LOC_MOD_DIVIDED],BOTTOM+[cy]:[SCREEN_LOC_MOD_DIVIDED]" produce.maptext_x = 2 produce.maptext_y = 2 diff --git a/code/datums/storage/subtypes_backpack.dm b/code/datums/storage/subtypes_backpack.dm index 360c835727d1..30c6027aa028 100644 --- a/code/datums/storage/subtypes_backpack.dm +++ b/code/datums/storage/subtypes_backpack.dm @@ -6,10 +6,8 @@ /datum/storage/backpack/holding max_storage_space = 56 -/datum/storage/backpack/holding/can_be_inserted(obj/item/W, mob/user, stop_messages = 0, click_params) - if(istype(W, /obj/item/backpack/holding)) - return 1 - return ..() +/datum/storage/backpack/holding/can_be_inserted(obj/item/inserting, mob/user, stop_messages = 0, click_params) + return istype(inserting, /obj/item/backpack/holding) || ..() /datum/storage/backpack/santa max_w_class = ITEM_SIZE_NORMAL diff --git a/code/datums/storage/subtypes_bag.dm b/code/datums/storage/subtypes_bag.dm index 07cdaf12cd2d..401ea28d1dad 100644 --- a/code/datums/storage/subtypes_bag.dm +++ b/code/datums/storage/subtypes_bag.dm @@ -3,19 +3,19 @@ allow_quick_empty = 1 use_to_pickup = 1 -/datum/storage/bag/handle_item_insertion(mob/user, obj/item/W, prevent_warning, skip_update, click_params) +/datum/storage/bag/handle_item_insertion(mob/user, obj/item/inserting, prevent_warning, skip_update, click_params) . = ..() if(. && istype(holder, /obj/item/bag)) var/obj/item/bag/bag = holder bag.update_w_class() -/datum/storage/bag/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/bag/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) . = ..() if(. && istype(holder, /obj/item/bag)) var/obj/item/bag/bag = holder bag.update_w_class() -/datum/storage/bag/can_be_inserted(obj/item/W, mob/user, stop_messages = 0, click_params = null) +/datum/storage/bag/can_be_inserted(obj/item/inserting, mob/user, stop_messages = 0, click_params = null) var/mob/living/human/H = ishuman(user) ? user : null // if we're human, then we need to check if bag in a pocket if(holder.loc?.storage || H?.is_in_pocket(holder)) if(!stop_messages) @@ -41,9 +41,9 @@ max_w_class = ITEM_SIZE_HUGE can_hold = list(/obj/item/coin, /obj/item/cash) -/datum/storage/bag/cash/infinite/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/bag/cash/infinite/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) . = ..() - if(. && istype(W,/obj/item/cash)) //only matters if its spacecash. + if(. && istype(removing, /obj/item/cash)) //only matters if its spacecash. handle_item_insertion(null, new /obj/item/cash/c1000, TRUE) /datum/storage/bag/quantum diff --git a/code/datums/storage/subtypes_box.dm b/code/datums/storage/subtypes_box.dm index dd94c30e1f32..479c9460eb88 100644 --- a/code/datums/storage/subtypes_box.dm +++ b/code/datums/storage/subtypes_box.dm @@ -47,23 +47,23 @@ max_w_class = ITEM_SIZE_TINY storage_slots = 7 -/datum/storage/box/cigar/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) - if(istype(W, /obj/item/clothing/mask/smokable/cigarette/cigar) && isatom(holder)) +/datum/storage/box/cigar/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) + if(istype(removing, /obj/item/clothing/mask/smokable/cigarette/cigar) && isatom(holder)) var/atom/atom_holder = holder if(atom_holder.reagents) - atom_holder.reagents.trans_to_obj(W, (atom_holder.reagents.total_volume/max(1, length(get_contents())))) + atom_holder.reagents.trans_to_obj(removing, (atom_holder.reagents.total_volume/max(1, length(get_contents())))) return ..() /datum/storage/box/cigarettes max_w_class = ITEM_SIZE_TINY max_storage_space = 6 -/datum/storage/box/cigarettes/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/box/cigarettes/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) // Don't try to transfer reagents to lighters - if(istype(W, /obj/item/clothing/mask/smokable/cigarette) && isatom(holder)) + if(istype(removing, /obj/item/clothing/mask/smokable/cigarette) && isatom(holder)) var/atom/atom_holder = holder if(atom_holder.reagents) - atom_holder.reagents.trans_to_obj(W, (atom_holder.reagents.total_volume/max(1, length(get_contents())))) + atom_holder.reagents.trans_to_obj(removing, (atom_holder.reagents.total_volume/max(1, length(get_contents())))) return ..() /datum/storage/box/cigarettes/cigarello diff --git a/code/datums/storage/subtypes_excavation.dm b/code/datums/storage/subtypes_excavation.dm index dacbdf2d2440..ec23be327fae 100644 --- a/code/datums/storage/subtypes_excavation.dm +++ b/code/datums/storage/subtypes_excavation.dm @@ -5,7 +5,7 @@ max_w_class = ITEM_SIZE_NORMAL use_to_pickup = 1 -/datum/storage/excavation/handle_item_insertion(mob/user, obj/item/W, prevent_warning, skip_update, click_params) +/datum/storage/excavation/handle_item_insertion(mob/user, obj/item/inserting, prevent_warning, skip_update, click_params) . = ..() var/obj/item/excavation/picks = holder if(istype(picks)) diff --git a/code/datums/storage/subtypes_misc.dm b/code/datums/storage/subtypes_misc.dm index fec9cd65cdf9..5f51b0ffc9de 100644 --- a/code/datums/storage/subtypes_misc.dm +++ b/code/datums/storage/subtypes_misc.dm @@ -106,16 +106,16 @@ can_hold = list(/obj/item) expected_type = /obj/structure/reagent_dispensers/compost_bin -/datum/storage/hopper/industrial/compost/can_be_inserted(obj/item/W, mob/user, stop_messages = 0, click_params = null) +/datum/storage/hopper/industrial/compost/can_be_inserted(obj/item/inserting, mob/user, stop_messages = 0, click_params = null) . = ..() if(!.) return - if(istype(W, /obj/item/food/worm) && istype(holder, /obj/structure/reagent_dispensers/compost_bin)) + if(istype(inserting, /obj/item/food/worm) && istype(holder, /obj/structure/reagent_dispensers/compost_bin)) var/worms = 0 for(var/obj/item/food/worm/worm in get_contents()) worms++ return worms < COMPOST_MAX_WORMS - return W.is_compostable() + return inserting.is_compostable() /datum/storage/hopper/mortar max_w_class = ITEM_SIZE_NORMAL * 2 diff --git a/code/datums/storage/subtypes_pills.dm b/code/datums/storage/subtypes_pills.dm index ca8287f168c6..29d2ba18f8f2 100644 --- a/code/datums/storage/subtypes_pills.dm +++ b/code/datums/storage/subtypes_pills.dm @@ -10,20 +10,20 @@ use_to_pickup = 1 use_sound = 'sound/effects/storage/pillbottle.ogg' -/datum/storage/pillbottle/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/pillbottle/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) . = ..() if(. && istype(holder, /obj/item/pill_bottle/foil_pack)) var/obj/item/pill_bottle/foil_pack/pop = holder if(pop.pop_sound) playsound(get_turf(pop), pop.pop_sound, 50) -/datum/storage/pillbottle/foil/can_be_inserted(obj/item/W, mob/user, stop_messages = 0, click_params = null) +/datum/storage/pillbottle/foil/can_be_inserted(obj/item/inserting, mob/user, stop_messages = 0, click_params = null) return FALSE -/datum/storage/pillbottle/foil/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/pillbottle/foil/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) . = ..() - if(. && W.loc != holder && istype(W, /obj/item/pill_bottle/foil_pack)) + if(. && removing.loc != holder && istype(removing, /obj/item/pill_bottle/foil_pack)) var/obj/item/pill_bottle/foil_pack/pop = holder if(pop.pill_positions) - pop.pill_positions -= W + pop.pill_positions -= removing pop.update_icon() diff --git a/code/datums/storage/subtypes_secure.dm b/code/datums/storage/subtypes_secure.dm index bf501d186be7..8427c0d7579d 100644 --- a/code/datums/storage/subtypes_secure.dm +++ b/code/datums/storage/subtypes_secure.dm @@ -16,7 +16,7 @@ . = ..() //Must be overriden to prevent gathering from tile and using on items when locked! -/datum/storage/secure/can_be_inserted(obj/item/W, mob/user, stop_messages, click_params = null) +/datum/storage/secure/can_be_inserted(inserting, mob/user, stop_messages, click_params = null) if(is_locked()) if(!stop_messages) to_chat(user, SPAN_WARNING("\The [holder] is locked, you cannot put anything inside.")) diff --git a/code/datums/storage/subtypes_sheets.dm b/code/datums/storage/subtypes_sheets.dm index 578282c8d4b9..7bc7504efca3 100644 --- a/code/datums/storage/subtypes_sheets.dm +++ b/code/datums/storage/subtypes_sheets.dm @@ -9,10 +9,10 @@ /datum/storage/sheets/robot capacity = 500 //Borgs get more because >specialization -/datum/storage/sheets/can_be_inserted(obj/item/W, mob/user, stop_messages = 0, click_params = null) - if(!istype(W,/obj/item/stack/material)) +/datum/storage/sheets/can_be_inserted(obj/item/inserting, mob/user, stop_messages = 0, click_params = null) + if(!istype(inserting,/obj/item/stack/material)) if(!stop_messages) - to_chat(user, "\The [holder] does not accept [W].") + to_chat(user, "\The [holder] does not accept [inserting].") return FALSE var/current = 0 for(var/obj/item/stack/material/S in get_contents()) @@ -24,8 +24,8 @@ return TRUE // Modified handle_item_insertion. Would prefer not to, but... -/datum/storage/sheets/handle_item_insertion(mob/user, obj/item/W, prevent_warning, skip_update, click_params) - var/obj/item/stack/material/S = W +/datum/storage/sheets/handle_item_insertion(mob/user, obj/item/inserting, prevent_warning, skip_update, click_params) + var/obj/item/stack/material/S = inserting if(!istype(S)) return FALSE var/amount @@ -71,8 +71,8 @@ atom_holder.update_icon() // Instead of removing -/datum/storage/sheets/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) - var/obj/item/stack/material/S = W +/datum/storage/sheets/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) + var/obj/item/stack/material/S = removing if(!istype(S)) return FALSE diff --git a/code/datums/storage/subtypes_slides.dm b/code/datums/storage/subtypes_slides.dm index 1f1e76f069a2..3630191a176f 100644 --- a/code/datums/storage/subtypes_slides.dm +++ b/code/datums/storage/subtypes_slides.dm @@ -3,15 +3,15 @@ max_storage_space = BASE_STORAGE_CAPACITY(ITEM_SIZE_SMALL) use_sound = 'sound/effects/storage/toolbox.ogg' -/datum/storage/slide_projector/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/slide_projector/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) . = ..() var/obj/item/slide_projector/projector = holder - if(. && istype(projector) && W == projector.current_slide) + if(. && istype(projector) && removing == projector.current_slide) var/list/contents = get_contents() projector.set_slide(length(contents) ? contents[1] : null) -/datum/storage/slide_projector/handle_item_insertion(mob/user, obj/item/W, prevent_warning, skip_update, click_params) +/datum/storage/slide_projector/handle_item_insertion(mob/user, obj/item/inserting, prevent_warning, skip_update, click_params) . = ..() var/obj/item/slide_projector/projector = holder if(. && istype(projector) && !projector.current_slide) - projector.set_slide(W) + projector.set_slide(inserting) diff --git a/code/datums/storage/subtypes_tray.dm b/code/datums/storage/subtypes_tray.dm index fd17ea8d7e45..f0d79ec39b46 100644 --- a/code/datums/storage/subtypes_tray.dm +++ b/code/datums/storage/subtypes_tray.dm @@ -4,11 +4,11 @@ allow_quick_gather = 1 use_sound = null -/datum/storage/tray/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/tray/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) . = ..() - W.vis_flags = initial(W.vis_flags) - W.appearance_flags = initial(W.appearance_flags) - W.update_icon() // in case it updates vis_flags + removing.vis_flags = initial(removing.vis_flags) + removing.appearance_flags = initial(removing.appearance_flags) + removing.update_icon() // in case it updates vis_flags /datum/storage/tray/gather_all(var/turf/T, var/mob/user) ..() diff --git a/code/datums/storage/subtypes_wallet.dm b/code/datums/storage/subtypes_wallet.dm index c9318f0146d6..75aed5045327 100644 --- a/code/datums/storage/subtypes_wallet.dm +++ b/code/datums/storage/subtypes_wallet.dm @@ -39,23 +39,23 @@ /obj/item/clothing/armor_attachment/tag, ) -/datum/storage/wallet/remove_from_storage(mob/user, obj/item/W, atom/new_location, skip_update) +/datum/storage/wallet/remove_from_storage(mob/user, obj/item/removing, atom/new_location, skip_update) . = ..() if(. && istype(holder, /obj/item/wallet)) var/obj/item/wallet/wallet = holder - if(W == wallet.front_id) + if(removing == wallet.front_id) wallet.front_id = null wallet.SetName(initial(wallet.name)) wallet.update_icon() - if(W == wallet.front_stick) + if(removing == wallet.front_stick) wallet.front_stick = null -/datum/storage/wallet/handle_item_insertion(mob/user, obj/item/W, prevent_warning, skip_update, click_params) +/datum/storage/wallet/handle_item_insertion(mob/user, obj/item/inserting, prevent_warning, skip_update, click_params) . = ..() if(. && istype(holder, /obj/item/wallet)) var/obj/item/wallet/wallet = holder - if(!wallet.front_id && istype(W, /obj/item/card/id)) - wallet.front_id = W + if(!wallet.front_id && istype(inserting, /obj/item/card/id)) + wallet.front_id = inserting wallet.update_icon() - if(!wallet.front_stick && istype(W, /obj/item/charge_stick)) - wallet.front_stick = W + if(!wallet.front_stick && istype(inserting, /obj/item/charge_stick)) + wallet.front_stick = inserting diff --git a/code/datums/supplypacks/engineering.dm b/code/datums/supplypacks/engineering.dm index e7ec3c1645be..727e55a1432c 100644 --- a/code/datums/supplypacks/engineering.dm +++ b/code/datums/supplypacks/engineering.dm @@ -87,7 +87,7 @@ containername = "collector crate" access = access_engine_equip -/decl/hierarchy/supply_pack/engineering/PA +/decl/hierarchy/supply_pack/engineering/particle_accelerator name = "Equipment - Particle accelerator" contains = list(/obj/structure/particle_accelerator/fuel_chamber, /obj/machinery/particle_accelerator/control_box, diff --git a/code/datums/supplypacks/galley.dm b/code/datums/supplypacks/galley.dm index 45c2c05ea161..2244e737d4e9 100644 --- a/code/datums/supplypacks/galley.dm +++ b/code/datums/supplypacks/galley.dm @@ -143,7 +143,7 @@ /decl/hierarchy/supply_pack/galley/beer_dispenser name = "Equipment - Booze dispenser" contains = list( - /obj/machinery/chemical_dispenser/bar_alc{anchored = FALSE} + /obj/machinery/chemical_dispenser/bar_alc/unanchored ) containertype = /obj/structure/largecrate containername = "booze dispenser crate" @@ -151,7 +151,7 @@ /decl/hierarchy/supply_pack/galley/soda_dispenser name = "Equipment - Soda dispenser" contains = list( - /obj/machinery/chemical_dispenser/bar_soft{anchored = FALSE} + /obj/machinery/chemical_dispenser/bar_soft/unanchored ) containertype = /obj/structure/largecrate containername = "soda dispenser crate" diff --git a/code/datums/supplypacks/nonessent.dm b/code/datums/supplypacks/nonessent.dm index f9e82573d193..bfbf2e87f4aa 100644 --- a/code/datums/supplypacks/nonessent.dm +++ b/code/datums/supplypacks/nonessent.dm @@ -94,7 +94,7 @@ /obj/item/clothing/pants/slacks/purple, /obj/item/clothing/shirt/button, /obj/item/clothing/suit/jacket/vest/black, - /obj/item/clothing/jumpsuit/mailman, + /obj/item/clothing/costume/mailman, /obj/item/clothing/dress/saloon, /obj/item/clothing/suspenders, /obj/item/clothing/suit/toggle/labcoat/mad, @@ -103,7 +103,7 @@ /obj/item/clothing/costume/owl, /obj/item/clothing/pants/slacks/black, /obj/item/clothing/shirt/button, - /obj/item/clothing/neck/tie/bow/color/red, + /obj/item/clothing/neck/tie/bow/red, /obj/item/clothing/suit/jacket/vest/blue, /obj/item/clothing/costume/gladiator, /obj/item/clothing/costume/soviet, @@ -115,7 +115,7 @@ /obj/item/clothing/costume/kilt, /obj/item/clothing/costume/savage_hunter, /obj/item/clothing/costume/savage_hunter/female, - /obj/item/clothing/jumpsuit/wetsuit) + /obj/item/clothing/costume/wetsuit) name = "Costume - Random" containername = "actor costumes crate" supply_method = /decl/supply_method/randomized diff --git a/code/datums/supplypacks/science.dm b/code/datums/supplypacks/science.dm index f7d7f9991091..5505d65f4647 100644 --- a/code/datums/supplypacks/science.dm +++ b/code/datums/supplypacks/science.dm @@ -4,7 +4,7 @@ /decl/hierarchy/supply_pack/science/chemistry_dispenser name = "Equipment - Chemical Reagent dispenser" contains = list( - /obj/machinery/chemical_dispenser{anchored = FALSE} + /obj/machinery/chemical_dispenser/unanchored ) containertype = /obj/structure/largecrate containername = "reagent dispenser crate" @@ -65,4 +65,13 @@ /decl/hierarchy/supply_pack/science/illuminate name = "Gear - Illumination grenades" contains = list(/obj/item/grenade/light = 8) - containername = "illumination grenade crate" \ No newline at end of file + containername = "illumination grenade crate" + +/decl/hierarchy/supply_pack/science/stasis_cages + name = "Stasis Cage" + contains = list( + /obj/structure/stasis_cage = 1 + ) + containertype = /obj/structure/closet/crate/large + containername = "stasis cage crate" + access = access_research diff --git a/code/datums/supplypacks/supplypack.dm b/code/datums/supplypacks/supplypack.dm index 1be6469edc51..319d1dee4089 100644 --- a/code/datums/supplypacks/supplypack.dm +++ b/code/datums/supplypacks/supplypack.dm @@ -14,9 +14,11 @@ var/supply_method = /decl/supply_method var/decl/security_level/security_level -//Is run once on init for non-base-category supplypacks. var/global/list/cargoprices = list() -/decl/hierarchy/supply_pack/proc/setup() +/decl/hierarchy/supply_pack/Initialize() + . = ..() // make sure children are set up + if(is_category()) + return // don't do any of this for categories if(!num_contained) for(var/entry in contains) num_contained += max(1, contains[entry]) @@ -28,8 +30,8 @@ var/global/list/cargoprices = list() cost = max(1, NONUNIT_CEILING((cost * WORTH_TO_SUPPLY_POINTS_CONSTANT * SSsupply.price_markup), WORTH_TO_SUPPLY_POINTS_ROUND_CONSTANT)) global.cargoprices[name] = cost - var/decl/supply_method/sm = GET_DECL(supply_method) - manifest = sm.setup_manifest(src) + var/decl/supply_method/method = GET_DECL(supply_method) + manifest = method.setup_manifest(src) /client/proc/print_cargo_prices() set name = "Print Cargo Prices" @@ -59,8 +61,8 @@ var/global/list/cargoprices = list() return security_state.current_security_level_is_same_or_higher_than(security_level) /decl/hierarchy/supply_pack/proc/spawn_contents(var/location) - var/decl/supply_method/sm = GET_DECL(supply_method) - . = sm.spawn_contents(src, location) + var/decl/supply_method/method = GET_DECL(supply_method) + . = method.spawn_contents(src, location) for(var/obj/O in .) O.anchored = FALSE @@ -73,18 +75,18 @@ var/global/list/cargoprices = list() //NEW NOTE: Do NOT set the price of any crates below 7 points. Doing so allows infinite points. */ -/decl/supply_method/proc/spawn_contents(var/decl/hierarchy/supply_pack/sp, var/location) - if(!sp || !location) +/decl/supply_method/proc/spawn_contents(var/decl/hierarchy/supply_pack/pack, var/location) + if(!pack || !location) return . = list() - for(var/entry in sp.contains) - for(var/i = 1 to max(1, sp.contains[entry])) + for(var/entry in pack.contains) + for(var/i = 1 to max(1, pack.contains[entry])) dd_insertObjectList(.,new entry(location)) -/decl/supply_method/proc/setup_manifest(var/decl/hierarchy/supply_pack/sp) +/decl/supply_method/proc/setup_manifest(var/decl/hierarchy/supply_pack/pack) . = list() . += "
    " - for(var/path in sp.contains) + for(var/path in pack.contains) var/atom/A = path if(!ispath(A)) continue @@ -92,13 +94,13 @@ var/global/list/cargoprices = list() . += "
" . = jointext(.,null) -/decl/supply_method/randomized/spawn_contents(var/decl/hierarchy/supply_pack/sp, var/location) - if(!sp || !location) +/decl/supply_method/randomized/spawn_contents(var/decl/hierarchy/supply_pack/pack, var/location) + if(!pack || !location) return . = list() - for(var/j = 1 to sp.num_contained) - var/picked = pick(sp.contains) + for(var/j = 1 to pack.num_contained) + var/picked = pick(pack.contains) . += new picked(location) -/decl/supply_method/randomized/setup_manifest(var/decl/hierarchy/supply_pack/sp) - return "Contains any [sp.num_contained] of:" + ..() +/decl/supply_method/randomized/setup_manifest(var/decl/hierarchy/supply_pack/pack) + return "Contains any [pack.num_contained] of:" + ..() diff --git a/code/datums/trading/_trader.dm b/code/datums/trading/_trader.dm index 267e2c67c776..097965789bd6 100644 --- a/code/datums/trading/_trader.dm +++ b/code/datums/trading/_trader.dm @@ -199,7 +199,7 @@ if(ishuman(user)) var/mob/living/human/H = user if(H.species) - specific = H.species.name + specific = H.species.uid else if(issilicon(user)) specific = TRADER_HAIL_SILICON_END if(!speech["[TRADER_HAIL_START][specific]"]) diff --git a/code/datums/traits/_traits.dm b/code/datums/traits/_traits.dm index bd1cbbf26364..b3e7103fe9d4 100644 --- a/code/datums/traits/_traits.dm +++ b/code/datums/traits/_traits.dm @@ -3,14 +3,18 @@ // certain number of them at character generation and they will alter some interactions with the world. /mob/living - var/list/traits + /// A list of mob-specific traits, for when the list differs from the species list. + /// Overrides the species list; if it's identical to it, it will be unset. + /// Code using the traits system should use get_traits() instead. + VAR_PRIVATE/list/_mob_traits /mob/living/proc/has_trait(trait_type, trait_level = TRAIT_LEVEL_EXISTS) SHOULD_NOT_OVERRIDE(TRUE) SHOULD_NOT_SLEEP(TRUE) - return (trait_type in traits) && (!trait_level || traits[trait_type] >= trait_level) + var/list/actual_traits = get_traits() + return (trait_type in actual_traits) && (!trait_level || actual_traits[trait_type] >= trait_level) -/mob/living/proc/GetTraitLevel(trait_type) +/mob/living/proc/get_trait_level(trait_type) SHOULD_NOT_SLEEP(TRUE) var/traits = get_traits() if(!traits) @@ -24,7 +28,7 @@ /mob/living/get_traits() RETURN_TYPE(/list) var/decl/species/our_species = get_species() - return traits || our_species?.traits + return _mob_traits || our_species?.traits /mob/living/proc/set_trait(trait_type, trait_level) SHOULD_NOT_SLEEP(TRUE) @@ -32,53 +36,51 @@ var/decl/trait/trait = GET_DECL(trait_type) if(!trait.validate_level(trait_level)) return FALSE - if(our_species && !traits) // If species traits haven't been setup before, check if we need to do so now + if(our_species && !_mob_traits) // If species traits haven't been setup before, check if we need to do so now var/species_level = our_species.traits[trait_type] if(species_level == trait_level) // Matched the default species trait level, ignore return TRUE - traits = our_species.traits.Copy() // The setup is to simply copy the species list of traits - if(!(trait_type in traits)) - LAZYSET(traits, trait_type, trait_level) + _mob_traits = our_species.traits.Copy() // The setup is to simply copy the species list of traits + if(!(trait_type in _mob_traits)) + LAZYSET(_mob_traits, trait_type, trait_level) trait.apply_trait(src) return TRUE -/mob/living/proc/RemoveTrait(trait_type, canonize = TRUE) +/mob/living/proc/remove_trait(trait_type, canonize = TRUE) var/decl/species/our_species = get_species() // If traits haven't been set up, but we're trying to remove a trait that exists on the species then set up traits - if(!traits && LAZYISIN(our_species?.traits, trait_type)) - traits = our_species.traits.Copy() - if(LAZYLEN(traits)) - LAZYREMOVE(traits, trait_type) + if(!_mob_traits && LAZYISIN(our_species?.traits, trait_type)) + _mob_traits = our_species.traits.Copy() + if(LAZYLEN(_mob_traits)) + LAZYREMOVE(_mob_traits, trait_type) // Check if we can just default back to species traits. if(canonize) - CanonizeTraits() + canonize_traits() /// Removes a trait unless it exists on the species. /// If it does exist on the species, we reset it to the species' trait level. -/mob/living/proc/RemoveExtrinsicTrait(trait_type) +/mob/living/proc/remove_extrinsic_trait(trait_type) var/decl/species/our_species = get_species() if(!LAZYACCESS(our_species?.traits, trait_type)) - RemoveTrait(trait_type) - else if(our_species?.traits[trait_type] != GetTraitLevel(trait_type)) + remove_trait(trait_type) + else if(our_species?.traits[trait_type] != get_trait_level(trait_type)) set_trait(trait_type, our_species?.traits[trait_type]) +/mob/living/proc/clear_extrinsic_traits() + _mob_traits = null + /// Sets the traits list to null if it's identical to the species list. /// Returns TRUE if the list was reset and FALSE otherwise. -/mob/living/proc/CanonizeTraits() - if(!traits) // Already in canonical form. +/mob/living/proc/canonize_traits() + if(!_mob_traits) // Already in canonical form. return FALSE var/decl/species/our_species = get_species() if(!our_species) // Doesn't apply without a species. return FALSE - var/list/missing_traits = traits ^ our_species?.traits - var/list/matched_traits = traits & our_species?.traits - if(LAZYLEN(missing_traits)) - return FALSE - for(var/trait in matched_traits) // inside this loop we know our_species exists and has traits - if(traits[trait] != our_species.traits[trait]) - return FALSE - traits = null - return TRUE + if(_mob_traits ~= our_species.traits) + _mob_traits = null + return TRUE + return FALSE /decl/trait abstract_type = /decl/trait @@ -194,10 +196,10 @@ return (istype(holder)) // Called by preferences selection for HTML display. -/decl/trait/proc/get_trait_selection_data(var/datum/category_item/player_setup_item/traits/caller, var/list/ticked_traits = list(), var/recurse_level = 0, var/ignore_children_if_unticked = 1, var/ignore_unticked) +/decl/trait/proc/get_trait_selection_data(var/datum/category_item/player_setup_item/traits/calling_item, var/list/ticked_traits = list(), var/recurse_level = 0, var/ignore_children_if_unticked = 1, var/ignore_unticked) var/ticked = (type in ticked_traits) - if((ignore_unticked && !ticked) || (caller && !is_available_to_select(caller.pref))) + if((ignore_unticked && !ticked) || (calling_item && !is_available_to_select(calling_item.pref))) return "" var/result = "" @@ -211,10 +213,10 @@ incompatible_trait_taken = TRUE break - var/chargen_name = get_chargen_name(caller.pref) - var/chargen_desc = get_chargen_desc(caller.pref) - if(istype(caller) && (ticked || caller.get_trait_total() + trait_cost <= get_config_value(/decl/config/num/max_character_traits)) && !incompatible_trait_taken) - result += "[ticked ? "[chargen_name]" : "[chargen_name]"] ([trait_cost])" + var/chargen_name = get_chargen_name(calling_item.pref) + var/chargen_desc = get_chargen_desc(calling_item.pref) + if(istype(calling_item) && (ticked || calling_item.get_trait_total() + trait_cost <= get_config_value(/decl/config/num/max_character_traits)) && !incompatible_trait_taken) + result += "[ticked ? "[chargen_name]" : "[chargen_name]"] ([trait_cost])" else result += ticked ? "[chargen_name]" : "[chargen_name]" @@ -227,7 +229,7 @@ result += "" if(LAZYLEN(children) && !(ignore_children_if_unticked && !ticked)) for(var/decl/trait/trait in children) - result += trait.get_trait_selection_data(caller, ticked_traits, (recurse_level+1), ignore_children_if_unticked) + result += trait.get_trait_selection_data(calling_item, ticked_traits, (recurse_level+1), ignore_children_if_unticked) return result /// Shows `show_to` a browser window describing the character setup traits taken by `src`. diff --git a/code/datums/traits/prosthetics/prosthetic_limbs.dm b/code/datums/traits/prosthetics/prosthetic_limbs.dm index 0ea2e8c06580..a620ebef2942 100644 --- a/code/datums/traits/prosthetics/prosthetic_limbs.dm +++ b/code/datums/traits/prosthetics/prosthetic_limbs.dm @@ -14,10 +14,8 @@ var/list/incompatible_with_limbs = list(BP_L_HAND) var/model -/decl/trait/prosthetic_limb/proc/get_base_model(var/species_name) - if(!species_name) - return /decl/bodytype/prosthetic/basic_human - var/decl/species/species = species_name ? get_species_by_key(species_name) : global.using_map.default_species +/decl/trait/prosthetic_limb/proc/get_base_model(var/species_uid) + var/decl/species/species = decls_repository.get_decl_by_id(species_uid || global.using_map.default_species) return species?.base_external_prosthetics_model /decl/trait/prosthetic_limb/get_chargen_name(datum/preferences/pref) @@ -84,12 +82,12 @@ if(!bodytype?.is_robotic) return FALSE if(model) - var/decl/bodytype/prosthetic/R = GET_DECL(model) - if(!istype(R)) + var/decl/bodytype/prosthetic/robot_model = GET_DECL(model) + if(!istype(robot_model)) return FALSE - var/decl/species/S = get_species_by_key(pref.species) || get_species_by_key(global.using_map.default_species) + var/decl/species/S = pref.get_species_decl() var/decl/bodytype/B = S.get_bodytype_by_name(pref.bodytype) - if(!R.check_can_install(apply_to_limb, target_bodytype = (check_bodytype || B.bodytype_category))) + if(!robot_model.check_can_install(apply_to_limb, target_bodytype = (check_bodytype || B.bodytype_category))) return FALSE // If we're a duplicate of our parent due to get_base_model(), hide this one. var/decl/trait/prosthetic_limb/parent_limb = parent @@ -114,7 +112,7 @@ // Robotize the selected limb. if(. && apply_to_limb) - var/use_model = model || get_base_model(holder.get_species_name()) + var/use_model = model || get_base_model(holder.get_species()?.uid) var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(holder, apply_to_limb) if(!istype(E)) var/list/organ_data = holder.should_have_limb(apply_to_limb) diff --git a/code/datums/underwear/bottom.dm b/code/datums/underwear/bottom.dm index a2ed61658161..fc8bd4a2ee30 100644 --- a/code/datums/underwear/bottom.dm +++ b/code/datums/underwear/bottom.dm @@ -1,4 +1,5 @@ /datum/category_item/underwear/bottom + abstract_type = /datum/category_item/underwear/bottom underwear_gender = PLURAL underwear_name = "underwear" underwear_type = /obj/item/underwear/bottom diff --git a/code/datums/underwear/socks.dm b/code/datums/underwear/socks.dm index 4b2689521937..70dc7454dce7 100644 --- a/code/datums/underwear/socks.dm +++ b/code/datums/underwear/socks.dm @@ -1,4 +1,5 @@ /datum/category_item/underwear/socks + abstract_type = /datum/category_item/underwear/socks underwear_name = "socks" underwear_gender = PLURAL underwear_type = /obj/item/underwear/socks diff --git a/code/datums/underwear/top.dm b/code/datums/underwear/top.dm index 6b559214f65e..816df62549df 100644 --- a/code/datums/underwear/top.dm +++ b/code/datums/underwear/top.dm @@ -1,4 +1,5 @@ /datum/category_item/underwear/top + abstract_type = /datum/category_item/underwear/top underwear_name = "bra" underwear_type = /obj/item/underwear/top diff --git a/code/datums/underwear/undershirt.dm b/code/datums/underwear/undershirt.dm index ad2f3c3691f7..ae4ac6a5d603 100644 --- a/code/datums/underwear/undershirt.dm +++ b/code/datums/underwear/undershirt.dm @@ -1,4 +1,5 @@ /datum/category_item/underwear/undershirt + abstract_type = /datum/category_item/underwear/undershirt underwear_name = "undershirt" underwear_type = /obj/item/underwear/undershirt diff --git a/code/datums/underwear/underwear.dm b/code/datums/underwear/underwear.dm index a42fcf1a66f1..ff0813a3e9f5 100644 --- a/code/datums/underwear/underwear.dm +++ b/code/datums/underwear/underwear.dm @@ -1,6 +1,9 @@ /**************************** * Category Collection Setup * ****************************/ +// TODO: replace underwear category stuff with decls or something? unlike player_setup_collection they're all singletons +// i hate to say it but the way this works may actually be perfect for /decl/hierarchy +var/global/datum/category_collection/underwear/underwear = new() /datum/category_collection/underwear category_group_type = /datum/category_group/underwear @@ -8,6 +11,9 @@ * Categories * *************/ // Lower sort order is applied as icons first +/datum/category_group/underwear + abstract_type = /datum/category_group/underwear + /datum/category_group/underwear/top name = "Underwear, top" sort_order = 1 diff --git a/code/datums/uplink/ammunition.dm b/code/datums/uplink/ammunition.dm index 4c0f2ba93ab3..0b9d512df9df 100644 --- a/code/datums/uplink/ammunition.dm +++ b/code/datums/uplink/ammunition.dm @@ -34,20 +34,6 @@ item_cost = 8 path = /obj/item/ammo_magazine/rifle -/datum/uplink_item/item/ammo/sniperammo - name = "Ammobox of Sniper Rounds" - desc = "A container of rounds for the anti-materiel rifle. Contains 7 rounds." - item_cost = 8 - path = /obj/item/box/ammo/sniperammo - antag_roles = list(/decl/special_role/mercenary) - -/datum/uplink_item/item/ammo/sniperammo/apds - name = "Ammobox of APDS Sniper Rounds" - desc = "A container of armor piercing rounds for the anti-materiel rifle. Contains 3 rounds." - item_cost = 12 - path = /obj/item/box/ammo/sniperammo/apds - antag_roles = list(/decl/special_role/mercenary) - /datum/uplink_item/item/ammo/shotgun_shells name = "Ammobox of Shotgun Shells" desc = "An ammo box with 2 sets of shell holders. Contains 8 buckshot shells total." @@ -60,26 +46,12 @@ item_cost = 8 path = /obj/item/box/ammo/shotgunammo -/datum/uplink_item/item/ammo/smg - name = "Standard Box Magazine" - desc = "A magazine for standard SMGs. Contains 20 rounds." - item_cost = 8 - path = /obj/item/ammo_magazine/smg - antag_roles = list(/decl/special_role/mercenary) - /datum/uplink_item/item/ammo/speedloader_magnum name = "Magnum Speedloader" desc = "A speedloader for magnum revolvers. Contains 6 rounds." item_cost = 8 path = /obj/item/ammo_magazine/speedloader -/datum/uplink_item/item/ammo/flechette - name = "Flechette Rifle Magazine" - desc = "A rifle magazine loaded with flechette rounds. Contains 9 rounds." - item_cost = 8 - path = /obj/item/magnetic_ammo - antag_roles = list(/decl/special_role/mercenary) - /datum/uplink_item/item/ammo/pistol_emp name = "Standard EMP Ammo Box" desc = "A box of EMP ammo for standard pistols. Contains 15 rounds." diff --git a/code/datums/uplink/badassery.dm b/code/datums/uplink/badassery.dm index 43375e941cb9..a0b1b26d0da3 100644 --- a/code/datums/uplink/badassery.dm +++ b/code/datums/uplink/badassery.dm @@ -67,33 +67,3 @@ /datum/uplink_item/item/badassery/random_many/purchase_log(obj/item/uplink/U) SSstatistics.add_field_details("traitor_uplink_items_bought", "[src]") log_and_message_admins("used \the [U.loc] to buy \a [src]") - -/**************** -* Surplus Crate * -****************/ -/datum/uplink_item/item/badassery/surplus - name = "\improper Surplus Crate" - item_cost = DEFAULT_TELECRYSTAL_AMOUNT * 4 - var/item_worth = DEFAULT_TELECRYSTAL_AMOUNT * 6 - var/icon - -/datum/uplink_item/item/badassery/surplus/New() - ..() - antag_roles = list(/decl/special_role/mercenary) - desc = "A crate containing [item_worth] telecrystal\s worth of surplus leftovers. If you can find some help to pay for it, you might strike gold." - -/datum/uplink_item/item/badassery/surplus/get_goods(var/obj/item/uplink/U, var/loc) - var/obj/structure/largecrate/C = new(loc) - var/random_items = get_random_uplink_items(U, item_worth, C) - for(var/datum/uplink_item/I in random_items) - I.purchase_log(U) - I.get_goods(U, C) - - return C - -/datum/uplink_item/item/badassery/surplus/log_icon() - if(!icon) - var/obj/structure/largecrate/C = /obj/structure/largecrate - icon = image(initial(C.icon), initial(C.icon_state)) - - return html_icon(icon) diff --git a/code/datums/uplink/devices_and_tools.dm b/code/datums/uplink/devices_and_tools.dm index 7536a5d65616..b9e59845a66a 100644 --- a/code/datums/uplink/devices_and_tools.dm +++ b/code/datums/uplink/devices_and_tools.dm @@ -116,17 +116,6 @@ item_cost = 40 path = /obj/item/powersink -/datum/uplink_item/item/tools/teleporter - name = "Teleporter Circuit Board" - desc = "A circuit board that can be used to create a teleporter console, able to lock onto detected \ - teleportation beacons. Requires a projector and teleporter hub nearby to work." - item_cost = 40 - path = /obj/item/stock_parts/circuitboard/teleporter - -/datum/uplink_item/item/tools/teleporter/New() - ..() - antag_roles = list(/decl/special_role/mercenary) - /datum/uplink_item/item/tools/ai_module name = "Hacked AI Upload Module" desc = "A module that can be used anonymously add a singular, top level law to an active AI. \ @@ -146,7 +135,6 @@ name = "Camera MIU" desc = "Wearing this mask allows you to remotely view any cameras you currently have access to. Take the mask off to stop viewing." item_cost = 60 - antag_costs = list(/decl/special_role/mercenary = 30) path = /obj/item/clothing/mask/ai /datum/uplink_item/item/tools/interceptor diff --git a/code/datums/uplink/grenades.dm b/code/datums/uplink/grenades.dm index c91af43ad7d9..fa22ab92bffc 100644 --- a/code/datums/uplink/grenades.dm +++ b/code/datums/uplink/grenades.dm @@ -48,35 +48,3 @@ name = "5x EMP Grenades" item_cost = 24 path = /obj/item/box/emps - -/datum/uplink_item/item/grenades/frag_high_yield - name = "Fragmentation Bomb" - item_cost = 24 - antag_roles = list(/decl/special_role/mercenary) // yeah maybe regular traitors shouldn't be able to get these - path = /obj/item/grenade/frag/high_yield - -/datum/uplink_item/item/grenades/fragshell - name = "1x Fragmentation Shell" - desc = "Weaker than standard fragmentation grenades, these devices can be fired from a grenade launcher." - item_cost = 10 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/grenade/frag/shell - -/datum/uplink_item/item/grenades/fragshells - name = "5x Fragmentation Shells" - desc = "Weaker than standard fragmentation grenades, these devices can be fired from a grenade launcher." - item_cost = 40 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/box/fragshells - -/datum/uplink_item/item/grenades/frag - name = "1x Fragmentation Grenade" - item_cost = 10 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/grenade/frag - -/datum/uplink_item/item/grenades/frags - name = "5x Fragmentation Grenades" - item_cost = 40 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/box/frags diff --git a/code/datums/uplink/hardsuit_modules.dm b/code/datums/uplink/hardsuit_modules.dm index d770e635c9f6..076c0247d543 100644 --- a/code/datums/uplink/hardsuit_modules.dm +++ b/code/datums/uplink/hardsuit_modules.dm @@ -39,10 +39,3 @@ desc = "A module capable of recharging your suit's power reserves, by tapping into an exposed, live wire." item_cost = 48 path = /obj/item/rig_module/power_sink - -/datum/uplink_item/item/hardsuit_modules/laser_canon - name = "\improper Mounted Laser Cannon" - desc = "A module capable of draining your suit's power reserves in order to fire a shoulder mounted laser cannon." - item_cost = 64 - path = /obj/item/rig_module/mounted/lcannon - antag_roles = list(/decl/special_role/mercenary) diff --git a/code/datums/uplink/highly_visible_and_dangerous_weapons.dm b/code/datums/uplink/highly_visible_and_dangerous_weapons.dm index c64cf84b614a..66e2b05b34d3 100644 --- a/code/datums/uplink/highly_visible_and_dangerous_weapons.dm +++ b/code/datums/uplink/highly_visible_and_dangerous_weapons.dm @@ -61,69 +61,18 @@ item_cost = 56 path = /obj/item/backpack/satchel/syndie_kit/revolver -/datum/uplink_item/item/visible_weapons/grenade_launcher - name = "Grenade Launcher" - desc = "A pump action grenade launcher loaded with a random assortment of grenades" - item_cost = 60 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/gun/launcher/grenade/loaded - -//These are for traitors (or other antags, perhaps) to have the option of purchasing some merc gear. -/datum/uplink_item/item/visible_weapons/smg - name = "Standard Submachine Gun" - desc = "A quick-firing weapon with three toggleable fire modes." - item_cost = 52 - path = /obj/item/gun/projectile/automatic/smg - antag_roles = list(/decl/special_role/mercenary) - -/datum/uplink_item/item/visible_weapons/assaultrifle - name = "Assault Rifle" - desc = "A common rifle with three toggleable fire modes." - item_cost = 60 - path = /obj/item/gun/projectile/automatic/assault_rifle - antag_roles = list(/decl/special_role/mercenary) - /datum/uplink_item/item/visible_weapons/advanced_energy_gun name = "Advanced Energy Gun" desc = "A highly experimental heavy energy weapon, with three different lethality settings." item_cost = 60 path = /obj/item/gun/energy/gun/nuclear -/datum/uplink_item/item/visible_weapons/heavysniper - name = "Anti-materiel Sniper Rifle" - desc = "A secure briefcase that contains an immensely powerful penetrating rifle, as well as seven extra sniper rounds." - item_cost = 68 - path = /obj/item/secure_storage/briefcase/heavysniper - antag_roles = list(/decl/special_role/mercenary) - -/datum/uplink_item/item/visible_weapons/combat_shotgun - name = "Pump Shotgun" - desc = "A high capacity, pump-action shotgun regularly used for repelling boarding parties in close range scenarios." - item_cost = 52 - path = /obj/item/gun/projectile/shotgun/pump - antag_roles = list(/decl/special_role/mercenary) - /datum/uplink_item/item/visible_weapons/sawnoff name = "Sawnoff Shotgun" desc = "A shortened double-barrel shotgun, able to fire either one, or both, barrels at once." item_cost = 45 path = /obj/item/gun/projectile/shotgun/doublebarrel/sawn -/datum/uplink_item/item/visible_weapons/flechetterifle - name = "Flechette Rifle" - desc = "A railgun with two toggleable fire modes, able to launch flechette ammunition at incredible speeds." - item_cost = 60 - path = /obj/item/gun/magnetic/railgun/flechette - antag_roles = list(/decl/special_role/mercenary) - -/datum/uplink_item/item/visible_weapons/railgun // Like a semi-auto AMR - name = "Railgun" - desc = "An anti-armour magnetic launching system fed by a high-capacity matter cartridge, \ - capable of firing slugs at intense speeds." - item_cost = DEFAULT_TELECRYSTAL_AMOUNT - (DEFAULT_TELECRYSTAL_AMOUNT - (DEFAULT_TELECRYSTAL_AMOUNT % 6)) / 6 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/gun/magnetic/railgun - /datum/uplink_item/item/visible_weapons/harpoonbomb name = "Explosive Harpoon" item_cost = 12 diff --git a/code/datums/uplink/uplink_items.dm b/code/datums/uplink/uplink_items.dm index 97db7fad4614..26ed3c2e370c 100644 --- a/code/datums/uplink/uplink_items.dm +++ b/code/datums/uplink/uplink_items.dm @@ -1,11 +1,10 @@ -var/global/datum/uplink/uplink = new() - -/datum/uplink +/decl/uplink var/list/items_assoc var/list/datum/uplink_item/items var/list/datum/uplink_category/categories -/datum/uplink/New() +/decl/uplink/Initialize() + . = ..() items_assoc = list() items = init_subtypes(/datum/uplink_item) categories = init_subtypes(/datum/uplink_category) diff --git a/code/datums/uplink/uplink_sources.dm b/code/datums/uplink/uplink_sources.dm index a0dc90c3bf93..a37027741bf1 100644 --- a/code/datums/uplink/uplink_sources.dm +++ b/code/datums/uplink/uplink_sources.dm @@ -54,15 +54,15 @@ var/global/list/default_uplink_source_priority = list( . = ..() /decl/uplink_source/radio/setup_uplink_source(var/mob/M, var/amount) - var/obj/item/radio/R = find_in_mob(M, /obj/item/radio) - if(!R) + var/obj/item/radio/radio = find_in_mob(M, /obj/item/radio) + if(!radio) return SETUP_FAILED - var/obj/item/uplink/T = new(R, M.mind, amount) - R.hidden_uplink = T - R.traitor_frequency = sanitize_frequency(rand(PUBLIC_LOW_FREQ+1, PUB_FREQ-1)) - to_chat(M, "A portable object teleportation relay has been installed in your [R.name]. Simply dial the frequency [format_frequency(R.traitor_frequency)] to unlock its hidden features.") - M.StoreMemory("Radio Freq: [format_frequency(R.traitor_frequency)] ([R.name]).", /decl/memory_options/system) + var/obj/item/uplink/T = new(radio, M.mind, amount) + radio.hidden_uplink = T + radio.traitor_frequency = sanitize_frequency(rand(PUBLIC_LOW_FREQ+1, PUB_FREQ-1)) + to_chat(M, "A portable object teleportation relay has been installed in your [radio.name]. Simply dial the frequency [format_frequency(radio.traitor_frequency)] to unlock its hidden features.") + M.StoreMemory("Radio Freq: [format_frequency(radio.traitor_frequency)] ([radio.name]).", /decl/memory_options/system) /decl/uplink_source/implant name = "Implant" @@ -133,8 +133,8 @@ var/global/list/default_uplink_source_priority = list( priority_order |= GET_DECL(entry) for(var/entry in priority_order) - var/decl/uplink_source/US = entry - if(US.setup_uplink_source(M, amount) != SETUP_FAILED) + var/decl/uplink_source/uplink = entry + if(uplink.setup_uplink_source(M, amount) != SETUP_FAILED) return TRUE to_chat(M, "Either by choice or circumstance you will be without an uplink.") diff --git a/code/datums/vending/stored_item.dm b/code/datums/vending/stored_item.dm index 8eda6287cacb..3246f711603d 100644 --- a/code/datums/vending/stored_item.dm +++ b/code/datums/vending/stored_item.dm @@ -82,7 +82,7 @@ for(var/atom/movable/thing in instances) thing.forceMove(new_storing_obj) -/datum/stored_items/proc/get_combined_matter(include_instances = TRUE) +/datum/stored_items/proc/get_combined_matter(include_instances = TRUE, include_reagents = TRUE) var/virtual_amount = amount - length(instances) if(virtual_amount) . = atom_info_repository.get_matter_for(item_path)?.Copy() @@ -92,4 +92,4 @@ . = list() if(include_instances) for(var/atom/instance in instances) - . = MERGE_ASSOCS_WITH_NUM_VALUES(., instance.get_contained_matter()) \ No newline at end of file + . = MERGE_ASSOCS_WITH_NUM_VALUES(., instance.get_contained_matter(include_reagents)) \ No newline at end of file diff --git a/code/datums/wires/camera.dm b/code/datums/wires/camera.dm index 09046ea83f19..c1e09d292805 100644 --- a/code/datums/wires/camera.dm +++ b/code/datums/wires/camera.dm @@ -42,7 +42,7 @@ var/global/const/CAMERA_WIRE_ALARM = 8 if(CAMERA_WIRE_POWER) C.cut_power = !mended - C.set_status(mended, usr) + C.set_camera_status(mended, usr) if(CAMERA_WIRE_LIGHT) C.light_disabled = !mended diff --git a/code/datums/wires/radio.dm b/code/datums/wires/radio.dm index d2d868a4a7d1..5de478c9dd76 100644 --- a/code/datums/wires/radio.dm +++ b/code/datums/wires/radio.dm @@ -12,35 +12,35 @@ var/global/const/WIRE_RECEIVE = 2 var/global/const/WIRE_TRANSMIT = 4 /datum/wires/radio/CanUse(var/mob/living/L) - var/obj/item/radio/R = holder - if(R.panel_open) + var/obj/item/radio/radio = holder + if(radio.panel_open) return 1 return 0 /datum/wires/radio/UpdatePulsed(var/index) - var/obj/item/radio/R = holder + var/obj/item/radio/radio = holder switch(index) if(WIRE_SIGNAL) - R.listening = !R.listening && !IsIndexCut(WIRE_RECEIVE) - R.broadcasting = R.listening && !IsIndexCut(WIRE_TRANSMIT) + radio.listening = !radio.listening && !IsIndexCut(WIRE_RECEIVE) + radio.broadcasting = radio.listening && !IsIndexCut(WIRE_TRANSMIT) if(WIRE_RECEIVE) - R.listening = !R.listening && !IsIndexCut(WIRE_SIGNAL) + radio.listening = !radio.listening && !IsIndexCut(WIRE_SIGNAL) if(WIRE_TRANSMIT) - R.broadcasting = !R.broadcasting && !IsIndexCut(WIRE_SIGNAL) + radio.broadcasting = !radio.broadcasting && !IsIndexCut(WIRE_SIGNAL) SSnano.update_uis(holder) /datum/wires/radio/UpdateCut(var/index, var/mended) - var/obj/item/radio/R = holder + var/obj/item/radio/radio = holder switch(index) if(WIRE_SIGNAL) - R.listening = mended && !IsIndexCut(WIRE_RECEIVE) - R.broadcasting = mended && !IsIndexCut(WIRE_TRANSMIT) + radio.listening = mended && !IsIndexCut(WIRE_RECEIVE) + radio.broadcasting = mended && !IsIndexCut(WIRE_TRANSMIT) if(WIRE_RECEIVE) - R.listening = mended && !IsIndexCut(WIRE_SIGNAL) + radio.listening = mended && !IsIndexCut(WIRE_SIGNAL) if(WIRE_TRANSMIT) - R.broadcasting = mended && !IsIndexCut(WIRE_SIGNAL) + radio.broadcasting = mended && !IsIndexCut(WIRE_SIGNAL) SSnano.update_uis(holder) \ No newline at end of file diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index 8bbba0d8da59..2a5576b5fb9e 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -19,61 +19,59 @@ var/global/const/BORG_WIRE_CAMERA = 16 /datum/wires/robot/GetInteractWindow(mob/user) . = ..() - var/mob/living/silicon/robot/R = holder + var/mob/living/silicon/robot/robot = holder var/datum/extension/network_device/camera/D = get_extension(holder, /datum/extension/network_device/) - . += text("
\n[(R.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]") - . += text("
\n[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]") + . += text("
\n[(robot.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]") + . += text("
\n[(robot.connected_ai ? "The AI link light is on." : "The AI link light is off.")]") . += text("
\n[(D.is_functional() ? "The Camera light is on." : "The Camera light is off.")]") - . += text("
\n[(R.lockcharge ? "The lockdown light is on." : "The lockdown light is off.")]") + . += text("
\n[(robot.lockcharge ? "The lockdown light is on." : "The lockdown light is off.")]") return . /datum/wires/robot/UpdateCut(var/index, var/mended) - var/mob/living/silicon/robot/R = holder + var/mob/living/silicon/robot/robot = holder switch(index) if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI if(!mended) - if (R.lawupdate == 1) - to_chat(R, "LawSync protocol engaged.") - R.show_laws() + if (robot.lawupdate == 1) + to_chat(robot, "LawSync protocol engaged.") + robot.show_laws() else - if (R.lawupdate == 0 && !R.emagged) - R.lawupdate = 1 + if (robot.lawupdate == 0 && !robot.emagged) + robot.lawupdate = 1 if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control if(!mended) - R.disconnect_from_ai() + robot.disconnect_from_ai() if (BORG_WIRE_CAMERA) cameranet.update_visibility(src, FALSE) if(BORG_WIRE_LOCKED_DOWN) - R.SetLockdown(!mended) + robot.SetLockdown(!mended) /datum/wires/robot/UpdatePulsed(var/index) - var/mob/living/silicon/robot/R = holder + var/mob/living/silicon/robot/robot = holder switch(index) if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI - if(!R.emagged) - var/mob/living/silicon/ai/new_ai = select_active_ai(R, get_z(R)) - R.connect_to_ai(new_ai) + if(!robot.emagged) + var/mob/living/silicon/ai/new_ai = select_active_ai(robot, get_z(robot)) + robot.connect_to_ai(new_ai) if (BORG_WIRE_CAMERA) var/datum/extension/network_device/camera/robot/D = get_extension(src, /datum/extension/network_device) if(D && D.is_functional()) - R.visible_message("[R]'s camera lens focuses loudly.") - to_chat(R, "Your camera lense focuses loudly.") + robot.visible_message("[robot]'s camera lens focuses loudly.") + to_chat(robot, "Your camera lense focuses loudly.") if(BORG_WIRE_LOCKED_DOWN) - R.SetLockdown(!R.lockcharge) // Toggle + robot.SetLockdown(!robot.lockcharge) // Toggle /datum/wires/robot/CanUse(var/mob/living/L) - var/mob/living/silicon/robot/R = holder - if(R.wiresexposed) - return 1 - return 0 + var/mob/living/silicon/robot/robot = holder + return robot.wiresexposed /datum/wires/robot/proc/IsCameraCut() return wires_status & BORG_WIRE_CAMERA diff --git a/code/game/antagonist/antagonist.dm b/code/game/antagonist/antagonist.dm index 042a32f12ee8..130f060c8591 100644 --- a/code/game/antagonist/antagonist.dm +++ b/code/game/antagonist/antagonist.dm @@ -51,6 +51,7 @@ var/decl/language/required_language // Used for setting appearance. + /// Species that are valid when changing appearance while spawning as this role. Null allows all species. var/list/valid_species var/min_player_age = 14 @@ -139,9 +140,6 @@ /decl/special_role/proc/get_leader_welcome_text(mob/recipient) return leader_welcome_text -/decl/special_role/proc/tick() - return 1 - // Get the raw list of potential players. /decl/special_role/proc/build_candidate_list(decl/game_mode/mode, ghosts_only) candidates = list() // Clear. @@ -192,7 +190,7 @@ /decl/special_role/proc/attempt_random_spawn() update_current_antag_max(SSticker.mode) - build_candidate_list(SSticker.mode, flags & (ANTAG_OVERRIDE_MOB|ANTAG_OVERRIDE_JOB)) + build_candidate_list(SSticker.mode, is_latejoin_template()) attempt_spawn() finalize_spawn() @@ -208,7 +206,7 @@ message_admins("Could not auto-spawn a [name], active antag limit reached.") return 0 - build_candidate_list(SSticker.mode, flags & (ANTAG_OVERRIDE_MOB|ANTAG_OVERRIDE_JOB)) + build_candidate_list(SSticker.mode, is_latejoin_template()) if(!candidates.len) message_admins("Could not auto-spawn a [name], no candidates found.") return 0 diff --git a/code/game/antagonist/antagonist_equip.dm b/code/game/antagonist/antagonist_equip.dm index 358f49da1a4f..022bb8c57d09 100644 --- a/code/game/antagonist/antagonist_equip.dm +++ b/code/game/antagonist/antagonist_equip.dm @@ -12,7 +12,7 @@ // This could use work. if(flags & ANTAG_CLEAR_EQUIPMENT) for(var/obj/item/thing in player.contents) - if(player.canUnEquip(thing)) + if(player.can_unequip_item(thing)) qdel(thing) //mainly for nonhuman antag compatibility. Should not effect item spawning. player.species.equip_survival_gear(player) diff --git a/code/game/antagonist/antagonist_factions.dm b/code/game/antagonist/antagonist_factions.dm index 07e12dd921fb..079a4daeb571 100644 --- a/code/game/antagonist/antagonist_factions.dm +++ b/code/game/antagonist/antagonist_factions.dm @@ -18,7 +18,7 @@ to_chat(src, "\The [player.current] cannot be \a [faction.faction_name]!") return - if(world.time < player.rev_cooldown) + if(world.time < player.conversion_cooldown) to_chat(src, "You must wait five seconds between attempts.") return @@ -26,7 +26,7 @@ log_admin("[src]([src.ckey]) attempted to convert [player.current] to the [faction.faction_name] faction.") message_admins("[src]([src.ckey]) attempted to convert [player.current] to the [faction.faction_name] faction.") - player.rev_cooldown = world.time + 5 SECONDS + player.conversion_cooldown = world.time + 5 SECONDS if (!faction.is_antagonist(player)) var/choice = alert(player.current,"Asked by [src]: Do you want to join the [faction.faction_descriptor]?","Join the [faction.faction_descriptor]?","No!","Yes!") if(!(player.current in able_mobs_in_oview(src))) diff --git a/code/game/antagonist/antagonist_panel.dm b/code/game/antagonist/antagonist_panel.dm index f16e898af98a..d34d47f6fe4d 100644 --- a/code/game/antagonist/antagonist_panel.dm +++ b/code/game/antagonist/antagonist_panel.dm @@ -17,7 +17,7 @@ /decl/special_role/proc/get_extra_panel_options() return -/decl/special_role/proc/get_check_antag_output(var/datum/admins/caller) +/decl/special_role/proc/get_check_antag_output(var/datum/admins/calling_admin) if(!current_antagonists || !current_antagonists.len) return "" @@ -33,7 +33,7 @@ if(M.stat == DEAD) dat += " (DEAD)" dat += "" - dat += "\[PM\]\[SR\]" + dat += "\[PM\]\[SR\]" else dat += "Mob not found/([player.key])!" dat += "" @@ -47,17 +47,17 @@ while(!isturf(disk_loc)) if(ismob(disk_loc)) var/mob/M = disk_loc - dat += "carried by [M.real_name] " + dat += "carried by [M.real_name] " if(istype(disk_loc, /obj)) var/obj/O = disk_loc dat += "in \a [O.name] " disk_loc = disk_loc.loc dat += "in [disk_loc.loc] at ([disk_loc.x], [disk_loc.y], [disk_loc.z])" dat += "" - dat += get_additional_check_antag_output(caller) + dat += get_additional_check_antag_output(calling_admin) dat += "
" return dat //Overridden elsewhere. -/decl/special_role/proc/get_additional_check_antag_output(var/datum/admins/caller) +/decl/special_role/proc/get_additional_check_antag_output(var/datum/admins/calling_admin) return "" diff --git a/code/game/antagonist/antagonist_place.dm b/code/game/antagonist/antagonist_place.dm index 1a69b0a7f26f..a81a4cb0dfb4 100644 --- a/code/game/antagonist/antagonist_place.dm +++ b/code/game/antagonist/antagonist_place.dm @@ -1,7 +1,7 @@ /decl/special_role/proc/get_starting_locations() if(landmark_id) starting_locations = list() - for(var/obj/abstract/landmark/L in global.landmarks_list) + for(var/obj/abstract/landmark/L in global.all_landmarks) if(L.name == landmark_id) starting_locations |= get_turf(L) diff --git a/code/game/antagonist/antagonist_update.dm b/code/game/antagonist/antagonist_update.dm index fcfd2c5fcdc2..4700d8b30018 100644 --- a/code/game/antagonist/antagonist_update.dm +++ b/code/game/antagonist/antagonist_update.dm @@ -3,10 +3,6 @@ leader = current_antagonists[1] /decl/special_role/proc/update_antag_mob(var/datum/mind/player, var/preserve_appearance) - - if(!valid_species) - valid_species = list(global.using_map.default_species) - // Get the mob. if((flags & ANTAG_OVERRIDE_MOB) && (!player.current || (mob_path && !istype(player.current, mob_path)))) var/mob/holder = player.current @@ -16,7 +12,7 @@ if(!preserve_appearance && (flags & ANTAG_SET_APPEARANCE)) spawn(3) var/mob/living/human/H = player.current - if(istype(H)) H.change_appearance(APPEARANCE_ALL, H.loc, H, valid_species, state = global.z_topic_state) + if(istype(H)) H.change_appearance(APPEARANCE_ALL, H.loc, H, species_whitelist = valid_species, state = global.z_topic_state) return player.current /decl/special_role/proc/update_access(var/mob/living/player) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index b6e467b64dac..0beedbde9025 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -403,8 +403,8 @@ var/global/list/mob/living/forced_ambiance_list = new if(LAZYLEN(forced_ambience) && !(L in forced_ambiance_list)) forced_ambiance_list += L L.playsound_local(T,sound(pick(forced_ambience), repeat = 1, wait = 0, volume = 25, channel = sound_channels.lobby_channel)) - if(LAZYLEN(ambience) && prob(5) && (world.time >= L.client.played + 3 MINUTES)) - L.playsound_local(T, sound(pick(ambience), repeat = 0, wait = 0, volume = 15, channel = sound_channels.ambience_channel)) + if(LAZYLEN(ambience) && prob(35) && (world.time >= L.client.played + 1.5 MINUTES)) + L.playsound_local(T, sound(pick(ambience), repeat = 0, wait = 0, volume = 25, channel = sound_channels.ambience_channel)) L.client.played = world.time /area/proc/clear_ambience(var/mob/living/L) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index fb3c08684708..d6d80c68478b 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -102,7 +102,7 @@ return null /** - Merge an exhaled air volume into air contents.. + Merge an exhaled air volume into air contents. */ /atom/proc/merge_exhaled_volume(datum/gas_mixture/exhaled) var/datum/gas_mixture/environment = return_air() @@ -145,7 +145,7 @@ /atom/proc/try_on_reagent_change() SHOULD_NOT_OVERRIDE(TRUE) set waitfor = FALSE - if(QDELETED(src) ||_reagent_update_started >= world.time) + if(QDELETED(src) || _reagent_update_started >= world.time) return FALSE _reagent_update_started = world.time sleep(0) // Defer to end of tick so we don't drop subsequent reagent updates. @@ -216,7 +216,8 @@ SHOULD_CALL_PARENT(TRUE) if(density != new_density) density = !!new_density - RAISE_EVENT(/decl/observ/density_set, src, !density, density) + if(event_listeners?[/decl/observ/density_set]) + raise_event_non_global(/decl/observ/density_set, !density, density) /** Handle a projectile `P` hitting this atom @@ -284,11 +285,13 @@ */ /atom/proc/examined_by(mob/user, distance, infix, suffix) var/list/examine_lines + // to_chat(user, "
") // these don't work in BYOND's native output panel. If we switch to browser output instead, you can readd this for(var/add_lines in list(get_examine_header(user, distance, infix, suffix), get_examine_strings(user, distance, infix, suffix), get_examine_hints(user, distance, infix, suffix))) if(islist(add_lines) && LAZYLEN(add_lines)) LAZYADD(examine_lines, add_lines) if(LAZYLEN(examine_lines)) to_chat(user, jointext(examine_lines, "
")) + // to_chat(user, "
") // see above RAISE_EVENT(/decl/observ/atom_examined, src, user, distance) return TRUE @@ -376,7 +379,8 @@ if(L.light_angle) L.source_atom.update_light() - RAISE_EVENT(/decl/observ/dir_set, src, old_dir, new_dir) + if(event_listeners?[/decl/observ/dir_set]) + raise_event_non_global(/decl/observ/dir_set, old_dir, new_dir) /// Set the icon to `new_icon` @@ -398,18 +402,24 @@ /** Update this atom's icon. - If prior to the first SSicon_update flush (i.e. it's during init), icon updates are forced to queue instead. - This saves a lot of init time. - Events: `updated_icon` */ /atom/proc/update_icon() SHOULD_CALL_PARENT(TRUE) - if(SSicon_update.init_state == SS_INITSTATE_NONE) - queue_icon_update() - else - on_update_icon() - RAISE_EVENT(/decl/observ/updated_icon, src) + on_update_icon() + if(event_listeners?[/decl/observ/updated_icon]) + raise_event_non_global(/decl/observ/updated_icon) + +/** + * Update this atom's icon. + * If prior to SSicon_update's first flush, queues. + * Otherwise, updates instantly. + */ +/atom/proc/lazy_update_icon() + if(SSicon_update.init_state != SS_INITSTATE_NONE) + return update_icon() + queue_icon_update() /** Update this atom's icon. @@ -425,13 +435,13 @@ * Obj adds matter contents. Other overrides may add extra handling for things like material storage. * Most useful for calculating worth or deconstructing something along with its contents. */ -/atom/proc/get_contained_matter() - if(length(reagents?.reagent_volumes)) +/atom/proc/get_contained_matter(include_reagents = TRUE) + if(include_reagents && length(reagents?.reagent_volumes)) LAZYINITLIST(.) - for(var/R in reagents.reagent_volumes) - .[R] += floor(REAGENT_VOLUME(reagents, R) / REAGENT_UNITS_PER_MATERIAL_UNIT) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + .[reagent.type] += floor(REAGENT_VOLUME(reagents, reagent) / REAGENT_UNITS_PER_MATERIAL_UNIT) for(var/atom/contained_obj as anything in get_contained_external_atoms()) // machines handle component parts separately - . = MERGE_ASSOCS_WITH_NUM_VALUES(., contained_obj.get_contained_matter()) + . = MERGE_ASSOCS_WITH_NUM_VALUES(., contained_obj.get_contained_matter(include_reagents)) /// Return a list of all simulated atoms inside this one. /atom/proc/get_contained_external_atoms() @@ -485,9 +495,8 @@ */ /atom/proc/try_detonate_reagents(var/severity = 3) if(reagents) - for(var/r_type in reagents.reagent_volumes) - var/decl/material/R = GET_DECL(r_type) - R.explosion_act(src, severity) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + reagent.explosion_act(src, severity) /** Handle an explosion of `severity` affecting this atom @@ -673,7 +682,7 @@ - Return: The result of the forceMove() at the end. */ /atom/movable/proc/dropInto(var/atom/destination) - while(istype(destination)) + while(!QDELETED(src) && istype(destination)) var/atom/drop_destination = destination.onDropInto(src) if(!istype(drop_destination) || drop_destination == destination) return forceMove(destination) diff --git a/code/game/atoms_init.dm b/code/game/atoms_init.dm index eb08297e2ab9..74a53a1d715c 100644 --- a/code/game/atoms_init.dm +++ b/code/game/atoms_init.dm @@ -89,10 +89,7 @@ updateVisibility(src) if(atom_codex_ref && atom_codex_ref != TRUE) // may be null, TRUE or a datum instance QDEL_NULL(atom_codex_ref) - var/atom/oldloc = loc . = ..() - if(isatom(oldloc) && oldloc.storage && !QDELETED(loc.storage)) - oldloc.storage.on_item_post_deletion(src) // must be done after deletion // This might need to be moved onto a Del() override at some point. QDEL_NULL(storage) @@ -135,6 +132,7 @@ . = ..() + var/atom/oldloc = loc forceMove(null) if(LAZYLEN(movement_handlers) && !ispath(movement_handlers[1])) @@ -151,6 +149,10 @@ if(!QDELETED(mask)) qdel(mask) + // This has to be done for movables because atoms can't be in storage. + if(isatom(oldloc) && !QDELETED(oldloc?.storage)) + oldloc.storage.on_item_post_deletion(src) // must be done after deletion + /atom/GetCloneArgs() return list(loc) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 73011d930265..0d998a4a5ec1 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -10,7 +10,8 @@ var/buckle_layer_above = FALSE var/buckle_dir = 0 var/buckle_lying = -1 // bed-like behavior, forces mob to lie or stand if buckle_lying != -1 - var/buckle_pixel_shift // ex. @'{"x":0,"y":0,"z":0}' //where the buckled mob should be pixel shifted to, or null for no pixel shift control + /// A list or JSON-encoded list of pixel offsets to use on a mob buckled to this atom. TRUE to use this atom's pixel shifts, null for no pixel shift control. + var/buckle_pixel_shift // ex. @'{"x":0,"y":0,"z":0}' var/buckle_require_restraints = 0 // require people to be cuffed before being able to buckle. eg: pipes var/buckle_require_same_tile = FALSE var/buckle_sound @@ -22,7 +23,9 @@ // var/elevation = 2 - not used anywhere var/move_speed = 10 var/l_move_time = 1 - var/m_flag = 1 + var/const/FIRST_DIAGONAL_STEP = 1 + var/const/SECOND_DIAGONAL_STEP = 2 + var/moving_diagonally = FALSE // Used so we don't break grabs mid-diagonal-move. var/datum/thrownthing/throwing var/throw_speed = 2 var/throw_range = 7 @@ -61,20 +64,24 @@ SSspacedrift.processing[src] = src return 1 -//return 0 to space drift, 1 to stop, -1 for mobs to handle space slips +// return SPACE_MOVE_FORBIDDEN to space drift, SPACE_MOVE_PERMITTED to stop, SPACE_MOVE_SUPPORTED for mobs to handle space slips +// Note that it may also return an instance of /atom/movable, which acts as SPACE_MOVE_SUPPORTED and results in pushing the movable backwards. /atom/movable/proc/is_space_movement_permitted(allow_movement = FALSE) if(!simulated) return SPACE_MOVE_PERMITTED if(has_gravity()) return SPACE_MOVE_PERMITTED - if(length(grabbed_by)) - return SPACE_MOVE_PERMITTED if(throwing) return SPACE_MOVE_PERMITTED if(anchored) return SPACE_MOVE_PERMITTED if(!isturf(loc)) return SPACE_MOVE_PERMITTED + if(length(grabbed_by)) + for(var/obj/item/grab/grab as anything in grabbed_by) + if(grab.assailant == src) + continue + return SPACE_MOVE_PERMITTED if(locate(/obj/structure/lattice) in range(1, get_turf(src))) //Not realistic but makes pushing things in space easier return SPACE_MOVE_SUPPORTED return SPACE_MOVE_FORBIDDEN @@ -149,7 +156,7 @@ /atom/movable/proc/forceMove(atom/destination) - if(QDELETED(src) && !QDESTROYING(src) && !isnull(destination)) + if(QDELETED(src) && !isnull(destination)) CRASH("Attempted to forceMove a QDELETED [src] out of nullspace!!!") if(loc == destination) @@ -161,6 +168,7 @@ // Both the origin and destination are turfs with different areas. // When either origin or destination is a turf and the other is not. var/is_new_area = (is_origin_turf ^ is_destination_turf) || (is_origin_turf && is_destination_turf && loc.loc != destination.loc) + var/was_below_z_turf = MOVABLE_IS_BELOW_ZTURF(src) var/atom/origin = loc loc = destination @@ -185,8 +193,8 @@ . = TRUE // observ - if(!loc) - RAISE_EVENT(/decl/observ/moved, src, origin, null) + if(!loc && event_listeners?[/decl/observ/moved]) + raise_event_non_global(/decl/observ/moved, origin, null) // freelook if(simulated && opacity) @@ -202,6 +210,18 @@ L = thing L.source_atom.update_light() + // Z-Mimic. + if (bound_overlay) + // The overlay will handle cleaning itself up on non-openspace turfs. + if (isturf(destination)) + bound_overlay.forceMove(get_step(src, UP)) + if (dir != bound_overlay.dir) + bound_overlay.set_dir(dir) + else // Not a turf, so we need to destroy immediately instead of waiting for the destruction timer to proc. + qdel(bound_overlay) + else if (isturf(loc) && (!origin || !was_below_z_turf) && MOVABLE_SHALL_MIMIC(src)) + SSzcopy.discover_movable(src) + if(buckled_mob) if(isturf(loc)) buckled_mob.glide_size = glide_size // Setting loc apparently does animate with glide size. @@ -224,7 +244,7 @@ /atom/movable/Move(...) var/old_loc = loc - + var/was_below_z_turf = MOVABLE_IS_BELOW_ZTURF(src) . = ..() if(.) @@ -237,8 +257,8 @@ else unbuckle_mob() - if(!loc) - RAISE_EVENT(/decl/observ/moved, src, old_loc, null) + if(!loc && event_listeners?[/decl/observ/moved]) + raise_event_non_global(/decl/observ/moved, old_loc, null) // freelook if(simulated && opacity) @@ -260,7 +280,7 @@ bound_overlay.forceMove(get_step(src, UP)) if (bound_overlay.dir != dir) bound_overlay.set_dir(dir) - else if (isturf(loc) && (!old_loc || !TURF_IS_MIMICKING(old_loc)) && MOVABLE_SHALL_MIMIC(src)) + else if (isturf(loc) && (!old_loc || !was_below_z_turf) && MOVABLE_SHALL_MIMIC(src)) SSzcopy.discover_movable(src) if(isturf(loc)) @@ -603,3 +623,8 @@ return TRUE return FALSE +/atom/movable/proc/get_cryogenic_power() + return 0 + +/atom/movable/proc/is_valid_merchant_pad_target() + return simulated diff --git a/code/game/atoms_movable_overlay.dm b/code/game/atoms_movable_overlay.dm index c6beb4d1becd..9f290edc35f7 100644 --- a/code/game/atoms_movable_overlay.dm +++ b/code/game/atoms_movable_overlay.dm @@ -39,9 +39,9 @@ master = null . = ..() -/atom/movable/overlay/attackby(obj/item/I, mob/user) +/atom/movable/overlay/attackby(obj/item/used_item, mob/user) if (master) - return master.attackby(I, user) + return master.attackby(used_item, user) return TRUE /atom/movable/overlay/attack_hand(mob/user) diff --git a/code/game/gamemodes/endgame/ftl_jump/ftl_jump.dm b/code/game/gamemodes/endgame/ftl_jump/ftl_jump.dm index 77f579113835..634ee0779fb6 100644 --- a/code/game/gamemodes/endgame/ftl_jump/ftl_jump.dm +++ b/code/game/gamemodes/endgame/ftl_jump/ftl_jump.dm @@ -53,14 +53,14 @@ if(M.client) to_chat(M,"You feel oddly light, and somewhat disoriented as everything around you shimmers and warps ever so slightly.") M.overlay_fullscreen("wormhole", /obj/screen/fullscreen/wormhole_overlay) - M.set_status(STAT_CONFUSE, 20) + M.set_status_condition(STAT_CONFUSE, 20) bluegoasts += new/obj/effect/bluegoast/(get_turf(M),M) /datum/universal_state/jump/proc/clear_duplicated(var/mob/living/M) if(M.client) to_chat(M,"You feel rooted in material world again.") M.clear_fullscreen("wormhole") - M.set_status(STAT_CONFUSE, 0) + M.set_status_condition(STAT_CONFUSE, 0) for(var/mob/goast in global.ghost_mob_list) goast.mouse_opacity = initial(goast.mouse_opacity) goast.set_invisibility(initial(goast.invisibility)) @@ -121,7 +121,7 @@ /obj/effect/bluegoast/proc/blueswitch() var/mob/living/human/H if(ishuman(daddy)) - H = new(get_turf(src), daddy.species.name, daddy.get_mob_snapshot(), daddy.get_bodytype()) + H = new(get_turf(src), daddy.species.uid, daddy.get_mob_snapshot(), daddy.get_bodytype()) for(var/obj/item/entry in daddy.get_equipped_items(TRUE)) daddy.remove_from_mob(entry) //steals instead of copies so we don't end up with duplicates H.equip_to_appropriate_slot(entry) diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm index 014baac33a14..20cd9d5a395b 100644 --- a/code/game/jobs/access.dm +++ b/code/game/jobs/access.dm @@ -58,19 +58,19 @@ /atom/movable/proc/check_access(atom/movable/A) return check_access_list(A ? A.GetAccess() : list()) -/atom/movable/proc/check_access_list(list/L) - var/list/R = get_req_access() +/atom/movable/proc/check_access_list(list/supplied_access) + var/list/required_access = get_req_access() - if(!R) - R = list() - if(!istype(L, /list)) + if(!required_access) + required_access = list() + if(!istype(supplied_access, /list)) return FALSE if(maint_all_access) - L = L.Copy() - L |= access_maint_tunnels + supplied_access = supplied_access.Copy() + supplied_access |= access_maint_tunnels - return has_access(R, L) + return has_access(required_access, supplied_access) /proc/has_access(list/req_access, list/accesses) for(var/req in req_access) @@ -143,11 +143,10 @@ var/global/list/datum/access/priv_all_access_datums_region return priv_all_access_datums_region.Copy() /proc/get_access_ids(var/access_types = ACCESS_TYPE_ALL) - var/list/L = new() + . = list() for(var/datum/access/A in get_all_access_datums()) if(A.access_type & access_types) - L += A.id - return L + . += A.id var/global/list/priv_all_access /proc/get_all_accesses() diff --git a/code/game/jobs/job/_job.dm b/code/game/jobs/job/_job.dm index 06e985a8772d..eb27bd7793e3 100644 --- a/code/game/jobs/job/_job.dm +++ b/code/game/jobs/job/_job.dm @@ -173,8 +173,8 @@ remembered_info += "Your account pin is: [account.remote_access_pin]
" remembered_info += "Your account funds are: [account.format_value_by_currency(account.money)]
" if(account.transaction_log.len) - var/datum/transaction/T = account.transaction_log[1] - remembered_info += "Your account was created: [T.time], [T.date] at [T.get_source_name()]
" + var/datum/transaction/transaction = account.transaction_log[1] + remembered_info += "Your account was created: [transaction.time], [transaction.date] at [transaction.get_source_name()]
" if(cash_on_hand > 0) var/decl/currency/cur = GET_DECL(global.using_map.default_currency) remembered_info += "Your cash on hand is: [cur.format_value(cash_on_hand)]
" @@ -235,13 +235,13 @@ to_chat(feedback, "Wrong rank for [title]. Valid ranks in [prefs.branches[title]] are: [get_ranks(prefs.branches[title])].") return TRUE - var/decl/species/S = get_species_by_key(prefs.species) + var/decl/species/S = prefs.get_species_decl() if(!is_species_allowed(S)) to_chat(feedback, "Restricted species, [S], for [title].") return TRUE - if(LAZYACCESS(minimum_character_age, S.get_root_species_name()) && (prefs.get_character_age() < minimum_character_age[S.get_root_species_name()])) - to_chat(feedback, "Not old enough. Minimum character age is [minimum_character_age[S.get_root_species_name()]].") + if(LAZYACCESS(minimum_character_age, S.uid) && (prefs.get_character_age() < minimum_character_age[S.uid])) + to_chat(feedback, "Not old enough. Minimum character age is [minimum_character_age[S.uid]].") return TRUE if(!S.check_background(src, prefs)) @@ -255,9 +255,9 @@ return FALSE -/datum/job/proc/get_join_link(var/client/caller, var/href_string, var/show_invalid_jobs) - if(is_available(caller)) - if(is_restricted(caller.prefs)) +/datum/job/proc/get_join_link(var/client/calling_client, var/href_string, var/show_invalid_jobs) + if(is_available(calling_client)) + if(is_restricted(calling_client.prefs)) if(show_invalid_jobs) return "[title]
[current_positions]
Active: [get_active_count()]
" else @@ -356,22 +356,21 @@ //Returns human-readable list of branches this job allows. /datum/job/proc/get_branches() - var/list/res = list() - for(var/T in allowed_branches) - var/datum/mil_branch/B = mil_branches.get_branch_by_type(T) - res += B.name - return english_list(res) + . = list() + for(var/branch in allowed_branches) + var/datum/mil_branch/branch_datum = mil_branches.get_branch_by_type(branch) + . += branch_datum.name + return english_list(.) //Same as above but ranks /datum/job/proc/get_ranks(branch) - var/list/res = list() - var/datum/mil_branch/B = mil_branches.get_branch(branch) - for(var/T in allowed_ranks) - var/datum/mil_rank/R = T - if(B && !(initial(R.name) in B.ranks)) + . = list() + var/datum/mil_branch/branch_datum = mil_branches.get_branch(branch) + for(var/datum/mil_rank/rank as anything in allowed_ranks) + if(branch_datum && !(initial(rank.name) in branch_datum.ranks)) continue - res |= initial(R.name) - return english_list(res) + . |= initial(rank.name) + return english_list(.) /datum/job/proc/get_description_blurb() return description @@ -380,17 +379,17 @@ if(!SSjobs.job_icons[title]) var/mob/living/human/dummy/mannequin/mannequin = get_mannequin("#job_icon") if(mannequin) - var/decl/species/mannequin_species = get_species_by_key(global.using_map.default_species) + var/decl/species/mannequin_species = decls_repository.get_decl_by_id(global.using_map.default_species) if(!is_species_allowed(mannequin_species)) // Don't just default to the first species allowed, pick one at random. for(var/other_species in shuffle(get_playable_species())) - var/decl/species/other_species_decl = get_species_by_key(other_species) + var/decl/species/other_species_decl = decls_repository.get_decl_by_id(other_species) if(is_species_allowed(other_species_decl)) mannequin_species = other_species_decl break if(!is_species_allowed(mannequin_species)) PRINT_STACK_TRACE("No allowed species allowed for job [title] ([type]), falling back to default!") - mannequin.change_species(mannequin_species.name) + mannequin.change_species(mannequin_species.uid) dress_mannequin(mannequin) mannequin.set_dir(SOUTH) var/icon/preview_icon = getFlatIcon(mannequin) @@ -398,27 +397,27 @@ SSjobs.job_icons[title] = preview_icon return SSjobs.job_icons[title] -/datum/job/proc/get_unavailable_reasons(var/client/caller) +/datum/job/proc/get_unavailable_reasons(var/client/calling_client) var/list/reasons = list() - if(jobban_isbanned(caller, title)) + if(jobban_isbanned(calling_client, title)) reasons["You are jobbanned."] = TRUE - if(is_semi_antagonist && jobban_isbanned(caller, /decl/special_role/provocateur)) + if(is_semi_antagonist && jobban_isbanned(calling_client, /decl/special_role/provocateur)) reasons["You are semi-antagonist banned."] = TRUE - if(!player_old_enough(caller)) + if(!player_old_enough(calling_client)) reasons["Your player age is too low."] = TRUE if(!is_position_available()) reasons["There are no positions left."] = TRUE - if(!isnull(allowed_branches) && (!caller.prefs.branches[title] || !is_branch_allowed(caller.prefs.branches[title]))) + if(!isnull(allowed_branches) && (!calling_client.prefs.branches[title] || !is_branch_allowed(calling_client.prefs.branches[title]))) reasons["Your branch of service does not allow it."] = TRUE - else if(!isnull(allowed_ranks) && (!caller.prefs.ranks[title] || !is_rank_allowed(caller.prefs.branches[title], caller.prefs.ranks[title]))) + else if(!isnull(allowed_ranks) && (!calling_client.prefs.ranks[title] || !is_rank_allowed(calling_client.prefs.branches[title], calling_client.prefs.ranks[title]))) reasons["Your rank choice does not allow it."] = TRUE - var/decl/species/S = get_species_by_key(caller.prefs.species) + var/decl/species/S = calling_client.prefs.get_species_decl() if(S) if(!is_species_allowed(S)) reasons["Your species choice does not allow it."] = TRUE - if(!S.check_background(src, caller.prefs)) + if(!S.check_background(src, calling_client.prefs)) reasons["Your background choices do not allow it."] = TRUE - var/special_blocker = check_special_blockers(caller.prefs) + var/special_blocker = check_special_blockers(calling_client.prefs) if(special_blocker) reasons["Your preferences do not allow it: '[special_blocker]'."] = TRUE return TRUE @@ -430,14 +429,14 @@ mannequin.delete_inventory(TRUE) equip_preview(mannequin, additional_skips = OUTFIT_ADJUSTMENT_SKIP_BACKPACK) -/datum/job/proc/is_available(var/client/caller) +/datum/job/proc/is_available(var/client/calling_client) if(!is_position_available()) return FALSE - if(jobban_isbanned(caller, title)) + if(jobban_isbanned(calling_client, title)) return FALSE - if(is_semi_antagonist && jobban_isbanned(caller, /decl/special_role/provocateur)) + if(is_semi_antagonist && jobban_isbanned(calling_client, /decl/special_role/provocateur)) return FALSE - if(!player_old_enough(caller)) + if(!player_old_enough(calling_client)) return FALSE return TRUE @@ -446,7 +445,7 @@ /datum/job/proc/get_roundstart_spawnpoint() var/list/loc_list = list() - for(var/obj/abstract/landmark/start/sloc in global.landmarks_list) + for(var/obj/abstract/landmark/start/sloc in global.all_landmarks) if(sloc.name != title) continue if(locate(/mob/living) in sloc.loc) continue loc_list += sloc diff --git a/code/game/jobs/server_whitelist.dm b/code/game/jobs/server_whitelist.dm index 9c8b84f46b57..da26aaeea7cf 100644 --- a/code/game/jobs/server_whitelist.dm +++ b/code/game/jobs/server_whitelist.dm @@ -63,8 +63,8 @@ var/global/list/alien_whitelist = list() alien_whitelist[row["ckey"]] = list(row["race"]) return TRUE -/proc/is_species_whitelisted(mob/M, var/species_name) - var/decl/species/S = get_species_by_key(species_name) +/proc/is_species_whitelisted(mob/M, var/species_uid) + var/decl/species/S = decls_repository.get_decl_by_id(species_uid) return is_alien_whitelisted(M, S) /proc/is_alien_whitelisted(mob/M, var/species) @@ -95,7 +95,7 @@ var/global/list/alien_whitelist = list() return FALSE if(!get_config_value(/decl/config/toggle/use_alien_whitelist) || !(S.spawn_flags & SPECIES_IS_WHITELISTED)) return TRUE - return whitelist_lookup(S.get_root_species_name(M), M.ckey) + return whitelist_lookup(S.uid, M.ckey) || whitelist_lookup(S.name, M.ckey) // Check for arbitrary text whitelisting. return istext(species) ? whitelist_lookup(species, M.ckey) : FALSE diff --git a/code/game/machinery/CableLayer.dm b/code/game/machinery/CableLayer.dm index e9da96a9a367..ee1ee91f4aa3 100644 --- a/code/game/machinery/CableLayer.dm +++ b/code/game/machinery/CableLayer.dm @@ -26,17 +26,17 @@ user.visible_message("\The [user] [!on?"dea":"a"]ctivates \the [src].", "You switch [src] [on? "on" : "off"]") return TRUE -/obj/machinery/cablelayer/attackby(var/obj/item/O, var/mob/user) - if(istype(O, /obj/item/stack/cable_coil)) +/obj/machinery/cablelayer/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/stack/cable_coil)) - var/result = load_cable(O) + var/result = load_cable(used_item) if(!result) to_chat(user, "\The [src]'s cable reel is full.") else to_chat(user, "You load [result] lengths of cable into [src].") return TRUE - if(IS_WIRECUTTER(O)) + if(IS_WIRECUTTER(used_item)) if(cable && cable.amount) var/m = round(input(user,"Please specify the length of cable to cut","Cut cable",min(cable.amount,30)) as num, 1) m = min(m, cable.amount) diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 37f33f20daca..435834976bc0 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -10,7 +10,6 @@ active_power_usage = 5 construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 var/suppressing = FALSE var/mob/living/victim diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 24e826c1739b..dc25d0685b56 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -42,6 +42,9 @@ add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/antitoxins()) add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/oxy_meds()) +/obj/machinery/sleeper/get_cryogenic_power() + return stasis + /obj/machinery/sleeper/Destroy() QDEL_NULL(beaker) QDEL_NULL_LIST(loaded_canisters) @@ -56,8 +59,7 @@ to_chat(user, SPAN_WARNING("\The [src] cannot accept any more chemical canisters.")) return FALSE if(!emagged) - for(var/rid in canister.reagents?.reagent_volumes) - var/decl/material/reagent = GET_DECL(rid) + for(var/decl/material/reagent as anything in canister.reagents?.reagent_volumes) for(var/banned_type in banned_chem_types) if(istype(reagent, banned_type)) to_chat(user, SPAN_WARNING("Automatic safety checking indicates the presence of a prohibited substance in this canister.")) @@ -94,11 +96,11 @@ LAZYREMOVE(., loaded_canisters) LAZYREMOVE(., beaker) -/obj/machinery/sleeper/get_contained_matter() +/obj/machinery/sleeper/get_contained_matter(include_reagents = TRUE) . = ..() - . = MERGE_ASSOCS_WITH_NUM_VALUES(., beaker.get_contained_matter()) + . = MERGE_ASSOCS_WITH_NUM_VALUES(., beaker.get_contained_matter(include_reagents)) for(var/obj/canister in loaded_canisters) - . = MERGE_ASSOCS_WITH_NUM_VALUES(., canister.get_contained_matter()) + . = MERGE_ASSOCS_WITH_NUM_VALUES(., canister.get_contained_matter(include_reagents)) /obj/machinery/sleeper/Initialize(mapload, d = 0, populate_parts = TRUE) . = ..() @@ -168,7 +170,7 @@ toggle_lavage() if(isliving(occupant) && stasis > 1) - occupant.set_stasis(stasis) + occupant.add_mob_modifier(/decl/mob_modifier/stasis, 2 SECONDS, source = src) /obj/machinery/sleeper/on_update_icon() cut_overlays() @@ -300,17 +302,17 @@ updateUsrDialog() go_out() -/obj/machinery/sleeper/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/chems/chem_disp_cartridge)) - add_reagent_canister(user, I) +/obj/machinery/sleeper/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/chems/chem_disp_cartridge)) + add_reagent_canister(user, used_item) return TRUE - if(istype(I, /obj/item/chems/glass)) + if(istype(used_item, /obj/item/chems/glass)) add_fingerprint(user) if(!beaker) - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - beaker = I - user.visible_message(SPAN_NOTICE("\The [user] adds \a [I] to \the [src]."), SPAN_NOTICE("You add \a [I] to \the [src].")) + beaker = used_item + user.visible_message(SPAN_NOTICE("\The [user] adds \a [used_item] to \the [src]."), SPAN_NOTICE("You add \a [used_item] to \the [src].")) else to_chat(user, SPAN_WARNING("\The [src] has a beaker already.")) return TRUE @@ -440,7 +442,7 @@ to_chat(user, SPAN_WARNING("There's no suitable occupant in \the [src].")) return if(!emagged && canister.reagents?.primary_reagent) - var/decl/material/chem = GET_DECL(canister.reagents.primary_reagent) + var/decl/material/chem = canister.reagents.primary_reagent if(chem.overdose && REAGENT_VOLUME(occupant.reagents, canister.reagents.primary_reagent) + amount >= chem.overdose) to_chat(user, SPAN_WARNING("Injecting more [chem.name] presents an overdose risk to the subject.")) return diff --git a/code/game/machinery/_machines_base/machine_construction/_construction.dm b/code/game/machinery/_machines_base/machine_construction/_construction.dm index fa819a58c1a6..8ae207901bbc 100644 --- a/code/game/machinery/_machines_base/machine_construction/_construction.dm +++ b/code/game/machinery/_machines_base/machine_construction/_construction.dm @@ -85,10 +85,10 @@ PRINT_STACK_TRACE("Machine [log_info_line(machine)] violated the state assumptions of the construction state [type]!") machine.attack_hand(user) -/decl/machine_construction/proc/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/proc/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if(!validate_state(machine)) PRINT_STACK_TRACE("Machine [log_info_line(machine)] violated the state assumptions of the construction state [type]!") - return machine.attackby(I, user) + return machine.attackby(used_item, user) return FALSE /decl/machine_construction/proc/mechanics_info() diff --git a/code/game/machinery/_machines_base/machine_construction/airlock.dm b/code/game/machinery/_machines_base/machine_construction/airlock.dm index 27f29d03070d..48de7420a1b7 100644 --- a/code/game/machinery/_machines_base/machine_construction/airlock.dm +++ b/code/game/machinery/_machines_base/machine_construction/airlock.dm @@ -3,22 +3,44 @@ down_state = /decl/machine_construction/default/panel_open/door var/hacking_state = /decl/machine_construction/default/panel_closed/door/hacking -/decl/machine_construction/default/panel_closed/door/attackby(obj/item/I, mob/user, obj/machinery/machine) - if(IS_SCREWDRIVER(I)) +/decl/machine_construction/default/panel_closed/door/fail_test_state_transfer(obj/machinery/machine, mob/user) + var/static/obj/item/screwdriver/screwdriver = new + // Prevent access locks on doors from interfering with our interactions. + for(var/obj/item/stock_parts/access_lock/lock in machine.get_all_components_of_type(/obj/item/stock_parts/access_lock)) + lock.locked = FALSE + // Test hacking state + if(!machine.attackby(screwdriver, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with screwdriver." + if(machine.construct_state.type != hacking_state) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [hacking_state])." + // Do it again to reverse that state change. + if(!machine.attackby(screwdriver, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with screwdriver on a second try." + if(machine.construct_state != src) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [type])." + // Now test the down state + var/static/obj/item/wrench/wrench = new + if(!machine.attackby(wrench, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with wrench." + if(machine.construct_state.type != down_state) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [down_state])." + +/decl/machine_construction/default/panel_closed/door/attackby(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_SCREWDRIVER(used_item)) TRANSFER_STATE(hacking_state) playsound(get_turf(machine), 'sound/items/Screwdriver.ogg', 50, 1) to_chat(user, SPAN_NOTICE("You release some of the logic wiring on \the [machine]. The cover panel remains closed.")) machine.update_icon() return TRUE - if(IS_WRENCH(I)) + if(IS_WRENCH(used_item)) TRANSFER_STATE(down_state) playsound(get_turf(machine), 'sound/items/Crowbar.ogg', 50, 1) machine.panel_open = TRUE to_chat(user, SPAN_NOTICE("You open the main cover panel on \the [machine], exposing the internals.")) machine.queue_icon_update() return TRUE - if(istype(I, /obj/item/part_replacer)) - var/obj/item/part_replacer/replacer = I + if(istype(used_item, /obj/item/part_replacer)) + var/obj/item/part_replacer/replacer = used_item if(replacer.remote_interaction) machine.part_replacement(user, replacer) for(var/line in machine.get_part_info_strings(user)) @@ -35,8 +57,8 @@ /decl/machine_construction/default/panel_closed/door/hacking up_state = /decl/machine_construction/default/panel_closed/door -/decl/machine_construction/default/panel_closed/door/hacking/attackby(obj/item/I, mob/user, obj/machinery/machine) - if(IS_SCREWDRIVER(I)) +/decl/machine_construction/default/panel_closed/door/hacking/attackby(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_SCREWDRIVER(used_item)) TRANSFER_STATE(up_state) playsound(get_turf(machine), 'sound/items/Screwdriver.ogg', 50, 1) to_chat(user, SPAN_NOTICE("You tuck the exposed wiring back into \the [machine] and screw the hatch back into place.")) diff --git a/code/game/machinery/_machines_base/machine_construction/computer.dm b/code/game/machinery/_machines_base/machine_construction/computer.dm index 684f0f4b8c18..797f16ad1ef2 100644 --- a/code/game/machinery/_machines_base/machine_construction/computer.dm +++ b/code/game/machinery/_machines_base/machine_construction/computer.dm @@ -4,7 +4,7 @@ down_state = /decl/machine_construction/default/panel_open/computer needs_board = "computer" -/decl/machine_construction/default/panel_closed/computer/no_deconstruct/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/default/panel_closed/computer/no_deconstruct/attackby(obj/item/used_item, mob/user, obj/machinery/machine) return FALSE /decl/machine_construction/default/panel_open/computer diff --git a/code/game/machinery/_machines_base/machine_construction/default.dm b/code/game/machinery/_machines_base/machine_construction/default.dm index 928954909b4e..d573df31e478 100644 --- a/code/game/machinery/_machines_base/machine_construction/default.dm +++ b/code/game/machinery/_machines_base/machine_construction/default.dm @@ -5,7 +5,7 @@ var/up_state var/down_state -/decl/machine_construction/default/no_deconstruct/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/default/no_deconstruct/attackby(obj/item/used_item, mob/user, obj/machinery/machine) . = FALSE /decl/machine_construction/default/panel_closed @@ -13,6 +13,22 @@ visible_components = FALSE locked = TRUE +/decl/machine_construction/default/panel_closed/fail_unit_test(obj/machinery/machine) + if((. = ..())) + return + var/static/mob/living/human/user = new + return fail_test_state_transfer(machine, user) + +/decl/machine_construction/default/panel_closed/proc/fail_test_state_transfer(obj/machinery/machine, mob/user) + var/static/obj/item/screwdriver/screwdriver = new + // Prevent access locks on machines interfering with our interactions. + for(var/obj/item/stock_parts/access_lock/lock in machine.get_all_components_of_type(/obj/item/stock_parts/access_lock)) + lock.locked = FALSE + if(!machine.attackby(screwdriver, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with screwdriver." + if(machine.construct_state.type != down_state) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [down_state])." + /decl/machine_construction/default/panel_closed/state_is_valid(obj/machinery/machine) return !machine.panel_open @@ -21,18 +37,18 @@ if(!.) try_change_state(machine, down_state) -/decl/machine_construction/default/panel_closed/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/default/panel_closed/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if((. = ..())) return - if(IS_SCREWDRIVER(I)) + if(IS_SCREWDRIVER(used_item)) TRANSFER_STATE(down_state) playsound(get_turf(machine), 'sound/items/Screwdriver.ogg', 50, 1) machine.panel_open = TRUE to_chat(user, SPAN_NOTICE("You open the maintenance hatch of \the [machine].")) machine.update_icon() return TRUE - if(istype(I, /obj/item/part_replacer)) - var/obj/item/part_replacer/replacer = I + if(istype(used_item, /obj/item/part_replacer)) + var/obj/item/part_replacer/replacer = used_item if(replacer.remote_interaction) machine.part_replacement(user, replacer) for(var/line in machine.get_part_info_strings(user)) @@ -62,28 +78,28 @@ if(!.) try_change_state(machine, up_state) -/decl/machine_construction/default/panel_open/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/default/panel_open/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if((. = ..())) return - if(IS_CROWBAR(I)) + if(IS_CROWBAR(used_item)) TRANSFER_STATE(down_state) playsound(get_turf(machine), 'sound/items/Crowbar.ogg', 50, 1) machine.visible_message(SPAN_NOTICE("\The [user] deconstructs \the [machine].")) machine.dismantle() return - if(IS_SCREWDRIVER(I)) + if(IS_SCREWDRIVER(used_item)) TRANSFER_STATE(up_state) playsound(get_turf(machine), 'sound/items/Screwdriver.ogg', 50, 1) machine.panel_open = FALSE to_chat(user, SPAN_NOTICE("You close the maintenance hatch of \the [machine].")) machine.update_icon() return TRUE - if(istype(I, /obj/item/part_replacer)) - return machine.part_replacement(user, I) - if(IS_WRENCH(I)) + if(istype(used_item, /obj/item/part_replacer)) + return machine.part_replacement(user, used_item) + if(IS_WRENCH(used_item)) return machine.part_removal(user) - if(istype(I)) - return machine.part_insertion(user, I) + if(istype(used_item)) + return machine.part_insertion(user, used_item) return FALSE /decl/machine_construction/default/panel_open/mechanics_info() diff --git a/code/game/machinery/_machines_base/machine_construction/frame.dm b/code/game/machinery/_machines_base/machine_construction/frame.dm index 1913c959fbed..5eeb7883bc92 100644 --- a/code/game/machinery/_machines_base/machine_construction/frame.dm +++ b/code/game/machinery/_machines_base/machine_construction/frame.dm @@ -11,21 +11,21 @@ else try_change_state(machine, /decl/machine_construction/frame/wrenched) -/decl/machine_construction/frame/unwrenched/attackby(obj/item/I, mob/user, obj/machinery/machine) - if(IS_WRENCH(I)) +/decl/machine_construction/frame/unwrenched/attackby(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_WRENCH(used_item)) playsound(machine.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, 20, machine)) TRANSFER_STATE(/decl/machine_construction/frame/wrenched) to_chat(user, "You wrench \the [machine] into place.") machine.anchored = TRUE - if(IS_WELDER(I)) - var/obj/item/weldingtool/WT = I - if(!WT.weld(0, user)) + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(!welder.weld(0, user)) to_chat(user, "The welding tool must be on to complete this task.") return TRUE playsound(machine.loc, 'sound/items/Welder.ogg', 50, 1) if(do_after(user, 20, machine)) - if(!WT.isOn()) + if(!welder.isOn()) return TRUE TRANSFER_STATE(/decl/machine_construction/default/deconstructed) to_chat(user, "You deconstruct \the [machine].") @@ -48,16 +48,16 @@ else try_change_state(machine, /decl/machine_construction/frame/unwrenched) -/decl/machine_construction/frame/wrenched/attackby(obj/item/I, mob/user, obj/machinery/machine) - if(IS_WRENCH(I)) +/decl/machine_construction/frame/wrenched/attackby(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_WRENCH(used_item)) playsound(machine.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, 20, machine)) TRANSFER_STATE(/decl/machine_construction/frame/unwrenched) to_chat(user, "You unfasten \the [machine].") machine.anchored = FALSE return TRUE - if(IS_COIL(I)) - var/obj/item/stack/cable_coil/C = I + if(IS_COIL(used_item)) + var/obj/item/stack/cable_coil/C = used_item if(C.get_amount() < 5) to_chat(user, "You need five lengths of cable to add them to \the [machine].") return TRUE @@ -85,20 +85,20 @@ else try_change_state(machine, /decl/machine_construction/frame/unwrenched) -/decl/machine_construction/frame/awaiting_circuit/attackby(obj/item/I, mob/user, obj/machinery/constructable_frame/machine) - if(istype(I, /obj/item/stock_parts/circuitboard)) - var/obj/item/stock_parts/circuitboard/circuit = I +/decl/machine_construction/frame/awaiting_circuit/attackby(obj/item/used_item, mob/user, obj/machinery/constructable_frame/machine) + if(istype(used_item, /obj/item/stock_parts/circuitboard)) + var/obj/item/stock_parts/circuitboard/circuit = used_item if(circuit.board_type == machine.expected_machine_type) - if(user.canUnEquip(I)) + if(user.can_unequip_item(used_item)) TRANSFER_STATE(/decl/machine_construction/frame/awaiting_parts) - user.try_unequip(I, machine) + user.try_unequip(used_item, machine) playsound(machine.loc, 'sound/items/Deconstruct.ogg', 50, 1) to_chat(user, "You add the circuit board to \the [machine].") - machine.circuit = I + machine.circuit = used_item else to_chat(user, "This frame does not accept circuit boards of this type!") return TRUE - if(IS_WIRECUTTER(I)) + if(IS_WIRECUTTER(used_item)) TRANSFER_STATE(/decl/machine_construction/frame/wrenched) playsound(machine.loc, 'sound/items/Wirecutter.ogg', 50, 1) to_chat(user, "You remove the cables.") @@ -122,15 +122,15 @@ else try_change_state(machine, /decl/machine_construction/frame/unwrenched) -/decl/machine_construction/frame/awaiting_parts/attackby(obj/item/I, mob/user, obj/machinery/constructable_frame/machine) - if(IS_CROWBAR(I)) +/decl/machine_construction/frame/awaiting_parts/attackby(obj/item/used_item, mob/user, obj/machinery/constructable_frame/machine) + if(IS_CROWBAR(used_item)) TRANSFER_STATE(/decl/machine_construction/frame/awaiting_circuit) playsound(machine.loc, 'sound/items/Crowbar.ogg', 50, 1) machine.circuit.dropInto(machine.loc) machine.circuit = null to_chat(user, "You remove the circuit board.") return TRUE - if(IS_SCREWDRIVER(I)) + if(IS_SCREWDRIVER(used_item)) playsound(machine.loc, 'sound/items/Screwdriver.ogg', 50, 1) var/obj/machinery/new_machine = new machine.circuit.build_path(machine.loc, machine.dir, FALSE) machine.circuit.construct(new_machine) diff --git a/code/game/machinery/_machines_base/machine_construction/item_chassis.dm b/code/game/machinery/_machines_base/machine_construction/item_chassis.dm index 234319a1bca2..e97190d5d71a 100644 --- a/code/game/machinery/_machines_base/machine_construction/item_chassis.dm +++ b/code/game/machinery/_machines_base/machine_construction/item_chassis.dm @@ -5,8 +5,8 @@ down_state = /decl/machine_construction/default/panel_open/item_chassis -/decl/machine_construction/default/panel_closed/item_chassis/attackby(obj/item/I, mob/user, obj/machinery/machine) - if(IS_WRENCH(I)) +/decl/machine_construction/default/panel_closed/item_chassis/attackby(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_WRENCH(used_item)) TRANSFER_STATE(/decl/machine_construction/default/deconstructed) playsound(get_turf(machine), 'sound/items/Ratchet.ogg', 50, 1) machine.visible_message(SPAN_NOTICE("\The [user] deconstructs \the [machine].")) diff --git a/code/game/machinery/_machines_base/machine_construction/pipe.dm b/code/game/machinery/_machines_base/machine_construction/pipe.dm index 4667327dd0e0..010428a50e47 100644 --- a/code/game/machinery/_machines_base/machine_construction/pipe.dm +++ b/code/game/machinery/_machines_base/machine_construction/pipe.dm @@ -6,29 +6,29 @@ /decl/machine_construction/pipe/state_is_valid(obj/machinery/machine) return TRUE -/decl/machine_construction/pipe/proc/deconstruct_transition(obj/item/I, mob/user, obj/machinery/machine) - if(IS_WRENCH(I)) +/decl/machine_construction/pipe/proc/deconstruct_transition(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_WRENCH(used_item)) TRANSFER_STATE(/decl/machine_construction/default/deconstructed) playsound(get_turf(machine), 'sound/items/Ratchet.ogg', 50, 1) machine.visible_message(SPAN_NOTICE("\The [user] unfastens \the [machine].")) machine.dismantle() -/decl/machine_construction/pipe/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/pipe/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if((. = ..())) return - return deconstruct_transition(I, user, machine) + return deconstruct_transition(used_item, user, machine) /decl/machine_construction/pipe/mechanics_info() . = list() . += "Use a wrench to deconstruct the machine" // Same, but uses different tool. -/decl/machine_construction/pipe/welder/deconstruct_transition(obj/item/I, mob/user, obj/machinery/machine) - if(IS_WELDER(I)) - var/obj/item/weldingtool/WT = I - if(!WT.isOn()) +/decl/machine_construction/pipe/welder/deconstruct_transition(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(!welder.isOn()) return FALSE - if(!WT.weld(0,user)) + if(!welder.weld(0,user)) return FALSE var/fail = machine.cannot_transition_to(/decl/machine_construction/default/deconstructed, user) if(istext(fail)) @@ -40,7 +40,7 @@ playsound(get_turf(machine), 'sound/items/Welder.ogg', 50, 1) if(!do_after(user, 5 SECONDS, machine)) return TRUE - if(!WT.isOn()) + if(!welder.isOn()) return TRUE playsound(get_turf(machine), 'sound/items/Welder2.ogg', 50, 1) TRANSFER_STATE(/decl/machine_construction/default/deconstructed) diff --git a/code/game/machinery/_machines_base/machine_construction/wall_frame.dm b/code/game/machinery/_machines_base/machine_construction/wall_frame.dm index 9c01dcc5db7c..a81bd4d52312 100644 --- a/code/game/machinery/_machines_base/machine_construction/wall_frame.dm +++ b/code/game/machinery/_machines_base/machine_construction/wall_frame.dm @@ -25,20 +25,20 @@ else try_change_state(machine, newly_built_state) -/decl/machine_construction/wall_frame/panel_closed/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/wall_frame/panel_closed/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if((. = ..())) return - if(istype(I, /obj/item/part_replacer)) - var/obj/item/part_replacer/replacer = I + if(istype(used_item, /obj/item/part_replacer)) + var/obj/item/part_replacer/replacer = used_item if(replacer.remote_interaction) machine.part_replacement(user, replacer) for(var/line in machine.get_part_info_strings(user)) to_chat(user, line) return TRUE - return down_interaction(I, user, machine) + return down_interaction(used_item, user, machine) -/decl/machine_construction/wall_frame/panel_closed/proc/down_interaction(obj/item/I, mob/user, obj/machinery/machine) - if(IS_SCREWDRIVER(I)) +/decl/machine_construction/wall_frame/panel_closed/proc/down_interaction(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_SCREWDRIVER(used_item)) TRANSFER_STATE(open_state) playsound(get_turf(machine), 'sound/items/Screwdriver.ogg', 50, 1) machine.panel_open = TRUE @@ -55,6 +55,23 @@ machine.panel_open = TRUE machine.queue_icon_update() +/decl/machine_construction/wall_frame/panel_closed/fail_unit_test(obj/machinery/machine) + if((. = ..())) + return + var/static/mob/living/human/user = new + return fail_test_state_transfer(machine, user) + +/decl/machine_construction/wall_frame/panel_closed/proc/fail_test_state_transfer(obj/machinery/machine, mob/user) + var/static/obj/item/screwdriver/screwdriver = new + // Prevent access locks on machines interfering with our interactions. + for(var/obj/item/stock_parts/access_lock/lock in machine.get_all_components_of_type(/obj/item/stock_parts/access_lock)) + lock.locked = FALSE + if(!machine.attackby(screwdriver, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with screwdriver." + if(machine.construct_state.type != open_state) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [open_state])." + + // Open panel /decl/machine_construction/wall_frame/panel_open/state_is_valid(obj/machinery/machine) @@ -68,11 +85,11 @@ else try_change_state(machine, active_state) -/decl/machine_construction/wall_frame/panel_open/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/wall_frame/panel_open/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if((. = ..())) return - if(IS_WIRECUTTER(I)) + if(IS_WIRECUTTER(used_item)) TRANSFER_STATE(diconnected_state) playsound(get_turf(machine), 'sound/items/Wirecutter.ogg', 50, 1) user.visible_message(SPAN_WARNING("\The [user] has cut the wires inside \the [machine]!"), "You have cut the wires inside \the [machine].") @@ -81,20 +98,20 @@ machine.queue_icon_update() return TRUE - if((. = up_interaction(I, user, machine))) + if((. = up_interaction(used_item, user, machine))) return - if(istype(I, /obj/item/part_replacer)) - return machine.part_replacement(user, I) + if(istype(used_item, /obj/item/part_replacer)) + return machine.part_replacement(user, used_item) - if(IS_WRENCH(I)) + if(IS_WRENCH(used_item)) return machine.part_removal(user) - if(istype(I)) - return machine.part_insertion(user, I) + if(istype(used_item)) + return machine.part_insertion(user, used_item) -/decl/machine_construction/wall_frame/panel_open/proc/up_interaction(obj/item/I, mob/user, obj/machinery/machine) - if(IS_SCREWDRIVER(I)) +/decl/machine_construction/wall_frame/panel_open/proc/up_interaction(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_SCREWDRIVER(used_item)) TRANSFER_STATE(active_state) playsound(get_turf(machine), 'sound/items/Screwdriver.ogg', 50, 1) machine.panel_open = FALSE @@ -124,12 +141,12 @@ else try_change_state(machine, active_state) -/decl/machine_construction/wall_frame/no_wires/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/wall_frame/no_wires/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if((. = ..())) return - if(IS_COIL(I)) - var/obj/item/stack/cable_coil/A = I + if(IS_COIL(used_item)) + var/obj/item/stack/cable_coil/A = used_item if (A.can_use(5)) TRANSFER_STATE(open_state) A.use(5) @@ -140,20 +157,20 @@ to_chat(user, SPAN_WARNING("You need five pieces of cable to wire \the [machine].")) return TRUE - if((. = down_interaction(I, user, machine))) + if((. = down_interaction(used_item, user, machine))) return - if(istype(I, /obj/item/part_replacer)) - return machine.part_replacement(user, I) + if(istype(used_item, /obj/item/part_replacer)) + return machine.part_replacement(user, used_item) - if(IS_WRENCH(I)) + if(IS_WRENCH(used_item)) return machine.part_removal(user) - if(istype(I)) - return machine.part_insertion(user, I) + if(istype(used_item)) + return machine.part_insertion(user, used_item) -/decl/machine_construction/wall_frame/no_wires/proc/down_interaction(obj/item/I, mob/user, obj/machinery/machine) - if(IS_CROWBAR(I)) +/decl/machine_construction/wall_frame/no_wires/proc/down_interaction(obj/item/used_item, mob/user, obj/machinery/machine) + if(IS_CROWBAR(used_item)) TRANSFER_STATE(bottom_state) playsound(get_turf(machine), 'sound/items/Crowbar.ogg', 50, 1) to_chat(user, "You pry out the circuit!") @@ -183,16 +200,16 @@ else try_change_state(machine, active_state) -/decl/machine_construction/wall_frame/no_circuit/attackby(obj/item/I, mob/user, obj/machinery/machine) +/decl/machine_construction/wall_frame/no_circuit/attackby(obj/item/used_item, mob/user, obj/machinery/machine) if((. = ..())) return - if(istype(I, /obj/item/stock_parts/circuitboard)) - var/obj/item/stock_parts/circuitboard/board = I + if(istype(used_item, /obj/item/stock_parts/circuitboard)) + var/obj/item/stock_parts/circuitboard/board = used_item if(board.build_path != (machine.base_type || machine.type)) to_chat(user, SPAN_WARNING("This circuitboard does not fit inside \the [machine]!")) return TRUE - if(!user.canUnEquip(board)) + if(!user.can_unequip_item(board)) return TRUE machine.set_broken(TRUE, MACHINE_BROKEN_CONSTRUCT) TRANSFER_STATE(diconnected_state) @@ -202,7 +219,7 @@ machine.queue_icon_update() return TRUE - if(IS_WRENCH(I)) + if(IS_WRENCH(used_item)) TRANSFER_STATE(/decl/machine_construction/default/deconstructed) playsound(get_turf(machine), 'sound/items/Ratchet.ogg', 50, 1) machine.visible_message(SPAN_NOTICE("\The [user] deconstructs \the [machine].")) diff --git a/code/game/machinery/_machines_base/machine_construction/wall_frame_hackable.dm b/code/game/machinery/_machines_base/machine_construction/wall_frame_hackable.dm index 2afb4460f3fa..7c1d98873bda 100644 --- a/code/game/machinery/_machines_base/machine_construction/wall_frame_hackable.dm +++ b/code/game/machinery/_machines_base/machine_construction/wall_frame_hackable.dm @@ -64,6 +64,29 @@ . += "Use a screwdriver close the hatch and tuck the exposed wires back in." . += "Use a parts replacer to view installed parts." +/decl/machine_construction/wall_frame/panel_closed/hackable/fail_test_state_transfer(obj/machinery/machine, mob/user) + var/static/obj/item/screwdriver/screwdriver = new + // Prevent access locks on doors from interfering with our interactions. + for(var/obj/item/stock_parts/access_lock/lock in machine.get_all_components_of_type(/obj/item/stock_parts/access_lock)) + lock.locked = FALSE + // Test hacking state + if(!machine.attackby(screwdriver, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with screwdriver." + var/const/hacking_state = /decl/machine_construction/wall_frame/panel_closed/hackable/hacking // TODO: un-hardcode this + if(machine.construct_state.type != hacking_state) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [hacking_state])." + // Do it again to reverse that state change. + if(!machine.attackby(screwdriver, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with screwdriver on a second try." + if(machine.construct_state != src) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [type])." + // Now test the open state + var/static/obj/item/crowbar/crowbar = new + if(!machine.attackby(crowbar, user)) + return "Machine [log_info_line(machine)] did not respond to attackby with crowbar." + if(machine.construct_state.type != open_state) + return "Machine [log_info_line(machine)] had a construct_state of type [machine.construct_state.type] after screwdriver interaction (expected [open_state])." + /decl/machine_construction/wall_frame/panel_open/hackable/up_interaction(obj/item/I, mob/user, obj/machinery/machine) if(IS_CROWBAR(I)) TRANSFER_STATE(active_state) diff --git a/code/game/machinery/_machines_base/machinery.dm b/code/game/machinery/_machines_base/machinery.dm index c57624ee3c9e..5f03a9d4ba72 100644 --- a/code/game/machinery/_machines_base/machinery.dm +++ b/code/game/machinery/_machines_base/machinery.dm @@ -506,12 +506,12 @@ Class Procs: LAZYREMOVE(., component_parts) // This only includes external atoms by default, so we need to add components back. -/obj/machinery/get_contained_matter() +/obj/machinery/get_contained_matter(include_reagents = TRUE) . = ..() var/list/component_types = types_of_component(/obj/item/stock_parts) for(var/path in component_types) for(var/obj/item/stock_parts/part in get_all_components_of_type(path)) - var/list/part_costs = part.get_contained_matter() + var/list/part_costs = part.get_contained_matter(include_reagents) for(var/key in part_costs) .[key] += part_costs[key] * component_types[path] diff --git a/code/game/machinery/_machines_base/machinery_components.dm b/code/game/machinery/_machines_base/machinery_components.dm index 032e31d058a3..d4fecb27c52d 100644 --- a/code/game/machinery/_machines_base/machinery_components.dm +++ b/code/game/machinery/_machines_base/machinery_components.dm @@ -187,15 +187,15 @@ var/global/list/machine_path_to_circuit_type events_repository.unregister(/decl/observ/destroyed, part, src) return part -/obj/machinery/proc/replace_part(mob/user, var/obj/item/part_replacer/R, var/obj/item/stock_parts/old_part, var/obj/item/stock_parts/new_part) +/obj/machinery/proc/replace_part(mob/user, var/obj/item/part_replacer/replacer, var/obj/item/stock_parts/old_part, var/obj/item/stock_parts/new_part) if(ispath(old_part)) old_part = get_component_of_type(old_part, TRUE) old_part = uninstall_component(old_part) - if(R) - if(R.storage) - R.storage.remove_from_storage(null, new_part, src) - R.storage.handle_item_insertion(null, old_part, TRUE) - R.part_replacement_sound() + if(replacer) + if(replacer.storage) + replacer.storage.remove_from_storage(null, new_part, src) + replacer.storage.handle_item_insertion(null, old_part, TRUE) + replacer.part_replacement_sound() install_component(new_part) to_chat(user, "[old_part.name] replaced with [new_part.name].") @@ -254,18 +254,18 @@ var/global/list/machine_path_to_circuit_type // Hook to get updates. /obj/machinery/proc/component_stat_change(var/obj/item/stock_parts/part, old_stat, flag) -/obj/machinery/attackby(obj/item/I, mob/user) - if((. = component_attackby(I, user))) +/obj/machinery/attackby(obj/item/used_item, mob/user) + if((. = component_attackby(used_item, user))) return return ..() -/obj/machinery/proc/component_attackby(obj/item/I, mob/user) +/obj/machinery/proc/component_attackby(obj/item/used_item, mob/user) for(var/obj/item/stock_parts/part in component_parts) if(!components_are_accessible(part.type)) continue - if((. = part.attackby(I, user))) + if((. = part.attackby(used_item, user))) return - return construct_state?.attackby(I, user, src) + return construct_state?.attackby(used_item, user, src) /obj/machinery/proc/component_attack_hand(mob/user) for(var/obj/item/stock_parts/part in component_parts) @@ -279,15 +279,15 @@ var/global/list/machine_path_to_circuit_type Standard helpers for users interacting with machinery parts. */ -/obj/machinery/proc/part_replacement(mob/user, obj/item/part_replacer/R) +/obj/machinery/proc/part_replacement(mob/user, obj/item/part_replacer/replacer) for(var/obj/item/stock_parts/A in component_parts) if(!A.base_type) continue if(!(A.part_flags & PART_FLAG_HAND_REMOVE)) continue - for(var/obj/item/stock_parts/B in R.contents) + for(var/obj/item/stock_parts/B in replacer.contents) if(istype(B, A.base_type) && B.rating > A.rating) - replace_part(user, R, A, B) + replace_part(user, replacer, A, B) return TRUE for(var/path in uncreated_component_parts) var/obj/item/stock_parts/A = path @@ -295,13 +295,13 @@ Standard helpers for users interacting with machinery parts. continue var/base_type = initial(A.base_type) if(base_type) - for(var/obj/item/stock_parts/B in R.contents) + for(var/obj/item/stock_parts/B in replacer.contents) if(istype(B, base_type) && B.rating > initial(A.rating)) - replace_part(user, R, A, B) + replace_part(user, replacer, A, B) return TRUE /obj/machinery/proc/part_insertion(mob/user, obj/item/stock_parts/part) // Second argument may actually be an arbitrary item. - if(!user.canUnEquip(part) && !isstack(part)) + if(!user.can_unequip_item(part) && !isstack(part)) return FALSE var/number = can_add_component(part, user) if(!number) diff --git a/code/game/machinery/_machines_base/machinery_damage.dm b/code/game/machinery/_machines_base/machinery_damage.dm index bba75011ff7a..29a821716b0c 100644 --- a/code/game/machinery/_machines_base/machinery_damage.dm +++ b/code/game/machinery/_machines_base/machinery_damage.dm @@ -82,13 +82,13 @@ . = ..() take_damage(P.damage, P.atom_damage_type) -/obj/machinery/bash(obj/item/W, mob/user) - if(!istype(W)) +/obj/machinery/bash(obj/item/used_item, mob/user) + if(!istype(used_item)) return FALSE - var/force = W.expend_attack_force(user) + var/force = used_item.expend_attack_force(user) if(force <= 5) return FALSE . = ..() if(.) - user.setClickCooldown(W.attack_cooldown + W.w_class) - take_damage(force, W.atom_damage_type) \ No newline at end of file + user.setClickCooldown(used_item.attack_cooldown + used_item.w_class) + take_damage(force, used_item.atom_damage_type) \ No newline at end of file diff --git a/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm b/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm index c8fdd39f53bd..f3c2bd507167 100644 --- a/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm +++ b/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm @@ -15,7 +15,7 @@ return FALSE // Can potentially add uninstall code here, but not currently supported. return ..() -/obj/item/stock_parts/proc/set_status(var/obj/machinery/machine, var/flag) +/obj/item/stock_parts/proc/set_component_status(var/obj/machinery/machine, var/flag) var/old_stat = status status |= flag if(old_stat != status) @@ -34,7 +34,7 @@ machine.component_stat_change(src, old_stat, flag) /obj/item/stock_parts/proc/on_install(var/obj/machinery/machine) - set_status(machine, PART_STAT_INSTALLED) + set_component_status(machine, PART_STAT_INSTALLED) /obj/item/stock_parts/proc/on_uninstall(var/obj/machinery/machine, var/temporary = FALSE) unset_status(machine, PART_STAT_INSTALLED) @@ -48,7 +48,7 @@ if(istype(machine)) LAZYDISTINCTADD(machine.processing_parts, src) START_PROCESSING_MACHINE(machine, MACHINERY_PROCESS_COMPONENTS) - set_status(machine, PART_STAT_PROCESSING) + set_component_status(machine, PART_STAT_PROCESSING) /obj/item/stock_parts/proc/stop_processing(var/obj/machinery/machine) if(istype(machine)) @@ -86,7 +86,12 @@ if(ELECTROCUTE) cause = "sparks" visible_message(SPAN_WARNING("Something [cause] inside \the [machine]."), range = 2) - SetName("broken [name]") + update_name() + +/obj/item/stock_parts/update_name() + . = ..() + if(!is_functional()) + SetName("broken [name]") // prepend 'broken' to the results /obj/item/stock_parts/proc/is_functional() return (!can_take_damage()) || (current_health > 0) diff --git a/code/game/machinery/_machines_base/stock_parts/access_lock.dm b/code/game/machinery/_machines_base/stock_parts/access_lock.dm index 2f4935ed6731..8d6b4aec8cea 100644 --- a/code/game/machinery/_machines_base/stock_parts/access_lock.dm +++ b/code/game/machinery/_machines_base/stock_parts/access_lock.dm @@ -54,10 +54,10 @@ if(emagged && user.skill_check_multiple(list(SKILL_FORENSICS = SKILL_EXPERT, SKILL_COMPUTER = SKILL_EXPERT))) . += SPAN_WARNING("On close inspection, there is something odd about the interface. You suspect it may have been tampered with.") -/obj/item/stock_parts/access_lock/attackby(obj/item/W, mob/user) +/obj/item/stock_parts/access_lock/attackby(obj/item/used_item, mob/user) var/obj/machinery/machine = loc if(!emagged && istype(machine)) - var/obj/item/card/id/I = W.GetIdCard() + var/obj/item/card/id/I = used_item.GetIdCard() if(I && check_access(I)) locked = !locked visible_message(SPAN_NOTICE("\The [src] beeps and flashes green twice: it is now [locked ? "" : "un"]locked.")) diff --git a/code/game/machinery/_machines_base/stock_parts/building_material.dm b/code/game/machinery/_machines_base/stock_parts/building_material.dm index 615a39b9a852..2ad4e83360f9 100644 --- a/code/game/machinery/_machines_base/stock_parts/building_material.dm +++ b/code/game/machinery/_machines_base/stock_parts/building_material.dm @@ -67,9 +67,9 @@ materials = null ..() -/obj/item/stock_parts/building_material/get_contained_matter() +/obj/item/stock_parts/building_material/get_contained_matter(include_reagents = TRUE) . = ..() for(var/obj/item/thing in materials) - var/list/costs = thing.get_contained_matter() + var/list/costs = thing.get_contained_matter(include_reagents) for(var/key in costs) .[key] += costs[key] diff --git a/code/game/machinery/_machines_base/stock_parts/card_reader.dm b/code/game/machinery/_machines_base/stock_parts/card_reader.dm index 3f92564a8d7e..05472503c246 100644 --- a/code/game/machinery/_machines_base/stock_parts/card_reader.dm +++ b/code/game/machinery/_machines_base/stock_parts/card_reader.dm @@ -46,8 +46,8 @@ return swipe_card(O, user) . = ..() -/obj/item/stock_parts/item_holder/card_reader/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W) && !istype(loc, /obj/machinery)) //Only if not in the machine, to prevent hijacking tool interactions with the machine +/obj/item/stock_parts/item_holder/card_reader/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item) && !istype(loc, /obj/machinery)) //Only if not in the machine, to prevent hijacking tool interactions with the machine should_swipe = !should_swipe to_chat(user, SPAN_NOTICE("You toggle \the [src] into [should_swipe? "swipe" : "insert"] card mode.")) return TRUE diff --git a/code/game/machinery/_machines_base/stock_parts/item_holder.dm b/code/game/machinery/_machines_base/stock_parts/item_holder.dm index 707acd2dbd00..cb875fa65dec 100644 --- a/code/game/machinery/_machines_base/stock_parts/item_holder.dm +++ b/code/game/machinery/_machines_base/stock_parts/item_holder.dm @@ -17,9 +17,9 @@ unregister_on_eject() . = ..() -/obj/item/stock_parts/item_holder/attackby(obj/item/W, mob/user) - if(is_accepted_type(W)) - insert_item(W, user) +/obj/item/stock_parts/item_holder/attackby(obj/item/used_item, mob/user) + if(is_accepted_type(used_item)) + insert_item(used_item, user) return TRUE . = ..() diff --git a/code/game/machinery/_machines_base/stock_parts/network_lock.dm b/code/game/machinery/_machines_base/stock_parts/network_lock.dm index d5d6e187fdee..d5cd653186e4 100644 --- a/code/game/machinery/_machines_base/stock_parts/network_lock.dm +++ b/code/game/machinery/_machines_base/stock_parts/network_lock.dm @@ -75,10 +75,10 @@ if(emagged && user.skill_check_multiple(list(SKILL_FORENSICS = SKILL_EXPERT, SKILL_COMPUTER = SKILL_EXPERT))) . += SPAN_WARNING("On closer inspection, there is something odd about the interface. You suspect it may have been tampered with.") -/obj/item/stock_parts/network_receiver/network_lock/attackby(obj/item/W, mob/user) +/obj/item/stock_parts/network_receiver/network_lock/attackby(obj/item/used_item, mob/user) . = ..() - if(istype(W, /obj/item/card/id)) - if(check_access(W)) + if(istype(used_item, /obj/item/card/id)) + if(check_access(used_item)) playsound(src, 'sound/machines/ping.ogg', 20, 0) else playsound(src, 'sound/machines/buzz-two.ogg', 20, 0) diff --git a/code/game/machinery/_machines_base/stock_parts/power/battery.dm b/code/game/machinery/_machines_base/stock_parts/power/battery.dm index c78b358aea6b..ecb17db640aa 100644 --- a/code/game/machinery/_machines_base/stock_parts/power/battery.dm +++ b/code/game/machinery/_machines_base/stock_parts/power/battery.dm @@ -49,7 +49,7 @@ if(istype(machine)) machine.power_change() machine.queue_icon_update() - set_status(machine, PART_STAT_CONNECTED) + set_component_status(machine, PART_STAT_CONNECTED) update_icon() return cell @@ -112,7 +112,7 @@ /obj/item/stock_parts/power/battery/can_provide_power(var/obj/machinery/machine) if(is_functional() && cell && cell.check_charge(CELLRATE * machine.get_power_usage())) machine.update_power_channel(LOCAL) - set_status(machine, PART_STAT_ACTIVE) + set_component_status(machine, PART_STAT_ACTIVE) return TRUE return FALSE @@ -147,24 +147,24 @@ icon_state = "battery[!!cell]" // Cell interaction -/obj/item/stock_parts/power/battery/attackby(obj/item/I, mob/user) +/obj/item/stock_parts/power/battery/attackby(obj/item/used_item, mob/user) var/obj/machinery/machine = loc // Interactions with/without machine - if(istype(I, /obj/item/cell)) + if(istype(used_item, /obj/item/cell)) if(cell) to_chat(user, "There is a power cell already installed.") return TRUE if(istype(machine) && (machine.stat & MAINT)) to_chat(user, "There is no connector for your power cell.") return TRUE - if(I.w_class != ITEM_SIZE_NORMAL) - to_chat(user, "\The [I] is too [I.w_class < ITEM_SIZE_NORMAL? "small" : "large"] to fit here.") + if(used_item.w_class != ITEM_SIZE_NORMAL) + to_chat(user, "\The [used_item] is too [used_item.w_class < ITEM_SIZE_NORMAL? "small" : "large"] to fit here.") return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - add_cell(machine, I) + add_cell(machine, used_item) user.visible_message(\ SPAN_WARNING("\The [user] has inserted the power cell to \the [src]!"),\ SPAN_NOTICE("You insert the power cell.")) diff --git a/code/game/machinery/_machines_base/stock_parts/power/terminal.dm b/code/game/machinery/_machines_base/stock_parts/power/terminal.dm index 79cdd75518dd..2d0347720f4a 100644 --- a/code/game/machinery/_machines_base/stock_parts/power/terminal.dm +++ b/code/game/machinery/_machines_base/stock_parts/power/terminal.dm @@ -48,7 +48,7 @@ //Is willing to provide power if the wired contribution is nonnegligible and there is enough total local power to run the machine. /obj/item/stock_parts/power/terminal/can_provide_power(var/obj/machinery/machine) if(is_functional() && terminal && terminal.surplus() && machine.can_use_power_oneoff(machine.get_power_usage(), LOCAL) <= 0) - set_status(machine, PART_STAT_ACTIVE) + set_component_status(machine, PART_STAT_ACTIVE) machine.update_power_channel(LOCAL) return TRUE return FALSE @@ -76,7 +76,7 @@ terminal.queue_icon_update() set_extension(src, /datum/extension/event_registration/shuttle_stationary, GET_DECL(/decl/observ/moved), machine, PROC_REF(machine_moved), get_area(src)) - set_status(machine, PART_STAT_CONNECTED) + set_component_status(machine, PART_STAT_CONNECTED) start_processing(machine) /obj/item/stock_parts/power/terminal/proc/machine_moved(var/obj/machinery/machine, var/turf/old_loc, var/turf/new_loc) @@ -115,13 +115,13 @@ to_chat(user, "There is already a terminal here.") return TRUE -/obj/item/stock_parts/power/terminal/attackby(obj/item/I, mob/user) +/obj/item/stock_parts/power/terminal/attackby(obj/item/used_item, mob/user) var/obj/machinery/machine = loc if(!istype(machine)) return ..() // Interactions inside machine only - if (istype(I, /obj/item/stack/cable_coil) && !terminal) + if (istype(used_item, /obj/item/stack/cable_coil) && !terminal) var/turf/T = get_step(machine, terminal_dir) if(terminal_dir && user.loc != T) return FALSE // Wrong terminal handler. @@ -131,7 +131,7 @@ if(istype(T) && !T.is_plating()) to_chat(user, "You must remove the floor plating in front of \the [machine] first.") return TRUE - var/obj/item/stack/cable_coil/C = I + var/obj/item/stack/cable_coil/C = used_item if(!C.can_use(10)) to_chat(user, "You need ten lengths of cable for \the [machine].") return TRUE diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm index e571411e9730..e8aab501f355 100644 --- a/code/game/machinery/ai_slipper.dm +++ b/code/game/machinery/ai_slipper.dm @@ -23,7 +23,7 @@ src.uses = uses src.power_change() -/obj/machinery/ai_slipper/attackby(obj/item/W, mob/user) +/obj/machinery/ai_slipper/attackby(obj/item/used_item, mob/user) if(stat & (NOPOWER|BROKEN)) return FALSE if (issilicon(user)) diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 4096611b87e7..ea3a147ad7ea 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -884,18 +884,18 @@ FIRE ALARM set_light(2, 0.25, COLOR_RED) else if(isContactLevel(z)) var/decl/security_state/security_state = GET_DECL(global.using_map.security_state) - var/decl/security_level/sl = security_state.current_security_level + var/decl/security_level/sec_level = security_state.current_security_level - set_light(sl.light_power, sl.light_range, sl.light_color_alarm) + set_light(sec_level.light_power, sec_level.light_range, sec_level.light_color_alarm) - if(sl.alarm_appearance.alarm_icon) - var/image/alert1 = image(sl.icon, sl.alarm_appearance.alarm_icon) - alert1.color = sl.alarm_appearance.alarm_icon_color + if(sec_level.alarm_appearance.alarm_icon) + var/image/alert1 = image(sec_level.icon, sec_level.alarm_appearance.alarm_icon) + alert1.color = sec_level.alarm_appearance.alarm_icon_color add_overlay(alert1) - if(sl.alarm_appearance.alarm_icon_twotone) - var/image/alert2 = image(sl.icon, sl.alarm_appearance.alarm_icon_twotone) - alert2.color = sl.alarm_appearance.alarm_icon_twotone_color + if(sec_level.alarm_appearance.alarm_icon_twotone) + var/image/alert2 = image(sec_level.icon, sec_level.alarm_appearance.alarm_icon_twotone) + alert2.color = sec_level.alarm_appearance.alarm_icon_twotone_color add_overlay(alert2) else add_overlay("fire0") @@ -913,7 +913,7 @@ FIRE ALARM alarm(rand(30/severity, 60/severity)) ..() -/obj/machinery/firealarm/attackby(obj/item/W, mob/user) +/obj/machinery/firealarm/attackby(obj/item/used_item, mob/user) if((. = ..())) return src.alarm() diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 52613f16121d..af152d8b5028 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -1,32 +1,36 @@ /obj/machinery/portable_atmospherics/canister - name = "canister" - icon = 'icons/obj/atmos.dmi' - icon_state = "yellow" - density = TRUE - max_health = 100 - obj_flags = OBJ_FLAG_CONDUCTIBLE - w_class = ITEM_SIZE_GARGANTUAN - construct_state = /decl/machine_construction/pipe/welder - uncreated_component_parts = null - start_pressure = 45 ATM - volume = 1000 - interact_offline = TRUE - matter = list( + name = "canister" + icon = 'icons/obj/atmos.dmi' + icon_state = "yellow" + density = TRUE + max_health = 100 + obj_flags = OBJ_FLAG_CONDUCTIBLE + w_class = ITEM_SIZE_GARGANTUAN + construct_state = /decl/machine_construction/pipe/welder + stat_immune = NOSCREEN | NOINPUT | NOPOWER + start_pressure = 45 ATM + volume = 1000 + interact_offline = TRUE + matter = list( /decl/material/solid/metal/steel = 10 * SHEET_MATERIAL_AMOUNT ) - + uncreated_component_parts = null var/valve_open = FALSE var/release_pressure = ONE_ATMOSPHERE var/release_flow_rate = ATMOS_DEFAULT_VOLUME_PUMP //in L/s var/canister_color = "yellow" var/can_label = TRUE var/temperature_resistance = 1000 + T0C + var/decl/material/start_gas = null /obj/machinery/portable_atmospherics/canister/Initialize(mapload, material) if(ispath(material)) matter = list() matter[material] = 10 * SHEET_MATERIAL_AMOUNT . = ..(mapload) + if(start_gas) + air_contents.adjust_gas(start_gas, MolesForPressure()) + lazy_update_icon() /obj/machinery/portable_atmospherics/canister/drain_power() return -1 @@ -36,45 +40,69 @@ icon_state = "redws" canister_color = "redws" can_label = FALSE + start_gas = /decl/material/gas/nitrous_oxide /obj/machinery/portable_atmospherics/canister/nitrogen name = "nitrogen canister" icon_state = "red" canister_color = "red" can_label = FALSE + start_gas = /decl/material/gas/nitrogen /obj/machinery/portable_atmospherics/canister/nitrogen/prechilled name = "cryogenic nitrogen canister" start_pressure = 20 ATM +/obj/machinery/portable_atmospherics/canister/nitrogen/prechilled/Initialize() + . = ..() + air_contents.temperature = 80 + lazy_update_icon() + /obj/machinery/portable_atmospherics/canister/oxygen name = "oxygen canister" icon_state = "blue" canister_color = "blue" can_label = FALSE + start_gas = /decl/material/gas/oxygen /obj/machinery/portable_atmospherics/canister/oxygen/prechilled name = "cryogenic oxygen canister" start_pressure = 20 ATM +/obj/machinery/portable_atmospherics/canister/oxygen/prechilled/Initialize() + . = ..() + air_contents.temperature = 80 + lazy_update_icon() + /obj/machinery/portable_atmospherics/canister/hydrogen name = "hydrogen canister" icon_state = "purple" canister_color = "purple" can_label = FALSE + start_gas = /decl/material/gas/hydrogen /obj/machinery/portable_atmospherics/canister/carbon_dioxide name = "\improper CO2 canister" icon_state = "black" canister_color = "black" can_label = FALSE + start_gas = /decl/material/gas/carbon_dioxide +// This uses an Initialize override instead of start_gas. /obj/machinery/portable_atmospherics/canister/air name = "air canister" icon_state = "grey" canister_color = "grey" can_label = FALSE +// This doesn't use start_gas because it's a mix. +/obj/machinery/portable_atmospherics/canister/air/Initialize() + . = ..() + var/list/air_mix = StandardAirMix() + air_contents.adjust_gas(/decl/material/gas/oxygen, air_mix[/decl/material/gas/oxygen], FALSE) + air_contents.adjust_gas(/decl/material/gas/nitrogen, air_mix[/decl/material/gas/nitrogen]) + lazy_update_icon() + /obj/machinery/portable_atmospherics/canister/air/airlock start_pressure = 3 ATM @@ -197,15 +225,15 @@ EMPTY_CANISTER(hydrogen, /obj/machinery/portable_atmospherics/canister/hydrogen) healthcheck() return ..() -/obj/machinery/portable_atmospherics/canister/bash(var/obj/item/W, var/mob/user) +/obj/machinery/portable_atmospherics/canister/bash(var/obj/item/used_item, var/mob/user) . = ..() if(.) - current_health -= W.expend_attack_force(user) + current_health -= used_item.expend_attack_force(user) healthcheck() -/obj/machinery/portable_atmospherics/canister/attackby(var/obj/item/W, var/mob/user) - if(isrobot(user) && istype(W, /obj/item/tank/jetpack)) - var/obj/item/tank/jetpack/pack = W +/obj/machinery/portable_atmospherics/canister/attackby(var/obj/item/used_item, var/mob/user) + if(isrobot(user) && istype(used_item, /obj/item/tank/jetpack)) + var/obj/item/tank/jetpack/pack = used_item var/datum/gas_mixture/thejetpack = pack.air_contents if(thejetpack) var/env_pressure = thejetpack.return_pressure() @@ -301,64 +329,11 @@ EMPTY_CANISTER(hydrogen, /obj/machinery/portable_atmospherics/canister/hydrogen) return STATUS_CLOSE return ..() -/obj/machinery/portable_atmospherics/canister/oxygen/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/oxygen, MolesForPressure()) - update_icon() - -/obj/machinery/portable_atmospherics/canister/hydrogen/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/hydrogen, MolesForPressure()) - update_icon() - -/obj/machinery/portable_atmospherics/canister/oxygen/prechilled/Initialize() - . = ..() - air_contents.temperature = 80 - update_icon() - -/obj/machinery/portable_atmospherics/canister/sleeping_agent/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/nitrous_oxide, MolesForPressure()) - update_icon() - -/obj/machinery/portable_atmospherics/canister/nitrogen/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/nitrogen, MolesForPressure()) - update_icon() - -/obj/machinery/portable_atmospherics/canister/nitrogen/prechilled/Initialize() - . = ..() - air_contents.temperature = 80 - update_icon() - -/obj/machinery/portable_atmospherics/canister/carbon_dioxide/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/carbon_dioxide, MolesForPressure()) - update_icon() - - -/obj/machinery/portable_atmospherics/canister/air/Initialize() - . = ..() - var/list/air_mix = StandardAirMix() - air_contents.adjust_multi(/decl/material/gas/oxygen, air_mix[/decl/material/gas/oxygen], /decl/material/gas/nitrogen, air_mix[/decl/material/gas/nitrogen]) - update_icon() - - // Special types used for engine setup admin verb, they contain double amount of that of normal canister. -/obj/machinery/portable_atmospherics/canister/nitrogen/engine_setup/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/nitrogen, MolesForPressure()) - update_icon() - -/obj/machinery/portable_atmospherics/canister/carbon_dioxide/engine_setup/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/carbon_dioxide, MolesForPressure()) - update_icon() - -/obj/machinery/portable_atmospherics/canister/hydrogen/engine_setup/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/hydrogen, MolesForPressure()) - update_icon() +#define ENGINE_SETUP_CANISTER(BASE_TYPE) ##BASE_TYPE/engine_setup/start_pressure = BASE_TYPE::start_pressure * 2; +ENGINE_SETUP_CANISTER(/obj/machinery/portable_atmospherics/canister/nitrogen) +ENGINE_SETUP_CANISTER(/obj/machinery/portable_atmospherics/canister/carbon_dioxide) +ENGINE_SETUP_CANISTER(/obj/machinery/portable_atmospherics/canister/hydrogen) // Spawn debug tanks. /obj/machinery/portable_atmospherics/canister/helium @@ -366,31 +341,19 @@ EMPTY_CANISTER(hydrogen, /obj/machinery/portable_atmospherics/canister/hydrogen) icon_state = "black" canister_color = "black" can_label = FALSE - -/obj/machinery/portable_atmospherics/canister/helium/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/helium, MolesForPressure()) - update_icon() + start_gas = /decl/material/gas/helium /obj/machinery/portable_atmospherics/canister/methyl_bromide name = "\improper CH3Br canister" icon_state = "black" canister_color = "black" can_label = FALSE - -/obj/machinery/portable_atmospherics/canister/methyl_bromide/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/methyl_bromide, MolesForPressure()) - update_icon() + start_gas = /decl/material/gas/methyl_bromide /obj/machinery/portable_atmospherics/canister/chlorine name = "chlorine canister" icon_state = "black" canister_color = "black" can_label = FALSE - -/obj/machinery/portable_atmospherics/canister/chlorine/Initialize() - . = ..() - air_contents.adjust_gas(/decl/material/gas/chlorine, MolesForPressure()) - update_icon() + start_gas = /decl/material/gas/chlorine // End debug tanks. diff --git a/code/game/machinery/atmoalter/pump.dm b/code/game/machinery/atmoalter/pump.dm index 2c107d7aac1b..43297c50a477 100644 --- a/code/game/machinery/atmoalter/pump.dm +++ b/code/game/machinery/atmoalter/pump.dm @@ -27,7 +27,8 @@ . = ..() var/list/air_mix = StandardAirMix() - src.air_contents.adjust_multi(/decl/material/gas/oxygen, air_mix[/decl/material/gas/oxygen], /decl/material/gas/nitrogen, air_mix[/decl/material/gas/nitrogen]) + air_contents.adjust_gas(/decl/material/gas/oxygen, air_mix[/decl/material/gas/oxygen], FALSE) + air_contents.adjust_gas(/decl/material/gas/nitrogen, air_mix[/decl/material/gas/nitrogen]) /obj/machinery/portable_atmospherics/powered/pump/on_update_icon() overlays.Cut() diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm index 06bed379ecea..bf3c3498dda1 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -181,8 +181,8 @@ cut_overlays() icon_state = "scrubber:[!!((use_power == POWER_USE_ACTIVE) && !(stat & (NOPOWER|BROKEN)))]" -/obj/machinery/portable_atmospherics/powered/scrubber/huge/attackby(var/obj/item/I, var/mob/user) - if(IS_WRENCH(I)) +/obj/machinery/portable_atmospherics/powered/scrubber/huge/attackby(var/obj/item/used_item, var/mob/user) + if(IS_WRENCH(used_item)) if(use_power == POWER_USE_ACTIVE) to_chat(user, "Turn \the [src] off first!") return TRUE @@ -193,7 +193,7 @@ return TRUE //doesn't hold tanks - if(istype(I, /obj/item/tank)) + if(istype(used_item, /obj/item/tank)) return FALSE return ..() @@ -203,8 +203,8 @@ name = "stationary air scrubber" base_type = /obj/machinery/portable_atmospherics/powered/scrubber/huge/stationary -/obj/machinery/portable_atmospherics/powered/scrubber/huge/stationary/attackby(var/obj/item/I, var/mob/user) - if(IS_WRENCH(I)) +/obj/machinery/portable_atmospherics/powered/scrubber/huge/stationary/attackby(var/obj/item/used_item, var/mob/user) + if(IS_WRENCH(used_item)) to_chat(user, "The bolts are too tight for you to unscrew!") return TRUE diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm index f9583f4acfc1..75e0387142c4 100644 --- a/code/game/machinery/biogenerator.dm +++ b/code/game/machinery/biogenerator.dm @@ -81,6 +81,9 @@ /obj/machinery/biogenerator/attackby(var/obj/item/used_item, var/mob/user) + if(panel_open || IS_SCREWDRIVER(used_item)) + return ..() + if(processing) if((. = component_attackby(used_item, user))) return diff --git a/code/game/machinery/bodyscanner.dm b/code/game/machinery/bodyscanner.dm index 9ae5ed360527..6998f0f78519 100644 --- a/code/game/machinery/bodyscanner.dm +++ b/code/game/machinery/bodyscanner.dm @@ -2,7 +2,7 @@ /obj/machinery/bodyscanner var/mob/living/human/occupant var/locked - name = "Body Scanner" + name = "body scanner" icon = 'icons/obj/Cryogenic2.dmi' icon_state = "body_scanner_0" density = TRUE @@ -11,7 +11,6 @@ active_power_usage = 10000 //10 kW. It's a big all-body scanner. construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 var/open_sound = 'sound/machines/podopen.ogg' var/close_sound = 'sound/machines/podclose.ogg' diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index 10f382fb55be..9e19104b483a 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -40,8 +40,8 @@ . = ..() update_icon() -/obj/machinery/button/attackby(obj/item/W, mob/user) - if(!(. = component_attackby(W, user))) +/obj/machinery/button/attackby(obj/item/used_item, mob/user) + if(!(. = component_attackby(used_item, user))) return attack_hand_with_interaction_checks(user) /obj/machinery/button/interface_interact(user) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 98bac3c1fd33..8d28f55a3c86 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -44,7 +44,13 @@ var/light_disabled = 0 var/alarm_on = 0 - var/affected_by_emp_until = 0 + var/emp_timer_id = null + + /// The threshold that installed scanning modules need to met or exceed in order for the camera to see through walls. + var/const/XRAY_THRESHOLD = 2 + + /// The threshold that installed capacitors need to met or exceed in order for the camera to be immunie to EMP. + var/const/EMP_PROOF_THRESHOLD = 2 /obj/machinery/camera/get_examine_strings(mob/user, distance, infix, suffix) . = ..() @@ -84,23 +90,14 @@ invalidateCameraCache() set_extension(src, /datum/extension/network_device/camera, null, null, null, TRUE, preset_channels, c_tag, cameranet_enabled, requires_connection) + RefreshParts() /obj/machinery/camera/Destroy() - set_status(0) //kick anyone viewing out + set_camera_status(0) //kick anyone viewing out + deltimer(emp_timer_id) return ..() /obj/machinery/camera/Process() - if((stat & EMPED) && world.time >= affected_by_emp_until) - stat &= ~EMPED - cancelCameraAlarm() - update_icon() - update_coverage() - - if (detectTime > 0) - var/elapsed = world.time - detectTime - if (elapsed > alarm_delay) - triggerAlarm() - if (stat & (EMPED)) return if(!motion_sensor) @@ -156,16 +153,30 @@ newTarget(AM) /obj/machinery/camera/emp_act(severity) - if(!(stat_immune & EMPED) && prob(100/severity)) - if(!affected_by_emp_until || (world.time < affected_by_emp_until)) - affected_by_emp_until = max(affected_by_emp_until, world.time + (90 SECONDS / severity)) - else - stat |= EMPED - set_light(0) - triggerCameraAlarm() - update_icon() - update_coverage() - START_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF) + if(stat_immune & EMPED) + return + if(prob(100 / severity)) + stat |= EMPED + set_light(0) + triggerCameraAlarm() + update_icon() + update_coverage() + + var/emp_length = 90 SECONDS / severity + emp_timer_id = addtimer(CALLBACK(src, PROC_REF(emp_expired)), emp_length, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE) + ..() + +/obj/machinery/camera/proc/emp_expired() + stat &= ~EMPED + cancelCameraAlarm() + update_icon() + update_coverage() + + if (detectTime > 0) + var/elapsed = world.time - detectTime + if (elapsed > alarm_delay) + triggerAlarm() + /obj/machinery/camera/bullet_act(var/obj/item/projectile/P) take_damage(P.get_structure_damage(), P.atom_damage_type) @@ -196,10 +207,10 @@ return TRUE return FALSE -/obj/machinery/camera/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/paper)) +/obj/machinery/camera/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/paper)) var/datum/extension/network_device/camera/D = get_extension(src, /datum/extension/network_device) - D.show_paper(W, user) + D.show_paper(used_item, user) return ..() /obj/machinery/camera/interface_interact(mob/user) @@ -227,7 +238,7 @@ //sparks spark_at(loc, amount=5) -/obj/machinery/camera/proc/set_status(var/newstatus, var/mob/user) +/obj/machinery/camera/proc/set_camera_status(var/newstatus, var/mob/user) if (status != newstatus && (!cut_power || status == TRUE)) status = newstatus // The only way for AI to reactivate cameras are malf abilities, this gives them different messages. @@ -254,25 +265,28 @@ update_coverage() /obj/machinery/camera/on_update_icon() + var/base_state = initial(icon_state) + if(total_component_rating_of_type(/obj/item/stock_parts/scanning_module) >= XRAY_THRESHOLD) + base_state = "xraycam" if (!status || (stat & BROKEN)) - icon_state = "[initial(icon_state)]1" + icon_state = "[base_state]1" else if (stat & EMPED) - icon_state = "[initial(icon_state)]emp" + icon_state = "[base_state]emp" else - icon_state = initial(icon_state) + icon_state = base_state /obj/machinery/camera/RefreshParts() . = ..() var/power_mult = 1 var/emp_protection = total_component_rating_of_type(/obj/item/stock_parts/capacitor) - if(emp_protection > 2) - stat_immune &= EMPED + if(emp_protection >= EMP_PROOF_THRESHOLD) + stat_immune |= EMPED else stat_immune &= ~EMPED var/xray_rating = total_component_rating_of_type(/obj/item/stock_parts/scanning_module) var/datum/extension/network_device/camera/camera_device = get_extension(src, /datum/extension/network_device/) if(camera_device) - if(xray_rating > 2) + if(xray_rating >= XRAY_THRESHOLD) camera_device.xray_enabled = TRUE power_mult++ else @@ -337,7 +351,7 @@ ) /obj/machinery/camera/proc/toggle_status() - set_status(!status) + set_camera_status(!status) /decl/public_access/public_method/toggle_camera name = "toggle camera" diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index 30ee583beec2..0fe1d526de06 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -1,5 +1,5 @@ /obj/machinery/camera/network/engineering - preset_channels = list(CAMERA_CAMERA_CHANNEL_ENGINEERING) + preset_channels = list(CAMERA_CHANNEL_ENGINEERING) req_access = list(access_engine) /obj/machinery/camera/network/ert @@ -33,33 +33,24 @@ requires_connection = FALSE // EMP - -/obj/machinery/camera/emp_proof/populate_parts(full_populate) - . = ..() - install_component(/obj/item/stock_parts/capacitor/adv, TRUE) +/obj/machinery/camera/emp_proof + uncreated_component_parts = list(/obj/item/stock_parts/capacitor/adv = 1) // X-RAY - /obj/machinery/camera/xray - icon_state = "xraycam" // Thanks to Krutchen for the icons. - -/obj/machinery/camera/xray/populate_parts(full_populate) - . = ..() - install_component(/obj/item/stock_parts/scanning_module/adv, TRUE) + uncreated_component_parts = list(/obj/item/stock_parts/scanning_module/adv = 1) // MOTION - -/obj/machinery/camera/motion/populate_parts(full_populate) - . = ..() - install_component(/obj/item/stock_parts/micro_laser, TRUE) +/obj/machinery/camera/motion + uncreated_component_parts = list(/obj/item/stock_parts/micro_laser = 1) // ALL UPGRADES - -/obj/machinery/camera/all/populate_parts(full_populate) - . = ..() - install_component(/obj/item/stock_parts/capacitor/adv, TRUE) - install_component(/obj/item/stock_parts/scanning_module/adv, TRUE) - install_component(/obj/item/stock_parts/micro_laser, TRUE) +/obj/machinery/camera/all + uncreated_component_parts = list( + /obj/item/stock_parts/capacitor/adv = 1, + /obj/item/stock_parts/scanning_module/adv = 1, + /obj/item/stock_parts/micro_laser = 1 + ) // AUTONAME left as a map stub /obj/machinery/camera/autoname \ No newline at end of file diff --git a/code/game/machinery/camera/robot_camera.dm b/code/game/machinery/camera/robot_camera.dm index fc74d78f8096..cf3463664fa9 100644 --- a/code/game/machinery/camera/robot_camera.dm +++ b/code/game/machinery/camera/robot_camera.dm @@ -1,14 +1,14 @@ /datum/extension/network_device/camera/robot - expected_type = /mob/living/silicon/robot + expected_type = /mob/living/silicon/robot /datum/extension/network_device/camera/robot/is_functional() - var/mob/living/silicon/robot/R = holder - if(R.wires.IsIndexCut(BORG_WIRE_CAMERA)) + var/mob/living/silicon/robot/robot = holder + if(robot.wires.IsIndexCut(BORG_WIRE_CAMERA)) return FALSE - if(!R.has_power) + if(!robot.has_power) return FALSE - if(R.stat == DEAD) + if(robot.stat == DEAD) return FALSE - if(!R.is_component_functioning("camera")) + if(!robot.is_component_functioning("camera")) return FALSE return TRUE \ No newline at end of file diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 5a27cca96219..9cc55afa80f1 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -52,8 +52,8 @@ STOP_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF) update_icon() -/obj/machinery/cell_charger/attackby(obj/item/W, mob/user) - if(IS_WRENCH(W) && !panel_open) +/obj/machinery/cell_charger/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item) && !panel_open) . = TRUE if(get_cell()) to_chat(user, "Remove the cell first!") diff --git a/code/game/machinery/centrifuge.dm b/code/game/machinery/centrifuge.dm new file mode 100644 index 000000000000..217e63809e5e --- /dev/null +++ b/code/game/machinery/centrifuge.dm @@ -0,0 +1,183 @@ +/datum/storage/hopper/industrial/centrifuge + can_hold = list( + /obj/item/food, + ) + expected_type = /obj/machinery/centrifuge + +/datum/storage/hopper/industrial/centrifuge/proc/should_ingest(mob/user, obj/item/thing) + if(thing.reagents?.total_volume <= 0) + if(user) + to_chat(user, SPAN_WARNING("\The [thing] is empty.")) + return FALSE + return TRUE + +/datum/storage/hopper/industrial/centrifuge/can_be_inserted(obj/item/inserting, mob/user, stop_messages, click_params) + . = ..() + if(. && !should_ingest(user, inserting)) + return FALSE + +/obj/machinery/centrifuge + name = "industrial centrifuge" + desc = "A machine used to extract reagents and materials from objects via spinning them at extreme speed." + icon = 'icons/obj/machines/centrifuge.dmi' + icon_state = ICON_STATE_WORLD + anchored = TRUE + density = TRUE + construct_state = /decl/machine_construction/default/panel_closed + uncreated_component_parts = null + storage = /datum/storage/hopper/industrial/centrifuge + base_type = /obj/machinery/centrifuge + stat_immune = 0 + + // Reference to our reagent container. Set to a path to create on init. + var/obj/item/loaded_beaker + + // Stolen from fabricators. + var/sound_id + var/datum/sound_token/sound_token + var/work_sound = 'sound/machines/fabricator_loop.ogg' + +/obj/machinery/centrifuge/mapped + loaded_beaker = /obj/item/chems/glass/beaker/large + +/obj/machinery/centrifuge/Initialize() + . = ..() + if(ispath(loaded_beaker)) + loaded_beaker = new loaded_beaker + +/obj/machinery/centrifuge/get_stored_inventory() + . = ..() + if(LAZYLEN(.)) + LAZYREMOVE(., loaded_beaker) + +/obj/machinery/centrifuge/Destroy() + QDEL_NULL(loaded_beaker) + return ..() + +/obj/machinery/centrifuge/dismantle() + if(loaded_beaker) + loaded_beaker.dropInto(loc) + loaded_beaker = null + return ..() + +/obj/machinery/centrifuge/components_are_accessible(path) + return use_power != POWER_USE_ACTIVE && ..() + +/obj/machinery/centrifuge/cannot_transition_to(state_path, mob/user) + if(use_power == POWER_USE_ACTIVE) + return SPAN_NOTICE("You must wait for \the [src] to finish first!") + return ..() + +/obj/machinery/centrifuge/attackby(obj/item/used_item, mob/user) + + if(use_power == POWER_USE_ACTIVE) + to_chat(user, SPAN_NOTICE("\The [src] is currently spinning, wait until it's finished.")) + return TRUE + + if((. = component_attackby(used_item, user))) + return + + // Load in a new container for products. + if(istype(used_item, /obj/item/chems/glass/beaker)) + if(loaded_beaker) + to_chat(user, SPAN_WARNING("\The [src] already has a beaker loaded.")) + return TRUE + if(user.try_unequip(used_item, src)) + loaded_beaker = used_item + to_chat(user, SPAN_NOTICE("You load \the [loaded_beaker] into \the [src].")) + return TRUE + + // Parent call handles inserting the frame into our contents, + return ..() + +/obj/machinery/centrifuge/attack_hand(mob/user) + + if(use_power == POWER_USE_ACTIVE) + user.visible_message("\The [user] disengages \the [src].") + update_use_power(POWER_USE_IDLE) + return TRUE + + if(use_power == POWER_USE_IDLE) + if(!loaded_beaker || QDELETED(loaded_beaker)) + to_chat(user, SPAN_WARNING("\The [src] has no beaker loaded to receive any products.")) + loaded_beaker = null // just in case + return TRUE + + if(length(get_stored_inventory())) + user.visible_message("\The [user] engages \the [src].") + update_use_power(POWER_USE_ACTIVE) + else + to_chat(user, SPAN_WARNING("\The [src]'s hopper is empty.")) + return TRUE + + if(use_power == POWER_USE_OFF || !operable()) + to_chat(user, SPAN_WARNING("\The [src]'s interface is unresponsive.")) + return TRUE + + return ..() + +/obj/machinery/centrifuge/Process(wait, tick) + ..() + + if(use_power != POWER_USE_ACTIVE) + return + + if(!loaded_beaker) + visible_message("\The [src] stops spinning and flashes a red light.") + update_use_power(POWER_USE_IDLE) + return + + var/list/processing_items = get_stored_inventory() + if(!length(processing_items)) + visible_message("\The [src] stops spinning and flashes a green light.") + update_use_power(POWER_USE_IDLE) + return + + var/obj/item/thing = processing_items[1] + thing.handle_centrifuge_process(src) + if(!QDELETED(thing) && loc) + thing.dropInto(loc) + +/obj/machinery/centrifuge/Initialize() + sound_id = "[work_sound]" + return ..() + +/obj/machinery/centrifuge/Destroy() + QDEL_NULL(sound_token) + return ..() + +/obj/machinery/centrifuge/update_use_power() + . = ..() + if(use_power == POWER_USE_ACTIVE) + if(!sound_token) + sound_token = play_looping_sound(src, sound_id, work_sound, volume = 30) + else + QDEL_NULL(sound_token) + +/obj/machinery/centrifuge/on_update_icon() + icon_state = initial(icon_state) + if(stat & BROKEN) + icon_state = "[icon_state]-broken" + else if(use_power == POWER_USE_OFF || !operable()) + icon_state = "[icon_state]-off" + else if(use_power == POWER_USE_ACTIVE) + icon_state = "[icon_state]-working" + +/obj/machinery/centrifuge/get_quick_interaction_handler(mob/user) + return loaded_beaker ? GET_DECL(/decl/interaction_handler/remove_centrifuge_beaker) : null + +/obj/machinery/centrifuge/get_alt_interactions(var/mob/user) + . = ..() + if(loaded_beaker) + LAZYADD(., /decl/interaction_handler/remove_centrifuge_beaker) + +/decl/interaction_handler/remove_centrifuge_beaker + name = "Remove Beaker" + expected_target_type = /obj/machinery/centrifuge + +/decl/interaction_handler/remove_centrifuge_beaker/invoked(atom/target, mob/user, obj/item/prop) + var/obj/machinery/centrifuge/centrifuge = target + if(centrifuge.loaded_beaker) + centrifuge.loaded_beaker.dropInto(centrifuge.loc) + user.put_in_hands(centrifuge.loaded_beaker) + centrifuge.loaded_beaker = null diff --git a/code/game/machinery/computer/ai_core.dm b/code/game/machinery/computer/ai_core.dm index c76905972bca..79bb78e9540e 100644 --- a/code/game/machinery/computer/ai_core.dm +++ b/code/game/machinery/computer/ai_core.dm @@ -108,59 +108,59 @@ var/global/list/empty_playable_ai_cores = list() else icon_state = "0" -/obj/structure/aicore/attackby(obj/item/P, mob/user) +/obj/structure/aicore/attackby(obj/item/used_item, mob/user) . = ..() if(.) update_icon() else if(!authorized) - if(access_ai_upload in P.GetAccess()) - to_chat(user, SPAN_NOTICE("You swipe [P] at [src] and authorize it to connect into the systems of [global.using_map.full_name].")) + if(access_ai_upload in used_item.GetAccess()) + to_chat(user, SPAN_NOTICE("You swipe [used_item] at [src] and authorize it to connect into the systems of [global.using_map.full_name].")) authorized = 1 if(anchored) if(!glass_installed && wired) - if(istype(P, /obj/item/stock_parts/circuitboard/aicore)) + if(istype(used_item, /obj/item/stock_parts/circuitboard/aicore)) if(circuit) to_chat(user, SPAN_WARNING("There is already a circuit installed in \the [src].")) return TRUE if(!wired) to_chat(user, SPAN_WARNING("Wire \the [src] first.")) return TRUE - if(user.try_unequip(P, src)) + if(user.try_unequip(used_item, src)) playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) to_chat(user, SPAN_NOTICE("You place the circuit board inside the frame.")) - circuit = P + circuit = used_item update_icon() return TRUE if(circuit && circuit_secured) - if(istype(P, /obj/item/organ/internal) && wired && circuit && circuit_secured) - var/obj/item/organ/internal/M = P + if(istype(used_item, /obj/item/organ/internal) && wired && circuit && circuit_secured) + var/obj/item/organ/internal/M = used_item var/mob/living/brainmob = M.get_brainmob() if(!brainmob) - to_chat(user, SPAN_WARNING("Sticking a mindless [P] into the frame would be pointless.")) + to_chat(user, SPAN_WARNING("Sticking a mindless [used_item] into the frame would be pointless.")) return if(brainmob.stat == DEAD) - to_chat(user, SPAN_WARNING("Sticking a dead [P] into the frame would sort of defeat the purpose.")) + to_chat(user, SPAN_WARNING("Sticking a dead [used_item] into the frame would sort of defeat the purpose.")) return if(jobban_isbanned(brainmob, "AI")) - to_chat(user, SPAN_WARNING("This [P] does not seem to fit.")) + to_chat(user, SPAN_WARNING("This [used_item] does not seem to fit.")) return - if(!user.try_unequip(P, src)) + if(!user.try_unequip(used_item, src)) if(brainmob.mind) clear_antag_roles(brainmob.mind, 1) - brain = P - to_chat(usr, "You connect \the [P] to the frame and slide it into the casing.") + brain = used_item + to_chat(usr, "You connect \the [used_item] to the frame and slide it into the casing.") update_icon() return TRUE - if(istype(P, /obj/item/stack/material)) - var/obj/item/stack/material/RG = P + if(istype(used_item, /obj/item/stack/material)) + var/obj/item/stack/material/RG = used_item if(RG.material.type != /decl/material/solid/glass || !RG.reinf_material || RG.get_amount() < 2) to_chat(user, SPAN_WARNING("You need two sheets of reinforced glass to put in the glass panel.")) return TRUE @@ -175,14 +175,14 @@ var/global/list/empty_playable_ai_cores = list() update_icon() return TRUE - if(istype(P, /obj/item/aiModule/freeform)) - var/obj/item/aiModule/freeform/M = P + if(istype(used_item, /obj/item/aiModule/freeform)) + var/obj/item/aiModule/freeform/M = used_item laws.add_inherent_law(M.newFreeFormLaw) to_chat(usr, "Added a freeform law.") return TRUE - if(istype(P, /obj/item/aiModule)) - var/obj/item/aiModule/module = P + if(istype(used_item, /obj/item/aiModule)) + var/obj/item/aiModule/module = used_item laws.clear_inherent_laws() if(module.laws) for(var/datum/ai_law/AL in module.laws.inherent_laws) @@ -224,9 +224,9 @@ var/global/list/deactivated_ai_cores = list() card.clear() qdel(src) -/obj/structure/aicore/deactivated/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/aicard)) - var/obj/item/aicard/card = W +/obj/structure/aicore/deactivated/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/aicard)) + var/obj/item/aicard/card = used_item var/mob/living/silicon/ai/transfer = locate() in card if(transfer) load_ai(transfer,card,user) diff --git a/code/game/machinery/computer/guestpass.dm b/code/game/machinery/computer/guestpass.dm index 6b52228b8ec4..4fcf1b94292d 100644 --- a/code/game/machinery/computer/guestpass.dm +++ b/code/game/machinery/computer/guestpass.dm @@ -58,19 +58,20 @@ var/reason = "NOT SPECIFIED" var/duration_max = 60 var/duration = 5 + var/terminal_serial var/list/internal_log = list() var/mode = 0 // 0 - making pass, 1 - viewing logs /obj/machinery/computer/guestpass/Initialize() . = ..() - uid = "[random_id("guestpass_serial_number",100,999)]-G[rand(10,99)]" + terminal_serial = "[random_id("guestpass_serial_number",100,999)]-G[rand(10,99)]" -/obj/machinery/computer/guestpass/attackby(obj/O, mob/user) - if(istype(O, /obj/item/card/id)) - if(!giver && user.try_unequip(O)) - O.forceMove(src) - giver = O +/obj/machinery/computer/guestpass/attackby(obj/used_item, mob/user) + if(istype(used_item, /obj/item/card/id)) + if(!giver && user.try_unequip(used_item)) + used_item.forceMove(src) + giver = used_item updateUsrDialog() else if(giver) to_chat(user, SPAN_WARNING("There is already ID card inside.")) @@ -151,19 +152,19 @@ giver = null accesses.Cut() else - var/obj/item/I = user.get_active_held_item() - if (istype(I, /obj/item/card/id) && user.try_unequip(I)) - I.forceMove(src) - giver = I + var/obj/item/used_item = user.get_active_held_item() + if (istype(used_item, /obj/item/card/id) && user.try_unequip(used_item)) + used_item.forceMove(src) + giver = used_item . = TOPIC_REFRESH else if (href_list["print"]) - var/dat = "

Activity log of guest pass terminal #[uid]


" + var/dat = "

Activity log of guest pass terminal #[terminal_serial]


" for (var/entry in internal_log) dat += "[entry]

" - var/obj/item/paper/P = new/obj/item/paper( loc ) - P.SetName("activity log") - P.info = dat + var/obj/item/paper/paper = new/obj/item/paper( loc ) + paper.SetName("activity log") + paper.info = dat . = TOPIC_REFRESH else if (href_list["issue"]) diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index 992d2b211b51..8128cf6e71da 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -4,13 +4,12 @@ icon_screen = "command" var/mob/living/silicon/current -/obj/machinery/computer/upload/attackby(obj/item/O, mob/user) - if(istype(O, /obj/item/aiModule)) - var/obj/item/aiModule/M = O +/obj/machinery/computer/upload/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/aiModule)) + var/obj/item/aiModule/M = used_item M.install(src, user) return TRUE - else - return ..() + return ..() /obj/machinery/computer/upload/ai name = "\improper AI upload console" diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index da48f9028515..ab639d35a2e9 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -41,12 +41,12 @@ break . = tracking_linked_server -/obj/machinery/computer/message_monitor/attackby(obj/item/O, mob/user) +/obj/machinery/computer/message_monitor/attackby(obj/item/used_item, mob/user) if(stat & (NOPOWER|BROKEN)) return ..() if(!istype(user)) return TRUE - if(IS_SCREWDRIVER(O) && emagged) + if(IS_SCREWDRIVER(used_item) && emagged) //Stops people from just unscrewing the monitor and putting it back to get the console working again. to_chat(user, "It is too hot to mess with!") return TRUE diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index b3903352d555..aa9eb1647d52 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -78,5 +78,5 @@ if(!warning) return TOPIC_HANDLED var/obj/item/implant/I = locate(href_list["warn"]) if(I?.imp_in) - var/mob/living/R = I.imp_in - to_chat(R, "You hear a voice in your head saying: '[warning]'") + var/mob/living/victim = I.imp_in + to_chat(victim, "You hear a voice in your head saying: '[warning]'") diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm index 4b1d38034e52..81e3a6b26706 100644 --- a/code/game/machinery/computer/robot.dm +++ b/code/game/machinery/computer/robot.dm @@ -108,47 +108,47 @@ /obj/machinery/computer/robotics/proc/get_cyborgs(var/mob/user) var/list/robots = list() - for(var/mob/living/silicon/robot/R in global.silicon_mob_list) + for(var/mob/living/silicon/robot/robot in global.silicon_mob_list) // Ignore drones - if(isdrone(R)) + if(isdrone(robot)) continue // Ignore antagonistic cyborgs - if(R.scrambledcodes) + if(robot.scrambledcodes) continue - var/list/robot = list() - robot["name"] = R.name - var/turf/T = get_turf(R) + var/list/robot_data = list() + robot_data["name"] = robot.name + var/turf/T = get_turf(robot) var/area/A = get_area(T) if(istype(T) && istype(A) && isContactLevel(T.z)) - robot["location"] = "[A.proper_name] ([T.x], [T.y])" + robot_data["location"] = "[A.proper_name] ([T.x], [T.y])" else - robot["location"] = "Unknown" + robot_data["location"] = "Unknown" - if(R.stat) - robot["status"] = "Not Responding" - else if (R.lockcharge) - robot["status"] = "Lockdown" + if(robot.stat) + robot_data["status"] = "Not Responding" + else if (robot.lockcharge) + robot_data["status"] = "Lockdown" else - robot["status"] = "Operational" + robot_data["status"] = "Operational" - if(R.cell) - robot["cell"] = 1 - robot["cell_capacity"] = R.cell.maxcharge - robot["cell_current"] = R.cell.charge - robot["cell_percentage"] = round(R.cell.percent()) + if(robot.cell) + robot_data["cell"] = 1 + robot_data["cell_capacity"] = robot.cell.maxcharge + robot_data["cell_current"] = robot.cell.charge + robot_data["cell_percentage"] = round(robot.cell.percent()) else - robot["cell"] = 0 + robot_data["cell"] = 0 - robot["module"] = R.module ? R.module.name : "None" - robot["master_ai"] = R.connected_ai ? R.connected_ai.name : "None" - robot["hackable"] = 0 + robot_data["module"] = robot.module ? robot.module.name : "None" + robot_data["master_ai"] = robot.connected_ai ? robot.connected_ai.name : "None" + robot_data["hackable"] = 0 // Antag AIs know whether linked cyborgs are hacked or not. - if(user && isAI(user) && (R.connected_ai == user) && player_is_antag(user.mind)) - robot["hacked"] = R.emagged ? 1 : 0 - robot["hackable"] = R.emagged? 0 : 1 - robots.Add(list(robot)) + if(user && isAI(user) && (robot.connected_ai == user) && player_is_antag(user.mind)) + robot_data["hacked"] = robot.emagged ? 1 : 0 + robot_data["hackable"] = robot.emagged? 0 : 1 + robots.Add(list(robot_data)) return robots // Proc: get_cyborg_by_name() @@ -157,6 +157,6 @@ /obj/machinery/computer/robotics/proc/get_cyborg_by_name(var/name) if (!name) return - for(var/mob/living/silicon/robot/R in global.silicon_mob_list) - if(R.name == name) - return R + for(var/mob/living/silicon/robot/robot in global.silicon_mob_list) + if(robot.name == name) + return robot diff --git a/code/game/machinery/computer/shuttle.dm b/code/game/machinery/computer/shuttle.dm index dad8eb391e9a..a63d6d3b2ead 100644 --- a/code/game/machinery/computer/shuttle.dm +++ b/code/game/machinery/computer/shuttle.dm @@ -9,7 +9,7 @@ var/list/authorized = list( ) -/obj/machinery/computer/shuttle/attackby(var/obj/item/card as obj, var/mob/user as mob) +/obj/machinery/computer/shuttle/attackby(var/obj/item/used_item, var/mob/user) if(stat & (BROKEN|NOPOWER)) return TRUE var/datum/evacuation_controller/shuttle/evac_control = SSevac.evacuation_controller @@ -17,20 +17,20 @@ to_chat(user, "This console should not be in use on this map. Please report this to a developer.") return TRUE - if(!istype(card, /obj/item/card)) // don't try to get an ID card if we're an emag - card = card.GetIdCard() // handles stored IDs in modcomps and similar + if(!istype(used_item, /obj/item/card)) // don't try to get an ID card if we're an emag + used_item = used_item.GetIdCard() // handles stored IDs in modcomps and similar - if ((!istype(card, /obj/item/card) || evac_control.has_evacuated() || !user)) + if ((!istype(used_item, /obj/item/card) || evac_control.has_evacuated() || !user)) return FALSE - if (istype(card, /obj/item/card/id)) - var/obj/item/card/id/id_card = card + if (istype(used_item, /obj/item/card/id)) + var/obj/item/card/id/id_card = used_item if(!LAZYISIN(id_card.access, access_bridge)) //doesn't have this access to_chat(user, "The access level of [id_card.registered_name]\'s card is not high enough.") return TRUE var/choice = alert(user, "Would you like to (un)authorize a shortened launch time? [auth_need - authorized.len] authorization\s are still needed. Use abort to cancel all authorizations.", "Shuttle Launch", "Authorize", "Repeal", "Abort") - if(evac_control.is_prepared() && user.get_active_held_item() != card) + if(evac_control.is_prepared() && user.get_active_held_item() != used_item) return TRUE switch(choice) if("Authorize") @@ -59,10 +59,10 @@ src.authorized = list( ) return TRUE - else if (istype(card, /obj/item/card/emag) && !emagged) + else if (istype(used_item, /obj/item/card/emag) && !emagged) var/choice = alert(user, "Would you like to launch the shuttle?","Shuttle control", "Launch", "Cancel") - if(!emagged && !evac_control.is_prepared() && user.get_active_held_item() == card && choice == "Launch") + if(!emagged && !evac_control.is_prepared() && user.get_active_held_item() == used_item && choice == "Launch") to_world("Alert: Shuttle launch time shortened to 10 seconds!") evac_control.set_launch_time(world.time+100) emagged = 1 diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 1892189e038e..7a0bf2fccd41 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -157,7 +157,9 @@ var/occupied_icon_state = "body_scanner_1" var/on_store_message = "has entered long-term storage." var/on_store_name = "Cryogenic Oversight" + var/on_store_visible_message = "$TARGET$ hums and hisses as it moves $USER$ into storage." //! A visible message to display when the user is despawned. $USER$ will be replaced with the user's name, $TARGET$ will be replaced with the pod's name. var/on_enter_occupant_message = "You feel cool air surround you. You go numb as your senses turn inward." + var/on_enter_visible_message = "$USER$ starts climbing into $TARGET$." //! A visible message to display when the user enters the pod. $USER$ will be replaced with the user's name. var/allow_occupant_types = list(/mob/living/human) var/disallow_occupant_types = list() @@ -188,6 +190,31 @@ disallow_occupant_types = list(/mob/living/silicon/robot/drone) applies_stasis = 0 +// Cryo +/obj/machinery/cryopod/robot/door + //This inherits from the robot cryo, so synths can be properly cryo'd. If a non-synth enters and is cryo'd, ..() is called and it'll still work. + abstract_type = /obj/machinery/cryopod/robot/door + name = "Airlock of Wonders" + desc = "An airlock that isn't an airlock, and shouldn't exist. Yell at a coder/mapper." + icon = 'icons/obj/machines/tramdoors.dmi' + icon_state = "door_closed" + base_icon_state = "door_closed" + occupied_icon_state = "door_locked" + on_enter_visible_message = "$USER$ steps into $TARGET$." + + time_till_despawn = 1 MINUTE //We want to be much faster then normal cryo, since waiting in an elevator for half an hour is a special kind of hell. + + allow_occupant_types = list(/mob/living/silicon/robot,/mob/living/human) + disallow_occupant_types = list(/mob/living/silicon/robot/drone) + +/obj/machinery/cryopod/robot/door/dorms + name = "Residential District Elevator" + desc = "A small elevator that goes down to the deeper section of the colony." + on_store_message = "has departed for the residential district." + on_store_name = "Residential Oversight" + on_enter_occupant_message = "The elevator door closes slowly, ready to bring you down to the residential district." + on_store_visible_message = "$TARGET$ makes a ding as it moves $USER$ to the residential district." + /obj/machinery/cryopod/lifepod name = "life pod" desc = "A man-sized pod for entering suspended animation. Dubbed 'cryocoffin' by more cynical spacers, it is pretty barebone, counting on stasis system to keep the victim alive rather than packing extended supply of food or air. Can be ordered with symbols of common religious denominations to be used in space funerals too." @@ -248,7 +275,7 @@ /obj/machinery/cryopod/lifepod/Process() if(SSevac.evacuation_controller && SSevac.evacuation_controller.state >= EVAC_LAUNCHING) if(occupant && !launched) - launch() + INVOKE_ASYNC(src, PROC_REF(launch)) ..() /obj/machinery/cryopod/Destroy() @@ -299,11 +326,14 @@ if (occupant && user.Adjacent(src)) . += occupant.get_examine_strings(user, distance, infix, suffix) +/obj/machinery/cryopod/get_cryogenic_power() + return applies_stasis ? 1 : 0 + //Lifted from Unity stasis.dm and refactored. /obj/machinery/cryopod/Process() if(occupant) if(applies_stasis && (world.time > time_entered + 20 SECONDS)) - occupant.set_stasis(2) + occupant.add_mob_modifier(/decl/mob_modifier/stasis, 2 SECONDS, source = src) //Allow a ten minute gap between entering the pod and actually despawning. // Only provide the gap if the occupant hasn't ghosted @@ -356,6 +386,7 @@ control_computer._admin_logs += "[key_name(occupant)] ([role_alt_title]) at [stationtime2text()]" log_and_message_admins("[key_name(occupant)] ([role_alt_title]) entered cryostorage.") + visible_message(SPAN_NOTICE(emote_replace_user_tokens(emote_replace_target_tokens(on_store_visible_message, src), occupant))) do_telecomms_announcement(src, "[occupant.real_name], [role_alt_title], [on_store_message]", "[on_store_name]") despawn_character(occupant) set_occupant(null) @@ -366,7 +397,10 @@ if(alert(target,"Would you like to enter long-term storage?",,"Yes","No") != "Yes") return if(!user.incapacitated() && !user.anchored && user.Adjacent(src) && user.Adjacent(target)) - visible_message("[user] starts putting [target] into \the [src].", range = 3) + if(target == user) + visible_message(SPAN_NOTICE(emote_replace_user_tokens(emote_replace_target_tokens(on_enter_visible_message, src), usr)), range = 3) + else + visible_message("[user] starts putting [target] into \the [src].", range = 3) if(!do_after(user, 20, src)|| QDELETED(target)) return set_occupant(target) @@ -417,8 +451,8 @@ var/list/items = get_contained_external_atoms() if(occupant) items -= occupant - for(var/obj/item/W in items) - W.dropInto(loc) + for(var/obj/item/thing in items) + thing.dropInto(loc) src.go_out() add_fingerprint(usr) @@ -441,7 +475,7 @@ if(!usr.can_enter_cryopod(usr)) return - visible_message("\The [usr] starts climbing into \the [src].", range = 3) + visible_message(emote_replace_user_tokens(emote_replace_target_tokens(on_enter_visible_message, src), usr), range = 3) if(do_after(usr, 20, src)) @@ -484,7 +518,7 @@ if(occupant.client) if(!silent) - to_chat(occupant, SPAN_NOTICE("[on_enter_occupant_message]")) + occupant.visible_message("\The [src] [emote_replace_target_tokens(on_enter_visible_message)]", SPAN_NOTICE(on_enter_occupant_message)) to_chat(occupant, SPAN_NOTICE("If you ghost, log out or close your client now, your character will shortly be permanently removed from the round.")) occupant.client.perspective = EYE_PERSPECTIVE occupant.client.eye = src @@ -520,14 +554,14 @@ to_chat(user, SPAN_NOTICE("The glass is already open.")) return TRUE -/obj/structure/broken_cryo/attackby(obj/item/W, mob/user) +/obj/structure/broken_cryo/attackby(obj/item/used_item, mob/user) if (busy) to_chat(user, SPAN_NOTICE("Someone else is attempting to open this.")) return TRUE if (!closed) to_chat(user, SPAN_NOTICE("The glass cover is already open.")) return TRUE - if (IS_CROWBAR(W)) + if (IS_CROWBAR(used_item)) busy = 1 visible_message("[user] starts to pry the glass cover off of \the [src].") if (!do_after(user, 50, src)) diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index 345a6b0359aa..7172c5958187 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -19,8 +19,8 @@ . = ..() icon_state = "barrier[src.locked]" -/obj/machinery/deployable/barrier/attackby(obj/item/W, mob/user) - if (istype(W, /obj/item/card/id)) +/obj/machinery/deployable/barrier/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/card/id)) if (src.allowed(user)) if (src.emagged < 2.0) src.locked = !src.locked @@ -36,7 +36,7 @@ spark_at(src, amount=2, cardinal_only = TRUE) visible_message("BZZzZZzZZzZT") return TRUE - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) var/current_max_health = get_max_health() if (current_health < current_max_health) current_health = current_max_health @@ -50,11 +50,11 @@ visible_message("[user] repairs \the [src]!") return TRUE else - switch(W.atom_damage_type) + switch(used_item.atom_damage_type) if(BURN) - current_health -= W.expend_attack_force(user) * 0.75 + current_health -= used_item.expend_attack_force(user) * 0.75 if(BRUTE) - current_health -= W.expend_attack_force(user) * 0.5 + current_health -= used_item.expend_attack_force(user) * 0.5 if (current_health <= 0) explode() return TRUE diff --git a/code/game/machinery/doors/_door.dm b/code/game/machinery/doors/_door.dm index 39628fe7da0b..17dfd16d50df 100644 --- a/code/game/machinery/doors/_door.dm +++ b/code/game/machinery/doors/_door.dm @@ -248,11 +248,10 @@ else if(density) do_animate("deny") - update_icon() return TRUE -/obj/machinery/door/proc/handle_repair(obj/item/I, mob/user) - if(istype(I, /obj/item/stack/material) && I.get_material_type() == src.get_material_type()) +/obj/machinery/door/proc/handle_repair(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/stack/material) && used_item.get_material_type() == src.get_material_type()) if(reason_broken & MACHINE_BROKEN_GENERIC) to_chat(user, "It looks like \the [src] is pretty busted. It's going to need more than just patching up now.") return TRUE @@ -268,7 +267,7 @@ var/amount_needed = (current_max_health - current_health) / DOOR_REPAIR_AMOUNT amount_needed = ceil(amount_needed) - var/obj/item/stack/stack = I + var/obj/item/stack/stack = used_item var/transfer if (repairing) transfer = stack.transfer_to(repairing, amount_needed - repairing.amount) @@ -286,12 +285,12 @@ return TRUE - if(repairing && IS_WELDER(I)) + if(repairing && IS_WELDER(used_item)) if(!density) to_chat(user, "\The [src] must be closed before you can repair it.") return TRUE - var/obj/item/weldingtool/welder = I + var/obj/item/weldingtool/welder = used_item if(welder.weld(0,user)) to_chat(user, "You start to fix dents and weld \the [repairing] into place.") playsound(src, 'sound/items/Welder.ogg', 100, 1) @@ -303,15 +302,15 @@ repairing = null return TRUE - if(repairing && IS_CROWBAR(I)) + if(repairing && IS_CROWBAR(used_item)) to_chat(user, "You remove \the [repairing].") playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1) repairing.dropInto(user.loc) repairing = null return TRUE -/obj/machinery/door/attackby(obj/item/I, mob/user) - . = handle_repair(I, user) +/obj/machinery/door/attackby(obj/item/used_item, mob/user) + . = handle_repair(used_item, user) if(.) return return ..() @@ -537,17 +536,17 @@ if( istype(T, /turf/wall)) success = 1 if(propagate) - for(var/turf/wall/W in RANGE_TURFS(T, 1)) - W.wall_connections = null - W.other_connections = null - W.queue_icon_update() + for(var/turf/wall/wall in RANGE_TURFS(T, 1)) + wall.wall_connections = null + wall.other_connections = null + wall.queue_icon_update() else if(istype(T, /turf/unsimulated/wall)) success = 1 else - for(var/obj/O in T) + for(var/obj/blend_obj in T) for(var/blend_type in get_blend_objects()) - if( istype(O, blend_type)) + if( istype(blend_obj, blend_type)) success = 1 if(success) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 004f0fc02a44..8c44f0f99c0b 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -428,12 +428,12 @@ About the new airlock wires panel: set_airlock_overlays(AIRLOCK_OPENING) flick("opening", src)//[stat ? "_stat":] animating_state = AIRLOCK_OPEN - update_icon() + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon), AIRLOCK_OPEN), 1 SECOND) // wait to update icon so the light doesn't go out too soon if("closing") set_airlock_overlays(AIRLOCK_CLOSING) flick("closing", src) animating_state = AIRLOCK_CLOSED - update_icon() + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon), AIRLOCK_CLOSED), 1 SECOND) // wait to update icon so the light doesn't go out too soon if("deny") set_airlock_overlays(AIRLOCK_DENY) if(density && arePowerSystemsOn()) @@ -441,7 +441,7 @@ About the new airlock wires panel: if(speaker) playsound(loc, open_failure_access_denied, 50, 0) animating_state = AIRLOCK_CLOSED - update_icon() + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon), AIRLOCK_CLOSED), 1 SECOND) // wait to update icon so the light doesn't go out too soon if("emag") set_airlock_overlays(AIRLOCK_EMAG) if(density && arePowerSystemsOn()) @@ -643,8 +643,8 @@ About the new airlock wires panel: var/cut_sound if(IS_WELDER(item)) - var/obj/item/weldingtool/WT = item - if(!WT.weld(0,user)) + var/obj/item/weldingtool/welder = item + if(!welder.weld(0,user)) return FALSE cut_verb = "cutting" cut_sound = 'sound/items/Welder.ogg' @@ -716,13 +716,13 @@ About the new airlock wires panel: src.unlock(1) //force it return TRUE -/obj/machinery/door/airlock/attackby(var/obj/item/C, var/mob/user) +/obj/machinery/door/airlock/attackby(var/obj/item/used_item, var/mob/user) // Brace is considered installed on the airlock, so interacting with it is protected from electrification. - if(brace && (istype(C.GetIdCard(), /obj/item/card/id/) || istype(C, /obj/item/crowbar/brace_jack))) - return brace.attackby(C, user) + if(brace && (istype(used_item.GetIdCard(), /obj/item/card/id/) || istype(used_item, /obj/item/crowbar/brace_jack))) + return brace.attackby(used_item, user) - if(!brace && istype(C, /obj/item/airlock_brace)) - var/obj/item/airlock_brace/A = C + if(!brace && istype(used_item, /obj/item/airlock_brace)) + var/obj/item/airlock_brace/A = used_item if(!density) to_chat(user, SPAN_WARNING("You must close \the [src] before installing \the [A]!")) return TRUE @@ -742,19 +742,19 @@ About the new airlock wires panel: if(src.shock(user, 75)) return TRUE - if(bash(C, user)) + if(bash(used_item, user)) return TRUE if (!repairing && (reason_broken & MACHINE_BROKEN_GENERIC) && src.locked) //bolted and broken - . = cut_bolts(C, user) + . = cut_bolts(used_item, user) if(!.) . = ..() return - if(!repairing && IS_WELDER(C) && !operating && density) - var/obj/item/weldingtool/W = C - if(!W.weld(0,user)) - to_chat(user, SPAN_NOTICE("Your [W.name] doesn't have enough fuel.")) + if(!repairing && IS_WELDER(used_item) && !operating && density) + var/obj/item/weldingtool/welder = used_item + if(!welder.weld(0,user)) + to_chat(user, SPAN_NOTICE("Your [welder.name] doesn't have enough fuel.")) return TRUE playsound(src, 'sound/items/Welder.ogg', 50, 1) user.visible_message(SPAN_WARNING("\The [user] begins welding \the [src] [welded ? "open" : "closed"]!"), @@ -769,11 +769,11 @@ About the new airlock wires panel: to_chat(user, SPAN_NOTICE("You must remain still to complete this task.")) return TRUE - else if(IS_WIRECUTTER(C) || IS_MULTITOOL(C) || istype(C, /obj/item/assembly/signaler)) + else if(IS_WIRECUTTER(used_item) || IS_MULTITOOL(used_item) || istype(used_item, /obj/item/assembly/signaler)) return wires.Interact(user) - else if(IS_CROWBAR(C)) - if(density && !can_open(TRUE) && component_attackby(C, user)) + else if(IS_CROWBAR(used_item)) + if(density && !can_open(TRUE) && component_attackby(used_item, user)) return TRUE else if(!repairing) // Add some minor damage as evidence of forcing. @@ -792,8 +792,8 @@ About the new airlock wires panel: close(1) return TRUE - if(istype(C, /obj/item/bladed/axe/fire) && !arePowerSystemsOn() && !(user.check_intent(I_FLAG_HARM))) - var/obj/item/bladed/axe/fire/F = C + if(istype(used_item, /obj/item/bladed/axe/fire) && !arePowerSystemsOn() && !(user.check_intent(I_FLAG_HARM))) + var/obj/item/bladed/axe/fire/F = used_item if(F.is_held_twohanded(user)) if(locked) to_chat(user, SPAN_WARNING("The airlock's bolts prevent it from being forced.")) @@ -805,16 +805,15 @@ About the new airlock wires panel: close(1) else if(user.can_twohand_item(F)) - to_chat(user, SPAN_WARNING("You need to be holding \the [C] in both hands to do that!")) + to_chat(user, SPAN_WARNING("You need to be holding \the [used_item] in both hands to do that!")) else - to_chat(user, SPAN_WARNING("You are too small to lever \the [src] open with \the [C]!")) + to_chat(user, SPAN_WARNING("You are too small to lever \the [src] open with \the [used_item]!")) return TRUE else if((stat & (BROKEN|NOPOWER)) && isanimal(user)) var/mob/living/simple_animal/A = user - var/obj/item/I = A.get_natural_weapon() - if(I?.expend_attack_force(user) >= 10) + if(used_item?.expend_attack_force(user) >= 10) if(density) visible_message(SPAN_DANGER("\The [A] forces \the [src] open!")) open(1) @@ -890,7 +889,7 @@ About the new airlock wires panel: panel_open = TRUE if(istype(construct_state, /decl/machine_construction/default/panel_closed)) var/decl/machine_construction/default/panel_closed/closed = construct_state - construct_state = closed.down_state + construct_state = GET_DECL(closed.down_state) construct_state.validate_state(src) if (secured_wires) lock() @@ -988,7 +987,8 @@ About the new airlock wires panel: if (lock_cut_state == BOLTS_CUT) return FALSE //what bolts? - src.locked = TRUE + locked = TRUE + locking = FALSE playsound(src, bolts_dropping, 30, 0, -6) audible_message("You hear a click from the bottom of the door.", hearing_distance = 1) update_icon() @@ -996,20 +996,21 @@ About the new airlock wires panel: return TRUE /obj/machinery/door/airlock/proc/unlock(var/forced=0) - if(!src.locked) + if(!locked) return FALSE if (!forced) - if(!src.arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) + if(!arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) return FALSE if(operating) locking = FALSE unlocking = TRUE return FALSE - if(operating || !src.arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) + if(!arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) return FALSE - src.locked = FALSE + locked = FALSE + unlocking = FALSE playsound(src, bolts_rising, 30, 0, -6) audible_message("You hear a click from the bottom of the door.", hearing_distance = 1) update_icon() diff --git a/code/game/machinery/doors/airlock_control.dm b/code/game/machinery/doors/airlock_control.dm index 579e29e33112..c1f9b50ebf6d 100644 --- a/code/game/machinery/doors/airlock_control.dm +++ b/code/game/machinery/doors/airlock_control.dm @@ -181,8 +181,8 @@ /obj/machinery/airlock_sensor/set_id_tag(var/new_id_tag) . = ..() - for(var/obj/item/stock_parts/radio/R in get_all_components_of_type(/obj/item/stock_parts/radio)) - R.set_id_tag(id_tag) + for(var/obj/item/stock_parts/radio/radio in get_all_components_of_type(/obj/item/stock_parts/radio)) + radio.set_id_tag(id_tag) /decl/public_access/public_variable/airlock_pressure expected_type = /obj/machinery/airlock_sensor @@ -331,8 +331,8 @@ /obj/machinery/button/access/set_id_tag(var/new_id_tag) . = ..() - for(var/obj/item/stock_parts/radio/R in get_all_components_of_type(/obj/item/stock_parts/radio)) - R.set_id_tag(id_tag) + for(var/obj/item/stock_parts/radio/radio in get_all_components_of_type(/obj/item/stock_parts/radio)) + radio.set_id_tag(id_tag) // // Button Part Presets diff --git a/code/game/machinery/doors/airlock_interactions.dm b/code/game/machinery/doors/airlock_interactions.dm index 2ad96280a52c..2406735f21a7 100644 --- a/code/game/machinery/doors/airlock_interactions.dm +++ b/code/game/machinery/doors/airlock_interactions.dm @@ -59,8 +59,8 @@ for(var/i in 1 to round(crush_damage/AIRLOCK_CRUSH_INCREMENT, 1)) apply_damage(AIRLOCK_CRUSH_INCREMENT, BRUTE) - set_status(STAT_STUN, round(crush_damage / 8, 1)) - set_status(STAT_WEAK, round(crush_damage / 8, 1)) + set_status_condition(STAT_STUN, round(crush_damage / 8, 1)) + set_status_condition(STAT_WEAK, round(crush_damage / 8, 1)) var/turf/T = loc if(!istype(T)) diff --git a/code/game/machinery/doors/airlock_subtypes.dm b/code/game/machinery/doors/airlock_subtypes.dm index 179b0d35d2c8..b3474720a5f6 100644 --- a/code/game/machinery/doors/airlock_subtypes.dm +++ b/code/game/machinery/doors/airlock_subtypes.dm @@ -163,9 +163,9 @@ name = "Escape Pod" locked = TRUE -/obj/machinery/door/airlock/external/escapepod/attackby(obj/item/C, mob/user) +/obj/machinery/door/airlock/external/escapepod/attackby(obj/item/used_item, mob/user) if(panel_open && !arePowerSystemsOn()) - if(IS_WRENCH(C)) + if(IS_WRENCH(used_item)) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user.visible_message(SPAN_WARNING("[user.name] starts frantically pumping the bolt override mechanism!"), SPAN_WARNING("You start frantically pumping the bolt override mechanism!")) if(do_after(user, 160) && locked) diff --git a/code/game/machinery/doors/blast_door.dm b/code/game/machinery/doors/blast_door.dm index 1fc6bb6afe3a..ca111e877bcf 100644 --- a/code/game/machinery/doors/blast_door.dm +++ b/code/game/machinery/doors/blast_door.dm @@ -142,13 +142,13 @@ return implicit_material // Proc: attackby() -// Parameters: 2 (C - Item this object was clicked with, user - Mob which clicked this object) +// Parameters: 2 (used_item - Item this object was clicked with, user - Mob which clicked this object) // Description: If we are clicked with crowbar or wielded fire axe, try to manually open the door. // This only works on broken doors or doors without power. Also allows repair with Plasteel. -/obj/machinery/door/blast/attackby(obj/item/C, mob/user) - add_fingerprint(user, 0, C) +/obj/machinery/door/blast/attackby(obj/item/used_item, mob/user) + add_fingerprint(user, 0, used_item) if(!panel_open) //Do this here so the door won't change state while prying out the circuit - if(IS_CROWBAR(C) || (istype(C, /obj/item/bladed/axe/fire) && C.is_held_twohanded())) + if(IS_CROWBAR(used_item) || (istype(used_item, /obj/item/bladed/axe/fire) && used_item.is_held_twohanded())) if(((stat & NOPOWER) || (stat & BROKEN)) && !( operating )) to_chat(user, "You begin prying at \the [src]...") if(do_after(user, 2 SECONDS, src)) @@ -158,18 +158,18 @@ else to_chat(user, "[src]'s motors resist your effort.") return TRUE - if(istype(C, /obj/item/stack/material) && C.get_material_type() == /decl/material/solid/metal/plasteel) + if(istype(used_item, /obj/item/stack/material) && used_item.get_material_type() == /decl/material/solid/metal/plasteel) var/amt = ceil((get_max_health() - current_health)/150) if(!amt) to_chat(user, "\The [src] is already fully functional.") return TRUE - var/obj/item/stack/P = C - if(!P.can_use(amt)) + var/obj/item/stack/stack = used_item + if(!stack.can_use(amt)) to_chat(user, "You don't have enough sheets to repair this! You need at least [amt] sheets.") return TRUE to_chat(user, "You begin repairing \the [src]...") if(do_after(user, 5 SECONDS, src)) - if(P.use(amt)) + if(stack.use(amt)) to_chat(user, "You have repaired \the [src].") repair() else diff --git a/code/game/machinery/doors/braces.dm b/code/game/machinery/doors/braces.dm index 137c4cddb4f1..92846b45c43d 100644 --- a/code/game/machinery/doors/braces.dm +++ b/code/game/machinery/doors/braces.dm @@ -68,12 +68,12 @@ /obj/item/airlock_brace/attack_self(mob/user) electronics.attack_self(user) -/obj/item/airlock_brace/attackby(obj/item/W, mob/user) - if (istype(W.GetIdCard(), /obj/item/card/id)) +/obj/item/airlock_brace/attackby(obj/item/used_item, mob/user) + if (istype(used_item.GetIdCard(), /obj/item/card/id)) if(!airlock) return attack_self(user) else - var/obj/item/card/id/C = W.GetIdCard() + var/obj/item/card/id/C = used_item.GetIdCard() if(check_access(C)) to_chat(user, "You swipe \the [C] through \the [src].") if(do_after(user, 10, airlock)) @@ -83,18 +83,18 @@ to_chat(user, "You swipe \the [C] through \the [src], but it does not react.") return TRUE - if (istype(W, /obj/item/crowbar/brace_jack)) + if (istype(used_item, /obj/item/crowbar/brace_jack)) if(!airlock) return FALSE - var/obj/item/crowbar/brace_jack/C = W + var/obj/item/crowbar/brace_jack/C = used_item to_chat(user, "You begin forcibly removing \the [src] with \the [C].") if(do_after(user, rand(150,300), airlock)) to_chat(user, "You finish removing \the [src].") unlock_brace(user) return TRUE - if(IS_WELDER(W)) - var/obj/item/weldingtool/C = W + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/C = used_item if(!is_damaged()) to_chat(user, "\The [src] does not require repairs.") return TRUE diff --git a/code/game/machinery/doors/double.dm b/code/game/machinery/doors/double.dm index 1cd2c99b2669..4bfc77f73631 100644 --- a/code/game/machinery/doors/double.dm +++ b/code/game/machinery/doors/double.dm @@ -58,10 +58,10 @@ if( istype(T, /turf/wall)) success = 1 if(propagate) - var/turf/wall/W = T - W.wall_connections = null - W.other_connections = null - W.queue_icon_update() + var/turf/wall/wall = T + wall.wall_connections = null + wall.other_connections = null + wall.queue_icon_update() else for(var/obj/O in T) for(var/blend_type in get_blend_objects()) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 673d87c5bdde..732b04b47d39 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -217,19 +217,19 @@ nextstate = FIREDOOR_CLOSED close() -/obj/machinery/door/firedoor/attackby(obj/item/C, mob/user) - add_fingerprint(user, 0, C) +/obj/machinery/door/firedoor/attackby(obj/item/used_item, mob/user) + add_fingerprint(user, 0, used_item) if(operating) return TRUE //Already doing something. - if(IS_WELDER(C) && !repairing) - var/obj/item/weldingtool/W = C - if(W.weld(0, user)) + if(IS_WELDER(used_item) && !repairing) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0, user)) playsound(src, 'sound/items/Welder.ogg', 100, 1) if(do_after(user, 2 SECONDS, src)) - if(!W.isOn()) return TRUE + if(!welder.isOn()) return TRUE blocked = !blocked - user.visible_message("\The [user] [blocked ? "welds" : "unwelds"] \the [src] with \a [W].",\ - "You [blocked ? "weld" : "unweld"] \the [src] with \the [W].",\ + user.visible_message("\The [user] [blocked ? "welds" : "unwelds"] \the [src] with \a [welder].",\ + "You [blocked ? "weld" : "unweld"] \the [src] with \the [welder].",\ "You hear something being welded.") playsound(src, 'sound/items/Welder.ogg', 100, 1) update_icon() @@ -237,33 +237,33 @@ to_chat(user, SPAN_WARNING("You must remain still to complete this task.")) return TRUE - if(blocked && IS_CROWBAR(C)) - user.visible_message("\The [user] pries at \the [src] with \a [C], but \the [src] is welded in place!",\ + if(blocked && IS_CROWBAR(used_item)) + user.visible_message("\The [user] pries at \the [src] with \a [used_item], but \the [src] is welded in place!",\ "You try to pry \the [src] [density ? "open" : "closed"], but it is welded in place!",\ "You hear someone struggle and metal straining.") return TRUE - if(!blocked && (IS_CROWBAR(C) || istype(C,/obj/item/bladed/axe/fire))) + if(!blocked && (IS_CROWBAR(used_item) || istype(used_item,/obj/item/bladed/axe/fire))) if(operating) return ..() - if(istype(C,/obj/item/bladed/axe/fire)) - var/obj/item/bladed/axe/fire/F = C + if(istype(used_item,/obj/item/bladed/axe/fire)) + var/obj/item/bladed/axe/fire/F = used_item if(!F.is_held_twohanded()) return ..() - user.visible_message("\The [user] starts to force \the [src] [density ? "open" : "closed"] with \a [C]!",\ - "You start forcing \the [src] [density ? "open" : "closed"] with \the [C]!",\ + user.visible_message("\The [user] starts to force \the [src] [density ? "open" : "closed"] with \a [used_item]!",\ + "You start forcing \the [src] [density ? "open" : "closed"] with \the [used_item]!",\ "You hear metal strain.") if(do_after(user, 3 SECONDS, src)) - if(IS_CROWBAR(C)) + if(IS_CROWBAR(used_item)) if(stat & (BROKEN|NOPOWER) || !density) - user.visible_message("\The [user] forces \the [src] [density ? "open" : "closed"] with \a [C]!",\ - "You force \the [src] [density ? "open" : "closed"] with \the [C]!",\ + user.visible_message("\The [user] forces \the [src] [density ? "open" : "closed"] with \a [used_item]!",\ + "You force \the [src] [density ? "open" : "closed"] with \the [used_item]!",\ "You hear metal strain, and a door [density ? "open" : "close"].") else - user.visible_message("\The [user] forces \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \a [C]!",\ - "You force \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \the [C]!",\ + user.visible_message("\The [user] forces \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \a [used_item]!",\ + "You force \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \the [used_item]!",\ "You hear metal strain and groan, and a door [density ? "opening" : "closing"].") if(density) open(1) @@ -348,7 +348,7 @@ panel_open = FALSE if(istype(construct_state, /decl/machine_construction/default/panel_open)) var/decl/machine_construction/default/panel_open/open = construct_state - construct_state = open.up_state + construct_state = GET_DECL(open.up_state) construct_state.validate_state(src) visible_message("The maintenance hatch of \the [src] closes.") update_icon() @@ -377,10 +377,10 @@ ATMOS_CANPASS_TURF(airblock, neighbour, myturf) if(airblock & AIR_BLOCKED) continue - for(var/obj/O in myturf) - if(istype(O, /obj/machinery/door)) + for(var/obj/thing in myturf) + if(istype(thing, /obj/machinery/door)) continue - ATMOS_CANPASS_MOVABLE(airblock, O, neighbour) + ATMOS_CANPASS_MOVABLE(airblock, thing, neighbour) . |= airblock if(. & AIR_BLOCKED) continue diff --git a/code/game/machinery/doors/firedoor_assembly.dm b/code/game/machinery/doors/firedoor_assembly.dm index bc3dcf1ab404..a861aa14a7db 100644 --- a/code/game/machinery/doors/firedoor_assembly.dm +++ b/code/game/machinery/doors/firedoor_assembly.dm @@ -10,19 +10,19 @@ var/result = /obj/machinery/door/firedoor -/obj/structure/firedoor_assembly/attackby(var/obj/item/C, var/mob/user) +/obj/structure/firedoor_assembly/attackby(var/obj/item/used_item, var/mob/user) . = ..() - if(!. && istype(C, /obj/item/stock_parts/circuitboard/airlock_electronics/firedoor) && wired) + if(!. && istype(used_item, /obj/item/stock_parts/circuitboard/airlock_electronics/firedoor) && wired) if(!anchored) to_chat(user, SPAN_WARNING("You must secure \the [src] first!")) else - if(!user.try_unequip(C, src)) + if(!user.try_unequip(used_item, src)) return playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) visible_message(SPAN_NOTICE("\The [user] inserts a circuit into \the [src].")) var/obj/machinery/door/firedoor/D = new result(get_turf(src), dir, FALSE) - var/obj/item/stock_parts/circuitboard/airlock_electronics/firedoor/electronics = C - D.install_component(C) + var/obj/item/stock_parts/circuitboard/airlock_electronics/firedoor/electronics = used_item + D.install_component(used_item) electronics.construct(D) D.construct_state.post_construct(D) D.close() diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index e6366bcc0a0f..f39b5849a088 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -171,12 +171,12 @@ /obj/machinery/door/window/CanFluidPass(var/coming_from) return !density || ((dir in global.cardinal) && coming_from != dir) -/obj/machinery/door/window/attackby(obj/item/I, mob/user) +/obj/machinery/door/window/attackby(obj/item/used_item, mob/user) //If it's in the process of opening/closing, ignore the click if(operating) return TRUE - if(bash(I, user)) + if(bash(used_item, user)) return TRUE . = ..() diff --git a/code/game/machinery/embedded_controller/airlock_docking_controller.dm b/code/game/machinery/embedded_controller/airlock_docking_controller.dm index 026318090b40..0605e8f0ff8e 100644 --- a/code/game/machinery/embedded_controller/airlock_docking_controller.dm +++ b/code/game/machinery/embedded_controller/airlock_docking_controller.dm @@ -12,15 +12,15 @@ var/datum/computer/file/embedded_program/docking/airlock/docking_program = program docking_program.display_name = display_name -/obj/machinery/embedded_controller/radio/airlock/docking_port/attackby(obj/item/W, mob/user) - if(IS_MULTITOOL(W)) //give them part of code, would take few tries to get full +/obj/machinery/embedded_controller/radio/airlock/docking_port/attackby(obj/item/used_item, mob/user) + if(IS_MULTITOOL(used_item)) //give them part of code, would take few tries to get full var/datum/computer/file/embedded_program/docking/airlock/docking_program = program var/code = docking_program.docking_codes if(!code) code = "N/A" else code = stars(code) - to_chat(user,"[W]'s screen displays '[code]'") + to_chat(user,"[used_item]'s screen displays '[code]'") return TRUE else return ..() diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index eeef5d6c7deb..edd7f125381e 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -35,9 +35,9 @@ // src.sd_SetLuminosity(0) //Don't want to render prison breaks impossible -/obj/machinery/flasher/attackby(obj/item/W, mob/user) - if(IS_WIRECUTTER(W)) - add_fingerprint(user, 0, W) +/obj/machinery/flasher/attackby(obj/item/used_item, mob/user) + if(IS_WIRECUTTER(used_item)) + add_fingerprint(user, 0, used_item) src.disable = !src.disable if (src.disable) user.visible_message("[user] has disconnected \the [src]'s flashbulb!", "You disconnect \the [src]'s flashbulb!") @@ -71,30 +71,7 @@ continue var/flash_time = strength - if(isliving(viewer)) - if(viewer.eyecheck() > FLASH_PROTECTION_NONE) - continue - if(ishuman(viewer)) - var/mob/living/human/H = viewer - flash_time = round(H.get_flash_mod() * flash_time) - if(flash_time <= 0) - return - var/vision_organ_tag = H.get_vision_organ_tag() - if(vision_organ_tag) - var/obj/item/organ/internal/organ = GET_INTERNAL_ORGAN(H, vision_organ_tag) - if(organ && organ.is_bruised() && prob(organ.get_organ_damage() + 50)) - H.flash_eyes() - organ.adjust_organ_damage(rand(1, 5)) - - if(!viewer.is_blind()) - do_flash(viewer, flash_time) - -/obj/machinery/flasher/proc/do_flash(var/mob/living/victim, var/flash_time) - victim.flash_eyes() - ADJ_STATUS(victim, STAT_BLURRY, flash_time) - ADJ_STATUS(victim, STAT_CONFUSE, flash_time + 2) - SET_STATUS_MAX(victim, STAT_STUN, flash_time / 2) - SET_STATUS_MAX(victim, STAT_WEAK, 3) + viewer.handle_flashed(flash_time) /obj/machinery/flasher/emp_act(severity) if(stat & (BROKEN|NOPOWER)) @@ -109,6 +86,7 @@ desc = "A portable flashing device. Wrench to activate and deactivate. Cannot detect slow movements." icon_state = "pflash1" icon = 'icons/obj/machines/flash_portable.dmi' + directional_offset = @'{"NORTH":{"y":0}, "SOUTH":{"y":0}, "EAST":{"x":0}, "WEST":{"x":0}}' strength = 8 anchored = FALSE base_state = "pflash" @@ -123,8 +101,8 @@ if(!MOVING_DELIBERATELY(M)) flash() -/obj/machinery/flasher/portable/attackby(obj/item/W, mob/user) - if(IS_WRENCH(W)) +/obj/machinery/flasher/portable/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item)) add_fingerprint(user) src.anchored = !src.anchored diff --git a/code/game/machinery/floor_light.dm b/code/game/machinery/floor_light.dm index b6fefd1fe27b..c9c4e8571b5f 100644 --- a/code/game/machinery/floor_light.dm +++ b/code/game/machinery/floor_light.dm @@ -29,28 +29,28 @@ var/global/list/floor_light_cache = list() . = ..() update_icon() -/obj/machinery/floor_light/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/floor_light/attackby(var/obj/item/used_item, var/mob/user) - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) anchored = !anchored if(use_power) update_use_power(POWER_USE_OFF) visible_message(SPAN_NOTICE("\The [user] has [anchored ? "attached" : "detached"] \the [src].")) return TRUE - if(IS_WELDER(W) && (damaged || (stat & BROKEN))) - var/obj/item/weldingtool/WT = W - if(!WT.weld(0, user)) + if(IS_WELDER(used_item) && (damaged || (stat & BROKEN))) + var/obj/item/weldingtool/welder = used_item + if(!welder.weld(0, user)) to_chat(user, SPAN_WARNING("\The [src] must be on to complete this task.")) return TRUE playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) - if(do_after(user, 20, src) && !QDELETED(src) && WT.isOn()) + if(do_after(user, 20, src) && !QDELETED(src) && welder.isOn()) visible_message(SPAN_NOTICE("\The [user] has repaired \the [src].")) set_broken(FALSE) damaged = null return TRUE - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) to_chat(user, SPAN_NOTICE("You dismantle the floor light.")) SSmaterials.create_object(/decl/material/solid/metal/steel, loc, 1) @@ -58,7 +58,7 @@ var/global/list/floor_light_cache = list() qdel(src) return TRUE - if(W.get_attack_force(user) && user.check_intent(I_FLAG_HARM)) + if(used_item.get_attack_force(user) && user.check_intent(I_FLAG_HARM)) return physical_attack_hand(user) return ..() diff --git a/code/game/machinery/floorlayer.dm b/code/game/machinery/floorlayer.dm index ea04c68ba826..92b6260ce5b6 100644 --- a/code/game/machinery/floorlayer.dm +++ b/code/game/machinery/floorlayer.dm @@ -35,23 +35,23 @@ user.visible_message("[user] has [!on?"de":""]activated \the [src].", "You [!on?"de":""]activate \the [src].") return TRUE -/obj/machinery/floorlayer/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/floorlayer/attackby(var/obj/item/used_item, var/mob/user) - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) var/m = input("Choose work mode", "Mode") as null|anything in mode mode[m] = !mode[m] var/O = mode[m] user.visible_message("[user] has set \the [src] [m] mode [!O?"off":"on"].", "You set \the [src] [m] mode [!O?"off":"on"].") return TRUE - if(istype(W, /obj/item/stack/tile)) - if(!user.try_unequip(W, T)) + if(istype(used_item, /obj/item/stack/tile)) + if(!user.try_unequip(used_item, T)) return TRUE - to_chat(user, "\The [W] successfully loaded.") + to_chat(user, "\The [used_item] successfully loaded.") TakeTile(T) return TRUE - if(IS_CROWBAR(W)) + if(IS_CROWBAR(used_item)) if(!length(contents)) to_chat(user, "\The [src] is empty.") else @@ -62,7 +62,7 @@ T = null return TRUE - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) T = input("Choose tile type.", "Tiles") as null|anything in contents return TRUE return ..() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index ce3c79b45d88..7145a9762c51 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -348,7 +348,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ end_call() if (caller_id&&sourcepad) if(caller_id.loc!=sourcepad.loc) - sourcepad.to_chat(caller_id, "Severing connection to distant holopad.") + to_chat(sourcepad.caller_id, "Severing connection to distant holopad.") end_call() audible_message("The connection has been terminated by the caller.") return 1 diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 26a071ea6aef..176f286e06bb 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -119,14 +119,14 @@ else icon_state = "[base_state]-p" -/obj/machinery/sparker/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/machinery/sparker/attackby(obj/item/used_item, mob/user) + if(panel_open && IS_WIRECUTTER(used_item)) add_fingerprint(user) disable = !disable if(disable) - user.visible_message("[user] has disabled \the [src]!", "You disable the connection to \the [src].") - else if(!disable) - user.visible_message("[user] has reconnected \the [src]!", "You fix the connection to \the [src].") + user.visible_message(SPAN_WARNING("[user] has disabled \the [src]!"), SPAN_WARNING("You disable the connection to \the [src].")) + else + user.visible_message(SPAN_WARNING("[user] has reconnected \the [src]!"), SPAN_WARNING("You fix the connection to \the [src].")) update_icon() return TRUE else diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index 1fb6b7666b72..530e66903cbb 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -126,7 +126,7 @@ var/mob/living/human/H = M if(H.get_sound_volume_multiplier() < 0.2) continue - M.set_status(STAT_ASLEEP, 0) + M.set_status_condition(STAT_ASLEEP, 0) ADJ_STATUS(M, STAT_STUTTER, 20) SET_STATUS_MAX(M, STAT_DEAF, 30) SET_STATUS_MAX(M, STAT_WEAK, 3) @@ -134,7 +134,7 @@ SET_STATUS_MAX(M, STAT_STUN, 10) SET_STATUS_MAX(M, STAT_PARA, 4) else - M.set_status(STAT_JITTER, 400) + M.set_status_condition(STAT_JITTER, 400) spawn(15) explode() @@ -152,10 +152,10 @@ new /obj/effect/decal/cleanable/blood/oil(src.loc) qdel(src) -/obj/machinery/media/jukebox/attackby(obj/item/W, mob/user) - if((IS_WRENCH(W) || IS_HAMMER(W)) && !panel_open) +/obj/machinery/media/jukebox/attackby(obj/item/used_item, mob/user) + if((IS_WRENCH(used_item) || IS_HAMMER(used_item)) && !panel_open) add_fingerprint(user) - wrench_floor_bolts(user, 0, W) + wrench_floor_bolts(user, 0, used_item) power_change() return TRUE return ..() diff --git a/code/game/machinery/kitchen/cooking_machines/_cooker.dm b/code/game/machinery/kitchen/cooking_machines/_cooker.dm index 699f0670a3b1..a340029c6599 100644 --- a/code/game/machinery/kitchen/cooking_machines/_cooker.dm +++ b/code/game/machinery/kitchen/cooking_machines/_cooker.dm @@ -65,14 +65,14 @@ return TRUE -/obj/machinery/cooker/attackby(var/obj/item/I, var/mob/user) +/obj/machinery/cooker/attackby(var/obj/item/used_item, var/mob/user) set waitfor = 0 //So that any remaining parts of calling proc don't have to wait for the long cooking time ahead. if(cooking) to_chat(user, "\The [src] is running!") return TRUE - if((. = component_attackby(I, user))) + if((. = component_attackby(used_item, user))) return if(!cook_type || (stat & (NOPOWER|BROKEN))) @@ -80,7 +80,7 @@ return TRUE // We're trying to cook something else. Check if it's valid. - var/obj/item/food/check = I + var/obj/item/food/check = used_item if(istype(check) && islist(check.cooked) && (cook_type in check.cooked)) to_chat(user, "\The [check] has already been [cook_type].") return TRUE @@ -100,12 +100,12 @@ M.apply_damage(rand(30,40), BURN, BP_CHEST) // Not sure why a food item that passed the previous checks would fail to drop, but safety first. - if(!user.try_unequip(I)) + if(!user.try_unequip(used_item)) return TRUE // We can actually start cooking now. - user.visible_message("\The [user] puts \the [I] into \the [src].") - cooking_obj = I + user.visible_message("\The [user] puts \the [used_item] into \the [src].") + cooking_obj = used_item cooking_obj.forceMove(src) cooking = 1 icon_state = on_icon diff --git a/code/game/machinery/kitchen/gibber.dm b/code/game/machinery/kitchen/gibber.dm index aa537a6a9965..4a68783d0305 100644 --- a/code/game/machinery/kitchen/gibber.dm +++ b/code/game/machinery/kitchen/gibber.dm @@ -9,7 +9,7 @@ initial_access = list(list(access_kitchen, access_morgue)) construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 + stat_immune = NOSCREEN var/operating = 0 //Is it on? var/dirty = 0 // Does it need cleaning? @@ -79,11 +79,11 @@ to_chat(user, SPAN_DANGER("You need a better grip to do that!")) return TRUE -/obj/machinery/gibber/attackby(var/obj/item/W, var/mob/user) - if(!operating && istype(W, /obj/item/organ)) - if(user.try_unequip(W)) - qdel(W) - user.visible_message(SPAN_DANGER("\The [user] feeds \the [W] into \the [src], obliterating it.")) +/obj/machinery/gibber/attackby(var/obj/item/used_item, var/mob/user) + if(!operating && istype(used_item, /obj/item/organ)) + if(user.try_unequip(used_item)) + qdel(used_item) + user.visible_message(SPAN_DANGER("\The [user] feeds \the [used_item] into \the [src], obliterating it.")) return TRUE return ..() diff --git a/code/game/machinery/kitchen/icecream.dm b/code/game/machinery/kitchen/icecream.dm index cd751f4d64af..9671e16e3614 100644 --- a/code/game/machinery/kitchen/icecream.dm +++ b/code/game/machinery/kitchen/icecream.dm @@ -100,15 +100,13 @@ dat += "Chocolate cones: Dispense Make x5 [product_types[CONE_CHOC]] cones left. (Ingredients: flour, sugar, coco powder)
" dat += "
" dat += "VAT CONTENT
" - for(var/liquid_type in reagents?.liquid_volumes) - var/decl/material/R = GET_DECL(liquid_type) - dat += "[R.get_reagent_name(reagents, MAT_PHASE_LIQUID)]: [LIQUID_VOLUME(reagents, liquid_type)]" - dat += "Purge
" + for(var/decl/material/reagent as anything in reagents?.liquid_volumes) + dat += "[reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID)]: [LIQUID_VOLUME(reagents, reagent)]" + dat += "Purge
" - for(var/solid_type in reagents?.solid_volumes) - var/decl/material/R = GET_DECL(solid_type) - dat += "[R.get_reagent_name(reagents, MAT_PHASE_SOLID)]: [SOLID_VOLUME(reagents, solid_type)]" - dat += "Purge
" + for(var/decl/material/reagent as anything in reagents?.solid_volumes) + dat += "[reagent.get_reagent_name(reagents, MAT_PHASE_SOLID)]: [SOLID_VOLUME(reagents, reagent)]" + dat += "Purge
" dat += "Refresh Close" @@ -116,37 +114,37 @@ popup.set_content(dat) popup.open() -/obj/machinery/icecream_vat/attackby(var/obj/item/O, var/mob/user) - if(istype(O, /obj/item/food/icecream)) - var/obj/item/food/icecream/I = O - if(!I.ice_creamed) +/obj/machinery/icecream_vat/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/food/icecream)) + var/obj/item/food/icecream/icecream = used_item + if(!icecream.ice_creamed) if(product_types[dispense_flavour] > 0) - src.visible_message("[html_icon(src)] [user] scoops delicious [flavour_name] icecream into [I].") + src.visible_message("[html_icon(src)] [user] scoops delicious [flavour_name] icecream into [icecream].") product_types[dispense_flavour] -= 1 - I.add_ice_cream(flavour_name) + icecream.add_ice_cream(flavour_name) // if(beaker) - // beaker.reagents.trans_to(I, 10) - if(I.reagents.total_volume < 10) - I.add_to_reagents(/decl/material/liquid/nutriment/sugar, 10 - I.reagents.total_volume) + // beaker.reagents.trans_to(icecream, 10) + if(icecream.reagents.total_volume < 10) + icecream.add_to_reagents(/decl/material/liquid/nutriment/sugar, 10 - icecream.reagents.total_volume) else to_chat(user, "There is not enough icecream left!") else - to_chat(user, "[O] already has icecream in it.") + to_chat(user, "[used_item] already has icecream in it.") return TRUE - else if(ATOM_IS_OPEN_CONTAINER(O)) + else if(ATOM_IS_OPEN_CONTAINER(used_item)) return TRUE else return ..() /obj/machinery/icecream_vat/proc/make(var/mob/user, var/make_type, var/amount) - for(var/R in get_ingredient_list(make_type)) - if(reagents.has_reagent(R, amount)) + for(var/reagent in get_ingredient_list(make_type)) + if(reagents.has_reagent(reagent, amount)) continue amount = 0 break if(amount) - for(var/R in get_ingredient_list(make_type)) - remove_from_reagents(R, amount) + for(var/reagent in get_ingredient_list(make_type)) + remove_from_reagents(reagent, amount) product_types[make_type] += amount var/flavour = get_flavour_name(make_type) if(make_type > 6) @@ -172,10 +170,10 @@ var/cone_name = get_flavour_name(dispense_cone) if(product_types[dispense_cone] >= 1) product_types[dispense_cone] -= 1 - var/obj/item/food/icecream/I = new(src.loc) - I.cone_type = cone_name - I.icon_state = "icecream_cone_[cone_name]" - I.desc = "Delicious [cone_name] cone, but no ice cream." + var/obj/item/food/icecream/icecream = new(src.loc) + icecream.cone_type = cone_name + icecream.icon_state = "icecream_cone_[cone_name]" + icecream.desc = "Delicious [cone_name] cone, but no ice cream." src.visible_message("[user] dispenses a crunchy [cone_name] cone from [src].") else to_chat(user, "There are no [cone_name] cones left!") @@ -188,9 +186,9 @@ . = TOPIC_REFRESH else if(href_list["disposeI"]) - var/decl/material/R = locate(href_list["disposeI"]) - if(R) - reagents.clear_reagent(R.type) + var/decl/material/reagent = locate(href_list["disposeI"]) + if(reagent) + reagents.clear_reagent(reagent.type) . = TOPIC_REFRESH if(href_list["refresh"]) diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index 886b8ce43997..f1b754a8920e 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -53,9 +53,9 @@ to_chat(user, SPAN_WARNING("This is ridiculous. You can not fit \the [grab.affecting] into \the [src].")) return TRUE -/obj/machinery/microwave/attackby(var/obj/item/O, var/mob/user) +/obj/machinery/microwave/attackby(var/obj/item/used_item, var/mob/user) if(broken > 0) - if(broken == 2 && IS_SCREWDRIVER(O)) // If it's broken and they're using a screwdriver + if(broken == 2 && IS_SCREWDRIVER(used_item)) // If it's broken and they're using a screwdriver user.visible_message( SPAN_NOTICE("\The [user] starts to fix part of [src]."), SPAN_NOTICE("You start to fix part of [src].") @@ -66,7 +66,7 @@ SPAN_NOTICE("You have fixed part of [src].") ) broken = 1 // Fix it a bit - else if(broken == 1 && IS_WRENCH(O)) // If it's broken and they're doing the wrench + else if(broken == 1 && IS_WRENCH(used_item)) // If it's broken and they're doing the wrench user.visible_message( SPAN_NOTICE("\The [user] starts to fix part of [src]."), SPAN_NOTICE("You start to fix part of [src].") @@ -83,11 +83,11 @@ else to_chat(user, SPAN_WARNING("It's broken!")) return 1 - else if((. = component_attackby(O, user))) + else if((. = component_attackby(used_item, user))) dispose() return else if(dirty==100) // The microwave is all dirty so can't be used! - if(istype(O, /obj/item/chems/spray/cleaner) || istype(O, /obj/item/chems/rag)) // If they're trying to clean it then let them + if(istype(used_item, /obj/item/chems/spray/cleaner) || istype(used_item, /obj/item/chems/rag)) // If they're trying to clean it then let them user.visible_message( SPAN_NOTICE("\The [user] starts to clean [src]."), SPAN_NOTICE("You start to clean [src].") @@ -104,11 +104,11 @@ else //Otherwise bad luck!! to_chat(user, SPAN_WARNING("It's dirty!")) return 1 - else if(!istype(O, /obj/item/chems/glass/bowl) && (istype(O,/obj/item/chems/glass) || istype(O,/obj/item/chems/drinks) || istype(O,/obj/item/chems/condiment) )) - if (!O.reagents) + else if(!istype(used_item, /obj/item/chems/glass/bowl) && (istype(used_item,/obj/item/chems/glass) || istype(used_item,/obj/item/chems/drinks) || istype(used_item,/obj/item/chems/condiment) )) + if (!used_item.reagents) return 1 return // transfer is handled in afterattack - else if(IS_WRENCH(O)) + else if(IS_WRENCH(used_item)) user.visible_message( SPAN_NOTICE("\The [user] begins [anchored ? "securing" : "unsecuring"] [src]."), SPAN_NOTICE("You attempt to [anchored ? "secure" : "unsecure"] [src].") @@ -121,32 +121,32 @@ ) else to_chat(user, SPAN_NOTICE("You decide not to do that.")) - else if(O.w_class <= ITEM_SIZE_LARGE) // this must be last + else if(used_item.w_class <= ITEM_SIZE_LARGE) // this must be last if (LAZYLEN(get_contained_external_atoms()) >= max_n_of_items) to_chat(user, SPAN_WARNING("This [src] is full of ingredients, you cannot put more.")) return 1 - if(istype(O, /obj/item/stack)) // This is bad, but I can't think of how to change it - var/obj/item/stack/S = O + if(istype(used_item, /obj/item/stack)) // This is bad, but I can't think of how to change it + var/obj/item/stack/S = used_item if(S.get_amount() > 1) var/obj/item/stack/new_stack = S.split(1) if(new_stack) new_stack.forceMove(src) user.visible_message( SPAN_NOTICE("\The [user] has added \a [new_stack.singular_name] to \the [src]."), - SPAN_NOTICE("You add one of [O] to \the [src].") + SPAN_NOTICE("You add one of [used_item] to \the [src].") ) SSnano.update_uis(src) return - if (!user.try_unequip(O, src)) + if (!user.try_unequip(used_item, src)) return user.visible_message( - SPAN_NOTICE("\The [user] has added \the [O] to \the [src]."), - SPAN_NOTICE("You add \the [O] to \the [src].") + SPAN_NOTICE("\The [user] has added \the [used_item] to \the [src]."), + SPAN_NOTICE("You add \the [used_item] to \the [src].") ) SSnano.update_uis(src) return else - to_chat(user, SPAN_WARNING("You have no idea what you can cook with \the [O].")) + to_chat(user, SPAN_WARNING("You have no idea what you can cook with \the [used_item].")) SSnano.update_uis(src) /obj/machinery/microwave/components_are_accessible(path) @@ -176,12 +176,11 @@ . = ..() var/data = list() data["cooking_items"] = list() - for(var/obj/O in get_contained_external_atoms()) - data["cooking_items"][O.name]++ + for(var/obj/used_item in get_contained_external_atoms()) + data["cooking_items"][used_item.name]++ data["cooking_reagents"] = list() - for(var/material_type in reagents.reagent_volumes) - var/decl/material/mat = GET_DECL(material_type) - data["cooking_reagents"][mat.name] = reagents.reagent_volumes[material_type] + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + data["cooking_reagents"][reagent.name] = reagents.reagent_volumes[reagent] data["on"] = !!operating data["broken"] = broken > 0 data["dirty"] = dirty >= 100 @@ -278,8 +277,8 @@ SSnano.update_uis(src) /obj/machinery/microwave/proc/has_extra_item() - for(var/obj/O in get_contained_external_atoms()) - if(!istype(O,/obj/item/food)) + for(var/obj/thing in get_contained_external_atoms()) + if(!istype(thing,/obj/item/food)) return TRUE return FALSE @@ -349,8 +348,8 @@ var/list/ingredients = get_contained_external_atoms() if (!LAZYLEN(ingredients) && !reagents.total_volume) return - for (var/obj/O in ingredients) - O.dropInto(loc) + for (var/obj/thing in ingredients) + thing.dropInto(loc) if (reagents.total_volume) dirty++ reagents.clear_reagents() @@ -358,31 +357,30 @@ to_chat(user, SPAN_NOTICE("You empty [src].")) SSnano.update_uis(src) -/obj/machinery/microwave/proc/eject_item(var/mob/user, var/obj/O, var/message = TRUE) - if(!istype(O) || !length(get_contained_external_atoms())) +/obj/machinery/microwave/proc/eject_item(var/mob/user, var/obj/thing, var/message = TRUE) + if(!istype(thing) || !length(get_contained_external_atoms())) return - O.dropInto(loc) + thing.dropInto(loc) if(user && message) - to_chat(user, SPAN_NOTICE("You remove [O] from [src].")) + to_chat(user, SPAN_NOTICE("You remove [thing] from [src].")) SSnano.update_uis(src) -/obj/machinery/microwave/proc/eject_reagent(var/mob/user, var/material_type) - if(!reagents.reagent_volumes[material_type]) +/obj/machinery/microwave/proc/eject_reagent(var/mob/user, var/decl/material/reagent) + if(!reagents.reagent_volumes[reagent]) SSnano.update_uis(src) return // should not happen, must be a UI glitch or href hacking var/obj/item/chems/held_container = user.get_active_held_item() - var/decl/material/M = GET_DECL(material_type) if(istype(held_container)) - var/amount_to_move = min(REAGENTS_FREE_SPACE(held_container.reagents), REAGENT_VOLUME(reagents, material_type)) + var/amount_to_move = min(REAGENTS_FREE_SPACE(held_container.reagents), REAGENT_VOLUME(reagents, reagent)) if(amount_to_move <= 0) to_chat(user, SPAN_WARNING("[held_container] is full!")) return - to_chat(user, SPAN_NOTICE("You empty [amount_to_move] units of [M.name] into [held_container].")) - reagents.trans_type_to(held_container, material_type, amount_to_move) + to_chat(user, SPAN_NOTICE("You empty [amount_to_move] units of [reagent.name] into [held_container].")) + reagents.trans_type_to(held_container, reagent, amount_to_move) else - to_chat(user, SPAN_NOTICE("You try to dump out the [M.name], but it gets all over [src] because you have nothing to put it in.")) + to_chat(user, SPAN_NOTICE("You try to dump out the [reagent.name], but it gets all over [src] because you have nothing to put it in.")) dirty++ - reagents.clear_reagent(material_type) + reagents.clear_reagent(reagent) SSnano.update_uis(src) /obj/machinery/microwave/on_update_icon() @@ -403,11 +401,11 @@ M.death() qdel(M) - for (var/obj/O in ingredients) + for (var/obj/thing in ingredients) amount++ - if (O.reagents && O.reagents.primary_reagent) - amount += REAGENT_VOLUME(O.reagents, O.reagents.primary_reagent) - qdel(O) + if (thing.reagents && thing.reagents.primary_reagent) + amount += REAGENT_VOLUME(thing.reagents, thing.reagents.primary_reagent) + qdel(thing) reagents.clear_reagents() SSnano.update_uis(src) var/obj/item/food/badrecipe/ffuu = new(src) @@ -426,18 +424,16 @@ return TOPIC_REFRESH if ("ejectitem") - for(var/obj/O in get_contained_external_atoms()) - if(strip_improper(O.name) == href_list["target"]) - eject_item(user, O) + for(var/obj/thing in get_contained_external_atoms()) + if(strip_improper(thing.name) == href_list["target"]) + eject_item(user, thing) break return TOPIC_REFRESH if ("ejectreagent") - var/decl/material/mat - for(var/material_type in reagents.reagent_volumes) - mat = GET_DECL(material_type) - if(mat.name == href_list["target"]) - eject_reagent(user, material_type) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(reagent.name == href_list["target"]) + eject_reagent(user, reagent) break return TOPIC_REFRESH diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 7bcf166a9089..d598001b671e 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -82,10 +82,10 @@ set_state(!on) return TRUE -/obj/machinery/light_switch/attackby(obj/item/I, mob/user) +/obj/machinery/light_switch/attackby(obj/item/used_item, mob/user) . = ..() if(!.) - to_chat(user, SPAN_NOTICE("You flick \the [src] with \the [I].")) + to_chat(user, SPAN_NOTICE("You flick \the [src] with \the [used_item].")) interface_interact(user) return TRUE diff --git a/code/game/machinery/mech_recharger.dm b/code/game/machinery/mech_recharger.dm index 5c2449e37ed2..08629aece6a2 100644 --- a/code/game/machinery/mech_recharger.dm +++ b/code/game/machinery/mech_recharger.dm @@ -11,7 +11,6 @@ base_type = /obj/machinery/mech_recharger construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 var/mob/living/exosuit/charging var/base_charge_rate = 60 KILOWATTS diff --git a/code/game/machinery/message_server.dm b/code/game/machinery/message_server.dm index fdec0c2b48ee..9ddf2a4d9f39 100644 --- a/code/game/machinery/message_server.dm +++ b/code/game/machinery/message_server.dm @@ -135,11 +135,11 @@ var/global/list/message_servers = list() update_icon() return TRUE -/obj/machinery/network/message_server/attackby(obj/item/O, mob/user) +/obj/machinery/network/message_server/attackby(obj/item/used_item, mob/user) if (active && !(stat & (BROKEN|NOPOWER)) && (spamfilter_limit < MESSAGE_SERVER_DEFAULT_SPAM_LIMIT*2) && \ - istype(O,/obj/item/stock_parts/circuitboard/message_monitor)) + istype(used_item,/obj/item/stock_parts/circuitboard/message_monitor)) spamfilter_limit += round(MESSAGE_SERVER_DEFAULT_SPAM_LIMIT / 2) - qdel(O) + qdel(used_item) to_chat(user, "You install additional memory and processors into \the [src]. Its filtering capabilities been enhanced.") return TRUE else diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index b129241b2ea4..5a3776da1e39 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -41,18 +41,18 @@ var/global/list/navbeacons = list() else icon_state = "[state]" -/obj/machinery/navbeacon/attackby(var/obj/item/I, var/mob/user) +/obj/machinery/navbeacon/attackby(var/obj/item/used_item, var/mob/user) var/turf/T = loc if(!T.is_plating()) return TRUE // prevent intraction when T-scanner revealed - if(IS_SCREWDRIVER(I)) + if(IS_SCREWDRIVER(used_item)) open = !open user.visible_message("\The [user] [open ? "opens" : "closes"] cover of \the [src].", "You [open ? "open" : "close"] cover of \the [src].") update_icon() return TRUE - else if(I.GetIdCard()) + else if(used_item.GetIdCard()) if(open) if (src.allowed(user)) src.locked = !src.locked diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 20c88ea60823..ae2af31628d8 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -711,7 +711,7 @@ var/global/list/allCasters = list() //Global list that will contain reference to else if(href_list["pick_censor_channel"]) var/datum/feed_channel/FC = locate(href_list["pick_censor_channel"]) viewing_channel = FC - screen = SCREEN_PICK_CENSOR_CHANNEL + screen = SCREEN_PICK_CENSOR_STORY . = TOPIC_REFRESH else if(href_list["refresh"]) @@ -882,8 +882,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to src.attack_self(src.loc) -/obj/item/newspaper/attackby(obj/item/W, mob/user) - if(IS_PEN(W)) +/obj/item/newspaper/attackby(obj/item/used_item, mob/user) + if(IS_PEN(used_item)) if(src.scribble_page == src.curr_page) to_chat(user, SPAN_WARNING("There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?")) return TRUE @@ -893,7 +893,7 @@ var/global/list/allCasters = list() //Global list that will contain reference to if(!CanPhysicallyInteractWith(user, src)) to_chat(user, SPAN_WARNING("You must stay close to \the [src]!")) return TRUE - if(W.do_tool_interaction(TOOL_PEN, user, src, 0, fuel_expenditure = 1) && !QDELETED(src)) //Make it instant, since handle_writing_literacy does the waiting + if(used_item.do_tool_interaction(TOOL_PEN, user, src, 0, fuel_expenditure = 1) && !QDELETED(src)) //Make it instant, since handle_writing_literacy does the waiting s = sanitize(s) s = user.handle_writing_literacy(user, s) src.scribble_page = src.curr_page @@ -943,3 +943,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to else audible_message("[src.name] beeps, \"Attention! Wanted issue distributed!\"") playsound(src.loc, 'sound/machines/warning-buzzer.ogg', 75, 1) + +// security newscaster preset +/obj/machinery/newscaster/security_unit + base_type = /obj/machinery/newscaster + securityCaster = TRUE \ No newline at end of file diff --git a/code/game/machinery/nuclear_bomb.dm b/code/game/machinery/nuclear_bomb.dm index ac2a4f67cec2..bb2365dbc314 100644 --- a/code/game/machinery/nuclear_bomb.dm +++ b/code/game/machinery/nuclear_bomb.dm @@ -44,8 +44,8 @@ var/global/bomb_set addtimer(CALLBACK(src, PROC_REF(explode)), 0) SSnano.update_uis(src) -/obj/machinery/nuclearbomb/attackby(obj/item/O, mob/user, params) - if(IS_SCREWDRIVER(O)) +/obj/machinery/nuclearbomb/attackby(obj/item/used_item, mob/user, params) + if(IS_SCREWDRIVER(used_item)) add_fingerprint(user) if(auth) if(panel_open == 0) @@ -69,38 +69,38 @@ var/global/bomb_set flick("lock", src) return TRUE - if(panel_open && (IS_MULTITOOL(O) || IS_WIRECUTTER(O))) + if(panel_open && (IS_MULTITOOL(used_item) || IS_WIRECUTTER(used_item))) return attack_hand_with_interaction_checks(user) if(extended) - if(istype(O, /obj/item/disk/nuclear)) - if(!user.try_unequip(O, src)) + if(istype(used_item, /obj/item/disk/nuclear)) + if(!user.try_unequip(used_item, src)) return TRUE - auth = O + auth = used_item add_fingerprint(user) return attack_hand_with_interaction_checks(user) if(anchored) switch(removal_stage) if(0) - if(IS_WELDER(O)) - var/obj/item/weldingtool/WT = O - if(!WT.isOn()) return TRUE - if(WT.get_fuel() < 5) // uses up 5 fuel. + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(!welder.isOn()) return TRUE + if(welder.get_fuel() < 5) // uses up 5 fuel. to_chat(user, "You need more fuel to complete this task.") return TRUE - user.visible_message("[user] starts cutting loose the anchoring bolt covers on [src].", "You start cutting loose the anchoring bolt covers with [O]...") + user.visible_message("[user] starts cutting loose the anchoring bolt covers on [src].", "You start cutting loose the anchoring bolt covers with [used_item]...") if(do_after(user, 4 SECONDS, src)) - if(QDELETED(src) || QDELETED(user) || !WT.weld(5, user)) return TRUE + if(QDELETED(src) || QDELETED(user) || !welder.weld(5, user)) return TRUE user.visible_message("\The [user] cuts through the bolt covers on \the [src].", "You cut through the bolt cover.") removal_stage = 1 return TRUE if(1) - if(IS_CROWBAR(O)) - user.visible_message("[user] starts forcing open the bolt covers on [src].", "You start forcing open the anchoring bolt covers with [O]...") + if(IS_CROWBAR(used_item)) + user.visible_message("[user] starts forcing open the bolt covers on [src].", "You start forcing open the anchoring bolt covers with [used_item]...") if(do_after(user, 1.5 SECONDS, src)) if(QDELETED(src) || QDELETED(user)) return TRUE @@ -109,23 +109,23 @@ var/global/bomb_set return TRUE if(2) - if(IS_WELDER(O)) - var/obj/item/weldingtool/WT = O - if(!WT.isOn()) return TRUE - if (WT.get_fuel() < 5) // uses up 5 fuel. + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(!welder.isOn()) return TRUE + if (welder.get_fuel() < 5) // uses up 5 fuel. to_chat(user, "You need more fuel to complete this task.") return TRUE - user.visible_message("[user] starts cutting apart the anchoring system sealant on [src].", "You start cutting apart the anchoring system's sealant with [O]...") + user.visible_message("[user] starts cutting apart the anchoring system sealant on [src].", "You start cutting apart the anchoring system's sealant with [used_item]...") if(do_after(user, 4 SECONDS, src)) - if(QDELETED(src) || QDELETED(user) || !WT.weld(5, user)) return TRUE + if(QDELETED(src) || QDELETED(user) || !welder.weld(5, user)) return TRUE user.visible_message("\The [user] cuts apart the anchoring system sealant on \the [src].", "You cut apart the anchoring system's sealant.") removal_stage = 3 return TRUE if(3) - if(IS_WRENCH(O)) + if(IS_WRENCH(used_item)) user.visible_message("[user] begins unwrenching the anchoring bolts on [src].", "You begin unwrenching the anchoring bolts...") if(do_after(user, 5 SECONDS, src)) if(QDELETED(src) || QDELETED(user)) return TRUE @@ -134,7 +134,7 @@ var/global/bomb_set return TRUE if(4) - if(IS_CROWBAR(O)) + if(IS_CROWBAR(used_item)) user.visible_message("[user] begins lifting [src] off of the anchors.", "You begin lifting the device off the anchors...") if(do_after(user, 8 SECONDS, src)) if(QDELETED(src) || QDELETED(user)) return TRUE @@ -230,11 +230,11 @@ var/global/bomb_set yes_code = 0 auth = null else - var/obj/item/I = user.get_active_held_item() - if(istype(I, /obj/item/disk/nuclear)) - if(!user.try_unequip(I, src)) + var/obj/item/used_item = user.get_active_held_item() + if(istype(used_item, /obj/item/disk/nuclear)) + if(!user.try_unequip(used_item, src)) return TOPIC_HANDLED - auth = I + auth = used_item if(is_auth(user)) if(href_list["type"]) . = TOPIC_REFRESH @@ -363,6 +363,7 @@ var/global/bomb_set icon_state = "idle" //====The nuclear authentication disc==== +var/global/list/obj/item/disk/nuclear/nuke_disks = list() /obj/item/disk/nuclear name = "nuclear authentication disk" desc = "Better keep this safe." @@ -372,19 +373,8 @@ var/global/bomb_set /obj/item/disk/nuclear/Initialize() . = ..() global.nuke_disks |= src - // Can never be quite sure that a game mode has been properly initiated or not at this point, so always register - events_repository.register(/decl/observ/moved, src, src, TYPE_PROC_REF(/obj/item/disk/nuclear, check_z_level)) - -/obj/item/disk/nuclear/proc/check_z_level() - if(!(istype(SSticker.mode, /decl/game_mode/nuclear))) - events_repository.unregister(/decl/observ/moved, src, src, TYPE_PROC_REF(/obj/item/disk/nuclear, check_z_level)) // However, when we are certain unregister if necessary - return - var/turf/T = get_turf(src) - if(!T || isNotStationLevel(T.z)) - qdel(src) /obj/item/disk/nuclear/Destroy() - events_repository.unregister(/decl/observ/moved, src, src, TYPE_PROC_REF(/obj/item/disk/nuclear, check_z_level)) global.nuke_disks -= src if(!length(global.nuke_disks)) var/turf/T = pick_area_turf_by_flag(AREA_FLAG_MAINTENANCE, list(/proc/is_station_turf, /proc/not_turf_contains_dense_objects)) @@ -418,8 +408,8 @@ var/global/bomb_set /obj/item/folder/envelope/nuke_instructions/Initialize() . = ..() - var/obj/item/paper/R = new(src) - R.set_content({"
Warning: Classified
[global.using_map.station_name] Self-Destruct System - Instructions


+ var/obj/item/paper/codes = new(src) + codes.set_content({"
Warning: Classified
[global.using_map.station_name] Self-Destruct System - Instructions


In the event of a Delta-level emergency, this document will guide you through the activation of the vessel's on-board nuclear self-destruct system. Please read carefully.

1) (Optional) Announce the imminent activation to any surviving crew members, and begin evacuation procedures.
@@ -442,7 +432,7 @@ var/global/bomb_set "vessel self-destruct instructions") //stamp the paper - R.apply_custom_stamp('icons/obj/items/stamps/stamp_cos.dmi', "'Top Secret'") + codes.apply_custom_stamp('icons/obj/items/stamps/stamp_cos.dmi', "'Top Secret'") //====vessel self-destruct system==== /obj/machinery/nuclearbomb/station @@ -475,7 +465,7 @@ var/global/bomb_set for(var/obj/machinery/self_destruct/ch in get_area(src)) inserters += ch -/obj/machinery/nuclearbomb/station/attackby(obj/item/O, mob/user) +/obj/machinery/nuclearbomb/station/attackby(obj/item/used_item, mob/user) return TRUE // cannot be moved /obj/machinery/nuclearbomb/station/OnTopic(mob/user, href_list, datum/topic_state/state) diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm index 3cfa2dd57bbe..51f5f1d33cec 100644 --- a/code/game/machinery/oxygen_pump.dm +++ b/code/game/machinery/oxygen_pump.dm @@ -17,6 +17,7 @@ var/mask_type = /obj/item/clothing/mask/breath/emergency var/icon_state_open = "emerg_open" var/icon_state_closed = "emerg" + var/icon_state_active // TODO implement power_channel = ENVIRON idle_power_usage = 10 @@ -135,8 +136,8 @@ return return 1 -/obj/machinery/oxygen_pump/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/machinery/oxygen_pump/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) stat ^= MAINT user.visible_message(SPAN_NOTICE("\The [user] [stat & MAINT ? "opens" : "closes"] \the [src]."), SPAN_NOTICE("You [stat & MAINT ? "open" : "close"] \the [src].")) if(stat & MAINT) @@ -144,17 +145,17 @@ if(!stat) icon_state = icon_state_closed return TRUE - if(istype(W, /obj/item/tank) && (stat & MAINT)) + if(istype(used_item, /obj/item/tank) && (stat & MAINT)) if(tank) to_chat(user, SPAN_WARNING("\The [src] already has a tank installed!")) return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - tank = W + tank = used_item user.visible_message(SPAN_NOTICE("\The [user] installs \the [tank] into \the [src]."), SPAN_NOTICE("You install \the [tank] into \the [src].")) src.add_fingerprint(user) return TRUE - if(istype(W, /obj/item/tank) && !stat) + if(istype(used_item, /obj/item/tank) && !stat) to_chat(user, SPAN_WARNING("Please open the maintenance hatch first.")) return TRUE return FALSE // TODO: should this be a parent call? do we want this to be (de)constructable? @@ -233,3 +234,45 @@ tank.distribute_pressure += cp tank.distribute_pressure = min(max(round(tank.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE) . = TOPIC_REFRESH // Refreshing is handled in machinery/Topic + +/obj/machinery/oxygen_pump/mobile + name = "portable oxygen pump" + icon = 'icons/obj/machines/medpump.dmi' + desc = "A portable oxygen pump with a retractable mask that you can pull over your face in case of emergencies." + icon_state = "medpump" + icon_state_open = "medpump_open" + icon_state_closed = "medpump" + icon_state_active = "medpump_active" + anchored = FALSE + density = TRUE + +/obj/machinery/oxygen_pump/mobile/stabilizer + name = "portable patient stabilizer" + desc = "A portable oxygen pump with a retractable mask used for stabilizing patients in the field." + icon_state = "patient_stabilizer" + icon_state_closed = "patient_stabilizer" + icon_state_open = "patient_stabilizer_open" + icon_state_active = "patient_stabilizer_active" + +/obj/machinery/oxygen_pump/mobile/stabilizer/Process() + . = ..() + if(!breather) // Safety. + return + if(breather.isSynthetic()) + return + +/* TODO: port modifiers or something similar + breather.add_modifier(breather.stat == DEAD ? /datum/modifier/bloodpump/corpse : /datum/modifier/bloodpump, 6 SECONDS) +*/ + + var/obj/item/organ/internal/lungs/lungs = breather.get_organ(BP_LUNGS, /obj/item/organ/internal/lungs) + if(!lungs) + return + if(lungs.status & ORGAN_DEAD) + breather.adjustOxyLoss(-(rand(1,8))) + else + breather.adjustOxyLoss(-(rand(10,15))) + if(lungs.is_bruised() && prob(30)) + lungs.heal_damage(1) + else + breather.suffocation_counter = max(breather.suffocation_counter - rand(1,5), 0) \ No newline at end of file diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index e117f2087257..005f27ca3465 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -71,8 +71,8 @@ Buildable meters /obj/item/pipe/attack_self(mob/user) return rotate(user) -/obj/item/pipe/attackby(var/obj/item/W, var/mob/user) - if(!IS_WRENCH(W)) +/obj/item/pipe/attackby(var/obj/item/used_item, var/mob/user) + if(!IS_WRENCH(used_item)) return ..() if (!isturf(loc)) return 1 @@ -117,8 +117,8 @@ Buildable meters . = ..() set_extension(src, /datum/extension/parts_stash) -/obj/item/machine_chassis/attackby(var/obj/item/W, var/mob/user) - if(!IS_WRENCH(W)) +/obj/item/machine_chassis/attackby(var/obj/item/used_item, var/mob/user) + if(!IS_WRENCH(used_item)) return ..() var/obj/machinery/machine = new build_type(get_turf(src), dir, TRUE) var/datum/extension/parts_stash/stash = get_extension(src, /datum/extension/parts_stash) diff --git a/code/game/machinery/pipe/pipelayer.dm b/code/game/machinery/pipe/pipelayer.dm index d34c2d094474..6287eafed099 100644 --- a/code/game/machinery/pipe/pipelayer.dm +++ b/code/game/machinery/pipe/pipelayer.dm @@ -14,12 +14,12 @@ var/P_type_t = "" var/max_metal = 50 var/metal = 10 - var/obj/item/wrench/W + var/obj/item/wrench/wrench var/list/Pipes = list("regular pipes"=0,"scrubbers pipes"=31,"supply pipes"=29,"heat exchange pipes"=2, "fuel pipes"=45) /obj/machinery/pipelayer/Initialize() . = ..() - W = new(src) + wrench = new(src) /obj/machinery/pipelayer/Move(new_turf,M_Dir) . = ..() @@ -39,24 +39,24 @@ user.visible_message("[user] has [!on?"de":""]activated \the [src].", "You [!on?"de":""]activate \the [src].") return TRUE -/obj/machinery/pipelayer/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/pipelayer/attackby(var/obj/item/used_item, var/mob/user) - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) P_type_t = input("Choose pipe type", "Pipe type") as null|anything in Pipes P_type = Pipes[P_type_t] user.visible_message("[user] has set \the [src] to manufacture [P_type_t].", "You set \the [src] to manufacture [P_type_t].") return TRUE - if(IS_CROWBAR(W)) + if(IS_CROWBAR(used_item)) a_dis=!a_dis user.visible_message("[user] has [!a_dis?"de":""]activated auto-dismantling.", "You [!a_dis?"de":""]activate auto-dismantling.") return TRUE - if(istype(W, /obj/item/stack/material) && W.get_material_type() == /decl/material/solid/metal/steel) + if(istype(used_item, /obj/item/stack/material) && used_item.get_material_type() == /decl/material/solid/metal/steel) - var/result = load_metal(W) + var/result = load_metal(used_item) if(isnull(result)) - to_chat(user, "Unable to load [W] - no metal found.") + to_chat(user, "Unable to load [used_item] - no metal found.") else if(!result) to_chat(user, "\The [src] is full.") else @@ -64,7 +64,7 @@ return TRUE - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) if(metal) var/m = round(input(usr,"Please specify the amount of metal to remove","Remove metal",min(round(metal),50)) as num, 1) m = min(m, 50) @@ -129,6 +129,6 @@ var/obj/item/pipe/P = new(w_turf) P.set_dir(p_dir) - P.attackby(W , src) + P.attackby(wrench , src) return 1 diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 0fde815d1326..99d2fd9681f1 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -236,9 +236,9 @@ var/global/list/turret_icons . = ..() // TODO: remove these or refactor to use construct states -/obj/machinery/porta_turret/attackby(obj/item/I, mob/user) +/obj/machinery/porta_turret/attackby(obj/item/used_item, mob/user) if(stat & BROKEN) - if(IS_CROWBAR(I)) + if(IS_CROWBAR(used_item)) //If the turret is destroyed, you can remove it with a crowbar to //try and salvage its components to_chat(user, "You begin prying the metal coverings off.") @@ -251,7 +251,7 @@ var/global/list/turret_icons return TRUE return FALSE - else if(IS_WRENCH(I)) + else if(IS_WRENCH(used_item)) if(enabled || raised) to_chat(user, "You cannot unsecure an active turret!") return TRUE @@ -277,7 +277,7 @@ var/global/list/turret_icons wrenching = 0 return TRUE - else if(istype(I, /obj/item/card/id)||istype(I, /obj/item/modular_computer)) + else if(istype(used_item, /obj/item/card/id)||istype(used_item, /obj/item/modular_computer)) //Behavior lock/unlock mangement if(allowed(user)) locked = !locked @@ -289,9 +289,9 @@ var/global/list/turret_icons else //if the turret was attacked with the intention of harming it: - var/force = I.expend_attack_force(user) * 0.5 + var/force = used_item.expend_attack_force(user) * 0.5 user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - take_damage(force, I.atom_damage_type) + take_damage(force, used_item.atom_damage_type) if(force > 1) //if the force of impact dealt at least 1 damage, the turret gets pissed off if(!attacked && !emagged) attacked = 1 diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 9a05621916b9..a63a730636f3 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -15,7 +15,6 @@ var/icon_state_idle = "recharger0" //also when unpowered var/portable = 1 - stat_immune = 0 uncreated_component_parts = null construct_state = /decl/machine_construction/default/panel_closed @@ -23,10 +22,10 @@ charging = null . = ..() -/obj/machinery/recharger/attackby(obj/item/G, mob/user) +/obj/machinery/recharger/attackby(obj/item/used_item, mob/user) var/allowed = 0 for (var/allowed_type in allowed_devices) - if (istype(G, allowed_type)) allowed = 1 + if (istype(used_item, allowed_type)) allowed = 1 if(allowed) . = TRUE @@ -35,24 +34,24 @@ return // Checks to make sure the recharger is powered. if(stat & NOPOWER) - to_chat(user, "\The [src] blinks red as you try to insert \the [G]!") + to_chat(user, "\The [src] blinks red as you try to insert \the [used_item]!") return - if (istype(G, /obj/item/gun/energy/)) - var/obj/item/gun/energy/E = G + if (istype(used_item, /obj/item/gun/energy/)) + var/obj/item/gun/energy/E = used_item if(E.self_recharge) to_chat(user, "You can't find a charging port on \the [E].") return - if(!G.get_cell()) + if(!used_item.get_cell()) to_chat(user, "This device does not have a battery installed.") return - if(user.try_unequip(G)) - G.forceMove(src) - charging = G + if(user.try_unequip(used_item)) + used_item.forceMove(src) + charging = used_item update_icon() return - if(portable && IS_WRENCH(G) && !panel_open) + if(portable && IS_WRENCH(used_item) && !panel_open) . = TRUE if(charging) to_chat(user, "Remove [charging] first!") @@ -83,11 +82,11 @@ update_use_power(POWER_USE_IDLE) icon_state = icon_state_idle else - var/obj/item/cell/C = charging.get_cell() - if(istype(C)) - if(!C.fully_charged()) + var/obj/item/cell/cell = charging.get_cell() + if(istype(cell)) + if(!cell.fully_charged()) icon_state = icon_state_charging - C.give(active_power_usage*CELLRATE) + cell.give(active_power_usage*CELLRATE) update_use_power(POWER_USE_ACTIVE) else icon_state = icon_state_charged @@ -98,9 +97,9 @@ ..(severity) return if(charging) - var/obj/item/cell/C = charging.get_cell() - if(istype(C)) - C.emp_act(severity) + var/obj/item/cell/cell = charging.get_cell() + if(istype(cell)) + cell.emp_act(severity) ..(severity) /obj/machinery/recharger/on_update_icon() //we have an update_icon() in addition to the stuff in process to make it feel a tiny bit snappier. diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 1be2e054aaaa..74a34b4ac150 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -8,7 +8,6 @@ idle_power_usage = 50 base_type = /obj/machinery/recharge_station uncreated_component_parts = null - stat_immune = 0 construct_state = /decl/machine_construction/default/panel_closed var/overlay_icon = 'icons/obj/objects.dmi' @@ -70,12 +69,12 @@ var/obj/item/cell/target if(isrobot(occupant)) - var/mob/living/silicon/robot/R = occupant - target = R.cell - if(R.module) - R.module.respawn_consumable(R, charging_power * CELLRATE / 250) //consumables are magical, apparently + var/mob/living/silicon/robot/robot = occupant + target = robot.cell + if(robot.module) + robot.module.respawn_consumable(robot, charging_power * CELLRATE / 250) //consumables are magical, apparently // If we are capable of repairing damage, reboot destroyed components and allow them to be repaired for very large power spike. - var/list/damaged = R.get_damaged_components(1,1,1) + var/list/damaged = robot.get_damaged_components(1,1,1) if(damaged.len && wire_rate && weld_rate) for(var/datum/robot_component/C in damaged) if((C.installed == -1) && use_power_oneoff(100 KILOWATTS, LOCAL) <= 0) @@ -174,8 +173,8 @@ last_overlay_state = overlay_state() overlays = list(image(overlay_icon, overlay_state())) -/obj/machinery/recharge_station/Bumped(var/mob/living/silicon/robot/R) - addtimer(CALLBACK(src, PROC_REF(go_in), R), 1) +/obj/machinery/recharge_station/Bumped(var/mob/living/silicon/robot/robot) + addtimer(CALLBACK(src, PROC_REF(go_in), robot), 1) /obj/machinery/recharge_station/proc/go_in(var/mob/M) @@ -191,8 +190,8 @@ /obj/machinery/recharge_station/proc/hascell(var/mob/M) if(isrobot(M)) - var/mob/living/silicon/robot/R = M - return (R.cell) + var/mob/living/silicon/robot/robot = M + return (robot.cell) if(ishuman(M)) var/mob/living/human/H = M if(H.isSynthetic()) diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 2fe46fa3e1d6..3452f128f8b0 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -206,16 +206,16 @@ var/global/req_console_information = list() set_department(choice) return TOPIC_REFRESH -/obj/machinery/network/requests_console/attackby(var/obj/item/O, var/mob/user) - if (istype(O, /obj/item/card/id)) +/obj/machinery/network/requests_console/attackby(var/obj/item/used_item, var/mob/user) + if (istype(used_item, /obj/item/card/id)) if(inoperable(MAINT)) return TRUE switch(screen) if(RCS_MESSAUTH) - var/obj/item/card/id/T = O + var/obj/item/card/id/T = used_item msgVerified = text("Verified by [T.registered_name] ([T.assignment])") SSnano.update_uis(src) if(RCS_ANNOUNCE) - var/obj/item/card/id/ID = O + var/obj/item/card/id/ID = used_item if (access_RC_announce in ID.GetAccess()) announceAuth = 1 announcement.announcer = ID.assignment ? "[ID.assignment] [ID.registered_name]" : ID.registered_name @@ -224,10 +224,10 @@ var/global/req_console_information = list() to_chat(user, "You are not authorized to send announcements.") SSnano.update_uis(src) return TRUE - if (istype(O, /obj/item/stamp)) + if (istype(used_item, /obj/item/stamp)) if(inoperable(MAINT)) return TRUE if(screen == RCS_MESSAUTH) - var/obj/item/stamp/T = O + var/obj/item/stamp/T = used_item msgStamped = "Stamped with the [T.name]" SSnano.update_uis(src) return TRUE diff --git a/code/game/machinery/seed_extractor.dm b/code/game/machinery/seed_extractor.dm index 28bcefc71584..6f451e7ce6c1 100644 --- a/code/game/machinery/seed_extractor.dm +++ b/code/game/machinery/seed_extractor.dm @@ -10,36 +10,34 @@ active_power_usage = 2000 construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 -/obj/machinery/seed_extractor/attackby(var/obj/item/O, var/mob/user) +/obj/machinery/seed_extractor/attackby(var/obj/item/used_item, var/mob/user) // Fruits and vegetables. - if(istype(O, /obj/item/food/grown)) - if(!user.try_unequip(O)) + if(istype(used_item, /obj/item/food/grown)) + if(!user.try_unequip(used_item)) return TRUE - var/obj/item/food/grown/F = O + var/obj/item/food/grown/F = used_item if(!F.seed) - to_chat(user, SPAN_WARNING("\The [O] doesn't seem to have any usable seeds inside it.")) + to_chat(user, SPAN_WARNING("\The [used_item] doesn't seem to have any usable seeds inside it.")) return TRUE - to_chat(user, SPAN_NOTICE("You extract some seeds from [O].")) + to_chat(user, SPAN_NOTICE("You extract some seeds from [used_item].")) for(var/i = 1 to rand(1,4)) new /obj/item/seeds/modified(get_turf(src), null, F.seed) - qdel(O) + qdel(used_item) return TRUE //Grass. - if(istype(O, /obj/item/stack/tile/grass)) - var/obj/item/stack/tile/grass/S = O + if(istype(used_item, /obj/item/stack/tile/grass)) + var/obj/item/stack/tile/grass/S = used_item if (S.use(1)) to_chat(user, SPAN_NOTICE("You extract some seeds from the grass tile.")) new /obj/item/seeds/grassseed(loc) return TRUE - if(istype(O, /obj/item/fossil/plant)) // Fossils - var/obj/item/seeds/random/R = new(get_turf(src)) - to_chat(user, SPAN_NOTICE("\The [src] scans \the [O] and spits out \a [R].")) - qdel(O) + if(istype(used_item, /obj/item/fossil/plant)) // Fossils + to_chat(user, SPAN_NOTICE("\The [src] scans \the [used_item] and spits out \a [new /obj/item/seeds/random(get_turf(src))].")) + qdel(used_item) return TRUE return ..() diff --git a/code/game/machinery/self_destruct.dm b/code/game/machinery/self_destruct.dm index badb1853918b..a987fa104aee 100644 --- a/code/game/machinery/self_destruct.dm +++ b/code/game/machinery/self_destruct.dm @@ -9,31 +9,31 @@ var/armed = 0 var/damaged = 0 -/obj/machinery/self_destruct/attackby(obj/item/W, mob/user) - if(IS_WELDER(W)) +/obj/machinery/self_destruct/attackby(obj/item/used_item, mob/user) + if(IS_WELDER(used_item)) if(!damaged) return FALSE user.visible_message("[user] begins to repair [src].", "You begin repairing [src].") if(do_after(user, 100, src)) - var/obj/item/weldingtool/w = W + var/obj/item/weldingtool/w = used_item if(w.weld(10)) damaged = 0 user.visible_message("[user] repairs [src].", "You repair [src].") else to_chat(user, "There is not enough fuel to repair [src].") return TRUE - if(istype(W, /obj/item/nuclear_cylinder)) + if(istype(used_item, /obj/item/nuclear_cylinder)) if(damaged) to_chat(user, "[src] is damaged, you cannot place the cylinder.") return TRUE if(cylinder) to_chat(user, "There is already a cylinder here.") return TRUE - user.visible_message("[user] begins to carefully place [W] onto [src].", "You begin to carefully place [W] onto [src].") - if(do_after(user, 80, src) && user.try_unequip(W, src)) - cylinder = W + user.visible_message("[user] begins to carefully place [used_item] onto [src].", "You begin to carefully place [used_item] onto [src].") + if(do_after(user, 80, src) && user.try_unequip(used_item, src)) + cylinder = used_item density = TRUE - user.visible_message("[user] places [W] onto [src].", "You place [W] onto [src].") + user.visible_message("[user] places [used_item] onto [src].", "You place [used_item] onto [src].") update_icon() return TRUE return ..() diff --git a/code/game/machinery/self_destruct_storage.dm b/code/game/machinery/self_destruct_storage.dm index afaf920ef1da..df7512e5da09 100644 --- a/code/game/machinery/self_destruct_storage.dm +++ b/code/game/machinery/self_destruct_storage.dm @@ -51,6 +51,16 @@ to_chat(user, SPAN_WARNING("The card fails to do anything. It seems this device has an advanced encryption system.")) return NO_EMAG_ACT +// I hate this but can't think of a better way aside from skipping the testing entirely for this type, +// which is worse. Basically, we just need to ensure we pass the cannot_transition_to check. +/obj/machinery/nuclear_cylinder_storage/fail_construct_state_unit_test() + locked = FALSE + open = TRUE + var/list/old_cylinders = cylinders // This is evil. + cylinders = list() + . = ..() + cylinders = old_cylinders + /obj/machinery/nuclear_cylinder_storage/components_are_accessible(path) return !locked && open && ..() @@ -86,13 +96,13 @@ return TRUE return FALSE -/obj/machinery/nuclear_cylinder_storage/attackby(obj/item/O, mob/user) - if(!open && operable() && istype(O, /obj/item/card/id)) +/obj/machinery/nuclear_cylinder_storage/attackby(obj/item/used_item, mob/user) + if(!open && operable() && istype(used_item, /obj/item/card/id)) if(panel_open) to_chat(user, SPAN_WARNING("\The [src] is currently in maintenance mode!")) return TRUE - var/obj/item/card/id/id = O + var/obj/item/card/id/id = used_item if(check_access(id)) locked = !locked user.visible_message( @@ -102,21 +112,21 @@ update_icon() return TRUE - if(open && istype(O, /obj/item/nuclear_cylinder) && (length(cylinders) < max_cylinders)) + if(open && istype(used_item, /obj/item/nuclear_cylinder) && (length(cylinders) < max_cylinders)) if(panel_open) to_chat(user, SPAN_WARNING("\The [src] is currently in maintenance mode!")) return TRUE user.visible_message( - "\The [user] begins inserting \the [O] into storage.", - "You begin inserting \the [O] into storage." + "\The [user] begins inserting \the [used_item] into storage.", + "You begin inserting \the [used_item] into storage." ) - if(do_after(user, interact_time, src) && open && (length(cylinders) < max_cylinders) && user.try_unequip(O, src)) + if(do_after(user, interact_time, src) && open && (length(cylinders) < max_cylinders) && user.try_unequip(used_item, src)) user.visible_message( - "\The [user] places \the [O] into storage.", - "You place \the [O] into storage." + "\The [user] places \the [used_item] into storage.", + "You place \the [used_item] into storage." ) - cylinders.Add(O) + cylinders.Add(used_item) update_icon() return TRUE diff --git a/code/game/machinery/singularitybeacon.dm b/code/game/machinery/singularitybeacon.dm index 5d8690d56765..e9f6d6381be5 100644 --- a/code/game/machinery/singularitybeacon.dm +++ b/code/game/machinery/singularitybeacon.dm @@ -54,8 +54,8 @@ var/global/list/singularity_beacons = list() else to_chat(user, SPAN_DANGER("You need to screw the beacon to the floor first!")) -/obj/machinery/singularity_beacon/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/machinery/singularity_beacon/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) if(use_power) to_chat(user, SPAN_DANGER("You need to deactivate the beacon first!")) return TRUE diff --git a/code/game/machinery/smartfridge/_smartfridge.dm b/code/game/machinery/smartfridge/_smartfridge.dm index c446e87a4389..68db0c387afd 100644 --- a/code/game/machinery/smartfridge/_smartfridge.dm +++ b/code/game/machinery/smartfridge/_smartfridge.dm @@ -45,8 +45,8 @@ return list() return ..() -/obj/machinery/smartfridge/proc/accept_check(var/obj/item/O) - if(istype(O,/obj/item/food/grown/) || istype(O,/obj/item/seeds/)) +/obj/machinery/smartfridge/proc/accept_check(var/obj/item/stocking_item) + if(istype(stocking_item,/obj/item/food/grown) || istype(stocking_item,/obj/item/seeds)) return 1 return 0 @@ -104,10 +104,10 @@ draw_state = "[icon_state]-top" if(check_state_in_icon(draw_state, icon)) - var/image/I = image(icon, draw_state) - I.pixel_z = 32 - I.layer = ABOVE_WINDOW_LAYER - add_overlay(I) + var/image/overlay_image = image(icon, draw_state) + overlay_image.pixel_z = 32 + overlay_image.layer = ABOVE_WINDOW_LAYER + add_overlay(overlay_image) // Append our off state if needed. if(stat & BROKEN) @@ -116,9 +116,9 @@ icon_state = "[icon_state]-off" /obj/machinery/smartfridge/dismantle() - for(var/datum/stored_items/I in item_records) - while(I.amount > 0) - I.get_product(get_turf(src)) // They'd get dumped anyway, but this makes things GC properly. + for(var/datum/stored_items/stored_item in item_records) + while(stored_item.amount > 0) + stored_item.get_product(get_turf(src)) // They'd get dumped anyway, but this makes things GC properly. ..() /******************* @@ -129,42 +129,42 @@ . = ..() update_icon() -/obj/machinery/smartfridge/attackby(var/obj/item/O, var/mob/user) - if(accept_check(O)) - if(!user.try_unequip(O)) +/obj/machinery/smartfridge/attackby(var/obj/item/used_item, var/mob/user) + if(accept_check(used_item)) + if(!user.try_unequip(used_item)) return TRUE - stock_item(O) - user.visible_message("\The [user] has added \the [O] to \the [src].", "You add \the [O] to \the [src].") + stock_item(used_item) + user.visible_message("\The [user] has added \the [used_item] to \the [src].", "You add \the [used_item] to \the [src].") update_icon() return TRUE - if(O.storage) + if(used_item.storage) var/plants_loaded = 0 - for(var/obj/G in O.storage.get_contents()) - if(accept_check(G) && O.storage.remove_from_storage(user, G, src, TRUE)) + for(var/obj/G in used_item.storage.get_contents()) + if(accept_check(G) && used_item.storage.remove_from_storage(user, G, src, TRUE)) plants_loaded++ stock_item(G) - O.storage.finish_bulk_removal() + used_item.storage.finish_bulk_removal() if(plants_loaded) - user.visible_message("\The [user] loads \the [src] with the contents of \the [O].", "You load \the [src] with the contents of \the [O].") - if(length(O.storage.get_contents()) > 0) + user.visible_message("\The [user] loads \the [src] with the contents of \the [used_item].", "You load \the [src] with the contents of \the [used_item].") + if(length(used_item.storage.get_contents()) > 0) to_chat(user, "Some items were refused.") return TRUE return ..() -/obj/machinery/smartfridge/proc/stock_item(var/obj/item/O) - for(var/datum/stored_items/I in item_records) - if(istype(O, I.item_path) && O.name == I.item_name) - stock(I, O) +/obj/machinery/smartfridge/proc/stock_item(var/obj/item/stocking_item) + for(var/datum/stored_items/stored_item in item_records) + if(istype(stocking_item, stored_item.item_path) && stocking_item.name == stored_item.item_name) + stock(stored_item, stocking_item) return - var/datum/stored_items/I = new/datum/stored_items(src, O.type, O.name) - dd_insertObjectList(item_records, I) - stock(I, O) + var/datum/stored_items/stored_item = new/datum/stored_items(src, stocking_item.type, stocking_item.name) + dd_insertObjectList(item_records, stored_item) + stock(stored_item, stocking_item) -/obj/machinery/smartfridge/proc/stock(var/datum/stored_items/I, var/obj/item/O) - I.add_product(O) +/obj/machinery/smartfridge/proc/stock(var/datum/stored_items/stored_item, var/obj/item/stocking_item) + stored_item.add_product(stocking_item) SSnano.update_uis(src) /obj/machinery/smartfridge/interface_interact(mob/user) @@ -187,10 +187,10 @@ var/list/items[0] for (var/i=1 to length(item_records)) - var/datum/stored_items/I = item_records[i] - var/count = I.get_amount() + var/datum/stored_items/stored_item = item_records[i] + var/count = stored_item.get_amount() if(count > 0) - items.Add(list(list("display_name" = html_encode(capitalize(I.item_name)), "vend" = i, "quantity" = count))) + items.Add(list(list("display_name" = html_encode(capitalize(stored_item.item_name)), "vend" = i, "quantity" = count))) if(items.len > 0) data["contents"] = items @@ -210,15 +210,15 @@ if(href_list["vend"]) var/index = text2num(href_list["vend"]) - var/datum/stored_items/I = item_records[index] - var/count = I.get_amount() + var/datum/stored_items/stored_item = item_records[index] + var/count = stored_item.get_amount() var/amount = clamp(text2num(href_list["amount"]), 0, count) // Sanity check, there are probably ways to press the button when it shouldn't be possible. if(amount <= 0) return TOPIC_REFRESH // you must be confused, we have none of that here! for(var/i = 1 to amount) - I.get_product(get_turf(src)) + stored_item.get_product(get_turf(src)) update_icon() var/vend_state = "[icon_state]-vend" if (check_state_in_icon(vend_state, icon)) //Show the vending animation if needed @@ -232,8 +232,8 @@ if(!target) return 0 - for(var/datum/stored_items/I in src.item_records) - throw_item = I.get_product(loc) + for(var/datum/stored_items/stored_item in src.item_records) + throw_item = stored_item.get_product(loc) if(!QDELETED(throw_item)) break diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index f42cb1070087..4059128a7d11 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -168,23 +168,23 @@ remove_display() var/decl/security_state/security_state = GET_DECL(global.using_map.security_state) - var/decl/security_level/sl = security_state.current_security_level + var/decl/security_level/sec_level = security_state.current_security_level - set_light(sl.light_range, sl.light_power, sl.light_color_status_display) + set_light(sec_level.light_range, sec_level.light_power, sec_level.light_color_status_display) - if(sl.alarm_appearance.display_icon) - var/image/alert1 = image(sl.icon, sl.alarm_appearance.display_icon) - alert1.color = sl.alarm_appearance.display_icon_color + if(sec_level.alarm_appearance.display_icon) + var/image/alert1 = image(sec_level.icon, sec_level.alarm_appearance.display_icon) + alert1.color = sec_level.alarm_appearance.display_icon_color overlays |= alert1 - if(sl.alarm_appearance.display_icon_twotone) - var/image/alert2 = image(sl.icon, sl.alarm_appearance.display_icon_twotone) - alert2.color = sl.alarm_appearance.display_icon_twotone_color + if(sec_level.alarm_appearance.display_icon_twotone) + var/image/alert2 = image(sec_level.icon, sec_level.alarm_appearance.display_icon_twotone) + alert2.color = sec_level.alarm_appearance.display_icon_twotone_color overlays |= alert2 - if(sl.alarm_appearance.display_emblem) - var/image/alert3 = image(sl.icon, sl.alarm_appearance.display_emblem) - alert3.color = sl.alarm_appearance.display_emblem_color + if(sec_level.alarm_appearance.display_emblem) + var/image/alert3 = image(sec_level.icon, sec_level.alarm_appearance.display_emblem) + alert3.color = sec_level.alarm_appearance.display_emblem_color overlays |= alert3 /obj/machinery/status_display/proc/set_picture(state) diff --git a/code/game/machinery/suit_cycler.dm b/code/game/machinery/suit_cycler.dm index fd147aef4247..bb484cec914c 100644 --- a/code/game/machinery/suit_cycler.dm +++ b/code/game/machinery/suit_cycler.dm @@ -49,7 +49,7 @@ var/target_bodytype var/mob/living/human/occupant - var/obj/item/clothing/suit/space/void/suit + var/obj/item/clothing/suit/space/suit var/obj/item/clothing/head/helmet/space/helmet var/obj/item/clothing/shoes/magboots/boots @@ -148,6 +148,21 @@ target_bodytype = available_bodytypes[1] update_icon() +#ifdef UNIT_TEST + // Pass this off to lateload to make sure any Initialize() overrides on subtypes or modpacks also run. + return INITIALIZE_HINT_LATELOAD + +/obj/machinery/suit_cycler/LateInitialize() + . = ..() + if(suit && !istype(suit)) + log_error("[type] has invalid suit instance: [suit]") + if(helmet && !istype(helmet)) + log_error("[type] has invalid helmet instance: [helmet]") + if(boots && !istype(boots)) + log_error("[type] has invalid suit instance: [boots]") +#endif + + /obj/machinery/suit_cycler/Destroy() if(occupant) occupant.dropInto(loc) @@ -195,33 +210,33 @@ return TRUE return ..() -/obj/machinery/suit_cycler/attackby(obj/item/I, mob/user) +/obj/machinery/suit_cycler/attackby(obj/item/used_item, mob/user) if(electrified != 0 && shock(user, 100)) return TRUE //Hacking init. - if(IS_MULTITOOL(I) || IS_WIRECUTTER(I)) + if(IS_MULTITOOL(used_item) || IS_WIRECUTTER(used_item)) if(panel_open) physical_attack_hand(user) return TRUE - if(istype(I, /obj/item/clothing/shoes/magboots)) + if(istype(used_item, /obj/item/clothing/shoes/magboots)) if(locked) to_chat(user, SPAN_WARNING("The suit cycler is locked.")) return TRUE if(boots) to_chat(user, SPAN_WARNING("The cycler already contains some boots.")) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, "You fit \the [I] into the suit cycler.") - set_boots(I) + to_chat(user, "You fit \the [used_item] into the suit cycler.") + set_boots(used_item) update_icon() updateUsrDialog() return TRUE - if(istype(I,/obj/item/clothing/head/helmet/space) && !istype(I, /obj/item/clothing/head/helmet/space/rig)) + if(istype(used_item,/obj/item/clothing/head/helmet/space) && !istype(used_item, /obj/item/clothing/head/helmet/space/rig)) if(locked) to_chat(user, SPAN_WARNING("The suit cycler is locked.")) @@ -231,26 +246,26 @@ to_chat(user, SPAN_WARNING("The cycler already contains a helmet.")) return TRUE - if(user.try_unequip(I, src)) - to_chat(user, "You fit \the [I] into the suit cycler.") - set_helmet(I) + if(user.try_unequip(used_item, src)) + to_chat(user, "You fit \the [used_item] into the suit cycler.") + set_helmet(used_item) update_icon() updateUsrDialog() return TRUE - if(istype(I,/obj/item/clothing/suit/space/void)) + if(istype(used_item, /obj/item/clothing/suit/space)) if(locked) to_chat(user, SPAN_WARNING("The suit cycler is locked.")) return TRUE if(suit) - to_chat(user, SPAN_WARNING("The cycler already contains a voidsuit.")) + to_chat(user, SPAN_WARNING("The cycler already contains a spacesuit.")) return TRUE - if(user.try_unequip(I, src)) - to_chat(user, "You fit \the [I] into the suit cycler.") - set_suit(I) + if(user.try_unequip(used_item, src)) + to_chat(user, "You fit \the [used_item] into the suit cycler.") + set_suit(used_item) update_icon() updateUsrDialog() return TRUE @@ -470,6 +485,11 @@ return eject_occupant(usr) +/obj/machinery/suit_cycler/relaymove(var/mob/user) + ..() + if(occupant == user) + eject_occupant(user) + /obj/machinery/suit_cycler/proc/eject_occupant(mob/user) if(locked || active) @@ -502,3 +522,6 @@ if(boots) boots.refit_for_bodytype(target_bodytype) finished_job() + +/obj/machinery/suit_cycler/shuttle_rotate(angle) // DO NOT CHANGE DIR. Change this when someone adds directional sprites for suit cyclers. + return diff --git a/code/game/machinery/supplybeacon.dm b/code/game/machinery/supplybeacon.dm index b74a93b635dc..6b5e01a6d6cd 100644 --- a/code/game/machinery/supplybeacon.dm +++ b/code/game/machinery/supplybeacon.dm @@ -41,8 +41,8 @@ if(!drop_type) drop_type = pick(supply_drop_random_loot_types()) -/obj/structure/supply_beacon/attackby(var/obj/item/W, var/mob/user) - if(!activated && IS_WRENCH(W)) +/obj/structure/supply_beacon/attackby(var/obj/item/used_item, var/mob/user) + if(!activated && IS_WRENCH(used_item)) anchored = !anchored user.visible_message(SPAN_NOTICE("\The [user] [anchored ? "secures" : "unsecures"] \the [src].")) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 0b61d1782680..6053e343fad9 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -48,14 +48,14 @@ var/turf/T = get_turf(locked) . += SPAN_NOTICE("The console is locked on to \[[T.loc.name]\].") -/obj/machinery/computer/teleporter/attackby(var/obj/I, var/mob/user) +/obj/machinery/computer/teleporter/attackby(var/obj/used_item, var/mob/user) - var/obj/item/card/data/C = I + var/obj/item/card/data/C = used_item if(!istype(C) || (stat & (NOPOWER|BROKEN)) || C.function != "teleporter") return ..() var/obj/L = null - for(var/obj/abstract/landmark/sloc in global.landmarks_list) + for(var/obj/abstract/landmark/sloc in global.all_landmarks) if(sloc.name != C.data || (locate(/mob/living) in sloc.loc)) continue L = sloc @@ -64,10 +64,10 @@ if(!L) L = locate("landmark*[C.data]") // use old stype - if(istype(L, /obj/abstract/landmark) && isturf(L.loc) && user.try_unequip(I)) + if(istype(L, /obj/abstract/landmark) && isturf(L.loc) && user.try_unequip(used_item)) to_chat(user, "You insert the coordinates into the machine.") to_chat(user, "A message flashes across the screen reminding the traveller that the nuclear authentication disk is to remain on the [station_name()] at all times.") - qdel(I) + qdel(used_item) audible_message(SPAN_NOTICE("Locked in.")) src.locked = L one_time_use = 1 @@ -83,10 +83,10 @@ var/list/areaindex = list() . = TRUE - for(var/obj/item/radio/beacon/R in global.radio_beacons) - if(!R.functioning) + for(var/obj/item/radio/beacon/radio in global.radio_beacons) + if(!radio.functioning) continue - var/turf/T = get_turf(R) + var/turf/T = get_turf(radio) if (!T) continue if(!isPlayerLevel(T.z)) @@ -96,13 +96,13 @@ tmpname = "[tmpname] ([++areaindex[tmpname]])" else areaindex[tmpname] = 1 - L[tmpname] = R + L[tmpname] = radio - for (var/obj/item/implant/tracking/I in global.tracking_implants) - if (!I.implanted || !ismob(I.loc)) + for (var/obj/item/implant/tracking/used_item in global.tracking_implants) + if (!used_item.implanted || !ismob(used_item.loc)) continue else - var/mob/M = I.loc + var/mob/M = used_item.loc if (M.stat == DEAD) if (M.timeofdeath + 6000 < world.time) continue @@ -116,7 +116,7 @@ tmpname = "[tmpname] ([++areaindex[tmpname]])" else areaindex[tmpname] = 1 - L[tmpname] = I + L[tmpname] = used_item var/desc = input("Please select a location to lock in.", "Locking Computer") in L|null if(!desc) @@ -150,8 +150,8 @@ if(station && station.engaged) station.disengage() -/obj/machinery/computer/teleporter/proc/set_target(var/obj/O) - src.locked = O +/obj/machinery/computer/teleporter/proc/set_target(var/obj/target) + src.locked = target events_repository.register(/decl/observ/destroyed, locked, src, PROC_REF(target_lost)) /obj/machinery/computer/teleporter/Destroy() @@ -248,7 +248,7 @@ else z_flags &= ~ZMM_MANGLE_PLANES -/obj/machinery/teleport/station/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/teleport/station/attackby(var/obj/item/used_item, var/mob/user) return attack_hand_with_interaction_checks(user) || ..() /obj/machinery/teleport/station/interface_interact(var/mob/user) diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm index 235da1f889fd..4955f4173658 100644 --- a/code/game/machinery/turret_control.dm +++ b/code/game/machinery/turret_control.dm @@ -84,11 +84,11 @@ return ..() -/obj/machinery/turretid/attackby(obj/item/W, mob/user) +/obj/machinery/turretid/attackby(obj/item/used_item, mob/user) if(stat & BROKEN) return FALSE - if(istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer)) + if(istype(used_item, /obj/item/card/id)||istype(used_item, /obj/item/modular_computer)) if(src.allowed(user)) if(emagged) to_chat(user, "The turret control is unresponsive.") diff --git a/code/game/machinery/turrets/_turrets.dm b/code/game/machinery/turrets/_turrets.dm index dd6109cdf461..d0e2354b8d57 100644 --- a/code/game/machinery/turrets/_turrets.dm +++ b/code/game/machinery/turrets/_turrets.dm @@ -132,19 +132,19 @@ return update_use_power(POWER_USE_IDLE) -/obj/machinery/turret/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/gun) && !installed_gun) - if(!user.try_unequip(I, src)) +/obj/machinery/turret/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/gun) && !installed_gun) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, SPAN_NOTICE("You install \the [I] into \the [src]!")) - installed_gun = I + to_chat(user, SPAN_NOTICE("You install \the [used_item] into \the [src]!")) + installed_gun = used_item setup_gun() return TRUE - if(istype(I, /obj/item/ammo_magazine) || istype(I, /obj/item/ammo_casing)) + if(istype(used_item, /obj/item/ammo_magazine) || istype(used_item, /obj/item/ammo_casing)) var/obj/item/stock_parts/ammo_box/ammo_box = get_component_of_type(/obj/item/stock_parts/ammo_box) if(istype(ammo_box)) - return ammo_box.attackby(I, user) + return ammo_box.attackby(used_item, user) . = ..() // This is called after the gun gets instantiated or slotted in. @@ -234,7 +234,7 @@ return angle_between_two_angles(leftmost_traverse, angle, rightmost_traverse) /obj/machinery/turret/set_dir(ndir) - ..() + . = ..() calculate_traverse() // Instantly turns the turret to a specific absolute angle. @@ -323,12 +323,12 @@ else if(length(potential_targets)) while(length(potential_targets)) - var/weakref/W = potential_targets[1] - potential_targets -= W - if(is_valid_target(W.resolve())) - target = W + var/weakref/target_ref = potential_targets[1] + potential_targets -= target_ref + if(is_valid_target(target_ref.resolve())) + target = target_ref track_target() - return W + return target_ref target = null return null diff --git a/code/game/machinery/turrets/network_turret.dm b/code/game/machinery/turrets/network_turret.dm index ede8a175eef7..110daa4e9487 100644 --- a/code/game/machinery/turrets/network_turret.dm +++ b/code/game/machinery/turrets/network_turret.dm @@ -34,13 +34,13 @@ . = ..() set_extension(src, /datum/extension/network_device/sentry_turret) -/obj/machinery/turret/network/attackby(obj/item/I, mob/user) +/obj/machinery/turret/network/attackby(obj/item/used_item, mob/user) . = ..() - if(istype(I, /obj/item/stock_parts/computer/hard_drive/portable)) + if(istype(used_item, /obj/item/stock_parts/computer/hard_drive/portable)) if(!check_access(user)) to_chat(user, SPAN_WARNING("\The [src] flashes a red light: you lack access to download its logfile.")) return - var/obj/item/stock_parts/computer/hard_drive/portable/drive = I + var/obj/item/stock_parts/computer/hard_drive/portable/drive = used_item var/datum/computer_file/data/logfile/turret_log = prepare_log_file() if(drive.store_file(turret_log) == OS_FILE_SUCCESS) to_chat(user, SPAN_NOTICE("\The [src] flashes a blue light as it downloads its log file onto \the [drive]!")) diff --git a/code/game/machinery/turrets/turret_ammo.dm b/code/game/machinery/turrets/turret_ammo.dm index 2ae590923072..656d35162e5e 100644 --- a/code/game/machinery/turrets/turret_ammo.dm +++ b/code/game/machinery/turrets/turret_ammo.dm @@ -17,9 +17,9 @@ QDEL_NULL_LIST(stored_ammo) . = ..() -/obj/item/stock_parts/ammo_box/attackby(obj/item/W, mob/user) +/obj/item/stock_parts/ammo_box/attackby(obj/item/used_item, mob/user) . = ..() - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) to_chat(user, SPAN_NOTICE("You dump the ammo stored in \the [src] on the ground.")) for(var/obj/item/ammo_casing/casing as anything in stored_ammo) casing.forceMove(get_turf(src)) @@ -28,8 +28,8 @@ stored_caliber = null return TRUE - if(istype(W, /obj/item/ammo_casing)) - var/obj/item/ammo_casing/casing = W + if(istype(used_item, /obj/item/ammo_casing)) + var/obj/item/ammo_casing/casing = used_item if(stored_caliber && casing.caliber != stored_caliber) to_chat(user, SPAN_WARNING("The caliber of \the [casing] does not match the caliber stored in \the [src]!")) return TRUE @@ -45,8 +45,8 @@ playsound(user, 'sound/weapons/guns/interaction/bullet_insert.ogg', 50, 1) return TRUE - if(istype(W, /obj/item/ammo_magazine)) - var/obj/item/ammo_magazine/magazine = W + if(istype(used_item, /obj/item/ammo_magazine)) + var/obj/item/ammo_magazine/magazine = used_item if(stored_caliber && magazine.caliber != stored_caliber) to_chat(user, SPAN_WARNING("The caliber of \the [magazine] does not match the caliber stored in \the [src]!")) return TRUE @@ -58,7 +58,8 @@ return TRUE stored_caliber = magazine.caliber - for(var/obj/item/ammo_casing/casing in magazine.get_stored_ammo_count()) + magazine.create_initial_contents() + for(var/obj/item/ammo_casing/casing in magazine.stored_ammo) // Just in case. if(casing.caliber != stored_caliber) continue diff --git a/code/game/machinery/vending/_vending.dm b/code/game/machinery/vending/_vending.dm index b3036e173176..0587601e9378 100644 --- a/code/game/machinery/vending/_vending.dm +++ b/code/game/machinery/vending/_vending.dm @@ -120,8 +120,8 @@ product_records.Add(product) /obj/machinery/vending/Destroy() - for(var/datum/stored_items/vending_products/R in product_records) - qdel(R) + for(var/datum/stored_items/vending_products/product_record in product_records) + qdel(product_record) product_records = null return ..() @@ -144,9 +144,9 @@ if(!(. = ..()) && isitem(dropping) && istype(user) && user.check_intent(I_FLAG_HELP) && CanPhysicallyInteract(user)) return attempt_to_stock(dropping, user) -/obj/machinery/vending/attackby(obj/item/W, mob/user) +/obj/machinery/vending/attackby(obj/item/used_item, mob/user) - var/obj/item/charge_stick/CS = W.GetChargeStick() + var/obj/item/charge_stick/CS = used_item.GetChargeStick() if (currently_vending && vendor_account && !vendor_account.suspended) if(!vend_ready) @@ -159,8 +159,8 @@ if (CS) paid = pay_with_charge_card(CS) handled = 1 - else if (istype(W, /obj/item/cash)) - var/obj/item/cash/C = W + else if (istype(used_item, /obj/item/cash)) + var/obj/item/cash/C = used_item paid = pay_with_cash(C) handled = 1 @@ -171,34 +171,31 @@ SSnano.update_uis(src) return TRUE // don't smack that machine with your $2 - if (istype(W, /obj/item/cash)) + if (istype(used_item, /obj/item/cash)) attack_hand_with_interaction_checks(user) return TRUE - if(IS_MULTITOOL(W) || IS_WIRECUTTER(W)) + if(IS_MULTITOOL(used_item) || IS_WIRECUTTER(used_item)) if(panel_open) attack_hand_with_interaction_checks(user) return TRUE - if((. = component_attackby(W, user))) + if((. = component_attackby(used_item, user))) return - if((user.check_intent(I_FLAG_HELP)) && attempt_to_stock(W, user)) + if((user.check_intent(I_FLAG_HELP)) && attempt_to_stock(used_item, user)) return TRUE - if((obj_flags & OBJ_FLAG_ANCHORABLE) && (IS_WRENCH(W) || IS_HAMMER(W))) - wrench_floor_bolts(user, null, W) - power_change() - return + return ..() // handle anchoring and bashing /obj/machinery/vending/state_transition(decl/machine_construction/new_state) . = ..() SSnano.update_uis(src) /obj/machinery/vending/proc/attempt_to_stock(var/obj/item/I, var/mob/user) - for(var/datum/stored_items/vending_products/R in product_records) - if(I.type == R.item_path) - stock(I, R, user) + for(var/datum/stored_items/vending_products/product_record in product_records) + if(I.type == product_record.item_path) + stock(I, product_record, user) return 1 /** @@ -309,20 +306,20 @@ if (href_list["vend"] && !currently_vending) var/key = text2num(href_list["vend"]) - var/datum/stored_items/vending_products/R = LAZYACCESS(product_records, key) - if(!R) + var/datum/stored_items/vending_products/product_record = LAZYACCESS(product_records, key) + if(!product_record) return TOPIC_REFRESH // This should not happen unless the request from NanoUI was bad - if(!(R.category & categories)) + if(!(product_record.category & categories)) return TOPIC_REFRESH - if(R.price <= 0) - vend(R, user) + if(product_record.price <= 0) + vend(product_record, user) else if(issilicon(user)) //If the item is not free, provide feedback if a synth is trying to buy something. to_chat(user, SPAN_DANGER("Artificial unit recognized. Artificial units cannot complete this transaction. Purchase canceled.")) else - currently_vending = R + currently_vending = product_record if(!vendor_account || vendor_account.suspended) status_message = "This machine is currently unable to process payments due to problems with the associated account." status_error = 1 @@ -344,7 +341,7 @@ return list() return ..() -/obj/machinery/vending/proc/vend(var/datum/stored_items/vending_products/R, mob/user) +/obj/machinery/vending/proc/vend(var/datum/stored_items/vending_products/product_record, mob/user) if(!vend_ready) return if((!allowed(user)) && !emagged && scan_id) //For SECURE VENDING MACHINES YEAH @@ -365,7 +362,7 @@ var/vend_state = "[icon_state]-vend" if (check_state_in_icon(vend_state, icon)) //Show the vending animation if needed flick(vend_state, src) - addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/vending, finish_vending), R), vend_delay) + addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/vending, finish_vending), product_record), vend_delay) /obj/machinery/vending/proc/do_vending_reply() set waitfor = FALSE @@ -394,14 +391,14 @@ * Add item to the machine * * Checks if item is vendable in this machine should be performed before - * calling. W is the item being inserted, R is the associated vending_product entry. + * calling. used_item is the item being inserted, product_record is the associated vending_product entry. */ -/obj/machinery/vending/proc/stock(obj/item/W, var/datum/stored_items/vending_products/R, var/mob/user) - if(!user.try_unequip(W)) +/obj/machinery/vending/proc/stock(obj/item/used_item, var/datum/stored_items/vending_products/product_record, var/mob/user) + if(!user.try_unequip(used_item)) return - if(R.add_product(W)) - to_chat(user, SPAN_NOTICE("You insert \the [W] in the product receptor.")) + if(product_record.add_product(used_item)) + to_chat(user, SPAN_NOTICE("You insert \the [used_item] in the product receptor.")) SSnano.update_uis(src) return 1 @@ -456,9 +453,9 @@ //Oh no we're malfunctioning! Dump out some product and break. /obj/machinery/vending/proc/malfunction() set waitfor = FALSE - for(var/datum/stored_items/vending_products/R in product_records) - while(R.get_amount()>0) - R.get_product(loc) + for(var/datum/stored_items/vending_products/product_record in product_records) + while(product_record.get_amount()>0) + product_record.get_product(loc) break set_broken(TRUE) @@ -469,8 +466,8 @@ if(!target) return 0 - for(var/datum/stored_items/vending_products/R in shuffle(product_records)) - throw_item = R.get_product(loc) + for(var/datum/stored_items/vending_products/product_record in shuffle(product_records)) + throw_item = product_record.get_product(loc) if(!QDELETED(throw_item)) break if(QDELETED(throw_item)) diff --git a/code/game/machinery/vending/misc.dm b/code/game/machinery/vending/misc.dm index a9386e3930e9..76360d927358 100644 --- a/code/game/machinery/vending/misc.dm +++ b/code/game/machinery/vending/misc.dm @@ -27,7 +27,7 @@ /obj/item/chems/glass/beaker/bowl = 2, /obj/item/plate/tray/metal/aluminium = 8, /obj/item/knife/kitchen = 3, - /obj/item/kitchen/rollingpin = 2, + /obj/item/rollingpin = 2, /obj/item/chems/drinks/pitcher = 2, /obj/item/chems/drinks/glass2/coffeecup = 8, /obj/item/chems/drinks/glass2/coffeecup/teacup = 8, diff --git a/code/game/machinery/vending_deconstruction.dm b/code/game/machinery/vending_deconstruction.dm index 958f9d71d4b3..57ab1eba0302 100644 --- a/code/game/machinery/vending_deconstruction.dm +++ b/code/game/machinery/vending_deconstruction.dm @@ -25,25 +25,25 @@ var/obj/machinery/vending/vendor = over var/target_type = vendor.base_type || vendor.type if(ispath(expected_type, target_type)) - for(var/datum/stored_items/R in product_records) + for(var/datum/stored_items/product_record in product_records) for(var/datum/stored_items/record in vendor.product_records) - if(record.merge(R)) + if(record.merge(product_record)) break - if(!QDELETED(R)) - R.migrate(over) - vendor.product_records += R + if(!QDELETED(product_record)) + product_record.migrate(over) + vendor.product_records += product_record product_records = null SSnano.update_uis(vendor) qdel(src) return TRUE . = ..() -/obj/structure/vending_refill/get_contained_matter() +/obj/structure/vending_refill/get_contained_matter(include_reagents = TRUE) . = ..() for(var/datum/stored_items/vending_products/record in product_records) . = MERGE_ASSOCS_WITH_NUM_VALUES(., record.get_combined_matter(include_instances = FALSE)) -/obj/machinery/vending/get_contained_matter() +/obj/machinery/vending/get_contained_matter(include_reagents = TRUE) . = ..() for(var/datum/stored_items/vending_products/record in product_records) . = MERGE_ASSOCS_WITH_NUM_VALUES(., record.get_combined_matter(include_instances = FALSE)) @@ -52,8 +52,8 @@ var/obj/structure/vending_refill/dump = new(loc) dump.SetName("[dump.name] ([name])") dump.expected_type = base_type || type - for(var/datum/stored_items/vending_products/R in product_records) - R.migrate(dump) + for(var/datum/stored_items/vending_products/product_record in product_records) + product_record.migrate(dump) dump.product_records = product_records product_records = null . = ..() \ No newline at end of file diff --git a/code/game/machinery/wall_frames.dm b/code/game/machinery/wall_frames.dm index f06099ed6e37..56e7c788416d 100644 --- a/code/game/machinery/wall_frames.dm +++ b/code/game/machinery/wall_frames.dm @@ -9,15 +9,15 @@ var/reverse = 0 //if resulting object faces opposite its dir (like light fixtures) var/fully_construct = FALSE // Results in a machine with all parts auto-installed and ready to go if TRUE; if FALSE, the machine will spawn without removable expected parts -/obj/item/frame/get_contained_matter() +/obj/item/frame/get_contained_matter(include_reagents = TRUE) . = ..() if(fully_construct) var/list/cost = atom_info_repository.get_matter_for(build_machine_type) for(var/key in cost) .[key] += cost[key] -/obj/item/frame/attackby(obj/item/W, mob/user) - if(IS_WRENCH(W)) +/obj/item/frame/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item)) for(var/key in matter) SSmaterials.create_object(key, get_turf(src), round(matter[key]/SHEET_MATERIAL_AMOUNT)) qdel(src) @@ -278,10 +278,10 @@ return TRUE master_controller_id_tag = null -/obj/item/frame/button/airlock_controller/attackby(obj/item/W, mob/user) - if(!istype(W, /obj/item/stock_parts/circuitboard)) +/obj/item/frame/button/airlock_controller/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/stock_parts/circuitboard)) return ..() - var/obj/item/stock_parts/circuitboard/board = W + var/obj/item/stock_parts/circuitboard/board = used_item var/obj/machinery/M if(ispath(board.build_path, /obj/machinery/embedded_controller/radio)) build_machine_type = board.build_path @@ -291,7 +291,7 @@ . = TRUE if(.) M = build_machine_type - to_chat(user, SPAN_NOTICE("You setup \the [src]'s software to work as a '[initial(M.name)]', using \the [W].")) + to_chat(user, SPAN_NOTICE("You setup \the [src]'s software to work as a '[initial(M.name)]', using \the [used_item].")) return TRUE return FALSE @@ -305,8 +305,8 @@ to_chat(user, SPAN_WARNING("First, use a multitool on the kit to properly setup the controller's software!")) //Let them also hit it with a circuitboard if they so wish. But multitool is better when you don't want to print one for nothing. -/obj/item/frame/button/airlock_controller/kit/attackby(obj/item/W, mob/user) - if(!IS_MULTITOOL(W)) +/obj/item/frame/button/airlock_controller/kit/attackby(obj/item/used_item, mob/user) + if(!IS_MULTITOOL(used_item)) return ..() //Handle kit configuration var/obj/machinery/M = /obj/machinery/dummy_airlock_controller diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index 1beca6b072f1..f6e04eb2d50f 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -16,7 +16,6 @@ anchored = TRUE construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = NOSCREEN obj_flags = OBJ_FLAG_ANCHORABLE clicksound = "button" clickvol = 40 @@ -93,58 +92,59 @@ state &= ~WASHER_STATE_RUNNING update_use_power(POWER_USE_IDLE) -/obj/machinery/washing_machine/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/chems/pill/detergent)) +/obj/machinery/washing_machine/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/chems/pill/detergent)) if(!(atom_flags & ATOM_FLAG_OPEN_CONTAINER)) to_chat(user, SPAN_WARNING("Open the detergent port first!")) return TRUE if(reagents.total_volume >= reagents.maximum_volume) to_chat(user, SPAN_WARNING("The detergent port is full!")) return TRUE - if(!user.try_unequip(W)) + if(!user.try_unequip(used_item)) return TRUE // Directly transfer to the holder to avoid touch reactions. - W.reagents?.trans_to_holder(reagents, W.reagents.total_volume) - to_chat(user, SPAN_NOTICE("You dissolve \the [W] in the detergent port.")) - qdel(W) + used_item.reagents?.trans_to_holder(reagents, used_item.reagents.total_volume) + to_chat(user, SPAN_NOTICE("You dissolve \the [used_item] in the detergent port.")) + qdel(used_item) return TRUE if(state & WASHER_STATE_RUNNING) to_chat(user, SPAN_WARNING("\The [src] is currently running.")) return TRUE + if((. = ..())) + return + // If the detergent port is open and the item is an open container, assume we're trying to fill the detergent port. - if(!(state & WASHER_STATE_CLOSED) && !((atom_flags & W.atom_flags) & ATOM_FLAG_OPEN_CONTAINER)) + if(!(state & WASHER_STATE_CLOSED) && !((atom_flags & used_item.atom_flags) & ATOM_FLAG_OPEN_CONTAINER)) var/list/wash_whitelist = get_wash_whitelist() var/list/wash_blacklist = get_wash_blacklist() var/list/washing_atoms = get_contained_external_atoms() if(length(washing_atoms) < 5) - if(istype(W, /obj/item/holder)) // Mob holder - for(var/mob/living/doggy in W) + if(istype(used_item, /obj/item/holder)) // Mob holder + for(var/mob/living/doggy in used_item) doggy.forceMove(src) - qdel(W) + qdel(used_item) state |= WASHER_STATE_LOADED update_icon() return TRUE // An empty whitelist implies all items can be washed. - else if((!length(wash_whitelist) || is_type_in_list(W, wash_whitelist)) && !is_type_in_list(W, wash_blacklist)) - if(W.w_class > max_item_size) - to_chat(user, SPAN_WARNING("\The [W] is too large for \the [src]!")) + else if((!length(wash_whitelist) || is_type_in_list(used_item, wash_whitelist)) && !is_type_in_list(used_item, wash_blacklist)) + if(used_item.w_class > max_item_size) + to_chat(user, SPAN_WARNING("\The [used_item] is too large for \the [src]!")) return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE state |= WASHER_STATE_LOADED update_icon() else - to_chat(user, SPAN_WARNING("You can't put \the [W] in \the [src].")) + to_chat(user, SPAN_WARNING("You can't put \the [used_item] in \the [src].")) return TRUE else to_chat(user, SPAN_NOTICE("\The [src] is full.")) return TRUE - return ..() - /obj/machinery/washing_machine/physical_attack_hand(mob/user) if(state & WASHER_STATE_RUNNING) to_chat(user, SPAN_WARNING("\The [src] is currently running.")) diff --git a/code/game/movietitles.dm b/code/game/movietitles.dm index 5361529c1593..e193fae03d2a 100644 --- a/code/game/movietitles.dm +++ b/code/game/movietitles.dm @@ -66,9 +66,9 @@ var/global/list/end_titles if(GetAssignment(H) != "Unassigned") job = ", [uppertext(GetAssignment(H))]" var/used_name = H.real_name - var/datum/computer_file/report/crew_record/R = get_crewmember_record(H.real_name) - if(R && R.get_rank()) - var/datum/mil_rank/rank = mil_branches.get_rank(R.get_branch(), R.get_rank()) + var/datum/computer_file/report/crew_record/record = get_crewmember_record(H.real_name) + if(record && record.get_rank()) + var/datum/mil_rank/rank = mil_branches.get_rank(record.get_branch(), record.get_rank()) if(rank.name_short) used_name = "[rank.name_short] [used_name]" var/showckey = 0 @@ -102,17 +102,16 @@ var/global/list/end_titles if(H.timeofdeath < 5 MINUTES) //no prespawned corpses continue if(H.isMonkey() && findtext(H.real_name,"[lowertext(H.species.name)]")) - monkies[H.species.name] += 1 + monkies[H.species] += 1 else if(H.real_name) corpses += H.real_name - for(var/spec in monkies) - var/decl/species/S = get_species_by_key(spec) - corpses += "[monkies[spec]] [lowertext(monkies[spec] > 1 ? S.name_plural : S.name)]" + for(var/decl/species/monkey_species in monkies) + corpses += "[monkies[monkey_species]] [lowertext(monkies[monkey_species] > 1 ? monkey_species.name_plural : monkey_species.name)]" if(corpses.len) titles += "
BASED ON REAL EVENTS
In memory of [english_list(corpses)].
" var/list/staff = list("PRODUCTION STAFF:") - var/list/staffjobs = list("Coffe Fetcher", "Cameraman", "Angry Yeller", "Chair Operator", "Choreographer", "Historical Consultant", "Costume Designer", "Chief Editor", "Executive Assistant") + var/list/staffjobs = list("Coffee Fetcher", "Cameraman", "Angry Yeller", "Chair Operator", "Choreographer", "Historical Consultant", "Costume Designer", "Chief Editor", "Executive Assistant") var/list/goodboys = list() for(var/client/C) if(!C.holder) @@ -120,7 +119,7 @@ var/global/list/end_titles if(C.holder.rights & (R_DEBUG|R_ADMIN)) var/list/all_backgrounds = decls_repository.get_decls_of_subtype(/decl/background_detail/heritage) var/decl/background_detail/cult = all_backgrounds[pick(all_backgrounds)] - staff += "[uppertext(pick(staffjobs))] - [cult.get_random_name(pick(MALE, FEMALE))] a.k.a. '[C.key]'" + staff += "[uppertext(pick(staffjobs))] - [cult.get_random_name(C.gender)] a.k.a. '[C.key]'" else if(C.holder.rights & R_MOD) goodboys += "[C.key]" diff --git a/code/game/objects/__objs.dm b/code/game/objects/__objs.dm index 8ea7caabc68b..62566afe1a1c 100644 --- a/code/game/objects/__objs.dm +++ b/code/game/objects/__objs.dm @@ -293,7 +293,7 @@ /obj/proc/WillContain() return -/obj/get_contained_matter() +/obj/get_contained_matter(include_reagents = TRUE) . = ..() if(length(matter)) . = MERGE_ASSOCS_WITH_NUM_VALUES(., matter.Copy()) @@ -479,3 +479,9 @@ animate_heat_glow(temperature, scale_sub = round((my_material.melting_point - T20C) * 0.25) + T20C, scale_div = round(my_material.melting_point * 0.75), scale_max = my_material.melting_point, skip_filter = TRUE, anim_time = anim_time) if(isatom(loc)) loc.update_icon() + +/obj/is_valid_merchant_pad_target() + if(anchored) + return FALSE + return ..() + diff --git a/code/game/objects/_obj_edibility.dm b/code/game/objects/_objs_edibility.dm similarity index 98% rename from code/game/objects/_obj_edibility.dm rename to code/game/objects/_objs_edibility.dm index 9fa4ec70827f..65fc62ced6a4 100644 --- a/code/game/objects/_obj_edibility.dm +++ b/code/game/objects/_objs_edibility.dm @@ -156,8 +156,8 @@ show_feed_message_end(user, target, consumption_method) if(consumption_method == EATING_METHOD_DRINK && target?.has_personal_goal(/datum/goal/achievement/specific_object/drink)) - for(var/R in reagents.reagent_volumes) - target.update_personal_goal(/datum/goal/achievement/specific_object/drink, R) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + target.update_personal_goal(/datum/goal/achievement/specific_object/drink, reagent) handle_consumed(user, target, consumption_method) return EATEN_SUCCESS diff --git a/code/game/objects/auras/aura.dm b/code/game/objects/auras/aura.dm deleted file mode 100644 index 5de18f3adf62..000000000000 --- a/code/game/objects/auras/aura.dm +++ /dev/null @@ -1,58 +0,0 @@ -/*Auras are simple: They are simple overriders for attackbys, bullet_act, damage procs, etc. They also tick after their respective mob. -They should be used for undeterminate mob effects, like for instance a toggle-able forcefield, or indestructability as long as you don't move. -They should also be used for when you want to effect the ENTIRE mob, like having an armor buff or showering candy everytime you walk. -*/ - -/obj/aura - var/mob/living/user - -/obj/aura/Initialize() - . = ..() - if(isliving(loc)) - added_to(loc) - user.add_aura(src) - -/obj/aura/Destroy() - if(user) - user.remove_aura(src) - removed() - return ..() - -/obj/aura/proc/added_to(var/mob/living/target) - user = target - -/obj/aura/proc/removed() - user = null - -/obj/aura/proc/life_tick() - return 0 - -/obj/aura/attackby(var/obj/item/I, var/mob/user) - return 0 - -/obj/aura/bullet_act(var/obj/item/projectile/P, var/def_zone) - return 0 - -/obj/aura/hitby() - SHOULD_CALL_PARENT(FALSE) - return FALSE - -/obj/aura/debug - var/returning = FALSE - -/obj/aura/debug/attackby(var/obj/item/I, var/mob/user) - log_debug("Attackby for \ref[src]: [I], [user]") - return returning - -/obj/aura/debug/bullet_act(var/obj/item/projectile/P, var/def_zone) - log_debug("Bullet Act for \ref[src]: [P], [def_zone]") - return returning - -/obj/aura/debug/life_tick() - log_debug("Life tick") - return returning - -/obj/aura/debug/hitby(var/atom/movable/M, var/datum/thrownthing/TT) - SHOULD_CALL_PARENT(FALSE) - log_debug("Hit By for \ref[src]: [M], [TT.speed]") - return returning \ No newline at end of file diff --git a/code/game/objects/auras/personal_shields/personal_shield.dm b/code/game/objects/auras/personal_shields/personal_shield.dm deleted file mode 100644 index 934005ceb4f9..000000000000 --- a/code/game/objects/auras/personal_shields/personal_shield.dm +++ /dev/null @@ -1,34 +0,0 @@ -/obj/aura/personal_shield - name = "personal shield" - -/obj/aura/personal_shield/added_to(var/mob/living/L) - ..() - playsound(user,'sound/weapons/flash.ogg',35,1) - to_chat(user,"You feel your body prickle as \the [src] comes online.") - -/obj/aura/personal_shield/bullet_act(var/obj/item/projectile/P, var/def_zone) - user.visible_message("\The [user]'s [src.name] flashes before \the [P] can hit them!") - new /obj/effect/temporary(get_turf(src), 2 SECONDS,'icons/obj/machines/shielding.dmi',"shield_impact") - playsound(user,'sound/effects/basscannon.ogg',35,1) - return AURA_FALSE|AURA_CANCEL - -/obj/aura/personal_shield/removed() - to_chat(user,"\The [src] goes offline!") - playsound(user,'sound/mecha/internaldmgalarm.ogg',25,1) - ..() - -/obj/aura/personal_shield/device - var/obj/item/personal_shield/shield - -/obj/aura/personal_shield/device/bullet_act() - . = ..() - if(shield) - shield.take_charge() - -/obj/aura/personal_shield/device/Initialize(mapload, var/user_shield) - . = ..() - shield = user_shield - -/obj/aura/personal_shield/device/Destroy() - shield = null - return ..() \ No newline at end of file diff --git a/code/game/objects/auras/radiant_aura.dm b/code/game/objects/auras/radiant_aura.dm deleted file mode 100644 index d25cfa807b95..000000000000 --- a/code/game/objects/auras/radiant_aura.dm +++ /dev/null @@ -1,20 +0,0 @@ -/obj/aura/radiant_aura - name = "radiant aura" - icon = 'icons/effects/effects.dmi' - icon_state = "fire_goon" - layer = ABOVE_WINDOW_LAYER - -/obj/aura/radiant_aura/added_to(var/mob/living/L) - ..() - to_chat(L,"A bubble of light appears around you, exuding protection and warmth.") - set_light(6, 6, "#e09d37") - -/obj/aura/radiant_aura/removed() - to_chat(user, "Your protective aura dissipates, leaving you feeling cold and unsafe.") - ..() - -/obj/aura/radiant_aura/bullet_act(var/obj/item/projectile/P, var/def_zone) - if(P.damage_flags() & DAM_LASER) - user.visible_message("\The [P] refracts, bending into \the [user]'s aura.") - return AURA_FALSE - return 0 diff --git a/code/game/objects/auras/regenerating_aura.dm b/code/game/objects/auras/regenerating_aura.dm deleted file mode 100644 index 7c313fc2d1c3..000000000000 --- a/code/game/objects/auras/regenerating_aura.dm +++ /dev/null @@ -1,121 +0,0 @@ -/obj/aura/regenerating - name = "regenerating aura" - var/brute_mult = 1 - var/fire_mult = 1 - var/tox_mult = 1 - -/obj/aura/regenerating/life_tick() - user.heal_damage(BRUTE, brute_mult, do_update_health = FALSE) - user.heal_damage(BURN, fire_mult, do_update_health = FALSE) - user.heal_damage(TOX, tox_mult) - -/obj/aura/regenerating/human - var/nutrition_damage_mult = 1 //How much nutrition it takes to heal regular damage - var/external_nutrition_mult = 50 // How much nutrition it takes to regrow a limb - var/organ_mult = 2 - var/regen_message = "Your body throbs as you feel your ORGAN regenerate." - var/grow_chance = 0 - var/grow_threshold = 0 - var/ignore_tag = BP_BRAIN //organ tag to ignore - var/last_nutrition_warning = 0 - var/innate_heal = TRUE // Whether the aura is on, basically. - - -/obj/aura/regenerating/human/proc/external_regeneration_effect(var/obj/item/organ/external/O, var/mob/living/human/H) - return - -/obj/aura/regenerating/human/life_tick() - var/mob/living/human/H = user - if(!istype(H)) - . = 0 - CRASH("Someone gave [user.type] a [src.type] aura. This is invalid.") - if(!innate_heal || H.is_in_stasis() || H.stat == DEAD) - return 0 - if(H.nutrition < nutrition_damage_mult) - low_nut_warning() - return 0 - - var/update_health = FALSE - var/organ_regen = get_config_value(/decl/config/num/health_organ_regeneration_multiplier) - if(brute_mult && H.get_damage(BRUTE)) - update_health = TRUE - H.heal_damage(BRUTE, brute_mult * organ_regen, do_update_health = FALSE) - H.adjust_nutrition(-nutrition_damage_mult) - if(fire_mult && H.get_damage(BURN)) - update_health = TRUE - H.heal_damage(BURN, fire_mult * organ_regen, do_update_health = FALSE) - H.adjust_nutrition(-nutrition_damage_mult) - if(tox_mult && H.get_damage(TOX)) - update_health = TRUE - H.heal_damage(TOX, tox_mult * organ_regen, do_update_health = FALSE) - H.adjust_nutrition(-nutrition_damage_mult) - if(update_health) - H.update_health() - - if(!can_regenerate_organs()) - return 1 - if(organ_mult) - if(prob(10) && H.nutrition >= 150 && !H.get_damage(BRUTE) && !H.get_damage(BURN)) - var/obj/item/organ/external/D = GET_EXTERNAL_ORGAN(H, BP_HEAD) - if (D.status & ORGAN_DISFIGURED) - if (H.nutrition >= 20) - D.status &= ~ORGAN_DISFIGURED - H.adjust_nutrition(-20) - else - low_nut_warning(BP_HEAD) - - var/list/organs = H.get_internal_organs() - for(var/obj/item/organ/internal/regen_organ in shuffle(organs.Copy())) - if(BP_IS_PROSTHETIC(regen_organ) || regen_organ.organ_tag == ignore_tag) - continue - if(istype(regen_organ)) - if(regen_organ.get_organ_damage() > 0 && !(regen_organ.status & ORGAN_DEAD)) - if (H.nutrition >= organ_mult) - regen_organ.adjust_organ_damage(-(organ_mult)) - H.adjust_nutrition(-organ_mult) - if(prob(5)) - to_chat(H, replacetext(regen_message,"ORGAN", regen_organ.name)) - else - low_nut_warning(regen_organ.name) - - if(prob(grow_chance)) - var/decl/bodytype/root_bodytype = H.get_bodytype() - for(var/limb_type in root_bodytype.has_limbs) - var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(H, limb_type) - if(E && E.organ_tag != BP_HEAD && !E.is_vital_to_owner() && !E.is_usable()) //Skips heads and vital bits... - if (H.nutrition > grow_threshold) - H.remove_organ(E) //...because no one wants their head to explode to make way for a new one. - qdel(E) - E= null - else - low_nut_warning(E.name) - if(!E) - var/list/organ_data = root_bodytype.has_limbs[limb_type] - var/limb_path = organ_data["path"] - var/obj/item/organ/external/O = new limb_path(H) - external_regeneration_effect(O,H) - H.adjust_nutrition(-external_nutrition_mult) - organ_data["descriptor"] = O.name - H.update_body() - return - else if (H.nutrition > grow_threshold) //We don't subtract any nut here, but let's still only heal wounds when we have nut. - for(var/datum/wound/W in E.wounds) - if(W.wound_damage() == 0 && prob(50)) - qdel(W) - return 1 - -/obj/aura/regenerating/human/proc/low_nut_warning(var/wound_type) - if (last_nutrition_warning + 1 MINUTE < world.time) - to_chat(user, "You need more energy to regenerate your [wound_type || "wounds"].") - last_nutrition_warning = world.time - return 1 - return 0 - -/obj/aura/regenerating/human/proc/toggle() - innate_heal = !innate_heal - -/obj/aura/regenerating/human/proc/can_toggle() - return TRUE - -/obj/aura/regenerating/human/proc/can_regenerate_organs() - return TRUE diff --git a/code/game/objects/compass/compass_overmap.dm b/code/game/objects/compass/compass_overmap.dm index 31ef3d2bb1fe..11ee76eef866 100644 --- a/code/game/objects/compass/compass_overmap.dm +++ b/code/game/objects/compass/compass_overmap.dm @@ -30,10 +30,10 @@ var/list/seen_waypoint_ids = list() for(var/key in owner.known_sectors) - var/datum/computer_file/data/waypoint/R = owner.known_sectors[key] - var/wp_id = "\ref[R]" - set_waypoint(wp_id, uppertext(R.fields["name"]), R.fields["x"], R.fields["y"], owner_turf.z, R.fields["color"] || COLOR_SILVER) - if(!R.fields["tracking"]) + var/datum/computer_file/data/waypoint/waypoint = owner.known_sectors[key] + var/wp_id = "\ref[waypoint]" + set_waypoint(wp_id, uppertext(waypoint.fields["name"]), waypoint.fields["x"], waypoint.fields["y"], owner_turf.z, waypoint.fields["color"] || COLOR_SILVER) + if(!waypoint.fields["tracking"]) hide_waypoint(wp_id) seen_waypoint_ids += wp_id for(var/id in compass_waypoints) diff --git a/code/game/objects/effects/chem/foam.dm b/code/game/objects/effects/chem/foam.dm index 70d5c86bb2e0..06a1a7d81f79 100644 --- a/code/game/objects/effects/chem/foam.dm +++ b/code/game/objects/effects/chem/foam.dm @@ -59,8 +59,8 @@ if(!metal) F.create_reagents(10) if(reagents) - for(var/R in reagents.reagent_volumes) - F.add_to_reagents(R, 1, safety = 1) //added safety check since reagents in the foam have already had a chance to react + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + F.add_to_reagents(reagent, 1, safety = 1) //added safety check since reagents in the foam have already had a chance to react /obj/effect/effect/foam/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) // foam disolves when heated, except metal foams if(!metal && prob(max(0, exposed_temperature - 475))) @@ -93,8 +93,8 @@ // bit of a hack here. Foam carries along any reagent also present in the glass it is mixed with (defaults to water if none is present). Rather than actually transfer the reagents, this makes a list of the reagent ids and spawns 1 unit of that reagent when the foam disolves. if(carry && !metal) - for(var/R in carry.reagent_volumes) - carried_reagents += R + for(var/decl/material/reagent as anything in carry.reagent_volumes) + carried_reagents += reagent /datum/effect/effect/system/foam_spread/start() spawn(0) @@ -170,11 +170,11 @@ physically_destroyed() return TRUE -/obj/structure/foamedmetal/attackby(var/obj/item/I, var/mob/user) - if(prob(I.expend_attack_force(user) * 20 - metal * 25)) +/obj/structure/foamedmetal/attackby(var/obj/item/used_item, var/mob/user) + if(prob(used_item.expend_attack_force(user) * 20 - metal * 25)) user.visible_message( SPAN_WARNING("\The [user] smashes through the foamed metal."), - SPAN_NOTICE("You smash through the foamed metal with \the [I].") + SPAN_NOTICE("You smash through the foamed metal with \the [used_item].") ) physically_destroyed() else diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm index 5fae22fc6003..421c415cb24f 100644 --- a/code/game/objects/effects/decals/Cleanable/humans.dm +++ b/code/game/objects/effects/decals/Cleanable/humans.dm @@ -196,8 +196,8 @@ /obj/effect/decal/cleanable/blood/writing/Initialize() . = ..() if(LAZYLEN(random_icon_states)) - for(var/obj/effect/decal/cleanable/blood/writing/W in loc) - random_icon_states.Remove(W.icon_state) + for(var/obj/effect/decal/cleanable/blood/writing/writing in loc) + random_icon_states.Remove(writing.icon_state) icon_state = pick(random_icon_states) else icon_state = "writing1" @@ -255,9 +255,9 @@ /obj/effect/decal/cleanable/blood/gibs/proc/streak(var/list/directions) spawn (0) var/direction = pick(directions) - for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) + for (var/i in 1 to pick(1, 200; 2, 150; 3, 50; 4)) sleep(3) - if (i > 0) + if (i > 1) var/obj/effect/decal/cleanable/blood/b = new /obj/effect/decal/cleanable/blood/splatter(loc, null, chemical) b.basecolor = src.basecolor b.update_icon() diff --git a/code/game/objects/effects/decals/Cleanable/misc.dm b/code/game/objects/effects/decals/Cleanable/misc.dm index 6fe6ea7441a4..3da636a2c505 100644 --- a/code/game/objects/effects/decals/Cleanable/misc.dm +++ b/code/game/objects/effects/decals/Cleanable/misc.dm @@ -16,13 +16,13 @@ sweepable = TRUE burnable = FALSE -/obj/effect/decal/cleanable/ash/attackby(obj/item/I, mob/user) - if(ATOM_IS_OPEN_CONTAINER(I)) - if(REAGENTS_FREE_SPACE(I.reagents) <= 0) - to_chat(user, SPAN_WARNING("\The [I] is full.")) +/obj/effect/decal/cleanable/ash/attackby(obj/item/used_item, mob/user) + if(ATOM_IS_OPEN_CONTAINER(used_item)) + if(REAGENTS_FREE_SPACE(used_item.reagents) <= 0) + to_chat(user, SPAN_WARNING("\The [used_item] is full.")) else - I.add_to_reagents(/decl/material/solid/carbon/ashes, 20) - user.visible_message(SPAN_NOTICE("\The [user] carefully scoops \the [src] into \the [I].")) + used_item.add_to_reagents(/decl/material/solid/carbon/ashes, 20) + user.visible_message(SPAN_NOTICE("\The [user] carefully scoops \the [src] into \the [used_item].")) qdel(src) return TRUE return ..() diff --git a/code/game/objects/effects/decals/Cleanable/robots.dm b/code/game/objects/effects/decals/Cleanable/robots.dm index 8487334c1a4d..925fb3c2e437 100644 --- a/code/game/objects/effects/decals/Cleanable/robots.dm +++ b/code/game/objects/effects/decals/Cleanable/robots.dm @@ -16,9 +16,9 @@ /obj/effect/decal/cleanable/blood/gibs/robot/streak(var/list/directions) spawn (0) var/direction = pick(directions) - for (var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++) + for (var/i in 1 to pick(1, 200; 2, 150; 3, 50; 4)) sleep(3) - if (i > 0) + if (i > 1) if (prob(40)) var/obj/effect/decal/cleanable/blood/oil/streak = new(src.loc) streak.update_icon() diff --git a/code/game/objects/effects/gateway.dm b/code/game/objects/effects/gateway.dm index 2b6be989f274..61c3250d6462 100644 --- a/code/game/objects/effects/gateway.dm +++ b/code/game/objects/effects/gateway.dm @@ -54,10 +54,10 @@ var/mob/living/silicon/robot/Robot = victim QDEL_NULL(Robot.central_processor) else - for(var/obj/item/W in victim) - victim.drop_from_inventory(W) - if(istype(W, /obj/item/implant)) - qdel(W) + for(var/obj/item/thing in victim) + victim.drop_from_inventory(thing) + if(istype(thing, /obj/item/implant)) + qdel(thing) var/mob/living/new_mob = new /mob/living/simple_animal/corgi(AM.loc) new_mob.set_intent(I_FLAG_HARM) diff --git a/code/game/objects/effects/item_pickup_ghost.dm b/code/game/objects/effects/item_pickup_ghost.dm index aa07bcd0e6a8..cd8d1df1cc0b 100644 --- a/code/game/objects/effects/item_pickup_ghost.dm +++ b/code/game/objects/effects/item_pickup_ghost.dm @@ -3,10 +3,8 @@ var/lifetime = 0.2 SECONDS /obj/effect/temporary/item_pickup_ghost/Initialize(var/mapload, var/obj/item/picked_up) - . = ..(mapload, lifetime, picked_up.icon, picked_up.icon_state) - pixel_x = picked_up.pixel_x - pixel_y = picked_up.pixel_y - color = picked_up.color + . = ..(mapload, lifetime, null, null) + appearance = picked_up.appearance /obj/effect/temporary/item_pickup_ghost/proc/animate_towards(var/atom/target) var/new_pixel_x = pixel_x + (target.x - src.x) * 32 diff --git a/code/game/objects/effects/landmarks.dm b/code/game/objects/effects/landmarks.dm index 827773adb4cc..b71fd6a50060 100644 --- a/code/game/objects/effects/landmarks.dm +++ b/code/game/objects/effects/landmarks.dm @@ -1,3 +1,4 @@ +var/global/list/obj/abstract/landmark/all_landmarks = list() /obj/abstract/landmark name = "landmark" var/delete_me = 0 @@ -7,13 +8,13 @@ tag = "landmark*[name]" if(delete_me) return INITIALIZE_HINT_QDEL - global.landmarks_list += src + global.all_landmarks += src /obj/abstract/landmark/proc/delete() delete_me = TRUE /obj/abstract/landmark/Destroy() - global.landmarks_list -= src + global.all_landmarks -= src return ..() /obj/abstract/landmark/start @@ -107,7 +108,7 @@ /obj/abstract/landmark/costume/waiter/make_costumes() new /obj/item/clothing/pants/slacks/black(loc) new /obj/item/clothing/shirt/button(loc) - new /obj/item/clothing/neck/tie/bow/color/red(loc) + new /obj/item/clothing/neck/tie/bow/red(loc) new /obj/item/clothing/suit/jacket/vest/blue(loc) var/CHOICE= pick( /obj/item/clothing/head/kitty, /obj/item/clothing/head/rabbitears) new CHOICE(loc) diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm index bcfac656cfd2..805288d6b365 100644 --- a/code/game/objects/effects/misc.dm +++ b/code/game/objects/effects/misc.dm @@ -26,16 +26,16 @@ return INITIALIZE_HINT_LATELOAD /obj/effect/paint/LateInitialize() - var/turf/wall/W = get_turf(src) - if(istype(W)) - W.paint_color = color - W.stripe_color = color - W.update_icon() + var/turf/wall/wall = get_turf(src) + if(istype(wall)) + wall.paint_color = color + wall.stripe_color = color + wall.lazy_update_icon() var/obj/structure/wall_frame/WF = locate() in loc if(WF) WF.paint_color = color WF.stripe_color = color - WF.update_icon() + WF.lazy_update_icon() qdel(src) /obj/effect/paint/pink @@ -72,10 +72,10 @@ return INITIALIZE_HINT_LATELOAD /obj/effect/paint_stripe/LateInitialize() - var/turf/wall/W = get_turf(src) - if(istype(W)) - W.stripe_color = color - W.update_icon() + var/turf/wall/wall = get_turf(src) + if(istype(wall)) + wall.stripe_color = color + wall.update_icon() var/obj/structure/wall_frame/WF = locate() in loc if(WF) WF.stripe_color = color diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 2aae839cd613..5e5f6d7cf2c8 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -33,23 +33,20 @@ die() return TRUE -/obj/effect/spider/attackby(var/obj/item/W, var/mob/user) +/obj/effect/spider/attackby(var/obj/item/used_item, var/mob/user) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - if(W.attack_verb.len) - visible_message("\The [src] has been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]") - else - visible_message("\The [src] has been attacked with \the [W][(user ? " by [user]." : ".")]") + visible_message("\The [src] has been [used_item.pick_attack_verb()] with \the [used_item][(user ? " by [user]." : ".")]") - var/damage = W.expend_attack_force(user) / 4 + var/damage = used_item.expend_attack_force(user) / 4 - if(W.has_edge()) + if(used_item.has_edge()) damage += 5 - if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item - if(WT.weld(0, user)) + if(welder.weld(0, user)) damage = 15 playsound(loc, 'sound/items/Welder.ogg', 100, 1) @@ -194,7 +191,7 @@ stop_automove() . = ..() -/obj/effect/spider/spiderling/attackby(var/obj/item/W, var/mob/user) +/obj/effect/spider/spiderling/attackby(var/obj/item/used_item, var/mob/user) . = ..() if(current_health > 0) disturbed() diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index 638b704a188d..f037c65998aa 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -89,8 +89,7 @@ addtimer(CALLBACK(AM, TYPE_PROC_REF(/atom/movable, throw_at), throw_target, throw_dist, throw_dist), 0) var/took = (REALTIMEOFDAY-start_time)/10 - if(Debug2) - to_world_log("## DEBUG: Explosion([x0],[y0],[z0])(d[devastation_range],h[heavy_impact_range],l[light_impact_range]): Took [took] seconds.") + testing("## DEBUG: Explosion([x0],[y0],[z0])(d[devastation_range],h[heavy_impact_range],l[light_impact_range]): Took [took] seconds.") return 1 #define EXPLFX_NONE 0 diff --git a/code/game/objects/items/__item.dm b/code/game/objects/items/__item.dm index fb1c143c2752..171b27c8b98b 100644 --- a/code/game/objects/items/__item.dm +++ b/code/game/objects/items/__item.dm @@ -23,7 +23,7 @@ var/no_attack_log = FALSE var/obj/item/master = null var/origin_tech //Used by R&D to determine what research bonuses it grants. - var/list/attack_verb = list("hit") //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]" + VAR_PROTECTED/list/attack_verb = "hit" //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]" var/lock_picking_level = 0 //used to determine whether something can pick a lock, and how well. var/attack_cooldown = DEFAULT_WEAPON_COOLDOWN var/melee_accuracy_bonus = 0 @@ -109,8 +109,8 @@ var/tmp/use_single_icon var/center_of_mass = @'{"x":16,"y":16}' //can be null for no exact placement behaviour - /// Used when this item is replaced by a loadout item. If TRUE, loadout places src in wearer's storage. If FALSE, src is deleted. - var/replaced_in_loadout = TRUE + /// Controls what method is used to resolve conflicts between equipped items and mob loadout. + var/replaced_in_loadout = LOADOUT_CONFLICT_DELETE var/paint_color var/paint_verb @@ -129,6 +129,7 @@ var/unwieldsound = 'sound/foley/tooldrop1.ogg' var/base_name + var/base_desc /// Can this object leak into water sources? var/watertight = FALSE @@ -196,6 +197,7 @@ /obj/item/Initialize(var/ml, var/material_key) base_name ||= name + base_desc ||= desc if(isnull(current_health)) current_health = max_health //Make sure to propagate max_health to health var before material setup, for consistency @@ -488,27 +490,11 @@ return ..() && (!strict || loc == user) /obj/item/proc/squash_item(skip_qdel = FALSE) - if(!istype(material) || material.hardness > MAT_VALUE_MALLEABLE) return null - - var/list/leftover_mats = list() - for(var/mat in matter) - var/decl/material/material_decl = GET_DECL(mat) - if(material_decl.hardness <= MAT_VALUE_MALLEABLE) - var/spawn_amount = round(matter[mat] / SHEET_MATERIAL_AMOUNT) - if(spawn_amount > 0) - var/obj/item/stack/material/lump/lump = new(loc, spawn_amount, mat) - LAZYADD(., lump) - continue - leftover_mats[mat] = matter[mat] - - if(length(leftover_mats)) - var/obj/item/debris/scraps/remains = new(loc) - remains.matter = leftover_mats?.Copy() - remains.update_primary_material() - LAZYADD(., remains) - + var/list/results = convert_matter_to_lumps(skip_qdel) + if(length(results)) + . = results if(!skip_qdel) matter = null material = null @@ -591,26 +577,24 @@ if (isturf(old_loc)) var/obj/effect/temporary/item_pickup_ghost/ghost = new(old_loc, src) ghost.animate_towards(user) - on_picked_up(user) + on_picked_up(user, old_loc) return TRUE return FALSE /obj/item/attack_ai(mob/living/silicon/ai/user) - if (!istype(src.loc, /obj/item/robot_module)) + if (!istype(loc, /obj/item/robot_module)) return //If the item is part of a cyborg module, equip it if(!isrobot(user)) return - var/mob/living/silicon/robot/R = user - R.activate_module(src) - if(R.hud_used) - R.hud_used.update_robot_modules_display() + var/mob/living/silicon/robot/robot = user + robot.put_in_hands(src) -/obj/item/proc/try_slapcrafting(obj/item/W, mob/user) - if(SSfabrication.try_craft_with(src, W, user)) +/obj/item/proc/try_slapcrafting(obj/item/used_item, mob/user) + if(SSfabrication.try_craft_with(src, used_item, user)) return TRUE - if(SSfabrication.try_craft_with(W, src, user)) + if(SSfabrication.try_craft_with(used_item, src, user)) return TRUE return FALSE @@ -665,10 +649,13 @@ addtimer(CALLBACK(user, TYPE_PROC_REF(/mob, check_emissive_equipment)), 0, TIMER_UNIQUE) RAISE_EVENT(/decl/observ/mob_unequipped, user, src) - RAISE_EVENT_REPEAT(/decl/observ/item_unequipped, src, user) + RAISE_EVENT(/decl/observ/item_unequipped, src, user) // called just after an item is picked up, after it has been equipped to the mob. -/obj/item/proc/on_picked_up(mob/user) +/obj/item/proc/on_picked_up(mob/user, atom/old_loc) + if(old_loc == loc || old_loc == user) + // not being picked up, just transferring between slots, don't adjust the offset + return if(randpixel) pixel_x = rand(-randpixel, randpixel) pixel_y = rand(-randpixel/2, randpixel/2) @@ -725,7 +712,7 @@ addtimer(CALLBACK(user, TYPE_PROC_REF(/mob, check_emissive_equipment)), 0, TIMER_UNIQUE) RAISE_EVENT(/decl/observ/mob_equipped, user, src, slot) - RAISE_EVENT_REPEAT(/decl/observ/item_equipped, src, user, slot) + RAISE_EVENT(/decl/observ/item_equipped, src, user, slot) // As above but for items being equipped to an active module on a robot. /obj/item/proc/equipped_robot(var/mob/user) @@ -743,7 +730,6 @@ var/obj/item/back = user.get_equipped_item(slot_back_str) return back?.storage?.can_be_inserted(src, user, TRUE) - var/datum/inventory_slot/inv_slot = user.get_inventory_slot_datum(slot) if(!inv_slot) return FALSE @@ -764,7 +750,7 @@ return inv_slot?.is_accessible(user, src, disable_warning) /obj/item/proc/can_be_dropped_by_client(mob/M) - return M.canUnEquip(src) + return M.can_unequip_item(src) /obj/item/verb/verb_pickup() set src in oview(1) @@ -1021,8 +1007,7 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. /obj/item/clothing/inherit_custom_item_data(var/datum/custom_item/citem) . = ..() - base_clothing_icon = icon - base_clothing_state = icon_state + reconsider_single_icon() /obj/item/proc/is_special_cutting_tool(var/high_power) return FALSE @@ -1137,7 +1122,7 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. for(var/equipped_slot in get_associated_equipment_slots()) wearer.update_equipment_overlay(equipped_slot, FALSE) if(do_update_icon) - wearer.update_icon() + wearer.lazy_update_icon() return TRUE /obj/item/proc/reconsider_client_screen_presence(var/client/client, var/slot) @@ -1185,9 +1170,12 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. /obj/item/proc/handle_loadout_equip_replacement(obj/item/old_item) return -/// Used to handle equipped icons overwritten by custom loadout. If TRUE, loadout places src in wearer's storage. If FALSE, src is deleted by loadout. +/// Used to handle equipped items overwritten by custom loadout. +/// Returns one of LOADOUT_CONFLICT_DELETE, LOADOUT_CONFLICT_STORAGE, or LOADOUT_CONFLICT_KEEP. /obj/item/proc/loadout_should_keep(obj/item/new_item, mob/wearer) - return type != new_item.type && !replaced_in_loadout + if(type == new_item.type) // for exact type collisions, just delete by default + return LOADOUT_CONFLICT_DELETE + return replaced_in_loadout /obj/item/dropped(mob/user, slot) . = ..() @@ -1226,10 +1214,9 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. var/decl/material/bait_mat = GET_DECL(mat) if(bait_mat.fishing_bait_value) . += MATERIAL_UNITS_TO_REAGENTS_UNITS(matter[mat]) * bait_mat.fishing_bait_value * BAIT_VALUE_CONSTANT - for(var/mat in reagents?.reagent_volumes) - var/decl/material/bait_mat = GET_DECL(mat) - if(bait_mat.fishing_bait_value) - . += reagents.reagent_volumes[mat] * bait_mat.fishing_bait_value * BAIT_VALUE_CONSTANT + for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + if(reagent.fishing_bait_value) + . += reagents.reagent_volumes[reagent] * reagent.fishing_bait_value * BAIT_VALUE_CONSTANT #undef BAIT_VALUE_CONSTANT /obj/item/proc/get_storage_cost() @@ -1308,8 +1295,7 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. if(!reagents_state || !check_state_in_icon(reagents_state, icon)) return var/image/reagent_overlay = overlay_image(icon, reagents_state, reagents.get_color(), RESET_COLOR | RESET_ALPHA) - for(var/reagent_type in reagents.reagent_volumes) - var/decl/material/reagent = GET_DECL(reagent_type) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) if(!reagent.reagent_overlay) continue var/modified_reagent_overlay = state_prefix ? "[state_prefix]_[reagent.reagent_overlay]" : reagent.reagent_overlay @@ -1337,3 +1323,37 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. coating_string = FONT_COLORED(coating.get_color(), coating_string) return coating_string return ..() + +// Bespoke proc for handling when a centrifuge smooshes us, only currently used by growns and hive frames. +/obj/item/proc/handle_centrifuge_process(obj/machinery/centrifuge/centrifuge) + SHOULD_CALL_PARENT(TRUE) + return istype(centrifuge) && !QDELETED(centrifuge.loaded_beaker) && istype(centrifuge.loaded_beaker) + +/obj/item/proc/convert_matter_to_lumps(skip_qdel = FALSE) + + var/list/scrap_matter = list() + for(var/mat in matter) + var/mat_amount = matter[mat] + var/obj/item/stack/material/mat_stack = /obj/item/stack/material/lump + var/mat_per_stack = SHEET_MATERIAL_AMOUNT * initial(mat_stack.matter_multiplier) + var/sheet_amount = round(mat_amount / mat_per_stack) + if(sheet_amount) + var/obj/item/stack/material/lump/lump = new(loc, sheet_amount, mat) + LAZYADD(., lump) + mat_amount -= sheet_amount * mat_per_stack + if(mat_amount) + scrap_matter[mat] += mat_amount + + if(length(scrap_matter)) + var/obj/item/debris/scraps/scraps = new(loc) + scraps.matter = scrap_matter.Copy() + scraps.update_primary_material() + LAZYADD(., scraps) + + matter = null + material = null + if(!skip_qdel) + qdel(src) + +/obj/item/proc/pick_attack_verb() + return DEFAULTPICK(attack_verb, attack_verb) || "attacked" // if it's not a list, return itself or just "attacked" \ No newline at end of file diff --git a/code/game/objects/items/_item_edibility.dm b/code/game/objects/items/_item_edibility.dm index c93934b6f52b..4957dbecff8f 100644 --- a/code/game/objects/items/_item_edibility.dm +++ b/code/game/objects/items/_item_edibility.dm @@ -4,7 +4,7 @@ add_trace_DNA(target) // Used to get a piece of food from an item. -/obj/item/proc/seperate_food_chunk(obj/item/utensil/utensil, mob/user) +/obj/item/proc/separate_food_chunk(obj/item/utensil/utensil, mob/user) var/utensil_food_type = get_utensil_food_type() if(!istype(utensil) || !utensil_food_type) return @@ -14,8 +14,12 @@ // Create a dummy copy of the target food item. // This ensures we keep all food behavior, strings, sounds, etc. utensil.loaded_food = new utensil_food_type(utensil, material?.type, TRUE) - QDEL_NULL(utensil.loaded_food.trash) - QDEL_NULL(utensil.loaded_food.plate) + if(ismovable(utensil.loaded_food.trash)) + qdel(utensil.loaded_food.trash) + utensil.loaded_food.trash = null // Unset it even if it didn't need deleting (e.g. it was a path) + if(ismovable(utensil.loaded_food.plate)) + qdel(utensil.loaded_food.plate) + utensil.loaded_food.plate = null utensil.loaded_food.color = color utensil.loaded_food.filling_color = get_food_filling_color() utensil.loaded_food.SetName("\proper some [utensil.loaded_food.name]") @@ -25,12 +29,12 @@ reagents.trans_to(utensil.loaded_food, remove_amt) handle_chunk_separated() if(!reagents.total_volume) - handle_consumed() + handle_consumed(user) // it's not actually being consumed, so i'm not sure this is correct utensil.update_icon() else // This shouldn't happen, but who knows. to_chat(user, SPAN_WARNING("None of \the [src] is left!")) - handle_consumed() + handle_consumed(user) return TRUE /obj/item/proc/get_food_filling_color() diff --git a/code/game/objects/items/_item_force.dm b/code/game/objects/items/_item_force.dm index 790d894e5962..500bec99069c 100644 --- a/code/game/objects/items/_item_force.dm +++ b/code/game/objects/items/_item_force.dm @@ -22,7 +22,7 @@ var/list/item_effects = get_item_effects(IE_CAT_DAMAGE) if(length(item_effects)) for(var/decl/item_effect/damage_effect as anything in item_effects) - . = damage_effect.expend_attack_use(src, user, item_effects[damage_effect]) + damage_effect.expend_attack_use(src, user, item_effects[damage_effect]) /obj/item/proc/get_attack_force(mob/living/user) if(_base_attack_force <= 0 || (item_flags & ITEM_FLAG_NO_BLUDGEON)) diff --git a/code/game/objects/items/_item_materials.dm b/code/game/objects/items/_item_materials.dm index ecf48b7029e8..893b901af7c8 100644 --- a/code/game/objects/items/_item_materials.dm +++ b/code/game/objects/items/_item_materials.dm @@ -1,6 +1,6 @@ /obj/item/on_update_icon() - . = ..() SHOULD_CALL_PARENT(TRUE) + . = ..() cut_overlays() if((material_alteration & MAT_FLAG_ALTERATION_COLOR) && material) alpha = 100 + material.opacity * 255 @@ -91,6 +91,7 @@ obj_flags &= (~OBJ_FLAG_CONDUCTIBLE) if(isnull(initial(paint_verb))) paint_verb = material.paint_verb + refresh_color() // apply material color update_attack_force() update_name() if(material_armor_multiplier) diff --git a/code/game/objects/items/artifice/chain.dm b/code/game/objects/items/artifice/chain.dm index 3a48abad4759..2e44bf586f62 100644 --- a/code/game/objects/items/artifice/chain.dm +++ b/code/game/objects/items/artifice/chain.dm @@ -6,4 +6,5 @@ icon_state = ICON_STATE_WORLD icon = 'icons/obj/items/chain.dmi' material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color material_alteration = MAT_FLAG_ALTERATION_ALL diff --git a/code/game/objects/items/artifice/hook.dm b/code/game/objects/items/artifice/hook.dm index c20c77b14801..c04401d873fb 100644 --- a/code/game/objects/items/artifice/hook.dm +++ b/code/game/objects/items/artifice/hook.dm @@ -5,4 +5,5 @@ icon_state = ICON_STATE_WORLD icon = 'icons/obj/items/hook.dmi' material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color material_alteration = MAT_FLAG_ALTERATION_ALL diff --git a/code/game/objects/items/blades/_blade.dm b/code/game/objects/items/blades/_blade.dm index 19dbcbce1cd6..80aa8b5d1ed7 100644 --- a/code/game/objects/items/blades/_blade.dm +++ b/code/game/objects/items/blades/_blade.dm @@ -75,7 +75,7 @@ initial_tool_qualities[TOOL_HATCHET] = TOOL_QUALITY_MEDIOCRE set_extension(src, /datum/extension/tool/variable/simple, initial_tool_qualities) - shine = istype(material) ? clamp((material.reflectiveness * 0.01) * 255, 10, (0.6 * ReadHSV(RGBtoHSV(material.color))[3])) : null + shine = istype(material) ? clamp((material.reflectiveness * 0.01) * 255, 10, (0.6 * rgb2num(material.color, COLORSPACE_HSV)[3])) : null icon_state = ICON_STATE_WORLD on_update_icon() diff --git a/code/game/objects/items/blades/axe.dm b/code/game/objects/items/blades/axe.dm index 9bda1a9a1345..ab902f9187a4 100644 --- a/code/game/objects/items/blades/axe.dm +++ b/code/game/objects/items/blades/axe.dm @@ -19,8 +19,8 @@ . = ..() if(proximity && A && is_held_twohanded()) if(istype(A,/obj/structure/window)) - var/obj/structure/window/W = A - W.shatter() + var/obj/structure/window/window = A + window.shatter() else if(istype(A,/obj/structure/grille)) qdel(A) else if(istype(A,/obj/effect/vine)) diff --git a/code/game/objects/items/blades/axe_fire.dm b/code/game/objects/items/blades/axe_fire.dm index 61cc07e683f1..afe7d8e25f23 100644 --- a/code/game/objects/items/blades/axe_fire.dm +++ b/code/game/objects/items/blades/axe_fire.dm @@ -1,6 +1,7 @@ /obj/item/bladed/axe/fire name = "fire axe" icon = 'icons/obj/items/bladed/fireaxe.dmi' + icon_state = ICON_STATE_WORLD desc = "Truly, the weapon of a madman. Who would think to fight fire with an axe?" material_alteration = MAT_FLAG_ALTERATION_NAME guard_material = /decl/material/solid/organic/plastic diff --git a/code/game/objects/items/blades/folding.dm b/code/game/objects/items/blades/folding.dm index 281c88d523a0..8e769c44d179 100644 --- a/code/game/objects/items/blades/folding.dm +++ b/code/game/objects/items/blades/folding.dm @@ -52,15 +52,13 @@ icon_state = "[icon_state]-closed" /obj/item/bladed/folding/update_attack_force() - ..() + . = ..() set_edge(open) set_sharp(open) - if(open) - w_class = open_item_size - attack_verb = open_attack_verbs - else - w_class = closed_item_size - attack_verb = closed_attack_verbs + w_class = open ? open_item_size : closed_item_size + +/obj/item/bladed/folding/pick_attack_verb() + return DEFAULTPICK(open ? open_attack_verbs : closed_attack_verbs, ..()) // Only show the inhand sprite when open. /obj/item/bladed/folding/get_mob_overlay(mob/user_mob, slot, bodypart, use_fallback_if_icon_missing = TRUE, skip_adjustment = FALSE) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 4313657b12dc..f3b1c0e3a00a 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -7,11 +7,17 @@ icon_state = "bodybag_folded" w_class = ITEM_SIZE_SMALL material = /decl/material/solid/organic/plastic + var/bag_type = /obj/structure/closet/body_bag + +/obj/item/bodybag/proc/create_bag_structure(mob/user) + var/atom/bag = new bag_type(user.loc) + bag.add_fingerprint(user) + return bag /obj/item/bodybag/attack_self(mob/user) - var/obj/structure/closet/body_bag/R = new /obj/structure/closet/body_bag(user.loc) - R.add_fingerprint(user) + create_bag_structure(user) qdel(src) + return TRUE /obj/item/box/bodybags name = "body bags" @@ -56,8 +62,8 @@ if(LAZYLEN(lbls?.labels)) add_overlay("bodybag_label") -/obj/structure/closet/body_bag/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/hand_labeler)) +/obj/structure/closet/body_bag/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/hand_labeler)) return FALSE //Prevent the labeler from opening the bag when trying to apply a label . = ..() diff --git a/code/game/objects/items/books/_book.dm b/code/game/objects/items/books/_book.dm index a71fd39032a7..f9db9deefc36 100644 --- a/code/game/objects/items/books/_book.dm +++ b/code/game/objects/items/books/_book.dm @@ -41,6 +41,13 @@ if(SSpersistence.is_tracking(src, /decl/persistence_handler/book)) . = QDEL_HINT_LETMELIVE +/// Clears the text written in the book. Used for acetone removing ink. Returns TRUE if successful, FALSE if it can't be dissolved. +/obj/item/book/proc/clear_text() + if(can_dissolve_text) + dat = null + return TRUE + return FALSE + /obj/item/book/on_update_icon() . = ..() icon_state = get_world_inventory_state() @@ -77,16 +84,20 @@ if(dat) user.visible_message("\The [user] opens a book titled \"[title]\" and begins reading intently.") - var/processed_dat = user.handle_reading_literacy(user, dat) - if(processed_dat) - show_browser(user, processed_dat, "window=book;size=1000x550") - onclose(user, "book") + show_text_to(user) else to_chat(user, SPAN_WARNING("This book is completely blank!")) -/obj/item/book/attackby(obj/item/W, mob/user) +/// Reader is the mob doing the reading, whose skill will be used for skillchecks. User is the mob who is holding the book, and do_afters will use them. +/obj/item/book/proc/show_text_to(mob/reader, mob/user) + var/processed_dat = reader.handle_reading_literacy(reader, dat) + if(processed_dat) + show_browser(reader, processed_dat, "window=book;size=1000x550") + onclose(reader, "book") + +/obj/item/book/attackby(obj/item/used_item, mob/user) - if(IS_PEN(W)) + if(IS_PEN(used_item)) if(unique) to_chat(user, SPAN_WARNING("These pages don't seem to take the ink well. Looks like you can't modify it.")) return TRUE @@ -113,7 +124,7 @@ if(content) last_modified_ckey = user.ckey pencode_dat = content - dat = formatpencode(usr, content, W) + dat = formatpencode(usr, content, used_item) if("Author") var/newauthor = sanitize(input(usr, "Write the author's name:")) @@ -126,7 +137,7 @@ author = newauthor return TRUE - if((IS_KNIFE(W) || IS_WIRECUTTER(W)) && user.check_intent(I_FLAG_HARM) && try_carve(user, W)) + if((IS_KNIFE(used_item) || IS_WIRECUTTER(used_item)) && user.check_intent(I_FLAG_HARM) && try_carve(user, used_item)) return TRUE return ..() @@ -148,9 +159,7 @@ SPAN_NOTICE("\The [user] opens up a book and shows it to \the [target].") ) user.setClickCooldown(DEFAULT_QUICK_COOLDOWN) //to prevent spam - var/processed_dat = target.handle_reading_literacy(user, "Author: [author].

" + "[dat]") - if(processed_dat) - show_browser(target, processed_dat, "window=book;size=1000x550") + show_text_to(target) return TRUE return ..() diff --git a/code/game/objects/items/books/manuals/_manual.dm b/code/game/objects/items/books/manuals/_manual.dm index 7cee55d5709e..8d09360270e9 100644 --- a/code/game/objects/items/books/manuals/_manual.dm +++ b/code/game/objects/items/books/manuals/_manual.dm @@ -2,13 +2,38 @@ unique = TRUE // Unable to be copied, unable to be modified abstract_type = /obj/item/book/manual var/guide_decl + var/tmp/has_initialized = FALSE /obj/item/book/manual/Initialize() . = ..() + // try to initialize the text! if it's prior to sscodex init it'll initialize on being read + // if the guide is invalid the manual will need to be deleted + if(initialize_data(in_init = TRUE) == INITIALIZE_HINT_QDEL) + return INITIALIZE_HINT_QDEL + +/obj/item/book/manual/try_to_read() + initialize_data() + . = ..() + +/obj/item/book/manual/show_text_to() + initialize_data() + . = ..() + +/obj/item/book/manual/clear_text() + if((. = ..())) + has_initialized = TRUE // prevent data from being added later if it hasn't already been + +/obj/item/book/manual/proc/initialize_data(in_init = FALSE) + if(has_initialized || !SScodex.initialized) + return + // Has yet to initialize. var/guide_text = guide_decl && SScodex.get_manual_text(guide_decl) if(!guide_text) log_debug("Manual [type] spawned with invalid guide decl type ([guide_decl || null]).") - return INITIALIZE_HINT_QDEL + if(in_init) + return INITIALIZE_HINT_QDEL + qdel(src) + return dat = {" @@ -19,3 +44,4 @@ "} + has_initialized = TRUE diff --git a/code/game/objects/items/books/skill/_skill.dm b/code/game/objects/items/books/skill/_skill.dm index 9c9bf06db827..39ed2b3cdfe0 100644 --- a/code/game/objects/items/books/skill/_skill.dm +++ b/code/game/objects/items/books/skill/_skill.dm @@ -213,17 +213,17 @@ Skill books that increase your skills while you activate and hold them /obj/item/book/skill/proc/check_buff() if(!reading) return - var/mob/R = reading.resolve() - if(!istype(R) || !CanPhysicallyInteract(R)) + var/mob/reader = reading.resolve() + if(!istype(reader) || !CanPhysicallyInteract(reader)) remove_buff() /obj/item/book/skill/proc/remove_buff() - var/mob/R = reading?.resolve() + var/mob/reader = reading?.resolve() reading = null - if(istype(R)) - to_chat(R, SPAN_DANGER("You lose the page you were on! You can't cross-reference using [title] like this!")) - if(R.fetch_buffs_of_type(/datum/skill_buff/skill_book, 0)) - unlearn(R) + if(istype(reader)) + to_chat(reader, SPAN_DANGER("You lose the page you were on! You can't cross-reference using [title] like this!")) + if(reader.fetch_buffs_of_type(/datum/skill_buff/skill_book, 0)) + unlearn(reader) STOP_PROCESSING(SSprocessing, src) /obj/item/book/skill/Destroy() diff --git a/code/game/objects/items/books/skill/_skill_custom.dm b/code/game/objects/items/books/skill/_skill_custom.dm index 2d9bfa2a3595..736cd80fe022 100644 --- a/code/game/objects/items/books/skill/_skill_custom.dm +++ b/code/game/objects/items/books/skill/_skill_custom.dm @@ -53,8 +53,8 @@ /obj/item/book/skill/custom/question icon = 'icons/obj/items/books/book_white_question.dmi' -/obj/item/book/skill/custom/attackby(obj/item/pen, mob/user) - if(!IS_PEN(pen)) +/obj/item/book/skill/custom/attackby(obj/item/used_item, mob/user) + if(!IS_PEN(used_item)) return ..() if(!user.skill_check(SKILL_LITERACY, SKILL_BASIC)) to_chat(user, SPAN_WARNING("You can't even read, yet you want to write a whole educational textbook?")) @@ -64,26 +64,26 @@ return TRUE var/state_check = skill_option_string // the state skill_option_string is in just before opening the input var/choice = input(user, "What would you like to change?","Textbook editing") as null|anything in list("Title", "Author", skill_option_string) - if(!can_write(pen,user)) + if(!can_write(used_item,user)) return TRUE switch(choice) if("Title") - edit_title(pen, user) + edit_title(used_item, user) if("Skill") if(state_check != "Skill") // make sure someone hasn't already started the book while we were staring at menus woops to_chat(user, SPAN_WARNING("The skill has already been selected and the writing started.")) return TRUE - edit_skill(pen, user) + edit_skill(used_item, user) if("Continue writing content") if(state_check != "Continue writing content") return TRUE - continue_skill(pen, user) + continue_skill(used_item, user) if("Author") - edit_author(pen, user) + edit_author(used_item, user) else return TRUE diff --git a/code/game/objects/items/candelabra.dm b/code/game/objects/items/candelabra.dm index 1f82ec443aa7..1b123c42034f 100644 --- a/code/game/objects/items/candelabra.dm +++ b/code/game/objects/items/candelabra.dm @@ -7,7 +7,7 @@ list("x" = 6, "y" = 17) ) -/datum/storage/candelabra/can_be_inserted(obj/item/W, mob/user, stop_messages, click_params) +/datum/storage/candelabra/can_be_inserted(obj/item/used_item, mob/user, stop_messages, click_params) . = ..() && holder && length(holder.get_stored_inventory()) < length(candle_offsets) /obj/item/candelabra @@ -17,6 +17,7 @@ icon_state = ICON_STATE_WORLD storage = /datum/storage/candelabra material = /decl/material/solid/metal/brass + color = /decl/material/solid/metal/brass::color material_alteration = MAT_FLAG_ALTERATION_ALL /obj/item/candelabra/attackby(obj/item/used_item, mob/user) @@ -26,12 +27,8 @@ return TRUE . = ..() -/obj/item/candelabra/filled/Initialize(ml, material_key) - new /obj/item/flame/candle/random(src) - new /obj/item/flame/candle/random(src) - new /obj/item/flame/candle/random(src) - . = ..() - update_icon() +/obj/item/candelabra/filled/WillContain() + return list(/obj/item/flame/candle/handmade = 3) // Workaround for vis_contents propagating color. /obj/item/candelabra/on_update_icon() diff --git a/code/game/objects/items/circuitboards/machinery/household.dm b/code/game/objects/items/circuitboards/machinery/household.dm index 5ce6f6ead15f..b3e8803a255d 100644 --- a/code/game/objects/items/circuitboards/machinery/household.dm +++ b/code/game/objects/items/circuitboards/machinery/household.dm @@ -46,6 +46,18 @@ /obj/item/stock_parts/circuitboard/cooker/get_buildable_types() return subtypesof(/obj/machinery/cooker) +/obj/item/stock_parts/circuitboard/centrifuge + name = "circuitboard (industrial centrifuge)" + build_path = /obj/machinery/centrifuge + board_type = "machine" + origin_tech = @'{"biotech":2,"engineering":1}' + req_components = list( + /obj/item/stock_parts/manipulator = 2, + /obj/item/stock_parts/matter_bin = 2, + /obj/item/stock_parts/console_screen = 1, + /obj/item/stock_parts/keyboard = 1 + ) + /obj/item/stock_parts/circuitboard/seed_extractor name = "circuitboard (seed extractor)" build_path = /obj/machinery/seed_extractor diff --git a/code/game/objects/items/circuitboards/machinery/medical.dm b/code/game/objects/items/circuitboards/machinery/medical.dm index a1ad9088df20..0f5e011f6878 100644 --- a/code/game/objects/items/circuitboards/machinery/medical.dm +++ b/code/game/objects/items/circuitboards/machinery/medical.dm @@ -18,8 +18,7 @@ origin_tech = @'{"engineering":2,"biotech":4,"programming":4}' req_components = list( /obj/item/stock_parts/scanning_module = 2, - /obj/item/stock_parts/manipulator = 2, - /obj/item/stock_parts/console_screen = 1) + /obj/item/stock_parts/manipulator = 2) additional_spawn_components = list( /obj/item/stock_parts/power/apc/buildable = 1 ) diff --git a/code/game/objects/items/contraband.dm b/code/game/objects/items/contraband.dm index 601f8a9f3e83..8b62f298f8f7 100644 --- a/code/game/objects/items/contraband.dm +++ b/code/game/objects/items/contraband.dm @@ -48,12 +48,10 @@ add_to_reagents(reagent, picked_reagents[reagent]) var/list/names = new - for(var/liquid_type in reagents.liquid_volumes) - var/decl/material/liquid = GET_DECL(liquid_type) - names += liquid.get_reagent_name(reagents, MAT_PHASE_LIQUID) + for(var/decl/material/reagent as anything in reagents.liquid_volumes) + names += reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID) - for(var/solid_type in reagents.solid_volumes) - var/decl/material/solid = GET_DECL(solid_type) - names += solid.get_reagent_name(reagents, MAT_PHASE_SOLID) + for(var/decl/material/reagent as anything in reagents.solid_volumes) + names += reagent.get_reagent_name(reagents, MAT_PHASE_SOLID) desc = "Contains [english_list(names)]." \ No newline at end of file diff --git a/code/game/objects/items/cryobag.dm b/code/game/objects/items/cryobag.dm index f045c550ad9d..ba01e37bc1d0 100644 --- a/code/game/objects/items/cryobag.dm +++ b/code/game/objects/items/cryobag.dm @@ -12,15 +12,17 @@ /decl/material/solid/metal/silver = MATTER_AMOUNT_TRACE, /decl/material/solid/metal/gold = MATTER_AMOUNT_TRACE ) + bag_type = /obj/structure/closet/body_bag/cryobag var/stasis_power -/obj/item/bodybag/cryobag/attack_self(mob/user) - var/obj/structure/closet/body_bag/cryobag/R = new /obj/structure/closet/body_bag/cryobag(user.loc) - if(stasis_power) - R.stasis_power = stasis_power - R.update_icon() - R.add_fingerprint(user) - qdel(src) +/obj/item/bodybag/cryobag/get_cryogenic_power() + return stasis_power + +/obj/item/bodybag/cryobag/create_bag_structure(mob/user) + var/obj/structure/closet/body_bag/cryobag/bag = ..() + if(istype(bag) && stasis_power) + bag.stasis_power = stasis_power + return bag /obj/structure/closet/body_bag/cryobag name = "stasis bag" @@ -92,9 +94,7 @@ stasis_power = round(0.75 * stasis_power) animate(src, color = color_matrix_saturation(get_saturation()), time = 10) update_icon() - - if(LAZYACCESS(patient.stasis_sources, STASIS_CRYOBAG) != stasis_power) - patient.set_stasis(stasis_power, STASIS_CRYOBAG) + patient.add_mob_modifier(/decl/mob_modifier/stasis, 2 SECONDS, source = src) /obj/structure/closet/body_bag/cryobag/return_air() //Used to make stasis bags protect from vacuum. if(airtank) diff --git a/code/game/objects/items/devices/boombox.dm b/code/game/objects/items/devices/boombox.dm index fc3850c843bc..01f0e716d581 100644 --- a/code/game/objects/items/devices/boombox.dm +++ b/code/game/objects/items/devices/boombox.dm @@ -2,8 +2,7 @@ name = "boombox" desc = "A device used to emit rhythmic sounds, colloquially referred to as a 'boombox'. It's in a retro style (massive), and absolutely unwieldy." icon = 'icons/obj/items/device/boombox.dmi' - icon_state = "off" - item_state = "boombox" + icon_state = ICON_STATE_WORLD _base_attack_force = 7 w_class = ITEM_SIZE_HUGE //forbid putting something that emits loud sounds forever into a backpack origin_tech = @'{"magnets":2,"combat":1}' @@ -91,22 +90,22 @@ change_volume(volume - 10) return TOPIC_HANDLED -/obj/item/boombox/attackby(var/obj/item/W, var/mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/boombox/attackby(var/obj/item/used_item, var/mob/user) + if(IS_SCREWDRIVER(used_item)) if(!panel) - user.visible_message(SPAN_NOTICE("\The [user] re-attaches \the [src]'s front panel with \the [W]."), SPAN_NOTICE("You re-attach \the [src]'s front panel.")) + user.visible_message(SPAN_NOTICE("\The [user] re-attaches \the [src]'s front panel with \the [used_item]."), SPAN_NOTICE("You re-attach \the [src]'s front panel.")) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) panel = TRUE return TRUE if(!broken) - AdjustFrequency(W, user) + AdjustFrequency(used_item, user) return TRUE else if(panel) - user.visible_message(SPAN_NOTICE("\The [user] unhinges \the [src]'s front panel with \the [W]."), SPAN_NOTICE("You unhinge \the [src]'s front panel.")) + user.visible_message(SPAN_NOTICE("\The [user] unhinges \the [src]'s front panel with \the [used_item]."), SPAN_NOTICE("You unhinge \the [src]'s front panel.")) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) panel = FALSE - if(istype(W,/obj/item/stack/nanopaste)) - var/obj/item/stack/S = W + if(istype(used_item,/obj/item/stack/nanopaste)) + var/obj/item/stack/S = used_item if(broken && !panel) if(S.use(1)) user.visible_message(SPAN_NOTICE("\The [user] pours some of \the [S] onto \the [src]."), SPAN_NOTICE("You pour some of \the [S] over \the [src]'s internals and watch as it retraces and resolders paths.")) @@ -116,7 +115,7 @@ else . = ..() -/obj/item/boombox/proc/AdjustFrequency(var/obj/item/W, var/mob/user) +/obj/item/boombox/proc/AdjustFrequency(var/obj/item/used_item, var/mob/user) var/const/MIN_FREQUENCY = 0.5 var/const/MAX_FREQUENCY = 1.5 @@ -137,7 +136,7 @@ return FALSE if(!MayAdjust(user)) return FALSE - if(W != user.get_active_held_item()) + if(used_item != user.get_active_held_item()) return FALSE if(!CanPhysicallyInteract(user)) diff --git a/code/game/objects/items/devices/hacktool.dm b/code/game/objects/items/devices/hacktool.dm index 1b06acd9f0d3..88ebe70cf775 100644 --- a/code/game/objects/items/devices/hacktool.dm +++ b/code/game/objects/items/devices/hacktool.dm @@ -23,8 +23,8 @@ hack_state = null return ..() -/obj/item/multitool/hacktool/attackby(var/obj/item/W, var/mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/multitool/hacktool/attackby(var/obj/item/used_item, var/mob/user) + if(IS_SCREWDRIVER(used_item)) in_hack_mode = !in_hack_mode playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) return TRUE diff --git a/code/game/objects/items/devices/holowarrant.dm b/code/game/objects/items/devices/holowarrant.dm index ff3fe45f5725..624d4f818656 100644 --- a/code/game/objects/items/devices/holowarrant.dm +++ b/code/game/objects/items/devices/holowarrant.dm @@ -58,9 +58,9 @@ if(href_list["select"]) var/list/active_warrants = list() - for(var/datum/computer_file/report/warrant/W in global.all_warrants) - if(!W.archived) - active_warrants["[capitalize(W.get_category())] - [W.get_name()]"] = W + for(var/datum/computer_file/report/warrant/warrant in global.all_warrants) + if(!warrant.archived) + active_warrants["[capitalize(warrant.get_category())] - [warrant.get_name()]"] = warrant if(!length(active_warrants)) to_chat(user,SPAN_WARNING("There are no active warrants available.")) return TOPIC_HANDLED @@ -81,10 +81,10 @@ D.ui_interact(user) return TOPIC_HANDLED -/obj/item/holowarrant/attackby(obj/item/W, mob/user) +/obj/item/holowarrant/attackby(obj/item/used_item, mob/user) if(!active) return ..() - var/obj/item/card/id/I = W.GetIdCard() + var/obj/item/card/id/I = used_item.GetIdCard() if(I && check_access_list(I.GetAccess())) var/choice = alert(user, "Would you like to authorize this warrant?","Warrant authorization","Yes","No") var/datum/report_field/signature/auth = active.field_from_name("Authorized by") diff --git a/code/game/objects/items/devices/inducer.dm b/code/game/objects/items/devices/inducer.dm index 132fcc0e82fe..bb84d497a164 100644 --- a/code/game/objects/items/devices/inducer.dm +++ b/code/game/objects/items/devices/inducer.dm @@ -46,8 +46,8 @@ return TRUE return FALSE -/obj/item/inducer/attackby(obj/item/W, mob/user) - if(CannotUse(user) || recharge(W, user)) +/obj/item/inducer/attackby(obj/item/used_item, mob/user) + if(CannotUse(user) || recharge(used_item, user)) return TRUE return ..() @@ -59,15 +59,15 @@ else recharging = TRUE var/obj/item/cell/MyC = get_cell() - var/obj/item/cell/C = A.get_cell() + var/obj/item/cell/cell = A.get_cell() var/obj/O if(istype(A, /obj)) O = A - if(C) + if(cell) var/charge_length = 10 var/done_any = FALSE spark_at(user, amount = 1, cardinal_only = TRUE) - if(C.charge >= C.maxcharge) + if(cell.charge >= cell.maxcharge) to_chat(user, "\The [A] is fully charged!") recharging = FALSE return TRUE @@ -78,15 +78,15 @@ charge_length += rand(10, 30) if (user.get_skill_value(SKILL_ELECTRICAL) < SKILL_ADEPT) charge_length += rand(40, 60) - while(C.charge < C.maxcharge) + while(cell.charge < cell.maxcharge) if(MyC.charge > max(0, MyC.charge*failsafe) && do_after(user, charge_length, target = user)) if(CannotUse(user)) return TRUE - if(QDELETED(C)) + if(QDELETED(cell)) return TRUE spark_at(user, amount = 1, cardinal_only = TRUE) done_any = TRUE - induce(C) + induce(cell) if(O) O.update_icon() else diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index 4d9877a67ead..df209e9cc0d5 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -91,9 +91,9 @@ . = ..() // TODO: Refactor this to check matter or maybe even just use the fabricator recipe for lights directly -/obj/item/lightreplacer/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/stack/material) && W.get_material_type() == /decl/material/solid/glass) - var/obj/item/stack/G = W +/obj/item/lightreplacer/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/stack/material) && used_item.get_material_type() == /decl/material/solid/glass) + var/obj/item/stack/G = used_item if(uses >= max_uses) to_chat(user, "\The [src] is full.") else if(G.use(1)) @@ -103,8 +103,8 @@ to_chat(user, "You need one sheet of glass to replace lights.") return TRUE - if(istype(W, /obj/item/light)) - var/obj/item/light/L = W + if(istype(used_item, /obj/item/light)) + var/obj/item/light/L = used_item if(L.status == 0) // LIGHT OKAY if(uses < max_uses) if(!user.try_unequip(L)) @@ -119,15 +119,8 @@ return ..() /obj/item/lightreplacer/attack_self(mob/user) - /* // This would probably be a bit OP. If you want it though, uncomment the code. - if(isrobot(user)) - var/mob/living/silicon/robot/R = user - if(R.emagged) - src.Emag() - to_chat(usr, "You shortcircuit \the [src].") - return - */ to_chat(usr, "It has [uses] lights remaining.") + return TRUE /obj/item/lightreplacer/on_update_icon() . = ..() diff --git a/code/game/objects/items/devices/modkit.dm b/code/game/objects/items/devices/modkit.dm index b5eb44262b35..8b73d443025e 100644 --- a/code/game/objects/items/devices/modkit.dm +++ b/code/game/objects/items/devices/modkit.dm @@ -18,7 +18,7 @@ /obj/item/modkit/Initialize(ml, material_key) if(!target_bodytype) - var/decl/species/species = GET_DECL(global.using_map.default_species) + var/decl/species/species = decls_repository.get_decl_by_id(global.using_map.default_species) target_bodytype = species.default_bodytype.bodytype_flag . = ..() diff --git a/code/game/objects/items/devices/oxycandle.dm b/code/game/objects/items/devices/oxycandle.dm index 0040ac660821..c24ced497aef 100644 --- a/code/game/objects/items/devices/oxycandle.dm +++ b/code/game/objects/items/devices/oxycandle.dm @@ -1,3 +1,4 @@ +// TODO: Make this an actual candle that burns something that produces oxygen as a waste product? That'd be doable now... /obj/item/oxycandle name = "oxygen candle" desc = "A steel tube with the words 'OXYGEN - PULL CORD TO IGNITE' stamped on the side.\nA small label reads 'WARNING: NOT FOR LIGHTING USE. WILL IGNITE FLAMMABLE GASSES'" @@ -34,8 +35,8 @@ air_contents = new /datum/gas_mixture() air_contents.volume = 200 //liters air_contents.temperature = T20C - var/list/air_mix = list(/decl/material/gas/oxygen = 1 * (target_pressure * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature)) - air_contents.adjust_multi(/decl/material/gas/oxygen, air_mix[/decl/material/gas/oxygen]) + var/const/OXYGEN_FRACTION = 1 // separating out the constant so it's clearer why it exists and how to modify it later + air_contents.adjust_gas(/decl/material/gas/oxygen, OXYGEN_FRACTION * (target_pressure * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature)) START_PROCESSING(SSprocessing, src) // Process of Oxygen candles releasing air. Makes 200 volume of oxygen @@ -63,8 +64,8 @@ return environment.merge(removed) volume -= 200 - var/list/air_mix = list(/decl/material/gas/oxygen = 1 * (target_pressure * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature)) - air_contents.adjust_multi(/decl/material/gas/oxygen, air_mix[/decl/material/gas/oxygen]) + var/const/OXYGEN_FRACTION = 1 // separating out the constant so it's clearer why it exists and how to modify it later + air_contents.adjust_gas(/decl/material/gas/oxygen, OXYGEN_FRACTION * (target_pressure * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature)) /obj/item/oxycandle/on_update_icon() . = ..() diff --git a/code/game/objects/items/devices/paint_sprayer.dm b/code/game/objects/items/devices/paint_sprayer.dm index 90c99edcaacc..33f49ba11395 100644 --- a/code/game/objects/items/devices/paint_sprayer.dm +++ b/code/game/objects/items/devices/paint_sprayer.dm @@ -143,46 +143,46 @@ return . -/obj/item/paint_sprayer/proc/paint_wall(var/turf/wall/W, var/mob/user) - if(istype(W) && (!W.material || !W.material.wall_flags)) +/obj/item/paint_sprayer/proc/paint_wall(var/turf/wall/wall, var/mob/user) + if(istype(wall) && (!wall.material || !wall.material.wall_flags)) to_chat(user, SPAN_WARNING("You can't paint this wall type.")) return var/choice - if(W.material.wall_flags & PAINT_PAINTABLE && W.material.wall_flags & PAINT_STRIPABLE) + if(wall.material.wall_flags & PAINT_PAINTABLE && wall.material.wall_flags & PAINT_STRIPABLE) choice = input(user, "What do you wish to paint?") as null|anything in list(PAINT_REGION_PAINT,PAINT_REGION_STRIPE) - else if(W.material.wall_flags & PAINT_PAINTABLE) + else if(wall.material.wall_flags & PAINT_PAINTABLE) choice = PAINT_REGION_PAINT - else if(W.material.wall_flags & PAINT_STRIPABLE) + else if(wall.material.wall_flags & PAINT_STRIPABLE) choice = PAINT_REGION_STRIPE - if (user.incapacitated() || !W || !user.Adjacent(W)) + if (user.incapacitated() || !wall || !user.Adjacent(wall)) return FALSE if(choice == PAINT_REGION_PAINT) - W.paint_wall(spray_color) + wall.paint_wall(spray_color) else if(choice == PAINT_REGION_STRIPE) - W.stripe_wall(spray_color) + wall.stripe_wall(spray_color) -/obj/item/paint_sprayer/proc/pick_color_from_wall(var/turf/wall/W, var/mob/user) - if (!W.material || !W.material.wall_flags) +/obj/item/paint_sprayer/proc/pick_color_from_wall(var/turf/wall/wall, var/mob/user) + if (!wall.material || !wall.material.wall_flags) return FALSE - switch (select_wall_region(W, user, "Where do you wish to select the color from?")) + switch (select_wall_region(wall, user, "Where do you wish to select the color from?")) if (PAINT_REGION_PAINT) - return W.paint_color + return wall.paint_color if (PAINT_REGION_STRIPE) - return W.stripe_color + return wall.stripe_color else return FALSE -/obj/item/paint_sprayer/proc/select_wall_region(var/turf/wall/W, var/mob/user, var/input_text) +/obj/item/paint_sprayer/proc/select_wall_region(var/turf/wall/wall, var/mob/user, var/input_text) var/list/choices = list() - if (W.material.wall_flags & PAINT_PAINTABLE) + if (wall.material.wall_flags & PAINT_PAINTABLE) choices |= PAINT_REGION_PAINT - if (W.material.wall_flags & PAINT_STRIPABLE) + if (wall.material.wall_flags & PAINT_STRIPABLE) choices |= PAINT_REGION_STRIPE var/choice = input(user, input_text) as null|anything in sortTim(choices, /proc/cmp_text_asc) - if (user.incapacitated() || !W || !user.Adjacent(W)) + if (user.incapacitated() || !wall || !user.Adjacent(wall)) return FALSE return choice diff --git a/code/game/objects/items/devices/personal_shield.dm b/code/game/objects/items/devices/personal_shield.dm index c83b7522cc8d..c88b59712e98 100644 --- a/code/game/objects/items/devices/personal_shield.dm +++ b/code/game/objects/items/devices/personal_shield.dm @@ -11,36 +11,45 @@ /decl/material/solid/metal/uranium = MATTER_AMOUNT_TRACE, ) var/uses = 5 - var/obj/aura/personal_shield/device/shield + var/shield_effect_type = /decl/mob_modifier/shield/device /obj/item/personal_shield/attack_self(var/mob/user) - if(uses && !shield) - shield = new(user,src) - else - QDEL_NULL(shield) + if(loc == user && isliving(user)) + var/mob/living/holder = user + if(holder.has_mob_modifier(shield_effect_type, source = src)) + holder.remove_mob_modifier(shield_effect_type, source = src) + else if(uses && shield_effect_type) + holder.add_mob_modifier(shield_effect_type, source = src) + else + return ..() + return TRUE + return ..() /obj/item/personal_shield/Move() - QDEL_NULL(shield) - return ..() + var/mob/living/holder = loc + . = ..() + if(. && istype(holder) && holder.has_mob_modifier(shield_effect_type, source = src)) + holder.remove_mob_modifier(shield_effect_type, source = src) /obj/item/personal_shield/forceMove() - QDEL_NULL(shield) - return ..() + var/mob/living/holder = loc + . = ..() + if(. && istype(holder) && holder.has_mob_modifier(shield_effect_type, source = src)) + holder.remove_mob_modifier(shield_effect_type, source = src) -/obj/item/personal_shield/proc/take_charge() - if(!--uses) - QDEL_NULL(shield) - to_chat(loc,"\The [src] begins to spark as it breaks!") +/obj/item/personal_shield/proc/expend_charge() + if(uses <= 0) + return FALSE + uses-- + if(uses <= 0 && ismob(loc)) + var/mob/living/holder = loc + if(istype(holder) && holder.has_mob_modifier(shield_effect_type, source = src)) + holder.remove_mob_modifier(shield_effect_type, source = src) + to_chat(holder, SPAN_DANGER("\The [src] begins to spark as it breaks!")) update_icon() - return + return TRUE /obj/item/personal_shield/on_update_icon() . = ..() if(uses) - icon_state = "batterer" - else - icon_state = "battererburnt" - -/obj/item/personal_shield/Destroy() - QDEL_NULL(shield) - return ..() \ No newline at end of file + add_overlay("[icon_state]-on") \ No newline at end of file diff --git a/code/game/objects/items/devices/pinpointer.dm b/code/game/objects/items/devices/pinpointer.dm index f187965a533c..b9624ebf4803 100644 --- a/code/game/objects/items/devices/pinpointer.dm +++ b/code/game/objects/items/devices/pinpointer.dm @@ -126,14 +126,14 @@ var/turf/T = get_turf(src) var/zlevels = SSmapping.get_connected_levels(T.z) var/cur_dist = world.maxx+world.maxy - for(var/obj/item/radio/beacon/R in global.radio_beacons) - if(!R.functioning) + for(var/obj/item/radio/beacon/radio in global.radio_beacons) + if(!radio.functioning) continue - if((R.z in zlevels) && R.frequency == tracking_freq) - var/check_dist = get_dist(src,R) + if((radio.z in zlevels) && radio.frequency == tracking_freq) + var/check_dist = get_dist(src, radio) if(check_dist < cur_dist) cur_dist = check_dist - . = weakref(R) + . = weakref(radio) /obj/item/pinpointer/radio/attack_self(var/mob/user) interact(user) diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm index 890fb77b269c..104617710a6e 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -67,8 +67,8 @@ STOP_PROCESSING_POWER_OBJECT(src) . = ..() -/obj/item/powersink/attackby(var/obj/item/I, var/mob/user) - if(IS_SCREWDRIVER(I)) +/obj/item/powersink/attackby(var/obj/item/used_item, var/mob/user) + if(IS_SCREWDRIVER(used_item)) if(mode == DISCONNECTED) var/turf/T = loc if(isturf(T) && !!T.is_plating()) diff --git a/code/game/objects/items/devices/radio/beacon.dm b/code/game/objects/items/devices/radio/beacon.dm index 3aa24d6dacaf..1cda309212b5 100644 --- a/code/game/objects/items/devices/radio/beacon.dm +++ b/code/game/objects/items/devices/radio/beacon.dm @@ -74,8 +74,8 @@ var/global/list/radio_beacons = list() var/turf/T = get_turf(src) hide(hides_under_flooring() && !T.is_plating()) -/obj/item/radio/beacon/anchored/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/stack/nanopaste)) +/obj/item/radio/beacon/anchored/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/stack/nanopaste)) if(functioning) to_chat(user, SPAN_WARNING("\The [src] does not need any repairs.")) return TRUE @@ -83,7 +83,7 @@ var/global/list/radio_beacons = list() to_chat(user, SPAN_WARNING("\The [src] is completely irrepairable.")) return TRUE - var/obj/item/stack/nanopaste/S = I + var/obj/item/stack/nanopaste/S = used_item if(!panel_open) to_chat(user, SPAN_WARNING("You can't work on \the [src] until its been opened up.")) return TRUE diff --git a/code/game/objects/items/devices/radio/encryptionkey.dm b/code/game/objects/items/devices/radio/encryptionkey.dm index dc29d7b3e4b4..bcc1ab952fbe 100644 --- a/code/game/objects/items/devices/radio/encryptionkey.dm +++ b/code/game/objects/items/devices/radio/encryptionkey.dm @@ -43,17 +43,17 @@ return TRUE . = ..() -/obj/item/encryptionkey/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/card/id)) - var/obj/item/card/id/id = W +/obj/item/encryptionkey/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/card/id)) + var/obj/item/card/id/id = used_item var/list/access = id.GetAccess() if(!length(access)) - to_chat(user, SPAN_WARNING("\The [W] has no access keys to copy.")) + to_chat(user, SPAN_WARNING("\The [used_item] has no access keys to copy.")) return TRUE LAZYINITLIST(can_decrypt) can_decrypt |= access UNSETEMPTY(can_decrypt) - to_chat(user, SPAN_NOTICE("You pass \the [W] across \the [src], copying the access keys into the encryption cache.")) + to_chat(user, SPAN_NOTICE("You pass \the [used_item] across \the [src], copying the access keys into the encryption cache.")) return TRUE . = ..() diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 0d58d152d45a..ed308e4410a9 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -16,8 +16,8 @@ return /obj/item/radio/headset/on_update_icon() + . = ..() icon_state = get_world_inventory_state() - cut_overlays() if(on) if(analog) add_overlay("[icon_state]-local") diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 081365675f01..7277834d2d25 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -456,22 +456,22 @@ if(panel_open) . += SPAN_WARNING("A panel on the back of \the [src] is hanging open.") -/obj/item/radio/attackby(obj/item/W, mob/user) +/obj/item/radio/attackby(obj/item/used_item, mob/user) user.set_machine(src) - if(istype(W, /obj/item/encryptionkey)) + if(istype(used_item, /obj/item/encryptionkey)) if(!encryption_key_capacity) to_chat(user, SPAN_WARNING("\The [src] cannot accept an encryption key.")) return TRUE if(length(encryption_keys) >= encryption_key_capacity) to_chat(user, SPAN_WARNING("\The [src] cannot fit any more encryption keys.")) return TRUE - if(user.try_unequip(W, src)) - LAZYADD(encryption_keys, W) + if(user.try_unequip(used_item, src)) + LAZYADD(encryption_keys, used_item) channels = null return TRUE - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) if(length(encryption_keys)) var/obj/item/encryptionkey/ekey = pick(encryption_keys) ekey.dropInto(loc) diff --git a/code/game/objects/items/devices/radio/radio_borg.dm b/code/game/objects/items/devices/radio/radio_borg.dm index c8c6935215e0..eab3b5bd6e08 100644 --- a/code/game/objects/items/devices/radio/radio_borg.dm +++ b/code/game/objects/items/devices/radio/radio_borg.dm @@ -13,8 +13,8 @@ /obj/item/radio/borg/can_receive_message(var/check_network_membership) . = ..() && isrobot(loc) if(.) - var/mob/living/silicon/robot/R = loc - if(!R.handle_radio_transmission()) + var/mob/living/silicon/robot/robot = loc + if(!robot.handle_radio_transmission()) return FALSE /obj/item/radio/borg/ert @@ -32,8 +32,8 @@ /obj/item/radio/borg/talk_into(mob/living/M, message, message_mode, var/verb = "says", var/decl/language/speaking = null) . = ..() if(isrobot(loc)) - var/mob/living/silicon/robot/R = src.loc - R.handle_radio_transmission() + var/mob/living/silicon/robot/robot = src.loc + robot.handle_radio_transmission() /obj/item/radio/borg/OnTopic(mob/user, href_list, datum/topic_state/state) if((. = ..())) diff --git a/code/game/objects/items/devices/spy_bug.dm b/code/game/objects/items/devices/spy_bug.dm index c3cf46fe3b81..518b43c3d377 100644 --- a/code/game/objects/items/devices/spy_bug.dm +++ b/code/game/objects/items/devices/spy_bug.dm @@ -38,13 +38,12 @@ /obj/item/spy_bug/attack_self(mob/user) radio.attack_self(user) -/obj/item/spy_bug/attackby(obj/W, mob/user) - if(istype(W, /obj/item/spy_monitor)) - var/obj/item/spy_monitor/SM = W +/obj/item/spy_bug/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/spy_monitor)) + var/obj/item/spy_monitor/SM = used_item SM.pair(src, user) return TRUE - else - return ..() + return ..() /obj/item/spy_bug/hear_talk(mob/M, var/msg, verb, decl/language/speaking) radio.hear_talk(M, msg, speaking) @@ -88,12 +87,11 @@ radio.attack_self(user) view_cameras(user) -/obj/item/spy_monitor/attackby(obj/W, mob/user) - if(istype(W, /obj/item/spy_bug)) - pair(W, user) +/obj/item/spy_monitor/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/spy_bug)) + pair(used_item, user) return TRUE - else - return ..() + return ..() /obj/item/spy_monitor/proc/pair(var/obj/item/spy_bug/SB, var/mob/living/user) to_chat(user, SPAN_NOTICE("\The [SB] has been paired with \the [src].")) diff --git a/code/game/objects/items/devices/suit_cooling.dm b/code/game/objects/items/devices/suit_cooling.dm index 27b044c6a1d0..a8cbf50f10b3 100644 --- a/code/game/objects/items/devices/suit_cooling.dm +++ b/code/game/objects/items/devices/suit_cooling.dm @@ -106,8 +106,8 @@ turn_on() to_chat(user, "You switch \the [src] [on ? "on" : "off"].") -/obj/item/suit_cooling_unit/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/suit_cooling_unit/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) if(cover_open) cover_open = 0 to_chat(user, "You screw the panel into place.") @@ -117,14 +117,14 @@ update_icon() return TRUE - if (istype(W, /obj/item/cell)) + if (istype(used_item, /obj/item/cell)) if(cover_open) if(cell) to_chat(user, "There is a [cell] already installed here.") else - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - cell = W + cell = used_item to_chat(user, "You insert \the [cell].") update_icon() return TRUE diff --git a/code/game/objects/items/devices/tape_recorder/magnetic_tape.dm b/code/game/objects/items/devices/tape_recorder/magnetic_tape.dm new file mode 100644 index 000000000000..26d5cdf79b36 --- /dev/null +++ b/code/game/objects/items/devices/tape_recorder/magnetic_tape.dm @@ -0,0 +1,176 @@ +/obj/item/magnetic_tape + name = "tape" + desc = "A magnetic tape that can hold up to ten minutes of content." + icon = 'icons/obj/items/device/tape_recorder/tape_casette_white.dmi' + icon_state = ICON_STATE_WORLD + w_class = ITEM_SIZE_SMALL + material = /decl/material/solid/organic/plastic + matter = list( + /decl/material/solid/metal/steel = MATTER_AMOUNT_REINFORCEMENT, + /decl/material/solid/fiberglass = MATTER_AMOUNT_TRACE + ) + _base_attack_force = 1 + var/max_capacity = 600 + var/used_capacity = 0 + var/list/storedinfo = new/list() + var/list/timestamp = new/list() + var/ruined = FALSE + var/doctored = FALSE + /// Whether we draw the ruined ribbon overlay when ruined. + var/draw_ribbon_if_ruined = TRUE + +/obj/item/magnetic_tape/on_update_icon() + . = ..() + icon_state = get_world_inventory_state() + if(draw_ribbon_if_ruined && ruined && max_capacity) + add_overlay(overlay_image(icon, "[icon_state]_ribbonoverlay", flags = RESET_COLOR)) + +/obj/item/magnetic_tape/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) + ruin() + return ..() + +/obj/item/magnetic_tape/attack_self(mob/user) + if(!ruined) + to_chat(user, SPAN_NOTICE("You pull out all the tape!")) + get_loose_tape(user, length(storedinfo)) + ruin() + + +/obj/item/magnetic_tape/proc/ruin() + ruined = TRUE + update_icon() + + +/obj/item/magnetic_tape/proc/fix() + ruined = FALSE + update_icon() + + +/obj/item/magnetic_tape/proc/record_speech(text) + timestamp += used_capacity + storedinfo += "\[[time2text(used_capacity SECONDS,"mm:ss")]\] [text]" + + +//shows up on the printed transcript as (Unrecognized sound) +/obj/item/magnetic_tape/proc/record_noise(text) + timestamp += used_capacity + storedinfo += "*\[[time2text(used_capacity SECONDS,"mm:ss")]\] [text]" + + +/obj/item/magnetic_tape/attackby(obj/item/used_item, mob/user, params) + if(user.incapacitated()) // TODO: this may not be necessary since OnClick checks before starting the attack chain + return TRUE + if(ruined && IS_SCREWDRIVER(used_item)) + if(!max_capacity) + to_chat(user, SPAN_NOTICE("There is no tape left inside.")) + return TRUE + to_chat(user, SPAN_NOTICE("You start winding the tape back in...")) + if(do_after(user, 12 SECONDS, target = src)) + to_chat(user, SPAN_NOTICE("You wound the tape back in.")) + fix() + return TRUE + else if(IS_PEN(used_item)) + if(loc == user) + var/new_name = input(user, "What would you like to label the tape?", "Tape labeling") as null|text + if(isnull(new_name)) return TRUE + new_name = sanitize_safe(new_name) + if(new_name) + SetName("tape - '[new_name]'") + to_chat(user, SPAN_NOTICE("You label the tape '[new_name]'.")) + else + SetName("tape") + to_chat(user, SPAN_NOTICE("You scratch off the label.")) + return TRUE + else if(IS_WIRECUTTER(used_item)) + cut(user) + return TRUE + else if(istype(used_item, /obj/item/magnetic_tape/loose)) + join(user, used_item) + return TRUE + return ..() + +/obj/item/magnetic_tape/proc/cut(mob/user) + if(!LAZYLEN(timestamp)) + to_chat(user, SPAN_NOTICE("There's nothing on this tape!")) + return + var/list/output = list("
") + for(var/i in 1 to length(timestamp)) + var/time = "\[[time2text(timestamp[i] SECONDS,"mm:ss")]\]" + output += "[time]
-----CUT------
" + output += "
" + + var/datum/browser/popup = new(user, "tape_cutting", "Cutting tape", 170, 600) + popup.set_content(jointext(output,null)) + popup.open() + +/obj/item/magnetic_tape/proc/join(mob/user, obj/item/magnetic_tape/other) + if(max_capacity + other.max_capacity > initial(max_capacity)) + to_chat(user, SPAN_NOTICE("You can't fit this much tape in!")) + return + if(user.try_unequip(other)) + to_chat(user, SPAN_NOTICE("You join ends of the tape together.")) + max_capacity += other.max_capacity + used_capacity = min(used_capacity + other.used_capacity, max_capacity) + timestamp += other.timestamp + storedinfo += other.storedinfo + doctored = TRUE + ruin() + update_icon() + qdel(other) + +/obj/item/magnetic_tape/OnTopic(var/mob/user, var/list/href_list) + if(href_list["cut_after"]) + var/index = text2num(href_list["cut_after"]) + if(index >= length(timestamp)) + return + + to_chat(user, SPAN_NOTICE("You remove part of the tape.")) + get_loose_tape(user, index) + cut(user) + return TOPIC_REFRESH + +//Spawns new loose tape item, with data starting from [index] entry +/obj/item/magnetic_tape/proc/get_loose_tape(var/mob/user, var/index) + var/obj/item/magnetic_tape/loose/newtape = new() + newtape.timestamp = timestamp.Copy(index+1) + newtape.storedinfo = storedinfo.Copy(index+1) + newtape.max_capacity = max_capacity - index + newtape.used_capacity = max(0, used_capacity - max_capacity) + newtape.doctored = doctored + user.put_in_hands(newtape) + + timestamp.Cut(index+1) + storedinfo.Cut(index+1) + max_capacity = index + used_capacity = min(used_capacity,index) + +//Random colour tapes +/obj/item/magnetic_tape/random/Initialize() + icon = pick(list( + 'icons/obj/items/device/tape_recorder/tape_casette_white.dmi', + 'icons/obj/items/device/tape_recorder/tape_casette_blue.dmi', + 'icons/obj/items/device/tape_recorder/tape_casette_red.dmi', + 'icons/obj/items/device/tape_recorder/tape_casette_yellow.dmi', + 'icons/obj/items/device/tape_recorder/tape_casette_purple.dmi' + )) + . = ..() + +/obj/item/magnetic_tape/loose + name = "magnetic tape" + desc = "Quantum-enriched self-repairing nanotape, used for magnetic storage of information." + icon = 'icons/obj/items/device/tape_recorder/tape_casette_loose.dmi' + ruined = TRUE + draw_ribbon_if_ruined = FALSE + +/obj/item/magnetic_tape/loose/fix() + return + +/obj/item/magnetic_tape/loose/get_loose_tape() + return + +/obj/item/magnetic_tape/loose/get_examine_strings(mob/user, distance, infix, suffix) + . = ..() + if(distance <= 1) + . += SPAN_NOTICE("It looks long enough to hold [max_capacity] seconds worth of recording.") + if(doctored && user.skill_check(SKILL_FORENSICS, SKILL_PROF)) + . += SPAN_WARNING("It has been tampered with...") diff --git a/code/game/objects/items/devices/tape_recorder/tape_recorder.dm b/code/game/objects/items/devices/tape_recorder/tape_recorder.dm new file mode 100644 index 000000000000..7677f30a1dc0 --- /dev/null +++ b/code/game/objects/items/devices/tape_recorder/tape_recorder.dm @@ -0,0 +1,360 @@ +/obj/item/taperecorder + name = "universal recorder" + desc = "A device that can record to cassette tapes, and play them. It automatically translates the content in playback." + icon = 'icons/obj/items/device/tape_recorder/tape_recorder.dmi' + icon_state = ICON_STATE_WORLD + w_class = ITEM_SIZE_SMALL + material = /decl/material/solid/metal/aluminium + matter = list(/decl/material/solid/fiberglass = MATTER_AMOUNT_REINFORCEMENT) + obj_flags = OBJ_FLAG_CONDUCTIBLE + slot_flags = SLOT_LOWER_BODY + throw_speed = 4 + throw_range = 20 + + var/emagged = FALSE + var/recording = FALSE + var/playing = FALSE + var/playsleepseconds = 0 + var/obj/item/magnetic_tape/mytape = /obj/item/magnetic_tape/random + var/const/TRANSCRIPT_PRINT_COOLDOWN = 5 MINUTES + /// (FLOAT) The minimum world.time before a transcript can be printed again. + var/next_print_time = 0 + var/datum/wires/taperecorder/wires = null // Wires datum + /// (BOOL) If TRUE, wire datum is accessible for interactions. + var/wires_accessible = FALSE + +/obj/item/taperecorder/Initialize() + . = ..() + wires = new(src) + if(ispath(mytape)) + mytape = new mytape(src) + global.listening_objects += src + update_icon() + +/obj/item/taperecorder/empty + mytape = null + +/obj/item/taperecorder/Destroy() + QDEL_NULL(wires) + QDEL_NULL(mytape) + return ..() + +/obj/item/taperecorder/attackby(obj/item/used_item, mob/user, params) + if(IS_SCREWDRIVER(used_item)) + wires_accessible = !wires_accessible + to_chat(user, SPAN_NOTICE("You [wires_accessible ? "open" : "secure"] the lid.")) + return TRUE + if(istype(used_item, /obj/item/magnetic_tape)) + if(mytape) + to_chat(user, SPAN_NOTICE("There's already a tape inside.")) + return TRUE + if(!user.try_unequip(used_item)) + return TRUE + used_item.forceMove(src) + mytape = used_item + to_chat(user, SPAN_NOTICE("You insert [used_item] into [src].")) + update_icon() + return TRUE + return ..() + + +/obj/item/taperecorder/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) + if(mytape) + mytape.ruin() //Fires destroy the tape + return ..() + + +/obj/item/taperecorder/attack_hand(mob/user) + if(user.is_holding_offhand(src) && mytape && user.check_dexterity(DEXTERITY_SIMPLE_MACHINES)) + eject() + return TRUE + return ..() + + +/obj/item/taperecorder/verb/eject() + set name = "Eject Tape" + set category = "Object" + + if(usr.incapacitated()) + return + if(!mytape) + to_chat(usr, SPAN_NOTICE("There's no tape in \the [src].")) + return + if(emagged) + to_chat(usr, SPAN_NOTICE("The tape seems to be stuck inside.")) + return + + if(playing || recording) + stop() + to_chat(usr, SPAN_NOTICE("You remove [mytape] from [src].")) + usr.put_in_hands(mytape) + mytape = null + update_icon() + +/obj/item/taperecorder/get_examine_strings(mob/user, distance, infix, suffix) + . = ..() + if(distance <= 1 && wires_accessible) + . += SPAN_NOTICE("The wires are exposed.") + +/obj/item/taperecorder/hear_talk(mob/living/M, msg, var/verb="says", decl/language/speaking=null) + if(mytape && recording) + + if(speaking) + if(!speaking.machine_understands) + msg = speaking.scramble(M, msg) + mytape.record_speech("[M.name] [speaking.format_message_plain(msg, verb)]") + else + mytape.record_speech("[M.name] [verb], \"[msg]\"") + +/obj/item/taperecorder/show_message(msg, type, alt, alt_type) + var/recordedtext + if (msg && type == AUDIBLE_MESSAGE) //must be hearable + recordedtext = msg + else if (alt && alt_type == AUDIBLE_MESSAGE) + recordedtext = alt + else + return + if(mytape && recording) + mytape.record_noise("[strip_html_properly(recordedtext)]") + +/obj/item/taperecorder/emag_act(var/remaining_charges, var/mob/user) + if(!emagged) + emagged = TRUE + recording = FALSE + to_chat(user, SPAN_WARNING("PZZTTPFFFT")) + update_icon() + return 1 + else + to_chat(user, SPAN_WARNING("It is already emagged!")) + +/obj/item/taperecorder/proc/explode() + var/turf/T = get_turf(loc) + if(ismob(loc)) + var/mob/M = loc + to_chat(M, SPAN_DANGER("\The [src] explodes!")) + if(T) + T.hotspot_expose(700,125) + explosion(T, -1, -1, 0, 4) + qdel(src) + return + +/obj/item/taperecorder/verb/record() + set name = "Start Recording" + set category = "Object" + + if(usr.incapacitated()) + return + playsound(src, 'sound/machines/click.ogg', 10, 1) + if(!mytape) + to_chat(usr, SPAN_NOTICE("There's no tape!")) + return + if(mytape.ruined || emagged) + audible_message(SPAN_WARNING("The tape recorder makes a scratchy noise.")) + return + if(recording) + to_chat(usr, SPAN_NOTICE("You're already recording!")) + return + if(playing) + to_chat(usr, SPAN_NOTICE("You can't record when playing!")) + return + if(mytape.used_capacity < mytape.max_capacity) + to_chat(usr, SPAN_NOTICE("Recording started.")) + recording = TRUE + update_icon() + + mytape.record_speech("Recording started.") + + //count seconds until full, or recording is stopped + while(mytape && recording && mytape.used_capacity < mytape.max_capacity) + sleep(1 SECOND) + mytape.used_capacity++ + if(mytape.used_capacity >= mytape.max_capacity) + to_chat(usr, SPAN_NOTICE("The tape is full.")) + stop_recording() + + + update_icon() + return + else + to_chat(usr, SPAN_NOTICE("The tape is full.")) + + +/obj/item/taperecorder/proc/stop_recording() + //Sanity checks skipped, should not be called unless actually recording + recording = FALSE + update_icon() + mytape.record_speech("Recording stopped.") + if(ismob(loc)) + var/mob/M = loc + to_chat(M, SPAN_NOTICE("Recording stopped.")) + + +/obj/item/taperecorder/verb/stop() + set name = "Stop" + set category = "Object" + + if(usr.incapacitated()) + return + playsound(src, 'sound/machines/click.ogg', 10, 1) + if(recording) + stop_recording() + return + else if(playing) + playing = FALSE + update_icon() + to_chat(usr, SPAN_NOTICE("Playback stopped.")) + return + else + to_chat(usr, SPAN_NOTICE("Stop what?")) + + +/obj/item/taperecorder/verb/wipe_tape() + set name = "Wipe Tape" + set category = "Object" + + if(usr.incapacitated()) + return + if(!mytape) + return + if(emagged || mytape.ruined) + audible_message(SPAN_WARNING("The tape recorder makes a scratchy noise.")) + return + if(recording || playing) + to_chat(usr, SPAN_NOTICE("You can't wipe the tape while playing or recording!")) + return + else + if(mytape.storedinfo) mytape.storedinfo.Cut() + if(mytape.timestamp) mytape.timestamp.Cut() + mytape.used_capacity = 0 + to_chat(usr, SPAN_NOTICE("You wipe the tape.")) + return + + +/obj/item/taperecorder/verb/playback_memory() + set name = "Playback Tape" + set category = "Object" + + if(usr.incapacitated()) + return + play(usr) + +/obj/item/taperecorder/proc/play(mob/user) + if(!mytape) + to_chat(user, SPAN_NOTICE("There's no tape!")) + return + if(mytape.ruined) + audible_message(SPAN_WARNING("The tape recorder makes a scratchy noise.")) + return + if(recording) + to_chat(user, SPAN_NOTICE("You can't playback when recording!")) + return + if(playing) + to_chat(user, SPAN_NOTICE("\The [src] is already playing its recording!")) + return + playing = TRUE + update_icon() + to_chat(user, SPAN_NOTICE("Audio playback started.")) + playsound(src, 'sound/machines/click.ogg', 10, 1) + for(var/i=1 , i < mytape.max_capacity , i++) + if(!mytape || !playing) + break + if(length(mytape.storedinfo) < i) + break + + var/turf/T = get_turf(src) + var/playedmessage = mytape.storedinfo[i] + if (findtextEx(playedmessage,"*",1,2)) //remove marker for action sounds + playedmessage = copytext(playedmessage,2) + T.audible_message(SPAN_MAROON("Tape Recorder: [playedmessage]")) + + if(length(mytape.storedinfo) < i+1) + playsleepseconds = 1 + sleep(10) + T = get_turf(src) + T.audible_message(SPAN_MAROON("Tape Recorder: End of recording.")) + playsound(src, 'sound/machines/click.ogg', 10, 1) + break + else + playsleepseconds = mytape.timestamp[i+1] - mytape.timestamp[i] + + if(playsleepseconds > 14) + sleep(10) + T = get_turf(src) + T.audible_message(SPAN_MAROON("Tape Recorder: Skipping [playsleepseconds] seconds of silence")) + playsleepseconds = 1 + sleep(playsleepseconds SECONDS) + + + playing = FALSE + update_icon() + + if(emagged) + var/turf/T = get_turf(src) + T.audible_message(SPAN_MAROON("Tape Recorder: This tape recorder will self-destruct in... Five.")) + sleep(10) + T = get_turf(src) + T.audible_message(SPAN_MAROON("Tape Recorder: Four.")) + sleep(10) + T = get_turf(src) + T.audible_message(SPAN_MAROON("Tape Recorder: Three.")) + sleep(10) + T = get_turf(src) + T.audible_message(SPAN_MAROON("Tape Recorder: Two.")) + sleep(10) + T = get_turf(src) + T.audible_message(SPAN_MAROON("Tape Recorder: One.")) + sleep(10) + explode() + + +/obj/item/taperecorder/verb/print_transcript() + set name = "Print Transcript" + set category = "Object" + + if(usr.incapacitated()) + return + if(!mytape) + to_chat(usr, SPAN_NOTICE("There's no tape!")) + return + if(mytape.ruined || emagged) + audible_message(SPAN_WARNING("The tape recorder makes a scratchy noise.")) + return + if(next_print_time < world.time) + to_chat(usr, SPAN_NOTICE("The recorder can't print that fast!")) + return + if(recording || playing) + to_chat(usr, SPAN_NOTICE("You can't print the transcript while playing or recording!")) + return + + to_chat(usr, SPAN_NOTICE("Transcript printed.")) + var/obj/item/paper/P = new /obj/item/paper(get_turf(src)) + var/t1 = "Transcript:

" + for(var/i in 1 to length(mytape.storedinfo)) + var/printedmessage = mytape.storedinfo[i] + if (findtextEx(printedmessage,"*",1,2)) //replace action sounds + printedmessage = "\[[time2text(mytape.timestamp[i]*10,"mm:ss")]\] (Unrecognized sound)" + t1 += "[printedmessage]
" + P.info = t1 + P.SetName("Transcript") + next_print_time = world.time + TRANSCRIPT_PRINT_COOLDOWN + +/obj/item/taperecorder/attack_self(mob/user) + if(wires_accessible) + wires.Interact(user) + return + if(recording || playing) + stop() + else + record() + +/obj/item/taperecorder/on_update_icon() + . = ..() + icon_state = get_world_inventory_state() + if(!mytape) + icon_state = "[icon_state]_empty" + else if(recording) + icon_state = "[icon_state]_recording" + else if(playing) + icon_state = "[icon_state]_playing" + else + icon_state = "[icon_state]_idle" diff --git a/code/datums/wires/taperecorder.dm b/code/game/objects/items/devices/tape_recorder/taperecorder_wires.dm similarity index 90% rename from code/datums/wires/taperecorder.dm rename to code/game/objects/items/devices/tape_recorder/taperecorder_wires.dm index 784cd1a17df1..20e4bd7f63fa 100644 --- a/code/datums/wires/taperecorder.dm +++ b/code/game/objects/items/devices/tape_recorder/taperecorder_wires.dm @@ -4,8 +4,7 @@ descriptions = list( new /datum/wire_description(TAPE_WIRE_TOGGLE, "This wire runs to the play/stop toggle.", SKILL_ADEPT) ) - -var/global/const/TAPE_WIRE_TOGGLE = 1 + var/const/TAPE_WIRE_TOGGLE = 1 /datum/wires/taperecorder/UpdatePulsed(var/index) var/obj/item/taperecorder/T = holder diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm deleted file mode 100644 index 54ecd2dfd4ef..000000000000 --- a/code/game/objects/items/devices/taperecorder.dm +++ /dev/null @@ -1,540 +0,0 @@ -/obj/item/taperecorder - name = "universal recorder" - desc = "A device that can record to cassette tapes, and play them. It automatically translates the content in playback." - icon = 'icons/obj/items/device/tape_recorder/tape_recorder.dmi' - icon_state = ICON_STATE_WORLD - w_class = ITEM_SIZE_SMALL - material = /decl/material/solid/metal/aluminium - matter = list(/decl/material/solid/fiberglass = MATTER_AMOUNT_REINFORCEMENT) - obj_flags = OBJ_FLAG_CONDUCTIBLE - slot_flags = SLOT_LOWER_BODY - throw_speed = 4 - throw_range = 20 - - var/emagged = 0.0 - var/recording = 0.0 - var/playing = 0.0 - var/playsleepseconds = 0.0 - var/obj/item/magnetic_tape/mytape = /obj/item/magnetic_tape/random - var/canprint = 1 - var/datum/wires/taperecorder/wires = null // Wires datum - var/maintenance = 0 - -/obj/item/taperecorder/Initialize() - . = ..() - wires = new(src) - if(ispath(mytape)) - mytape = new mytape(src) - global.listening_objects += src - update_icon() - -/obj/item/taperecorder/empty - mytape = null - -/obj/item/taperecorder/Destroy() - QDEL_NULL(wires) - if(mytape) - qdel(mytape) - mytape = null - return ..() - -/obj/item/taperecorder/attackby(obj/item/I, mob/user, params) - if(IS_SCREWDRIVER(I)) - maintenance = !maintenance - to_chat(user, "You [maintenance ? "open" : "secure"] the lid.") - return TRUE - if(istype(I, /obj/item/magnetic_tape)) - if(mytape) - to_chat(user, "There's already a tape inside.") - return TRUE - if(!user.try_unequip(I)) - return TRUE - I.forceMove(src) - mytape = I - to_chat(user, "You insert [I] into [src].") - update_icon() - return TRUE - return ..() - - -/obj/item/taperecorder/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) - if(mytape) - mytape.ruin() //Fires destroy the tape - return ..() - - -/obj/item/taperecorder/attack_hand(mob/user) - if(user.is_holding_offhand(src) && mytape && user.check_dexterity(DEXTERITY_SIMPLE_MACHINES)) - eject() - return TRUE - return ..() - - -/obj/item/taperecorder/verb/eject() - set name = "Eject Tape" - set category = "Object" - - if(usr.incapacitated()) - return - if(!mytape) - to_chat(usr, "There's no tape in \the [src].") - return - if(emagged) - to_chat(usr, "The tape seems to be stuck inside.") - return - - if(playing || recording) - stop() - to_chat(usr, "You remove [mytape] from [src].") - usr.put_in_hands(mytape) - mytape = null - update_icon() - -/obj/item/taperecorder/get_examine_strings(mob/user, distance, infix, suffix) - . = ..() - if(distance <= 1 && maintenance) - . += SPAN_NOTICE("The wires are exposed.") - -/obj/item/taperecorder/hear_talk(mob/living/M, msg, var/verb="says", decl/language/speaking=null) - if(mytape && recording) - - if(speaking) - if(!speaking.machine_understands) - msg = speaking.scramble(M, msg) - mytape.record_speech("[M.name] [speaking.format_message_plain(msg, verb)]") - else - mytape.record_speech("[M.name] [verb], \"[msg]\"") - -/obj/item/taperecorder/show_message(msg, type, alt, alt_type) - var/recordedtext - if (msg && type == AUDIBLE_MESSAGE) //must be hearable - recordedtext = msg - else if (alt && alt_type == AUDIBLE_MESSAGE) - recordedtext = alt - else - return - if(mytape && recording) - mytape.record_noise("[strip_html_properly(recordedtext)]") - -/obj/item/taperecorder/emag_act(var/remaining_charges, var/mob/user) - if(emagged == 0) - emagged = 1 - recording = 0 - to_chat(user, "PZZTTPFFFT") - update_icon() - return 1 - else - to_chat(user, "It is already emagged!") - -/obj/item/taperecorder/proc/explode() - var/turf/T = get_turf(loc) - if(ismob(loc)) - var/mob/M = loc - to_chat(M, "\The [src] explodes!") - if(T) - T.hotspot_expose(700,125) - explosion(T, -1, -1, 0, 4) - qdel(src) - return - -/obj/item/taperecorder/verb/record() - set name = "Start Recording" - set category = "Object" - - if(usr.incapacitated()) - return - playsound(src, 'sound/machines/click.ogg', 10, 1) - if(!mytape) - to_chat(usr, "There's no tape!") - return - if(mytape.ruined || emagged) - audible_message("The tape recorder makes a scratchy noise.") - return - if(recording) - to_chat(usr, "You're already recording!") - return - if(playing) - to_chat(usr, "You can't record when playing!") - return - if(mytape.used_capacity < mytape.max_capacity) - to_chat(usr, "Recording started.") - recording = 1 - update_icon() - - mytape.record_speech("Recording started.") - - //count seconds until full, or recording is stopped - while(mytape && recording && mytape.used_capacity < mytape.max_capacity) - sleep(10) - mytape.used_capacity++ - if(mytape.used_capacity >= mytape.max_capacity) - if(ismob(loc)) - var/mob/M = loc - to_chat(M, "The tape is full.") - stop_recording() - - - update_icon() - return - else - to_chat(usr, "The tape is full.") - - -/obj/item/taperecorder/proc/stop_recording() - //Sanity checks skipped, should not be called unless actually recording - recording = 0 - update_icon() - mytape.record_speech("Recording stopped.") - if(ismob(loc)) - var/mob/M = loc - to_chat(M, "Recording stopped.") - - -/obj/item/taperecorder/verb/stop() - set name = "Stop" - set category = "Object" - - if(usr.incapacitated()) - return - playsound(src, 'sound/machines/click.ogg', 10, 1) - if(recording) - stop_recording() - return - else if(playing) - playing = 0 - update_icon() - to_chat(usr, "Playback stopped.") - return - else - to_chat(usr, "Stop what?") - - -/obj/item/taperecorder/verb/wipe_tape() - set name = "Wipe Tape" - set category = "Object" - - if(usr.incapacitated()) - return - if(!mytape) - return - if(emagged || mytape.ruined) - audible_message("The tape recorder makes a scratchy noise.") - return - if(recording || playing) - to_chat(usr, "You can't wipe the tape while playing or recording!") - return - else - if(mytape.storedinfo) mytape.storedinfo.Cut() - if(mytape.timestamp) mytape.timestamp.Cut() - mytape.used_capacity = 0 - to_chat(usr, "You wipe the tape.") - return - - -/obj/item/taperecorder/verb/playback_memory() - set name = "Playback Tape" - set category = "Object" - - if(usr.incapacitated()) - return - play(usr) - -/obj/item/taperecorder/proc/play(mob/user) - if(!mytape) - to_chat(user, "There's no tape!") - return - if(mytape.ruined) - audible_message("The tape recorder makes a scratchy noise.") - return - if(recording) - to_chat(user, "You can't playback when recording!") - return - if(playing) - to_chat(user, "You're already playing!") - return - playing = 1 - update_icon() - to_chat(user, "Audio playback started.") - playsound(src, 'sound/machines/click.ogg', 10, 1) - for(var/i=1 , i < mytape.max_capacity , i++) - if(!mytape || !playing) - break - if(mytape.storedinfo.len < i) - break - - var/turf/T = get_turf(src) - var/playedmessage = mytape.storedinfo[i] - if (findtextEx(playedmessage,"*",1,2)) //remove marker for action sounds - playedmessage = copytext(playedmessage,2) - T.audible_message(SPAN_MAROON("Tape Recorder: [playedmessage]")) - - if(mytape.storedinfo.len < i+1) - playsleepseconds = 1 - sleep(10) - T = get_turf(src) - T.audible_message(SPAN_MAROON("Tape Recorder: End of recording.")) - playsound(src, 'sound/machines/click.ogg', 10, 1) - break - else - playsleepseconds = mytape.timestamp[i+1] - mytape.timestamp[i] - - if(playsleepseconds > 14) - sleep(10) - T = get_turf(src) - T.audible_message(SPAN_MAROON("Tape Recorder: Skipping [playsleepseconds] seconds of silence")) - playsleepseconds = 1 - sleep(10 * playsleepseconds) - - - playing = 0 - update_icon() - - if(emagged) - var/turf/T = get_turf(src) - T.audible_message(SPAN_MAROON("Tape Recorder: This tape recorder will self-destruct in... Five.")) - sleep(10) - T = get_turf(src) - T.audible_message(SPAN_MAROON("Tape Recorder: Four.")) - sleep(10) - T = get_turf(src) - T.audible_message(SPAN_MAROON("Tape Recorder: Three.")) - sleep(10) - T = get_turf(src) - T.audible_message(SPAN_MAROON("Tape Recorder: Two.")) - sleep(10) - T = get_turf(src) - T.audible_message(SPAN_MAROON("Tape Recorder: One.")) - sleep(10) - explode() - - -/obj/item/taperecorder/verb/print_transcript() - set name = "Print Transcript" - set category = "Object" - - if(usr.incapacitated()) - return - if(!mytape) - to_chat(usr, "There's no tape!") - return - if(mytape.ruined || emagged) - audible_message("The tape recorder makes a scratchy noise.") - return - if(!canprint) - to_chat(usr, "The recorder can't print that fast!") - return - if(recording || playing) - to_chat(usr, "You can't print the transcript while playing or recording!") - return - - to_chat(usr, "Transcript printed.") - var/obj/item/paper/P = new /obj/item/paper(get_turf(src)) - var/t1 = "Transcript:

" - for(var/i=1,mytape.storedinfo.len >= i,i++) - var/printedmessage = mytape.storedinfo[i] - if (findtextEx(printedmessage,"*",1,2)) //replace action sounds - printedmessage = "\[[time2text(mytape.timestamp[i]*10,"mm:ss")]\] (Unrecognized sound)" - t1 += "[printedmessage]
" - P.info = t1 - P.SetName("Transcript") - canprint = 0 - sleep(300) - canprint = 1 - -/obj/item/taperecorder/attack_self(mob/user) - if(maintenance) - wires.Interact(user) - return - if(recording || playing) - stop() - else - record() - -/obj/item/taperecorder/on_update_icon() - . = ..() - icon_state = get_world_inventory_state() - if(!mytape) - icon_state = "[icon_state]_empty" - else if(recording) - icon_state = "[icon_state]_recording" - else if(playing) - icon_state = "[icon_state]_playing" - else - icon_state = "[icon_state]_idle" - -/obj/item/magnetic_tape - name = "tape" - desc = "A magnetic tape that can hold up to ten minutes of content." - icon = 'icons/obj/items/device/tape_recorder/tape_casette_white.dmi' - icon_state = ICON_STATE_WORLD - w_class = ITEM_SIZE_SMALL - material = /decl/material/solid/organic/plastic - matter = list( - /decl/material/solid/metal/steel = MATTER_AMOUNT_REINFORCEMENT, - /decl/material/solid/fiberglass = MATTER_AMOUNT_TRACE - ) - _base_attack_force = 1 - var/max_capacity = 600 - var/used_capacity = 0 - var/list/storedinfo = new/list() - var/list/timestamp = new/list() - var/ruined = 0 - var/doctored = 0 - /// Whether we draw the ruined ribbon overlay when ruined. - var/draw_ribbon_if_ruined = TRUE - -/obj/item/magnetic_tape/on_update_icon() - . = ..() - icon_state = get_world_inventory_state() - if(draw_ribbon_if_ruined && ruined && max_capacity) - add_overlay(overlay_image(icon, "[icon_state]_ribbonoverlay", flags = RESET_COLOR)) - -/obj/item/magnetic_tape/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) - ruin() - return ..() - -/obj/item/magnetic_tape/attack_self(mob/user) - if(!ruined) - to_chat(user, "You pull out all the tape!") - get_loose_tape(user, storedinfo.len) - ruin() - - -/obj/item/magnetic_tape/proc/ruin() - ruined = TRUE - update_icon() - - -/obj/item/magnetic_tape/proc/fix() - ruined = FALSE - update_icon() - - -/obj/item/magnetic_tape/proc/record_speech(text) - timestamp += used_capacity - storedinfo += "\[[time2text(used_capacity*10,"mm:ss")]\] [text]" - - -//shows up on the printed transcript as (Unrecognized sound) -/obj/item/magnetic_tape/proc/record_noise(text) - timestamp += used_capacity - storedinfo += "*\[[time2text(used_capacity*10,"mm:ss")]\] [text]" - - -/obj/item/magnetic_tape/attackby(obj/item/I, mob/user, params) - if(user.incapacitated()) // TODO: this may not be necessary since OnClick checks before starting the attack chain - return TRUE - if(ruined && IS_SCREWDRIVER(I)) - if(!max_capacity) - to_chat(user, "There is no tape left inside.") - return TRUE - to_chat(user, "You start winding the tape back in...") - if(do_after(user, 120, target = src)) - to_chat(user, "You wound the tape back in.") - fix() - return TRUE - else if(IS_PEN(I)) - if(loc == user) - var/new_name = input(user, "What would you like to label the tape?", "Tape labeling") as null|text - if(isnull(new_name)) return TRUE - new_name = sanitize_safe(new_name) - if(new_name) - SetName("tape - '[new_name]'") - to_chat(user, "You label the tape '[new_name]'.") - else - SetName("tape") - to_chat(user, "You scratch off the label.") - return TRUE - else if(IS_WIRECUTTER(I)) - cut(user) - return TRUE - else if(istype(I, /obj/item/magnetic_tape/loose)) - join(user, I) - return TRUE - return ..() - -/obj/item/magnetic_tape/proc/cut(mob/user) - if(!LAZYLEN(timestamp)) - to_chat(user, "There's nothing on this tape!") - return - var/list/output = list("
") - for(var/i=1, i < timestamp.len, i++) - var/time = "\[[time2text(timestamp[i]*10,"mm:ss")]\]" - output += "[time]
-----CUT------
" - output += "
" - - var/datum/browser/popup = new(user, "tape_cutting", "Cutting tape", 170, 600) - popup.set_content(jointext(output,null)) - popup.open() - -/obj/item/magnetic_tape/proc/join(mob/user, obj/item/magnetic_tape/other) - if(max_capacity + other.max_capacity > initial(max_capacity)) - to_chat(user, "You can't fit this much tape in!") - return - if(user.try_unequip(other)) - to_chat(user, "You join ends of the tape together.") - max_capacity += other.max_capacity - used_capacity = min(used_capacity + other.used_capacity, max_capacity) - timestamp += other.timestamp - storedinfo += other.storedinfo - doctored = 1 - ruin() - update_icon() - qdel(other) - -/obj/item/magnetic_tape/OnTopic(var/mob/user, var/list/href_list) - if(href_list["cut_after"]) - var/index = text2num(href_list["cut_after"]) - if(index >= timestamp.len) - return - - to_chat(user, "You remove part of the tape off.") - get_loose_tape(user, index) - cut(user) - return TOPIC_REFRESH - -//Spawns new loose tape item, with data starting from [index] entry -/obj/item/magnetic_tape/proc/get_loose_tape(var/mob/user, var/index) - var/obj/item/magnetic_tape/loose/newtape = new() - newtape.timestamp = timestamp.Copy(index+1) - newtape.storedinfo = storedinfo.Copy(index+1) - newtape.max_capacity = max_capacity - index - newtape.used_capacity = max(0, used_capacity - max_capacity) - newtape.doctored = doctored - user.put_in_hands(newtape) - - timestamp.Cut(index+1) - storedinfo.Cut(index+1) - max_capacity = index - used_capacity = min(used_capacity,index) - -//Random colour tapes -/obj/item/magnetic_tape/random/Initialize() - icon = pick(list( - 'icons/obj/items/device/tape_recorder/tape_casette_white.dmi', - 'icons/obj/items/device/tape_recorder/tape_casette_blue.dmi', - 'icons/obj/items/device/tape_recorder/tape_casette_red.dmi', - 'icons/obj/items/device/tape_recorder/tape_casette_yellow.dmi', - 'icons/obj/items/device/tape_recorder/tape_casette_purple.dmi' - )) - . = ..() - -/obj/item/magnetic_tape/loose - name = "magnetic tape" - desc = "Quantum-enriched self-repairing nanotape, used for magnetic storage of information." - icon = 'icons/obj/items/device/tape_recorder/tape_casette_loose.dmi' - ruined = TRUE - draw_ribbon_if_ruined = FALSE - -/obj/item/magnetic_tape/loose/fix() - return - -/obj/item/magnetic_tape/loose/get_loose_tape() - return - -/obj/item/magnetic_tape/loose/get_examine_strings(mob/user, distance, infix, suffix) - . = ..() - if(distance <= 1) - . += SPAN_NOTICE("It looks long enough to hold [max_capacity] seconds worth of recording.") - if(doctored && user.skill_check(SKILL_FORENSICS, SKILL_PROF)) - . += SPAN_WARNING("It has been tampered with...") diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 2f2506b6aa05..40f7cc830eff 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -28,21 +28,21 @@ attacher_ref = null return ..() -/obj/item/transfer_valve/attackby(obj/item/item, mob/user) +/obj/item/transfer_valve/attackby(obj/item/used_item, mob/user) var/turf/location = get_turf(src) // For admin logs - if(istype(item, /obj/item/tank)) + if(istype(used_item, /obj/item/tank)) var/T1_weight = 0 var/T2_weight = 0 if(tank_one && tank_two) to_chat(user, "There are already two tanks attached, remove one first.") return TRUE - if(!user.try_unequip(item, src)) + if(!user.try_unequip(used_item, src)) return TRUE if(!tank_one) - tank_one = item + tank_one = used_item else - tank_two = item + tank_two = used_item message_admins("[key_name_admin(user)] attached both tanks to a transfer valve. (JMP)") log_game("[key_name_admin(user)] attached both tanks to a transfer valve.") to_chat(user, "You attach the tank to the transfer valve.") @@ -54,24 +54,24 @@ src.w_class = max(initial(src.w_class),T1_weight,T2_weight) //gets w_class of biggest object, because you shouldn't be able to just shove tanks in and have them be tiny. . = TRUE //TODO: Have this take an assemblyholder - else if(isassembly(item)) - var/obj/item/assembly/A = item + else if(isassembly(used_item)) + var/obj/item/assembly/A = used_item if(A.secured) to_chat(user, "The device is secured.") return TRUE if(attached_device) to_chat(user, "There is already an device attached to the valve, remove it first.") return TRUE - if(!user.try_unequip(item, src)) + if(!user.try_unequip(used_item, src)) return TRUE attached_device = A - to_chat(user, "You attach \the [item] to the valve controls and secure it.") + to_chat(user, "You attach \the [used_item] to the valve controls and secure it.") A.holder = src A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb). - global.bombers += "[key_name(user)] attached a [item] to a transfer valve." - message_admins("[key_name_admin(user)] attached a [item] to a transfer valve. (JMP)") - log_game("[key_name_admin(user)] attached a [item] to a transfer valve.") + global.bombers += "[key_name(user)] attached a [used_item] to a transfer valve." + message_admins("[key_name_admin(user)] attached a [used_item] to a transfer valve. (JMP)") + log_game("[key_name_admin(user)] attached a [used_item] to a transfer valve.") attacher_ref = weakref(user) . = TRUE if(.) diff --git a/code/game/objects/items/devices/tvcamera.dm b/code/game/objects/items/devices/tvcamera.dm index 914286faa0f3..4450994afe0c 100644 --- a/code/game/objects/items/devices/tvcamera.dm +++ b/code/game/objects/items/devices/tvcamera.dm @@ -97,12 +97,13 @@ /* Assembly by a roboticist */ // TODO: Make this slapcrafting or remove tvcamera/tvassembly entirely -/obj/item/robot_parts/head/attackby(var/obj/item/assembly/S, mob/user) - if (!istype(S, /obj/item/assembly/infra)) +/obj/item/robot_parts/head/attackby(obj/item/used_item, mob/user) + var/obj/item/assembly/infra/assembly = used_item + if(!istype(assembly)) return ..() - var/obj/item/TVAssembly/A = new(user) - qdel(S) - user.put_in_hands(A) + var/obj/item/TVAssembly/tv_assembly = new(user) + qdel(assembly) + user.put_in_hands(tv_assembly) to_chat(user, "You add the infrared sensor to the robot head.") qdel(src) return TRUE @@ -120,25 +121,25 @@ Using robohead because of restricting to roboticist */ material = /decl/material/solid/metal/steel // TODO: refactor this to use slapcrafting? remove entirely? -/obj/item/TVAssembly/attackby(var/obj/item/W, var/mob/user) +/obj/item/TVAssembly/attackby(var/obj/item/used_item, var/mob/user) switch(buildstep) if(0) - if(istype(W, /obj/item/robot_parts/robot_component/camera)) + if(istype(used_item, /obj/item/robot_parts/robot_component/camera)) to_chat(user, "You add the camera module to [src]") - qdel(W) + qdel(used_item) desc = "This TV camera assembly has a camera module." buildstep++ return TRUE if(1) - if(istype(W, /obj/item/taperecorder)) - qdel(W) + if(istype(used_item, /obj/item/taperecorder)) + qdel(used_item) buildstep++ to_chat(user, "You add the tape recorder to [src]") desc = "This TV camera assembly has a camera and audio module." return TRUE if(2) - if(IS_COIL(W)) - var/obj/item/stack/cable_coil/C = W + if(IS_COIL(used_item)) + var/obj/item/stack/cable_coil/C = used_item if(!C.use(3)) to_chat(user, "You need three cable coils to wire the devices.") return TRUE @@ -147,14 +148,14 @@ Using robohead because of restricting to roboticist */ desc = "This TV camera assembly has wires sticking out." return TRUE if(3) - if(IS_WIRECUTTER(W)) + if(IS_WIRECUTTER(used_item)) to_chat(user, " You trim the wires.") buildstep++ desc = "This TV camera assembly needs casing." return TRUE if(4) - if(istype(W, /obj/item/stack/material)) - var/obj/item/stack/material/S = W + if(istype(used_item, /obj/item/stack/material)) + var/obj/item/stack/material/S = used_item if(S.material?.type == /decl/material/solid/metal/steel && S.use(1)) buildstep++ to_chat(user, "You encase the assembly.") diff --git a/code/game/objects/items/devices/uplink.dm b/code/game/objects/items/devices/uplink.dm index 02f4eb078b7c..2d54bf5b1bfa 100644 --- a/code/game/objects/items/devices/uplink.dm +++ b/code/game/objects/items/devices/uplink.dm @@ -50,13 +50,11 @@ update_nano_data() src.uplink_owner = owner - world_uplinks += src uses = telecrystals START_PROCESSING(SSobj, src) /obj/item/uplink/Destroy() uplink_owner = null - world_uplinks -= src STOP_PROCESSING(SSobj, src) return ..() @@ -152,6 +150,7 @@ // The purchasing code. /obj/item/uplink/OnTopic(user, href_list) + var/decl/uplink/uplink = IMPLIED_DECL if(href_list["buy_item"]) var/datum/uplink_item/UI = (locate(href_list["buy_item"]) in uplink.items) UI.buy(src, usr) @@ -175,6 +174,7 @@ update_nano_data() /obj/item/uplink/proc/update_nano_data() + var/decl/uplink/uplink = IMPLIED_DECL if(nanoui_menu == 0) var/categories[0] for(var/datum/uplink_category/category in uplink.categories) diff --git a/code/game/objects/items/devices/uplink_random_lists.dm b/code/game/objects/items/devices/uplink_random_lists.dm index b0acc8d88f6a..bd97ea3283ee 100644 --- a/code/game/objects/items/devices/uplink_random_lists.dm +++ b/code/game/objects/items/devices/uplink_random_lists.dm @@ -4,7 +4,7 @@ var/reselect_probability // Probability that we'll decide to keep this item if previously selected. // Is done together with the keep_probability check. Being selected more than once does not affect this probability. -/datum/uplink_random_item/New(var/uplink_item, var/keep_probability = 100, var/reselect_propbability = 33) +/datum/uplink_random_item/New(var/uplink_item, var/keep_probability = 100, var/reselect_probability = 33) ..() src.uplink_item = uplink_item src.keep_probability = keep_probability @@ -19,19 +19,20 @@ /datum/uplink_random_selection/proc/get_random_item(var/telecrystals, obj/item/uplink/U, var/list/bought_items) var/const/attempts = 50 + var/decl/uplink/uplink = IMPLIED_DECL for(var/i = 0; i < attempts; i++) - var/datum/uplink_random_item/RI = pick(items) - if(!prob(RI.keep_probability)) + var/datum/uplink_random_item/random_item = pick(items) + if(!prob(random_item.keep_probability)) continue - var/datum/uplink_item/I = uplink.items_assoc[RI.uplink_item] - if(I.cost(telecrystals, U) > telecrystals) + var/datum/uplink_item/uplink_item = uplink.items_assoc[random_item.uplink_item] + if(uplink_item.cost(telecrystals, uplink) > telecrystals) continue - if(bought_items && (I in bought_items) && !prob(RI.reselect_probability)) + if(bought_items && (uplink_item in bought_items) && !prob(random_item.reselect_probability)) continue - if(U && !I.can_buy(U)) + if(uplink && !uplink_item.can_buy(uplink)) continue - return I + return uplink_item return uplink.items_assoc[/datum/uplink_item/item/stealthy_weapons/soap] var/global/list/uplink_random_selections_ @@ -47,7 +48,6 @@ var/global/list/uplink_random_selections_ items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/silenced) items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/revolver) - items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/heavysniper, 15, 0) items += new/datum/uplink_random_item(/datum/uplink_item/item/grenades/emp, 50) items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/crossbow, 33) items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/energy_sword, 75) @@ -63,7 +63,7 @@ var/global/list/uplink_random_selections_ items += new/datum/uplink_random_item(/datum/uplink_item/item/stealth_items/chameleon_projector) items += new/datum/uplink_random_item(/datum/uplink_item/item/stealth_items/voice) - items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/toolbox, reselect_propbability = 10) + items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/toolbox, reselect_probability = 10) items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/plastique) items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/encryptionkey_radio) items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/encryptionkey_binary) @@ -74,27 +74,25 @@ var/global/list/uplink_random_selections_ items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/heavy_armor) items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/powersink, 10, 10) items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/ai_module, 25, 0) - items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/teleporter, 10, 0) items += new/datum/uplink_random_item(/datum/uplink_item/item/implants/imp_freedom) items += new/datum/uplink_random_item(/datum/uplink_item/item/implants/imp_compress) items += new/datum/uplink_random_item(/datum/uplink_item/item/implants/imp_explosive) - items += new/datum/uplink_random_item(/datum/uplink_item/item/medical/sinpockets, reselect_propbability = 20) - items += new/datum/uplink_random_item(/datum/uplink_item/item/medical/surgery, reselect_propbability = 10) - items += new/datum/uplink_random_item(/datum/uplink_item/item/medical/combat, reselect_propbability = 10) + items += new/datum/uplink_random_item(/datum/uplink_item/item/medical/sinpockets, reselect_probability = 20) + items += new/datum/uplink_random_item(/datum/uplink_item/item/medical/surgery, reselect_probability = 10) + items += new/datum/uplink_random_item(/datum/uplink_item/item/medical/combat, reselect_probability = 10) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/energy_net, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/ewar_voice, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/maneuvering_jets, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/egun, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/power_sink, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/laser_canon, reselect_propbability = 5) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_probability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/energy_net, reselect_probability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/ewar_voice, reselect_probability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/maneuvering_jets, reselect_probability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/egun, reselect_probability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/power_sink, reselect_probability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_propbability = 15) - items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_propbability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_probability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_probability = 15) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/thermal, reselect_probability = 15) items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/suit_sensor_mobile) items += new/datum/uplink_random_item(/datum/uplink_item/item/services/suit_sensor_shutdown, 75, 0) @@ -105,7 +103,6 @@ var/global/list/uplink_random_selections_ /datum/uplink_item/item/ammo, /datum/uplink_item/item/badassery, /datum/uplink_item/item/telecrystal, - /datum/uplink_item/item/tools/teleporter, /datum/uplink_item/item/tools/supply_beacon, /datum/uplink_item/item/implants/imp_uplink, ) @@ -121,16 +118,17 @@ var/global/list/uplink_random_selections_ var/new_thing = new/datum/uplink_random_item(uplink_item_type) items += new_thing -/datum/uplink_random_selection/blacklist/get_random_item(var/telecrystals, obj/item/uplink/U, var/list/bought_items) +/datum/uplink_random_selection/blacklist/get_random_item(var/telecrystals, obj/item/uplink/uplink_access, var/list/bought_items) var/const/attempts = 50 + var/decl/uplink/uplink = IMPLIED_DECL for(var/i = 0; i < attempts; i++) - var/datum/uplink_random_item/RI = pick(items) - if(!prob(RI.keep_probability)) + var/datum/uplink_random_item/random_item = pick(items) + if(!prob(random_item.keep_probability)) continue - var/datum/uplink_item/I = uplink.items_assoc[RI.uplink_item] - if(I.cost(telecrystals, U) > telecrystals) + var/datum/uplink_item/uplink_item = uplink.items_assoc[random_item.uplink_item] + if(uplink_item.cost(telecrystals, uplink_access) > telecrystals) continue - if(bought_items && (I in bought_items) && !prob(RI.reselect_probability)) + if(bought_items && (uplink_item in bought_items) && !prob(random_item.reselect_probability)) continue - return I + return uplink_item return uplink.items_assoc[/datum/uplink_item/item/stealthy_weapons/soap] diff --git a/code/game/objects/items/fleece.dm b/code/game/objects/items/fleece.dm index c787e1b21679..b6f7a4cc2807 100644 --- a/code/game/objects/items/fleece.dm +++ b/code/game/objects/items/fleece.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/items/fleece.dmi' icon_state = ICON_STATE_WORLD w_class = ITEM_SIZE_HUGE // an entire fleece is quite large in terms of volume - attack_verb = list("slapped") + attack_verb = "slapped" hitsound = 'sound/weapons/towelwhip.ogg' material = /decl/material/solid/organic/cloth/wool material_alteration = MAT_FLAG_ALTERATION_COLOR diff --git a/code/game/objects/items/glassjar.dm b/code/game/objects/items/glassjar.dm index 22e99321baa3..6c6a654fb2fc 100644 --- a/code/game/objects/items/glassjar.dm +++ b/code/game/objects/items/glassjar.dm @@ -71,15 +71,15 @@ update_icon() return -/obj/item/glass_jar/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/cash)) +/obj/item/glass_jar/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/cash)) if(contains == 0) contains = 1 if(contains != 1) return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - var/obj/item/cash/S = W + var/obj/item/cash/S = used_item user.visible_message("[user] puts \the [S] into \the [src].") update_icon() return TRUE diff --git a/code/game/objects/items/horseshoe.dm b/code/game/objects/items/horseshoe.dm index 089d3c9cc4bf..622dfaf99721 100644 --- a/code/game/objects/items/horseshoe.dm +++ b/code/game/objects/items/horseshoe.dm @@ -5,4 +5,11 @@ icon_state = ICON_STATE_WORLD icon = 'icons/obj/items/horseshoe.dmi' material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color material_alteration = MAT_FLAG_ALTERATION_ALL + +/// A horseshoe hung above a door. +/obj/item/horseshoe/hung + anchored = TRUE + randpixel = 0 + layer = ABOVE_HUMAN_LAYER \ No newline at end of file diff --git a/code/game/objects/items/latexballoon.dm b/code/game/objects/items/latexballoon.dm index 6066fbeaedef..cf070a49deef 100644 --- a/code/game/objects/items/latexballoon.dm +++ b/code/game/objects/items/latexballoon.dm @@ -43,8 +43,8 @@ burst() return ..() -/obj/item/latexballon/attackby(obj/item/W, mob/user) - if (W.can_puncture()) +/obj/item/latexballon/attackby(obj/item/used_item, mob/user) + if (used_item.can_puncture()) burst() return TRUE return FALSE diff --git a/code/game/objects/items/paintkit.dm b/code/game/objects/items/paintkit.dm index 9e99fdea07d2..5d8602efb267 100644 --- a/code/game/objects/items/paintkit.dm +++ b/code/game/objects/items/paintkit.dm @@ -38,10 +38,10 @@ desc = "A kit for modifying a voidsuit." uses = 2 -/obj/item/clothing/head/helmet/space/void/attackby(var/obj/item/O, var/mob/user) +/obj/item/clothing/head/helmet/space/void/attackby(var/obj/item/used_item, var/mob/user) - if(istype(O,/obj/item/kit/suit)) - var/obj/item/kit/suit/kit = O + if(istype(used_item,/obj/item/kit/suit)) + var/obj/item/kit/suit/kit = used_item to_chat(user, SPAN_NOTICE("You set about modifying \the [src] into \a [kit.new_name] void helmet.")) SetName("[kit.new_name] void helmet") desc = kit.new_desc @@ -53,10 +53,10 @@ return ..() -/obj/item/clothing/suit/space/void/attackby(var/obj/item/O, var/mob/user) +/obj/item/clothing/suit/space/void/attackby(var/obj/item/used_item, var/mob/user) - if(istype(O, /obj/item/kit/suit)) - var/obj/item/kit/suit/kit = O + if(istype(used_item, /obj/item/kit/suit)) + var/obj/item/kit/suit/kit = used_item to_chat(user, SPAN_NOTICE("You set about modifying \the [src] into \a [kit.new_name] voidsuit.")) SetName("[kit.new_name] voidsuit") desc = kit.new_desc diff --git a/code/game/objects/items/passport.dm b/code/game/objects/items/passport.dm index 55032ba5ba8b..48ce254e834e 100644 --- a/code/game/objects/items/passport.dm +++ b/code/game/objects/items/passport.dm @@ -5,7 +5,7 @@ _base_attack_force = 1 gender = PLURAL w_class = ITEM_SIZE_SMALL - attack_verb = list("whipped") + attack_verb = "whipped" hitsound = 'sound/weapons/towelwhip.ogg' desc = "A set of identifying documents." material = /decl/material/solid/organic/paper diff --git a/code/game/objects/items/plunger.dm b/code/game/objects/items/plunger.dm index 711aec009b05..29558d974c81 100644 --- a/code/game/objects/items/plunger.dm +++ b/code/game/objects/items/plunger.dm @@ -3,7 +3,7 @@ desc = "This is possibly the least sanitary object around." icon = 'icons/obj/items/plunger.dmi' icon_state = ICON_STATE_WORLD - attack_verb = list("plunged") + attack_verb = "plunged" _base_attack_force = 1 w_class = ITEM_SIZE_NORMAL slot_flags = SLOT_HEAD | SLOT_FACE diff --git a/code/game/objects/items/rescuebag.dm b/code/game/objects/items/rescuebag.dm index 4ae13e1cd418..df7b9225027f 100644 --- a/code/game/objects/items/rescuebag.dm +++ b/code/game/objects/items/rescuebag.dm @@ -8,6 +8,7 @@ origin_tech = @'{"biotech":2}' material = /decl/material/solid/organic/plastic matter = list(/decl/material/solid/silicon = MATTER_AMOUNT_SECONDARY) + bag_type = /obj/structure/closet/body_bag/rescue var/obj/item/tank/airtank /obj/item/bodybag/rescue/loaded @@ -23,25 +24,24 @@ QDEL_NULL(airtank) return ..() -/obj/item/bodybag/rescue/attack_self(mob/user) - var/obj/structure/closet/body_bag/rescue/R = new /obj/structure/closet/body_bag/rescue(user.loc) - R.add_fingerprint(user) - if(airtank) - R.set_tank(airtank) +/obj/item/bodybag/rescue/create_bag_structure(mob/user) + var/obj/structure/closet/body_bag/rescue/bag = ..() + if(istype(bag) && airtank) + bag.set_tank(airtank) airtank = null - qdel(src) + return bag -/obj/item/bodybag/rescue/attackby(obj/item/W, mob/user, var/click_params) - if(istype(W,/obj/item/tank)) +/obj/item/bodybag/rescue/attackby(obj/item/used_item, mob/user, var/click_params) + if(istype(used_item,/obj/item/tank)) if(airtank) to_chat(user, "\The [src] already has an air tank installed.") return TRUE - if(user.try_unequip(W)) - W.forceMove(src) - airtank = W - to_chat(user, "You install \the [W] in \the [src].") + if(user.try_unequip(used_item)) + used_item.forceMove(src) + airtank = used_item + to_chat(user, "You install \the [used_item] in \the [src].") return TRUE - else if(airtank && IS_SCREWDRIVER(W)) + else if(airtank && IS_SCREWDRIVER(used_item)) to_chat(user, "You remove \the [airtank] from \the [src].") airtank.dropInto(loc) airtank = null @@ -88,15 +88,15 @@ if(airtank) add_overlay("tank") -/obj/structure/closet/body_bag/rescue/attackby(obj/item/W, mob/user, var/click_params) - if(istype(W,/obj/item/tank)) +/obj/structure/closet/body_bag/rescue/attackby(obj/item/used_item, mob/user, var/click_params) + if(istype(used_item,/obj/item/tank)) if(airtank) to_chat(user, "\The [src] already has an air tank installed.") - else if(user.try_unequip(W, src)) - set_tank(W) - to_chat(user, "You install \the [W] in \the [src].") + else if(user.try_unequip(used_item, src)) + set_tank(used_item) + to_chat(user, "You install \the [used_item] in \the [src].") return TRUE - else if(airtank && IS_SCREWDRIVER(W)) + else if(airtank && IS_SCREWDRIVER(used_item)) to_chat(user, "You remove \the [airtank] from \the [src].") airtank.dropInto(loc) airtank = null diff --git a/code/game/objects/items/robot/robot_frame.dm b/code/game/objects/items/robot/robot_frame.dm index 24f7474aa6e1..2759cbc834e3 100644 --- a/code/game/objects/items/robot/robot_frame.dm +++ b/code/game/objects/items/robot/robot_frame.dm @@ -32,10 +32,10 @@ SSstatistics.add_field("cyborg_frames_built",1) return TRUE -/obj/item/robot_parts/robot_suit/attackby(obj/item/W, mob/user) +/obj/item/robot_parts/robot_suit/attackby(obj/item/used_item, mob/user) // Uninstall a robotic part. - if(IS_CROWBAR(W)) + if(IS_CROWBAR(used_item)) if(!parts.len) to_chat(user, SPAN_WARNING("\The [src] has no parts to remove.")) return TRUE @@ -49,40 +49,40 @@ return TRUE // Install a robotic part. - else if (istype(W, /obj/item/robot_parts)) - var/obj/item/robot_parts/part = W - if(!required_parts[part.bp_tag] || !istype(W, required_parts[part.bp_tag])) - to_chat(user, SPAN_WARNING("\The [src] is not compatible with \the [W].")) + else if (istype(used_item, /obj/item/robot_parts)) + var/obj/item/robot_parts/part = used_item + if(!required_parts[part.bp_tag] || !istype(used_item, required_parts[part.bp_tag])) + to_chat(user, SPAN_WARNING("\The [src] is not compatible with \the [used_item].")) else if(parts[part.bp_tag]) - to_chat(user, SPAN_WARNING("\The [src] already has \a [W] installed.")) - else if(part.can_install(user) && user.try_unequip(W, src)) + to_chat(user, SPAN_WARNING("\The [src] already has \a [used_item] installed.")) + else if(part.can_install(user) && user.try_unequip(used_item, src)) parts[part.bp_tag] = part update_icon() return TRUE // Install a brain. - else if(istype(W, /obj/item/organ/internal/brain_interface)) + else if(istype(used_item, /obj/item/organ/internal/brain_interface)) if(!isturf(loc)) - to_chat(user, SPAN_WARNING("You can't put \the [W] in without the frame being on the ground.")) + to_chat(user, SPAN_WARNING("You can't put \the [used_item] in without the frame being on the ground.")) return TRUE if(!check_completion()) to_chat(user, SPAN_WARNING("The frame is not ready for the central processor to be installed.")) return TRUE - var/obj/item/organ/internal/brain_interface/M = W + var/obj/item/organ/internal/brain_interface/M = used_item var/mob/living/brainmob = M?.get_brainmob() if(!brainmob) - to_chat(user, SPAN_WARNING("Sticking an empty [W.name] into the frame would sort of defeat the purpose.")) + to_chat(user, SPAN_WARNING("Sticking an empty [used_item.name] into the frame would sort of defeat the purpose.")) return TRUE if(jobban_isbanned(brainmob, ASSIGNMENT_ROBOT)) - to_chat(user, SPAN_WARNING("\The [W] does not seem to fit.")) + to_chat(user, SPAN_WARNING("\The [used_item] does not seem to fit.")) return TRUE if(brainmob.stat == DEAD) - to_chat(user, SPAN_WARNING("Sticking a dead [W.name] into the frame would sort of defeat the purpose.")) + to_chat(user, SPAN_WARNING("Sticking a dead [used_item.name] into the frame would sort of defeat the purpose.")) return TRUE var/ghost_can_reenter = 0 @@ -95,10 +95,10 @@ else ghost_can_reenter = 1 if(!ghost_can_reenter) - to_chat(user, SPAN_WARNING("\The [W] is completely unresponsive; there's no point.")) + to_chat(user, SPAN_WARNING("\The [used_item] is completely unresponsive; there's no point.")) return TRUE - if(!user.try_unequip(W)) + if(!user.try_unequip(used_item)) return TRUE SSstatistics.add_field("cyborg_frames_built",1) @@ -106,7 +106,7 @@ if(!O) return TRUE - O.central_processor = W + O.central_processor = used_item O.set_invisibility(INVISIBILITY_NONE) O.custom_name = created_name O.updatename("Default") @@ -120,7 +120,7 @@ var/obj/item/robot_parts/chest/chest = parts[BP_CHEST] chest.cell.forceMove(O) - W.forceMove(O) //Should fix cybros run time erroring when blown up. It got deleted before, along with the frame. + used_item.forceMove(O) //Should fix cybros run time erroring when blown up. It got deleted before, along with the frame. // Since we "magically" installed a cell, we also have to update the correct component. if(O.cell) @@ -134,7 +134,7 @@ qdel(src) return TRUE - else if(IS_PEN(W)) + else if(IS_PEN(used_item)) var/t = sanitize_safe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN) if(t && (in_range(src, user) || loc == user)) created_name = t diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 16d7f1eddcd5..cbe87ec2d299 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -7,15 +7,15 @@ ***********************************************************************/ /obj/item/borg/overdrive name = "overdrive" - icon = 'icons/obj/decals.dmi' + icon = 'icons/obj/signs/warnings.dmi' icon_state = "shock" /********************************************************************** HUD/SIGHT things ***********************************************************************/ /obj/item/borg/sight - icon = 'icons/obj/decals.dmi' - icon_state = "securearea" + icon = 'icons/obj/signs/warnings.dmi' + icon_state = "secureareaold" var/sight_mode = null var/glasses_hud_type diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 3e99d2da0c52..3fde339bc303 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -22,12 +22,12 @@ if(!ispath(model, /decl/bodytype/prosthetic)) model = /decl/bodytype/prosthetic/basic_human model_info = model - var/decl/bodytype/prosthetic/R = GET_DECL(model) - if(R) - SetName("[R.name] [initial(name)]") - desc = "[R.desc]" - if(icon_state in icon_states(R.icon_base)) - icon = R.icon_base + var/decl/bodytype/prosthetic/robot_model = GET_DECL(model) + if(robot_model) + SetName("[robot_model.name] [initial(name)]") + desc = "[robot_model.desc]" + if(icon_state in icon_states(robot_model.icon_base)) + icon = robot_model.icon_base else SetDefaultName() @@ -106,54 +106,54 @@ success = FALSE return success && ..() -/obj/item/robot_parts/chest/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/cell)) +/obj/item/robot_parts/chest/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/cell)) if(src.cell) to_chat(user, "You have already inserted a cell!") else - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - src.cell = W + src.cell = used_item to_chat(user, "You insert the cell!") return TRUE - if(IS_COIL(W)) + if(IS_COIL(used_item)) if(src.wires) to_chat(user, "You have already inserted wire!") else - var/obj/item/stack/cable_coil/coil = W + var/obj/item/stack/cable_coil/coil = used_item if(coil.use(1)) src.wires = 1.0 to_chat(user, "You insert the wire!") return TRUE return ..() -/obj/item/robot_parts/head/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/flash)) +/obj/item/robot_parts/head/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/flash)) if(isrobot(user)) var/current_module = user.get_active_held_item() - if(current_module == W) + if(current_module == used_item) to_chat(user, "How do you propose to do that?") return TRUE else - add_flashes(W,user) + add_flashes(used_item,user) else - add_flashes(W,user) + add_flashes(used_item,user) return TRUE return ..() -/obj/item/robot_parts/head/proc/add_flashes(obj/item/W, mob/user) //Made into a seperate proc to avoid copypasta +/obj/item/robot_parts/head/proc/add_flashes(obj/item/used_item, mob/user) //Made into a seperate proc to avoid copypasta if(src.flash1 && src.flash2) to_chat(user, "You have already inserted the eyes!") return else if(src.flash1) - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return - src.flash2 = W + src.flash2 = used_item to_chat(user, "You insert the flash into the eye socket!") else - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return - src.flash1 = W + src.flash1 = used_item to_chat(user, "You insert the flash into the eye socket!") diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 1dd4881d7c09..7230cd94476d 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -11,8 +11,8 @@ var/locked = 0 var/require_module = 0 -/obj/item/borg/upgrade/proc/action(var/mob/living/silicon/robot/R) - if(R.stat == DEAD) +/obj/item/borg/upgrade/proc/action(var/mob/living/silicon/robot/robot) + if(robot.stat == DEAD) to_chat(usr, "\The [src] will not function on a deceased robot.") return 1 return 0 @@ -23,10 +23,10 @@ icon = 'icons/obj/modules/module_cyborg_1.dmi' require_module = 1 -/obj/item/borg/upgrade/reset/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/reset/action(var/mob/living/silicon/robot/robot) if((. = ..())) return 0 - R.reset_module() + robot.reset_module() return 1 /obj/item/borg/upgrade/uncertified @@ -36,15 +36,15 @@ require_module = 0 var/new_module = null -/obj/item/borg/upgrade/uncertified/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/uncertified/action(var/mob/living/silicon/robot/robot) if((. = ..())) return 0 if(!new_module) - to_chat(usr, "[R]'s error lights strobe repeatedly - something seems to be wrong with the chip.") + to_chat(usr, "[robot]'s error lights strobe repeatedly - something seems to be wrong with the chip.") return 0 // Suppress the alert so the AI doesn't see a reset message. - R.reset_module(TRUE) - R.pick_module(new_module) + robot.reset_module(TRUE) + robot.pick_module(new_module) return 1 /obj/item/borg/upgrade/uncertified/party @@ -72,12 +72,12 @@ /obj/item/borg/upgrade/rename/attack_self(mob/user) heldname = sanitize_safe(input(user, "Enter new robot name", "Robot Reclassification", heldname), MAX_NAME_LEN) -/obj/item/borg/upgrade/rename/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/rename/action(var/mob/living/silicon/robot/robot) if(..()) return 0 - R.notify_ai(ROBOT_NOTIFICATION_NEW_NAME, R.name, heldname) - R.SetName(heldname) - R.custom_name = heldname - R.real_name = heldname + robot.notify_ai(ROBOT_NOTIFICATION_NEW_NAME, robot.name, heldname) + robot.SetName(heldname) + robot.custom_name = heldname + robot.real_name = heldname return 1 @@ -86,16 +86,16 @@ desc = "Used to boost cyborg's light intensity." icon = 'icons/obj/modules/module_cyborg_1.dmi' -/obj/item/borg/upgrade/floodlight/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/floodlight/action(var/mob/living/silicon/robot/robot) if(..()) return 0 - if(R.intenselight) + if(robot.intenselight) to_chat(usr, "This cyborg's light was already upgraded.") return 0 else - R.intenselight = 1 - R.update_robot_light() - to_chat(R, "Lighting systems upgrade detected.") + robot.intenselight = 1 + robot.update_robot_light() + to_chat(robot, "Lighting systems upgrade detected.") return 1 /obj/item/borg/upgrade/restart @@ -105,19 +105,19 @@ material = /decl/material/solid/metal/steel matter = list(/decl/material/solid/fiberglass = MATTER_AMOUNT_REINFORCEMENT) -/obj/item/borg/upgrade/restart/action(var/mob/living/silicon/robot/R) - if(R.current_health < 0) +/obj/item/borg/upgrade/restart/action(var/mob/living/silicon/robot/robot) + if(robot.current_health < 0) to_chat(usr, "You have to repair the robot before using this module!") return 0 - if(!R.key) + if(!robot.key) for(var/mob/observer/ghost/ghost in global.player_list) - if(ghost.mind && ghost.mind.current == R) - R.key = ghost.key + if(ghost.mind && ghost.mind.current == robot) + robot.key = ghost.key - R.set_stat(CONSCIOUS) - R.switch_from_dead_to_living_mob_list() - R.notify_ai(ROBOT_NOTIFICATION_NEW_UNIT) + robot.set_stat(CONSCIOUS) + robot.switch_from_dead_to_living_mob_list() + robot.notify_ai(ROBOT_NOTIFICATION_NEW_UNIT) return 1 @@ -132,14 +132,14 @@ /decl/material/solid/metal/gold = MATTER_AMOUNT_TRACE ) -/obj/item/borg/upgrade/vtec/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/vtec/action(var/mob/living/silicon/robot/robot) if(..()) return FALSE - if(R.vtec == TRUE) + if(robot.vtec == TRUE) return FALSE - R.speed-- - R.vtec = TRUE + robot.speed-- + robot.vtec = TRUE return TRUE @@ -156,23 +156,23 @@ ) origin_tech = @'{"materials":2,"engineering":3,"programming":3,"powerstorage":2,"combat":2}' -/obj/item/borg/upgrade/weaponcooler/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/weaponcooler/action(var/mob/living/silicon/robot/robot) if(..()) return 0 - if(!R.module || !(type in R.module.supported_upgrades)) - to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!") + if(!robot.module || !(type in robot.module.supported_upgrades)) + to_chat(robot, "Upgrade mounting error! No suitable hardpoint detected!") to_chat(usr, "There's no mounting point for the module!") return 0 - var/obj/item/gun/energy/gun/secure/mounted/T = locate() in R.module + var/obj/item/gun/energy/gun/secure/mounted/T = locate() in robot.module if(!T) - T = locate() in R.module.equipment + T = locate() in robot.module.equipment if(!T) to_chat(usr, "This robot has had its energy gun removed!") return 0 if(T.recharge_time <= 2) - to_chat(R, "Maximum cooling achieved for this hardpoint!") + to_chat(robot, "Maximum cooling achieved for this hardpoint!") to_chat(usr, "There's no room for another cooling unit!") return 0 @@ -193,18 +193,18 @@ ) origin_tech = @'{"materials":2,"engineering":3,"programming":3,"magnets":3}' -/obj/item/borg/upgrade/jetpack/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/jetpack/action(var/mob/living/silicon/robot/robot) if(..()) return 0 - if(!R.module || !(type in R.module.supported_upgrades)) - to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!") + if(!robot.module || !(type in robot.module.supported_upgrades)) + to_chat(robot, "Upgrade mounting error! No suitable hardpoint detected!") to_chat(usr, "There's no mounting point for the module!") return 0 else - R.module.equipment += new/obj/item/tank/jetpack/carbondioxide - for(var/obj/item/tank/jetpack/carbondioxide in R.module.equipment) - R.set_internals(src) - //R.icon_state="Miner+j" + robot.module.equipment += new/obj/item/tank/jetpack/carbondioxide + for(var/obj/item/tank/jetpack/carbondioxide in robot.module.equipment) + robot.set_internals(src) + //robot.icon_state="Miner+j" return 1 /obj/item/borg/upgrade/rcd @@ -219,15 +219,15 @@ ) origin_tech = @'{"materials":4,"engineering":4,"programming":3}' -/obj/item/borg/upgrade/rcd/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/rcd/action(var/mob/living/silicon/robot/robot) if(..()) return 0 - if(!R.module || !(type in R.module.supported_upgrades)) - to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!") + if(!robot.module || !(type in robot.module.supported_upgrades)) + to_chat(robot, "Upgrade mounting error! No suitable hardpoint detected!") to_chat(usr, "There's no mounting point for the module!") return 0 else - R.module.equipment += new/obj/item/rcd/borg(R.module) + robot.module.equipment += new/obj/item/rcd/borg(robot.module) return 1 /obj/item/borg/upgrade/syndicate @@ -242,11 +242,11 @@ ) origin_tech = @'{"materials":2,"engineering":2,"programming":3,"esoteric":2,"combat":2}' -/obj/item/borg/upgrade/syndicate/action(var/mob/living/silicon/robot/R) +/obj/item/borg/upgrade/syndicate/action(var/mob/living/silicon/robot/robot) if(..()) return 0 - if(R.emagged == 1) + if(robot.emagged == 1) return 0 - R.emagged = 1 + robot.emagged = 1 return 1 diff --git a/code/game/objects/items/rock.dm b/code/game/objects/items/rock.dm index 4a57b5ab4dde..ff0f5189bb5c 100644 --- a/code/game/objects/items/rock.dm +++ b/code/game/objects/items/rock.dm @@ -17,9 +17,9 @@ )) // TODO: craft a flint striker from a flint and a piece of metal -/obj/item/rock/attackby(obj/item/W, mob/user) +/obj/item/rock/attackby(obj/item/used_item, mob/user) - var/decl/material/weapon_material = W.get_striking_material() + var/decl/material/weapon_material = used_item.get_striking_material() var/decl/material/our_material = get_material() if((weapon_material?.ferrous && our_material?.type == /decl/material/solid/stone/flint) || (our_material?.ferrous && weapon_material?.type == /decl/material/solid/stone/flint)) var/turf/spark_turf = get_turf(src) diff --git a/code/game/objects/items/stacks/medical/medical_bandage.dm b/code/game/objects/items/stacks/medical/medical_bandage.dm index 23d81504abf9..cd0ca1efdc10 100644 --- a/code/game/objects/items/stacks/medical/medical_bandage.dm +++ b/code/game/objects/items/stacks/medical/medical_bandage.dm @@ -25,9 +25,8 @@ /obj/item/stack/medical/bandage/proc/get_poultice_requirement_string() . = list() - for(var/reagent in poultice_reagent_requirements) - var/decl/material/reagent_decl = GET_DECL(reagent) - . += "[poultice_reagent_requirements[reagent]] unit\s of [reagent_decl.liquid_name]" + for(var/decl/material/reagent as anything in poultice_reagent_requirements) + . += "[poultice_reagent_requirements[reagent.type]] unit\s of [reagent.liquid_name]" . = english_list(.) /obj/item/stack/medical/bandage/get_examine_strings(mob/user, distance, infix, suffix) @@ -76,7 +75,7 @@ /obj/item/stack/medical/bandage/proc/bandage_wound(mob/user, mob/target, obj/item/organ/external/affecting, datum/wound/wound) user.visible_message( SPAN_NOTICE("\The [user] bandages \a [wound.desc] on \the [target]'s [affecting.name]."), - SPAN_NOTICE("You bandage \a [wound.desc] on \the [target]'s [affecting.name].") + SPAN_NOTICE("You bandage \a [wound.desc] on \the [target]'s [affecting.name].") ) wound.bandage() diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index 405c08b1f34c..0c4581d6c17f 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -21,18 +21,18 @@ return TRUE if (isrobot(target)) //Repairing cyborgs - var/mob/living/silicon/robot/R = target - if (R.getBruteLoss() || R.getFireLoss() ) + var/mob/living/silicon/robot/robot = target + if (robot.getBruteLoss() || robot.getFireLoss() ) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - R.heal_damage(BRUTE, 15, do_update_health = FALSE) - R.heal_damage(BURN, 15) + robot.heal_damage(BRUTE, 15, do_update_health = FALSE) + robot.heal_damage(BURN, 15) use(1) user.visible_message( - SPAN_NOTICE("\The [user] applied some [name] to \the [R]'s damaged areas."), - SPAN_NOTICE("You apply some [name] to \the [R]'s damaged areas.") + SPAN_NOTICE("\The [user] applied some [name] to \the [robot]'s damaged areas."), + SPAN_NOTICE("You apply some [name] to \the [robot]'s damaged areas.") ) else - to_chat(user, SPAN_NOTICE("\The [R]'s systems are all nominal.")) + to_chat(user, SPAN_NOTICE("\The [robot]'s systems are all nominal.")) return TRUE //Repairing robolimbs diff --git a/code/game/objects/items/stacks/rods.dm b/code/game/objects/items/stacks/rods.dm index 7e244c18453f..1a8d655c9dd1 100644 --- a/code/game/objects/items/stacks/rods.dm +++ b/code/game/objects/items/stacks/rods.dm @@ -47,17 +47,17 @@ icon_state = base_state // TODO: slapcrafting recipes to replace this block. -/obj/item/stack/material/rods/attackby(obj/item/W, mob/user) +/obj/item/stack/material/rods/attackby(obj/item/used_item, mob/user) - if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item if(!can_use(2)) to_chat(user, SPAN_WARNING("You need at least two rods to do this.")) return TRUE - if(WT.weld(0,user)) - visible_message(SPAN_NOTICE("\The [src] is fused together by \the [user] with \the [WT]."), 3, SPAN_NOTICE("You hear welding."), 2) + if(welder.weld(0,user)) + visible_message(SPAN_NOTICE("\The [src] is fused together by \the [user] with \the [welder]."), 3, SPAN_NOTICE("You hear welding."), 2) for(var/obj/item/stack/material/new_item in SSmaterials.create_object((material?.type || /decl/material/solid/metal/steel), usr.loc, 1)) new_item.add_to_stacks(usr) if(user.is_holding_offhand(src)) @@ -65,8 +65,8 @@ use(2) return TRUE - if (istype(W, /obj/item/stack/tape_roll/duct_tape)) - var/obj/item/stack/tape_roll/duct_tape/T = W + if (istype(used_item, /obj/item/stack/tape_roll/duct_tape)) + var/obj/item/stack/tape_roll/duct_tape/T = used_item if(!T.can_use(4)) to_chat(user, SPAN_WARNING("You need 4 [T.plural_name] to make a splint!")) return TRUE diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index b95475cea8fe..2a48ee7fd1b5 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -165,11 +165,15 @@ popup.open() -/obj/item/stack/proc/produce_recipe(decl/stack_recipe/recipe, var/producing, var/expending, mob/user, paint_color, sublist = null) +/obj/item/stack/proc/produce_recipe(decl/stack_recipe/recipe, var/producing, var/expending, mob/user, paint_color) if(producing <= 0 || expending <= 0 || expending > get_amount()) return + if(expending > recipe.get_required_stack_amount(src, product_amount = producing)) + PRINT_STACK_TRACE("Possible HREF hacking attempt, recipe amount consumed and produced doesn't match!") + return + var/decl/material/mat = get_material() var/decl/material/reinf_mat = get_reinforced_material() if (!can_use(expending)) @@ -194,11 +198,14 @@ to_chat(user, SPAN_NOTICE("You [recipe.get_craft_verb(src)] [recipe.get_display_name(producing, mat, reinf_mat)]!")) var/list/atom/results = recipe.spawn_result(user, user.loc, producing, mat, reinf_mat, paint_color, crafting_stack_type, expending) - var/atom/movable/O = LAZYACCESS(results, 1) - if(istype(O) && !QDELETED(O)) // In case of stack merger. - O.add_fingerprint(user) - user.put_in_hands(O) - list_recipes(user, sublist) + var/was_put_in_hand = FALSE + for(var/atom/result in results) + if(QDELETED(result)) + continue + result.add_fingerprint(user) + if(isitem(result) && !was_put_in_hand) + if(user.put_in_hands(result)) + was_put_in_hand = TRUE /obj/item/stack/OnTopic(mob/user, list/href_list) . = ..() @@ -246,9 +253,10 @@ var/producing = text2num(href_list["producing"]) var/expending = text2num(href_list["expending"]) var/datum/stack_recipe_list/returning = locate(href_list["returning"]) - if(producing > 0 && expending > 0) - produce_recipe(recipe, producing, expending, user, paint_color, sublist = returning) - return TOPIC_REFRESH + if(producing > 0 && expending > 0 && expending <= recipe.get_required_stack_amount(src, product_amount = producing)) + produce_recipe(recipe, producing, expending, user, paint_color) + list_recipes(user, returning) + return TOPIC_HANDLED // Don't attempt to refresh, list_recipes should handle that already... return TOPIC_NOACTION @@ -448,9 +456,9 @@ src.interact(usr) return TRUE -/obj/item/stack/attackby(obj/item/W, mob/user) - if (istype(W, /obj/item/stack) && can_merge_stacks(W)) - var/obj/item/stack/S = W +/obj/item/stack/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/stack) && can_merge_stacks(used_item)) + var/obj/item/stack/S = used_item . = src.transfer_to(S) spawn(0) //give the stacks a chance to delete themselves if necessary diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm index 2fa50e63988a..79f64d66a684 100644 --- a/code/game/objects/items/stacks/tiles/tile_types.dm +++ b/code/game/objects/items/stacks/tiles/tile_types.dm @@ -202,6 +202,7 @@ * Carpets */ /obj/item/stack/tile/carpet + build_type = /obj/item/stack/tile/carpet name = "brown carpet" singular_name = "brown carpet" desc = "A piece of brown carpet." @@ -217,12 +218,13 @@ /obj/item/stack/tile/carpet/on_update_icon() . = ..() if(detail_color) - set_overlays(overlay_image(icon, "[icon_state]-detail", detail_color, RESET_COLOR)) + add_overlay(overlay_image(icon, "[icon_state]_detail", detail_color, RESET_COLOR)) /obj/item/stack/tile/carpet/fifty amount = 50 /obj/item/stack/tile/carpet/blue + build_type = /obj/item/stack/tile/carpet/blue name = "blue carpet" desc = "A piece of blue and gold carpet." singular_name = "blue carpet" @@ -232,6 +234,7 @@ amount = 50 /obj/item/stack/tile/carpet/blue2 + build_type = /obj/item/stack/tile/carpet/blue2 name = "pale blue carpet" desc = "A piece of blue and pale blue carpet." singular_name = "pale blue carpet" @@ -242,6 +245,7 @@ amount = 50 /obj/item/stack/tile/carpet/blue3 + build_type = /obj/item/stack/tile/carpet/blue3 name = "sea blue carpet" desc = "A piece of blue and green carpet." singular_name = "sea blue carpet" @@ -252,6 +256,7 @@ amount = 50 /obj/item/stack/tile/carpet/magenta + build_type = /obj/item/stack/tile/carpet/magenta name = "magenta carpet" desc = "A piece of magenta carpet." singular_name = "magenta carpet" @@ -262,6 +267,7 @@ amount = 50 /obj/item/stack/tile/carpet/purple + build_type = /obj/item/stack/tile/carpet/purple name = "purple carpet" desc = "A piece of purple carpet." singular_name = "purple carpet" @@ -272,6 +278,7 @@ amount = 50 /obj/item/stack/tile/carpet/orange + build_type = /obj/item/stack/tile/carpet/orange name = "orange carpet" desc = "A piece of orange carpet." singular_name = "orange carpet" @@ -282,6 +289,7 @@ amount = 50 /obj/item/stack/tile/carpet/green + build_type = /obj/item/stack/tile/carpet/green name = "green carpet" desc = "A piece of green carpet." singular_name = "green carpet" @@ -302,6 +310,7 @@ amount = 50 /obj/item/stack/tile/carpet/rustic + build_type = /obj/item/stack/tile/carpet/rustic name = "rustic carpet" desc = "A piece of simple, rustic carpeting." singular_name = "rustic carpet" diff --git a/code/game/objects/items/stools.dm b/code/game/objects/items/stools.dm index 31c54d503a53..528ff6abad1e 100644 --- a/code/game/objects/items/stools.dm +++ b/code/game/objects/items/stools.dm @@ -96,8 +96,8 @@ padding_extension?.remove_padding(do_icon_update = FALSE) qdel(src) -/obj/item/stool/attackby(obj/item/W, mob/user) - if(IS_WRENCH(W)) +/obj/item/stool/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item)) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) dismantle() return TRUE diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index d16e6c230f38..ce927361ee62 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -7,7 +7,7 @@ w_class = ITEM_SIZE_TINY material = /decl/material/solid/metal/steel center_of_mass = @'{"x":16,"y":7}' - attack_verb = list("stabbed") + attack_verb = "stabbed" lock_picking_level = 5 sharp = TRUE material_alteration = MAT_FLAG_ALTERATION_COLOR diff --git a/code/game/objects/items/tools/shears.dm b/code/game/objects/items/tools/shears.dm index b5958ab00254..47ff4cf48b7a 100644 --- a/code/game/objects/items/tools/shears.dm +++ b/code/game/objects/items/tools/shears.dm @@ -6,6 +6,7 @@ w_class = ITEM_SIZE_SMALL origin_tech = @'{"materials":1,"engineering":1}' material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color center_of_mass = @'{"x":18,"y":10}' attack_verb = list("sheared", "cut") sharp = TRUE diff --git a/code/game/objects/items/tools/wrench.dm b/code/game/objects/items/tools/wrench.dm index c117895cea1b..ea8c1ac9e68a 100644 --- a/code/game/objects/items/tools/wrench.dm +++ b/code/game/objects/items/tools/wrench.dm @@ -60,5 +60,5 @@ /obj/item/wrench/pipe/afterattack(atom/A, mob/user, proximity) . = ..() if(proximity && istype(A,/obj/structure/window) && is_held_twohanded()) - var/obj/structure/window/W = A - W.shatter() + var/obj/structure/window/window = A + window.shatter() diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 15e634163ec3..76255a19f118 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -66,10 +66,9 @@ return w_class = (reagents?.total_volume > 0)? ITEM_SIZE_SMALL : ITEM_SIZE_TINY //#TODO: Maybe acids should handle eating their own containers themselves? - for(var/reagent in reagents?.reagent_volumes) - var/decl/material/M = GET_DECL(reagent) - if(M.solvent_power >= MAT_SOLVENT_STRONG) - visible_message(SPAN_DANGER("\The [M] chews through \the [src]!")) + for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + if(reagent.solvent_power >= MAT_SOLVENT_STRONG) + visible_message(SPAN_DANGER("\The [reagent] chews through \the [src]!")) physically_destroyed() /obj/item/chems/water_balloon/throw_impact(atom/hit_atom, datum/thrownthing/TT) @@ -146,11 +145,11 @@ desc = "A cheap, plastic replica of an energy sword. Realistic sounds! Ages 8 and up." sharp = FALSE edge = FALSE - attack_verb = list("hit") + attack_verb = "hit" material = /decl/material/solid/organic/plastic active_hitsound = 'sound/weapons/genhit.ogg' active_descriptor = "extended" - active_attack_verb = list("hit") + active_attack_verb = "hit" active_edge = FALSE active_sharp = FALSE _active_base_attack_force = 1 diff --git a/code/game/objects/items/weapons/AI_modules.dm b/code/game/objects/items/weapons/AI_modules.dm index edaf4f9a0e5c..efc2e1ac52de 100644 --- a/code/game/objects/items/weapons/AI_modules.dm +++ b/code/game/objects/items/weapons/AI_modules.dm @@ -64,9 +64,9 @@ AI MODULES if(!istype(ai)) return //We don't have slaves if we are not an AI - for(var/mob/living/silicon/robot/R in ai.connected_robots) - to_chat(R, "These are your laws now:") - R.show_laws() + for(var/mob/living/silicon/robot/robot in ai.connected_robots) + to_chat(robot, "These are your laws now:") + robot.show_laws() /obj/item/aiModule/proc/log_law_changes(mob/living/silicon/target, mob/sender) var/time = time2text(world.realtime,"hh:mm:ss") diff --git a/code/game/objects/items/weapons/RCD.dm b/code/game/objects/items/weapons/RCD.dm index 88fd20ce3f67..2d17c5eef94c 100644 --- a/code/game/objects/items/weapons/RCD.dm +++ b/code/game/objects/items/weapons/RCD.dm @@ -46,19 +46,19 @@ . += "The current mode is '[work_mode]'." . += "It currently holds [stored_matter]/[max_stored_matter] matter-units." -/obj/item/rcd/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/rcd_ammo)) - var/obj/item/rcd_ammo/cartridge = W +/obj/item/rcd/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/rcd_ammo)) + var/obj/item/rcd_ammo/cartridge = used_item if((stored_matter + cartridge.remaining) > max_stored_matter) to_chat(user, "The RCD can't hold that many additional matter-units.") return TRUE stored_matter += cartridge.remaining - qdel(W) + qdel(used_item) playsound(src.loc, 'sound/machines/click.ogg', 50, 1) to_chat(user, "The RCD now holds [stored_matter]/[max_stored_matter] matter-units.") update_icon() return TRUE - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) crafting = !crafting if(!crafting) to_chat(user, SPAN_NOTICE("You reassemble the RCD.")) @@ -150,11 +150,11 @@ /obj/item/rcd/borg/useResource(var/amount, var/mob/user) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - if(R.cell) + var/mob/living/silicon/robot/robot = user + if(robot.cell) var/cost = amount*30 - if(R.cell.charge >= cost) - R.cell.use(cost) + if(robot.cell.charge >= cost) + robot.cell.use(cost) return 1 return 0 diff --git a/code/game/objects/items/weapons/RPD.dm b/code/game/objects/items/weapons/RPD.dm index 6a4725991050..91262b470c90 100644 --- a/code/game/objects/items/weapons/RPD.dm +++ b/code/game/objects/items/weapons/RPD.dm @@ -146,7 +146,7 @@ var/global/list/rpd_pipe_selection_skilled = list() return playsound(get_turf(user), 'sound/items/Deconstruct.ogg', 50, 1) - P.build(T, new/datum/fabricator_build_order(P, 1, list("slected_color" = pipe_colors[pipe_color]))) + P.build(T, new/datum/fabricator_build_order(P, 1, list("selected_color" = pipe_colors[pipe_color]))) if(prob(20)) spark_at(src, amount = 5, holder = src) @@ -162,17 +162,17 @@ var/global/list/rpd_pipe_selection_skilled = list() interact(user) add_fingerprint(user) -/obj/item/rpd/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/pipe)) - if(!user.try_unequip(W)) +/obj/item/rpd/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/pipe)) + if(!user.try_unequip(used_item)) return TRUE - recycle(W,user) + recycle(used_item,user) return TRUE return ..() -/obj/item/rpd/proc/recycle(var/obj/item/W,var/mob/user) +/obj/item/rpd/proc/recycle(var/obj/item/used_item,var/mob/user) if(!user.skill_check(SKILL_ATMOS,SKILL_BASIC)) - user.visible_message("\The [user] struggles with \the [src] as they futilely jam \the [W] against it.") + user.visible_message("\The [user] struggles with \the [src] as they futilely jam \the [used_item] against it.") return playsound(src.loc, 'sound/effects/pop.ogg', 50, 1) - qdel(W) \ No newline at end of file + qdel(used_item) \ No newline at end of file diff --git a/code/game/objects/items/weapons/RSF.dm b/code/game/objects/items/weapons/RSF.dm index 19fd6dc47b10..977b8c1909c3 100644 --- a/code/game/objects/items/weapons/RSF.dm +++ b/code/game/objects/items/weapons/RSF.dm @@ -27,12 +27,12 @@ RSF if(distance <= 1) . += "It currently holds [stored_matter]/30 fabrication-units." -/obj/item/rsf/attackby(obj/item/W, mob/user) - if (istype(W, /obj/item/rcd_ammo)) +/obj/item/rsf/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/rcd_ammo)) if ((stored_matter + 10) > 30) to_chat(user, "The RSF can't hold any more matter.") return TRUE - qdel(W) + qdel(used_item) stored_matter += 10 playsound(src.loc, 'sound/machines/click.ogg', 10, 1) to_chat(user, "The RSF now holds [stored_matter]/30 fabrication-units.") @@ -67,8 +67,8 @@ RSF if(!proximity) return if(isrobot(user)) - var/mob/living/silicon/robot/R = user - if(R.stat || !R.cell || R.cell.charge <= 0) + var/mob/living/silicon/robot/robot = user + if(robot.stat || !robot.cell || robot.cell.charge <= 0) return else if(stored_matter <= 0) @@ -106,9 +106,9 @@ RSF product.dropInto(A.loc) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - if(R.cell) - R.cell.use(used_energy) + var/mob/living/silicon/robot/robot = user + if(robot.cell) + robot.cell.use(used_energy) else stored_matter-- to_chat(user, "The RSF now holds [stored_matter]/30 fabrication-units.") diff --git a/code/game/objects/items/weapons/autopsy.dm b/code/game/objects/items/weapons/autopsy.dm index e7e5cb527e9b..b71582135b02 100644 --- a/code/game/objects/items/weapons/autopsy.dm +++ b/code/game/objects/items/weapons/autopsy.dm @@ -35,9 +35,8 @@ return add_autopsy_data(S) - for(var/T in M.chem_doses) - var/decl/material/R = T - chemtraces |= initial(R.name) + for(var/decl/material/reagent as anything in M._chem_doses) + chemtraces |= reagent.use_name else if(istype(A, /obj/item/organ/external)) set_target(A, user) @@ -52,13 +51,13 @@ return for(var/V in O.autopsy_data) - var/datum/autopsy_data/W = O.autopsy_data[V] + var/datum/autopsy_data/wound_data = O.autopsy_data[V] if(weapon_data[V]) var/datum/autopsy_data/data = weapon_data[V]["data"] - data.merge_with(W) + data.merge_with(wound_data) weapon_data[V]["organs"] |= O.name else - weapon_data[V] = list("data" = W.copy(), "organs" = list(O.name)) + weapon_data[V] = list("data" = wound_data.copy(), "organs" = list(O.name)) /obj/item/scanner/autopsy/proc/get_formatted_data() var/list/scan_data = list("Subject: [target_name]") @@ -66,11 +65,11 @@ if(timeofdeath) scan_data += "Time of death: [worldtime2stationtime(timeofdeath)]
" - var/n = 1 + var/weapon_count = 1 for(var/weapon in weapon_data) var/list/organs = weapon_data[weapon]["organs"] var/datum/autopsy_data/data = weapon_data[weapon]["data"] - scan_data += "Weapon #[n++]: [data.weapon]" + scan_data += "Weapon #[weapon_count++]: [data.weapon]" if(data.hits) var/damage_desc switch(data.damage) @@ -111,12 +110,12 @@ var/time_inflicted = 0 /datum/autopsy_data/proc/copy() - var/datum/autopsy_data/W = new() - W.weapon = weapon - W.damage = damage - W.hits = hits - W.time_inflicted = time_inflicted - return W + var/datum/autopsy_data/wound_data = new() + wound_data.weapon = weapon + wound_data.damage = damage + wound_data.hits = hits + wound_data.time_inflicted = time_inflicted + return wound_data /datum/autopsy_data/proc/merge_with(var/datum/autopsy_data/other) damage += other.damage diff --git a/code/game/objects/items/weapons/cane.dm b/code/game/objects/items/weapons/cane.dm index e78dcbfe9502..2fef3513ae38 100644 --- a/code/game/objects/items/weapons/cane.dm +++ b/code/game/objects/items/weapons/cane.dm @@ -61,14 +61,13 @@ return TRUE return ..() -/obj/item/cane/fancy/sword/attackby(var/obj/item/knife/folding/W, var/mob/user) - - if(!istype(concealed_blade) && istype(W) && user.try_unequip(W, src)) +/obj/item/cane/fancy/sword/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(concealed_blade) && istype(used_item, /obj/item/knife/folding) && user.try_unequip(used_item, src)) user.visible_message( - SPAN_NOTICE("\The [user] has sheathed \a [W] into \the [src]."), - SPAN_NOTICE("You sheathe \the [W] into \the [src].") + SPAN_NOTICE("\The [user] has sheathed \a [used_item] into \the [src]."), + SPAN_NOTICE("You sheathe \the [used_item] into \the [src].") ) - concealed_blade = W + concealed_blade = used_item update_icon() user.update_inhand_overlays() return TRUE diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 37ebe84e2db5..2dadd2bbf4d5 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -35,8 +35,8 @@ else . += "It has a blank space for a signature." -/obj/item/card/union/attackby(var/obj/item/thing, var/mob/user) - if(IS_PEN(thing)) +/obj/item/card/union/attackby(var/obj/item/used_item, var/mob/user) + if(IS_PEN(used_item)) if(signed_by) to_chat(user, SPAN_WARNING("\The [src] has already been signed.")) else @@ -63,9 +63,9 @@ . = ..() add_overlay(overlay_image(icon, "[icon_state]-color", detail_color)) -/obj/item/card/data/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/integrated_electronics/detailer)) - var/obj/item/integrated_electronics/detailer/D = I +/obj/item/card/data/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/integrated_electronics/detailer)) + var/obj/item/integrated_electronics/detailer/D = used_item detail_color = D.detail_color update_icon() return ..() diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index c6ba8afe150d..18245dfe7fbd 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -24,7 +24,7 @@ w_class = ITEM_SIZE_SMALL throw_speed = 3 throw_range = 15 - attack_verb = list("HONKED") + attack_verb = "HONKED" material = /decl/material/solid/metal/steel matter = list( /decl/material/solid/organic/plastic = MATTER_AMOUNT_SECONDARY diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 8fb5342ed6e6..828d94861e61 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -69,23 +69,23 @@ return TRUE // TODO: This should really use the cell extension -/obj/item/defibrillator/attackby(obj/item/W, mob/user, params) - if(W == paddles) +/obj/item/defibrillator/attackby(obj/item/used_item, mob/user, params) + if(used_item == paddles) reattach_paddles(user) return TRUE - else if(istype(W, /obj/item/cell)) + else if(istype(used_item, /obj/item/cell)) if(bcell) to_chat(user, "\The [src] already has a cell.") else - if(!user.try_unequip(W)) + if(!user.try_unequip(used_item)) return TRUE - W.forceMove(src) - bcell = W + used_item.forceMove(src) + bcell = used_item to_chat(user, "You install a cell in \the [src].") update_icon() return TRUE - else if(IS_SCREWDRIVER(W)) + else if(IS_SCREWDRIVER(used_item)) if(bcell) bcell.update_icon() bcell.dropInto(loc) @@ -365,8 +365,8 @@ H.resuscitate() var/obj/item/organ/internal/cell/potato = H.get_organ(BP_CELL, /obj/item/organ/internal/cell) if(potato && potato.cell) - var/obj/item/cell/C = potato.cell - C.give(chargecost) + var/obj/item/cell/cell = potato.cell + cell.give(chargecost) ADJ_STATUS(H, STAT_ASLEEP, -60) log_and_message_admins("used \a [src] to revive [key_name(H)].") @@ -471,14 +471,14 @@ cooldowntime = (3 SECONDS) /obj/item/shockpaddles/robot/check_charge(var/charge_amt) - if(isrobot(src.loc)) - var/mob/living/silicon/robot/R = src.loc - return (R.cell && R.cell.check_charge(charge_amt)) + if(isrobot(loc)) + var/mob/living/silicon/robot/robot = loc + return robot.cell?.check_charge(charge_amt) /obj/item/shockpaddles/robot/checked_use(var/charge_amt) - if(isrobot(src.loc)) - var/mob/living/silicon/robot/R = src.loc - return (R.cell && R.cell.checked_use(charge_amt)) + if(isrobot(loc)) + var/mob/living/silicon/robot/robot = loc + return robot.cell?.checked_use(charge_amt) /obj/item/shockpaddles/rig name = "mounted defibrillator" @@ -490,19 +490,19 @@ wielded = 1 /obj/item/shockpaddles/rig/check_charge(var/charge_amt) - if(istype(src.loc, /obj/item/rig_module/device/defib)) - var/obj/item/rig_module/device/defib/module = src.loc + if(istype(loc, /obj/item/rig_module/device/defib)) + var/obj/item/rig_module/device/defib/module = loc return (module.holder && module.holder.cell && module.holder.cell.check_charge(charge_amt)) /obj/item/shockpaddles/rig/checked_use(var/charge_amt) - if(istype(src.loc, /obj/item/rig_module/device/defib)) - var/obj/item/rig_module/device/defib/module = src.loc + if(istype(loc, /obj/item/rig_module/device/defib)) + var/obj/item/rig_module/device/defib/module = loc return (module.holder && module.holder.cell && module.holder.cell.checked_use(charge_amt)) /obj/item/shockpaddles/rig/set_cooldown(var/delay) ..() - if(istype(src.loc, /obj/item/rig_module/device/defib)) - var/obj/item/rig_module/device/defib/module = src.loc + if(istype(loc, /obj/item/rig_module/device/defib)) + var/obj/item/rig_module/device/defib/module = loc module.next_use = world.time + delay /* Shockpaddles that are linked to a base unit diff --git a/code/game/objects/items/weapons/dice.dm b/code/game/objects/items/weapons/dice.dm index f67a1791c48d..374f19e6ccb2 100644 --- a/code/game/objects/items/weapons/dice.dm +++ b/code/game/objects/items/weapons/dice.dm @@ -5,7 +5,7 @@ icon_state = "d66" w_class = ITEM_SIZE_TINY var/sides = 6 - attack_verb = list("diced") + attack_verb = "diced" material = /decl/material/solid/organic/plastic /obj/item/dice/Initialize() @@ -77,7 +77,7 @@ /obj/item/dice/d100 name = "d100" desc = "A die with ten sides. This one is for the tens digit." - icon_state = "d10010" + icon_state = "d1001" sides = 10 /obj/item/dice/d100/roll_die() diff --git a/code/game/objects/items/weapons/ecigs.dm b/code/game/objects/items/weapons/ecigs.dm index 55789ad967b9..353404026db9 100644 --- a/code/game/objects/items/weapons/ecigs.dm +++ b/code/game/objects/items/weapons/ecigs.dm @@ -131,14 +131,14 @@ M.update_equipment_overlay(slot_wear_mask_str, redraw_mob = FALSE) M.update_inhand_overlays() -/obj/item/clothing/mask/smokable/ecig/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/chems/ecig_cartridge)) +/obj/item/clothing/mask/smokable/ecig/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/chems/ecig_cartridge)) if (ec_cartridge)//can't add second one to_chat(user, SPAN_NOTICE("A cartridge has already been installed.")) - else if(user.try_unequip(I, src))//fits in new one - ec_cartridge = I + else if(user.try_unequip(used_item, src))//fits in new one + ec_cartridge = used_item update_icon() - to_chat(user, SPAN_NOTICE("You insert \the [I] into \the [src].")) + to_chat(user, SPAN_NOTICE("You insert \the [used_item] into \the [src].")) return TRUE return ..() diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index 289c8d6fcd57..296e348430d4 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -28,12 +28,12 @@ wires = null return ..() -/obj/item/plastique/attackby(var/obj/item/I, var/mob/user) - if(IS_SCREWDRIVER(I)) +/obj/item/plastique/attackby(var/obj/item/used_item, var/mob/user) + if(IS_SCREWDRIVER(used_item)) open_panel = !open_panel to_chat(user, "You [open_panel ? "open" : "close"] the wire panel.") return TRUE - else if(IS_WIRECUTTER(I) || IS_MULTITOOL(I) || istype(I, /obj/item/assembly/signaler )) + else if(IS_WIRECUTTER(used_item) || IS_MULTITOOL(used_item) || istype(used_item, /obj/item/assembly/signaler )) return wires.Interact(user) else return ..() diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index 99b4cb049def..f50b680ff129 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -106,11 +106,11 @@ /obj/item/flamethrower/isflamesource() return lit -/obj/item/flamethrower/attackby(obj/item/W, mob/user) +/obj/item/flamethrower/attackby(obj/item/used_item, mob/user) if(user.incapacitated()) return TRUE - if(IS_WRENCH(W) && !secured)//Taking this apart + if(IS_WRENCH(used_item) && !secured)//Taking this apart var/turf/T = get_turf(src) if(welding_tool) welding_tool.dropInto(T) @@ -128,14 +128,14 @@ qdel(src) return TRUE - if(IS_SCREWDRIVER(W) && igniter && !lit) + if(IS_SCREWDRIVER(used_item) && igniter && !lit) secured = !secured to_chat(user, SPAN_NOTICE("\The [igniter] is now [secured ? "secured" : "unsecured"]!")) update_icon() return TRUE - if(isigniter(W)) - var/obj/item/assembly/igniter/I = W + if(isigniter(used_item)) + var/obj/item/assembly/igniter/I = used_item if(I.secured) to_chat(user, SPAN_WARNING("\The [I] is not ready to attach yet! Use a screwdriver on it first.")) return TRUE @@ -149,23 +149,23 @@ update_icon() return TRUE - if(istype(W, /obj/item/tank)) + if(istype(used_item, /obj/item/tank)) if(tank) to_chat(user, SPAN_WARNING("There appears to already be a tank loaded in \the [src]!")) return TRUE - user.drop_from_inventory(W, src) - tank = W + user.drop_from_inventory(used_item, src) + tank = used_item update_icon() return TRUE - if(istype(W, /obj/item/scanner/gas)) - var/obj/item/scanner/gas/A = W + if(istype(used_item, /obj/item/scanner/gas)) + var/obj/item/scanner/gas/A = used_item A.analyze_gases(src, user) return TRUE - if(W.isflamesource()) // you can light it with external input, even without an igniter + if(used_item.isflamesource()) // you can light it with external input, even without an igniter attempt_lighting(user, TRUE) update_icon() return TRUE diff --git a/code/game/objects/items/weapons/gift_wrappaper.dm b/code/game/objects/items/weapons/gift_wrappaper.dm index 62f1c7e3fe4a..331c51c130ee 100644 --- a/code/game/objects/items/weapons/gift_wrappaper.dm +++ b/code/game/objects/items/weapons/gift_wrappaper.dm @@ -35,8 +35,8 @@ return to_chat(user, "You can't move.") -/obj/effect/spresent/attackby(obj/item/W, mob/user) - if(!IS_WIRECUTTER(W)) +/obj/effect/spresent/attackby(obj/item/used_item, mob/user) + if(!IS_WIRECUTTER(used_item)) to_chat(user, "I need wirecutters for that.") return TRUE diff --git a/code/game/objects/items/weapons/grenades/chem_grenade.dm b/code/game/objects/items/weapons/grenades/chem_grenade.dm index be47c0d7390d..060c4864e227 100644 --- a/code/game/objects/items/weapons/grenades/chem_grenade.dm +++ b/code/game/objects/items/weapons/grenades/chem_grenade.dm @@ -48,9 +48,9 @@ if(path == 1) add_overlay("[icon_state]-locked") -/obj/item/grenade/chem_grenade/attackby(obj/item/W, mob/user) - if(istype(W,/obj/item/assembly_holder) && (!stage || stage==1) && path != 2) - var/obj/item/assembly_holder/det = W +/obj/item/grenade/chem_grenade/attackby(obj/item/used_item, mob/user) + if(istype(used_item,/obj/item/assembly_holder) && (!stage || stage==1) && path != 2) + var/obj/item/assembly_holder/det = used_item if(istype(det.a_left,det.a_right.type) || (!isigniter(det.a_left) && !isigniter(det.a_right))) to_chat(user, "Assembly must contain one igniter.") return TRUE @@ -60,8 +60,8 @@ if(!user.try_unequip(det, src)) return TRUE path = 1 - log_and_message_admins("has attached \a [W] to \the [src].") - to_chat(user, "You add [W] to the metal casing.") + log_and_message_admins("has attached \a [used_item] to \the [src].") + to_chat(user, "You add [used_item] to the metal casing.") playsound(src.loc, 'sound/items/Screwdriver2.ogg', 25, -3) detonator = det if(istimer(detonator.a_left)) @@ -73,7 +73,7 @@ SetName("unsecured grenade with [beakers.len] containers[detonator?" and detonator":""]") stage = 1 . = TRUE - else if(IS_SCREWDRIVER(W) && path != 2) + else if(IS_SCREWDRIVER(used_item) && path != 2) if(stage == 1) path = 1 if(beakers.len) @@ -97,22 +97,22 @@ stage = 1 active = FALSE . = TRUE - else if(is_type_in_list(W, allowed_containers) && (!stage || stage==1) && path != 2) + else if(is_type_in_list(used_item, allowed_containers) && (!stage || stage==1) && path != 2) path = 1 if(beakers.len == 2) to_chat(user, "The grenade can not hold more containers.") return TRUE else - if(W.reagents.total_volume) - if(!user.try_unequip(W, src)) + if(used_item.reagents.total_volume) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, "You add \the [W] to the assembly.") - beakers += W + to_chat(user, "You add \the [used_item] to the assembly.") + beakers += used_item stage = 1 SetName("unsecured grenade with [beakers.len] containers[detonator?" and detonator":""]") . = TRUE else - to_chat(user, "\The [W] is empty.") + to_chat(user, "\The [used_item] is empty.") return TRUE if(.) update_icon() diff --git a/code/game/objects/items/weapons/grenades/flashbang.dm b/code/game/objects/items/weapons/grenades/flashbang.dm index 138a3b7df34c..ef1232a46a31 100644 --- a/code/game/objects/items/weapons/grenades/flashbang.dm +++ b/code/game/objects/items/weapons/grenades/flashbang.dm @@ -7,25 +7,22 @@ /obj/item/grenade/flashbang/detonate() ..() + var/turf/our_turf = get_turf(src) + on_detonate(our_turf) + new /obj/effect/sparks(our_turf) + new /obj/effect/effect/smoke/illumination(our_turf, 5, 30, 1, "#ffffff") + qdel(src) + +/obj/item/grenade/flashbang/proc/on_detonate(turf/our_turf) var/list/victims = list() var/list/objs = list() - var/turf/T = get_turf(src) - get_listeners_in_range(T, 7, victims, objs) - for(var/mob/living/M in victims) - bang(T, M) - - FOR_DVIEW(var/obj/effect/blob/B, 7, T, INVISIBILITY_MAXIMUM) //Blob damage here - var/damage = round(30/(get_dist(B,T)+1)) - B.take_damage(damage, BURN) - END_FOR_DVIEW - - new /obj/effect/sparks(loc) - new /obj/effect/effect/smoke/illumination(loc, 5, 30, 1, "#ffffff") - qdel(src) + get_listeners_in_range(our_turf, 7, victims, objs) + for(var/mob/living/victim in victims) + bang(our_turf, victim) // Added a new proc called 'bang' that takes a location and a person to be banged. // Called during the loop that bangs people in lockers/containers and when banging -// people in normal view. Could theroetically be called during other explosions. +// people in normal view. Could theoretically be called during other explosions. // -- Polymorph /obj/item/grenade/flashbang/proc/bang(var/turf/T , var/mob/living/M) to_chat(M, SPAN_DANGER("BANG")) diff --git a/code/game/objects/items/weapons/grenades/grenade.dm b/code/game/objects/items/weapons/grenades/grenade.dm index 29b99d979ac2..42ef0fe712ed 100644 --- a/code/game/objects/items/weapons/grenades/grenade.dm +++ b/code/game/objects/items/weapons/grenades/grenade.dm @@ -81,8 +81,8 @@ if(T) T.hotspot_expose(700,125) -/obj/item/grenade/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/grenade/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) switch(det_time) if (1) det_time = 10 diff --git a/code/game/objects/items/weapons/grenades/smokebomb.dm b/code/game/objects/items/weapons/grenades/smokebomb.dm index 1347194837ec..2ba6f0b26f7d 100644 --- a/code/game/objects/items/weapons/grenades/smokebomb.dm +++ b/code/game/objects/items/weapons/grenades/smokebomb.dm @@ -18,10 +18,6 @@ smoke.attach(src) smoke.set_up(10, 0, get_turf(src)) START_PROCESSING(SSobj, src) - for(var/obj/effect/blob/B in view(8,src)) - var/damage = round(30/(get_dist(B,src)+1)) - B.current_health -= damage - B.update_icon() QDEL_IN(src, 8 SECONDS) /obj/item/grenade/smokebomb/Process() diff --git a/code/game/objects/items/weapons/locator.dm b/code/game/objects/items/weapons/locator.dm index a6ad7b1def9d..01fe0fcc8c02 100644 --- a/code/game/objects/items/weapons/locator.dm +++ b/code/game/objects/items/weapons/locator.dm @@ -51,11 +51,11 @@ Frequency: if (sr) src.temp += "Located Beacons:
" - for(var/obj/item/radio/beacon/W in global.radio_beacons) - if(!W.functioning) + for(var/obj/item/radio/beacon/radio in global.radio_beacons) + if(!radio.functioning) continue - if (W.frequency == src.frequency) - var/turf/tr = get_turf(W) + if (radio.frequency == src.frequency) + var/turf/tr = get_turf(radio) if (tr.z == sr.z && tr) var/direct = max(abs(tr.x - sr.x), abs(tr.y - sr.y)) if (direct < 5) @@ -68,19 +68,19 @@ Frequency: direct = "weak" else direct = "very weak" - src.temp += "[W.code]-[dir2text(get_dir(sr, tr))]-[direct]
" + src.temp += "[radio.code]-[dir2text(get_dir(sr, tr))]-[direct]
" src.temp += "Extranneous Signals:
" - for (var/obj/item/implant/tracking/W in global.tracking_implants) - if (!W.implanted || !(istype(W.loc,/obj/item/organ/external) || ismob(W.loc))) + for (var/obj/item/implant/tracking/implant in global.tracking_implants) + if (!implant.implanted || !(istype(implant.loc,/obj/item/organ/external) || ismob(implant.loc))) continue else - var/mob/M = W.loc + var/mob/M = implant.loc if (M.stat == DEAD) if (M.timeofdeath + 6000 < world.time) continue - var/turf/tr = get_turf(W) + var/turf/tr = get_turf(implant) if (tr.z == sr.z && tr) var/direct = max(abs(tr.x - sr.x), abs(tr.y - sr.y)) if (direct < 20) @@ -91,7 +91,7 @@ Frequency: direct = "strong" else direct = "weak" - src.temp += "[W.id]-[dir2text(get_dir(sr, tr))]-[direct]
" + src.temp += "[implant.id]-[dir2text(get_dir(sr, tr))]-[direct]
" src.temp += "You are at \[[sr.x],[sr.y],[sr.z]\] in orbital coordinates.

Refresh
" else diff --git a/code/game/objects/items/weapons/material/ashtray.dm b/code/game/objects/items/weapons/material/ashtray.dm index babc46c5ba58..305f721f1730 100644 --- a/code/game/objects/items/weapons/material/ashtray.dm +++ b/code/game/objects/items/weapons/material/ashtray.dm @@ -22,23 +22,23 @@ else if (contents.len >= max_butts/2) add_overlay("ashtray_half") -/obj/item/ashtray/attackby(obj/item/W, mob/user) - if (istype(W,/obj/item/trash/cigbutt) || istype(W,/obj/item/clothing/mask/smokable/cigarette) || istype(W, /obj/item/flame/match)) +/obj/item/ashtray/attackby(obj/item/used_item, mob/user) + if (istype(used_item,/obj/item/trash/cigbutt) || istype(used_item,/obj/item/clothing/mask/smokable/cigarette) || istype(used_item, /obj/item/flame/match)) if (contents.len >= max_butts) to_chat(user, "\The [src] is full.") return TRUE - if (istype(W,/obj/item/clothing/mask/smokable/cigarette)) - var/obj/item/clothing/mask/smokable/cigarette/cig = W + if (istype(used_item,/obj/item/clothing/mask/smokable/cigarette)) + var/obj/item/clothing/mask/smokable/cigarette/cig = used_item if (cig.lit == 1) visible_message(SPAN_NOTICE("\The [user] crushes \the [cig] in \the [src], putting it out.")) - W = cig.extinguish_fire(no_message = TRUE) + used_item = cig.extinguish_fire(no_message = TRUE) else if (cig.lit == 0) to_chat(user, SPAN_NOTICE("You place \the [cig] in \the [src] without even smoking it. Why would you do that?")) else - visible_message(SPAN_NOTICE("\The [user] places \the [W] in \the [src].")) + visible_message(SPAN_NOTICE("\The [user] places \the [used_item] in \the [src].")) - if(user.try_unequip(W, src)) + if(user.try_unequip(used_item, src)) set_extension(src, /datum/extension/scent/ashtray) update_icon() return TRUE diff --git a/code/game/objects/items/weapons/material/folding.dm b/code/game/objects/items/weapons/material/folding.dm index 5d298afbd27b..e5bcd0486741 100644 --- a/code/game/objects/items/weapons/material/folding.dm +++ b/code/game/objects/items/weapons/material/folding.dm @@ -27,13 +27,12 @@ add_fingerprint(user) /obj/item/knife/folding/update_attack_force() - ..() + . = ..() if(open) set_edge(TRUE) set_sharp(TRUE) w_class = ITEM_SIZE_NORMAL attack_verb = list("slashed", "stabbed") - ..() else set_edge(initial(edge)) set_sharp(initial(sharp)) @@ -58,7 +57,7 @@ valid_handle_colors = list(WOOD_COLOR_GENERIC, WOOD_COLOR_RICH, WOOD_COLOR_BLACK, WOOD_COLOR_CHOCOLATE, WOOD_COLOR_PALE) /obj/item/knife/folding/wood/get_striking_material(mob/user, atom/target) - . = open ? ..() : GET_DECL(/decl/material/solid/organic/wood) // todo: different handle colors -> different material + . = open ? ..() : GET_DECL(/decl/material/solid/organic/wood/oak) // todo: different handle colors -> different material /obj/item/knife/folding/tacticool name = "folding knife" diff --git a/code/game/objects/items/weapons/material/kitchen.dm b/code/game/objects/items/weapons/material/kitchen.dm index b33cef4f1c83..344eb317abbf 100644 --- a/code/game/objects/items/weapons/material/kitchen.dm +++ b/code/game/objects/items/weapons/material/kitchen.dm @@ -1,23 +1,25 @@ -/obj/item/kitchen - icon = 'icons/obj/kitchen.dmi' - material = /decl/material/solid/metal/aluminium - material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME - /* * Rolling Pins */ -/obj/item/kitchen/rollingpin +/obj/item/rollingpin name = "rolling pin" desc = "Used to knock out the Bartender." - icon_state = "rolling_pin" + icon_state = ICON_STATE_WORLD + icon = 'icons/obj/items/rolling_pin.dmi' attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "whacked") material = /decl/material/solid/organic/wood/oak + material_alteration = MAT_FLAG_ALTERATION_ALL + color = /decl/material/solid/organic/wood/oak::color -/obj/item/kitchen/rollingpin/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) +/obj/item/rollingpin/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) if (user.has_genetic_condition(GENE_COND_CLUMSY) && prob(50) && user.try_unequip(src)) to_chat(user, SPAN_DANGER("\The [src] slips out of your hand and hits your head.")) user.take_organ_damage(10) SET_STATUS_MAX(user, STAT_PARA, 2) return TRUE return ..() + +/obj/item/kitchen/rollingpin/walnut + material = /decl/material/solid/organic/wood/walnut + color = /decl/material/solid/organic/wood/walnut::color \ No newline at end of file diff --git a/code/game/objects/items/weapons/material/shards.dm b/code/game/objects/items/weapons/material/shards.dm index cd4ddfb14100..12b2e317060c 100644 --- a/code/game/objects/items/weapons/material/shards.dm +++ b/code/game/objects/items/weapons/material/shards.dm @@ -56,14 +56,14 @@ if(has_handle) add_overlay(overlay_image(icon, "handle", has_handle, RESET_COLOR)) -/obj/item/shard/attackby(obj/item/W, mob/user) - if(IS_WELDER(W) && material.shard_can_repair) - var/obj/item/weldingtool/WT = W - if(WT.weld(0, user)) +/obj/item/shard/attackby(obj/item/used_item, mob/user) + if(IS_WELDER(used_item) && material.shard_can_repair) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0, user)) material.create_object(get_turf(src)) qdel(src) return TRUE - if(istype(W, /obj/item/stack/cable_coil)) + if(istype(used_item, /obj/item/stack/cable_coil)) if(!material || (material.shard_name in list(SHARD_SPLINTER, SHARD_SHRAPNEL))) to_chat(user, SPAN_WARNING("\The [src] is not suitable for using as a shank.")) @@ -71,7 +71,7 @@ if(has_handle) to_chat(user, SPAN_WARNING("\The [src] already has a handle.")) return TRUE - var/obj/item/stack/cable_coil/cable = W + var/obj/item/stack/cable_coil/cable = used_item if(cable.use(3)) to_chat(user, SPAN_NOTICE("You wind some cable around the thick end of \the [src].")) has_handle = cable.color diff --git a/code/game/objects/items/weapons/material/stick.dm b/code/game/objects/items/weapons/material/stick.dm index d752ca73f46d..92faaca3265f 100644 --- a/code/game/objects/items/weapons/material/stick.dm +++ b/code/game/objects/items/weapons/material/stick.dm @@ -5,6 +5,7 @@ icon_state = ICON_STATE_WORLD w_class = ITEM_SIZE_NORMAL material = /decl/material/solid/organic/wood/oak + color = /decl/material/solid/organic/wood/oak::color attack_verb = list("poked", "jabbed") material_alteration = MAT_FLAG_ALTERATION_ALL lock_picking_level = 3 @@ -14,22 +15,22 @@ user.visible_message("\The [user] snaps [src].", "You snap [src].") shatter(0) -/obj/item/stick/attackby(obj/item/W, mob/user) +/obj/item/stick/attackby(obj/item/used_item, mob/user) - if(W.is_sharp() && W.has_edge() && !sharp) - user.visible_message("[user] sharpens [src] with [W].", "You sharpen [src] using [W].") + if(used_item.is_sharp() && used_item.has_edge() && !sharp) + user.visible_message("[user] sharpens [src] with [used_item].", "You sharpen [src] using [used_item].") set_sharp(TRUE) SetName("sharpened " + name) update_attack_force() return TRUE - if(!sharp && (istype(W, /obj/item/stack/material/bolt) || istype(W, /obj/item/stack/material/bundle))) + if(!sharp && (istype(used_item, /obj/item/stack/material/bolt) || istype(used_item, /obj/item/stack/material/bundle))) var/choice = input(user, "Do you want to make a torch, or a splint?", "Stick Crafting") as null|anything in list("Torch", "Splint") - if(!choice || QDELETED(user) || user.get_active_held_item() != W || QDELETED(W) || !QDELETED(src) || (loc != user && !Adjacent(user)) || sharp) + if(!choice || QDELETED(user) || user.get_active_held_item() != used_item || QDELETED(used_item) || !QDELETED(src) || (loc != user && !Adjacent(user)) || sharp) return TRUE - var/obj/item/stack/material/cloth = W + var/obj/item/stack/material/cloth = used_item var/atom/product_type var/cloth_cost @@ -43,7 +44,7 @@ return TRUE if(cloth.get_amount() < cloth_cost) - to_chat(user, SPAN_WARNING("You need at least [cloth_cost] unit\s of material to create \a [initial(product_type.name)].")) + to_chat(user, SPAN_WARNING("You need at least [cloth_cost] unit\s of material to create \a [atom_info_repository.get_name_for(product_type)].")) return TRUE // Ugly way to check for dried grass vs regular grass. @@ -53,7 +54,7 @@ var/was_held = (loc == user) cloth.use(cloth_cost) if(!was_held || user.try_unequip(src)) - var/obj/item/thing = new product_type(get_turf(src), material?.type, W.material?.type) + var/obj/item/thing = new product_type(get_turf(src), material?.type, used_item.material?.type) if(was_held) user.put_in_hands(thing) to_chat(user, SPAN_NOTICE("You fashion \the [src] into \a [thing].")) @@ -74,3 +75,7 @@ user.do_attack_animation(target) return TRUE return ..() + +/obj/item/stick/walnut + material = /decl/material/solid/organic/wood/walnut + color = /decl/material/solid/organic/wood/walnut::color \ No newline at end of file diff --git a/code/game/objects/items/weapons/material/swiss.dm b/code/game/objects/items/weapons/material/swiss.dm index 5d8c473145fb..33db97ea49cd 100644 --- a/code/game/objects/items/weapons/material/swiss.dm +++ b/code/game/objects/items/weapons/material/swiss.dm @@ -94,7 +94,7 @@ . += "Its [lowertext(active_tool)] is folded out." /obj/item/knife/folding/swiss/update_attack_force() - ..() + . = ..() if(active_tool == SWISSKNF_CLOSED) w_class = initial(w_class) else diff --git a/code/game/objects/items/weapons/material/swords.dm b/code/game/objects/items/weapons/material/swords.dm index 094dd9767a23..8723695261a2 100644 --- a/code/game/objects/items/weapons/material/swords.dm +++ b/code/game/objects/items/weapons/material/swords.dm @@ -20,7 +20,7 @@ _base_attack_force = 15 var/draw_handle = TRUE -/obj/item/edge/set_edge(new_edge) +/obj/item/sword/set_edge(new_edge) . = ..() if(. && !has_edge()) attack_verb = list("attacked", "stabbed", "jabbed", "smacked", "prodded") diff --git a/code/game/objects/items/weapons/melee/baseball_bat.dm b/code/game/objects/items/weapons/melee/baseball_bat.dm index 9499208e9c84..b3f851b290c9 100644 --- a/code/game/objects/items/weapons/melee/baseball_bat.dm +++ b/code/game/objects/items/weapons/melee/baseball_bat.dm @@ -2,6 +2,7 @@ name = "bat" desc = "HOME RUN!" icon = 'icons/obj/items/weapon/bat.dmi' + icon_state = ICON_STATE_WORLD w_class = ITEM_SIZE_LARGE can_be_twohanded = TRUE pickup_sound = 'sound/foley/scrape1.ogg' diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index bfc53022ae67..58437b40dcb6 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -39,9 +39,9 @@ var/inactive_sound = 'sound/weapons/saberoff.ogg' - attack_verb = list("hit") + attack_verb = "hit" var/list/active_attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") - var/list/inactive_attack_verb = list("hit") + var/list/inactive_attack_verb = "hit" /obj/item/energy_blade/get_max_weapon_force() return _active_base_attack_force @@ -82,6 +82,9 @@ return _active_base_attack_force return _base_attack_force +/obj/item/energy_blade/pick_attack_verb() + return DEFAULTPICK(active ? active_attack_verb : inactive_attack_verb, ..()) + /obj/item/energy_blade/proc/toggle_active(var/mob/user) active = !active @@ -93,7 +96,6 @@ base_parry_chance = active_parry_chance armor_penetration = active_armour_pen hitsound = active_hitsound - attack_verb = active_attack_verb w_class = max(w_class, ITEM_SIZE_NORMAL) slot_flags &= ~SLOT_POCKET @@ -108,7 +110,6 @@ base_parry_chance = initial(base_parry_chance) armor_penetration = initial(armor_penetration) hitsound = initial(hitsound) - attack_verb = inactive_attack_verb w_class = initial(w_class) slot_flags = initial(slot_flags) diff --git a/code/game/objects/items/weapons/melee/energy_projected.dm b/code/game/objects/items/weapons/melee/energy_projected.dm index 927cff0a5f96..1009f5745438 100644 --- a/code/game/objects/items/weapons/melee/energy_projected.dm +++ b/code/game/objects/items/weapons/melee/energy_projected.dm @@ -38,7 +38,7 @@ . = ..() check_loc() -/obj/item/energy_blade/projected/on_picked_up(mob/user) +/obj/item/energy_blade/projected/on_picked_up(mob/user, atom/old_loc) . = ..() check_loc() diff --git a/code/game/objects/items/weapons/mop.dm b/code/game/objects/items/weapons/mop.dm index 87d93544aebe..2efa8c00554f 100644 --- a/code/game/objects/items/weapons/mop.dm +++ b/code/game/objects/items/weapons/mop.dm @@ -68,8 +68,8 @@ to_chat(user, SPAN_NOTICE("You have finished mopping!")) return TRUE -/obj/effect/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/mop) || istype(I, /obj/item/soap)) +/obj/effect/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/mop) || istype(used_item, /obj/item/soap)) return FALSE return ..() diff --git a/code/game/objects/items/weapons/secrets_disk.dm b/code/game/objects/items/weapons/secrets_disk.dm index afcf3d485403..70a6c4036b17 100644 --- a/code/game/objects/items/weapons/secrets_disk.dm +++ b/code/game/objects/items/weapons/secrets_disk.dm @@ -58,9 +58,9 @@ to_chat(user, "The cryptographic lock on this disk is far too complex. Your sequencer can't break the code.") return 0 -/obj/item/disk/secret_project/attackby(obj/item/W, mob/user) - if(istype(W,/obj/item/card/id)) - var/obj/item/card/id/ID = W +/obj/item/disk/secret_project/attackby(obj/item/used_item, mob/user) + if(istype(used_item,/obj/item/card/id)) + var/obj/item/card/id/ID = used_item if(check_access(ID)) locked = !locked to_chat(user, "You swipe your card and [locked ? "lock":"unlock"] the disk.") diff --git a/code/game/objects/items/weapons/shields/shield_crafting.dm b/code/game/objects/items/weapons/shields/shield_crafting.dm index 307db9bce88b..783be5a4e6e2 100644 --- a/code/game/objects/items/weapons/shields/shield_crafting.dm +++ b/code/game/objects/items/weapons/shields/shield_crafting.dm @@ -5,6 +5,7 @@ icon_state = ICON_STATE_WORLD icon = 'icons/obj/items/shield_fasteners.dmi' material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color material_alteration = MAT_FLAG_ALTERATION_ALL // TODO: single-step slapcrafting @@ -14,6 +15,7 @@ icon_state = ICON_STATE_WORLD abstract_type = /obj/item/shield_base material = /decl/material/solid/organic/wood/oak + color = /decl/material/solid/organic/wood/oak::color material_alteration = MAT_FLAG_ALTERATION_ALL var/wooden_icon var/fittings_type = /obj/item/shield_fasteners diff --git a/code/game/objects/items/weapons/shields/shield_riot.dm b/code/game/objects/items/weapons/shields/shield_riot.dm index 0cc0c9324f0a..afd8e5959e44 100644 --- a/code/game/objects/items/weapons/shields/shield_riot.dm +++ b/code/game/objects/items/weapons/shields/shield_riot.dm @@ -30,10 +30,10 @@ return 0 return base_block_chance -/obj/item/shield/riot/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/baton)) +/obj/item/shield/riot/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/baton)) if(cooldown < world.time - 25) - user.visible_message("[user] bashes [src] with [W]!") + user.visible_message("[user] bashes [src] with [used_item]!") playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1) cooldown = world.time return TRUE diff --git a/code/game/objects/items/weapons/soap.dm b/code/game/objects/items/weapons/soap.dm index 99614d0fe16e..ebb10a60b96d 100644 --- a/code/game/objects/items/weapons/soap.dm +++ b/code/game/objects/items/weapons/soap.dm @@ -54,7 +54,7 @@ update_icon() /obj/item/soap/proc/wet() - add_to_reagents(/decl/material/liquid/cleaner/soap, SOAP_CLEANER_ON_WET) + add_to_reagents(/decl/material/liquid/cleaner/soap, SOAP_CLEANER_ON_WET, phase = MAT_PHASE_LIQUID) /obj/item/soap/Crossed(atom/movable/AM) var/mob/living/victim = AM @@ -111,13 +111,13 @@ return TRUE return ..() -/obj/item/soap/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/key)) +/obj/item/soap/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/key)) if(key_data) to_chat(user, SPAN_WARNING("\The [src] already has a key imprint.")) else - to_chat(user, SPAN_NOTICE("You imprint \the [I] into \the [src].")) - var/obj/item/key/K = I + to_chat(user, SPAN_NOTICE("You imprint \the [used_item] into \the [src].")) + var/obj/item/key/K = used_item key_data = K.key_data update_icon() return TRUE diff --git a/code/game/objects/items/weapons/storage/backpack.dm b/code/game/objects/items/weapons/storage/backpack.dm index 7a234732c98e..2b3e166a2d24 100644 --- a/code/game/objects/items/weapons/storage/backpack.dm +++ b/code/game/objects/items/weapons/storage/backpack.dm @@ -13,11 +13,15 @@ storage = /datum/storage/backpack material = /decl/material/solid/organic/leather/synth +/obj/item/backpack/get_associated_equipment_slots() + . = ..() + LAZYDISTINCTADD(., slot_back_str) + //Cannot be washed :( /obj/item/backpack/can_contaminate() return FALSE -/obj/item/backpack/attackby(obj/item/W, mob/user) +/obj/item/backpack/attackby(obj/item/used_item, mob/user) if (storage?.use_sound) playsound(src.loc, storage.use_sound, 50, 1, -5) return ..() @@ -51,10 +55,10 @@ explosion(src.loc,(dist),(dist*2),(dist*4)) return 1000 -/obj/item/backpack/holding/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/backpack/holding) || istype(W, /obj/item/bag/trash/advanced)) +/obj/item/backpack/holding/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/backpack/holding) || istype(used_item, /obj/item/bag/trash/advanced)) to_chat(user, "The spatial interfaces of the two devices conflict and malfunction.") - qdel(W) + qdel(used_item) return 1 return ..() @@ -344,7 +348,7 @@ anchored = i ? TRUE : FALSE alpha = i ? 128 : initial(alpha) -/obj/item/backpack/satchel/flat/attackby(obj/item/W, mob/user) +/obj/item/backpack/satchel/flat/attackby(obj/item/used_item, mob/user) var/turf/T = get_turf(src) if(hides_under_flooring() && isturf(T) && !T.is_plating()) to_chat(user, "You must remove the plating first.") diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm index 5b60770ac977..6e4dde21a2b7 100644 --- a/code/game/objects/items/weapons/storage/bags.dm +++ b/code/game/objects/items/weapons/storage/bags.dm @@ -58,10 +58,10 @@ origin_tech = @'{"exoticmatter":5,"materials":6}' storage = /datum/storage/bag/trash/advanced -/obj/item/bag/trash/advanced/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/backpack/holding) || istype(W, /obj/item/bag/trash/advanced)) +/obj/item/bag/trash/advanced/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/backpack/holding) || istype(used_item, /obj/item/bag/trash/advanced)) to_chat(user, "The spatial interfaces of the two devices conflict and malfunction.") - qdel(W) + qdel(used_item) return 1 return ..() diff --git a/code/game/objects/items/weapons/storage/bible.dm b/code/game/objects/items/weapons/storage/bible.dm index 9c123d4624dc..37a12e8d3dcc 100644 --- a/code/game/objects/items/weapons/storage/bible.dm +++ b/code/game/objects/items/weapons/storage/bible.dm @@ -89,9 +89,9 @@ if(proximity && user?.mind?.assigned_job?.is_holy) if(A.reagents && A.reagents.has_reagent(/decl/material/liquid/water)) //blesses all the water in the holder to_chat(user, SPAN_NOTICE("You bless \the [A].")) // I wish it was this easy in nethack - LAZYSET(A.reagents.reagent_data, /decl/material/liquid/water, list("holy" = TRUE)) + LAZYSET(A.reagents.reagent_data, /decl/material/liquid/water, list(DATA_WATER_HOLINESS = TRUE)) -/obj/item/bible/attackby(obj/item/W, mob/user) +/obj/item/bible/attackby(obj/item/used_item, mob/user) if(storage?.use_sound) playsound(loc, storage.use_sound, 50, 1, -5) return ..() diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index 0b46f4484c5e..fa38daee6000 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -431,6 +431,7 @@ return list(/obj/item/chems/hypospray/autoinjector/stabilizer = 7) /obj/item/box/lights + abstract_type = /obj/item/box/lights name = "box of replacement bulbs" icon_state = "light" desc = "This box is shaped on the inside so that only light tubes and bulbs fit." diff --git a/code/game/objects/items/weapons/storage/fancy/_fancy.dm b/code/game/objects/items/weapons/storage/fancy/_fancy.dm index 7dbc2d00ee76..44f9cd602a65 100644 --- a/code/game/objects/items/weapons/storage/fancy/_fancy.dm +++ b/code/game/objects/items/weapons/storage/fancy/_fancy.dm @@ -49,4 +49,4 @@ if(distance > 1 || !key_type) return var/key_count = count_by_type(contents, key_type) - . += "There [key_count == 1? "is" : "are"] [key_count] [initial(key_type.name)]\s in the box." + . += "There [key_count == 1? "is" : "are"] [key_count] [atom_info_repository.get_name_for(key_type)]\s in the box." diff --git a/code/game/objects/items/weapons/storage/fancy/cigarettes.dm b/code/game/objects/items/weapons/storage/fancy/cigarettes.dm index b8f10502a532..379d275b5f8f 100644 --- a/code/game/objects/items/weapons/storage/fancy/cigarettes.dm +++ b/code/game/objects/items/weapons/storage/fancy/cigarettes.dm @@ -130,7 +130,7 @@ //cigarellos /obj/item/box/fancy/cigarettes/cigarello name = "pack of Trident Original cigars" - desc = "The Trident brand's wood tipped little cigar, favored by the Sol corps diplomatique for their pleasant aroma. Machine made on Mars for over 100 years." + desc = "The Trident brand's wood tipped little cigar, favored by some for their pleasant aroma. Machine made on Mars for over 100 years." icon = 'icons/obj/items/storage/cigpack/cigarillo.dmi' icon_state = "CRpacket" item_state = "Dpacket" @@ -142,7 +142,7 @@ /obj/item/box/fancy/cigarettes/cigarello/variety name = "pack of Trident Fruit cigars" - desc = "The Trident brand's wood tipped little cigar, favored by the Sol corps diplomatique for their pleasant aroma. Machine made on Mars for over 100 years. This is a fruit variety pack." + desc = "The Trident brand's wood tipped little cigar, favored by some for their pleasant aroma. Machine made on Mars for over 100 years. This is a fruit variety pack." icon = 'icons/obj/items/storage/cigpack/cigarillo_fruity.dmi' icon_state = "CRFpacket" @@ -157,7 +157,7 @@ /obj/item/box/fancy/cigarettes/cigarello/mint name = "pack of Trident Menthol cigars" - desc = "The Trident brand's wood tipped little cigar, favored by the Sol corps diplomatique for their pleasant aroma. Machine made on Mars for over 100 years. These are the menthol variety." + desc = "The Trident brand's wood tipped little cigar, favored by some for their pleasant aroma. Machine made on Mars for over 100 years. These are the menthol variety." icon = 'icons/obj/items/storage/cigpack/cigarillo_menthol.dmi' icon_state = "CRMpacket" @@ -167,76 +167,57 @@ //////////////////////////////////////////////////////////////////////////////// // Syndie Cigs //////////////////////////////////////////////////////////////////////////////// +/obj/item/box/fancy/cigarettes/covert + abstract_type = /obj/item/box/fancy/cigarettes/covert + /// (TYPEPATH) Used to reset the name and description of covert cigarette packs on init. + var/obj/item/box/fancy/cigarettes/disguised_as = /obj/item/box/fancy/cigarettes + /// (STRING) Part of a string appended to the description on init. + var/scribble = null + +/obj/item/box/fancy/cigarettes/covert/Initialize(ml, material_key) + . = ..() + if(ispath(disguised_as, /obj/item/box/fancy/cigarettes)) + //Reset the name to the default cig pack. Done for codex reasons, since it indexes things by initial names + if(name == initial(name)) // allow mapped names to override it + SetName(disguised_as::name) + if(desc == initial(desc) && istext(scribble)) // ditto for mapped descs + desc = "[disguised_as::desc] '[scribble]' has been scribbled on it." // Flash Powder Pack -/obj/item/box/fancy/cigarettes/flash_powder +/obj/item/box/fancy/cigarettes/covert/flash_powder name = "pack of flash powder laced Trans-Stellar Duty-frees" + disguised_as = /obj/item/box/fancy/cigarettes + scribble = "F" -/obj/item/box/fancy/cigarettes/flash_powder/Initialize(ml, material_key) - . = ..() - //Reset the name to the default cig pack. Done for codex reasons, since it indexes things by initial names - var/obj/item/box/fancy/cigarettes/C = /obj/item/box/fancy/cigarettes - if(name == initial(name)) - SetName(initial(C.name)) - if(desc == initial(desc)) - desc = "[initial(desc)] 'F' has been scribbled on it." - -/obj/item/box/fancy/cigarettes/flash_powder/populate_reagents() +/obj/item/box/fancy/cigarettes/covert/flash_powder/populate_reagents() var/max_storage_space = max(1, storage?.max_storage_space) add_to_reagents(/decl/material/solid/metal/aluminium, max_storage_space) add_to_reagents(/decl/material/solid/potassium, max_storage_space) add_to_reagents(/decl/material/solid/sulfur, max_storage_space) //Chemsmoke Pack -/obj/item/box/fancy/cigarettes/chemsmoke +/obj/item/box/fancy/cigarettes/covert/chemsmoke name = "pack of smoke powder laced Trans-Stellar Duty-frees" + scribble = "S" -/obj/item/box/fancy/cigarettes/chemsmoke/Initialize(ml, material_key) - . = ..() - //Reset the name to the default cig pack. Done for codex reasons, since it indexes things by initial names - var/obj/item/box/fancy/cigarettes/C = /obj/item/box/fancy/cigarettes - if(name == initial(name)) - SetName(initial(C.name)) - if(desc == initial(desc)) - desc = "[initial(desc)] 'S' has been scribbled on it." - -/obj/item/box/fancy/cigarettes/chemsmoke/populate_reagents() +/obj/item/box/fancy/cigarettes/covert/chemsmoke/populate_reagents() var/max_storage_space = max(1, storage?.max_storage_space) add_to_reagents(/decl/material/solid/potassium, max_storage_space) add_to_reagents(/decl/material/liquid/nutriment/sugar, max_storage_space) add_to_reagents(/decl/material/solid/phosphorus, max_storage_space) //Mindbreak Pack (now called /decl/chemical_reaction/hallucinogenics) -/obj/item/box/fancy/cigarettes/mindbreak - name = "pack of mindbreak toxin laced Trans-Stellar Duty-frees" //#TODO: maybe fix the lore for that? +/obj/item/box/fancy/cigarettes/covert/mindbreak + name = "pack of hallucinogen-laced Trans-Stellar Duty-frees" //#TODO: maybe fix the lore for that? + scribble = "H" -/obj/item/box/fancy/cigarettes/mindbreak/Initialize(ml, material_key) - . = ..() - //Reset the name to the default cig pack. Done for codex reasons, since it indexes things by initial names - var/obj/item/box/fancy/cigarettes/C = /obj/item/box/fancy/cigarettes - if(name == initial(name)) - SetName(initial(C.name)) - if(desc == initial(desc)) - desc = "[initial(desc)] 'MB' has been scribbled on it." //#TODO: maybe fix the lore for that? - -/obj/item/box/fancy/cigarettes/mindbreak/populate_reagents() - var/max_storage_space = max(1, storage?.max_storage_space) - add_to_reagents(/decl/material/solid/silicon, max_storage_space) - add_to_reagents(/decl/material/liquid/fuel/hydrazine, max_storage_space) - add_to_reagents(/decl/material/liquid/antitoxins, max_storage_space) +/obj/item/box/fancy/cigarettes/covert/mindbreak/populate_reagents() + add_to_reagents(/decl/material/liquid/hallucinogenics, (3 * max(1, storage?.max_storage_space))) -//Tricord pack (now called /decl/material/liquid/regenerator) -/obj/item/box/fancy/cigarettes/tricord - name = "pack of tricordazine laced Trans-Stellar Duty-frees" //#TODO: maybe fix the lore for that? +//Tricord pack (now called 'regenerative serum') +/obj/item/box/fancy/cigarettes/covert/tricord + name = "pack of regenerative serum-laced Trans-Stellar Duty-frees" //#TODO: maybe fix the lore for that? + scribble = "R" -/obj/item/box/fancy/cigarettes/tricord/Initialize(ml, material_key) - . = ..() - //Reset the name to the default cig pack. Done for codex reasons, since it indexes things by initial names - var/obj/item/box/fancy/cigarettes/C = /obj/item/box/fancy/cigarettes - if(name == initial(name)) - SetName(initial(C.name)) - if(desc == initial(desc)) - desc = "[initial(desc)] 'T' has been scribbled on it." //#TODO: maybe fix the lore for that? - -/obj/item/box/fancy/cigarettes/tricord/populate_reagents() +/obj/item/box/fancy/cigarettes/covert/tricord/populate_reagents() add_to_reagents(/decl/material/liquid/regenerator, (4 * max(1, storage?.max_storage_space))) diff --git a/code/game/objects/items/weapons/storage/fancy/vials.dm b/code/game/objects/items/weapons/storage/fancy/vials.dm index 23cbb2db06bc..de59950c7674 100644 --- a/code/game/objects/items/weapons/storage/fancy/vials.dm +++ b/code/game/objects/items/weapons/storage/fancy/vials.dm @@ -46,6 +46,6 @@ else add_overlay("ledb") -/obj/item/lockbox/vials/attackby(obj/item/W, mob/user) +/obj/item/lockbox/vials/attackby(obj/item/used_item, mob/user) . = ..() update_icon() \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/laundry_basket.dm b/code/game/objects/items/weapons/storage/laundry_basket.dm index c09205958c96..4d03a5567929 100644 --- a/code/game/objects/items/weapons/storage/laundry_basket.dm +++ b/code/game/objects/items/weapons/storage/laundry_basket.dm @@ -33,7 +33,7 @@ to_chat(user, "You dump \the [src]'s contents onto \the [T].") return ..() -/obj/item/laundry_basket/on_picked_up(mob/user) +/obj/item/laundry_basket/on_picked_up(mob/user, atom/old_loc) var/obj/item/laundry_basket/offhand/O = new(user) O.SetName("[name] - second hand") O.desc = "Your second grip on \the [src]." diff --git a/code/game/objects/items/weapons/storage/lockbox.dm b/code/game/objects/items/weapons/storage/lockbox.dm index 3ad6fb923d8c..341efc0954d0 100644 --- a/code/game/objects/items/weapons/storage/lockbox.dm +++ b/code/game/objects/items/weapons/storage/lockbox.dm @@ -18,8 +18,8 @@ var/icon_broken = "lockbox+b" -/obj/item/lockbox/attackby(obj/item/W as obj, mob/user as mob) - if (istype(W, /obj/item/card/id)) +/obj/item/lockbox/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/card/id)) if(src.broken) to_chat(user, "It appears to be broken.") return TRUE @@ -35,9 +35,9 @@ else to_chat(user, "Access Denied") return TRUE - else if(istype(W, /obj/item/energy_blade)) - var/obj/item/energy_blade/blade = W - if(blade.is_special_cutting_tool() && emag_act(INFINITY, user, W, "The locker has been sliced open by [user] with an energy blade!", "You hear metal being sliced and sparks flying.")) + else if(istype(used_item, /obj/item/energy_blade)) + var/obj/item/energy_blade/blade = used_item + if(blade.is_special_cutting_tool() && emag_act(INFINITY, user, used_item, "The locker has been sliced open by [user] with an energy blade!", "You hear metal being sliced and sparks flying.")) spark_at(src.loc, amount=5) playsound(src.loc, 'sound/weapons/blade1.ogg', 50, 1) return TRUE diff --git a/code/game/objects/items/weapons/storage/lunchbox.dm b/code/game/objects/items/weapons/storage/lunchbox.dm index 69aefb817316..f05761ec870a 100644 --- a/code/game/objects/items/weapons/storage/lunchbox.dm +++ b/code/game/objects/items/weapons/storage/lunchbox.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/items/storage/lunchboxes/lunchbox_rainbow.dmi' icon_state = ICON_STATE_WORLD w_class = ITEM_SIZE_NORMAL - attack_verb = list("lunched") + attack_verb = "lunched" material = /decl/material/solid/organic/plastic storage = /datum/storage/lunchbox var/tmp/filled = FALSE diff --git a/code/game/objects/items/weapons/storage/matches.dm b/code/game/objects/items/weapons/storage/matches.dm index 8312621ce0cb..fe883451bf5a 100644 --- a/code/game/objects/items/weapons/storage/matches.dm +++ b/code/game/objects/items/weapons/storage/matches.dm @@ -11,15 +11,15 @@ /obj/item/box/matches/WillContain() return list(/obj/item/flame/match = 10) -/obj/item/box/matches/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/flame/match)) - var/obj/item/flame/match/match = W +/obj/item/box/matches/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/flame/match)) + var/obj/item/flame/match/match = used_item if(match.light(null, no_message = TRUE)) playsound(src.loc, 'sound/items/match.ogg', 60, 1, -4) user.visible_message( - SPAN_NOTICE("[user] strikes [W] on \the [src]."), - SPAN_NOTICE("You strike [W] on \the [src].") + SPAN_NOTICE("[user] strikes [used_item] on \the [src]."), + SPAN_NOTICE("You strike [used_item] on \the [src].") ) - W.update_icon() + used_item.update_icon() return TRUE return ..() diff --git a/code/game/objects/items/weapons/storage/nuggets.dm b/code/game/objects/items/weapons/storage/nuggets.dm index 3ecc72ce2270..c8a8b1602fc2 100644 --- a/code/game/objects/items/weapons/storage/nuggets.dm +++ b/code/game/objects/items/weapons/storage/nuggets.dm @@ -32,6 +32,7 @@ . += /obj/item/food/nugget /obj/item/box/nuggets/on_update_icon() + . = ..() var/datum/storage/box/nuggets/nugget_box = storage if(length(contents) == 0 || !istype(nugget_box)) icon_state = "[initial(icon_state)]_empty" diff --git a/code/game/objects/items/weapons/storage/picnic_basket.dm b/code/game/objects/items/weapons/storage/picnic_basket.dm index a01f1c93088d..7ecd98a74f58 100644 --- a/code/game/objects/items/weapons/storage/picnic_basket.dm +++ b/code/game/objects/items/weapons/storage/picnic_basket.dm @@ -6,7 +6,7 @@ icon_state = ICON_STATE_WORLD w_class = ITEM_SIZE_NORMAL storage = /datum/storage/picnic_basket - attack_verb = list("picnics") + attack_verb = "picnics" material = /decl/material/solid/organic/plastic var/tmp/filled = FALSE diff --git a/code/game/objects/items/weapons/storage/secure.dm b/code/game/objects/items/weapons/storage/secure.dm index 860536919b89..fb7ff59d4049 100644 --- a/code/game/objects/items/weapons/storage/secure.dm +++ b/code/game/objects/items/weapons/storage/secure.dm @@ -46,9 +46,9 @@ if(new_locked) storage?.close_all() -/obj/item/secure_storage/attackby(obj/item/W, mob/user) +/obj/item/secure_storage/attackby(obj/item/used_item, mob/user) var/datum/extension/lockable/lock = get_extension(src, /datum/extension/lockable) - if(lock.attackby(W, user)) + if(lock.attackby(used_item, user)) return TRUE // -> storage/attackby() what with handle insertion, etc diff --git a/code/game/objects/items/weapons/storage/toolbox.dm b/code/game/objects/items/weapons/storage/toolbox.dm index c2342c95d367..61fd4e38f25c 100644 --- a/code/game/objects/items/weapons/storage/toolbox.dm +++ b/code/game/objects/items/weapons/storage/toolbox.dm @@ -11,7 +11,7 @@ w_class = ITEM_SIZE_LARGE storage = /datum/storage/toolbox origin_tech = @'{"combat":1}' - attack_verb = list("robusted") + attack_verb = "robusted" material = /decl/material/solid/metal/aluminium _base_attack_force = 20 diff --git a/code/game/objects/items/weapons/storage/uplink_kits.dm b/code/game/objects/items/weapons/storage/uplink_kits.dm index 7612a6e897b0..a6eb745f50c6 100644 --- a/code/game/objects/items/weapons/storage/uplink_kits.dm +++ b/code/game/objects/items/weapons/storage/uplink_kits.dm @@ -126,10 +126,10 @@ /obj/item/box/syndie_kit/cigarette/WillContain() return list( - /obj/item/box/fancy/cigarettes/flash_powder = 2, - /obj/item/box/fancy/cigarettes/chemsmoke = 2, - /obj/item/box/fancy/cigarettes/mindbreak, - /obj/item/box/fancy/cigarettes/tricord, + /obj/item/box/fancy/cigarettes/covert/flash_powder = 2, + /obj/item/box/fancy/cigarettes/covert/chemsmoke = 2, + /obj/item/box/fancy/cigarettes/covert/mindbreak, + /obj/item/box/fancy/cigarettes/covert/tricord, /obj/item/flame/fuelled/lighter/zippo/random, ) diff --git a/code/game/objects/items/weapons/storage/wall_mirror.dm b/code/game/objects/items/weapons/storage/wall_mirror.dm index 91b5554585d3..a69b0d5e135f 100644 --- a/code/game/objects/items/weapons/storage/wall_mirror.dm +++ b/code/game/objects/items/weapons/storage/wall_mirror.dm @@ -97,18 +97,17 @@ if(!ishuman(user)) return - var/W = weakref(user) - var/datum/nano_module/appearance_changer/AC = LAZYACCESS(ui_users, W) + var/weakref/user_ref = weakref(user) + var/datum/nano_module/appearance_changer/AC = LAZYACCESS(ui_users, user_ref) if(!AC) AC = new(mirror, user) AC.name = title if(flags) AC.flags = flags - LAZYSET(ui_users, W, AC) + LAZYSET(ui_users, user_ref, AC) AC.ui_interact(user) /proc/clear_ui_users(var/list/ui_users) - for(var/W in ui_users) - var/AC = ui_users[W] - qdel(AC) + for(var/user_ref in ui_users) + qdel(ui_users[user_ref]) LAZYCLEARLIST(ui_users) diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 4a176ec5298b..e8ffe9555320 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -7,7 +7,7 @@ slot_flags = SLOT_LOWER_BODY w_class = ITEM_SIZE_NORMAL origin_tech = @'{"combat":2}' - attack_verb = list("beaten") + attack_verb = "beaten" base_parry_chance = 30 material = /decl/material/solid/metal/aluminium matter = list( @@ -35,7 +35,7 @@ /obj/item/baton/infinite/Initialize(var/ml, var/material_key, var/loaded_cell_type) . = ..(ml, material_key, loaded_cell_type = /obj/item/cell/device/infinite) - set_status(1, null) + set_cell_status(1, null) /obj/item/baton/proc/update_status() var/obj/item/cell/cell = get_cell() @@ -66,10 +66,10 @@ set_light(0) /obj/item/baton/attack_self(mob/user) - set_status(!status, user) + set_cell_status(!status, user) add_fingerprint(user) -/obj/item/baton/proc/set_status(var/newstatus, mob/user) +/obj/item/baton/proc/set_cell_status(var/newstatus, mob/user) var/obj/item/cell/cell = get_cell() if(cell?.charge >= hitcost) if(status != newstatus) @@ -161,15 +161,15 @@ // usability without proper checks. // Also hard-coded to be unuseable outside their righteous synthetic owners. /obj/item/baton/robot/attack_self(mob/user) - var/mob/living/silicon/robot/R = isrobot(user) ? user : null // null if the user is NOT a robot - if (R) + var/mob/living/silicon/robot/robot = isrobot(user) ? user : null // null if the user is NOT a robot + if (robot) return ..() else // Stop pretending and get out of your cardborg suit, human. to_chat(user, "You don't seem to be able to interact with this by yourself.") add_fingerprint(user) return 0 -/obj/item/baton/robot/attackby(obj/item/W, mob/user) +/obj/item/baton/robot/attackby(obj/item/used_item, mob/user) return FALSE /obj/item/baton/robot/setup_power_supply(loaded_cell_type, accepted_cell_type, power_supply_extension_type, charge_value) @@ -207,7 +207,7 @@ stunforce = 0 agonyforce = 60 //same force as a stunbaton, but uses way more charge. hitcost = 25 - attack_verb = list("poked") + attack_verb = "poked" slot_flags = null matter = list( /decl/material/solid/organic/plastic = MATTER_AMOUNT_TRACE, diff --git a/code/game/objects/items/weapons/surgery_tools.dm b/code/game/objects/items/weapons/surgery_tools.dm index 082bccc7a32a..c4f24a7afcdb 100644 --- a/code/game/objects/items/weapons/surgery_tools.dm +++ b/code/game/objects/items/weapons/surgery_tools.dm @@ -63,7 +63,7 @@ obj_flags = OBJ_FLAG_CONDUCTIBLE w_class = ITEM_SIZE_SMALL origin_tech = @'{"materials":1,"biotech":1}' - attack_verb = list("burnt") + attack_verb = "burnt" /obj/item/cautery/Initialize() . = ..() @@ -84,7 +84,7 @@ _base_attack_force = 15 w_class = ITEM_SIZE_NORMAL origin_tech = @'{"materials":1,"biotech":1}' - attack_verb = list("drilled") + attack_verb = "drilled" /obj/item/surgicaldrill/Initialize() . = ..() diff --git a/code/game/objects/items/weapons/surgery_tools_ancient.dm b/code/game/objects/items/weapons/surgery_tools_ancient.dm index f6f31166bfac..d9c4f6d27433 100644 --- a/code/game/objects/items/weapons/surgery_tools_ancient.dm +++ b/code/game/objects/items/weapons/surgery_tools_ancient.dm @@ -2,12 +2,13 @@ abstract_type = /obj/item/ancient_surgery icon_state = ICON_STATE_WORLD material = /decl/material/solid/metal/bronze + color = /decl/material/solid/metal/bronze::color + material_alteration = MAT_FLAG_ALTERATION_ALL matter = null obj_flags = OBJ_FLAG_CONDUCTIBLE w_class = ITEM_SIZE_SMALL origin_tech = @'{"materials":1,"biotech":1}' drop_sound = 'sound/foley/knifedrop3.ogg' - material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC /obj/item/ancient_surgery/proc/get_tool_properties() return diff --git a/code/game/objects/items/weapons/tanks/tank_types.dm b/code/game/objects/items/weapons/tanks/tank_types.dm index f5b1580e8a67..643125e14e14 100644 --- a/code/game/objects/items/weapons/tanks/tank_types.dm +++ b/code/game/objects/items/weapons/tanks/tank_types.dm @@ -22,6 +22,10 @@ desc = "A tank of oxygen. This one is yellow." icon = 'icons/obj/items/tanks/tank_yellow.dmi' +/obj/item/tank/oxygen/red + desc = "A tank of oxygen. This one is red." + icon = 'icons/obj/items/tanks/tank_red.dmi' + /obj/item/tank/oxygen/empty starting_pressure = list() diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index 23aa1b6ab20e..55bedc9bca88 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -114,28 +114,28 @@ var/global/list/global/tank_gauge_cache = list() if(valve_welded) . += SPAN_WARNING("\The [src] emergency relief valve has been welded shut!") -/obj/item/tank/attackby(var/obj/item/W, var/mob/user) +/obj/item/tank/attackby(var/obj/item/used_item, var/mob/user) if (istype(loc, /obj/item/assembly)) icon = loc - if (istype(W, /obj/item/scanner/gas)) - return TRUE + if (istype(used_item, /obj/item/scanner/gas)) + return FALSE // allow afterattack to proceed - if (istype(W,/obj/item/latexballon)) - var/obj/item/latexballon/LB = W + if (istype(used_item,/obj/item/latexballon)) + var/obj/item/latexballon/LB = used_item LB.blow(src) add_fingerprint(user) return TRUE - if(IS_COIL(W)) - var/obj/item/stack/cable_coil/C = W + if(IS_COIL(used_item)) + var/obj/item/stack/cable_coil/C = used_item if(C.use(1)) wired = 1 to_chat(user, "You attach the wires to the tank.") update_icon() return TRUE - if(IS_WIRECUTTER(W)) + if(IS_WIRECUTTER(used_item)) if(wired && proxyassembly.assembly) to_chat(user, "You carefully begin clipping the wires that attach to the tank.") @@ -173,23 +173,20 @@ var/global/list/global/tank_gauge_cache = list() to_chat(user, "There are no wires to cut!") return TRUE - if(istype(W, /obj/item/assembly_holder)) + if(istype(used_item, /obj/item/assembly_holder)) if(wired) to_chat(user, "You begin attaching the assembly to \the [src].") if(do_after(user, 50, src)) - to_chat(user, "You finish attaching the assembly to \the [src].") - global.bombers += "[key_name(user)] attached an assembly to a wired [src]. Temp: [air_contents.temperature-T0C]" - log_and_message_admins("attached an assembly to a wired [src]. Temp: [air_contents.temperature-T0C]", user) - assemble_bomb(W,user) + assemble_bomb(used_item,user) else to_chat(user, "You stop attaching the assembly.") else to_chat(user, "You need to wire the device up first.") return TRUE - if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W - if(WT.weld(1,user)) + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(1,user)) if(!valve_welded) to_chat(user, "You begin welding \the [src] emergency pressure relief valve.") if(do_after(user, 40,src)) @@ -199,8 +196,8 @@ var/global/list/global/tank_gauge_cache = list() else global.bombers += "[key_name(user)] attempted to weld \a [src]. [air_contents.temperature-T0C]" log_and_message_admins("attempted to weld \a [src]. [air_contents.temperature-T0C]", user) - if(WT.welding) - to_chat(user, "You accidentally rake \the [W] across \the [src]!") + if(welder.welding) + to_chat(user, "You accidentally rake \the [used_item] across \the [src]!") maxintegrity -= rand(2,6) integrity = min(integrity,maxintegrity) air_contents.add_thermal_energy(rand(2000,50000)) @@ -209,8 +206,8 @@ var/global/list/global/tank_gauge_cache = list() add_fingerprint(user) return TRUE - if(istype(W, /obj/item/flamethrower)) - var/obj/item/flamethrower/F = W + if(istype(used_item, /obj/item/flamethrower)) + var/obj/item/flamethrower/F = used_item if(!F.secured || F.tank || !user.try_unequip(src, F)) return TRUE @@ -550,39 +547,45 @@ var/global/list/global/tank_gauge_cache = list() /obj/item/tankassemblyproxy/receive_signal() //This is mainly called by the sensor through sense() to the holder, and from the holder to here. tank.cause_explosion() //boom (or not boom if you made shijwtty mix) -/obj/item/tank/proc/assemble_bomb(W,user) //Bomb assembly proc. This turns assembly+tank into a bomb - var/obj/item/assembly_holder/S = W - var/mob/M = user - if(!S.secured) //Check if the assembly is secured - return +/obj/item/tank/proc/assemble_bomb(used_item,mob/user) //Bomb assembly proc. This turns assembly+tank into a bomb + var/obj/item/assembly_holder/S = used_item if(isigniter(S.a_left) == isigniter(S.a_right)) //Check if either part of the assembly has an igniter, but if both parts are igniters, then fuck it return + if(!S.secured) //Check if the assembly is secured + to_chat(user, SPAN_NOTICE("\The [S] must be secured before attaching it to \the [src]!")) + return - if(!M.try_unequip(src)) + if(!user.try_unequip(src)) return //Remove the tank from your character,in case you were holding it - M.put_in_hands(src) //Equips the bomb if possible, or puts it on the floor. + user.put_in_hands(src) //Equips the bomb if possible, or puts it on the floor. proxyassembly.assembly = S //Tell the bomb about its assembly part S.master = proxyassembly //Tell the assembly about its new owner - S.forceMove(src) //Move the assembly + user.remove_from_mob(S, src, FALSE) //Move the assembly and reset HUD layer/plane status update_icon() + to_chat(user, "You finish attaching the assembly to \the [src].") + global.bombers += "[key_name(user)] attached an assembly to a wired [src]. Temp: [air_contents.temperature-T0C]" + log_and_message_admins("attached an assembly to a wired [src]. Temp: [air_contents.temperature-T0C]", user) /obj/item/tank/proc/cause_explosion() //This happens when a bomb is told to explode + var/obj/item/assembly_holder/assy = proxyassembly.assembly - var/ign = assy.a_right - var/obj/item/other = assy.a_left + var/obj/item/igniter = assy.a_right + var/obj/item/other = assy.a_left if (isigniter(assy.a_left)) - ign = assy.a_left - other = assy.a_right + igniter = assy.a_left + other = assy.a_right if(other) other.dropInto(get_turf(src)) - qdel(ign) + if(!QDELETED(igniter)) + qdel(igniter) assy.master = null proxyassembly.assembly = null - qdel(assy) + if(!QDELETED(assy)) + qdel(assy) update_icon() air_contents.add_thermal_energy(15000) diff --git a/code/game/objects/items/weapons/tape.dm b/code/game/objects/items/weapons/tape.dm index eaec2caa5867..d10c34c4f8e3 100644 --- a/code/game/objects/items/weapons/tape.dm +++ b/code/game/objects/items/weapons/tape.dm @@ -147,14 +147,14 @@ return ..() -/obj/item/stack/tape_roll/duct_tape/proc/stick(var/obj/item/W, mob/user) - if(!(W.item_flags & ITEM_FLAG_CAN_TAPE) || !user.try_unequip(W)) +/obj/item/stack/tape_roll/duct_tape/proc/stick(var/obj/item/used_item, mob/user) + if(!(used_item.item_flags & ITEM_FLAG_CAN_TAPE) || !user.try_unequip(used_item)) return FALSE if(!can_use(1)) return FALSE use(1) var/obj/item/duct_tape/tape = new(get_turf(src)) - tape.attach(W) + tape.attach(used_item) user.put_in_hands(tape) return TRUE @@ -184,17 +184,17 @@ anchored = FALSE // Unattach it from whereever it's on, if anything. return ..() -/obj/item/duct_tape/attackby(obj/item/W, mob/user) - return stuck? stuck.attackby(W, user) : ..() +/obj/item/duct_tape/attackby(obj/item/used_item, mob/user) + return stuck? stuck.attackby(used_item, user) : ..() /obj/item/duct_tape/examined_by(mob/user, distance, infix, suffix) return stuck ? stuck.examined_by(user, distance, infix, suffix) : ..() -/obj/item/duct_tape/proc/attach(var/obj/item/W) - stuck = W +/obj/item/duct_tape/proc/attach(var/obj/item/used_item) + stuck = used_item anchored = TRUE - SetName("[W.name] (taped)") - W.forceMove(src) + SetName("[used_item.name] (taped)") + used_item.forceMove(src) playsound(src, 'sound/effects/tape.ogg', 25) update_icon() diff --git a/code/game/objects/items/weapons/towels.dm b/code/game/objects/items/weapons/towels.dm index 498f1abd25fc..80cacb07e3da 100644 --- a/code/game/objects/items/weapons/towels.dm +++ b/code/game/objects/items/weapons/towels.dm @@ -7,7 +7,7 @@ slot_flags = SLOT_HEAD | SLOT_LOWER_BODY | SLOT_OVER_BODY _base_attack_force = 1 w_class = ITEM_SIZE_NORMAL - attack_verb = list("whipped") + attack_verb = "whipped" hitsound = 'sound/weapons/towelwhip.ogg' material = /decl/material/solid/organic/cloth material_alteration = MAT_FLAG_ALTERATION_ALL @@ -188,7 +188,7 @@ name = "fleece" // sets its name to 'golden fleece' due to material desc = "The legendary Golden Fleece of Jason made real." _base_attack_force = 1 - attack_verb = list("smote") + attack_verb = "smote" material = /decl/material/solid/metal/gold /obj/item/towel/fleece/update_material_description() @@ -210,7 +210,7 @@ update_icon() return TRUE -/obj/item/towel/on_picked_up(mob/user) +/obj/item/towel/on_picked_up(mob/user, atom/old_loc) ..() if(laid_out) laid_out = FALSE @@ -241,4 +241,8 @@ /// A mapping subtype for a doormat that's already been laid out. /obj/item/towel/doormat/flat laid_out = TRUE - icon_state = ICON_STATE_WORLD + "-flat" \ No newline at end of file + icon_state = ICON_STATE_WORLD + "-flat" + +/obj/item/towel/doormat/flat/Initialize() + . = ..() + reset_offsets() // we don't want to overwrite randpixel but we don't want it to have a random offset either \ No newline at end of file diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm index 61276713a388..445f92be6909 100644 --- a/code/game/objects/items/weapons/weaponry.dm +++ b/code/game/objects/items/weapons/weaponry.dm @@ -200,8 +200,8 @@ healthcheck() return TRUE -/obj/effect/energy_net/attackby(obj/item/W, mob/user) - current_health -= W.expend_attack_force(user) +/obj/effect/energy_net/attackby(obj/item/used_item, mob/user) + current_health -= used_item.expend_attack_force(user) healthcheck() return TRUE diff --git a/code/game/objects/items/welding/electric_welder.dm b/code/game/objects/items/welding/electric_welder.dm index c46aa882f571..382690a971b4 100644 --- a/code/game/objects/items/welding/electric_welder.dm +++ b/code/game/objects/items/welding/electric_welder.dm @@ -47,7 +47,7 @@ /obj/item/weldingtool/electric/insert_tank(var/obj/item/chems/welder_tank/T, var/mob/user, var/no_updates = FALSE, var/quiet = FALSE) return FALSE // No tanks! -/obj/item/weldingtool/electric/attempt_modify(var/obj/item/W, var/mob/user) +/obj/item/weldingtool/electric/attempt_modify(var/obj/item/used_item, var/mob/user) return FALSE // NO ELECTRIC FLAMETHROWER /obj/item/weldingtool/electric/use_fuel(var/amount) diff --git a/code/game/objects/items/welding/weldbackpack.dm b/code/game/objects/items/welding/weldbackpack.dm index 5b8bdbb036a9..661197c56601 100644 --- a/code/game/objects/items/welding/weldbackpack.dm +++ b/code/game/objects/items/welding/weldbackpack.dm @@ -30,7 +30,7 @@ /obj/item/weldingtool/weldpack/toggle_unscrewed(mob/user) return FALSE -/obj/item/weldingtool/weldpack/attempt_modify(obj/item/W, mob/user) +/obj/item/weldingtool/weldpack/attempt_modify(obj/item/used_item, mob/user) return FALSE /obj/item/weldingtool/weldpack/dropped(mob/user) diff --git a/code/game/objects/items/welding/weldingtool.dm b/code/game/objects/items/welding/weldingtool.dm index f46f50010915..720957f0b6d0 100644 --- a/code/game/objects/items/welding/weldingtool.dm +++ b/code/game/objects/items/welding/weldingtool.dm @@ -137,27 +137,27 @@ to_chat(user, SPAN_NOTICE("The welder can now be attached and modified.")) return TRUE -/obj/item/weldingtool/proc/attempt_modify(var/obj/item/W, var/mob/user) - if(!status && istype(W, /obj/item/stack/material/rods)) - var/obj/item/stack/material/rods/R = W +/obj/item/weldingtool/proc/attempt_modify(var/obj/item/used_item, var/mob/user) + if(!status && istype(used_item, /obj/item/stack/material/rods)) + var/obj/item/stack/material/rods/R = used_item R.use(1) user.drop_from_inventory(src) user.put_in_hands(new /obj/item/flamethrower(get_turf(src), src)) qdel(src) return TRUE -/obj/item/weldingtool/attackby(obj/item/W, mob/user) +/obj/item/weldingtool/attackby(obj/item/used_item, mob/user) if(welding) to_chat(user, SPAN_WARNING("Stop welding first!")) return TRUE - if (istype(W, /obj/item/chems/welder_tank)) - return insert_tank(W, user) + if (istype(used_item, /obj/item/chems/welder_tank)) + return insert_tank(used_item, user) - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) return toggle_unscrewed(user) - if(attempt_modify(W, user)) + if(attempt_modify(used_item, user)) return TRUE return ..() diff --git a/code/game/objects/structures/__structure.dm b/code/game/objects/structures/__structure.dm index dfe3a96be019..2a90385995b3 100644 --- a/code/game/objects/structures/__structure.dm +++ b/code/game/objects/structures/__structure.dm @@ -301,11 +301,11 @@ auto_align() will then place the sprite so the defined center_of_mass is at the closest to where the cursor has clicked on. Note: This proc can be overwritten to allow for different types of auto-alignment. */ -/obj/structure/proc/auto_align(obj/item/W, click_params) - if (!W.center_of_mass) // Clothing, material stacks, generally items with large sprites where exact placement would be unhandy. - W.pixel_x = rand(-W.randpixel, W.randpixel) - W.pixel_y = rand(-W.randpixel, W.randpixel) - W.pixel_z = 0 +/obj/structure/proc/auto_align(obj/item/aligning, click_params) + if (!aligning.center_of_mass) // Clothing, material stacks, generally items with large sprites where exact placement would be unhandy. + aligning.pixel_x = rand(-aligning.randpixel, aligning.randpixel) + aligning.pixel_y = rand(-aligning.randpixel, aligning.randpixel) + aligning.pixel_z = 0 return if (!click_params) return @@ -324,10 +324,10 @@ Note: This proc can be overwritten to allow for different types of auto-alignmen span_y = bound_height / CELLSIZE var/cell_x = clamp(round(mouse_x/CELLSIZE), 0, span_x-1) // Ranging from 0 to span_x-1 var/cell_y = clamp(round(mouse_y/CELLSIZE), 0, span_y-1) - var/list/center = cached_json_decode(W.center_of_mass) - W.pixel_x = (CELLSIZE * (cell_x + 0.5)) - center["x"] - W.pixel_y = (CELLSIZE * (cell_y + 0.5)) - center["y"] - W.pixel_z = 0 + var/list/center = cached_json_decode(aligning.center_of_mass) + aligning.pixel_x = (CELLSIZE * (cell_x + 0.5)) - center["x"] + aligning.pixel_y = (CELLSIZE * (cell_y + 0.5)) - center["y"] + aligning.pixel_z = 0 // Does this structure override turf depth for the purposes of mob offsets? /obj/structure/proc/is_platform() diff --git a/code/game/objects/structures/_structure_construction.dm b/code/game/objects/structures/_structure_construction.dm index 186aa29e0e0f..85ffb92fa599 100644 --- a/code/game/objects/structures/_structure_construction.dm +++ b/code/game/objects/structures/_structure_construction.dm @@ -65,7 +65,7 @@ var/force = used_item.expend_attack_force(user) if(force && user.check_intent(I_FLAG_HARM)) attack_animation(user) - visible_message(SPAN_DANGER("\The [src] has been [pick(used_item.attack_verb)] with \the [used_item] by \the [user]!")) + visible_message(SPAN_DANGER("\The [src] has been [used_item.pick_attack_verb()] with \the [used_item] by \the [user]!")) take_damage(force, used_item.atom_damage_type) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) add_fingerprint(user) diff --git a/code/game/objects/structures/_structure_icon.dm b/code/game/objects/structures/_structure_icon.dm index 12bbc26f1602..966df9a1cc4c 100644 --- a/code/game/objects/structures/_structure_icon.dm +++ b/code/game/objects/structures/_structure_icon.dm @@ -35,10 +35,10 @@ var/global/list/default_noblend_objects = list(/obj/machinery/door/window, /obj/ /obj/structure/proc/find_blendable_obj_in_turf(var/turf/T, var/propagate) if(is_type_in_list(T, global.default_blend_objects)) if(propagate && istype(T, /turf/wall)) - for(var/turf/wall/W in RANGE_TURFS(T, 1)) - W.wall_connections = null - W.other_connections = null - W.queue_icon_update() + for(var/turf/wall/wall in RANGE_TURFS(T, 1)) + wall.wall_connections = null + wall.other_connections = null + wall.queue_icon_update() return TRUE for(var/obj/O in T) if(!is_type_in_list(O, global.default_blend_objects)) diff --git a/code/game/objects/structures/_structure_materials.dm b/code/game/objects/structures/_structure_materials.dm index 604a48b49acd..533df4ca3d72 100644 --- a/code/game/objects/structures/_structure_materials.dm +++ b/code/game/objects/structures/_structure_materials.dm @@ -4,6 +4,8 @@ var/material_alteration var/dismantled var/name_prefix + /// The base alpha used to calculate material-based alpha in update_material_color(). + var/base_alpha = 50 /obj/structure/get_material() RETURN_TYPE(/decl/material) @@ -57,7 +59,7 @@ /obj/structure/proc/update_material_color() color = get_color() if(istype(material)) - alpha = clamp((50 + material.opacity * 255), 0, 255) + alpha = clamp((base_alpha + material.opacity * 255), 0, 255) else alpha = initial(alpha) diff --git a/code/game/objects/structures/barrels/cask_rack.dm b/code/game/objects/structures/barrels/cask_rack.dm index c8e5cebc6184..2dfbdc2d8e09 100644 --- a/code/game/objects/structures/barrels/cask_rack.dm +++ b/code/game/objects/structures/barrels/cask_rack.dm @@ -143,16 +143,12 @@ // A larger stack, used to arrange up to three casks. /obj/structure/cask_rack/large + name_prefix = "large" desc = "A flat rack used to stop casks from rolling around." max_stack = 3 w_class = ITEM_SIZE_LARGE_STRUCTURE icon = 'icons/obj/structures/barrels/cask_rack_large.dmi' -// We want 'large wooden cask rack' not 'wooden large cask rack' -/obj/structure/cask_rack/large/update_material_name(override_name) - . = ..() - SetName("large [name]") - /obj/structure/cask_rack/large/adjust_barrel_offsets(atom/movable/barrel, barrel_position) ..() switch(barrel_position) diff --git a/code/game/objects/structures/barricade.dm b/code/game/objects/structures/barricade.dm index b5708b8f18f2..ece9d0fa5244 100644 --- a/code/game/objects/structures/barricade.dm +++ b/code/game/objects/structures/barricade.dm @@ -49,16 +49,16 @@ else icon_state = "barricade" -/obj/structure/barricade/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/stack/material/rods) && !reinf_material) - var/obj/item/stack/material/rods/R = W - if(R.get_amount() < 5) +/obj/structure/barricade/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/stack/material/rods) && !reinf_material) + var/obj/item/stack/material/rods/rods = used_item + if(rods.get_amount() < 5) to_chat(user, SPAN_WARNING("You need more rods to build a cheval de frise.")) else visible_message(SPAN_NOTICE("\The [user] begins to work on \the [src].")) - if(do_after(user, 4 SECONDS, src) && !reinf_material && R.use(5)) - visible_message(SPAN_NOTICE("\The [user] fastens \the [R] to \the [src].")) - reinf_material = R.material + if(do_after(user, 4 SECONDS, src) && !reinf_material && rods.use(5)) + visible_message(SPAN_NOTICE("\The [user] fastens \the [rods] to \the [src].")) + reinf_material = rods.material update_materials(TRUE) . = ..() diff --git a/code/game/objects/structures/barsign.dm b/code/game/objects/structures/barsign.dm index d47f2eef2fd7..f3f0467e1a62 100644 --- a/code/game/objects/structures/barsign.dm +++ b/code/game/objects/structures/barsign.dm @@ -33,11 +33,11 @@ . = ..() icon_state = pick(get_valid_states()) -/obj/structure/sign/double/barsign/attackby(obj/item/I, mob/user) +/obj/structure/sign/double/barsign/attackby(obj/item/used_item, mob/user) if(cult) return ..() - var/obj/item/card/id/card = I.GetIdCard() + var/obj/item/card/id/card = used_item.GetIdCard() if(istype(card)) if(access_bar in card.GetAccess()) var/sign_type = input(user, "What would you like to change the barsign to?") as null|anything in get_valid_states(0) diff --git a/code/game/objects/structures/beds/rollerbed.dm b/code/game/objects/structures/beds/rollerbed.dm index a919d9f30bc9..a3f332b4b044 100644 --- a/code/game/objects/structures/beds/rollerbed.dm +++ b/code/game/objects/structures/beds/rollerbed.dm @@ -34,12 +34,12 @@ iv.pixel_y = 6 add_overlay(iv) -/obj/structure/bed/roller/attackby(obj/item/I, mob/user) - if(iv_stand && !beaker && istype(I, /obj/item/chems)) - if(!user.try_unequip(I, src)) +/obj/structure/bed/roller/attackby(obj/item/used_item, mob/user) + if(iv_stand && !beaker && istype(used_item, /obj/item/chems)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, "You attach \the [I] to \the [src].") - beaker = I + to_chat(user, "You attach \the [used_item] to \the [src].") + beaker = used_item queue_icon_update() return TRUE return ..() diff --git a/code/game/objects/structures/beds/simple_bed.dm b/code/game/objects/structures/beds/simple_bed.dm index 3092fc63a717..31a656cfa0a8 100644 --- a/code/game/objects/structures/beds/simple_bed.dm +++ b/code/game/objects/structures/beds/simple_bed.dm @@ -1,7 +1,7 @@ /obj/structure/bed/simple desc = "A slatted wooden bed." icon = 'icons/obj/structures/furniture/bed_simple.dmi' - icon_state = "bed_padded_preview" // For map editor preview purposes + icon_state = "world_padded_preview" // For map editor preview purposes parts_type = /obj/item/stack/material/plank material = /decl/material/solid/organic/wood/oak initial_padding_material = /decl/material/solid/organic/plantmatter/grass/dry @@ -48,7 +48,7 @@ /obj/structure/bed/simple/crafted initial_padding_material = null - icon_state = "bed" + icon_state = ICON_STATE_WORLD color = /decl/material/solid/organic/wood/oak::color /obj/item/bedsheet/furs diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index ccfe1f59c914..1ddc5b1937f1 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -12,16 +12,16 @@ LINEN BINS item_state = "bedsheet" randpixel = 0 slot_flags = SLOT_BACK - layer = BASE_ABOVE_OBJ_LAYER + layer = ABOVE_STRUCTURE_LAYER // layer below other objects but above beds throw_speed = 1 throw_range = 2 w_class = ITEM_SIZE_SMALL material = /decl/material/solid/organic/cloth -/obj/item/bedsheet/attackby(obj/item/I, mob/user) - if(I.is_sharp() || I.has_edge()) - user.visible_message("\The [user] begins cutting up \the [src] with \a [I].", "You begin cutting up \the [src] with \the [I].") - if(do_after(user, 50, src)) +/obj/item/bedsheet/attackby(obj/item/used_item, mob/user) + if(used_item.is_sharp() || used_item.has_edge()) + user.visible_message("\The [user] begins cutting up \the [src] with \a [used_item].", "You begin cutting up \the [src] with \the [used_item].") + if(do_after(user, 5 SECONDS, src)) to_chat(user, "You cut \the [src] into pieces!") for(var/i in 1 to rand(2,5)) new /obj/item/chems/rag(get_turf(src)) @@ -137,33 +137,33 @@ LINEN BINS else icon_state = "linenbin-full" -/obj/structure/bedsheetbin/attackby(obj/item/I, mob/user) +/obj/structure/bedsheetbin/attackby(obj/item/used_item, mob/user) var/curamount = get_amount() - if(istype(I, /obj/item/bedsheet)) + if(istype(used_item, /obj/item/bedsheet)) if(curamount >= max_stored) to_chat(user, SPAN_WARNING("\The [src] is full!")) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - LAZYDISTINCTADD(sheets, I) + LAZYDISTINCTADD(sheets, used_item) update_icon() - to_chat(user, SPAN_NOTICE("You put [I] in [src].")) + to_chat(user, SPAN_NOTICE("You put [used_item] in [src].")) return TRUE //Let the parent attackby run to handle tool interactions . = ..() if(!.) - if(curamount && !hidden && I.w_class < w_class) //make sure there's sheets to hide it among, make sure nothing else is hidden in there. - if(!user.try_unequip(I, src)) + if(curamount && !hidden && used_item.w_class < w_class) //make sure there's sheets to hide it among, make sure nothing else is hidden in there. + if(!user.try_unequip(used_item, src)) return TRUE - hidden = I - to_chat(user, SPAN_NOTICE("You hide [I] among the sheets.")) + hidden = used_item + to_chat(user, SPAN_NOTICE("You hide [used_item] among the sheets.")) return TRUE else if(hidden) - to_chat(user, SPAN_WARNING("There's not enough space to hide \the [I]!")) - else if(I.w_class >= w_class) - to_chat(user, SPAN_WARNING("\The [I] is too big to hide in \the [src]!")) + to_chat(user, SPAN_WARNING("There's not enough space to hide \the [used_item]!")) + else if(used_item.w_class >= w_class) + to_chat(user, SPAN_WARNING("\The [used_item] is too big to hide in \the [src]!")) else if(curamount < 1) to_chat(user, SPAN_WARNING("You can't hide anything if there's no sheets to cover it!")) diff --git a/code/game/objects/structures/benches/bench.dm b/code/game/objects/structures/benches/bench.dm index 30cf502c7213..16ba3b36eceb 100644 --- a/code/game/objects/structures/benches/bench.dm +++ b/code/game/objects/structures/benches/bench.dm @@ -3,7 +3,7 @@ name = "bench" desc = "A simple slatted bench." icon = 'icons/obj/structures/furniture/bench.dmi' - icon_state = ICON_STATE_WORLD + "_standing" + icon_state = ICON_STATE_WORLD + "_preview" color = WOOD_COLOR_GENERIC initial_padding_material = null material = /decl/material/solid/organic/wood/oak diff --git a/code/game/objects/structures/catwalk.dm b/code/game/objects/structures/catwalk.dm index b7186e1926d5..3f5b94ea0716 100644 --- a/code/game/objects/structures/catwalk.dm +++ b/code/game/objects/structures/catwalk.dm @@ -76,9 +76,9 @@ for(var/i = 1 to 4) add_overlay(image(icon, "catwalk[connections ? connections[i] : "0"]", dir = BITFLAG(i-1))) if(plated_tile) - var/image/I = image(icon, "plated") - I.color = plated_tile.color - add_overlay(I) + var/image/overlay_image = image(icon, "plated") + overlay_image.color = plated_tile.color + add_overlay(overlay_image) /obj/structure/catwalk/create_dismantled_products(var/turf/T) . = ..() @@ -109,25 +109,25 @@ /obj/structure/catwalk/attack_robot(var/mob/user) return attack_hand_with_interaction_checks(user) -/obj/structure/catwalk/attackby(obj/item/C, mob/user) +/obj/structure/catwalk/attackby(obj/item/used_item, mob/user) if((. = ..())) return - if(istype(C, /obj/item/gun/energy/plasmacutter)) - var/obj/item/gun/energy/plasmacutter/cutter = C + if(istype(used_item, /obj/item/gun/energy/plasmacutter)) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(cutter.slice(user)) dismantle_structure(user) return TRUE - if(istype(C, /obj/item/stack/tile/mono) && !plated_tile) + if(istype(used_item, /obj/item/stack/tile/mono) && !plated_tile) var/ladder = (locate(/obj/structure/ladder) in loc) if(ladder) to_chat(user, SPAN_WARNING("\The [ladder] is in the way.")) return TRUE - var/obj/item/stack/tile/ST = C + var/obj/item/stack/tile/ST = used_item if(ST.in_use) return TRUE @@ -148,7 +148,7 @@ var/decl/flooring/F = decls[flooring_type] if(!F.build_type) continue - if(istype(C, F.build_type) && (!F.build_material || C.material?.type == F.build_material)) + if(istype(used_item, F.build_type) && (!F.build_material || used_item.material?.type == F.build_material)) plated_tile = F break update_icon() @@ -217,13 +217,13 @@ if(locate(/obj/structure/catwalk) in loc) warning("Frame Spawner: A catwalk already exists at [loc.x]-[loc.y]-[loc.z]") else - var/obj/structure/catwalk/C = new /obj/structure/catwalk(loc) - C.plated_tile += GET_DECL(plating_type) - C.name = "plated catwalk" - C.update_icon() + var/obj/structure/catwalk/catwalk = new /obj/structure/catwalk(loc) + catwalk.plated_tile += GET_DECL(plating_type) + catwalk.name = "plated catwalk" + catwalk.update_icon() activated = 1 for(var/turf/T in orange(src, 1)) - for(var/obj/effect/wallframe_spawn/other in T) + for(var/obj/effect/catwalk_plated/other in T) if(!other.activated) other.activate() /obj/effect/catwalk_plated/dark diff --git a/code/game/objects/structures/chairs/rustic_chairs.dm b/code/game/objects/structures/chairs/rustic_chairs.dm index 840678cb077e..a61ca9b1a171 100644 --- a/code/game/objects/structures/chairs/rustic_chairs.dm +++ b/code/game/objects/structures/chairs/rustic_chairs.dm @@ -5,6 +5,7 @@ material = /decl/material/solid/organic/wood/walnut color = /decl/material/solid/organic/wood/walnut::color user_comfort = -0.5 + buckle_pixel_shift = TRUE // use chair offset /obj/structure/chair/rustic_fancy name_prefix = "fancy" diff --git a/code/game/objects/structures/chairs/wheelchair.dm b/code/game/objects/structures/chairs/wheelchair.dm index 31fb6781e1a7..97b79c15d7af 100644 --- a/code/game/objects/structures/chairs/wheelchair.dm +++ b/code/game/objects/structures/chairs/wheelchair.dm @@ -73,9 +73,9 @@ bloodiness-- /proc/equip_wheelchair(mob/living/human/H) //Proc for spawning in a wheelchair if a new character has no legs. Used in new_player.dm - var/obj/structure/chair/wheelchair/W = new(get_turf(H)) + var/obj/structure/chair/wheelchair/wheelchair = new(get_turf(H)) if(isturf(H.loc)) - W.buckle_mob(H) + wheelchair.buckle_mob(H) /obj/structure/chair/wheelchair/verb/collapse() set name = "Collapse Wheelchair" @@ -136,9 +136,9 @@ user.visible_message("[user] starts to lay out \the [src].") if(do_after(user, 4 SECONDS, src)) - var/obj/structure/chair/wheelchair/W = new structure_form_type(get_turf(user)) - user.visible_message("[user] lays out \the [W].") - W.add_fingerprint(user) + var/obj/structure/chair/wheelchair/wheelchair = new structure_form_type(get_turf(user)) + user.visible_message("[user] lays out \the [wheelchair].") + wheelchair.add_fingerprint(user) qdel(src) /obj/item/wheelchair_kit/physically_destroyed(skip_qdel) diff --git a/code/game/objects/structures/charge_pylon.dm b/code/game/objects/structures/charge_pylon.dm index fd12329b714f..8c504e466205 100644 --- a/code/game/objects/structures/charge_pylon.dm +++ b/code/game/objects/structures/charge_pylon.dm @@ -45,10 +45,10 @@ visible_message("\The [user] has been shocked by \the [src]!") user.throw_at(get_step(user,get_dir(src,user)), 5, 10) -/obj/structure/charge_pylon/attackby(var/obj/item/item, mob/user) - if(!istype(item, /obj/item/grab)) +/obj/structure/charge_pylon/attackby(var/obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/grab)) return FALSE - var/obj/item/grab/grab = item + var/obj/item/grab/grab = used_item var/mob/M = grab.get_affecting_mob() if(M) charge_user(M) diff --git a/code/game/objects/structures/chemistry/heater.dm b/code/game/objects/structures/chemistry/heater.dm index 7050d2f9ee86..bf0c3a573feb 100644 --- a/code/game/objects/structures/chemistry/heater.dm +++ b/code/game/objects/structures/chemistry/heater.dm @@ -75,18 +75,18 @@ if(ismob(new_loc)) visible_message(SPAN_NOTICE("\The [new_loc] removes \the [am] from \the [src].")) -/obj/structure/fire_source/heater/attackby(obj/item/thing, mob/user) +/obj/structure/fire_source/heater/attackby(obj/item/used_item, mob/user) - if(istype(thing, /obj/item/chems/glass) && ATOM_IS_OPEN_CONTAINER(thing)) + if(istype(used_item, /obj/item/chems/glass) && ATOM_IS_OPEN_CONTAINER(used_item)) if(retort && vessel) to_chat(user, SPAN_WARNING("\The [src] is already holding \a [retort] and \a [vessel].")) return TRUE - if(user.try_unequip(thing, src)) + if(user.try_unequip(used_item, src)) if(!retort) - set_retort(thing) + set_retort(used_item) visible_message(SPAN_NOTICE("\The [user] places \the [retort] onto \the [src].")) else if(!vessel) - set_vessel(thing) + set_vessel(used_item) visible_message(SPAN_NOTICE("\The [user] places \the [vessel] under \the [src].")) return TRUE diff --git a/code/game/objects/structures/coathanger.dm b/code/game/objects/structures/coathanger.dm index 3462edc0b082..155a7eeff3dc 100644 --- a/code/game/objects/structures/coathanger.dm +++ b/code/game/objects/structures/coathanger.dm @@ -70,16 +70,16 @@ if(thing.slot_flags & slots_allowed[slot]) return TRUE -/obj/structure/coatrack/attackby(obj/item/W, mob/user) - if(!can_hang(W)) +/obj/structure/coatrack/attackby(obj/item/used_item, mob/user) + if(!can_hang(used_item)) return ..() if(length(contents) >= max_items) - to_chat(user, SPAN_NOTICE("There is no room on \the [src] to hang \the [W].")) + to_chat(user, SPAN_NOTICE("There is no room on \the [src] to hang \the [used_item].")) return TRUE - if(user.try_unequip(W, src)) + if(user.try_unequip(used_item, src)) user.visible_message( \ - SPAN_NOTICE("\The [user] hangs \the [W] on \the [src]."), \ - SPAN_NOTICE("You hang \the [W] on \the [src].") \ + SPAN_NOTICE("\The [user] hangs \the [used_item] on \the [src]."), \ + SPAN_NOTICE("You hang \the [used_item] on \the [src].") \ ) update_icon() return TRUE diff --git a/code/game/objects/structures/compost.dm b/code/game/objects/structures/compost.dm index 407a6d38600d..e8f3c18ec831 100644 --- a/code/game/objects/structures/compost.dm +++ b/code/game/objects/structures/compost.dm @@ -88,28 +88,28 @@ var/global/const/COMPOST_WORM_HUNGER_FACTOR = MINIMUM_CHEMICAL_VOLUME reagents.trans_to(loc, reagents.total_volume) return ..() -/obj/structure/reagent_dispensers/compost_bin/attackby(obj/item/W, mob/user) +/obj/structure/reagent_dispensers/compost_bin/attackby(obj/item/used_item, mob/user) if(user.check_intent(I_FLAG_HARM)) return ..() - if(W.storage) + if(used_item.storage) var/emptied = FALSE - for(var/obj/item/O in W.get_stored_inventory()) + for(var/obj/item/O in used_item.get_stored_inventory()) if(storage.can_be_inserted(O)) - W.storage.remove_from_storage(null, O, loc, skip_update = TRUE) + used_item.storage.remove_from_storage(null, O, loc, skip_update = TRUE) storage.handle_item_insertion(null, O, skip_update = TRUE) emptied = TRUE if(emptied) - W.storage.finish_bulk_removal() + used_item.storage.finish_bulk_removal() storage.update_ui_after_item_insertion() - if(length(W.get_stored_inventory())) - to_chat(user, SPAN_NOTICE("You partially empty \the [W] into \the [src]'s hopper.")) + if(length(used_item.get_stored_inventory())) + to_chat(user, SPAN_NOTICE("You partially empty \the [used_item] into \the [src]'s hopper.")) else - to_chat(user, SPAN_NOTICE("You empty \the [W] into \the [src]'s hopper.")) - W.update_icon() + to_chat(user, SPAN_NOTICE("You empty \the [used_item] into \the [src]'s hopper.")) + used_item.update_icon() return TRUE return ..() @@ -174,15 +174,14 @@ var/global/const/COMPOST_WORM_HUNGER_FACTOR = MINIMUM_CHEMICAL_VOLUME remains.update_primary_material() // Digest reagents. - for(var/mat in reagents.reagent_volumes) - if(ispath(mat, /decl/material/liquid/fertilizer)) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(istype(reagent, /decl/material/liquid/fertilizer)) continue - var/decl/material/material_data = GET_DECL(mat) - if(!material_data.compost_value) + if(!reagent.compost_value) continue - var/clamped_worm_drink_amount = min(round(worm_eat_amount * REAGENT_UNITS_PER_MATERIAL_UNIT), reagents.reagent_volumes[mat]) - reagents.add_reagent(/decl/material/liquid/fertilizer/compost, max(1, round(clamped_worm_drink_amount * material_data.compost_value))) - reagents.remove_reagent(mat, clamped_worm_drink_amount) + var/clamped_worm_drink_amount = min(round(worm_eat_amount * REAGENT_UNITS_PER_MATERIAL_UNIT), reagents.reagent_volumes[reagent]) + reagents.add_reagent(/decl/material/liquid/fertilizer/compost, max(1, round(clamped_worm_drink_amount * reagent.compost_value))) + reagents.remove_reagent(reagent, clamped_worm_drink_amount) break // Grow more worms. diff --git a/code/game/objects/structures/crates_lockers/closets/__closet.dm b/code/game/objects/structures/crates_lockers/closets/__closet.dm index 67dda1ac39ba..9e18b1611a33 100644 --- a/code/game/objects/structures/crates_lockers/closets/__closet.dm +++ b/code/game/objects/structures/crates_lockers/closets/__closet.dm @@ -265,9 +265,9 @@ var/global/list/closets = list() receive_mouse_drop(grab.affecting, user) //act like they were dragged onto the closet return TRUE if(IS_WELDER(used_item)) - var/obj/item/weldingtool/WT = used_item - if(WT.weld(0,user)) - slice_into_parts(WT, user) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0,user)) + slice_into_parts(welder, user) return TRUE if(istype(used_item, /obj/item/gun/energy/plasmacutter)) var/obj/item/gun/energy/plasmacutter/cutter = used_item @@ -315,9 +315,9 @@ var/global/list/closets = list() return FALSE //Return false to get afterattack to be called if(IS_WELDER(used_item) && (setup & CLOSET_CAN_BE_WELDED)) - var/obj/item/weldingtool/WT = used_item - if(!WT.weld(0,user)) - if(WT.isOn()) + var/obj/item/weldingtool/welder = used_item + if(!welder.weld(0,user)) + if(welder.isOn()) to_chat(user, SPAN_NOTICE("You need more welding fuel to complete this task.")) return TRUE welded = !welded @@ -330,10 +330,10 @@ var/global/list/closets = list() return attack_hand_with_interaction_checks(user) -/obj/structure/closet/proc/slice_into_parts(obj/W, mob/user) +/obj/structure/closet/proc/slice_into_parts(obj/item/used_item, mob/user) user.visible_message( - SPAN_NOTICE("\The [src] has been cut apart by [user] with \the [W]."), - SPAN_NOTICE("You have cut \the [src] apart with \the [W]."), + SPAN_NOTICE("\The [src] has been cut apart by [user] with \the [used_item]."), + SPAN_NOTICE("You have cut \the [src] apart with \the [used_item]."), "You hear welding." ) physically_destroyed() diff --git a/code/game/objects/structures/crates_lockers/closets/coffin.dm b/code/game/objects/structures/crates_lockers/closets/coffin.dm index 7b06ff2b19d8..236153f78f39 100644 --- a/code/game/objects/structures/crates_lockers/closets/coffin.dm +++ b/code/game/objects/structures/crates_lockers/closets/coffin.dm @@ -17,8 +17,8 @@ if(locked) return FALSE -/obj/structure/closet/coffin/attackby(obj/item/W, mob/user) - if(!opened && IS_SCREWDRIVER(W)) +/obj/structure/closet/coffin/attackby(obj/item/used_item, mob/user) + if(!opened && IS_SCREWDRIVER(used_item)) to_chat(user, SPAN_NOTICE("You begin screwing [src]'s lid [locked ? "open" : "shut"].")) playsound(src, 'sound/items/Screwdriver.ogg', 100, 1) if(do_after(user, screwdriver_time_needed, src)) diff --git a/code/game/objects/structures/crates_lockers/closets/job_closets.dm b/code/game/objects/structures/crates_lockers/closets/job_closets.dm index 629490936d77..d59af0e46727 100644 --- a/code/game/objects/structures/crates_lockers/closets/job_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/job_closets.dm @@ -43,7 +43,7 @@ /obj/item/clothing/dress/sun, /obj/item/clothing/pants/slacks/black = 2, /obj/item/clothing/shirt/button = 2, - /obj/item/clothing/neck/tie/bow/color/red = 2, + /obj/item/clothing/neck/tie/bow/red = 2, /obj/item/clothing/suit/jacket/vest/blue = 2, /obj/item/radio/headset/headset_service = 2, /obj/item/box/mousetraps = 2, diff --git a/code/game/objects/structures/crates_lockers/closets/secure/_secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/_secure_closets.dm index b18ae84828b6..ff568d29a611 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/_secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/_secure_closets.dm @@ -9,5 +9,5 @@ wall_mounted = 0 //never solid (You can always pass over it) current_health = 200 -/obj/structure/closet/secure_closet/slice_into_parts(obj/item/weldingtool/WT, mob/user) +/obj/structure/closet/secure_closet/slice_into_parts(obj/item/weldingtool/welder, mob/user) to_chat(user, "\The [src] is too strong to be taken apart.") 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 08ba2e29d23b..860f376f6b1f 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/security.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/security.dm @@ -19,7 +19,7 @@ /obj/item/telebaton, /obj/item/clothing/dress/cap, /obj/item/clothing/head/caphat/formal, - /obj/item/clothing/jumpsuit/captainformal, + /obj/item/clothing/costume/captainformal, ) /obj/structure/closet/secure_closet/hop diff --git a/code/game/objects/structures/crates_lockers/closets/statue.dm b/code/game/objects/structures/crates_lockers/closets/statue.dm index 27a6d55f4fce..946821ceff5a 100644 --- a/code/game/objects/structures/crates_lockers/closets/statue.dm +++ b/code/game/objects/structures/crates_lockers/closets/statue.dm @@ -98,10 +98,10 @@ current_health -= 60 / severity check_health() -/obj/structure/closet/statue/attackby(obj/item/I, mob/user) - current_health -= I.expend_attack_force(user) +/obj/structure/closet/statue/attackby(obj/item/used_item, mob/user) + current_health -= used_item.expend_attack_force(user) user.do_attack_animation(src) - visible_message("[user] strikes [src] with [I].") + visible_message("[user] strikes [src] with [used_item].") check_health() return TRUE diff --git a/code/game/objects/structures/crates_lockers/closets/syndicate.dm b/code/game/objects/structures/crates_lockers/closets/syndicate.dm index 6d3bec631ee9..33fd93aa1d48 100644 --- a/code/game/objects/structures/crates_lockers/closets/syndicate.dm +++ b/code/game/objects/structures/crates_lockers/closets/syndicate.dm @@ -33,35 +33,6 @@ new /obj/item/clothing/mask/gas/syndicate(src) new /obj/item/clothing/head/helmet/space/void/merc(src) - -/obj/structure/closet/syndicate/nuclear - desc = "It's a storage unit for nuclear-operative gear." - -/obj/structure/closet/syndicate/nuclear/Initialize() - . = ..() - - new /obj/item/ammo_magazine/smg(src) - new /obj/item/ammo_magazine/smg(src) - new /obj/item/ammo_magazine/smg(src) - new /obj/item/ammo_magazine/smg(src) - new /obj/item/ammo_magazine/smg(src) - new /obj/item/box/handcuffs(src) - new /obj/item/box/flashbangs(src) - new /obj/item/gun/energy/gun(src) - new /obj/item/gun/energy/gun(src) - new /obj/item/gun/energy/gun(src) - new /obj/item/gun/energy/gun(src) - new /obj/item/gun/energy/gun(src) - new /obj/item/pinpointer/nukeop(src) - new /obj/item/pinpointer/nukeop(src) - new /obj/item/pinpointer/nukeop(src) - new /obj/item/pinpointer/nukeop(src) - new /obj/item/pinpointer/nukeop(src) - new /obj/item/modular_computer/pda/mercenary(src) - var/obj/item/radio/uplink/U = new(src) - U.tc_amount = 40 - return - /obj/structure/closet/syndicate/resources desc = "An old, dusty locker." diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index 59d02b4c8c5a..4eaac0b2cc2e 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -9,7 +9,7 @@ var/rigged = 0 /obj/structure/closet/crate/open(mob/user) - if((atom_flags & ATOM_FLAG_CLIMBABLE) && !opened && can_open(user)) + if((atom_flags & ATOM_FLAG_CLIMBABLE) && LAZYLEN(climbers) && !opened && can_open(user)) object_shaken() . = ..() if(.) @@ -32,13 +32,13 @@ devices += A . += "There are some wires attached to the lid, connected to [english_list(devices)]." -/obj/structure/closet/crate/attackby(obj/item/W, mob/user) +/obj/structure/closet/crate/attackby(obj/item/used_item, mob/user) if(opened) return ..() - else if(istype(W, /obj/item/stack/package_wrap)) + else if(istype(used_item, /obj/item/stack/package_wrap)) return FALSE // let afterattack run - else if(istype(W, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/C = W + else if(istype(used_item, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/C = used_item if(rigged) to_chat(user, "[src] is already rigged!") return TRUE @@ -47,12 +47,12 @@ rigged = 1 return TRUE return FALSE - else if((istype(W, /obj/item/assembly_holder) || istype(W, /obj/item/assembly)) && rigged) - if(!user.try_unequip(W, src)) + else if((istype(used_item, /obj/item/assembly_holder) || istype(used_item, /obj/item/assembly)) && rigged) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, "You attach [W] to [src].") + to_chat(user, "You attach [used_item] to [src].") return TRUE - else if(IS_WIRECUTTER(W)) + else if(IS_WIRECUTTER(used_item)) if(rigged) to_chat(user, "You cut away the wiring.") playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1) diff --git a/code/game/objects/structures/crates_lockers/largecrate.dm b/code/game/objects/structures/crates_lockers/largecrate.dm index 4e4e37090ac1..2ed4e74f0b4e 100644 --- a/code/game/objects/structures/crates_lockers/largecrate.dm +++ b/code/game/objects/structures/crates_lockers/largecrate.dm @@ -20,8 +20,8 @@ to_chat(user, SPAN_WARNING("You need a crowbar to pry this open!")) return TRUE -/obj/structure/largecrate/attackby(obj/item/W, mob/user) - if(IS_CROWBAR(W)) +/obj/structure/largecrate/attackby(obj/item/used_item, mob/user) + if(IS_CROWBAR(used_item)) user.visible_message( SPAN_NOTICE("\The [user] pries \the [src] open."), SPAN_NOTICE("You pry open \the [src]."), diff --git a/code/game/objects/structures/curtains.dm b/code/game/objects/structures/curtains.dm index 4e1bafbf36eb..0ef9f5dfbce3 100644 --- a/code/game/objects/structures/curtains.dm +++ b/code/game/objects/structures/curtains.dm @@ -23,8 +23,8 @@ matter = atom_info_repository.get_matter_for(/obj/structure/curtain, kind.material_key) update_icon() -/obj/item/curtain/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/curtain/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) if(!curtain_kind_path) return TRUE @@ -110,8 +110,8 @@ return TRUE return ..() -/obj/structure/curtain/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W) && curtain_kind_path) +/obj/structure/curtain/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item) && curtain_kind_path) user.visible_message( SPAN_NOTICE("\The [user] begins uninstalling \the [src]."), SPAN_NOTICE("You begin uninstalling \the [src].")) diff --git a/code/game/objects/structures/defensive_barrier.dm b/code/game/objects/structures/defensive_barrier.dm index 97b999566c0b..889d3a94bdff 100644 --- a/code/game/objects/structures/defensive_barrier.dm +++ b/code/game/objects/structures/defensive_barrier.dm @@ -127,9 +127,9 @@ update_icon() return TRUE -/obj/structure/defensive_barrier/attackby(obj/item/W, mob/user) +/obj/structure/defensive_barrier/attackby(obj/item/used_item, mob/user) - if(IS_SCREWDRIVER(W) && density) + if(IS_SCREWDRIVER(used_item) && density) user.visible_message(SPAN_NOTICE("\The [user] begins to [secured ? "secure" : "unsecure"] \the [src]...")) playsound(src, 'sound/items/Screwdriver.ogg', 100, 1) if(!do_after(user, 30, src)) @@ -199,9 +199,9 @@ user.drop_from_inventory(src) qdel(src) -/obj/item/defensive_barrier/attackby(obj/item/W, mob/user) - if(stored_health < stored_max_health && IS_WELDER(W)) - if(W.do_tool_interaction(TOOL_WELDER, user, src, \ +/obj/item/defensive_barrier/attackby(obj/item/used_item, mob/user) + if(stored_health < stored_max_health && IS_WELDER(used_item)) + if(used_item.do_tool_interaction(TOOL_WELDER, user, src, \ max(5, round((stored_max_health-stored_health) / 5)), \ "repairing the damage to", "repairing the damage to", \ "You fail to patch the damage to \the [src].", \ diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 06455c87a1fc..2223ada43936 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -92,9 +92,9 @@ for(var/atom/movable/AM in contents) underlays += AM.appearance -/obj/structure/displaycase/attackby(obj/item/W, mob/user) +/obj/structure/displaycase/attackby(obj/item/used_item, mob/user) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - var/obj/item/card/id/id = W.GetIdCard() + var/obj/item/card/id/id = used_item.GetIdCard() if(istype(id)) if(allowed(user)) locked = !locked @@ -103,13 +103,13 @@ to_chat(user, "\The [src]'s card reader denies you access.") return TRUE - if(isitem(W) && (!locked || destroyed)) - if(!W.simulated || W.anchored) + if(isitem(used_item) && (!locked || destroyed)) + if(!used_item.simulated || used_item.anchored) return FALSE - if(user.try_unequip(W, src)) - W.pixel_x = 0 - W.pixel_y = -7 + if(user.try_unequip(used_item, src)) + used_item.pixel_x = 0 + used_item.pixel_y = -7 update_icon() return TRUE . = ..() diff --git a/code/game/objects/structures/divider.dm b/code/game/objects/structures/divider.dm index d0cb78e85dfd..0ead2c654980 100644 --- a/code/game/objects/structures/divider.dm +++ b/code/game/objects/structures/divider.dm @@ -20,6 +20,11 @@ material = /decl/material/solid/organic/wood/oak color = /decl/material/solid/organic/wood/oak::color + +/obj/structure/divider/extended/wood/ebony + material = /decl/material/solid/organic/wood/ebony + color = /decl/material/solid/organic/wood/ebony::color + /obj/structure/divider/attack_hand(mob/user) if(user.check_intent(I_FLAG_HELP) && user.check_dexterity(DEXTERITY_SIMPLE_MACHINES, silent = TRUE)) extended = !extended diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index 9aba1e77c074..cf7af2c01748 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -123,9 +123,9 @@ icon_state = "shutter1" airlock_type = /obj/machinery/door/blast/shutters -/obj/structure/door_assembly/attackby(obj/item/W, mob/user) +/obj/structure/door_assembly/attackby(obj/item/used_item, mob/user) - if(IS_PEN(W)) + if(IS_PEN(used_item)) var/t = sanitize_safe(input(user, "Enter the name for the door.", src.name, src.created_name), MAX_NAME_LEN) if(!length(t)) return TRUE @@ -135,9 +135,9 @@ created_name = t return TRUE - if(IS_WELDER(W) && (glass == 1 || !anchored)) - var/obj/item/weldingtool/WT = W - if (WT.weld(0, user)) + if(IS_WELDER(used_item) && (glass == 1 || !anchored)) + var/obj/item/weldingtool/welder = used_item + if (welder.weld(0, user)) playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) if(glass == 1) var/decl/material/glass_material_datum = GET_DECL(glass_material) @@ -145,7 +145,7 @@ var/mat_name = glass_material_datum.solid_name || glass_material_datum.name user.visible_message("[user] welds the [mat_name] plating off the airlock assembly.", "You start to weld the [mat_name] plating off the airlock assembly.") if(do_after(user, 4 SECONDS, src)) - if(!WT.isOn()) + if(!welder.isOn()) return TRUE to_chat(user, "You welded the [mat_name] plating off!") glass_material_datum.create_object(get_turf(src), 2) @@ -155,7 +155,7 @@ if(!anchored) user.visible_message("[user] dissassembles the airlock assembly.", "You start to dissassemble the airlock assembly.") if(do_after(user, 4 SECONDS, src)) - if(!WT.isOn()) + if(!welder.isOn()) return TRUE to_chat(user, "You dissasembled the airlock assembly!") dismantle_structure(user) @@ -164,7 +164,7 @@ to_chat(user, "You need more welding fuel.") return TRUE - if(IS_WRENCH(W) && state == 0) + if(IS_WRENCH(used_item) && state == 0) playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1) if(anchored) user.visible_message("[user] begins unsecuring the airlock assembly from the floor.", "You begin unsecuring the airlock assembly from the floor.") @@ -179,8 +179,8 @@ return TRUE - else if(IS_COIL(W) && state == 0 && anchored) - var/obj/item/stack/cable_coil/C = W + else if(IS_COIL(used_item) && state == 0 && anchored) + var/obj/item/stack/cable_coil/C = used_item if (C.get_amount() < 1) to_chat(user, "You need one length of coil to wire the airlock assembly.") return TRUE @@ -192,7 +192,7 @@ update_icon() return TRUE - else if(IS_WIRECUTTER(W) && state == 1 ) + else if(IS_WIRECUTTER(used_item) && state == 1 ) playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1) user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.") @@ -204,8 +204,8 @@ update_icon() return TRUE - else if(istype(W, /obj/item/stock_parts/circuitboard/airlock_electronics) && state == 1) - var/obj/item/stock_parts/circuitboard/airlock_electronics/E = W + else if(istype(used_item, /obj/item/stock_parts/circuitboard/airlock_electronics) && state == 1) + var/obj/item/stock_parts/circuitboard/airlock_electronics/E = used_item if(!ispath(airlock_type, E.build_path)) return FALSE playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1) @@ -213,16 +213,16 @@ if(do_after(user, 40,src)) if(QDELETED(src)) return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE to_chat(user, "You installed the airlock electronics!") src.state = 2 src.SetName("Near finished Airlock Assembly") - src.electronics = W + src.electronics = used_item update_icon() return TRUE - else if(IS_CROWBAR(W) && state == 2 ) + else if(IS_CROWBAR(used_item) && state == 2 ) //This should never happen, but just in case I guess if (!electronics) to_chat(user, "There was nothing to remove.") @@ -243,8 +243,8 @@ update_icon() return TRUE - else if(istype(W, /obj/item/stack/material) && !glass) - var/obj/item/stack/material/S = W + else if(istype(used_item, /obj/item/stack/material) && !glass) + var/obj/item/stack/material/S = used_item var/material_name = S.get_material_type() if (S.get_amount() >= 2) playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1) @@ -258,7 +258,7 @@ return TRUE return FALSE - else if(IS_SCREWDRIVER(W) && state == 2 ) + else if(IS_SCREWDRIVER(used_item) && state == 2 ) playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1) to_chat(user, "Now finishing the airlock.") diff --git a/code/game/objects/structures/drain.dm b/code/game/objects/structures/drain.dm index 3b8e57ce9f49..66cdf42b45e0 100644 --- a/code/game/objects/structures/drain.dm +++ b/code/game/objects/structures/drain.dm @@ -16,17 +16,17 @@ if(welded) . += "It is welded shut." -/obj/structure/hygiene/drain/attackby(var/obj/item/thing, var/mob/user) - if(IS_WELDER(thing)) - var/obj/item/weldingtool/WT = thing - if(WT.isOn()) +/obj/structure/hygiene/drain/attackby(var/obj/item/used_item, var/mob/user) + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(welder.isOn()) welded = !welded to_chat(user, "You weld \the [src] [welded ? "closed" : "open"].") else - to_chat(user, "Turn \the [thing] on, first.") + to_chat(user, "Turn \the [used_item] on, first.") update_icon() return TRUE - if(IS_WRENCH(thing)) + if(IS_WRENCH(used_item)) new /obj/item/drain(src.loc) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) to_chat(user, "[user] unwrenches \the [src].") @@ -52,8 +52,8 @@ material = /decl/material/solid/metal/brass var/constructed_type = /obj/structure/hygiene/drain -/obj/item/drain/attackby(var/obj/item/thing, var/mob/user) - if(IS_WRENCH(thing)) +/obj/item/drain/attackby(var/obj/item/used_item, var/mob/user) + if(IS_WRENCH(used_item)) new constructed_type(get_turf(src)) playsound(src, 'sound/items/Ratchet.ogg', 50, 1) to_chat(user, SPAN_NOTICE("\The [user] wrenches \the [src] down.")) diff --git a/code/game/objects/structures/drying_rack.dm b/code/game/objects/structures/drying_rack.dm index 6bfacec89299..3feffa51de95 100644 --- a/code/game/objects/structures/drying_rack.dm +++ b/code/game/objects/structures/drying_rack.dm @@ -4,11 +4,13 @@ icon = 'icons/obj/drying_rack.dmi' icon_state = ICON_STATE_WORLD material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC var/obj/item/drying /obj/structure/drying_rack/ebony material = /decl/material/solid/organic/wood/ebony + color = /decl/material/solid/organic/wood/ebony::color /obj/structure/drying_rack/Destroy() QDEL_NULL(drying) @@ -54,12 +56,12 @@ if(drying_state) add_overlay(drying_state) -/obj/structure/drying_rack/attackby(var/obj/item/W, var/mob/user) +/obj/structure/drying_rack/attackby(var/obj/item/used_item, var/mob/user) - if(!drying && W.is_dryable()) - if(user.try_unequip(W)) - W.forceMove(src) - drying = W + if(!drying && used_item.is_dryable()) + if(user.try_unequip(used_item)) + used_item.forceMove(src) + drying = used_item if(!is_processing) START_PROCESSING(SSobj, src) update_icon() diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 768fe81af7f1..79cd15f429fc 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -16,13 +16,13 @@ // TODO: I wanted to make it so you had to actually use your hand to open it if it's closed, but // that'd be out of scope for just an attackby audit. Someone fix this so it can call parent please. -/obj/structure/extinguisher_cabinet/attackby(obj/item/O, mob/user) +/obj/structure/extinguisher_cabinet/attackby(obj/item/used_item, mob/user) if(isrobot(user)) return FALSE - if(istype(O, /obj/item/chems/spray/extinguisher)) - if(!has_extinguisher && opened && user.try_unequip(O, src)) - has_extinguisher = O - to_chat(user, "You place [O] in [src].") + if(istype(used_item, /obj/item/chems/spray/extinguisher)) + if(!has_extinguisher && opened && user.try_unequip(used_item, src)) + has_extinguisher = used_item + to_chat(user, "You place [used_item] in [src].") playsound(src.loc, 'sound/effects/extin.ogg', 50, 0) else opened = !opened diff --git a/code/game/objects/structures/fences.dm b/code/game/objects/structures/fences.dm index 8a127ce484fe..05eb791fb898 100644 --- a/code/game/objects/structures/fences.dm +++ b/code/game/objects/structures/fences.dm @@ -77,8 +77,8 @@ return TRUE return ..() -/obj/structure/fence/handle_repair(mob/user, obj/item/tool) - var/obj/item/stack/stack = tool +/obj/structure/fence/handle_repair(mob/user, obj/item/used_item) + var/obj/item/stack/stack = used_item if(hole_size > NO_HOLE && istype(stack)) to_chat(user, SPAN_NOTICE("You fit [stack.get_string_for_amount(1)] to damaged areas of \the [src].")) stack.use(1) @@ -88,8 +88,8 @@ return ..() -/obj/structure/fence/attackby(obj/item/tool, mob/user) - if(IS_WIRECUTTER(tool)) +/obj/structure/fence/attackby(obj/item/used_item, mob/user) + if(IS_WIRECUTTER(used_item)) if(!cuttable) to_chat(user, SPAN_WARNING("This section of the fence can't be cut.")) return TRUE @@ -98,7 +98,7 @@ to_chat(user, SPAN_NOTICE("This fence has too much cut out of it already.")) return TRUE - if(tool.do_tool_interaction(TOOL_WIRECUTTERS, user, src, CUT_TIME, "cutting through", "cutting through", check_skill = FALSE) && current_stage == hole_size) // do_tool_interaction sleeps, so make sure it hasn't been cut more while we waited + if(used_item.do_tool_interaction(TOOL_WIRECUTTERS, user, src, CUT_TIME, "cutting through", "cutting through", check_skill = FALSE) && current_stage == hole_size) // do_tool_interaction sleeps, so make sure it hasn't been cut more while we waited switch(++hole_size) if(MEDIUM_HOLE) user.visible_message( diff --git a/code/game/objects/structures/fireaxe_cabinet.dm b/code/game/objects/structures/fireaxe_cabinet.dm index ec563ffce7e7..dc52f5b61153 100644 --- a/code/game/objects/structures/fireaxe_cabinet.dm +++ b/code/game/objects/structures/fireaxe_cabinet.dm @@ -64,29 +64,29 @@ fireaxe = null . = ..() -/obj/structure/fireaxecabinet/attackby(var/obj/item/O, var/mob/user) +/obj/structure/fireaxecabinet/attackby(var/obj/item/used_item, var/mob/user) - if(IS_MULTITOOL(O)) + if(IS_MULTITOOL(used_item)) toggle_lock(user) return TRUE - if(istype(O, /obj/item/bladed/axe/fire)) + if(istype(used_item, /obj/item/bladed/axe/fire)) if(open) if(fireaxe) to_chat(user, "There is already \a [fireaxe] inside \the [src].") - else if(user.try_unequip(O)) - O.forceMove(src) - fireaxe = O + else if(user.try_unequip(used_item)) + used_item.forceMove(src) + fireaxe = used_item to_chat(user, "You place \the [fireaxe] into \the [src].") update_icon() return TRUE - var/force = O.expend_attack_force(user) + var/force = used_item.expend_attack_force(user) if(force) user.setClickCooldown(10) attack_animation(user) playsound(user, 'sound/effects/Glasshit.ogg', 50, 1) - visible_message("[user] [pick(O.attack_verb)] \the [src]!") + visible_message("[user] [used_item.pick_attack_verb()] \the [src]!") if(damage_threshold > force) to_chat(user, "Your strike is deflected by the reinforced glass!") return TRUE diff --git a/code/game/objects/structures/fires.dm b/code/game/objects/structures/fires.dm index 2c7dbb75097f..6f4821ea174c 100644 --- a/code/game/objects/structures/fires.dm +++ b/code/game/objects/structures/fires.dm @@ -277,36 +277,36 @@ environment.adjust_gas(w, waste[w], FALSE) environment.update_values() -/obj/structure/fire_source/attackby(var/obj/item/thing, var/mob/user) +/obj/structure/fire_source/attackby(var/obj/item/used_item, var/mob/user) // Gate a few interactions behind intent so they can be bypassed if needed. if(!user.check_intent(I_FLAG_HARM)) // Put cooking items onto the fire source. - if(istype(thing, /obj/item/chems/cooking_vessel) && user.try_unequip(thing, get_turf(src))) - thing.reset_offsets() + if(istype(used_item, /obj/item/chems/cooking_vessel) && user.try_unequip(used_item, get_turf(src))) + used_item.reset_offsets() return TRUE // Pour fuel or water into a fire. - if(istype(thing, /obj/item/chems)) - var/obj/item/chems/chems = thing + if(istype(used_item, /obj/item/chems)) + var/obj/item/chems/chems = used_item if(chems.standard_pour_into(user, src)) return TRUE - if(lit == FIRE_LIT && istype(thing, /obj/item/flame)) - thing.fire_act(return_air(), get_effective_burn_temperature(), 500) + if(lit == FIRE_LIT && istype(used_item, /obj/item/flame)) + used_item.fire_act(return_air(), get_effective_burn_temperature(), 500) return TRUE - if(thing.isflamesource()) - visible_message(SPAN_NOTICE("\The [user] attempts to light \the [src] with \the [thing].")) - try_light(thing.get_heat()) + if(used_item.isflamesource()) + visible_message(SPAN_NOTICE("\The [user] attempts to light \the [src] with \the [used_item].")) + try_light(used_item.get_heat()) return TRUE if((lit != FIRE_LIT || user.check_intent(I_FLAG_HARM))) // Only drop in one log at a time. - if(istype(thing, /obj/item/stack)) - var/obj/item/stack/stack = thing - thing = stack.split(1) - if(!QDELETED(thing) && user.try_unequip(thing, src)) - user.visible_message(SPAN_NOTICE("\The [user] drops \the [thing] into \the [src].")) + if(istype(used_item, /obj/item/stack)) + var/obj/item/stack/stack = used_item + used_item = stack.split(1) + if(!QDELETED(used_item) && user.try_unequip(used_item, src)) + user.visible_message(SPAN_NOTICE("\The [user] drops \the [used_item] into \the [src].")) update_icon() return TRUE @@ -366,13 +366,12 @@ var/do_steam = FALSE var/list/waste = list() - for(var/rtype in reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in reagents?.reagent_volumes) - var/decl/material/reagent = GET_DECL(rtype) if(reagent.accelerant_value <= FUEL_VALUE_SUPPRESSANT && !isnull(reagent.boiling_point) && reagent.boiling_point < get_effective_burn_temperature()) do_steam = TRUE - var/volume = NONUNIT_CEILING(REAGENT_VOLUME(reagents, rtype) / REAGENT_UNITS_PER_GAS_MOLE, 0.1) + var/volume = NONUNIT_CEILING(REAGENT_VOLUME(reagents, reagent) / REAGENT_UNITS_PER_GAS_MOLE, 0.1) var/list/waste_products = burn_material(reagent, volume) if(!isnull(waste_products)) for(var/product in waste_products) diff --git a/code/game/objects/structures/fishtanks.dm b/code/game/objects/structures/fishtanks.dm index f11786c8c397..313c92a5ccd7 100644 --- a/code/game/objects/structures/fishtanks.dm +++ b/code/game/objects/structures/fishtanks.dm @@ -70,10 +70,10 @@ var/global/list/fishtank_cache = list() visible_message(SPAN_NOTICE("\The [user] taps on \the [src].")) return TRUE -/obj/structure/glass_tank/attackby(var/obj/item/W, var/mob/user) - if(W.get_attack_force(user) < 5 || !user.check_intent(I_FLAG_HARM)) +/obj/structure/glass_tank/attackby(var/obj/item/used_item, var/mob/user) + if(used_item.get_attack_force(user) < 5 || !user.check_intent(I_FLAG_HARM)) attack_animation(user) - visible_message(SPAN_NOTICE("\The [user] taps \the [src] with \the [W].")) + visible_message(SPAN_NOTICE("\The [user] taps \the [src] with \the [used_item].")) else . = ..() diff --git a/code/game/objects/structures/fitness.dm b/code/game/objects/structures/fitness.dm index 6cbc033c7a37..f467fab29b45 100644 --- a/code/game/objects/structures/fitness.dm +++ b/code/game/objects/structures/fitness.dm @@ -42,8 +42,8 @@ var/list/success_message = list("with great effort", "straining hard", "without any trouble", "with ease") var/list/fail_message = list(", lifting them part of the way and then letting them drop", ", unable to even budge them") -/obj/structure/fitness/weightlifter/attackby(obj/item/W, mob/user) - if(IS_WRENCH(W)) +/obj/structure/fitness/weightlifter/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item)) playsound(src.loc, 'sound/items/Deconstruct.ogg', 75, 1) weight = (weight % max_weight) + 1 to_chat(user, "You set the machine's weight level to [weight].") diff --git a/code/game/objects/structures/flaps.dm b/code/game/objects/structures/flaps.dm index 3208d09cc814..b3b305a9f946 100644 --- a/code/game/objects/structures/flaps.dm +++ b/code/game/objects/structures/flaps.dm @@ -41,14 +41,14 @@ return ..() -/obj/structure/flaps/attackby(obj/item/W, mob/user) - if(IS_CROWBAR(W) && !anchored) +/obj/structure/flaps/attackby(obj/item/used_item, mob/user) + if(IS_CROWBAR(used_item) && !anchored) user.visible_message("\The [user] begins deconstructing \the [src].", "You start deconstructing \the [src].") if(user.do_skilled(3 SECONDS, SKILL_CONSTRUCTION, src)) user.visible_message("\The [user] deconstructs \the [src].", "You deconstruct \the [src].") qdel(src) return TRUE - if(IS_SCREWDRIVER(W) && anchored) + if(IS_SCREWDRIVER(used_item) && anchored) airtight = !airtight airtight ? become_airtight() : clear_airtight() user.visible_message("\The [user] adjusts \the [src], [airtight ? "preventing" : "allowing"] air flow.") diff --git a/code/game/objects/structures/flora/_flora.dm b/code/game/objects/structures/flora/_flora.dm index c38361f4a845..a7bcda669ec2 100644 --- a/code/game/objects/structures/flora/_flora.dm +++ b/code/game/objects/structures/flora/_flora.dm @@ -25,16 +25,16 @@ clear_materials() return ..() -/obj/structure/flora/attackby(obj/item/O, mob/user) - if(!user.check_intent(I_FLAG_HARM) && can_cut_down(O, user)) +/obj/structure/flora/attackby(obj/item/used_item, mob/user) + if(!user.check_intent(I_FLAG_HARM) && can_cut_down(used_item, user)) play_cut_sound(user) - cut_down(O, user) + cut_down(used_item, user) return TRUE . = ..() /**Whether the item used by user can cause cut_down to be called. Used to bypass default attack proc for some specific items/tools. */ -/obj/structure/flora/proc/can_cut_down(var/obj/item/I, var/mob/user) - return (I.expend_attack_force(user) >= 5) && I.is_sharp() //Anything sharp and relatively strong can cut us instantly +/obj/structure/flora/proc/can_cut_down(var/obj/item/used_item, var/mob/user) + return (used_item.expend_attack_force(user) >= 5) && used_item.is_sharp() //Anything sharp and relatively strong can cut us instantly /**What to do when the can_cut_down check returns true. Normally simply calls dismantle. */ /obj/structure/flora/proc/play_cut_sound(mob/user) @@ -42,7 +42,7 @@ if(snd_cut) playsound(src, snd_cut, 40, TRUE) -/obj/structure/flora/proc/cut_down(var/obj/item/I, var/mob/user) +/obj/structure/flora/proc/cut_down(var/obj/item/used_item, var/mob/user) dismantle_structure(user) return TRUE @@ -74,3 +74,4 @@ icon = 'icons/effects/decals/plant_remains.dmi' icon_state = "leafy_bits" cleanable_scent = "freshly cut plants" + sweepable = TRUE diff --git a/code/game/objects/structures/flora/plant.dm b/code/game/objects/structures/flora/plant.dm index 02ccd36a6567..9e44f55a2f3a 100644 --- a/code/game/objects/structures/flora/plant.dm +++ b/code/game/objects/structures/flora/plant.dm @@ -73,15 +73,15 @@ reset_color() set_overlays(plant.get_appearance(dead = dead, growth_stage = growth_stage, can_harvest = !!harvestable)) -/obj/structure/flora/plant/attackby(obj/item/O, mob/user) +/obj/structure/flora/plant/attackby(obj/item/used_item, mob/user) - if(IS_SHOVEL(O) || IS_HATCHET(O)) - user.visible_message(SPAN_NOTICE("\The [user] uproots \the [src] with \the [O]!")) + if(IS_SHOVEL(used_item) || IS_HATCHET(used_item)) + user.visible_message(SPAN_NOTICE("\The [user] uproots \the [src] with \the [used_item]!")) physically_destroyed() return TRUE // Hydrotray boilerplate for taking samples. - if(O.has_edge() && O.w_class < ITEM_SIZE_NORMAL && !user.check_intent(I_FLAG_HARM)) + if(used_item.has_edge() && used_item.w_class < ITEM_SIZE_NORMAL && !user.check_intent(I_FLAG_HARM)) if(sampled) to_chat(user, SPAN_WARNING("There's no bits that can be used for a sampling left.")) return TRUE diff --git a/code/game/objects/structures/fountain.dm b/code/game/objects/structures/fountain.dm index c92c9d360b1f..f596d169c6e0 100644 --- a/code/game/objects/structures/fountain.dm +++ b/code/game/objects/structures/fountain.dm @@ -85,6 +85,22 @@ used = TRUE desc = "The water flows beautifully from the spout, but the water in the pool does not ripple." +/mob/living/human + /// Used by the Fountain of Youth point of interest for on-examine messages. + var/became_older + /// Used by the Fountain of Youth point of interest for on-examine messages. + var/became_younger + +/decl/human_examination/fountain + priority = /decl/human_examination/graffiti::priority + 0.5 // just squeeze it in there + +/decl/human_examination/fountain/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + . = list() + if(source.became_younger) + . += "[pronouns.He] look[pronouns.s] a lot younger than you remember." + if(source.became_older) + . += "[pronouns.He] look[pronouns.s] a lot older than you remember." + /obj/structure/fountain/mundane name = "fountain" desc = "A beautifully constructed fountain." diff --git a/code/game/objects/structures/fuel_port.dm b/code/game/objects/structures/fuel_port.dm index 91eef126f0bb..6488d9972ad2 100644 --- a/code/game/objects/structures/fuel_port.dm +++ b/code/game/objects/structures/fuel_port.dm @@ -51,9 +51,9 @@ else add_overlay("[icon_state]_closed") -/obj/structure/fuel_port/attackby(obj/item/W, mob/user) +/obj/structure/fuel_port/attackby(obj/item/used_item, mob/user) . = FALSE - if(W.do_tool_interaction(TOOL_CROWBAR, user, src, 1 SECOND)) + if(used_item.do_tool_interaction(TOOL_CROWBAR, user, src, 1 SECOND)) if(open) playsound(src, sound_open, 25, 0, -3) open = FALSE @@ -62,7 +62,7 @@ open = TRUE . = TRUE - else if(istype(W, /obj/item/tank)) + else if(istype(used_item, /obj/item/tank)) if(!open) to_chat(user, SPAN_WARNING("\The [src] door is still closed!")) return TRUE @@ -71,7 +71,7 @@ to_chat(user, SPAN_WARNING("\The [src] already has a tank inside!")) return TRUE else - user.try_unequip(W, src) + user.try_unequip(used_item, src) . = TRUE if(.) diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index a82c4c7733da..d168182cdcc2 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -92,37 +92,37 @@ return FALSE . = ..() -/obj/structure/girder/attackby(var/obj/item/W, var/mob/user) +/obj/structure/girder/attackby(var/obj/item/used_item, var/mob/user) // Other methods of quickly destroying a girder. - if(W.is_special_cutting_tool(TRUE)) - if(istype(W, /obj/item/gun/energy/plasmacutter)) - var/obj/item/gun/energy/plasmacutter/cutter = W + if(used_item.is_special_cutting_tool(TRUE)) + if(istype(used_item, /obj/item/gun/energy/plasmacutter)) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(!cutter.slice(user)) return TRUE playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) - visible_message(SPAN_NOTICE("\The [user] begins slicing apart \the [src] with \the [W].")) + visible_message(SPAN_NOTICE("\The [user] begins slicing apart \the [src] with \the [used_item].")) if(do_after(user,reinf_material ? 40: 20,src)) - visible_message(SPAN_NOTICE("\The [user] slices apart \the [src] with \the [W].")) + visible_message(SPAN_NOTICE("\The [user] slices apart \the [src] with \the [used_item].")) dismantle_structure(user) return TRUE - if(IS_PICK(W)) - if(W.material?.hardness < material.hardness) - to_chat(user, SPAN_WARNING("\The [W] is not hard enough to excavate [material.solid_name].")) - else if(W.get_tool_quality(TOOL_PICK) < TOOL_QUALITY_GOOD) - to_chat(user, SPAN_WARNING("\The [W] is not capable of destroying \the [src].")) - else if(W.do_tool_interaction(TOOL_PICK, user, src, (reinf_material ? 6 : 4) SECONDS, set_cooldown = TRUE)) + if(IS_PICK(used_item)) + if(used_item.material?.hardness < material.hardness) + to_chat(user, SPAN_WARNING("\The [used_item] is not hard enough to excavate [material.solid_name].")) + else if(used_item.get_tool_quality(TOOL_PICK) < TOOL_QUALITY_GOOD) + to_chat(user, SPAN_WARNING("\The [used_item] is not capable of destroying \the [src].")) + else if(used_item.do_tool_interaction(TOOL_PICK, user, src, (reinf_material ? 6 : 4) SECONDS, set_cooldown = TRUE)) dismantle_structure(user) return TRUE // Reinforcing a girder, or turning it into a wall. - if(istype(W, /obj/item/stack/material)) + if(istype(used_item, /obj/item/stack/material)) if(anchored) - return construct_wall(W, user) + return construct_wall(used_item, user) else if(reinf_material) to_chat(user, SPAN_WARNING("\The [src] is already reinforced with [reinf_material.solid_name].")) else - return reinforce_with_material(W, user) + return reinforce_with_material(used_item, user) return TRUE . = ..() diff --git a/code/game/objects/structures/grandfather_clock.dm b/code/game/objects/structures/grandfather_clock.dm index 24882cb59e6c..49f4b63c22b7 100644 --- a/code/game/objects/structures/grandfather_clock.dm +++ b/code/game/objects/structures/grandfather_clock.dm @@ -8,6 +8,7 @@ density = TRUE material = /decl/material/solid/organic/wood/mahogany material_alteration = MAT_FLAG_ALTERATION_ALL + color = /decl/material/solid/organic/wood/mahogany::color var/face_color = "#f0edc7" var/last_time var/decl/material/clockwork_mat = /decl/material/solid/metal/brass diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index f1717f3be263..2577519149b1 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -166,13 +166,13 @@ parts_amount = 1 update_icon() -/obj/structure/grille/attackby(obj/item/W, mob/user) - if(IS_WIRECUTTER(W)) +/obj/structure/grille/attackby(obj/item/used_item, mob/user) + if(IS_WIRECUTTER(used_item)) if(!material.conductive || !shock(user, 100)) cut_grille() return TRUE - if((IS_SCREWDRIVER(W))) + if((IS_SCREWDRIVER(used_item))) var/turf/turf = loc if(((istype(turf) && turf.simulated) || anchored)) if(!shock(user, 90)) @@ -187,8 +187,8 @@ return TRUE //window placing - if(istype(W,/obj/item/stack/material)) - var/obj/item/stack/material/ST = W + if(istype(used_item,/obj/item/stack/material)) + var/obj/item/stack/material/ST = used_item if(ST.material.opacity > 0.7) return FALSE @@ -204,15 +204,15 @@ place_window(user, loc, dir_to_set, ST) return TRUE - if(!(W.obj_flags & OBJ_FLAG_CONDUCTIBLE) || !shock(user, 70)) + if(!(used_item.obj_flags & OBJ_FLAG_CONDUCTIBLE) || !shock(user, 70)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) user.do_attack_animation(src) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) - switch(W.atom_damage_type) + switch(used_item.atom_damage_type) if(BURN) - take_damage(W.expend_attack_force(user)) + take_damage(used_item.expend_attack_force(user)) if(BRUTE) - take_damage(W.expend_attack_force(user) * 0.1) + take_damage(used_item.expend_attack_force(user) * 0.1) return TRUE return ..() diff --git a/code/game/objects/structures/hand_cart.dm b/code/game/objects/structures/hand_cart.dm index e87082ef4650..33b352889f37 100644 --- a/code/game/objects/structures/hand_cart.dm +++ b/code/game/objects/structures/hand_cart.dm @@ -20,7 +20,7 @@ underlays += "cart_wheel" var/image/I = image(icon, "handcart_layer_north") I.layer = STRUCTURE_LAYER + 0.02 - I.color = BlendRGB(color, material.color, 0.5) + I.color = BlendHSV(color, material.color, 0.5) add_overlay(I) if(carrying) var/image/CA = image(carrying.icon, carrying.icon_state) diff --git a/code/game/objects/structures/hay.dm b/code/game/objects/structures/hay.dm index 47fa6ac32056..71f6c73a0647 100644 --- a/code/game/objects/structures/hay.dm +++ b/code/game/objects/structures/hay.dm @@ -44,6 +44,7 @@ icon = 'icons/obj/structures/haystack.dmi' icon_state = ICON_STATE_WORLD material = /decl/material/solid/organic/plantmatter/grass/dry + color = /decl/material/solid/organic/plantmatter/grass/dry::color storage = /datum/storage/haystack material_alteration = MAT_FLAG_ALTERATION_COLOR atom_flags = ATOM_FLAG_CLIMBABLE diff --git a/code/game/objects/structures/holosigns.dm b/code/game/objects/structures/holosigns.dm index 5e9ace14110d..d0c2b590a36f 100644 --- a/code/game/objects/structures/holosigns.dm +++ b/code/game/objects/structures/holosigns.dm @@ -25,8 +25,8 @@ deactivate(user) return TRUE -/obj/structure/holosign/attackby(obj/W, mob/user) - visible_message(SPAN_NOTICE("\The [user] waves \a [W] through \the [src], causing it to dissipate.")) +/obj/structure/holosign/attackby(obj/item/used_item, mob/user) + visible_message(SPAN_NOTICE("\The [user] waves \a [used_item] through \the [src], causing it to dissipate.")) deactivate(user) return TRUE diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm index 6963ec745c48..137ce1cba193 100644 --- a/code/game/objects/structures/inflatable.dm +++ b/code/game/objects/structures/inflatable.dm @@ -19,11 +19,11 @@ return playsound(loc, 'sound/items/zip.ogg', 75, 1) user.visible_message(SPAN_NOTICE("[user] inflates \the [src]."), SPAN_NOTICE("You inflate \the [src].")) - var/obj/structure/inflatable/R = new deploy_path(user.loc) - transfer_fingerprints_to(R) - R.add_fingerprint(user) + var/obj/structure/inflatable/debris = new deploy_path(user.loc) + transfer_fingerprints_to(debris) + debris.add_fingerprint(user) if(inflatable_health) - R.current_health = inflatable_health + debris.current_health = inflatable_health qdel(src) /obj/item/inflatable/door @@ -137,14 +137,14 @@ current_health = clamp(current_health + 3, 0, get_max_health()) taped = TRUE -/obj/structure/inflatable/attackby(obj/item/W, mob/user) +/obj/structure/inflatable/attackby(obj/item/used_item, mob/user) - if((W.atom_damage_type == BRUTE || W.atom_damage_type == BURN) && (W.can_puncture() || W.expend_attack_force(user) > 10)) - visible_message(SPAN_DANGER("\The [user] pierces \the [src] with \the [W]!")) + if((used_item.atom_damage_type == BRUTE || used_item.atom_damage_type == BURN) && (used_item.can_puncture() || used_item.expend_attack_force(user) > 10)) + visible_message(SPAN_DANGER("\The [user] pierces \the [src] with \the [used_item]!")) deflate(TRUE) return TRUE - if(!istype(W, /obj/item/inflatable_dispenser)) + if(!istype(used_item, /obj/item/inflatable_dispenser)) return ..() return FALSE @@ -160,17 +160,16 @@ playsound(loc, 'sound/machines/hiss.ogg', 75, 1) if(violent) visible_message("[src] rapidly deflates!") - var/obj/item/inflatable/torn/R = new(loc) - src.transfer_fingerprints_to(R) + transfer_fingerprints_to(new /obj/item/inflatable/torn(loc)) qdel(src) else if(!undeploy_path) return visible_message("\The [src] slowly deflates.") spawn(50) - var/obj/item/inflatable/R = new undeploy_path(src.loc) - src.transfer_fingerprints_to(R) - R.inflatable_health = current_health + var/obj/item/inflatable/door_item = new undeploy_path(src.loc) + src.transfer_fingerprints_to(door_item) + door_item.inflatable_health = current_health qdel(src) /obj/structure/inflatable/verb/hand_deflate() @@ -270,15 +269,15 @@ playsound(loc, 'sound/machines/hiss.ogg', 75, 1) if(violent) visible_message("[src] rapidly deflates!") - var/obj/item/inflatable/door/torn/R = new /obj/item/inflatable/door/torn(loc) - src.transfer_fingerprints_to(R) + transfer_fingerprints_to(new /obj/item/inflatable/door/torn(loc)) qdel(src) else visible_message("[src] slowly deflates.") spawn(50) - var/obj/item/inflatable/door/R = new /obj/item/inflatable/door(loc) - src.transfer_fingerprints_to(R) - qdel(src) + if(!QDELETED(src)) + if(loc) + transfer_fingerprints_to(new /obj/item/inflatable/door(loc)) + qdel(src) /obj/item/inflatable/torn name = "torn inflatable wall" diff --git a/code/game/objects/structures/ironing_board.dm b/code/game/objects/structures/ironing_board.dm index 3248822f656e..a6c821cadf72 100644 --- a/code/game/objects/structures/ironing_board.dm +++ b/code/game/objects/structures/ironing_board.dm @@ -24,14 +24,14 @@ . = ..() -/obj/structure/bed/roller/ironingboard/proc/remove_item(var/obj/item/I) - if(I == cloth) +/obj/structure/bed/roller/ironingboard/proc/remove_item(var/obj/item/used_item) + if(used_item == cloth) cloth = null - else if(I == holding) + else if(used_item == holding) holding = null update_icon() - events_repository.unregister(/decl/observ/destroyed, I, src, TYPE_PROC_REF(/obj/structure/bed/roller/ironingboard, remove_item)) + events_repository.unregister(/decl/observ/destroyed, used_item, src, TYPE_PROC_REF(/obj/structure/bed/roller/ironingboard, remove_item)) // make a screeching noise to drive people mad /obj/structure/bed/roller/ironingboard/Move() @@ -60,14 +60,14 @@ if(cloth) add_overlay(image(cloth.icon, cloth.icon_state)) -/obj/structure/bed/roller/ironingboard/attackby(var/obj/item/I, var/mob/user) +/obj/structure/bed/roller/ironingboard/attackby(var/obj/item/used_item, var/mob/user) if(!density) - if(istype(I,/obj/item/clothing) || istype(I,/obj/item/ironingiron)) + if(istype(used_item,/obj/item/clothing) || istype(used_item,/obj/item/ironingiron)) to_chat(user, "[src] isn't deployed!") return TRUE return ..() - if(istype(I,/obj/item/clothing)) + if(istype(used_item,/obj/item/clothing)) if(cloth) to_chat(user, "[cloth] is already on the ironing table!") return TRUE @@ -75,13 +75,13 @@ to_chat(user, "[buckled_mob] is already on the ironing table!") return TRUE - if(user.try_unequip(I, src)) - cloth = I - events_repository.register(/decl/observ/destroyed, I, src, TYPE_PROC_REF(/obj/structure/bed/roller/ironingboard, remove_item)) + if(user.try_unequip(used_item, src)) + cloth = used_item + events_repository.register(/decl/observ/destroyed, used_item, src, TYPE_PROC_REF(/obj/structure/bed/roller/ironingboard, remove_item)) update_icon() return TRUE - else if(istype(I,/obj/item/ironingiron)) - var/obj/item/ironingiron/R = I + else if(istype(used_item,/obj/item/ironingiron)) + var/obj/item/ironingiron/iron = used_item // anti-wrinkle "massage" if(buckled_mob && ishuman(buckled_mob)) @@ -100,9 +100,9 @@ return TRUE if(!cloth) - if(!holding && !R.enabled && user.try_unequip(I, src)) - holding = R - events_repository.register(/decl/observ/destroyed, I, src, TYPE_PROC_REF(/obj/structure/bed/roller/ironingboard, remove_item)) + if(!holding && !iron.enabled && user.try_unequip(used_item, src)) + holding = iron + events_repository.register(/decl/observ/destroyed, used_item, src, TYPE_PROC_REF(/obj/structure/bed/roller/ironingboard, remove_item)) update_icon() return TRUE to_chat(user, "There isn't anything on the ironing board.") diff --git a/code/game/objects/structures/iv_drip.dm b/code/game/objects/structures/iv_drip.dm index ffc24bfd1b37..796690f63565 100644 --- a/code/game/objects/structures/iv_drip.dm +++ b/code/game/objects/structures/iv_drip.dm @@ -84,15 +84,15 @@ return TRUE . = ..() -/obj/structure/iv_drip/attackby(obj/item/W, mob/user) - if (istype(W, /obj/item/chems)) +/obj/structure/iv_drip/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/chems)) if(!isnull(src.beaker)) to_chat(user, "There is already a reagent container loaded!") return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - beaker = W - to_chat(user, "You attach \the [W] to \the [src].") + beaker = used_item + to_chat(user, "You attach \the [used_item] to \the [src].") queue_icon_update() return TRUE else diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 4d58c9790cbf..5d67e910f7cb 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -24,69 +24,69 @@ . += "\The [src] [html_icon(src)] contains [reagents.total_volume] unit\s of liquid!" -/obj/structure/janitorialcart/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/bag/trash) && !mybag) - if(!user.try_unequip(I, src)) +/obj/structure/janitorialcart/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/bag/trash) && !mybag) + if(!user.try_unequip(used_item, src)) return TRUE - mybag = I + mybag = used_item update_icon() updateUsrDialog() - to_chat(user, "You put [I] into [src].") + to_chat(user, "You put [used_item] into [src].") return TRUE - else if(istype(I, /obj/item/mop)) - if(I.reagents.total_volume < I.reagents.maximum_volume) //if it's not completely soaked we assume they want to wet it, otherwise store it + else if(istype(used_item, /obj/item/mop)) + if(used_item.reagents.total_volume < used_item.reagents.maximum_volume) //if it's not completely soaked we assume they want to wet it, otherwise store it if(reagents.total_volume < 1) to_chat(user, "[src] is out of water!") else - reagents.trans_to_obj(I, I.reagents.maximum_volume) - to_chat(user, "You wet [I] in [src].") + reagents.trans_to_obj(used_item, used_item.reagents.maximum_volume) + to_chat(user, "You wet [used_item] in [src].") playsound(loc, 'sound/effects/slosh.ogg', 25, 1) return TRUE if(!mymop) - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - mymop = I + mymop = used_item update_icon() updateUsrDialog() - to_chat(user, "You put [I] into [src].") + to_chat(user, "You put [used_item] into [src].") return TRUE - else if(istype(I, /obj/item/chems/spray) && !myspray) - if(!user.try_unequip(I, src)) + else if(istype(used_item, /obj/item/chems/spray) && !myspray) + if(!user.try_unequip(used_item, src)) return TRUE - myspray = I + myspray = used_item update_icon() updateUsrDialog() - to_chat(user, "You put [I] into [src].") + to_chat(user, "You put [used_item] into [src].") return TRUE - else if(istype(I, /obj/item/lightreplacer) && !myreplacer) - if(!user.try_unequip(I, src)) + else if(istype(used_item, /obj/item/lightreplacer) && !myreplacer) + if(!user.try_unequip(used_item, src)) return TRUE - myreplacer = I + myreplacer = used_item update_icon() updateUsrDialog() - to_chat(user, "You put [I] into [src].") + to_chat(user, "You put [used_item] into [src].") return TRUE - else if(istype(I, /obj/item/caution)) + else if(istype(used_item, /obj/item/caution)) if(signs < 4) - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE signs++ update_icon() updateUsrDialog() - to_chat(user, "You put [I] into [src].") + to_chat(user, "You put [used_item] into [src].") else to_chat(user, "[src] can't hold any more signs.") return TRUE - else if(istype(I, /obj/item/chems/glass)) + else if(istype(used_item, /obj/item/chems/glass)) return FALSE // So we do not put them in the trash bag as we mean to fill the mop bucket; FALSE means run afterattack else if(mybag) - return mybag.attackby(I, user) + return mybag.attackby(used_item, user) return ..() @@ -217,26 +217,26 @@ if(mybag) . += "\A [mybag] is hanging on the [callme]." -/obj/structure/janicart/attackby(obj/item/I, mob/user) +/obj/structure/janicart/attackby(obj/item/used_item, mob/user) - if(istype(I, /obj/item/mop)) + if(istype(used_item, /obj/item/mop)) if(reagents.total_volume > 1) - reagents.trans_to_obj(I, 2) - to_chat(user, SPAN_NOTICE("You wet [I] in the [callme].")) + reagents.trans_to_obj(used_item, 2) + to_chat(user, SPAN_NOTICE("You wet [used_item] in the [callme].")) playsound(loc, 'sound/effects/slosh.ogg', 25, 1) else to_chat(user, SPAN_NOTICE("This [callme] is out of water!")) return TRUE - if(istype(I, /obj/item/janicart_key)) - to_chat(user, SPAN_NOTICE("Hold \the [I] in one of your hands while you drive this [callme].")) + if(istype(used_item, /obj/item/janicart_key)) + to_chat(user, SPAN_NOTICE("Hold \the [used_item] in one of your hands while you drive this [callme].")) return TRUE - if(istype(I, /obj/item/bag/trash)) - if(!user.try_unequip(I, src)) + if(istype(used_item, /obj/item/bag/trash)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, SPAN_NOTICE("You hook \the [I] onto the [callme].")) - mybag = I + to_chat(user, SPAN_NOTICE("You hook \the [used_item] onto the [callme].")) + mybag = used_item return TRUE . = ..() diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index 3de7c1dba7b2..0dd3a86c453d 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -64,37 +64,37 @@ to_chat(user, SPAN_NOTICE("Slicing lattice joints...")) physically_destroyed() -/obj/structure/lattice/attackby(obj/item/C, mob/user) - if (istype(C, /obj/item/stack/tile)) +/obj/structure/lattice/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/stack/tile)) var/turf/T = get_turf(src) - T.attackby(C, user) //BubbleWrap - hand this off to the underlying turf instead + T.attackby(used_item, user) //BubbleWrap - hand this off to the underlying turf instead return TRUE - if(IS_WELDER(C)) - var/obj/item/weldingtool/WT = C - if(WT.weld(0, user)) + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0, user)) deconstruct(user) return TRUE - if(istype(C, /obj/item/gun/energy/plasmacutter)) - var/obj/item/gun/energy/plasmacutter/cutter = C + if(istype(used_item, /obj/item/gun/energy/plasmacutter)) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(!cutter.slice(user)) return TRUE deconstruct(user) return TRUE - if (istype(C, /obj/item/stack/material/rods)) + if (istype(used_item, /obj/item/stack/material/rods)) var/ladder = (locate(/obj/structure/ladder) in loc) if(ladder) to_chat(user, SPAN_WARNING("\The [ladder] is in the way.")) return TRUE - var/obj/item/stack/material/rods/R = C + var/obj/item/stack/material/rods/rods = used_item var/turf/my_turf = get_turf(src) if(my_turf?.get_supporting_platform()) to_chat(user, SPAN_WARNING("There is already a platform here.")) return TRUE - else if(R.use(2)) + else if(rods.use(2)) playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) - new /obj/structure/catwalk(my_turf, R.material.type) + new /obj/structure/catwalk(my_turf, rods.material.type) return TRUE else to_chat(user, SPAN_WARNING("You require at least two rods to complete the catwalk.")) diff --git a/code/game/objects/structures/memorial.dm b/code/game/objects/structures/memorial.dm index 5a99c067a93d..38b509028309 100644 --- a/code/game/objects/structures/memorial.dm +++ b/code/game/objects/structures/memorial.dm @@ -12,12 +12,12 @@ var/list/fallen = list() -/obj/structure/memorial/attackby(var/obj/D, var/mob/user) - if(istype(D, /obj/item/clothing/dog_tags)) - var/obj/item/clothing/dog_tags/T = D - to_chat(user, "You add \the [T.owner_name]'s \the [T] to \the [src].") - fallen += "[T.owner_rank] [T.owner_name] | [T.owner_branch]" - qdel(T) +/obj/structure/memorial/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/clothing/dog_tags)) + var/obj/item/clothing/dog_tags/dogtags = used_item + to_chat(user, "You add \the [dogtags.owner_name]'s [dogtags.name] to \the [src].") + fallen += "[dogtags.owner_rank] [dogtags.owner_name] | [dogtags.owner_branch]" + qdel(dogtags) return TRUE return ..() diff --git a/code/game/objects/structures/mineral_bath.dm b/code/game/objects/structures/mineral_bath.dm index 3180e095a765..1ed4d581c726 100644 --- a/code/game/objects/structures/mineral_bath.dm +++ b/code/game/objects/structures/mineral_bath.dm @@ -14,7 +14,9 @@ /obj/structure/mineral_bath/return_air() var/datum/gas_mixture/venus = new(CELL_VOLUME, SYNTH_HEAT_LEVEL_1 - 10) - venus.adjust_multi(/decl/material/gas/chlorine, MOLES_N2STANDARD, /decl/material/gas/hydrogen, MOLES_O2STANDARD) + + venus.adjust_gas(/decl/material/gas/chlorine, MOLES_N2STANDARD, FALSE) + venus.adjust_gas(/decl/material/gas/hydrogen, MOLES_O2STANDARD, TRUE) return venus /obj/structure/mineral_bath/grab_attack(obj/item/grab/grab, mob/user) @@ -108,18 +110,17 @@ if(occupant.has_body_flag(BODY_FLAG_CRYSTAL_REFORM) && prob(10)) var/decl/bodytype/root_bodytype = occupant.get_bodytype() for(var/limb_type in root_bodytype.has_limbs) - var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(occupant, limb_type) - if(E && !E.is_usable() && !(E.limb_flags & ORGAN_FLAG_HEALS_OVERKILL)) - occupant.remove_organ(E) - qdel(E) - E = null - if(!E) + var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(occupant, limb_type) + if(limb && !limb.is_usable() && !(limb.limb_flags & ORGAN_FLAG_HEALS_OVERKILL)) + occupant.remove_organ(limb) + qdel(limb) + limb = null + if(!limb) var/list/organ_data = root_bodytype.has_limbs[limb_type] var/limb_path = organ_data["path"] - E = new limb_path(occupant) - organ_data["descriptor"] = E.name - to_chat(occupant, SPAN_NOTICE("You feel your [E.name] reform in the crystal bath.")) - occupant.update_body() + limb = new limb_path(occupant) + occupant.add_organ(limb, GET_EXTERNAL_ORGAN(occupant, limb.parent_organ), FALSE, FALSE) + to_chat(occupant, SPAN_NOTICE("You feel your [limb.name] reform in the crystal bath.")) repaired_organ = TRUE break @@ -133,18 +134,18 @@ // Repair robotic external organs. if(!repaired_organ && prob(25)) - for(var/obj/item/organ/external/E in occupant.get_external_organs()) - if(BP_IS_PROSTHETIC(E)) - for(var/obj/implanted_object in E.implants) + for(var/obj/item/organ/external/limb in occupant.get_external_organs()) + if(BP_IS_PROSTHETIC(limb)) + for(var/obj/implanted_object in limb.implants) if(!istype(implanted_object,/obj/item/implant) && !istype(implanted_object,/obj/item/organ/internal/augment) && prob(25)) // We don't want to remove REAL implants. Just shrapnel etc. - LAZYREMOVE(E.implants, implanted_object) + LAZYREMOVE(limb.implants, implanted_object) to_chat(occupant, SPAN_NOTICE("The mineral-rich bath dissolves the [implanted_object.name].")) qdel(implanted_object) - if(E.brute_dam || E.burn_dam) - E.heal_damage(rand(3,5), rand(3,5), robo_repair = 1) + if(limb.brute_dam || limb.burn_dam) + limb.heal_damage(rand(3,5), rand(3,5), robo_repair = 1) if(prob(25)) - to_chat(occupant, SPAN_NOTICE("The mineral-rich bath mends your [E.name].")) - if(!BP_IS_CRYSTAL(E) && !BP_IS_BRITTLE(E)) - E.status |= ORGAN_BRITTLE + to_chat(occupant, SPAN_NOTICE("The mineral-rich bath mends your [limb.name].")) + if(!BP_IS_CRYSTAL(limb) && !BP_IS_BRITTLE(limb)) + limb.status |= ORGAN_BRITTLE to_chat(occupant, SPAN_WARNING("It feels a bit brittle, though...")) break diff --git a/code/game/objects/structures/mop_bucket.dm b/code/game/objects/structures/mop_bucket.dm index 4a4adca8fb22..22eec93ece55 100644 --- a/code/game/objects/structures/mop_bucket.dm +++ b/code/game/objects/structures/mop_bucket.dm @@ -17,15 +17,15 @@ if(distance <= 1) . += "\The [src] [html_icon(src)] contains [reagents.total_volume] unit\s of water!" -/obj/structure/mopbucket/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/mop)) +/obj/structure/mopbucket/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/mop)) if(reagents.total_volume < 1) to_chat(user, SPAN_WARNING("\The [src] is out of water!")) - else if(REAGENTS_FREE_SPACE(I.reagents) >= 5) - reagents.trans_to_obj(I, 5) - to_chat(user, SPAN_NOTICE("You wet \the [I] in \the [src].")) + else if(REAGENTS_FREE_SPACE(used_item.reagents) >= 5) + reagents.trans_to_obj(used_item, 5) + to_chat(user, SPAN_NOTICE("You wet \the [used_item] in \the [src].")) playsound(loc, 'sound/effects/slosh.ogg', 25, 1) else - to_chat(user, SPAN_WARNING("\The [I] is saturated.")) + to_chat(user, SPAN_WARNING("\The [used_item] is saturated.")) return TRUE return ..() diff --git a/code/game/objects/structures/pit.dm b/code/game/objects/structures/pit.dm index 3e906526c8db..245e55bce956 100644 --- a/code/game/objects/structures/pit.dm +++ b/code/game/objects/structures/pit.dm @@ -148,6 +148,7 @@ pixel_y = 8 anchored = TRUE material = /decl/material/solid/organic/wood/oak + color = /decl/material/solid/organic/wood/oak::color w_class = ITEM_SIZE_NORMAL material_alteration = MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC | MAT_FLAG_ALTERATION_COLOR var/message = "Unknown." @@ -214,6 +215,7 @@ destruction_start_message = "smashing" destruction_finish_message = "smashing" material = /decl/material/solid/stone/granite + color = /decl/material/solid/stone/granite::color // Gravemarker items. // TODO: unify with signs somehow? some of this behaviour is similar... @@ -223,6 +225,7 @@ icon = 'icons/obj/structures/gravestone.dmi' icon_state = "wood" material = /decl/material/solid/organic/wood/oak + color = /decl/material/solid/organic/wood/oak::color w_class = ITEM_SIZE_NORMAL material_alteration = MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC | MAT_FLAG_ALTERATION_COLOR var/gravemarker_type = /obj/structure/gravemarker @@ -232,6 +235,7 @@ name = "gravestone" icon_state = "stone" material = /decl/material/solid/stone/granite + color = /decl/material/solid/stone/granite::color gravemarker_type = /obj/structure/gravemarker/gravestone /obj/item/gravemarker/get_examine_strings(mob/user, distance, infix, suffix) diff --git a/code/game/objects/structures/produce_bin.dm b/code/game/objects/structures/produce_bin.dm index 5c4b23434322..86ed462f5050 100644 --- a/code/game/objects/structures/produce_bin.dm +++ b/code/game/objects/structures/produce_bin.dm @@ -23,27 +23,27 @@ if(storage.can_be_inserted(produce, null)) storage.handle_item_insertion(null, produce) -/obj/structure/produce_bin/attackby(obj/item/bag, mob/user) +/obj/structure/produce_bin/attackby(obj/item/used_item, mob/user) if(user.check_intent(I_FLAG_HARM)) return ..() - if(bag.storage) + if(used_item.storage) var/emptied = FALSE - for(var/obj/item/food/grown/produce in bag.get_stored_inventory()) + for(var/obj/item/food/grown/produce in used_item.get_stored_inventory()) if(storage.can_be_inserted(produce)) - bag.storage.remove_from_storage(null, produce, loc, skip_update = TRUE) + used_item.storage.remove_from_storage(null, produce, loc, skip_update = TRUE) storage.handle_item_insertion(null, produce, skip_update = TRUE) emptied = TRUE if(emptied) - bag.storage.finish_bulk_removal() + used_item.storage.finish_bulk_removal() storage.finish_bulk_insertion() - if(length(bag.get_stored_inventory())) - to_chat(user, SPAN_NOTICE("You partially empty \the [bag] into \the [src]'s hopper.")) + if(length(used_item.get_stored_inventory())) + to_chat(user, SPAN_NOTICE("You partially empty \the [used_item] into \the [src]'s hopper.")) else - to_chat(user, SPAN_NOTICE("You empty \the [bag] into \the [src]'s hopper.")) + to_chat(user, SPAN_NOTICE("You empty \the [used_item] into \the [src]'s hopper.")) return TRUE return ..() diff --git a/code/game/objects/structures/quicksand.dm b/code/game/objects/structures/quicksand.dm index fbbd3393c87e..b3e1cffa4809 100644 --- a/code/game/objects/structures/quicksand.dm +++ b/code/game/objects/structures/quicksand.dm @@ -79,8 +79,8 @@ exposed = 1 update_icon() -/obj/effect/quicksand/attackby(obj/item/W, mob/user) - if(!exposed && W.expend_attack_force(user)) +/obj/effect/quicksand/attackby(obj/item/used_item, mob/user) + if(!exposed && used_item.expend_attack_force(user)) expose() return TRUE else diff --git a/code/game/objects/structures/racks.dm b/code/game/objects/structures/racks.dm index 2cbeb5bb7f58..cda6216899a8 100644 --- a/code/game/objects/structures/racks.dm +++ b/code/game/objects/structures/racks.dm @@ -35,10 +35,10 @@ return DEXTERITY_HOLD_ITEM return ..() -/obj/structure/rack/attackby(obj/item/O, mob/user, click_params) +/obj/structure/rack/attackby(obj/item/used_item, mob/user, click_params) . = ..() - if(!. && !isrobot(user) && O.loc == user && user.try_unequip(O, loc)) - auto_align(O, click_params) + if(!. && !isrobot(user) && used_item.loc == user && user.try_unequip(used_item, loc)) + auto_align(used_item, click_params) return TRUE /obj/structure/rack/holorack/dismantle_structure(mob/user) diff --git a/code/game/objects/structures/railing.dm b/code/game/objects/structures/railing.dm index ae06bb484e42..b04f59f9a150 100644 --- a/code/game/objects/structures/railing.dm +++ b/code/game/objects/structures/railing.dm @@ -88,8 +88,8 @@ WOOD_RAILING_SUBTYPE(yew) broken = TRUE for(var/thing in RANGE_TURFS(src, 1)) var/turf/T = thing - for(var/obj/structure/railing/R in T.contents) - R.update_icon() + for(var/obj/structure/railing/rail in T.contents) + rail.update_icon() . = ..() /obj/structure/railing/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) @@ -105,41 +105,41 @@ WOOD_RAILING_SUBTYPE(yew) var/Rturn = turn(dir, -90) var/Lturn = turn(dir, 90) - for(var/obj/structure/railing/R in loc) - if ((R.dir == Lturn) && R.anchored) + for(var/obj/structure/railing/rail in loc) + if ((rail.dir == Lturn) && rail.anchored) neighbor_status |= 32 if (propagate) - R.update_connections() - R.update_icon() - if ((R.dir == Rturn) && R.anchored) + rail.update_connections() + rail.update_icon() + if ((rail.dir == Rturn) && rail.anchored) neighbor_status |= 2 if (propagate) - R.update_connections() - R.update_icon() - for (var/obj/structure/railing/R in get_step(src, Lturn)) - if ((R.dir == dir) && R.anchored) + rail.update_connections() + rail.update_icon() + for (var/obj/structure/railing/rail in get_step(src, Lturn)) + if ((rail.dir == dir) && rail.anchored) neighbor_status |= 16 if (propagate) - R.update_connections() - R.update_icon() - for (var/obj/structure/railing/R in get_step(src, Rturn)) - if ((R.dir == dir) && R.anchored) + rail.update_connections() + rail.update_icon() + for (var/obj/structure/railing/rail in get_step(src, Rturn)) + if ((rail.dir == dir) && rail.anchored) neighbor_status |= 1 if (propagate) - R.update_connections() - R.update_icon() - for (var/obj/structure/railing/R in get_step(src, (Lturn + dir))) - if ((R.dir == Rturn) && R.anchored) + rail.update_connections() + rail.update_icon() + for (var/obj/structure/railing/rail in get_step(src, (Lturn + dir))) + if ((rail.dir == Rturn) && rail.anchored) neighbor_status |= 64 if (propagate) - R.update_connections() - R.update_icon() - for (var/obj/structure/railing/R in get_step(src, (Rturn + dir))) - if ((R.dir == Lturn) && R.anchored) + rail.update_connections() + rail.update_icon() + for (var/obj/structure/railing/rail in get_step(src, (Rturn + dir))) + if ((rail.dir == Lturn) && rail.anchored) neighbor_status |= 4 if (propagate) - R.update_connections() - R.update_icon() + rail.update_connections() + rail.update_icon() /obj/structure/railing/on_update_icon() ..() @@ -247,9 +247,9 @@ WOOD_RAILING_SUBTYPE(yew) return TRUE // TODO: rewrite to use handle_default_wrench_attackby, bash, etc -/obj/structure/railing/attackby(var/obj/item/W, var/mob/user) +/obj/structure/railing/attackby(var/obj/item/used_item, var/mob/user) // Dismantle - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) if(!anchored) playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, 2 SECONDS, src)) @@ -272,8 +272,8 @@ WOOD_RAILING_SUBTYPE(yew) update_icon() return TRUE // Repair - if(IS_WELDER(W)) - var/obj/item/weldingtool/F = W + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/F = used_item if(F.isOn()) var/current_max_health = get_max_health() if(current_health >= current_max_health) @@ -288,7 +288,7 @@ WOOD_RAILING_SUBTYPE(yew) return TRUE // Install - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) if(!density) to_chat(user, "You need to wrench \the [src] from back into place first.") return TRUE @@ -301,11 +301,11 @@ WOOD_RAILING_SUBTYPE(yew) update_icon() return TRUE - var/force = W.expend_attack_force(user) - if(force && (W.atom_damage_type == BURN || W.atom_damage_type == BRUTE)) + var/force = used_item.expend_attack_force(user) + if(force && (used_item.atom_damage_type == BURN || used_item.atom_damage_type == BRUTE)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - visible_message("\The [src] has been [LAZYLEN(W.attack_verb) ? pick(W.attack_verb) : "attacked"] with \the [W] by \the [user]!") - take_damage(force, W.atom_damage_type) + visible_message("\The [src] has been [used_item.pick_attack_verb()] with \the [used_item] by \the [user]!") + take_damage(force, used_item.atom_damage_type) return TRUE . = ..() diff --git a/code/game/objects/structures/rubble.dm b/code/game/objects/structures/rubble.dm index 69a418337921..221b9ebd9ea0 100644 --- a/code/game/objects/structures/rubble.dm +++ b/code/game/objects/structures/rubble.dm @@ -26,21 +26,21 @@ /obj/structure/rubble/on_update_icon() ..() for(var/i = 1 to 7) - var/image/I = image(icon,"rubble[rand(1,76)]") + var/image/overlay_image = image(icon,"rubble[rand(1,76)]") if(prob(10)) var/atom/A = pick(loot) if(initial(A.icon) && initial(A.icon_state)) - I.icon = initial(A.icon) - I.icon_state = initial(A.icon_state) - I.color = initial(A.color) + overlay_image.icon = initial(A.icon) + overlay_image.icon_state = initial(A.icon_state) + overlay_image.color = initial(A.color) if(!lootleft) - I.color = "#54362e" - I.pixel_x = rand(-16,16) - I.pixel_y = rand(-16,16) + overlay_image.color = "#54362e" + overlay_image.pixel_x = rand(-16,16) + overlay_image.pixel_y = rand(-16,16) var/matrix/M = matrix() M.Turn(rand(0,360)) - I.transform = M - add_overlay(I) + overlay_image.transform = M + add_overlay(overlay_image) if(lootleft) add_overlay("twinkle[rand(1,3)]") @@ -65,8 +65,8 @@ to_chat(user, SPAN_WARNING("Someone is already rummaging here!")) return TRUE -/obj/structure/rubble/attackby(var/obj/item/I, var/mob/user) - if(I.do_tool_interaction(TOOL_PICK, user, I, 3 SECONDS, set_cooldown = TRUE)) +/obj/structure/rubble/attackby(var/obj/item/used_item, var/mob/user) + if(used_item.do_tool_interaction(TOOL_PICK, user, used_item, 3 SECONDS, set_cooldown = TRUE)) if(lootleft && prob(1)) var/obj/item/booty = pickweight(loot) booty = new booty(loc) diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 5257b0607a9f..bd2bfd5e8d37 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -23,12 +23,12 @@ FLOOR SAFES // TODO: make this use a storage datum? /obj/structure/safe/Initialize() - for(var/obj/item/I in loc) + for(var/obj/item/thing in loc) if(space >= maxspace) break - if(I.w_class + space <= maxspace) //todo replace with internal storage or something - space += I.w_class - I.forceMove(src) + if(thing.w_class + space <= maxspace) //todo replace with internal storage or something + space += thing.w_class + thing.forceMove(src) . = ..() tumbler_1_pos = rand(0, 72) tumbler_1_open = rand(0, 72) @@ -134,21 +134,21 @@ FLOOR SAFES return TOPIC_REFRESH -/obj/structure/safe/attackby(obj/item/I, mob/user) +/obj/structure/safe/attackby(obj/item/used_item, mob/user) if(open) - if(I.w_class + space <= maxspace) - if(!user.try_unequip(I, src)) + if(used_item.w_class + space <= maxspace) + if(!user.try_unequip(used_item, src)) return TRUE - space += I.w_class - to_chat(user, "You put [I] in [src].") + space += used_item.w_class + to_chat(user, "You put [used_item] in [src].") updateUsrDialog() return TRUE else - to_chat(user, "[I] won't fit in [src].") + to_chat(user, "[used_item] won't fit in [src].") return TRUE else - if(istype(I, /obj/item/clothing/neck/stethoscope)) - to_chat(user, "Hold [I] in one of your hands while you manipulate the dial.") + if(istype(used_item, /obj/item/clothing/neck/stethoscope)) + to_chat(user, "Hold [used_item] in one of your hands while you manipulate the dial.") return TRUE return FALSE diff --git a/code/game/objects/structures/seaweed.dm b/code/game/objects/structures/seaweed.dm index bfa52f88a189..45762a60d942 100644 --- a/code/game/objects/structures/seaweed.dm +++ b/code/game/objects/structures/seaweed.dm @@ -30,8 +30,8 @@ icon_state = "lichen" icon = 'icons/obj/structures/plants.dmi' -/obj/effect/decal/cleanable/lichen/attackby(obj/item/I, mob/user) - if(I.is_sharp() && I.expend_attack_force(user) > 1) +/obj/effect/decal/cleanable/lichen/attackby(obj/item/used_item, mob/user) + if(used_item.is_sharp() && used_item.expend_attack_force(user) > 1) qdel(src) return TRUE . = ..() \ No newline at end of file diff --git a/code/game/objects/structures/signs.dm b/code/game/objects/structures/signs.dm index d5fcfd514556..0b1245e25d7c 100644 --- a/code/game/objects/structures/signs.dm +++ b/code/game/objects/structures/signs.dm @@ -23,9 +23,9 @@ try_install(target, user) return TRUE -/obj/item/sign/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W) && W.CanUseTopic(user, global.inventory_topic_state) && isturf(user.loc)) - return try_install(W, user) +/obj/item/sign/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item) && used_item.CanUseTopic(user, global.inventory_topic_state) && isturf(user.loc)) + return try_install(used_item, user) return ..() /obj/item/sign/on_update_icon() @@ -87,7 +87,7 @@ ///A wall mountable sign structure /obj/structure/sign name = "sign" - icon = 'icons/obj/decals.dmi' + icon = 'icons/obj/signs/warnings.dmi' anchored = TRUE opacity = FALSE density = FALSE diff --git a/code/game/objects/structures/signs/diploma.dm b/code/game/objects/structures/signs/diploma.dm index a6bbf52d992b..f3e929982b6d 100644 --- a/code/game/objects/structures/signs/diploma.dm +++ b/code/game/objects/structures/signs/diploma.dm @@ -125,9 +125,9 @@ if(distance <= 2) . += details.get_examine_string() -/obj/item/sign/diploma/attackby(obj/item/pen/W, mob/user) - if(IS_PEN(W)) - sign_diploma(W, user) +/obj/item/sign/diploma/attackby(obj/item/used_item, mob/user) + if(IS_PEN(used_item)) + sign_diploma(used_item, user) return TRUE return ..() diff --git a/code/game/objects/structures/skele_stand.dm b/code/game/objects/structures/skele_stand.dm index 95ce5fb549c2..4b3d9d944d18 100644 --- a/code/game/objects/structures/skele_stand.dm +++ b/code/game/objects/structures/skele_stand.dm @@ -56,25 +56,25 @@ swagnames += C.get_examine_line() . += "[gender == MALE ? "He" : "She"] is wearing [english_list(swagnames)]." -/obj/structure/skele_stand/attackby(obj/item/W, mob/user) - if(IS_PEN(W)) +/obj/structure/skele_stand/attackby(obj/item/used_item, mob/user) + if(IS_PEN(used_item)) var/nuname = sanitize(input(user,"What do you want to name this skeleton as?","Skeleton Christening",name) as text|null) if(nuname && CanPhysicallyInteract(user)) SetName(nuname) return TRUE - if(istype(W,/obj/item/clothing)) - var/obj/item/clothing/clothes = W + if(istype(used_item,/obj/item/clothing)) + var/obj/item/clothing/clothes = used_item if(!clothes.fallback_slot) return FALSE if(swag[clothes.fallback_slot]) to_chat(user,SPAN_NOTICE("There is already that kind of clothing on \the [src].")) - else if(user.try_unequip(W, src)) - swag[clothes.fallback_slot] = W + else if(user.try_unequip(used_item, src)) + swag[clothes.fallback_slot] = used_item update_icon() return TRUE . = ..() if(!.) - rattle_bones(user, W) + rattle_bones(user, used_item) return TRUE /obj/structure/skele_stand/Destroy() diff --git a/code/game/objects/structures/stasis_cage.dm b/code/game/objects/structures/stasis_cage.dm index 2ac55e2afe1d..5474cb223cf5 100644 --- a/code/game/objects/structures/stasis_cage.dm +++ b/code/game/objects/structures/stasis_cage.dm @@ -15,9 +15,9 @@ if(A) contain(A) -/obj/structure/stasis_cage/attackby(obj/item/O, mob/user) - if(contained && istype(O, /obj/item/scanner/xenobio)) - return contained.attackby(O, user) +/obj/structure/stasis_cage/attackby(obj/item/used_item, mob/user) + if(contained && istype(used_item, /obj/item/scanner/xenobio)) + return contained.attackby(used_item, user) . = ..() /obj/structure/stasis_cage/attack_hand(var/mob/user) diff --git a/code/game/objects/structures/tables.dm b/code/game/objects/structures/tables.dm index 98a4918cb530..ab9fbf3e716e 100644 --- a/code/game/objects/structures/tables.dm +++ b/code/game/objects/structures/tables.dm @@ -179,9 +179,9 @@ update_materials() return TRUE -/obj/structure/table/attackby(obj/item/W, mob/user, click_params) +/obj/structure/table/attackby(obj/item/used_item, mob/user, click_params) - if(user.check_intent(I_FLAG_HARM) && W.is_special_cutting_tool()) + if(user.check_intent(I_FLAG_HARM) && used_item.is_special_cutting_tool()) spark_at(src.loc, amount=5) playsound(src.loc, 'sound/weapons/blade1.ogg', 50, 1) user.visible_message(SPAN_DANGER("\The [src] was sliced apart by \the [user]!")) @@ -189,14 +189,14 @@ return TRUE if(!reinf_material) - if(istype(W, /obj/item/stack/material/rods)) - return reinforce_table(W, user) - if(istype(W, /obj/item/stack/material)) - return finish_table(W, user) + if(istype(used_item, /obj/item/stack/material/rods)) + return reinforce_table(used_item, user) + if(istype(used_item, /obj/item/stack/material)) + return finish_table(used_item, user) return ..() - if(!felted && istype(W, /obj/item/stack/tile/carpet)) - var/obj/item/stack/tile/carpet/C = W + if(!felted && istype(used_item, /obj/item/stack/tile/carpet)) + var/obj/item/stack/tile/carpet/C = used_item if(C.use(1)) user.visible_message( SPAN_NOTICE("\The [user] adds \the [C] to \the [src]."), @@ -208,15 +208,15 @@ return TRUE //playing cards - if(istype(W, /obj/item/hand)) - var/obj/item/hand/H = W + if(istype(used_item, /obj/item/hand)) + var/obj/item/hand/H = used_item if(H.cards && length(H.cards) == 1) user.visible_message("\The [user] plays \the [H.cards[1]].") return TRUE - if(istype(W, /obj/item/deck)) //playing cards + if(istype(used_item, /obj/item/deck)) //playing cards if(user.check_intent(I_FLAG_GRAB)) - var/obj/item/deck/D = W + var/obj/item/deck/D = used_item if(!length(D.cards)) to_chat(user, "There are no cards in the deck.") else @@ -226,8 +226,8 @@ . = ..() // Finally we can put the object onto the table. - if(!. && can_place_items && !isrobot(user) && W.loc == user && user.try_unequip(W, src.loc)) - auto_align(W, click_params) + if(!. && can_place_items && !isrobot(user) && used_item.loc == user && user.try_unequip(used_item, src.loc)) + auto_align(used_item, click_params) return TRUE /obj/structure/table/proc/reinforce_table(obj/item/stack/material/S, mob/user) @@ -342,11 +342,10 @@ var/flip_mod = "" if(left_neighbor_blend && right_neighbor_blend) flip_type = 2 - icon_state = "flip[flip_type]" else if(left_neighbor_blend || right_neighbor_blend) flip_type = 1 flip_mod = (left_neighbor_blend ? "+" : "-") - icon_state = "flip[flip_type][flip_mod]" + icon_state = "flip[flip_type][flip_mod]" var/image/I if(reinf_material) @@ -393,26 +392,26 @@ return var/list/blocked_dirs = list() - for(var/obj/structure/window/W in get_turf(src)) - if(W.is_fulltile()) + for(var/obj/structure/window/used_item in get_turf(src)) + if(used_item.is_fulltile()) connections = list("0", "0", "0", "0") return - blocked_dirs |= W.dir + blocked_dirs |= used_item.dir for(var/D in list(NORTH, SOUTH, EAST, WEST) - blocked_dirs) var/turf/T = get_step(src, D) - for(var/obj/structure/window/W in T) - if(W.is_fulltile() || W.dir == global.reverse_dir[D]) + for(var/obj/structure/window/used_item in T) + if(used_item.is_fulltile() || used_item.dir == global.reverse_dir[D]) blocked_dirs |= D break else - if(W.dir != D) // it's off to the side - blocked_dirs |= W.dir|D // blocks the diagonal + if(used_item.dir != D) // it's off to the side + blocked_dirs |= used_item.dir|D // blocks the diagonal for(var/D in list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST) - blocked_dirs) var/turf/T = get_step(src, D) - for(var/obj/structure/window/W in T) - if(W.is_fulltile() || (W.dir & global.reverse_dir[D])) + for(var/obj/structure/window/used_item in T) + if(used_item.is_fulltile() || (used_item.dir & global.reverse_dir[D])) blocked_dirs |= D break @@ -904,6 +903,7 @@ reinf_material = /decl/material/solid/organic/wood/walnut storage = /datum/storage/structure/desk bound_width = 64 + appearance_flags = /obj/structure/table::appearance_flags & ~TILE_BOUND material_alteration = MAT_FLAG_ALTERATION_ALL can_flip = FALSE top_surface_noun = "desktop" @@ -979,6 +979,7 @@ icon = 'icons/obj/structures/dresser.dmi' icon_state = "dresser" bound_width = 32 + appearance_flags = /obj/structure/table::appearance_flags top_surface_noun = "surface" tabletop_height = 15 mob_offset = 18 diff --git a/code/game/objects/structures/tank_dispenser.dm b/code/game/objects/structures/tank_dispenser.dm index 9f3fe1060a3c..25154a8f0036 100644 --- a/code/game/objects/structures/tank_dispenser.dm +++ b/code/game/objects/structures/tank_dispenser.dm @@ -78,14 +78,14 @@ popup.open() return TRUE -/obj/structure/tank_rack/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/tank)) +/obj/structure/tank_rack/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/tank)) var/list/adding_to_list - if(istype(I, /obj/item/tank/oxygen) || istype(I, /obj/item/tank/air)) + if(istype(used_item, /obj/item/tank/oxygen) || istype(used_item, /obj/item/tank/air)) LAZYINITLIST(oxygen_tanks) adding_to_list = oxygen_tanks - else if(istype(I, /obj/item/tank/hydrogen)) + else if(istype(used_item, /obj/item/tank/hydrogen)) LAZYINITLIST(hydrogen_tanks) adding_to_list = hydrogen_tanks else @@ -96,11 +96,11 @@ UNSETEMPTY(adding_to_list) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - LAZYADD(adding_to_list, weakref(I)) - to_chat(user, SPAN_NOTICE("You put [I] in [src].")) + LAZYADD(adding_to_list, weakref(used_item)) + to_chat(user, SPAN_NOTICE("You put [used_item] in [src].")) update_icon() attack_hand_with_interaction_checks(user) return TRUE diff --git a/code/game/objects/structures/target_stake.dm b/code/game/objects/structures/target_stake.dm index 38feb74fd25d..b1e25a0f4dce 100644 --- a/code/game/objects/structures/target_stake.dm +++ b/code/game/objects/structures/target_stake.dm @@ -11,15 +11,22 @@ structure_flags = STRUCTURE_FLAG_THROWN_DAMAGE var/obj/item/training_dummy/dummy +/obj/structure/target_stake/proc/set_dummy(obj/item/training_dummy/new_dummy) + dummy = new_dummy + if(dummy) + dummy.reset_offsets() + queue_icon_update() + queue_vis_contents_update() + /obj/structure/target_stake/Destroy() - dummy = null + set_dummy(null) . = ..() /obj/structure/target_stake/take_damage(damage, damage_type, damage_flags, inflicter, armor_pen, silent, do_update_health) if(dummy) . = dummy.take_damage(damage, damage_type, damage_flags, inflicter, armor_pen, silent, do_update_health) if(QDELETED(dummy)) - dummy = null + set_dummy(null) update_icon() return return ..() @@ -31,44 +38,32 @@ if(dummy) dummy.dropInto(loc) user.put_in_hands(dummy) - dummy = null - update_icon() + set_dummy(null) return TRUE return ..() /obj/structure/target_stake/attackby(obj/item/used_item, mob/user) if(dummy?.repair_target_dummy(used_item, user)) return TRUE + if(user.check_intent(I_FLAG_HARM) && dummy?.attackby(used_item, user)) + return TRUE if(istype(used_item, /obj/item/training_dummy) && can_hold_dummy(user, used_item)) if(dummy) to_chat(user, SPAN_WARNING("\The [src] is already holding \the [dummy].")) else if(user.try_unequip(used_item, src)) - dummy = used_item + set_dummy(used_item) visible_message(SPAN_NOTICE("\The [user] places \the [dummy] onto \the [src].")) - update_icon() return TRUE return ..() /obj/structure/target_stake/Initialize(ml, _mat, _reinf_mat) if(ispath(dummy)) - dummy = new dummy(src) + set_dummy(new dummy(src)) . = ..() - update_icon() -/obj/structure/target_stake/on_update_icon() +/obj/structure/target_stake/get_vis_contents_to_add() . = ..() - if(dummy) - // WTB way to stop vis_contents inheriting atom color - var/image/dummy_overlay = new /image - dummy_overlay.appearance = dummy - dummy_overlay.pixel_x = 0 - dummy_overlay.pixel_y = 0 - dummy_overlay.pixel_z = 0 - dummy_overlay.pixel_w = 0 - dummy_overlay.plane = FLOAT_PLANE - dummy_overlay.layer = FLOAT_LAYER - dummy_overlay.appearance_flags |= RESET_COLOR - add_overlay(dummy_overlay) + LAZYADD(., dummy) // Subtypes below. /obj/structure/target_stake/steel diff --git a/code/game/objects/structures/transit_tubes.dm b/code/game/objects/structures/transit_tubes.dm index 0c9982cc9a63..8c98af230f7a 100644 --- a/code/game/objects/structures/transit_tubes.dm +++ b/code/game/objects/structures/transit_tubes.dm @@ -59,7 +59,8 @@ /obj/structure/transit_tube_pod/Initialize() . = ..() - air_contents.adjust_multi(/decl/material/gas/oxygen, MOLES_O2STANDARD * 2, /decl/material/gas/nitrogen, MOLES_N2STANDARD) + air_contents.adjust_gas(/decl/material/gas/oxygen, MOLES_O2STANDARD * 2, FALSE) + air_contents.adjust_gas(/decl/material/gas/nitrogen, MOLES_N2STANDARD, TRUE) air_contents.temperature = T20C // Give auto tubes time to align before trying to start moving diff --git a/code/game/objects/structures/travois.dm b/code/game/objects/structures/travois.dm index bcf23f16081b..324972fbba5f 100644 --- a/code/game/objects/structures/travois.dm +++ b/code/game/objects/structures/travois.dm @@ -20,3 +20,8 @@ parts_type = /obj/item/stack/material/log material_alteration = MAT_FLAG_ALTERATION_ALL material = /decl/material/solid/organic/wood/oak + color = /decl/material/solid/organic/wood/oak::color + +/obj/structure/travois/walnut + material = /decl/material/solid/organic/wood/walnut + color = /decl/material/solid/organic/wood/walnut::color \ No newline at end of file diff --git a/code/game/objects/structures/under_wardrobe.dm b/code/game/objects/structures/under_wardrobe.dm index 815a1405394a..a440ae1b8806 100644 --- a/code/game/objects/structures/under_wardrobe.dm +++ b/code/game/objects/structures/under_wardrobe.dm @@ -8,9 +8,9 @@ density = TRUE var/static/list/amount_of_underwear_by_id_card -/obj/structure/undies_wardrobe/attackby(var/obj/item/item, var/mob/user) - if(istype(item, /obj/item/underwear)) - var/obj/item/underwear/underwear = item +/obj/structure/undies_wardrobe/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/underwear)) + var/obj/item/underwear/underwear = used_item if(!user.try_unequip(underwear)) return TRUE qdel(underwear) diff --git a/code/game/objects/structures/wall_cabinet.dm b/code/game/objects/structures/wall_cabinet.dm new file mode 100644 index 000000000000..3cc7b07bcc55 --- /dev/null +++ b/code/game/objects/structures/wall_cabinet.dm @@ -0,0 +1,35 @@ +// A wall-mounted storage object. +/obj/structure/wall_cabinet + name = "cabinet" + desc = "A wall-mounted cabinet used to store various goods and sundries, and also make use of all that wasted wall-space." + icon = 'icons/obj/structures/furniture/cabinet_duo.dmi' + icon_state = ICON_STATE_WORLD + anchored = TRUE + obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED + layer = ABOVE_HUMAN_LAYER + material_alteration = MAT_FLAG_ALTERATION_ALL + directional_offset = @'{"NORTH":{"y":-1},"SOUTH":{"y":24}}' + storage = /datum/storage/wall_cabinet + +/obj/structure/wall_cabinet/on_update_icon() + . = ..() + if(storage?.opened) + // todo: door material? glass cabinet doors could be interesting if we add a 'full' sprite + var/image/open_overlay = overlay_image(icon, "[icon_state]_open", get_color(), RESET_COLOR|KEEP_APART) + open_overlay.layer = ABOVE_HUMAN_LAYER + 0.005 + add_overlay(open_overlay) + +/datum/storage/wall_cabinet + max_storage_space = BASE_STORAGE_CAPACITY(ITEM_SIZE_GARGANTUAN) // smaller than structure fwiw + open_sound = 'sound/foley/drawer-open.ogg' + close_sound = 'sound/foley/drawer-close.ogg' + +/obj/structure/wall_cabinet/walnut + color = /decl/material/solid/organic/wood/walnut::color + material = /decl/material/solid/organic/wood/walnut + reinf_material = /decl/material/solid/organic/wood/walnut + +/obj/structure/wall_cabinet/ebony + color = /decl/material/solid/organic/wood/ebony::color + material = /decl/material/solid/organic/wood/ebony + reinf_material = /decl/material/solid/organic/wood/ebony \ No newline at end of file diff --git a/code/game/objects/structures/wall_frame.dm b/code/game/objects/structures/wall_frame.dm index b4d8c7a46054..21bf8027cd36 100644 --- a/code/game/objects/structures/wall_frame.dm +++ b/code/game/objects/structures/wall_frame.dm @@ -57,33 +57,33 @@ else return SPAN_DANGER("It's nearly falling to pieces.") -/obj/structure/wall_frame/attackby(var/obj/item/W, var/mob/user) +/obj/structure/wall_frame/attackby(var/obj/item/used_item, var/mob/user) . = ..() if(!.) //grille placing - if(istype(W, /obj/item/stack/material/rods)) + if(istype(used_item, /obj/item/stack/material/rods)) for(var/obj/structure/window/WINDOW in loc) if(WINDOW.dir == get_dir(src, user)) to_chat(user, SPAN_WARNING("There is a window in the way.")) return TRUE - place_grille(user, loc, W) + place_grille(user, loc, used_item) return TRUE //window placing - if(istype(W,/obj/item/stack/material)) - var/obj/item/stack/material/ST = W + if(istype(used_item,/obj/item/stack/material)) + var/obj/item/stack/material/ST = used_item if(ST.material.opacity <= 0.7) place_window(user, loc, SOUTHWEST, ST) return TRUE - if(istype(W, /obj/item/gun/energy/plasmacutter)) - var/obj/item/gun/energy/plasmacutter/cutter = W + if(istype(used_item, /obj/item/gun/energy/plasmacutter)) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(!cutter.slice(user)) return playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) - visible_message(SPAN_NOTICE("\The [user] begins slicing through \the [src] with \the [W].")) + visible_message(SPAN_NOTICE("\The [user] begins slicing through \the [src] with \the [used_item].")) if(do_after(user, 20,src)) - visible_message(SPAN_NOTICE("\The [user] slices \the [src] apart with \the [W].")) + visible_message(SPAN_NOTICE("\The [user] slices \the [src] apart with \the [used_item].")) dismantle_structure(user) return TRUE diff --git a/code/game/objects/structures/wall_sconce.dm b/code/game/objects/structures/wall_sconce.dm index c1211712b3c8..c87951094585 100644 --- a/code/game/objects/structures/wall_sconce.dm +++ b/code/game/objects/structures/wall_sconce.dm @@ -86,22 +86,22 @@ return ..() -/obj/structure/wall_sconce/attackby(obj/item/W, mob/user) +/obj/structure/wall_sconce/attackby(obj/item/used_item, mob/user) if(user.check_intent(I_FLAG_HARM)) return ..() - if(IS_HAMMER(W) || IS_WRENCH(W)) + if(IS_HAMMER(used_item) || IS_WRENCH(used_item)) dismantle_structure(user) return TRUE - if(W.isflamesource() && light_source && !light_source.lit) - light_source.attackby(W, user) + if(used_item.isflamesource() && light_source && !light_source.lit) + light_source.attackby(used_item, user) update_icon() return TRUE - if(istype(W, /obj/item/flame)) - var/obj/item/flame/flame = W + if(istype(used_item, /obj/item/flame)) + var/obj/item/flame/flame = used_item if(flame.sconce_can_hold) if(light_source) @@ -115,8 +115,8 @@ return TRUE // Refilling - if(light_source && istype(W, /obj/item/chems)) - var/obj/item/chems/chem_source = W + if(light_source && istype(used_item, /obj/item/chems)) + var/obj/item/chems/chem_source = used_item if(chem_source.standard_pour_into(user, light_source)) return TRUE diff --git a/code/game/objects/structures/wallframe_spawner.dm b/code/game/objects/structures/wallframe_spawner.dm index 2573ad0514fb..524b017cc5f5 100644 --- a/code/game/objects/structures/wallframe_spawner.dm +++ b/code/game/objects/structures/wallframe_spawner.dm @@ -4,6 +4,7 @@ icon_state = "wingrille" density = TRUE anchored = TRUE + atmos_canpass = CANPASS_NEVER var/win_path = /obj/structure/window/basic/full var/frame_path = /obj/structure/wall_frame/standard var/grille_path = /obj/structure/grille @@ -53,10 +54,10 @@ if(!other) var/found_connection if(locate(/obj/structure/grille) in T) - for(var/obj/structure/window/W in T) - if(W.type == win_path && W.dir == get_dir(T,src)) + for(var/obj/structure/window/window in T) + if(window.type == win_path && window.dir == get_dir(T,src)) found_connection = 1 - qdel(W) + qdel(window) if(!found_connection) var/obj/structure/window/new_win = new win_path(loc) new_win.set_dir(dir) @@ -84,7 +85,7 @@ D.update_connections() D.update_icon() -/obj/effect/wallframe_spawn/proc/handle_window_spawn(var/obj/structure/window/W) +/obj/effect/wallframe_spawn/proc/handle_window_spawn(var/obj/structure/window/window) return /obj/effect/wallframe_spawn/proc/handle_grille_spawn(var/obj/structure/grille/G) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 93cf5851a2da..1778979d9b52 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -29,9 +29,9 @@ var/global/list/hygiene_props = list() clogged = 0 tool_interaction_flags = initial(tool_interaction_flags) -/obj/structure/hygiene/attackby(var/obj/item/thing, var/mob/user) - if(clogged > 0 && isplunger(thing)) - user.visible_message(SPAN_NOTICE("\The [user] strives valiantly to unclog \the [src] with \the [thing]!")) +/obj/structure/hygiene/attackby(var/obj/item/used_item, var/mob/user) + if(clogged > 0 && isplunger(used_item)) + user.visible_message(SPAN_NOTICE("\The [user] strives valiantly to unclog \the [src] with \the [used_item]!")) spawn playsound(loc, 'sound/effects/plunger.ogg', 75, 1) sleep(5) @@ -50,9 +50,9 @@ var/global/list/hygiene_props = list() unclog() return TRUE //toilet paper interaction for clogging toilets and other facilities - if (istype(thing, /obj/item/stack/tape_roll/barricade_tape/toilet)) + if (istype(used_item, /obj/item/stack/tape_roll/barricade_tape/toilet)) if (clogged == -1) - to_chat(user, SPAN_WARNING("Try as you might, you can not clog \the [src] with \the [thing].")) + to_chat(user, SPAN_WARNING("Try as you might, you can not clog \the [src] with \the [used_item].")) return TRUE if (clogged) to_chat(user, SPAN_WARNING("\The [src] is already clogged.")) @@ -60,11 +60,11 @@ var/global/list/hygiene_props = list() if (!do_after(user, 3 SECONDS, src)) to_chat(user, SPAN_WARNING("You must stay still to clog \the [src].")) return TRUE - if (clogged || QDELETED(thing) || !user.try_unequip(thing)) + if (clogged || QDELETED(used_item) || !user.try_unequip(used_item)) return TRUE - to_chat(user, SPAN_NOTICE("You unceremoniously jam \the [src] with \the [thing]. What a rebel.")) + to_chat(user, SPAN_NOTICE("You unceremoniously jam \the [src] with \the [used_item]. What a rebel.")) clog(1) - qdel(thing) + qdel(used_item) return TRUE . = ..() @@ -141,17 +141,18 @@ var/global/list/hygiene_props = list() swirlie.take_damage(8) return TRUE + // TODO: storage datum if(cistern && !open) if(!contents.len) to_chat(user, SPAN_NOTICE("The cistern is empty.")) else - var/obj/item/I = pick(contents) + var/obj/item/thing = pick(contents) if(ishuman(user)) - user.put_in_hands(I) + user.put_in_hands(thing) else - I.dropInto(loc) - to_chat(user, SPAN_NOTICE("You find \a [I] in the cistern.")) - w_items -= I.w_class + thing.dropInto(loc) + to_chat(user, SPAN_NOTICE("You find \a [thing] in the cistern.")) + w_items -= thing.w_class return TRUE if(user.check_dexterity(DEXTERITY_SIMPLE_MACHINES, TRUE)) @@ -188,8 +189,8 @@ var/global/list/hygiene_props = list() return TRUE return ..() -/obj/structure/hygiene/toilet/attackby(obj/item/I, var/mob/user) - if(IS_CROWBAR(I)) +/obj/structure/hygiene/toilet/attackby(obj/item/used_item, var/mob/user) + if(IS_CROWBAR(used_item)) to_chat(user, SPAN_NOTICE("You start to [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"].")) playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1) if(do_after(user, 30, src)) @@ -202,16 +203,16 @@ var/global/list/hygiene_props = list() return TRUE if(cistern && !isrobot(user)) //STOP PUTTING YOUR MODULES IN THE TOILET. - if(I.w_class > ITEM_SIZE_NORMAL) - to_chat(user, SPAN_WARNING("\The [I] does not fit.")) + if(used_item.w_class > ITEM_SIZE_NORMAL) + to_chat(user, SPAN_WARNING("\The [used_item] does not fit.")) return TRUE - if(w_items + I.w_class > ITEM_SIZE_HUGE) + if(w_items + used_item.w_class > ITEM_SIZE_HUGE) to_chat(user, SPAN_WARNING("The cistern is full.")) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - w_items += I.w_class - to_chat(user, SPAN_NOTICE("You carefully place \the [I] into the cistern.")) + w_items += used_item.w_class + to_chat(user, SPAN_NOTICE("You carefully place \the [used_item] into the cistern.")) return TRUE . = ..() @@ -300,21 +301,21 @@ var/global/list/hygiene_props = list() if(. != INITIALIZE_HINT_QDEL) addtimer(CALLBACK(src, TYPE_PROC_REF(/datum, qdel_self)), 25 SECONDS) -/obj/structure/hygiene/shower/attackby(obj/item/I, var/mob/user) - if(istype(I, /obj/item/scanner/gas)) +/obj/structure/hygiene/shower/attackby(obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/scanner/gas)) to_chat(user, SPAN_NOTICE("The water temperature seems to be [watertemp].")) return TRUE - if(IS_WRENCH(I)) + if(IS_WRENCH(used_item)) var/newtemp = input(user, "What setting would you like to set the temperature valve to?", "Water Temperature Valve") in temperature_settings - if(newtemp != watertemp && !QDELETED(I) && !QDELETED(user) && !QDELETED(src) && user.Adjacent(src) && I.loc == src) - to_chat(user, SPAN_NOTICE("You begin to adjust the temperature valve with \the [I].")) + if(newtemp != watertemp && !QDELETED(used_item) && !QDELETED(user) && !QDELETED(src) && user.Adjacent(src) && used_item.loc == src) + to_chat(user, SPAN_NOTICE("You begin to adjust the temperature valve with \the [used_item].")) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, (5 SECONDS), src) && newtemp != watertemp) watertemp = newtemp user.visible_message( - SPAN_NOTICE("\The [user] adjusts \the [src] with \the [I]."), - SPAN_NOTICE("You adjust the shower with \the [I].")) + SPAN_NOTICE("\The [user] adjusts \the [src] with \the [used_item]."), + SPAN_NOTICE("You adjust the shower with \the [used_item].")) add_fingerprint(user) return TRUE . = ..() @@ -405,15 +406,15 @@ var/global/list/hygiene_props = list() SPAN_NOTICE("You wash your hands using \the [src].")) return TRUE -/obj/structure/hygiene/sink/attackby(obj/item/hit_with, var/mob/user) - if(isplunger(hit_with) && clogged > 0) +/obj/structure/hygiene/sink/attackby(obj/item/used_item, var/mob/user) + if(isplunger(used_item) && clogged > 0) return ..() if(busy) to_chat(user, SPAN_WARNING("Someone's already washing here.")) return TRUE - var/obj/item/chems/chem_container = hit_with + var/obj/item/chems/chem_container = used_item if (istype(chem_container) && ATOM_IS_OPEN_CONTAINER(chem_container) && chem_container.reagents) user.visible_message( SPAN_NOTICE("\The [user] fills \the [chem_container] using \the [src]."), @@ -422,8 +423,8 @@ var/global/list/hygiene_props = list() chem_container.add_to_reagents(/decl/material/liquid/water, min(REAGENTS_FREE_SPACE(chem_container.reagents), chem_container.amount_per_transfer_from_this)) return TRUE - else if (istype(hit_with, /obj/item/baton)) - var/obj/item/baton/baton = hit_with + else if (istype(used_item, /obj/item/baton)) + var/obj/item/baton/baton = used_item var/obj/item/cell/cell = baton.get_cell() if(cell?.check_charge(0) && baton.status) if(isliving(user)) @@ -434,25 +435,25 @@ var/global/list/hygiene_props = list() // robot users used to be handled separately, but deductcharge handles that for us baton.deductcharge(baton.hitcost) var/decl/pronouns/user_pronouns = user.get_pronouns() - user.visible_message(SPAN_DANGER("\The [user] was stunned by [user_pronouns.his] wet [hit_with]!")) + user.visible_message(SPAN_DANGER("\The [user] was stunned by [user_pronouns.his] wet [used_item]!")) return TRUE - else if(istype(hit_with, /obj/item/mop)) - if(REAGENTS_FREE_SPACE(hit_with.reagents) >= 5) - hit_with.add_to_reagents(/decl/material/liquid/water, 5) - to_chat(user, SPAN_NOTICE("You wet \the [hit_with] in \the [src].")) + else if(istype(used_item, /obj/item/mop)) + if(REAGENTS_FREE_SPACE(used_item.reagents) >= 5) + used_item.add_to_reagents(/decl/material/liquid/water, 5) + to_chat(user, SPAN_NOTICE("You wet \the [used_item] in \the [src].")) playsound(loc, 'sound/effects/slosh.ogg', 25, 1) else - to_chat(user, SPAN_WARNING("\The [hit_with] is saturated.")) + to_chat(user, SPAN_WARNING("\The [used_item] is saturated.")) return TRUE var/turf/location = user.loc if(!isturf(location)) return FALSE - if(!istype(hit_with)) + if(!istype(used_item)) return FALSE - to_chat(usr, SPAN_NOTICE("You start washing \the [hit_with].")) + to_chat(usr, SPAN_NOTICE("You start washing \the [used_item].")) playsound(loc, 'sound/effects/sink_long.ogg', 75, 1) busy = TRUE @@ -461,13 +462,13 @@ var/global/list/hygiene_props = list() return TRUE busy = FALSE - if(istype(hit_with, /obj/item/chems/spray/extinguisher)) + if(istype(used_item, /obj/item/chems/spray/extinguisher)) return TRUE // We're washing, not filling. - hit_with.clean() + used_item.clean() user.visible_message( \ - SPAN_NOTICE("\The [user] washes \a [hit_with] using \the [src]."), - SPAN_NOTICE("You wash \a [hit_with] using \the [src].")) + SPAN_NOTICE("\The [user] washes \a [used_item] using \the [src]."), + SPAN_NOTICE("You wash \a [used_item] using \the [src].")) return TRUE @@ -486,10 +487,10 @@ var/global/list/hygiene_props = list() flick("puddle-splash", src) return ..() -/obj/structure/hygiene/sink/puddle/attackby(obj/item/O, var/mob/user) - icon_state = "puddle-splash" +/obj/structure/hygiene/sink/puddle/attackby(obj/item/used_item, var/mob/user) . = ..() - icon_state = "puddle" + if(.) + flick("puddle-splash", src) //////////////////////////////////////////////////// // Toilet Paper Roll diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 56324d48a196..8fbd7f7f983e 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -115,11 +115,11 @@ return TRUE return FALSE -/obj/structure/windoor_assembly/attackby(obj/item/W, mob/user) +/obj/structure/windoor_assembly/attackby(obj/item/used_item, mob/user) . = ..() if(!. && anchored) - if(!secure && istype(W, /obj/item/stack/material/rods)) - var/obj/item/stack/material/rods/R = W + if(!secure && istype(used_item, /obj/item/stack/material/rods)) + var/obj/item/stack/material/rods/R = used_item if(R.get_amount() < 4) to_chat(user, SPAN_WARNING("You need more rods to do this.")) return TRUE @@ -128,14 +128,14 @@ visible_message(SPAN_NOTICE("\The [user] finishes reinforcing \the [src].")) secure = TRUE . = TRUE - else if(wired && !electronics && istype(W, /obj/item/stock_parts/circuitboard/airlock_electronics/windoor)) + else if(wired && !electronics && istype(used_item, /obj/item/stock_parts/circuitboard/airlock_electronics/windoor)) playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1) - visible_message(SPAN_NOTICE("\The [user] starts installing \the [W] into \the [src].")) - if(do_after(user, 4 SECONDS, src) && wired && !electronics && anchored && !QDELETED(src) && user.try_unequip(W, src)) - visible_message(SPAN_NOTICE("\The [user] finishes installing \the [W] into \the [src].")) - electronics = W + visible_message(SPAN_NOTICE("\The [user] starts installing \the [used_item] into \the [src].")) + if(do_after(user, 4 SECONDS, src) && wired && !electronics && anchored && !QDELETED(src) && user.try_unequip(used_item, src)) + visible_message(SPAN_NOTICE("\The [user] finishes installing \the [used_item] into \the [src].")) + electronics = used_item else - W.dropInto(loc) + used_item.dropInto(loc) . = TRUE update_icon() update_name() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index dcc075f7e4f6..f128e44b16f6 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -7,10 +7,12 @@ color = GLASS_COLOR layer = SIDE_WINDOW_LAYER - anchored = TRUE + anchored = FALSE // Base, non-premapped type should start unanchored. atom_flags = ATOM_FLAG_CHECKS_BORDER | ATOM_FLAG_CAN_BE_PAINTED obj_flags = OBJ_FLAG_ROTATABLE | OBJ_FLAG_MOVES_UNSUPPORTED - alpha = 180 + base_alpha = 100 // at 0.3 opacity for glass, this will result in a total alpha of around 176 + alpha = 180 // preview value + material_alteration = MAT_FLAG_ALTERATION_COLOR material = /decl/material/solid/glass rad_resistance_modifier = 0.5 atmos_canpass = CANPASS_PROC @@ -22,7 +24,7 @@ var/const/CONSTRUCTION_STATE_NO_FRAME = 0 var/const/CONSTRUCTION_STATE_IN_FRAME = 1 var/const/CONSTRUCTION_STATE_FASTENED = 2 - var/construction_state = CONSTRUCTION_STATE_FASTENED + var/construction_state = CONSTRUCTION_STATE_NO_FRAME var/id var/polarized = 0 var/basestate = "window" @@ -38,10 +40,19 @@ connections = dirs_to_corner_states(dirs) other_connections = dirs_to_corner_states(other_dirs) -/obj/structure/window/update_materials(var/keep_health) - . = ..() - name = "[reinf_material ? "reinforced " : ""][material.solid_name] window" - desc = "A window pane made from [material.solid_name]." +/obj/structure/window/update_material_name(override_name) + var/base_name = override_name || initial(name) + if(istype(material)) + SetName("[reinf_material ? "reinforced " : ""][material.adjective_name] [base_name]") + else + SetName(base_name) + +/obj/structure/window/update_material_desc(var/override_desc) + if(istype(material)) + var/reinf_string = istype(reinf_material) ? " reinforced with [reinf_material.use_name]" : null + desc = "A window pane made from [material.solid_name][reinf_string]." + else + ..() /obj/structure/window/Initialize(var/ml, var/_mat, var/_reinf_mat, var/dir_to_set, var/anchored) . = ..(ml, _mat, _reinf_mat) @@ -50,6 +61,8 @@ if(. != INITIALIZE_HINT_QDEL) if(!isnull(anchored)) set_anchored(anchored) + if(!anchored) + construction_state = CONSTRUCTION_STATE_NO_FRAME if(!isnull(dir_to_set)) set_dir(dir_to_set) if(is_fulltile()) @@ -252,9 +265,9 @@ to_chat(user, SPAN_NOTICE("You cut the wiring and remove the polarization from \the [src].")) return TRUE -/obj/structure/window/attackby(obj/item/W, mob/user) +/obj/structure/window/attackby(obj/item/used_item, mob/user) // bespoke interactions not handled by the prior procs - if(IS_MULTITOOL(W)) + if(IS_MULTITOOL(used_item)) if (!polarized) to_chat(user, SPAN_WARNING("\The [src] is not polarized.")) return TRUE @@ -264,13 +277,13 @@ toggle() else var/response = input(user, "New Window ID:", name, id) as null | text - if (isnull(response) || user.incapacitated() || !user.Adjacent(src) || user.get_active_held_item() != W) + if (isnull(response) || user.incapacitated() || !user.Adjacent(src) || user.get_active_held_item() != used_item) return TRUE id = sanitize_safe(response, MAX_NAME_LEN) to_chat(user, SPAN_NOTICE("The new ID of \the [src] is [id].")) return TRUE - else if(istype(W, /obj/item/gun/energy/plasmacutter) && anchored) - var/obj/item/gun/energy/plasmacutter/cutter = W + else if(istype(used_item, /obj/item/gun/energy/plasmacutter) && anchored) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(!cutter.slice(user)) return TRUE // failed to finish or otherwise failed, prevent further interactions playsound(src, 'sound/items/Welder.ogg', 80, 1) @@ -279,7 +292,7 @@ visible_message(SPAN_WARNING("[user] has sliced through the window's frame!")) playsound(src, 'sound/items/Welder.ogg', 80, 1) set_anchored(FALSE) - if (istype(W, /obj/item/paint_sprayer)) + if (istype(used_item, /obj/item/paint_sprayer)) return FALSE // allow afterattack to run return ..() // handle generic interactions, bashing, etc @@ -414,8 +427,8 @@ //This proc is used to update the icons of nearby windows. It should not be confused with update_nearby_tiles(), which is an atmos proc! /obj/structure/window/proc/update_nearby_icons() update_icon() - for(var/obj/structure/window/W in orange(src, 1)) - W.update_icon() + for(var/obj/structure/window/window in orange(src, 1)) + window.update_icon() // Visually connect with every type of window as long as it's full-tile. /obj/structure/window/can_visually_connect() @@ -472,6 +485,7 @@ ..() /obj/structure/window/basic + anchored = TRUE // Premapped type, start anchored. icon_state = "window" color = GLASS_COLOR @@ -486,6 +500,7 @@ name = "borosilicate window" color = GLASS_COLOR_SILICATE material = /decl/material/solid/glass/borosilicate + anchored = TRUE // Premapped type, start anchored. /obj/structure/window/borosilicate/full dir = NORTHEAST @@ -497,6 +512,8 @@ color = GLASS_COLOR_SILICATE material = /decl/material/solid/glass/borosilicate reinf_material = /decl/material/solid/metal/steel + anchored = TRUE // Premapped type, start anchored and fastened. + construction_state = CONSTRUCTION_STATE_FASTENED /obj/structure/window/borosilicate_reinforced/full dir = NORTHEAST @@ -507,6 +524,8 @@ icon_state = "rwindow" material = /decl/material/solid/glass reinf_material = /decl/material/solid/metal/steel + anchored = TRUE // Premapped type, start anchored and fastened. + construction_state = CONSTRUCTION_STATE_FASTENED /obj/structure/window/reinforced/full dir = NORTHEAST @@ -528,6 +547,7 @@ basestate = "w" reinf_basestate = "w" dir = NORTHEAST + anchored = TRUE // Premapped type, start anchored. /obj/structure/window/reinforced/polarized name = "electrochromic window" @@ -564,8 +584,8 @@ construct_state = /decl/machine_construction/wall_frame/panel_closed/simple base_type = /obj/machinery/button/windowtint -/obj/machinery/button/windowtint/attackby(obj/item/W, mob/user) - if(IS_MULTITOOL(W)) +/obj/machinery/button/windowtint/attackby(obj/item/used_item, mob/user) + if(IS_MULTITOOL(used_item)) var/t = sanitize_safe(input(user, "Enter the ID for the button.", name, id_tag), MAX_NAME_LEN) if(!CanPhysicallyInteract(user)) return TRUE @@ -579,9 +599,9 @@ /obj/machinery/button/windowtint/activate() if(operating) return - for(var/obj/structure/window/W in range(src,range)) - if(W.polarized && (W.id == id_tag || !W.id)) - W.toggle() + for(var/obj/structure/window/window in range(src,range)) + if(window.polarized && (window.id == id_tag || !window.id)) + window.toggle() ..() /obj/machinery/button/windowtint/power_change() @@ -619,27 +639,26 @@ if (!ST.can_use(required_amount)) to_chat(user, SPAN_NOTICE("You do not have enough sheets.")) return - for(var/obj/structure/window/WINDOW in loc) - if(WINDOW.dir == dir_to_set) + for(var/obj/structure/window/existing_window in loc) + if(existing_window.dir == dir_to_set) to_chat(user, SPAN_NOTICE("There is already a window facing this way there.")) return - if(WINDOW.is_fulltile() && (dir_to_set & (dir_to_set - 1))) //two fulltile windows + if(existing_window.is_fulltile() && (dir_to_set & (dir_to_set - 1))) //two fulltile windows to_chat(user, SPAN_NOTICE("There is already a window there.")) return to_chat(user, SPAN_NOTICE("You start placing the window.")) - if(do_after(user,20)) - for(var/obj/structure/window/WINDOW in loc) - if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting. + if(do_after(user, 2 SECONDS)) + for(var/obj/structure/window/existing_window in loc) + if(existing_window.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting. to_chat(user, SPAN_NOTICE("There is already a window facing this way there.")) return - if(WINDOW.is_fulltile() && (dir_to_set & (dir_to_set - 1))) + if(existing_window.is_fulltile() && (dir_to_set & (dir_to_set - 1))) to_chat(user, SPAN_NOTICE("There is already a window there.")) return if (ST.use(required_amount)) var/obj/structure/window/WD = new(loc, ST.material.type, ST.reinf_material?.type, dir_to_set, FALSE) to_chat(user, SPAN_NOTICE("You place [WD].")) - WD.set_anchored(FALSE) // handles setting construction state for us else to_chat(user, SPAN_NOTICE("You do not have enough sheets.")) return diff --git a/code/game/objects/structures/window_spawner.dm b/code/game/objects/structures/window_spawner.dm index 95f24c0fd089..2b3e90164e1a 100644 --- a/code/game/objects/structures/window_spawner.dm +++ b/code/game/objects/structures/window_spawner.dm @@ -9,6 +9,7 @@ icon_state = "wingrille" density = TRUE anchored = TRUE + atmos_canpass = CANPASS_NEVER var/win_path = /obj/structure/window/basic var/activated = FALSE var/fulltile = FALSE @@ -50,10 +51,10 @@ if(!other) var/found_connection if(locate(/obj/structure/grille) in T) - for(var/obj/structure/window/W in T) - if(W.type == win_path && W.dir == get_dir(T,src)) + for(var/obj/structure/window/window in T) + if(window.type == win_path && window.dir == get_dir(T,src)) found_connection = 1 - qdel(W) + qdel(window) if(!found_connection) var/obj/structure/window/new_win = new win_path(loc) new_win.set_dir(dir) @@ -71,7 +72,7 @@ for(var/obj/effect/wingrille_spawn/other in neighbours) if(!other.activated) other.activate() -/obj/effect/wingrille_spawn/proc/handle_window_spawn(var/obj/structure/window/W) +/obj/effect/wingrille_spawn/proc/handle_window_spawn(var/obj/structure/window/window) return // Currently unused, could be useful for pre-wired electrified windows. diff --git a/code/game/turfs/flooring/_flooring.dm b/code/game/turfs/flooring/_flooring.dm index 14e490f0aed6..a4e97fe7d360 100644 --- a/code/game/turfs/flooring/_flooring.dm +++ b/code/game/turfs/flooring/_flooring.dm @@ -194,12 +194,6 @@ var/global/list/flooring_cache = list() if(target.icon_state != target.floor_icon_state_override) target.icon_state = target.floor_icon_state_override - if(color) - target.color = color - else if(!can_paint || isnull(target.paint_color)) - var/decl/material/use_material = target.get_material() - target.color = use_material?.color - if (icon_edge_layer != FLOOR_EDGE_NONE && (has_internal_edges || has_external_edges)) var/edge_layer = target.layer + icon_edge_layer var/list/edge_overlays = list() diff --git a/code/game/turfs/flooring/_flooring_decals.dm b/code/game/turfs/flooring/_flooring_decals.dm index 57b678005ee5..50ca2d36ab71 100644 --- a/code/game/turfs/flooring/_flooring_decals.dm +++ b/code/game/turfs/flooring/_flooring_decals.dm @@ -1525,3 +1525,113 @@ var/global/list/floor_decals = list() /obj/effect/floor_decal/arrows name = "floor arrows" icon_state = "arrows" + +//Old tile, taken from Polaris +//TODO: Change these colors to use color defines? +/obj/effect/floor_decal/corner_oldtile + name = "corner oldtile" + icon_state = "corner_oldtile" + +/obj/effect/floor_decal/corner_oldtile/white + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#d9d9d9" + +/obj/effect/floor_decal/corner_oldtile/white/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/white/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" + +/obj/effect/floor_decal/corner_oldtile/blue + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#8ba7ad" + +/obj/effect/floor_decal/corner_oldtile/blue/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/blue/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" + +/obj/effect/floor_decal/corner_oldtile/yellow + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#8c6d46" + +/obj/effect/floor_decal/corner_oldtile/yellow/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/yellow/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" + +/obj/effect/floor_decal/corner_oldtile/gray + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#687172" + +/obj/effect/floor_decal/corner_oldtile/gray/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/gray/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" + +/obj/effect/floor_decal/corner_oldtile/beige + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#385e60" + +/obj/effect/floor_decal/corner_oldtile/beige/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/beige/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" + +/obj/effect/floor_decal/corner_oldtile/red + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#964e51" + +/obj/effect/floor_decal/corner_oldtile/red/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/red/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" + +/obj/effect/floor_decal/corner_oldtile/purple + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#906987" + +/obj/effect/floor_decal/corner_oldtile/purple/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/purple/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" + +/obj/effect/floor_decal/corner_oldtile/green + name = "corner oldtile" + icon_state = "corner_oldtile" + color = "#46725c" + +/obj/effect/floor_decal/corner_oldtile/green/diagonal + name = "corner oldtile diagonal" + icon_state = "corner_oldtile_diagonal" + +/obj/effect/floor_decal/corner_oldtile/green/full + name = "corner oldtile full" + icon_state = "corner_oldtile_full" \ No newline at end of file diff --git a/code/game/turfs/flooring/flooring_grass.dm b/code/game/turfs/flooring/flooring_grass.dm index e557193db38d..bc340140b5d5 100644 --- a/code/game/turfs/flooring/flooring_grass.dm +++ b/code/game/turfs/flooring/flooring_grass.dm @@ -6,7 +6,7 @@ has_base_range = 3 footstep_type = /decl/footsteps/grass icon_edge_layer = FLOOR_EDGE_GRASS - color = "#5e7a3b" + color = null // color from material turf_flags = TURF_FLAG_BACKGROUND | TURF_IS_HOLOMAP_PATH | TURF_FLAG_ABSORB_LIQUID can_engrave = FALSE damage_temperature = T0C+80 @@ -50,5 +50,6 @@ desc = "Do they smoke grass out in space, Bowie? Or do they smoke AstroTurf?" icon = 'icons/turf/flooring/fakegrass.dmi' has_base_range = 3 + color = "#5e7a3b" build_type = /obj/item/stack/tile/grass force_material = /decl/material/solid/organic/plastic diff --git a/code/game/turfs/flooring/flooring_mud.dm b/code/game/turfs/flooring/flooring_mud.dm index d6d77b4e9e31..6265343f2e7f 100644 --- a/code/game/turfs/flooring/flooring_mud.dm +++ b/code/game/turfs/flooring/flooring_mud.dm @@ -28,7 +28,7 @@ walker.add_walking_contaminant(force_material.type, rand(2,3)) /decl/flooring/mud/can_show_coating_footprints(turf/target, decl/material/contaminant) - if(force_material.type == contaminant) // So we don't end up covered in a million footsteps that we provided. + if(force_material == contaminant) // So we don't end up covered in a million footsteps that we provided. return FALSE return ..() diff --git a/code/game/turfs/flooring/flooring_path.dm b/code/game/turfs/flooring/flooring_path.dm index 475573d57730..cd821d713a86 100644 --- a/code/game/turfs/flooring/flooring_path.dm +++ b/code/game/turfs/flooring/flooring_path.dm @@ -27,15 +27,18 @@ icon_base = "cobble" icon_edge_layer = FLOOR_EDGE_PATH flooring_flags = TURF_REMOVE_CROWBAR + has_base_range = 1 /decl/flooring/path/running_bond name = "stone path" desc = "A rustic stone path, laid out in a running bond pattern." icon_base = "runningbond" + has_base_range = 3 gender = NEUTER /decl/flooring/path/herringbone name = "stone path" desc = "A rustic stone path, laid out in a herringbone pattern." icon_base = "herringbone" + has_base_range = null gender = NEUTER diff --git a/code/game/turfs/flooring/flooring_snow.dm b/code/game/turfs/flooring/flooring_snow.dm index 7ef511ab0e33..8dabb7167af5 100644 --- a/code/game/turfs/flooring/flooring_snow.dm +++ b/code/game/turfs/flooring/flooring_snow.dm @@ -41,7 +41,7 @@ walker.add_walking_contaminant(force_material.type, rand(1, 2)) /decl/flooring/snow/can_show_coating_footprints(turf/target, decl/material/contaminant) - if(force_material.type == contaminant) // So we don't end up covered in a million footsteps that we provided. + if(force_material == contaminant) // So we don't end up covered in a million footsteps that we provided. return FALSE return ..() diff --git a/code/game/turfs/flooring/flooring_wood.dm b/code/game/turfs/flooring/flooring_wood.dm index b5fc086d42f4..d7352fb03ae2 100644 --- a/code/game/turfs/flooring/flooring_wood.dm +++ b/code/game/turfs/flooring/flooring_wood.dm @@ -9,7 +9,7 @@ build_type = /obj/item/stack/tile/wood flooring_flags = TURF_IS_FRAGILE | TURF_REMOVE_SCREWDRIVER footstep_type = /decl/footsteps/wood - color = /decl/material/solid/organic/wood/oak::color + color = null force_material = /decl/material/solid/organic/wood/oak constructed = TRUE gender = NEUTER @@ -24,32 +24,26 @@ ) /decl/flooring/wood/mahogany - color = /decl/material/solid/organic/wood/mahogany::color build_type = /obj/item/stack/tile/wood/mahogany force_material = /decl/material/solid/organic/wood/mahogany /decl/flooring/wood/maple - color = /decl/material/solid/organic/wood/maple::color build_type = /obj/item/stack/tile/wood/maple force_material = /decl/material/solid/organic/wood/maple /decl/flooring/wood/ebony - color = /decl/material/solid/organic/wood/ebony::color build_type = /obj/item/stack/tile/wood/ebony force_material = /decl/material/solid/organic/wood/ebony /decl/flooring/wood/walnut - color = /decl/material/solid/organic/wood/walnut::color build_type = /obj/item/stack/tile/wood/walnut force_material = /decl/material/solid/organic/wood/walnut /decl/flooring/wood/bamboo - color = /decl/material/solid/organic/wood/bamboo::color build_type = /obj/item/stack/tile/wood/bamboo force_material = /decl/material/solid/organic/wood/bamboo /decl/flooring/wood/yew - color = /decl/material/solid/organic/wood/yew::color build_type = /obj/item/stack/tile/wood/yew force_material = /decl/material/solid/organic/wood/yew @@ -65,32 +59,26 @@ broken_states = null /decl/flooring/wood/rough/mahogany - color = /decl/material/solid/organic/wood/mahogany::color build_type = /obj/item/stack/tile/wood/rough/mahogany force_material = /decl/material/solid/organic/wood/mahogany /decl/flooring/wood/rough/maple - color = /decl/material/solid/organic/wood/maple::color build_type = /obj/item/stack/tile/wood/rough/maple force_material = /decl/material/solid/organic/wood/maple /decl/flooring/wood/rough/ebony - color = /decl/material/solid/organic/wood/ebony::color build_type = /obj/item/stack/tile/wood/rough/ebony force_material = /decl/material/solid/organic/wood/ebony /decl/flooring/wood/rough/walnut - color = /decl/material/solid/organic/wood/walnut::color build_type = /obj/item/stack/tile/wood/rough/walnut force_material = /decl/material/solid/organic/wood/walnut /decl/flooring/wood/rough/bamboo - color = /decl/material/solid/organic/wood/bamboo::color build_type = /obj/item/stack/tile/wood/rough/bamboo force_material = /decl/material/solid/organic/wood/bamboo /decl/flooring/wood/rough/yew - color = /decl/material/solid/organic/wood/yew::color build_type = /obj/item/stack/tile/wood/rough/yew force_material = /decl/material/solid/organic/wood/yew @@ -105,7 +93,7 @@ build_type = /obj/item/stack/tile/wood/laminate/oak flooring_flags = TURF_IS_FRAGILE | TURF_REMOVE_SCREWDRIVER footstep_type = /decl/footsteps/wood - color = /decl/material/solid/organic/wood/chipboard::color + color = null force_material = /decl/material/solid/organic/wood/chipboard constructed = TRUE gender = NEUTER @@ -120,26 +108,21 @@ ) /decl/flooring/laminate/mahogany - color = /decl/material/solid/organic/wood/chipboard/mahogany::color build_type = /obj/item/stack/tile/wood/laminate/mahogany force_material = /decl/material/solid/organic/wood/chipboard/mahogany /decl/flooring/laminate/maple - color = /decl/material/solid/organic/wood/chipboard/maple::color build_type = /obj/item/stack/tile/wood/laminate/maple force_material = /decl/material/solid/organic/wood/chipboard/maple /decl/flooring/laminate/ebony - color = /decl/material/solid/organic/wood/chipboard/ebony::color build_type = /obj/item/stack/tile/wood/laminate/ebony force_material = /decl/material/solid/organic/wood/chipboard/ebony /decl/flooring/laminate/walnut - color = /decl/material/solid/organic/wood/chipboard/walnut::color build_type = /obj/item/stack/tile/wood/laminate/walnut - force_material = /decl/material/solid/organic/wood/chipboard/yew + force_material = /decl/material/solid/organic/wood/chipboard/walnut /decl/flooring/laminate/yew - color = /decl/material/solid/organic/wood/chipboard/yew::color build_type = /obj/item/stack/tile/wood/laminate/yew force_material = /decl/material/solid/organic/wood/chipboard/yew diff --git a/code/game/turfs/floors/_floor.dm b/code/game/turfs/floors/_floor.dm index 7dc51d0f1746..22123008d757 100644 --- a/code/game/turfs/floors/_floor.dm +++ b/code/game/turfs/floors/_floor.dm @@ -5,7 +5,6 @@ layer = PLATING_LAYER permit_ao = TRUE thermal_conductivity = 0.040 - heat_capacity = 10000 explosion_resistance = 1 turf_flags = TURF_IS_HOLOMAP_PATH initial_gas = GAS_STANDARD_AIRMIX @@ -46,16 +45,9 @@ fill_to_zero_height() // try to refill turfs that act as fluid sources if(floor_material || get_topmost_flooring()) - update_from_flooring() - if(!ml) - for(var/direction in global.alldirs) - var/turf/target_turf = get_step_resolving_mimic(src, direction) - if(istype(target_turf)) - if(TICK_CHECK) // not CHECK_TICK -- only queue if the server is overloaded - target_turf.queue_icon_update() - else - target_turf.update_icon() - update_icon() + update_from_flooring(skip_update = ml) + if(ml) // We skipped the update above to avoid updating our neighbors, but we need to update ourselves. + lazy_update_icon() /turf/floor/ChangeTurf(turf/N, tell_universe, force_lighting_update, keep_air, update_open_turfs_above, keep_height) @@ -121,10 +113,10 @@ else physically_destroyed() -/turf/floor/get_footstep_sound(var/mob/caller) +/turf/floor/get_footstep_sound(var/mob/stepper) var/decl/flooring/use_flooring = get_topmost_flooring() if(istype(use_flooring)) - return get_footstep_for_mob(use_flooring.footstep_type, caller) + return get_footstep_for_mob(use_flooring.footstep_type, stepper) return ..() /turf/floor/get_movable_alpha_mask_state(atom/movable/mover) diff --git a/code/game/turfs/floors/floor_acts.dm b/code/game/turfs/floors/floor_acts.dm index 1280fd30cfa9..b231da61241b 100644 --- a/code/game/turfs/floors/floor_acts.dm +++ b/code/game/turfs/floors/floor_acts.dm @@ -54,6 +54,6 @@ /turf/floor/adjacent_fire_act(turf/adj_turf, datum/gas_mixture/adj_air, adj_temp, adj_volume) var/dir_to = get_dir(src, adj_turf) - for(var/obj/structure/window/W in src) - if(W.dir == dir_to || W.is_fulltile()) //Same direction or diagonal (full tile) - W.fire_act(adj_air, adj_temp, adj_volume) + for(var/obj/structure/window/window in src) + if(window.dir == dir_to || window.is_fulltile()) //Same direction or diagonal (full tile) + window.fire_act(adj_air, adj_temp, adj_volume) diff --git a/code/game/turfs/floors/floor_attackby.dm b/code/game/turfs/floors/floor_attackby.dm index 8b81baf3ae7a..c509629a34d2 100644 --- a/code/game/turfs/floors/floor_attackby.dm +++ b/code/game/turfs/floors/floor_attackby.dm @@ -51,7 +51,12 @@ for(var/decl/flooring/F as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/flooring)) if(!F.build_type) continue - if((ispath(S.type, F.build_type) || ispath(S.build_type, F.build_type)) && (isnull(F.build_material) || S.material?.type == F.build_material)) + // If S.build_type is set, we expect an exact match. Otherwise, we do + // an ispath on S.type. This is a shitty way to disambiguate carpet + // types because they're in the ugly position of "same material, built + // with a subtype" whereas with everything else, material + type + // disambiguates well enough. + if((S.build_type ? S.build_type == F.build_type : ispath(S.type, F.build_type)) && (isnull(F.build_material) || S.material?.type == F.build_material)) use_flooring = F break if(!use_flooring) diff --git a/code/game/turfs/floors/floor_icon.dm b/code/game/turfs/floors/floor_icon.dm index 0946e0d363ed..2b799313b9b1 100644 --- a/code/game/turfs/floors/floor_icon.dm +++ b/code/game/turfs/floors/floor_icon.dm @@ -71,15 +71,17 @@ // Draw a cliff wall if we have a northern neighbor that isn't part of our trench. var/turf/floor/neighbor = get_step_resolving_mimic(src, NORTH) - if(isturf(neighbor) && neighbor.is_open()) + // skip null and unsim edges, because we don't want trench edges along the edges of a map for no reason + if(!neighbor?.simulated || (isturf(neighbor) && neighbor.is_open())) return - if(!istype(neighbor) || (neighbor.get_physical_height() > my_height)) + if(!istype(neighbor, /turf/floor) || (neighbor.get_physical_height() > my_height)) - var/trench_icon = (istype(neighbor) && neighbor.get_trench_icon()) || get_trench_icon() + var/trench_icon = (istype(neighbor, /turf/floor) && neighbor.get_trench_icon()) || get_trench_icon() if(trench_icon) // cache the trench image, keyed by icon and color - var/trench_color = isatom(neighbor) ? neighbor.get_color() : get_color() + // formerly an isatom check but it should never be a non-atom true value + var/trench_color = neighbor ? neighbor.get_color() : get_color() var/trench_icon_key = "[ref(trench_icon)][trench_color]" I = _trench_image_cache[trench_icon_key] if(!I) diff --git a/code/game/turfs/floors/floor_layers.dm b/code/game/turfs/floors/floor_layers.dm index e482d21fc5a4..5396b3607cf2 100644 --- a/code/game/turfs/floors/floor_layers.dm +++ b/code/game/turfs/floors/floor_layers.dm @@ -5,16 +5,13 @@ /turf/floor/proc/get_all_flooring() . = list() - if(istype(_flooring)) - . += _flooring - else if(ispath(_flooring)) - . += GET_DECL(_flooring) - else if(islist(_flooring)) - for(var/floor in _flooring) - if(ispath(floor)) - _flooring += GET_DECL(floor) - else if(istype(floor, /decl/flooring)) - _flooring += floor + if(_flooring) + if(islist(_flooring)) + for(var/floor in _flooring) + . += RESOLVE_TO_DECL(floor) + _flooring = . // ensure the list elements are resolved + else + . += RESOLVE_TO_DECL(_flooring) if(_base_flooring) . += get_base_flooring() @@ -22,15 +19,11 @@ return !isnull(_flooring) /turf/floor/proc/set_base_flooring(new_base_flooring, skip_update) - if(ispath(new_base_flooring, /decl/flooring)) - new_base_flooring = GET_DECL(new_base_flooring) - else if(!istype(new_base_flooring, /decl/flooring)) - new_base_flooring = null + // We can never have a null base flooring. + new_base_flooring = RESOLVE_TO_DECL(new_base_flooring || initial(_base_flooring) || /decl/flooring/plating) if(_base_flooring == new_base_flooring) return _base_flooring = new_base_flooring - if(!_base_flooring) // We can never have a null base flooring. - _base_flooring = GET_DECL(initial(_base_flooring)) || GET_DECL(/decl/flooring/plating) update_from_flooring(skip_update) /turf/floor/proc/get_base_flooring() @@ -43,15 +36,14 @@ RETURN_TYPE(/decl/flooring) if(isnull(_topmost_flooring)) - var/flooring_length = length(_flooring) - if(flooring_length) // no need to check islist, length is only nonzero for lists and strings, and strings are invalid here - _topmost_flooring = _flooring[flooring_length] - else if(istype(_flooring, /decl/flooring)) - _topmost_flooring = _flooring - else if(ispath(_flooring, /decl/flooring)) - _topmost_flooring = GET_DECL(_flooring) - else + if(isnull(_flooring)) _topmost_flooring = FALSE + else + var/flooring_length = length(_flooring) + if(flooring_length) // no need to check islist, length is only nonzero for lists and strings, and strings are invalid here + _topmost_flooring = RESOLVE_TO_DECL(_flooring[flooring_length]) + else + _topmost_flooring = RESOLVE_TO_DECL(_flooring) return _topmost_flooring || get_base_flooring() /turf/floor/proc/clear_flooring(skip_update = FALSE, place_product) @@ -81,8 +73,7 @@ return // Validate our input. - if(ispath(flooring)) - flooring = GET_DECL(flooring) + flooring = RESOLVE_TO_DECL(flooring) if(!istype(flooring)) return @@ -100,8 +91,8 @@ return LAZYCLEARLIST(decals) - for(var/obj/effect/decal/writing/W in src) - qdel(W) + for(var/obj/effect/decal/writing/writing in src) + qdel(writing) flooring.on_flooring_remove(src) @@ -145,14 +136,9 @@ if(islist(newflooring)) _flooring = list() for(var/floor in UNLINT(newflooring)) - if(ispath(floor)) - floor = GET_DECL(floor) - if(istype(floor, /decl/flooring)) - _flooring += floor - else if(ispath(newflooring)) - _flooring = GET_DECL(newflooring) - else if(istype(newflooring)) - _flooring = newflooring + _flooring += RESOLVE_TO_DECL(floor) + else if(newflooring) + _flooring = RESOLVE_TO_DECL(newflooring) else return FALSE @@ -184,9 +170,8 @@ return // We only want to work with references. - if(ispath(newflooring, /decl/flooring)) - newflooring = GET_DECL(newflooring) - else if(!istype(newflooring, /decl/flooring)) + newflooring = RESOLVE_TO_DECL(newflooring) + if(!newflooring) return FALSE // Check if the layer is already present. @@ -250,8 +235,8 @@ qdel(print) if(!skip_update) - update_icon() + lazy_update_icon() for(var/dir in global.alldirs) var/turf/neighbor = get_step_resolving_mimic(src, dir) if(istype(neighbor)) - neighbor.update_icon() + neighbor.lazy_update_icon() diff --git a/code/game/turfs/floors/subtypes/floor_path.dm b/code/game/turfs/floors/subtypes/floor_path.dm index 65e09e4733c7..7d714f8efab9 100644 --- a/code/game/turfs/floors/subtypes/floor_path.dm +++ b/code/game/turfs/floors/subtypes/floor_path.dm @@ -5,7 +5,7 @@ desc = "A cobbled path made of loose stones." color = COLOR_GRAY icon = 'icons/turf/flooring/path.dmi' - icon_state = "cobble" + icon_state = "cobble0" _flooring = /decl/flooring/path/cobblestone floor_material = /decl/material/solid/stone/sandstone _base_flooring = /decl/flooring/dirt @@ -28,7 +28,7 @@ LAZYADD(decals, moss) /turf/floor/path/running_bond - icon_state = "runningbond" + icon_state = "runningbond0" _flooring = /decl/flooring/path/running_bond /turf/floor/path/herringbone diff --git a/code/game/turfs/floors/subtypes/floor_static.dm b/code/game/turfs/floors/subtypes/floor_static.dm index e990493c61a4..0a345025524a 100644 --- a/code/game/turfs/floors/subtypes/floor_static.dm +++ b/code/game/turfs/floors/subtypes/floor_static.dm @@ -9,8 +9,8 @@ footstep_type = /decl/footsteps/plating is_outside = OUTSIDE_AREA -/turf/floor/fixed/attackby(var/obj/item/C, var/mob/user) - if(istype(C, /obj/item/stack) && !IS_COIL(C)) +/turf/floor/fixed/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/stack) && !IS_COIL(used_item)) return TRUE return ..() @@ -29,8 +29,8 @@ icon = 'icons/turf/flooring/alium.dmi' icon_state = "jaggy" -/turf/floor/fixed/alium/attackby(var/obj/item/C, var/mob/user) - if(IS_CROWBAR(C)) +/turf/floor/fixed/alium/attackby(var/obj/item/used_item, var/mob/user) + if(IS_CROWBAR(used_item)) to_chat(user, "There aren't any openings big enough to pry it away...") return TRUE return ..() diff --git a/code/game/turfs/initialization/init.dm b/code/game/turfs/initialization/init.dm index 4229a04db9a7..1553584fcd6e 100644 --- a/code/game/turfs/initialization/init.dm +++ b/code/game/turfs/initialization/init.dm @@ -7,6 +7,7 @@ /area/Initialize(mapload) . = ..() if(ispath(turf_initializer)) - var/decl/turf_initializer/ti = GET_DECL(turf_initializer) - for(var/turf/T in src) - ti.InitializeTurf(T) + var/decl/turf_initializer/initializer = GET_DECL(turf_initializer) + // TODO: It may be worth doing a post-mapload loop over turfs instead, to limit the number of in-area (in-world) loops? + for(var/turf/initialized_turf in src) + initializer.InitializeTurf(initialized_turf) diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm index e763a49a8384..3836af3e8072 100644 --- a/code/game/turfs/open/_open.dm +++ b/code/game/turfs/open/_open.dm @@ -48,35 +48,35 @@ /turf/open/is_open() return TRUE -/turf/open/attackby(obj/item/C, mob/user) +/turf/open/attackby(obj/item/used_item, mob/user) - if(istype(C, /obj/item/stack/material/rods)) + if(istype(used_item, /obj/item/stack/material/rods)) var/ladder = (locate(/obj/structure/ladder) in src) if(ladder) to_chat(user, SPAN_WARNING("\The [ladder] is in the way.")) return TRUE var/obj/structure/lattice/lattice = locate(/obj/structure/lattice, src) if(lattice) - return lattice.attackby(C, user) - var/obj/item/stack/material/rods/rods = C + return lattice.attackby(used_item, user) + var/obj/item/stack/material/rods/rods = used_item if (rods.use(1)) to_chat(user, SPAN_NOTICE("You lay down the support lattice.")) playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) new /obj/structure/lattice(src, rods.material.type) return TRUE - if (istype(C, /obj/item/stack/tile)) - var/obj/item/stack/tile/tile = C + if (istype(used_item, /obj/item/stack/tile)) + var/obj/item/stack/tile/tile = used_item tile.try_build_turf(user, src) return TRUE //To lay cable. - if(IS_COIL(C) && try_build_cable(C, user)) + if(IS_COIL(used_item) && try_build_cable(used_item, user)) return TRUE for(var/atom/movable/M in below) if(M.movable_flags & MOVABLE_FLAG_Z_INTERACT) - return M.attackby(C, user) + return M.attackby(used_item, user) return FALSE diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 874422eae0b8..0c4d7107c015 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -92,23 +92,23 @@ return ..() -/turf/space/attackby(obj/item/C, mob/user) +/turf/space/attackby(obj/item/used_item, mob/user) - if (istype(C, /obj/item/stack/material/rods)) + if (istype(used_item, /obj/item/stack/material/rods)) var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) if(L) - return L.attackby(C, user) - var/obj/item/stack/material/rods/R = C - if (R.use(1)) + return L.attackby(used_item, user) + var/obj/item/stack/material/rods/rods = used_item + if (rods.use(1)) to_chat(user, "Constructing support lattice ...") playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) - new /obj/structure/lattice(src, R.material.type) + new /obj/structure/lattice(src, rods.material.type) return TRUE - if (istype(C, /obj/item/stack/tile/floor)) + if (istype(used_item, /obj/item/stack/tile/floor)) var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) if(L) - var/obj/item/stack/tile/floor/S = C + var/obj/item/stack/tile/floor/S = used_item if (!S.use(1)) return TRUE playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) diff --git a/code/game/turfs/space/transit.dm b/code/game/turfs/space/transit.dm index 9a6aff50393d..37b63eb82cde 100644 --- a/code/game/turfs/space/transit.dm +++ b/code/game/turfs/space/transit.dm @@ -2,7 +2,7 @@ var/push_direction // push things that get caught in the transit tile this direction //Overwrite because we dont want people building rods in space. -/turf/space/transit/attackby(obj/O, mob/user) +/turf/space/transit/attackby(obj/item/used_item, mob/user) return TRUE /turf/space/transit/Initialize() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 36812e0f3f53..285f4fc05c5c 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -19,7 +19,6 @@ //Properties for airtight tiles (/wall) var/thermal_conductivity = 0.05 - var/heat_capacity = 1 //Properties for both /// Does this turf contain air/let air through? @@ -242,20 +241,20 @@ grab.affecting.DoMove(get_dir(grab.affecting.loc, src), user, TRUE) return TRUE -/turf/attackby(obj/item/W, mob/user) +/turf/attackby(obj/item/used_item, mob/user) if(is_floor()) - if(istype(W, /obj/item/stack/tile)) - var/obj/item/stack/tile/T = W + if(istype(used_item, /obj/item/stack/tile)) + var/obj/item/stack/tile/T = used_item T.try_build_turf(user, src) return TRUE - if(IS_HOE(W) && can_dig_farm(W.material?.hardness)) - try_dig_farm(user, W) + if(IS_HOE(used_item) && can_dig_farm(used_item.material?.hardness)) + try_dig_farm(user, used_item) return TRUE - if(IS_SHOVEL(W)) + if(IS_SHOVEL(used_item)) // TODO: move these checks into the interaction handlers. var/atom/platform = get_supporting_platform() @@ -263,20 +262,20 @@ to_chat(user, SPAN_WARNING("\The [platform] [platform.get_pronouns().is] in the way!")) return TRUE - if(!can_be_dug(W.material?.hardness)) - to_chat(user, SPAN_WARNING("\The [src] is too hard to be dug with \the [W].")) + if(!can_be_dug(used_item.material?.hardness)) + to_chat(user, SPAN_WARNING("\The [src] is too hard to be dug with \the [used_item].")) return TRUE - if(user.check_intent(I_FLAG_HELP) && can_dig_pit(W.material?.hardness)) - try_dig_pit(user, W) - else if(can_dig_trench(W.material?.hardness)) - try_dig_trench(user, W) + if(user.check_intent(I_FLAG_HELP) && can_dig_pit(used_item.material?.hardness)) + try_dig_pit(user, used_item) + else if(can_dig_trench(used_item.material?.hardness)) + try_dig_trench(user, used_item) else - to_chat(user, SPAN_WARNING("You cannot dig anything out of \the [src] with \the [W].")) + to_chat(user, SPAN_WARNING("You cannot dig anything out of \the [src] with \the [used_item].")) return TRUE var/decl/material/material = get_material() - if(IS_PICK(W) && material) + if(IS_PICK(used_item) && material) // TODO: move these checks into the interaction handlers. var/atom/platform = get_supporting_platform() @@ -285,29 +284,29 @@ return TRUE if(material?.hardness <= MAT_VALUE_FLEXIBLE) - to_chat(user, SPAN_WARNING("\The [src] is too soft to be excavated with \the [W]. Use a shovel.")) + to_chat(user, SPAN_WARNING("\The [src] is too soft to be excavated with \the [used_item]. Use a shovel.")) return TRUE // Let picks dig out hard turfs, but not dig pits. - if(!can_be_dug(W.material?.hardness, using_tool = TOOL_PICK)) - to_chat(user, SPAN_WARNING("\The [src] is too hard to be excavated with \the [W].")) + if(!can_be_dug(used_item.material?.hardness, using_tool = TOOL_PICK)) + to_chat(user, SPAN_WARNING("\The [src] is too hard to be excavated with \the [used_item].")) return TRUE - if(can_dig_trench(W.material?.hardness, using_tool = TOOL_PICK)) - try_dig_trench(user, W, using_tool = TOOL_PICK) + if(can_dig_trench(used_item.material?.hardness, using_tool = TOOL_PICK)) + try_dig_trench(user, used_item, using_tool = TOOL_PICK) else - to_chat(user, SPAN_WARNING("You cannot excavate \the [src] with \the [W].")) + to_chat(user, SPAN_WARNING("You cannot excavate \the [src] with \the [used_item].")) return TRUE - if(W?.storage?.collection_mode && W.storage.gather_all(src, user)) + if(used_item?.storage?.collection_mode && used_item.storage.gather_all(src, user)) return TRUE - if(istype(W, /obj/item) && storage && storage.use_to_pickup && storage.collection_mode) + if(istype(used_item, /obj/item) && storage && storage.use_to_pickup && storage.collection_mode) storage.gather_all(src, user) return TRUE - if(IS_COIL(W) && try_build_cable(W, user)) + if(IS_COIL(used_item) && try_build_cable(used_item, user)) return TRUE return ..() @@ -421,15 +420,18 @@ L.Add(t) return L -/turf/proc/contains_dense_objects(list/exceptions) - if(density) - return TRUE +/turf/proc/get_first_dense_object(list/exceptions) for(var/atom/A in src) if(exceptions && (exceptions == A || (islist(exceptions) && (A in exceptions)))) continue if(A.density && !(A.atom_flags & ATOM_FLAG_CHECKS_BORDER)) - return TRUE - return FALSE + return A + return null + +/turf/proc/contains_dense_objects(list/exceptions) + if(density) + return TRUE + return !!get_first_dense_object(exceptions) /turf/proc/remove_cleanables() for(var/obj/effect/decal/cleanable/cleanable in src) @@ -475,7 +477,7 @@ return var/too_much_graffiti = 0 - for(var/obj/effect/decal/writing/W in src) + for(var/obj/effect/decal/writing/writing in src) too_much_graffiti++ if(too_much_graffiti >= 5) to_chat(vandal, "There's too much graffiti here to add more.") @@ -864,7 +866,7 @@ if(IS_HOE(held) && can_dig_farm(held.material?.hardness)) LAZYADD(., /decl/interaction_handler/dig/farm) -/// Contaminant may be the chemical type of the footprint being provided, +/// Contaminant may be the chemical decl of the footprint being provided, /// or null if we just want to know if we support footprints, at all, ever. /turf/proc/can_show_coating_footprints(decl/material/contaminant) return simulated diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm index a43c8994c4d4..ac2e306ea590 100644 --- a/code/game/turfs/turf_changing.dm +++ b/code/game/turfs/turf_changing.dm @@ -71,6 +71,8 @@ var/old_affecting_heat_sources = affecting_heat_sources var/old_height = get_physical_height() var/old_alpha_mask_state = get_movable_alpha_mask_state(null) + var/old_event_listeners = event_listeners + var/old_listening_to = _listening_to var/old_ambience = ambient_light var/old_ambience_mult = ambient_light_multiplier @@ -95,34 +97,37 @@ qdel(src) . = new N(src) - var/turf/W = . - W.above = old_above // Multiz ref tracking. - W.prev_type = old_prev_type // Shuttle transition turf tracking. + var/turf/changed_turf = . + changed_turf.above = old_above // Multiz ref tracking. + changed_turf.prev_type = old_prev_type // Shuttle transition turf tracking. + // Set our observation bookkeeping lists back. + changed_turf.event_listeners = old_event_listeners + changed_turf._listening_to = old_listening_to - W.affecting_heat_sources = old_affecting_heat_sources + changed_turf.affecting_heat_sources = old_affecting_heat_sources if (permit_ao) regenerate_ao() // Update ZAS, atmos and fire. - if(keep_air && W.can_inherit_air) - W.air = old_air + if(keep_air && changed_turf.can_inherit_air) + changed_turf.air = old_air if(old_fire) - if(W.simulated) - W.fire = old_fire + if(changed_turf.simulated) + changed_turf.fire = old_fire else if(old_fire) qdel(old_fire) - if(old_flooded != W.flooded) + if(old_flooded != changed_turf.flooded) set_flooded(old_flooded) // Raise appropriate events. - W.post_change() + changed_turf.post_change() if(tell_universe) - global.universe.OnTurfChange(W) + global.universe.OnTurfChange(changed_turf) - if(W.density != old_density) - RAISE_EVENT(/decl/observ/density_set, W, old_density, W.density) + if(changed_turf.density != old_density && changed_turf.event_listeners?[/decl/observ/density_set]) + changed_turf.raise_event_non_global(/decl/observ/density_set, old_density, changed_turf.density) // lighting stuff @@ -153,12 +158,12 @@ // end of lighting stuff // we check the var rather than the proc, because area outside values usually shouldn't be set on turfs - W.last_outside_check = OUTSIDE_UNCERTAIN - if(W.is_outside != old_outside) + changed_turf.last_outside_check = OUTSIDE_UNCERTAIN + if(changed_turf.is_outside != old_outside) // This will check the exterior atmos participation of this turf and all turfs connected by open space below. - W.set_outside(old_outside, skip_weather_update = TRUE) + changed_turf.set_outside(old_outside, skip_weather_update = TRUE) else // We didn't already update our external atmos participation in set_outside. - if(HasBelow(z) && (W.is_open() != old_is_open)) // Otherwise, we do it here if the open status of the turf has changed. + if(HasBelow(z) && (changed_turf.is_open() != old_is_open)) // Otherwise, we do it here if the open status of the turf has changed. var/turf/checking = src while(HasBelow(checking.z)) checking = GetBelow(checking) @@ -168,19 +173,19 @@ if(!checking.is_open()) break // In case the turf isn't marked for update in Initialize (e.g. space), we call this to create any unsimulated edges necessary. - if(W.zone_membership_candidate != old_zone_membership_candidate) + if(changed_turf.zone_membership_candidate != old_zone_membership_candidate) update_external_atmos_participation() - W.update_weather(force_update_below = W.is_open() != old_is_open) + changed_turf.update_weather(force_update_below = changed_turf.is_open() != old_is_open) if(keep_height) - W.set_physical_height(old_height) + changed_turf.set_physical_height(old_height) if(update_open_turfs_above) update_open_above(old_open_turf_type) if(old_alpha_mask_state != get_movable_alpha_mask_state(null)) - for(var/atom/movable/AM as anything in W) + for(var/atom/movable/AM as anything in changed_turf) AM.update_turf_alpha_mask() /turf/proc/transport_properties_from(turf/other, transport_air) diff --git a/code/game/turfs/turf_fluids.dm b/code/game/turfs/turf_fluids.dm index f0dd37d11c1a..48c6e74fc863 100644 --- a/code/game/turfs/turf_fluids.dm +++ b/code/game/turfs/turf_fluids.dm @@ -166,13 +166,12 @@ if(!length(reagents?.reagent_volumes) || !istype(air)) return var/update_air = FALSE - for(var/rtype in reagents.reagent_volumes) - var/decl/material/mat = GET_DECL(rtype) - if(mat.gas_flags & XGM_GAS_FUEL) - var/moles = round(reagents.reagent_volumes[rtype] / REAGENT_UNITS_PER_GAS_MOLE) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(reagent.gas_flags & XGM_GAS_FUEL) + var/moles = round(reagents.reagent_volumes[reagent] / REAGENT_UNITS_PER_GAS_MOLE) if(moles > 0) - air.adjust_gas(rtype, moles, FALSE) - remove_from_reagents(rtype, round(moles * REAGENT_UNITS_PER_GAS_MOLE)) + air.adjust_gas(reagent.type, moles, FALSE) + remove_from_reagents(reagent, round(moles * REAGENT_UNITS_PER_GAS_MOLE)) update_air = TRUE if(update_air) air.update_values() @@ -190,7 +189,7 @@ if(reagents?.total_volume > FLUID_QDEL_POINT) ADD_ACTIVE_FLUID(src) var/decl/material/primary_reagent = reagents.get_primary_reagent_decl() - if(primary_reagent && (REAGENT_VOLUME(reagents, primary_reagent.type) >= primary_reagent.slippery_amount)) + if(primary_reagent && (REAGENT_VOLUME(reagents, primary_reagent) >= primary_reagent.slippery_amount)) last_slipperiness = primary_reagent.slipperiness else last_slipperiness = 0 @@ -217,10 +216,10 @@ solids = reagents if(LAZYLEN(solids?.solid_volumes)) var/list/matter_list = list() - for(var/reagent_type in solids.solid_volumes) - var/reagent_amount = solids.solid_volumes[reagent_type] - matter_list[reagent_type] = round(reagent_amount/REAGENT_UNITS_PER_MATERIAL_UNIT) - solids.remove_reagent(reagent_type, reagent_amount, defer_update = TRUE, removed_phases = MAT_PHASE_SOLID) + for(var/decl/material/reagent as anything in solids.solid_volumes) + var/reagent_amount = solids.solid_volumes[reagent] + matter_list[reagent.type] = round(reagent_amount/REAGENT_UNITS_PER_MATERIAL_UNIT) + solids.remove_reagent(reagent, reagent_amount, defer_update = TRUE, removed_phases = MAT_PHASE_SOLID) var/obj/item/debris/scraps/chemical/scraps = locate() in contents if(!istype(scraps) || scraps.get_total_matter() >= MAX_SCRAP_MATTER) diff --git a/code/game/turfs/turf_footsteps.dm b/code/game/turfs/turf_footsteps.dm index bfa1f9171569..e9c2ff24ca47 100644 --- a/code/game/turfs/turf_footsteps.dm +++ b/code/game/turfs/turf_footsteps.dm @@ -1,15 +1,15 @@ -/proc/get_footstep_for_mob(var/footstep_type, var/mob/living/caller) - . = istype(caller) && caller.get_mob_footstep(footstep_type) +/proc/get_footstep_for_mob(var/footstep_type, var/mob/living/stepper) + . = istype(stepper) && stepper.get_mob_footstep(footstep_type) if(!.) - var/decl/footsteps/FS = GET_DECL(footstep_type) - . = pick(FS.footstep_sounds) + var/decl/footsteps/footsteps = GET_DECL(footstep_type) + . = pick(footsteps.footstep_sounds) -/turf/proc/get_footstep_sound(var/mob/caller) +/turf/proc/get_footstep_sound(var/mob/stepper) for(var/obj/structure/S in contents) if(S.footstep_type) - return get_footstep_for_mob(S.footstep_type, caller) + return get_footstep_for_mob(S.footstep_type, stepper) if(check_fluid_depth(10) && !is_flooded(TRUE)) - return get_footstep_for_mob(/decl/footsteps/water, caller) + return get_footstep_for_mob(/decl/footsteps/water, stepper) if(footstep_type) - return get_footstep_for_mob(footstep_type, caller) - return get_footstep_for_mob(/decl/footsteps/blank, caller) + return get_footstep_for_mob(footstep_type, stepper) + return get_footstep_for_mob(/decl/footsteps/blank, stepper) diff --git a/code/game/turfs/walls/_wall.dm b/code/game/turfs/walls/_wall.dm index 3ad1fc1f62d8..ef02c8f94328 100644 --- a/code/game/turfs/walls/_wall.dm +++ b/code/game/turfs/walls/_wall.dm @@ -25,7 +25,6 @@ var/global/list/wall_fullblend_objects = list( density = TRUE blocks_air = 1 thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT - heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall explosion_resistance = 10 color = COLOR_STEEL turf_flags = TURF_IS_HOLOMAP_OBSTACLE @@ -103,10 +102,10 @@ var/global/list/wall_fullblend_objects = list( . = ..() var/turf/debris = locate(old_x, old_y, old_z) if(debris) - for(var/turf/wall/W in RANGE_TURFS(debris, 1)) - W.wall_connections = null - W.other_connections = null - W.queue_icon_update() + for(var/turf/wall/wall in RANGE_TURFS(debris, 1)) + wall.wall_connections = null + wall.other_connections = null + wall.queue_icon_update() // Walls always hide the stuff below them. /turf/wall/levelupdate() @@ -301,9 +300,9 @@ var/global/list/wall_fullblend_objects = list( /turf/wall/proc/burn(temperature) if(!QDELETED(src) && istype(material) && material.combustion_effect(src, temperature, 0.7)) - for(var/turf/wall/W in range(3,src)) - if(W != src) - addtimer(CALLBACK(W, TYPE_PROC_REF(/turf/wall, burn), temperature/4), 2) + for(var/turf/wall/wall in range(3,src)) + if(wall != src) + addtimer(CALLBACK(wall, TYPE_PROC_REF(/turf/wall, burn), temperature/4), 2) physically_destroyed() /turf/wall/set_color(new_color) diff --git a/code/game/turfs/walls/wall_attacks.dm b/code/game/turfs/walls/wall_attacks.dm index 9e8eb62472e5..15cd5a1dbeec 100644 --- a/code/game/turfs/walls/wall_attacks.dm +++ b/code/game/turfs/walls/wall_attacks.dm @@ -111,48 +111,48 @@ if(!.) return try_touch(user, (locate(/obj/effect/overlay/wallrot) in src)) -/turf/wall/proc/handle_wall_tool_interactions(obj/item/W, mob/user) +/turf/wall/proc/handle_wall_tool_interactions(obj/item/used_item, mob/user) //get the user's location if(!isturf(user.loc)) return FALSE //can't do this stuff whilst inside objects and such - if(!construction_stage && try_graffiti(user, W)) + if(!construction_stage && try_graffiti(user, used_item)) return TRUE - if(W) + if(used_item) radiate() - if(W.get_heat() >= T100C) - burn(W.get_heat()) + if(used_item.get_heat() >= T100C) + burn(used_item.get_heat()) . = TRUE if(locate(/obj/effect/overlay/wallrot) in src) - if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W - if( WT.weld(0,user) ) - to_chat(user, "You burn away the fungi with \the [WT].") + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if( welder.weld(0,user) ) + to_chat(user, "You burn away the fungi with \the [welder].") playsound(src, 'sound/items/Welder.ogg', 10, 1) for(var/obj/effect/overlay/wallrot/WR in src) qdel(WR) return TRUE else - var/force = W.expend_attack_force(user) - if((!W.is_sharp() && !W.has_edge() && force >= 10) || force >= 20) - to_chat(user, "\The [src] crumbles away under the force of your [W.name].") + var/force = used_item.expend_attack_force(user) + if((!used_item.is_sharp() && !used_item.has_edge() && force >= 10) || force >= 20) + to_chat(user, "\The [src] crumbles away under the force of your [used_item.name].") physically_destroyed() return TRUE var/turf/T = user.loc //get user's location for delay checks - if(damage && istype(W, /obj/item/weldingtool)) + if(damage && istype(used_item, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = W + var/obj/item/weldingtool/welder = used_item - if(WT.weld(0,user)) + if(welder.weld(0,user)) to_chat(user, "You start repairing the damage to [src].") playsound(src, 'sound/items/Welder.ogg', 100, 1) - if(do_after(user, max(5, damage / 5), src) && WT && WT.isOn()) + if(do_after(user, max(5, damage / 5), src) && welder && welder.isOn()) to_chat(user, "You finish repairing the damage to [src].") take_damage(-damage) return TRUE // Basic dismantling. if(isnull(construction_stage) || !reinf_material) - var/datum/extension/demolisher/demolition = get_extension(W, /datum/extension/demolisher) + var/datum/extension/demolisher/demolition = get_extension(used_item, /datum/extension/demolisher) if(istype(demolition) && demolition.try_demolish(user, src)) return TRUE @@ -161,9 +161,9 @@ switch(construction_stage) if(6) - if(W.is_special_cutting_tool(TRUE)) + if(used_item.is_special_cutting_tool(TRUE)) - to_chat(user, "You drive \the [W] into the wall and begin trying to rip out the support frame...") + to_chat(user, "You drive \the [used_item] into the wall and begin trying to rip out the support frame...") playsound(src, 'sound/items/Welder.ogg', 100, 1) . = TRUE @@ -175,14 +175,14 @@ user.visible_message("The wall was torn open by [user]!") playsound(src, 'sound/items/Welder.ogg', 100, 1) - else if(IS_WIRECUTTER(W)) + else if(IS_WIRECUTTER(used_item)) playsound(src, 'sound/items/Wirecutter.ogg', 100, 1) construction_stage = 5 to_chat(user, "You cut the outer grille.") update_icon() return TRUE if(5) - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) to_chat(user, "You begin removing the support lines.") playsound(src, 'sound/items/Screwdriver.ogg', 100, 1) . = TRUE @@ -192,24 +192,24 @@ update_icon() to_chat(user, "You remove the support lines.") return - else if(istype(W,/obj/item/weldingtool)) - var/obj/item/weldingtool/WT = W - if(WT.weld(0,user)) + else if(istype(used_item,/obj/item/weldingtool)) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0,user)) construction_stage = 6 update_icon() to_chat(user, SPAN_NOTICE("You repair the outer grille.")) return TRUE if(4) var/cut_cover - if(istype(W,/obj/item/weldingtool)) - var/obj/item/weldingtool/WT = W - if(WT.weld(0,user)) + if(istype(used_item,/obj/item/weldingtool)) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0,user)) cut_cover=1 else return - else if (W.is_special_cutting_tool()) - if(istype(W, /obj/item/gun/energy/plasmacutter)) - var/obj/item/gun/energy/plasmacutter/cutter = W + else if (used_item.is_special_cutting_tool()) + if(istype(used_item, /obj/item/gun/energy/plasmacutter)) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(!cutter.slice(user)) return cut_cover = 1 @@ -224,7 +224,7 @@ to_chat(user, "You press firmly on the cover, dislodging it.") return if(3) - if(IS_CROWBAR(W)) + if(IS_CROWBAR(used_item)) to_chat(user, "You struggle to pry off the cover.") playsound(src, 'sound/items/Crowbar.ogg', 100, 1) . = TRUE @@ -235,7 +235,7 @@ to_chat(user, "You pry off the cover.") return if(2) - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) to_chat(user, "You start loosening the anchoring bolts which secure the support rods to their frame.") playsound(src, 'sound/items/Ratchet.ogg', 100, 1) . = TRUE @@ -247,15 +247,15 @@ return if(1) var/cut_cover - if(istype(W, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = W - if( WT.weld(0,user) ) + if(istype(used_item, /obj/item/weldingtool)) + var/obj/item/weldingtool/welder = used_item + if( welder.weld(0,user) ) cut_cover=1 else return - else if(W.is_special_cutting_tool()) - if(istype(W, /obj/item/gun/energy/plasmacutter)) - var/obj/item/gun/energy/plasmacutter/cutter = W + else if(used_item.is_special_cutting_tool()) + if(istype(used_item, /obj/item/gun/energy/plasmacutter)) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(!cutter.slice(user)) return cut_cover = 1 @@ -270,51 +270,51 @@ to_chat(user, "You cut the support rods loose from the frame.") return if(0) - if(IS_CROWBAR(W)) + if(IS_CROWBAR(used_item)) to_chat(user, "You struggle to pry off the outer sheath.") playsound(src, 'sound/items/Crowbar.ogg', 100, 1) . = TRUE - if(!do_after(user,100,src) || !istype(src, /turf/wall) || !user || !W || !T ) return - if(user.loc == T && user.get_active_held_item() == W ) + if(!do_after(user,100,src) || !istype(src, /turf/wall) || !user || !used_item || !T ) return + if(user.loc == T && user.get_active_held_item() == used_item ) to_chat(user, "You pry off the outer sheath.") dismantle_turf() return return FALSE -/turf/wall/attackby(var/obj/item/W, var/mob/user, click_params) +/turf/wall/attackby(var/obj/item/used_item, var/mob/user, click_params) - if(istype(W, /obj/item/stack/tile/roof) || !user.check_dexterity(DEXTERITY_SIMPLE_MACHINES) || !W.user_can_attack_with(user)) + if(istype(used_item, /obj/item/stack/tile/roof) || !user.check_dexterity(DEXTERITY_SIMPLE_MACHINES) || !used_item.user_can_attack_with(user)) return ..() - if(handle_wall_tool_interactions(W, user)) + if(handle_wall_tool_interactions(used_item, user)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) return TRUE - if(istype(W,/obj/item/frame)) - var/obj/item/frame/F = W + if(istype(used_item,/obj/item/frame)) + var/obj/item/frame/F = used_item F.try_build(src, click_params) return TRUE // Attack the wall with items - var/force = W.expend_attack_force(user) - if(istype(W,/obj/item/rcd) || istype(W, /obj/item/chems) || !force || user.check_intent(I_FLAG_HELP)) + var/force = used_item.expend_attack_force(user) + if(istype(used_item,/obj/item/rcd) || istype(used_item, /obj/item/chems) || !force || user.check_intent(I_FLAG_HELP)) return ..() user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) user.do_attack_animation(src) var/material_divisor = max(material.brute_armor, reinf_material?.brute_armor) - if(W.atom_damage_type == BURN) + if(used_item.atom_damage_type == BURN) material_divisor = max(material.burn_armor, reinf_material?.burn_armor) var/effective_force = round(force / material_divisor) if(effective_force < 2) - visible_message(SPAN_DANGER("\The [user] [pick(W.attack_verb)] \the [src] with \the [W], but it had no effect!")) + visible_message(SPAN_DANGER("\The [user] [used_item.pick_attack_verb()] \the [src] with \the [used_item], but it had no effect!")) playsound(src, hitsound, 25, 1) return TRUE // Check for a glancing blow. - var/dam_prob = max(0, 100 - material.hardness + effective_force + W.armor_penetration) + var/dam_prob = max(0, 100 - material.hardness + effective_force + used_item.armor_penetration) if(!prob(dam_prob)) - visible_message(SPAN_DANGER("\The [user] [pick(W.attack_verb)] \the [src] with \the [W], but it bounced off!")) + visible_message(SPAN_DANGER("\The [user] [used_item.pick_attack_verb()] \the [src] with \the [used_item], but it bounced off!")) playsound(src, hitsound, 25, 1) if(user.skill_fail_prob(SKILL_HAULING, 40, SKILL_ADEPT)) SET_STATUS_MAX(user, STAT_WEAK, 2) @@ -322,6 +322,6 @@ return TRUE playsound(src, get_hit_sound(), 50, 1) - visible_message(SPAN_DANGER("\The [user] [pick(W.attack_verb)] \the [src] with \the [W]!")) + visible_message(SPAN_DANGER("\The [user] [used_item.pick_attack_verb()] \the [src] with \the [used_item]!")) take_damage(effective_force) return TRUE \ No newline at end of file diff --git a/code/game/turfs/walls/wall_icon.dm b/code/game/turfs/walls/wall_icon.dm index 08732bbecaf9..94ca6d9b6eca 100644 --- a/code/game/turfs/walls/wall_icon.dm +++ b/code/game/turfs/walls/wall_icon.dm @@ -24,17 +24,17 @@ if(update_neighbors) var/iterate_turfs = list() for(var/direction in global.alldirs) - var/turf/wall/W = get_step_resolving_mimic(src, direction) - if(istype(W)) - W.wall_connections = null - W.other_connections = null - iterate_turfs += W - for(var/turf/wall/W as anything in iterate_turfs) - W.update_icon() + var/turf/wall/wall = get_step_resolving_mimic(src, direction) + if(istype(wall)) + wall.wall_connections = null + wall.other_connections = null + iterate_turfs += wall + for(var/turf/wall/wall as anything in iterate_turfs) + wall.lazy_update_icon() else wall_connections = null other_connections = null - update_icon() + lazy_update_icon() /turf/wall/proc/paint_wall(var/new_paint_color) paint_color = new_paint_color @@ -219,13 +219,13 @@ integrity += reinf_material.integrity add_overlay(SSmaterials.wall_damage_overlays[clamp(round(damage / integrity * DAMAGE_OVERLAY_COUNT) + 1, 1, DAMAGE_OVERLAY_COUNT)]) -/turf/wall/proc/can_join_with(var/turf/wall/W) - if(unique_merge_identifier != W.unique_merge_identifier) +/turf/wall/proc/can_join_with(var/turf/wall/wall) + if(unique_merge_identifier != wall.unique_merge_identifier) return 0 else if(unique_merge_identifier) return 1 - else if(material && istype(W.material)) - var/other_wall_icon = W.get_wall_icon() + else if(material && istype(wall.material)) + var/other_wall_icon = wall.get_wall_icon() if(get_wall_icon() == other_wall_icon) return 1 if(material.wall_blend_icons[other_wall_icon]) diff --git a/code/game/turfs/walls/wall_natural.dm b/code/game/turfs/walls/wall_natural.dm index ce8ea3dbbce8..095e8f7ed26e 100644 --- a/code/game/turfs/walls/wall_natural.dm +++ b/code/game/turfs/walls/wall_natural.dm @@ -50,42 +50,42 @@ update_neighboring_ramps(destroying_self = TRUE) . = ..() -/turf/wall/natural/attackby(obj/item/W, mob/user, click_params) +/turf/wall/natural/attackby(obj/item/used_item, mob/user, click_params) if(user.check_dexterity(DEXTERITY_COMPLEX_TOOLS) && !ramp_slope_direction) - if(istype(W, /obj/item/depth_scanner)) - var/obj/item/depth_scanner/C = W + if(istype(used_item, /obj/item/depth_scanner)) + var/obj/item/depth_scanner/C = used_item C.scan_atom(user, src) return TRUE - if (istype(W, /obj/item/measuring_tape)) - var/obj/item/measuring_tape/P = W + if (istype(used_item, /obj/item/measuring_tape)) + var/obj/item/measuring_tape/P = used_item user.visible_message(SPAN_NOTICE("\The [user] extends [P] towards [src]."),SPAN_NOTICE("You extend [P] towards [src].")) if(do_after(user,10, src)) to_chat(user, SPAN_NOTICE("\The [src] has been excavated to a depth of [excavation_level]cm.")) return TRUE - if(istype(W, /obj/item/tool/xeno)) - return handle_xenoarch_tool_interaction(W, user) + if(istype(used_item, /obj/item/tool/xeno)) + return handle_xenoarch_tool_interaction(used_item, user) . = ..() // Drill out natural walls. -/turf/wall/natural/handle_wall_tool_interactions(obj/item/W, mob/user) - if(IS_PICK(W) && !being_mined) +/turf/wall/natural/handle_wall_tool_interactions(obj/item/used_item, mob/user) + if(IS_PICK(used_item) && !being_mined) var/check_material_hardness if(material) check_material_hardness = material.hardness if(reinf_material && (isnull(check_material_hardness) || check_material_hardness > reinf_material.hardness)) check_material_hardness = reinf_material.hardness - if(isnull(check_material_hardness) || W.material?.hardness < check_material_hardness) - to_chat(user, SPAN_WARNING("\The [W] is not hard enough to dig through \the [src].")) + if(isnull(check_material_hardness) || used_item.material?.hardness < check_material_hardness) + to_chat(user, SPAN_WARNING("\The [used_item] is not hard enough to dig through \the [src].")) return TRUE if(being_mined) return TRUE being_mined = TRUE - if(W.do_tool_interaction(TOOL_PICK, user, src, 2 SECONDS, suffix_message = destroy_artifacts(W, INFINITY))) + if(used_item.do_tool_interaction(TOOL_PICK, user, src, 2 SECONDS, suffix_message = destroy_artifacts(used_item, INFINITY))) dismantle_turf() if(istype(src, /turf/wall/natural)) // dismantle_turf() can change our type being_mined = FALSE diff --git a/code/game/turfs/walls/wall_natural_icon.dm b/code/game/turfs/walls/wall_natural_icon.dm index 1d99392c29f5..e0231caf658a 100644 --- a/code/game/turfs/walls/wall_natural_icon.dm +++ b/code/game/turfs/walls/wall_natural_icon.dm @@ -39,7 +39,7 @@ shine = exterior_wall_shine_cache[shine_cache_key] if(isnull(shine)) // patented formula based on color's value (in HSV) - shine = clamp((material.reflectiveness * 0.01) * 255, 10, (0.6 * ReadHSV(RGBtoHSV(material.color))[3])) + shine = clamp((material.reflectiveness * 0.01) * 255, 10, (0.6 * rgb2num(material.color, COLORSPACE_HSV)[3])) exterior_wall_shine_cache[shine_cache_key] = shine var/new_icon diff --git a/code/game/turfs/walls/wall_natural_xenoarch.dm b/code/game/turfs/walls/wall_natural_xenoarch.dm index e24be7d65b39..85a49e5282fb 100644 --- a/code/game/turfs/walls/wall_natural_xenoarch.dm +++ b/code/game/turfs/walls/wall_natural_xenoarch.dm @@ -112,13 +112,13 @@ if(amount_rocks > 0) pass_geodata_to(new /obj/item/stack/material/ore(src, amount_rocks, material?.type)) -/turf/wall/natural/proc/destroy_artifacts(var/obj/item/W, var/newDepth) +/turf/wall/natural/proc/destroy_artifacts(var/obj/item/used_item, var/newDepth) if(!length(finds)) return var/datum/find/F = finds[1] if(newDepth > F.excavation_required) // Digging too deep can break the item. At least you won't summon a Balrog (probably) - if(W) - . = ". [pick("There is a crunching noise","[W] collides with some different rock","Part of the rock face crumbles away","Something breaks under [W]")]" + if(used_item) + . = ". [pick("There is a crunching noise","[used_item] collides with some different rock","Part of the rock face crumbles away","Something breaks under [used_item]")]" if(prob(10)) return if(prob(25)) diff --git a/code/game/turfs/walls/wall_wattle.dm b/code/game/turfs/walls/wall_wattle.dm index 42a93e90fc08..4cdca1b6df0c 100644 --- a/code/game/turfs/walls/wall_wattle.dm +++ b/code/game/turfs/walls/wall_wattle.dm @@ -21,16 +21,16 @@ return list("", "paint") // paint should always be available because of plastering! // Daubing with clay or soil -/turf/wall/wattle/attackby(obj/item/W, mob/user, click_params) +/turf/wall/wattle/attackby(obj/item/used_item, mob/user, click_params) if(isnull(daubing_material)) var/static/list/daub_materials = list( // Does not include subtypes. /decl/material/solid/soil = TRUE, /decl/material/solid/clay = TRUE ) - if(istype(W, /obj/item/stack/material) && daub_materials[W.material?.type]) + if(istype(used_item, /obj/item/stack/material) && daub_materials[used_item.material?.type]) if(!user.check_dexterity(DEXTERITY_WIELD_ITEM)) return TRUE - var/obj/item/stack/material/stack = W + var/obj/item/stack/material/stack = used_item var/sheets_to_use = stack.matter_units_to_sheets(matter_to_daub) if(stack.can_use(sheets_to_use) && user.do_skilled(1 SECOND, daubing_skill, target = src) && stack.can_use(sheets_to_use)) to_chat(user, SPAN_NOTICE("You daub \the [src] with \the [stack].")) @@ -49,7 +49,7 @@ // daubed walls have the color of their daubing /turf/wall/wattle/get_base_color() if(daubing_material) - return "#ae9f70" // daubing_material.color // sorry, but using the daubing material color looks bad + return "#795946" // daubing_material.color // sorry, but using the daubing material color looks bad return ..() // don't plaster over our damn reinforcements @@ -76,8 +76,10 @@ else if(paint_color) if(reinf_material) SetName("[reinf_material.solid_name]-framed plastered wall") + desc = "A plastered wall framed with [reinf_material.solid_name]." else SetName("plastered wall") + desc = "A plastered wall." else if(reinf_material) SetName("[reinf_material.solid_name]-framed [material.adjective_name] wattle and daub wall") @@ -89,6 +91,7 @@ /turf/wall/wattle/daubed icon_state = "wattledaub" daubing_material = /decl/material/solid/clay + color = "#795946" // temporary mapping preview colour taken from get_base_color() // the daub is lost when destroyed/deconstructed, since it's dried anyway /turf/wall/wattle/daubed/plastered @@ -116,7 +119,6 @@ }; \ /turf/wall/wattle/daubed/##material_name { \ material = /decl/material/solid/organic/wood/##material_name; \ - color = /decl/material/solid/organic/wood/##material_name::color; \ }; \ /turf/wall/wattle/daubed/##material_name/shutter { \ shutter_state = FALSE; \ diff --git a/code/game/world_topic_commands.dm b/code/game/world_topic_commands.dm index cfd86601053b..ab871592c196 100644 --- a/code/game/world_topic_commands.dm +++ b/code/game/world_topic_commands.dm @@ -212,9 +212,9 @@ info["key"] = S.key if(isrobot(S)) - var/mob/living/silicon/robot/R = S - info["master"] = R.connected_ai?.name - info["sync"] = R.lawupdate + var/mob/living/silicon/robot/robot = S + info["master"] = robot.connected_ai?.name + info["sync"] = robot.lawupdate if(!S.laws) info["laws"] = null @@ -263,7 +263,6 @@ info["turf"] = MT ? "[MT] @ [MT.x], [MT.y], [MT.z]" : "null" info["area"] = MT ? "[MT.loc]" : "null" info["antag"] = M.mind ? (M.mind.get_special_role_name("Not antag")) : "No mind" - info["hasbeenrev"] = M.mind ? M.mind.has_been_rev : "No mind" info["stat"] = M.stat info["type"] = M.type if(isliving(M)) diff --git a/code/modules/ZAS/ConnectionManager.dm b/code/modules/ZAS/ConnectionManager.dm index 3890cd85f5cd..de4e36c81129 100644 --- a/code/modules/ZAS/ConnectionManager.dm +++ b/code/modules/ZAS/ConnectionManager.dm @@ -36,70 +36,71 @@ Macros: /turf/var/tmp/connection_manager/connections -/connection_manager/var/connection/N -/connection_manager/var/connection/S -/connection_manager/var/connection/E -/connection_manager/var/connection/W +/connection_manager + var/connection/north_connection + var/connection/south_connection + var/connection/east_connection + var/connection/west_connection #ifdef MULTIZAS -/connection_manager/var/connection/U -/connection_manager/var/connection/D + var/connection/upward_connection + var/connection/downward_connection #endif /connection_manager/proc/get(d) switch(d) if(NORTH) - if(check(N)) return N + if(check(north_connection)) return north_connection else return null if(SOUTH) - if(check(S)) return S + if(check(south_connection)) return south_connection else return null if(EAST) - if(check(E)) return E + if(check(east_connection)) return east_connection else return null if(WEST) - if(check(W)) return W + if(check(west_connection)) return west_connection else return null #ifdef MULTIZAS if(UP) - if(check(U)) return U + if(check(upward_connection)) return upward_connection else return null if(DOWN) - if(check(D)) return D + if(check(downward_connection)) return downward_connection else return null #endif /connection_manager/proc/place(connection/c, d) switch(d) - if(NORTH) N = c - if(SOUTH) S = c - if(EAST) E = c - if(WEST) W = c + if(NORTH) north_connection = c + if(SOUTH) south_connection = c + if(EAST) east_connection = c + if(WEST) west_connection = c #ifdef MULTIZAS - if(UP) U = c - if(DOWN) D = c + if(UP) upward_connection = c + if(DOWN) downward_connection = c #endif /connection_manager/proc/update_all() - if(check(N)) N.update() - if(check(S)) S.update() - if(check(E)) E.update() - if(check(W)) W.update() + if(check(north_connection)) north_connection.update() + if(check(south_connection)) south_connection.update() + if(check(east_connection)) east_connection.update() + if(check(west_connection)) west_connection.update() #ifdef MULTIZAS - if(check(U)) U.update() - if(check(D)) D.update() + if(check(upward_connection)) upward_connection.update() + if(check(downward_connection)) downward_connection.update() #endif /connection_manager/proc/erase_all() - if(check(N)) N.erase() - if(check(S)) S.erase() - if(check(E)) E.erase() - if(check(W)) W.erase() + if(check(north_connection)) north_connection.erase() + if(check(south_connection)) south_connection.erase() + if(check(east_connection)) east_connection.erase() + if(check(west_connection)) west_connection.erase() #ifdef MULTIZAS - if(check(U)) U.erase() - if(check(D)) D.erase() + if(check(upward_connection)) upward_connection.erase() + if(check(downward_connection)) downward_connection.erase() #endif #undef check diff --git a/code/modules/abstract/_abstract.dm b/code/modules/abstract/_abstract.dm index 11d081248ecb..9f944be9cb33 100644 --- a/code/modules/abstract/_abstract.dm +++ b/code/modules/abstract/_abstract.dm @@ -1,20 +1,22 @@ /obj/abstract - name = "" - icon = 'icons/effects/landmarks.dmi' - icon_state = "x2" - simulated = FALSE - density = FALSE - anchored = TRUE - abstract_type = /obj/abstract - invisibility = INVISIBILITY_ABSTRACT + name = "" + icon = 'icons/effects/landmarks.dmi' + icon_state = "x2" + simulated = FALSE + density = FALSE + anchored = TRUE + abstract_type = /obj/abstract + invisibility = INVISIBILITY_ABSTRACT + var/hide_on_init = TRUE /obj/abstract/Initialize() . = ..() verbs.Cut() - //Let mappers see the damn thing by just making them invisible here opacity = FALSE - alpha = 0 - mouse_opacity = MOUSE_OPACITY_UNCLICKABLE + //Let mappers see the damn thing by just making them invisible here + if(hide_on_init) + alpha = 0 + mouse_opacity = MOUSE_OPACITY_UNCLICKABLE /obj/abstract/explosion_act() SHOULD_CALL_PARENT(FALSE) diff --git a/code/modules/abstract/airlock_helper.dm b/code/modules/abstract/airlock_helper.dm index 3e70efba8d44..0dd25032a27d 100644 --- a/code/modules/abstract/airlock_helper.dm +++ b/code/modules/abstract/airlock_helper.dm @@ -145,4 +145,7 @@ You still need to set the controller's "id_tag" to something unique. /obj/abstract/airlock_helper/button my_device = /obj/machinery/button/access icon_state = "button" - tag_addon = "_airlock" + +/obj/abstract/airlock_helper/button/configure_associated_device() + var/obj/machinery/button/access/my_button = my_device + my_button.set_id_tag(my_controller.id_tag) \ No newline at end of file diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/abstract/corpse_spawner.dm similarity index 95% rename from code/modules/awaymissions/corpse.dm rename to code/modules/abstract/corpse_spawner.dm index 0974e8d543e6..47319d03325b 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/abstract/corpse_spawner.dm @@ -1,9 +1,3 @@ -//These are meant for spawning on maps, namely Away Missions. - -//If someone can do this in a neater way, be my guest-Kor - -//To do: Allow corpses to appear mangled, bloody, etc. Allow customizing the bodies appearance (they're all bald and white right now). - #define CORPSE_SPAWNER_RANDOM_NAME BITFLAG(0) #define CORPSE_SPAWNER_CUT_SURVIVAL BITFLAG(1) #define CORPSE_SPAWNER_CUT_ID_PDA BITFLAG(2) @@ -63,7 +57,7 @@ else M.randomize_skin_color() - var/decl/species/species_decl = get_species_by_key(species_choice) + var/decl/species/species_decl = decls_repository.get_decl_by_id(species_choice) var/decl/bodytype/root_bodytype = M.get_bodytype() var/update_hair = FALSE if((spawn_flags & CORPSE_SPAWNER_RANDOM_HAIR_COLOR)) diff --git a/code/modules/abstract/follower.dm b/code/modules/abstract/follower.dm new file mode 100644 index 000000000000..42611d1131d2 --- /dev/null +++ b/code/modules/abstract/follower.dm @@ -0,0 +1,18 @@ +// Simple obj for following another obj around (for light effects or such that need a physical reference) +/obj/abstract/follower + anchored = TRUE + simulated = FALSE + invisibility = INVISIBILITY_ABSTRACT + +/obj/abstract/follower/Initialize() + . = ..() + name = "" + verbs.Cut() + +/obj/abstract/follower/proc/follow_owner(atom/movable/owner) + if(istype(owner) && !QDELETED(owner)) + set_dir(owner.dir) + if(owner.loc) + forceMove(owner.loc) + else + forceMove(null) diff --git a/code/modules/acting/acting_items.dm b/code/modules/acting/acting_items.dm index 43fab6332707..daa5ba77f187 100644 --- a/code/modules/acting/acting_items.dm +++ b/code/modules/acting/acting_items.dm @@ -33,7 +33,7 @@ if(!ishuman(user)) return ..() var/mob/living/human/H = user - H.change_appearance(APPEARANCE_ALL, H.loc, H, H.generate_valid_species(), state = global.z_topic_state) + H.change_appearance(APPEARANCE_ALL, H.loc, H, state = global.z_topic_state) var/getName = sanitize(input(H, "Would you like to change your name to something else?", "Name change") as null|text, MAX_NAME_LEN) if(getName) H.real_name = getName diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index c211f274d603..1cd43c395226 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -216,9 +216,9 @@ var/global/BSACooldown = 0 else f = 0 if(L in M.languages) - body += "[L.name]" + body += "[L.name]" else - body += "[L.name]" + body += "[L.name]" body += {"
@@ -1252,8 +1252,8 @@ var/global/BSACooldown = 0 if(isAI(S)) to_chat(usr, "AI [key_name(S, usr)]'s laws:") else if(isrobot(S)) - var/mob/living/silicon/robot/R = S - to_chat(usr, "CYBORG [key_name(S, usr)] [R.connected_ai?"(Slaved to: [R.connected_ai])":"(Independant)"]: laws:") + var/mob/living/silicon/robot/robot = S + to_chat(usr, "CYBORG [key_name(S, usr)] [robot.connected_ai?"(Slaved to: [robot.connected_ai])":"(Independant)"]: laws:") else if (ispAI(S)) to_chat(usr, "pAI [key_name(S, usr)]'s laws:") else @@ -1415,10 +1415,10 @@ var/global/BSACooldown = 0 SPAN_OCCULT("OOC: \The [M] has been paralyzed by a staff member. Please hold all interactions with them until staff have finished with them."), SPAN_OCCULT("OOC: You have been paralyzed by a staff member. Please refer to your currently open admin help ticket or, if you don't have one, admin help for assistance.") ) - M.set_status(STAT_PARA, 8000) + M.set_status_condition(STAT_PARA, 8000) M.admin_paralyzed = TRUE else - M.set_status(STAT_PARA, 0) + M.set_status_condition(STAT_PARA, 0) M.admin_paralyzed = FALSE M.visible_message(SPAN_OCCULT("OOC: \The [M] has been released from paralysis by staff. You may resume interactions with them.")) to_chat(M, SPAN_OCCULT("OOC: You have been released from paralysis by staff and can return to your game.")) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index aba99df3baf1..52587d2a21d2 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -164,7 +164,6 @@ var/global/list/admin_verbs_debug = list( /datum/admins/proc/jump_to_fluid_source, /datum/admins/proc/jump_to_fluid_active, /client/proc/cmd_admin_list_open_jobs, - /client/proc/Debug2, /client/proc/ZASSettings, /client/proc/cmd_debug_make_powernets, /client/proc/debug_controller, @@ -219,6 +218,7 @@ var/global/list/admin_verbs_debug = list( /datum/admins/proc/force_weather_state, /datum/admins/proc/force_kill_weather, /client/proc/force_reload_theme_css, + /client/proc/toggle_browser_inspect, ) var/global/list/admin_verbs_paranoid_debug = list( @@ -288,7 +288,6 @@ var/global/list/admin_verbs_hideable = list( /client/proc/cmd_admin_list_open_jobs, /client/proc/callproc, /client/proc/callproc_target, - /client/proc/Debug2, /client/proc/reload_admins, /client/proc/cmd_debug_make_powernets, /client/proc/debug_controller, diff --git a/code/modules/admin/buildmode/mode_areas.dm b/code/modules/admin/buildmode/mode_areas.dm index 9ddfcf18fc4c..39b28fa353c1 100644 --- a/code/modules/admin/buildmode/mode_areas.dm +++ b/code/modules/admin/buildmode/mode_areas.dm @@ -41,9 +41,9 @@ if (mode == "Pick") var/area/path = select_subpath((selected_area?.type || /area/space), /area) if (path) - for (var/area/R in global.areas) - if (R.type == path) - SelectArea(R) + for (var/area/build_area in global.areas) + if (build_area.type == path) + SelectArea(build_area) to_chat(user, "Picked area [selected_area.proper_name]") break else if (mode == "Create") diff --git a/code/modules/admin/secrets/admin_secrets/show_signalers.dm b/code/modules/admin/secrets/admin_secrets/show_signalers.dm deleted file mode 100644 index 3ddf2a4e2ffd..000000000000 --- a/code/modules/admin/secrets/admin_secrets/show_signalers.dm +++ /dev/null @@ -1,15 +0,0 @@ -/datum/admin_secret_item/admin_secret/show_signalers - name = "Show Last Signalers" - -/datum/admin_secret_item/admin_secret/show_signalers/name() - return "Show Last [length(global.lastsignalers)] Signaler\s" - -/datum/admin_secret_item/admin_secret/show_signalers/execute(var/mob/user) - . = ..() - if(!.) - return - - var/dat = "Showing last [length(global.lastsignalers)] signalers.
" - for(var/sig in global.lastsignalers) - dat += "[sig]
" - show_browser(user, dat, "window=lastsignalers;size=800x500") diff --git a/code/modules/admin/secrets/fun_secrets/break_some_lights.dm b/code/modules/admin/secrets/fun_secrets/break_some_lights.dm index 702b8d3427a5..f3784b1c16d2 100644 --- a/code/modules/admin/secrets/fun_secrets/break_some_lights.dm +++ b/code/modules/admin/secrets/fun_secrets/break_some_lights.dm @@ -11,7 +11,7 @@ var/list/epicentreList = list() for(var/i in 1 to 2) var/list/possibleEpicentres = list() - for(var/obj/abstract/landmark/newEpicentre in global.landmarks_list) + for(var/obj/abstract/landmark/newEpicentre in global.all_landmarks) if(newEpicentre.name == "lightsout" && !(newEpicentre in epicentreList)) possibleEpicentres += newEpicentre if(length(possibleEpicentres)) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index c9e2798773b2..29ed77d51145 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -233,6 +233,8 @@ delmob = TRUE var/transform_key = replacetext(href_list["simplemake"], "_", " ") + // Nothing ever seems to pass species to any simplemake href links... + // TODO: Remove subspecies argument if it actually is defunct? if(M.try_rudimentary_transform(transform_key, delmob, href_list["species"])) log_and_message_admins("has used rudimentary transformation on [key_name_admin(M)]. Transforming to [transform_key]; deletemob=[delmob]") @@ -908,9 +910,9 @@ //Job + antagonist if(M.mind) - special_role_description = "Role: [M.mind.assigned_role]; Antagonist: [M.mind.get_special_role_name("unknown role")]; Has been rev: [(M.mind.has_been_rev)?"Yes":"No"]" + special_role_description = "Role: [M.mind.assigned_role]; Antagonist: [M.mind.get_special_role_name("unknown role")]" else - special_role_description = "Role: Mind datum missing Antagonist: Mind datum missing; Has been rev: Mind datum missing;" + special_role_description = "Role: Mind datum missing Antagonist: Mind datum missing" //Health if(isliving(M)) @@ -992,7 +994,7 @@ M.take_damage(min(99, M.current_health - 1)) SET_STATUS_MAX(M, STAT_STUN, 20) SET_STATUS_MAX(M, STAT_WEAK, 20) - M.set_status(STAT_STUTTER, 20) + M.set_status_condition(STAT_STUTTER, 20) else if(href_list["CentcommReply"]) var/mob/living/L = locate(href_list["CentcommReply"]) @@ -1468,13 +1470,16 @@ if(!istype(M)) to_chat(usr, "[M] is illegal type, must be /mob!") return - var/decl/language/L = SSlore.get_language_by_name(href_list["lang"]) - if(L in M.languages) - if(!M.remove_language(L.type)) - to_chat(usr, "Failed to remove language '[L.name]' from \the [M]!") + var/decl/language/L = locate(href_list["lang"]) + if(istype(L)) + if(L in M.languages) + if(!M.remove_language(L.type)) + to_chat(usr, "Failed to remove language '[L.name]' from \the [M]!") + else + if(!M.add_language(L.type)) + to_chat(usr, "Failed to add language '[L.name]' to \the [M]!") else - if(!M.add_language(L.type)) - to_chat(usr, "Failed to add language '[L.name]' from \the [M]!") + to_chat(usr, "Failed to toggle unknown language on \the [M]!") show_player_panel(M) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 6878930ff4ae..c22ef2c4ab04 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -1,19 +1,3 @@ -/client/proc/Debug2() - set category = "Debug" - set name = "Debug-Game" - if(!check_rights(R_DEBUG)) return - - if(Debug2) - Debug2 = 0 - message_admins("[key_name(src)] toggled debugging off.") - log_admin("[key_name(src)] toggled debugging off.") - else - Debug2 = 1 - message_admins("[key_name(src)] toggled debugging on.") - log_admin("[key_name(src)] toggled debugging on.") - - SSstatistics.add_field_details("admin_verb","DG2") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - // callproc moved to code/modules/admin/callproc @@ -80,9 +64,9 @@ set desc = "Specify a location to spawn a pAI device, then specify a key to play that pAI" var/list/available = list() - for(var/mob/C in SSmobs.mob_list) - if(C.key) - available.Add(C) + for(var/mob/player in SSmobs.mob_list) + if(player.key) + available.Add(player) var/mob/choice = input("Choose a player to play the pAI", "Spawn pAI") in available if(!choice) return 0 @@ -511,6 +495,8 @@ . += "
  • qdel() Count: [I.qdels]
  • " if(I.early_destroy) . += "
  • Early destroy count: [I.early_destroy]
  • " + if(I.qdels) + . += "
  • Average Destroy() Cost: [I.destroy_time / I.qdels]ms/call
  • " . += "
  • Destroy() Cost: [I.destroy_time]ms
  • " if(I.hard_deletes) . += "
  • Total Hard Deletes [I.hard_deletes]
  • " @@ -526,3 +512,26 @@ . += "" show_browser(usr, JOINTEXT(.), "window=dellog") + +/client/proc/toggle_browser_inspect() + set category = "Debug" + set name = "Toggle Browser Inspect" + + #if DM_VERSION >= 516 + + var/browser_options = winget(src, null, "browser-options") + + if(findtext(browser_options, "devtools")) + // Disable the dev tools. + winset(src, null, list("browser-options" = "-devtools")) + message_admins("[key_name_admin(usr)] has disabled Browser Inspection.") + else + // Enable the dev tools. + winset(src, null, list("browser-options" = "+devtools")) + message_admins("[key_name_admin(usr)] has enabled Browser Inspection.") + + #else + + alert("Browser Inspection is not supported in this version of BYOND, please update to 516 or later.") + + #endif \ No newline at end of file diff --git a/code/modules/admin/verbs/grief_fixers.dm b/code/modules/admin/verbs/grief_fixers.dm index afea1d4a6feb..9288165c9b4a 100644 --- a/code/modules/admin/verbs/grief_fixers.dm +++ b/code/modules/admin/verbs/grief_fixers.dm @@ -13,9 +13,10 @@ sleep(10) var/current_time = world.timeofday - var/list/steps = sortTim(decls_repository.get_decls_of_subtype_unassociated(/decl/atmos_grief_fix_step), /proc/cmp_decl_sort_value_asc) + var/list/steps = decls_repository.get_decls_of_subtype_unassociated(/decl/atmos_grief_fix_step) + steps = sortTim(steps.Copy(), /proc/cmp_decl_sort_value_asc) var/step_count = length(steps) - for(var/step_index in 1 to length(step_count)) + for(var/step_index in 1 to step_count) var/decl/atmos_grief_fix_step/fix_step = steps[step_index] to_chat(usr, "\[[step_index]/[step_count]\] - [fix_step.name].") fix_step.act() diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index b599e3845e62..a9e734c065d7 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -108,8 +108,8 @@ var/global/list/mapping_debugging_markers = list() if(!T || !isturf(T) || !T.density ) if(!(locate(/obj/structure/grille,T))) var/window_check = 0 - for(var/obj/structure/window/W in T) - if (W.dir == turn(C1.dir,180) || (W.dir in list(NORTHEAST,SOUTHEAST,SOUTHWEST,NORTHWEST)) ) + for(var/obj/structure/window/window in T) + if (window.dir == turn(C1.dir,180) || (window.dir in list(NORTHEAST,SOUTHEAST,SOUTHWEST,NORTHWEST)) ) window_check = 1 break if(!window_check) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 06c04257babc..94fc9afc0221 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -526,8 +526,8 @@ /client/proc/special_set_vv_var(var/datum/O, variable, var_value, client) var/list/vv_set_handlers = decls_repository.get_decls_of_subtype(/decl/vv_set_handler) for(var/vv_handler in vv_set_handlers) - var/decl/vv_set_handler/sh = vv_set_handlers[vv_handler] - if(sh.can_handle_set_var(O, variable, var_value, client)) - sh.handle_set_var(O, variable, var_value, client) + var/decl/vv_set_handler/set_handler = vv_set_handlers[vv_handler] + if(set_handler.can_handle_set_var(O, variable, var_value, client)) + set_handler.handle_set_var(O, variable, var_value, client) return TRUE return FALSE diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 017f1c2bb561..39e5e364fc4c 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -9,8 +9,8 @@ if(confirm != "Yes") return - for(var/obj/item/W in M.get_contained_external_atoms()) - M.drop_from_inventory(W) + for(var/obj/item/thing in M.get_contained_external_atoms()) + M.drop_from_inventory(thing) log_admin("[key_name(usr)] made [key_name(M)] drop everything!") message_admins("[key_name_admin(usr)] made [key_name_admin(M)] drop everything!", 1) diff --git a/code/modules/admin/view_variables/helpers.dm b/code/modules/admin/view_variables/helpers.dm index 7b7155b8391c..77e8826c5a98 100644 --- a/code/modules/admin/view_variables/helpers.dm +++ b/code/modules/admin/view_variables/helpers.dm @@ -62,8 +62,8 @@ /mob/living/get_view_variables_options() return ..() + {" - - + + diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm index 971e7a394bcd..562c9f1f486b 100644 --- a/code/modules/admin/view_variables/topic.dm +++ b/code/modules/admin/view_variables/topic.dm @@ -332,7 +332,7 @@ to_chat(usr, SPAN_WARNING("This can only be done to instances of type /mob/living/human")) return - var/new_species = input("Please choose a new species.","Species",null) as null|anything in get_all_species() + var/decl/species/new_species = input("Please choose a new species.","Species",null) as null|anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species) if(!victim) to_chat(usr, SPAN_WARNING("Mob doesn't exist anymore")) @@ -341,7 +341,7 @@ if(!new_species) return - if(victim.change_species(new_species)) + if(victim.change_species(new_species.uid)) to_chat(usr, SPAN_NOTICE("Set species of \the [victim] to [victim.species].")) else to_chat(usr, SPAN_WARNING("Failed! Something went wrong.")) @@ -587,29 +587,9 @@ href_list["datumrefresh"] = href_list["mobToDamage"] else if(href_list["call_proc"]) - var/datum/called_proc = locate(href_list["call_proc"]) - if(istype(called_proc) || istype(called_proc, /client)) // can call on clients too, not just datums - callproc_targetpicked(1, called_proc) - else if(href_list["addaura"]) - if(!check_rights(R_DEBUG|R_ADMIN|R_FUN)) return - var/mob/living/victim = locate(href_list["addaura"]) - if(!istype(victim)) - return - var/choice = input("Please choose an aura to add", "Auras", null) as null|anything in typesof(/obj/aura) - if(!choice || !victim) - return - var/obj/new_aura = new choice(victim) - log_and_message_admins("added \the [new_aura] to \the [victim]") - else if(href_list["removeaura"]) - if(!check_rights(R_DEBUG|R_ADMIN|R_FUN)) return - var/mob/living/victim = locate(href_list["removeaura"]) - if(!istype(victim)) - return - var/choice = input("Please choose an aura to remove", "Auras", null) as null|anything in victim.auras - if(!choice || !victim) - return - log_and_message_admins("removed \the [choice] to \the [victim]") - qdel(choice) + var/datum/proc_callee = locate(href_list["call_proc"]) + if(istype(proc_callee) || istype(proc_callee, /client)) // can call on clients too, not just datums + callproc_targetpicked(1, proc_callee) else if(href_list["addstressor"]) if(!check_rights(R_DEBUG)) @@ -658,7 +638,7 @@ return if(amt < 0) amt += GET_STATUS(victim, selected_condition.type) - victim.set_status(selected_condition.type, amt) + victim.set_status_condition(selected_condition.type, amt) log_and_message_admins("set [selected_condition.name] to [amt] on \the [victim].") else if(href_list["setmaterial"]) @@ -705,6 +685,44 @@ else to_chat(usr, SPAN_WARNING("Failed to remove [ability] from [target]!")) + else if (href_list["add_mob_modifier"]) + var/mob/living/target = locate(href_list["add_mob_modifier"]) + if(!istype(target) || QDELETED(target)) + to_chat(usr, SPAN_WARNING("Only /mob/living mobs can have mob modifiers.")) + else + var/list/modifiers = list() + for(var/decl/mob_modifier/modifier in decls_repository.get_decls_of_type_unassociated(/decl/mob_modifier)) + if(modifier.can_be_admin_granted) + modifiers += modifier + // Evil pyramid due to apparently not being able to return early in this Topic() + var/decl/mob_modifier/modifier = input(usr, "Which modifier do you wish to give?", "Add Mob Modifier") as null|anything in modifiers + if(istype(modifier) && !QDELETED(target)) + var/duration = input(usr, "How long do you wish this modifier to last, in seconds? Enter -1 for a permanent modifier.", "Add Mob Modifier") as num|null + if(!isnull(duration)) + if(duration != MOB_MODIFIER_INDEFINITE) + duration = max(0, duration SECONDS) + if(duration != 0 && !QDELETED(target)) + if(target.add_mob_modifier(modifier, duration, source = target)) + to_chat(usr, SPAN_NOTICE("Added [modifier] to [target] for [duration] second\s.")) + else + to_chat(usr, SPAN_WARNING("Failed to add [modifier] to [target].")) + + else if (href_list["remove_mob_modifier"]) + var/mob/living/target = locate(href_list["remove_mob_modifier"]) + if(!istype(target) && !QDELETED(target)) + to_chat(usr, SPAN_WARNING("Only /mob/living mobs can have mob modifiers.")) + else + var/list/modifiers = list() + for(var/decl/mob_modifier/modifier in target._mob_modifiers) + if(modifier.can_be_admin_granted) + modifiers += modifier + var/decl/mob_modifier/modifier = input(usr, "Which modifier do you wish to remove?", "Remove Mob Modifier") as null|anything in modifiers + if(istype(modifier)) + if(target.remove_mob_modifier(modifier, source = target)) + to_chat(usr, SPAN_NOTICE("Removed [modifier] from [target].")) + else + to_chat(usr, SPAN_WARNING("Failed to remove [modifier] from [target].")) + if(href_list["datumrefresh"]) var/datum/datum_to_refresh = locate(href_list["datumrefresh"]) if(istype(datum_to_refresh, /datum) || istype(datum_to_refresh, /client)) diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 785f34bb3799..b05c0274ad21 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -23,10 +23,15 @@ var/const/WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message /obj/item/assembly/Destroy() - if(!QDELETED(holder)) - // the holder has the responsibility to clear its associated vars on destroy - QDEL_NULL(holder) - else + if(holder) + if(istype(holder)) + if(holder.a_left == src) + holder.a_left = null + if(holder.a_right == src) + holder.a_right = null + if(istype(holder, /datum) && !QDELETED(holder)) + // the holder has the responsibility to clear its associated vars on destroy + qdel(holder) holder = null return ..() @@ -83,15 +88,15 @@ //Not sure what goes here quite yet send signal? return 1 -/obj/item/assembly/attackby(obj/item/component, mob/user) - if(!user_can_attack_with(user) || !component.user_can_attack_with(user)) +/obj/item/assembly/attackby(obj/item/used_item, mob/user) + if(!user_can_attack_with(user) || !used_item.user_can_attack_with(user)) return TRUE - if(isassembly(component)) - var/obj/item/assembly/assembly = component + if(isassembly(used_item)) + var/obj/item/assembly/assembly = used_item if(!assembly.secured && !secured) attach_assembly(assembly, user) return TRUE - if(IS_SCREWDRIVER(component)) + if(IS_SCREWDRIVER(used_item)) if(toggle_secure()) to_chat(user, SPAN_NOTICE("\The [src] is ready!")) else diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index d809c53896d6..b0776e4e47ea 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -20,20 +20,26 @@ global.listening_objects += src /obj/item/assembly_holder/Destroy() - if(!QDELETED(a_left)) - a_left.holder = null - QDEL_NULL(a_left) - else + + if(a_left) + if(a_left.holder == src) + a_left.holder = null + if(!QDELETED(a_left)) + qdel(a_left) a_left = null - if(!QDELETED(a_right)) - a_right.holder = null - QDEL_NULL(a_right) - else + + if(a_right) + if(a_right.holder == src) + a_right.holder = null + if(!QDELETED(a_right)) + qdel(a_right) a_right = null - if(!QDELETED(special_assembly)) - QDEL_NULL(special_assembly) - else + + if(special_assembly) + if(!QDELETED(special_assembly)) + qdel(special_assembly) special_assembly = null + return ..() /obj/item/assembly_holder/proc/attach(var/obj/item/left_item, var/obj/item/right_item, var/mob/user) @@ -118,8 +124,8 @@ a_right.holder_movement() return ..() -/obj/item/assembly_holder/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/assembly_holder/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) if(!a_left || !a_right) to_chat(user, "BUG:Assembly part missing, please report this!") return TRUE diff --git a/code/modules/atmospherics/components/unary/outlet_injector.dm b/code/modules/atmospherics/components/unary/outlet_injector.dm index 80bd794da66e..20a9ee0a3b24 100644 --- a/code/modules/atmospherics/components/unary/outlet_injector.dm +++ b/code/modules/atmospherics/components/unary/outlet_injector.dm @@ -127,8 +127,8 @@ /obj/machinery/atmospherics/unary/outlet_injector/hide(var/i) update_icon() -/obj/machinery/atmospherics/unary/outlet_injector/attackby(var/obj/item/O, var/mob/user) - if(IS_MULTITOOL(O)) +/obj/machinery/atmospherics/unary/outlet_injector/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/browser/written_digital/popup = new (user, "Vent Configuration Utility", "[src] Configuration Panel", 600, 200) popup.set_content(jointext(get_console_data(),"
    ")) popup.open() diff --git a/code/modules/atmospherics/components/unary/tank.dm b/code/modules/atmospherics/components/unary/tank.dm index 29968bd94450..52c6c6fc0278 100644 --- a/code/modules/atmospherics/components/unary/tank.dm +++ b/code/modules/atmospherics/components/unary/tank.dm @@ -29,11 +29,9 @@ air_contents.temperature = T20C if(filling) - var/list/gases = list() for(var/gas in filling) - gases += gas - gases += start_pressure * filling[gas] * (air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) - air_contents.adjust_multi(arglist(gases)) + air_contents.adjust_gas(gas, start_pressure * filling[gas] * (air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature), FALSE) + air_contents.update_values() update_icon() /obj/machinery/atmospherics/unary/tank/set_initial_level() diff --git a/code/modules/atmospherics/components/unary/vent_pump.dm b/code/modules/atmospherics/components/unary/vent_pump.dm index 33a2df620b92..20f4d41f2594 100644 --- a/code/modules/atmospherics/components/unary/vent_pump.dm +++ b/code/modules/atmospherics/components/unary/vent_pump.dm @@ -278,16 +278,16 @@ . = ..() toggle_input_toggle() -/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user) - if(IS_WELDER(W)) +/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/used_item, mob/user) + if(IS_WELDER(used_item)) - var/obj/item/weldingtool/WT = W + var/obj/item/weldingtool/welder = used_item - if(!WT.isOn()) + if(!welder.isOn()) to_chat(user, "The welding tool needs to be on to start this task.") return 1 - if(!WT.weld(0,user)) + if(!welder.weld(0,user)) to_chat(user, "You need more welding fuel to complete this task.") return 1 @@ -301,7 +301,7 @@ if(!src) return 1 - if(!WT.isOn()) + if(!welder.isOn()) to_chat(user, "The welding tool needs to be on to finish this task.") return 1 @@ -312,7 +312,7 @@ "You [welded ? "weld \the [src] shut" : "unweld \the [src]"].", \ "You hear welding.") return 1 - if(IS_MULTITOOL(W)) + if(IS_MULTITOOL(used_item)) var/datum/browser/written_digital/popup = new(user, "Vent Configuration Utility", "[src] Configuration Panel", 600, 200) popup.set_content(jointext(get_console_data(),"
    ")) popup.open() diff --git a/code/modules/atmospherics/components/unary/vent_scrubber.dm b/code/modules/atmospherics/components/unary/vent_scrubber.dm index b5b6b81e8fde..4ff8c0e85b87 100644 --- a/code/modules/atmospherics/components/unary/vent_scrubber.dm +++ b/code/modules/atmospherics/components/unary/vent_scrubber.dm @@ -203,16 +203,16 @@ return SPAN_WARNING("You cannot take this [src] apart, it too exerted due to internal pressure.") return ..() -/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/weldingtool)) +/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = W + var/obj/item/weldingtool/welder = used_item - if(!WT.isOn()) + if(!welder.isOn()) to_chat(user, "The welding tool needs to be on to start this task.") return 1 - if(!WT.weld(0,user)) + if(!welder.weld(0,user)) to_chat(user, "You need more welding fuel to complete this task.") return 1 @@ -226,7 +226,7 @@ if(!src) return 1 - if(!WT.isOn()) + if(!welder.isOn()) to_chat(user, "The welding tool needs to be on to finish this task.") return 1 diff --git a/code/modules/atmospherics/he_pipes.dm b/code/modules/atmospherics/he_pipes.dm index 3898b49f36e5..a82bfab40318 100644 --- a/code/modules/atmospherics/he_pipes.dm +++ b/code/modules/atmospherics/he_pipes.dm @@ -124,5 +124,5 @@ // Doubling up on initialize_directions is necessary to allow HE pipes to connect /obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/set_dir(new_dir) - ..() + . = ..() initialize_directions_he = dir \ No newline at end of file diff --git a/code/modules/augment/active/circuit.dm b/code/modules/augment/active/circuit.dm index 913820ec2763..a6a86bd6ad61 100644 --- a/code/modules/augment/active/circuit.dm +++ b/code/modules/augment/active/circuit.dm @@ -10,8 +10,8 @@ material = /decl/material/solid/metal/steel origin_tech = @'{"materials":1,"magnets":1,"engineering":1,"programming":2}' -/obj/item/organ/internal/augment/active/simple/circuit/attackby(obj/item/W, mob/user) - if(IS_CROWBAR(W)) +/obj/item/organ/internal/augment/active/simple/circuit/attackby(obj/item/used_item, mob/user) + if(IS_CROWBAR(used_item)) //Remove internal circuit if(holding) holding.canremove = 1 @@ -21,11 +21,11 @@ playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) else to_chat(user, SPAN_WARNING("The augment is empty!")) return TRUE - if(istype(W, /obj/item/electronic_assembly/augment)) + if(istype(used_item, /obj/item/electronic_assembly/augment)) if(holding) to_chat(user, SPAN_WARNING("There's already an assembly in there.")) - else if(user.try_unequip(W, src)) - holding = W + else if(user.try_unequip(used_item, src)) + holding = used_item holding.canremove = 0 playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) return TRUE diff --git a/code/modules/augment/active/cyberbrain.dm b/code/modules/augment/active/cyberbrain.dm index caa75054b299..d5972c12333d 100644 --- a/code/modules/augment/active/cyberbrain.dm +++ b/code/modules/augment/active/cyberbrain.dm @@ -54,9 +54,9 @@ else if(!assembly.enabled && assembly.screen_on) assembly.turn_on(owner) -/obj/item/organ/internal/augment/active/cyberbrain/attackby(var/obj/item/W, var/mob/user) +/obj/item/organ/internal/augment/active/cyberbrain/attackby(var/obj/item/used_item, var/mob/user) var/datum/extension/assembly/assembly = get_extension(src, /datum/extension/assembly) - . = assembly.attackby(W, user) + . = assembly.attackby(used_item, user) if(.) return return ..() @@ -79,11 +79,11 @@ if(os) os.Process() -/obj/item/organ/internal/augment/active/cyberbrain/get_contained_matter() +/obj/item/organ/internal/augment/active/cyberbrain/get_contained_matter(include_reagents = TRUE) . = ..() var/datum/extension/assembly/assembly = get_extension(src, /datum/extension/assembly) for(var/obj/part in assembly?.parts) - . = MERGE_ASSOCS_WITH_NUM_VALUES(., part.get_contained_matter()) + . = MERGE_ASSOCS_WITH_NUM_VALUES(., part.get_contained_matter(include_reagents)) /* * diff --git a/code/modules/augment/augment.dm b/code/modules/augment/augment.dm index b65a6776d09c..63105dc6e02b 100644 --- a/code/modules/augment/augment.dm +++ b/code/modules/augment/augment.dm @@ -22,8 +22,8 @@ update_parent_organ() reagents?.clear_reagents() // Removing meat from the reagents list. -/obj/item/organ/internal/augment/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W) && allowed_organs.len > 1) +/obj/item/organ/internal/augment/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item) && allowed_organs.len > 1) //Here we can adjust location for implants that allow multiple slots organ_tag = input(user, "Adjust installation parameters") as null|anything in allowed_organs update_parent_organ() diff --git a/code/modules/augment/passive/nanoaura.dm b/code/modules/augment/passive/nanoaura.dm index b18920b72e8f..751ed5541abc 100644 --- a/code/modules/augment/passive/nanoaura.dm +++ b/code/modules/augment/passive/nanoaura.dm @@ -1,13 +1,3 @@ -//This handy augment protects you to a degree, keeping it online after critical damage however is bad - -/obj/aura/nanoaura - name = "Nanoaura" - var/obj/item/organ/internal/augment/active/nanounit/unit = null - var/active = 0 - - -//The organ itself - /obj/item/organ/internal/augment/active/nanounit name = "nanite MCU" allowed_organs = list(BP_AUGMENT_CHEST_ACTIVE) @@ -16,7 +6,8 @@ action_button_name = "Toggle Nanomachines" material = /decl/material/solid/metal/steel origin_tech = @'{"materials":4,"magnets":4,"engineering":5,"biotech":3}' - var/obj/aura/nanoaura/aura = null + var/active = FALSE + var/modifier_archetype = /decl/mob_modifier/nanoswarm var/charges = 4 /obj/item/organ/internal/augment/active/nanounit/reset_matter() @@ -28,58 +19,39 @@ /obj/item/organ/internal/augment/active/nanounit/on_add_effects() . = ..() - if(owner) - aura = new /obj/aura/nanoaura(owner, src) + if(owner && modifier_archetype) + owner.add_mob_modifier(modifier_archetype, source = src) /obj/item/organ/internal/augment/active/nanounit/on_remove_effects(mob/living/last_owner) - QDEL_NULL(aura) + if(istype(last_owner) && modifier_archetype) + last_owner.remove_mob_modifier(modifier_archetype, source = src) . = ..() /obj/item/organ/internal/augment/active/nanounit/proc/catastrophic_failure() playsound(owner,'sound/mecha/internaldmgalarm.ogg',25,1) + charges = -1 + active = FALSE owner.visible_message(SPAN_WARNING("The nanites attempt to harden. But they seem... brittle.")) for(var/obj/item/organ/external/E in owner.get_external_organs()) if(prob(25)) E.status |= ORGAN_BRITTLE //Some nanites are not responding and you're out of luck to_chat(owner, SPAN_DANGER("Your [E.name] feels cold and rigid.")) - QDEL_NULL(aura) + owner.remove_mob_modifier(modifier_archetype, source = src) /obj/item/organ/internal/augment/active/nanounit/activate() - if(!aura || !can_activate()) + if(!owner || !modifier_archetype || !can_activate()) return - if(aura.active) - aura.active = 0 + if(owner.has_mob_modifier(modifier_archetype, source = src)) + active = FALSE to_chat(owner,SPAN_NOTICE("Nanites entering sleep mode.")) - else - aura.active = 1 + owner.remove_mob_modifier(modifier_archetype, source = src) + else if(charges > 0) to_chat(owner,SPAN_NOTICE("Activation sequence in progress.")) + active = TRUE + owner.add_mob_modifier(modifier_archetype, source = src) playsound(owner,'sound/weapons/flash.ogg',35,1) - /obj/item/organ/internal/augment/active/nanounit/Destroy() + if(owner && modifier_archetype) + owner.remove_mob_modifier(modifier_archetype, source = src) . = ..() - QDEL_NULL(aura) - -/obj/aura/nanoaura/Initialize(var/maploading, var/obj/item/organ/internal/augment/active/nanounit/holder) - . = ..() - unit = holder - playsound(loc,'sound/weapons/flash.ogg',35,1) - to_chat(loc,SPAN_NOTICE("Your skin tingles as the nanites spread over your body.")) - -/obj/aura/nanoaura/bullet_act(var/obj/item/projectile/P, var/def_zone) - if(!active) - return - if(unit.charges > 0) - user.visible_message(SPAN_WARNING("The nanomachines harden as a response to physical trauma!")) - playsound(user,'sound/effects/basscannon.ogg',35,1) - unit.charges -= 1 - if(unit.charges <= 0) - to_chat(user, SPAN_DANGER("Warning: Critical damage threshold passed. Shut down unit to avoid further damage.")) - return AURA_FALSE|AURA_CANCEL - else unit.catastrophic_failure() - - -/obj/aura/nanoaura/Destroy() - to_chat(user, SPAN_WARNING("The nanites dissolve!")) - unit = null - return ..() diff --git a/code/modules/awaymissions/artillery.dm b/code/modules/awaymissions/artillery.dm deleted file mode 100644 index 644356e53d76..000000000000 --- a/code/modules/awaymissions/artillery.dm +++ /dev/null @@ -1,53 +0,0 @@ -/obj/structure/artilleryplaceholder - name = "artillery" - desc = "The ship's old superluminal artillery cannon. Looks inoperative." - icon = 'icons/obj/machines/artillery.dmi' - anchored = TRUE - density = TRUE - -/obj/structure/artilleryplaceholder/decorative - density = FALSE - -/obj/machinery/artillerycontrol - name = "superluminal artillery control" - icon_state = "control_boxp1" - icon = 'icons/obj/machines/particle_accelerator2.dmi' - density = TRUE - anchored = TRUE - var/tmp/time_to_reload = 360 SECONDS // originally this was 180 ticks at 1 tick per 2 seconds - var/reload_cooldown = 0 // The world.time value after which we will be able to fire. - -/obj/machinery/artillerycontrol/interface_interact(mob/user) - interact(user) - return TRUE - -/obj/machinery/artillerycontrol/interact(mob/user) - user.set_machine(src) - var/dat = list("Superluminal Artillery Control:
    ") - dat += "Locked on
    " - dat += "Charge progress: [round(100 - ((reload_cooldown - world.time) / time_to_reload))]%
    " - dat += "Open Fire
    " - dat += "Deployment of weapon authorized by
    [global.using_map.company_name] Naval Command

    Remember, friendly fire is grounds for termination of your contract and life.
    " - show_browser(user, JOINTEXT(dat), "window=superlumcontrol") - onclose(user, "superlumcontrol") - -/obj/machinery/artillerycontrol/OnTopic(mob/user, href_list) - if((. = ..())) - return - - var/area/thearea = input("Area to jump bombard", "Open Fire") as null|anything in teleportlocs - thearea = thearea ? teleportlocs[thearea] : null - if (!thearea) - return - if (world.time < reload_cooldown) - return - command_announcement.Announce("Wormhole artillery fire detected. Brace for impact.") - log_and_message_admins("has launched an artillery strike.", user, get_turf(src)) - var/list/turf/candidates = list() - // this is slow (in world loop) but we don't have a better way unless we pre-register a list of areas -> z-levels - // and this code isn't hot code at all - for(var/turf/tile in thearea) - candidates += tile - var/turf/target_loc = pick(candidates) - explosion(target_loc, 2, 5, 11) - reload_cooldown = world.time + time_to_reload diff --git a/code/modules/awaymissions/exile.dm b/code/modules/awaymissions/exile.dm deleted file mode 100644 index 51e98d910082..000000000000 --- a/code/modules/awaymissions/exile.dm +++ /dev/null @@ -1,36 +0,0 @@ -//////Exile implants will allow you to use the station gate, but not return home. This will allow security to exile badguys/for badguys to exile their kill targets//////// - - -/obj/item/implanter/exile - name = "implanter-exile" - imp = /obj/item/implant/exile - -/obj/item/implant/exile - name = "exile" - desc = "Prevents you from returning from away missions." - -/obj/item/implant/exile/get_data() - var/dat = {" - Implant Specifications:
    - Name: [global.using_map.company_name] Employee Exile Implant
    - Implant Details: The onboard gateway system has been modified to reject entry by individuals containing this implant
    "} - return dat - -/obj/item/implantcase/exile - name = "glass case - 'Exile'" - desc = "A case containing an exile implant." - icon_state = "implantcase-r" - imp = /obj/item/implant/exile - -/obj/structure/closet/secure_closet/exile - name = "Exile Implants" - req_access = list(access_hos) - -/obj/structure/closet/secure_closet/exile/Initialize() - . = ..() - new /obj/item/implanter/exile(src) - new /obj/item/implantcase/exile(src) - new /obj/item/implantcase/exile(src) - new /obj/item/implantcase/exile(src) - new /obj/item/implantcase/exile(src) - new /obj/item/implantcase/exile(src) diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm deleted file mode 100644 index 13f96d15a009..000000000000 --- a/code/modules/awaymissions/gateway.dm +++ /dev/null @@ -1,235 +0,0 @@ -/obj/machinery/gateway - name = "gateway" - desc = "A mysterious gateway built by unknown hands, it allows for faster than light travel to far-flung locations." - icon = 'icons/obj/machines/gateway.dmi' - icon_state = "off" - density = TRUE - anchored = TRUE - var/active = 0 - - -/obj/machinery/gateway/Initialize() - update_icon() - if(dir == SOUTH) - set_density(0) - . = ..() - -/obj/machinery/gateway/on_update_icon() - if(active) - icon_state = "on" - return - icon_state = "off" - - - -//this is da important part wot makes things go -/obj/machinery/gateway/centerstation - density = TRUE - icon_state = "offcenter" - - //warping vars - var/list/linked = list() - var/ready = 0 //have we got all the parts for a gateway? - var/wait = 0 //this just grabs world.time at world start - var/obj/machinery/gateway/centeraway/awaygate = null - -/obj/machinery/gateway/centerstation/Initialize() - update_icon() - wait = world.time + get_config_value(/decl/config/num/gateway_delay) //+ thirty minutes default - awaygate = locate(/obj/machinery/gateway/centeraway) - . = ..() - -/obj/machinery/gateway/centerstation/on_update_icon() - if(active) - icon_state = "oncenter" - return - icon_state = "offcenter" - - - -/obj/machinery/gateway/centerstation/Process() - if(stat & (NOPOWER)) - if(active) toggleoff() - return - - if(active) - use_power_oneoff(5000) - - -/obj/machinery/gateway/centerstation/proc/detect() - linked = list() //clear the list - var/turf/T = loc - - for(var/i in global.alldirs) - T = get_step(loc, i) - var/obj/machinery/gateway/G = locate(/obj/machinery/gateway) in T - if(G) - linked.Add(G) - continue - - //this is only done if we fail to find a part - ready = 0 - toggleoff() - break - - if(linked.len == 8) - ready = 1 - - -/obj/machinery/gateway/centerstation/proc/toggleon(mob/user) - if(!ready) - return - if(linked.len != 8) - return - if(stat & NOPOWER) - return - if(!awaygate) - to_chat(user, "Error: No destination found.") - return - if(world.time < wait) - to_chat(user, "Error: Warpspace triangulation in progress. Estimated time to completion: [round(((wait - world.time) / 10) / 60)] minutes.") - return - - for(var/obj/machinery/gateway/G in linked) - G.active = 1 - G.update_icon() - active = 1 - update_icon() - - -/obj/machinery/gateway/centerstation/proc/toggleoff() - for(var/obj/machinery/gateway/G in linked) - G.active = 0 - G.update_icon() - active = 0 - update_icon() - - -/obj/machinery/gateway/centerstation/attack_hand(mob/user) - if(!user.check_dexterity(DEXTERITY_COMPLEX_TOOLS, TRUE)) - return ..() - if(!ready) - detect() - return TRUE - if(!active) - toggleon(user) - return TRUE - toggleoff() - return TRUE - -//okay, here's the good teleporting stuff -/obj/machinery/gateway/centerstation/Bumped(atom/movable/M) - if(!ready) return - if(!active) return - if(!awaygate) return - if(awaygate.calibrated) - M.forceMove(get_step(awaygate.loc, SOUTH)) - M.set_dir(SOUTH) - return - -/obj/machinery/gateway/centerstation/attackby(obj/item/W, mob/user) - if(IS_MULTITOOL(W)) - to_chat(user, "The gate is already calibrated, there is no work for you to do here.") - return TRUE - return FALSE - -/////////////////////////////////////Away//////////////////////// - - -/obj/machinery/gateway/centeraway - density = TRUE - icon_state = "offcenter" - use_power = POWER_USE_OFF - var/calibrated = 1 - var/list/linked = list() //a list of the connected gateway chunks - var/ready = 0 - var/obj/machinery/gateway/centerstation/stationgate = null - - -/obj/machinery/gateway/centeraway/Initialize() - update_icon() - stationgate = locate(/obj/machinery/gateway/centerstation) - . = ..() - -/obj/machinery/gateway/centeraway/on_update_icon() - if(active) - icon_state = "oncenter" - return - icon_state = "offcenter" - - -/obj/machinery/gateway/centeraway/proc/detect() - linked = list() //clear the list - var/turf/T = loc - - for(var/i in global.alldirs) - T = get_step(loc, i) - var/obj/machinery/gateway/G = locate(/obj/machinery/gateway) in T - if(G) - linked.Add(G) - continue - - //this is only done if we fail to find a part - ready = 0 - toggleoff() - break - - if(linked.len == 8) - ready = 1 - - -/obj/machinery/gateway/centeraway/proc/toggleon(mob/user) - if(!ready) return - if(linked.len != 8) return - if(!stationgate) - to_chat(user, "Error: No destination found.") - return - - for(var/obj/machinery/gateway/G in linked) - G.active = 1 - G.update_icon() - active = 1 - update_icon() - - -/obj/machinery/gateway/centeraway/proc/toggleoff() - for(var/obj/machinery/gateway/G in linked) - G.active = 0 - G.update_icon() - active = 0 - update_icon() - - -/obj/machinery/gateway/centeraway/attack_hand(mob/user) - if(!user.check_dexterity(DEXTERITY_COMPLEX_TOOLS, TRUE)) - return ..() - if(!ready) - detect() - return TRUE - if(!active) - toggleon(user) - return TRUE - toggleoff() - return TRUE - -/obj/machinery/gateway/centeraway/Bumped(atom/movable/M) - if(!ready) return - if(!active) return - if(ishuman(M)) - for(var/obj/item/implant/exile/E in M)//Checking that there is an exile implant in the contents - if(E.imp_in == M)//Checking that it's actually implanted vs just in their pocket - to_chat(M, "The remote gate has detected your exile implant and is blocking your entry.") - return - M.forceMove(get_step(stationgate.loc, SOUTH)) - M.set_dir(SOUTH) - -/obj/machinery/gateway/centeraway/attackby(obj/item/W, mob/user) - if(IS_MULTITOOL(W)) - if(calibrated) - to_chat(user, "The gate is already calibrated, there is no work for you to do here.") - return TRUE - else - to_chat(user, "Recalibration successful!: This gate's systems have been fine tuned. Travel to this gate will now be on target.") - calibrated = 1 - return TRUE - return FALSE diff --git a/code/modules/awaymissions/pamphlet.dm b/code/modules/awaymissions/pamphlet.dm deleted file mode 100644 index 49dbb1237f44..000000000000 --- a/code/modules/awaymissions/pamphlet.dm +++ /dev/null @@ -1,39 +0,0 @@ -/obj/item/paper/pamphlet - name = "pamphlet" - icon = 'icons/obj/items/paperwork/pamphlet.dmi' - info = "Welcome to the Gateway project...
    \ - Congratulations! If you're reading this, you and your superiors have decided that you're \ - ready to commit to a life spent colonising the rolling hills of far away worlds. You \ - must be ready for a lifetime of adventure, a little bit of hard work, and an award \ - winning dental plan- but that's not all the Gateway project has to offer.
    \ -
    Because we care about you, we feel it is only fair to make sure you know the risks \ - before you commit to joining the Gateway project. All away destinations have \ - been fully scanned by an expeditionary team, and are certified to be 100% safe. \ - We've even left a case of space beer along with the basic materials you'll need to expand \ - the Project's operational area and start your new life.

    \ - Gateway Operation Basics
    \ - All approved Gateways operate on the same basic principals. They operate off \ - area equipment power as you would expect, but they also require a backup wire with at least \ - 128, 000 Watts of power running through it. Without this supply, it cannot safely function \ - and will reject all attempts at operation.

    \ - Once it is correctly setup, and once it has enough power to operate, the Gateway will begin \ - searching for an output location. The amount of time this takes is variable, but the Gateway \ - interface will give you an estimate accurate to the minute. Power loss will not interrupt the \ - searching process. Influenza will not interrupt the searching process. Temporal anomalies \ - may cause the estimate to be inaccurate, but will not interrupt the searching process.

    \ - Life On The Other Side
    \ - Once you have traversed the Gateway, you may experience some disorientation. Do not panic. \ - This is a normal side effect of travelling vast distances in a short period of time. You should \ - survey the immediate area, and attempt to locate your complimentary case of space beer. Our \ - expeditionary teams have ensured the complete safety of all away locations, but in a small \ - number of cases, the Gateway they have established may not be immediately obvious. \ - Do not panic if you cannot locate the return Gateway. Begin colonisation of the destination. \ -

    A New World
    \ - As a participant in the Gateway Project, you will be on the frontiers of space. \ - Though complete safety is assured, participants are advised to prepare for inhospitable \ - environs." - -//we don't want the silly text overlay! -/obj/item/paper/pamphlet/on_update_icon() - SHOULD_CALL_PARENT(FALSE) - return \ No newline at end of file diff --git a/code/modules/awaymissions/trigger.dm b/code/modules/awaymissions/trigger.dm deleted file mode 100644 index f1d2fa3405ee..000000000000 --- a/code/modules/awaymissions/trigger.dm +++ /dev/null @@ -1,40 +0,0 @@ -/obj/effect/step_trigger/message - var/message //the message to give to the mob - var/once = 1 - -/obj/effect/step_trigger/message/Trigger(mob/M) - if(M.client) - to_chat(M, "[message]") - if(once) - qdel(src) - -/obj/effect/step_trigger/teleport_fancy - var/locationx - var/locationy - var/uses = 1 //0 for infinite uses - var/entersparks = 0 - var/exitsparks = 0 - var/entersmoke = 0 - var/exitsmoke = 0 - -/obj/effect/step_trigger/teleport_fancy/Trigger(mob/M) - var/dest = locate(locationx, locationy, z) - M.Move(dest) - - if(entersparks) - spark_at(src, amount=4, cardinal_only = TRUE) - if(exitsparks) - spark_at(dest, amount=4, cardinal_only = TRUE) - - if(entersmoke) - var/datum/effect/effect/system/smoke_spread/s = new /datum/effect/effect/system/smoke_spread - s.set_up(4, 1, src, 0) - s.start() - if(exitsmoke) - var/datum/effect/effect/system/smoke_spread/s = new /datum/effect/effect/system/smoke_spread - s.set_up(4, 1, dest, 0) - s.start() - - uses-- - if(uses == 0) - qdel(src) \ No newline at end of file diff --git a/code/modules/backgrounds/_background.dm b/code/modules/backgrounds/_background.dm index bbefb7bd79a2..c456c54b1167 100644 --- a/code/modules/backgrounds/_background.dm +++ b/code/modules/backgrounds/_background.dm @@ -61,9 +61,12 @@ /decl/background_detail/proc/sanitize_background_name(new_name) return sanitize_name(new_name) +/decl/background_detail/proc/is_long() + return length(get_text_body()) > 200 + /decl/background_detail/proc/get_description(var/verbose = TRUE) LAZYSET(., "details", jointext(get_text_details(), "
    ")) - if(verbose || length(get_text_body()) <= 200) + if(verbose || !is_long()) LAZYSET(., "body", get_text_body()) else LAZYSET(., "body", "[copytext(get_text_body(), 1, 194)] \[...\]") diff --git a/code/modules/backgrounds/background_categories.dm b/code/modules/backgrounds/background_categories.dm index 61e5f76a0ad0..a9bc106d5f5d 100644 --- a/code/modules/backgrounds/background_categories.dm +++ b/code/modules/backgrounds/background_categories.dm @@ -31,8 +31,16 @@ old_tag = "home_system" uid = "heritage_cat_homeworld" item_type = /decl/background_detail/location + // When citizenship decls are better implemented, remove BACKGROUND_FLAG_CITIZENSHIP from flags. background_flags = BACKGROUND_FLAG_CITIZENSHIP | BACKGROUND_FLAG_LOCATION | BACKGROUND_FLAG_HOMEWORLD | BACKGROUND_FLAG_RESIDENCE +/decl/background_category/citizenship + name = "Citizenship" + old_tag = "citizenship" + uid = "heritage_cat_citizenship" + item_type = /decl/background_detail/citizenship + background_flags = BACKGROUND_FLAG_CITIZENSHIP + /decl/background_category/faction name = "Faction" old_tag = "faction" diff --git a/code/modules/backgrounds/citizenship/_citizenship.dm b/code/modules/backgrounds/citizenship/_citizenship.dm new file mode 100644 index 000000000000..e16cc9455ac7 --- /dev/null +++ b/code/modules/backgrounds/citizenship/_citizenship.dm @@ -0,0 +1,18 @@ +/decl/background_detail/citizenship + abstract_type = /decl/background_detail/citizenship + category = /decl/background_category/citizenship + var/ruling_body = "Other Faction" + var/capital + var/size_heading = "Systems" + var/size_value + var/founded + +/decl/background_detail/citizenship/get_text_details() + . = list() + if(!isnull(capital)) + . += "Capital: [capital]." + if(!isnull(size_value) && !isnull(size_heading)) + . += "Extent: [size_value] [size_heading]." + if(!isnull(founded)) + . += "Founded: [founded]" + . += ..() diff --git a/code/modules/backgrounds/citizenship/citizenship_other.dm b/code/modules/backgrounds/citizenship/citizenship_other.dm new file mode 100644 index 000000000000..d121a81af01a --- /dev/null +++ b/code/modules/backgrounds/citizenship/citizenship_other.dm @@ -0,0 +1,16 @@ +/decl/background_detail/citizenship/other + name = "Other Polity" + uid = "stateless_citizenship" + description = "You are from one of the many small, relatively unknown powers scattered across the galaxy." + language = /decl/language/human/common + secondary_langs = list( + /decl/language/human/common, + /decl/language/sign + ) + +/decl/background_detail/citizenship/stateless + name = "Stateless" + uid = "stateless" + description = "You do not possess any kind of official citizenship." + economic_power = 0 + capital = "None" diff --git a/code/modules/banners/_banner_frame.dm b/code/modules/banners/_banner_frame.dm index 39090a1ada7d..745de870f6ba 100644 --- a/code/modules/banners/_banner_frame.dm +++ b/code/modules/banners/_banner_frame.dm @@ -59,20 +59,20 @@ return TRUE return ..() -/obj/structure/banner_frame/attackby(obj/item/O, mob/user) - if(istype(O, /obj/item/banner)) +/obj/structure/banner_frame/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/banner)) if(banner) to_chat(user, SPAN_WARNING("There is already a banner hung on \the [src].")) return TRUE - var/obj/item/banner/other_banner = O + var/obj/item/banner/other_banner = used_item if(other_banner.banner_type != accepts_banner_type) - to_chat(user, SPAN_WARNING("\The [src] is not suitable for hanging \the [O].")) + to_chat(user, SPAN_WARNING("\The [src] is not suitable for hanging \the [used_item].")) return TRUE - if(user.try_unequip(O, src)) - user.visible_message(SPAN_NOTICE("\The [user] hangs \the [O] from \the [src]."), SPAN_NOTICE("You hang \the [O] from \the [src]."), SPAN_NOTICE("You hear the rustling of fabric.")) - set_banner(O) + if(user.try_unequip(used_item, src)) + user.visible_message(SPAN_NOTICE("\The [user] hangs \the [used_item] from \the [src]."), SPAN_NOTICE("You hang \the [used_item] from \the [src]."), SPAN_NOTICE("You hear the rustling of fabric.")) + set_banner(used_item) return TRUE return ..() diff --git a/code/modules/banners/sign.dm b/code/modules/banners/sign.dm index 835a88424278..4d341f08f58f 100644 --- a/code/modules/banners/sign.dm +++ b/code/modules/banners/sign.dm @@ -21,5 +21,5 @@ . = ..() /obj/item/banner/sign/random/Initialize(ml, material_key) - material = pick(typesof(/decl/material/solid/organic/wood)) + material = pick(decls_repository.get_decls_of_subtype(/decl/material/solid/organic/wood)) . = ..() diff --git a/code/modules/banners/sign_post.dm b/code/modules/banners/sign_post.dm index d1d0f959023e..d4b4a0c45a18 100644 --- a/code/modules/banners/sign_post.dm +++ b/code/modules/banners/sign_post.dm @@ -16,7 +16,7 @@ density = FALSE /obj/structure/banner_frame/sign/random/Initialize(ml, _mat, _reinf_mat) - material = pick(typesof(/decl/material/solid/organic/wood)) + material = pick(decls_repository.get_decls_of_subtype(/decl/material/solid/organic/wood)) ..() return INITIALIZE_HINT_LATELOAD diff --git a/code/modules/banners/signs_premade.dm b/code/modules/banners/signs_premade.dm new file mode 100644 index 000000000000..b555edde7070 --- /dev/null +++ b/code/modules/banners/signs_premade.dm @@ -0,0 +1,25 @@ +/obj/structure/banner_frame/sign/store + material = /decl/material/solid/organic/wood/maple + color = /decl/material/solid/organic/wood/maple::color + banner = /obj/item/banner/sign/store + +/obj/item/banner/sign/store + name = "store sign" + material = /decl/material/solid/organic/wood/maple + color = /decl/material/solid/organic/wood/maple::color + decals = list( + /decl/banner_symbol/sign/pawnbroker = COLOR_WHITE + ) + +/obj/structure/banner_frame/sign/tavern + material = /decl/material/solid/organic/wood/maple + color = /decl/material/solid/organic/wood/maple::color + banner = /obj/item/banner/sign/tavern + +/obj/item/banner/sign/tavern + name = "tavern sign" + material = /decl/material/solid/organic/wood/maple + color = /decl/material/solid/organic/wood/maple::color + decals = list( + /decl/banner_symbol/sign/mug = COLOR_WHITE + ) \ No newline at end of file diff --git a/code/modules/barricade_tape/barricade_tape_roll.dm b/code/modules/barricade_tape/barricade_tape_roll.dm index 6ebf3b5d5d6b..a768e9bc039c 100644 --- a/code/modules/barricade_tape/barricade_tape_roll.dm +++ b/code/modules/barricade_tape/barricade_tape_roll.dm @@ -42,7 +42,7 @@ update_icon() return ..() -/obj/item/stack/tape_roll/barricade_tape/on_picked_up(mob/user) +/obj/item/stack/tape_roll/barricade_tape/on_picked_up(mob/user, atom/old_loc) stop_unrolling() update_icon() return ..() diff --git a/code/modules/blood/blood_types.dm b/code/modules/blood/blood_types.dm index 3bf5fc6f4678..af4508282e7e 100644 --- a/code/modules/blood/blood_types.dm +++ b/code/modules/blood/blood_types.dm @@ -20,7 +20,7 @@ var/global/list/blood_types_by_name var/name var/list/antigens var/random_weighting = 1 - var/antigen_category = SPECIES_MONKEY // Rhesus factor oh no + var/antigen_category = "Primate" // Rhesus factor oh no var/splatter_name = "blood" var/splatter_desc = "It's some blood. That's not supposed to be there." diff --git a/code/modules/bodytype/_bodytype.dm b/code/modules/bodytype/_bodytype.dm index 7bb3afd74473..a60007dda2e4 100644 --- a/code/modules/bodytype/_bodytype.dm +++ b/code/modules/bodytype/_bodytype.dm @@ -239,6 +239,8 @@ var/global/list/bodytypes_by_category = list() var/eye_blend = ICON_ADD /// Stun from blindness modifier. var/eye_flash_mod = 1 + //how much damage to take from being flashed (if any) + var/eye_flash_burn = 0 // Bodytype temperature damage thresholds. /// Cold damage level 1 below this point. -30 Celsium degrees @@ -410,7 +412,7 @@ var/global/list/bodytypes_by_category = list() for(var/ltag in override_limb_types) has_limbs[ltag] = list("path" = override_limb_types[ltag]) - //Build organ descriptors + //Build organ descriptors and children lists for(var/organ_tag in has_limbs) var/list/organ_data = has_limbs[organ_tag] var/obj/item/organ/organ = organ_data["path"] @@ -421,6 +423,9 @@ var/global/list/bodytypes_by_category = list() LAZYADD(_organs_by_category[organ_cat], organ) LAZYINITLIST(_organ_tags_by_category) LAZYADD(_organ_tags_by_category[organ_cat], organ_tag) + var/list/parent_organ_data = has_limbs[organ::parent_organ] + if(parent_organ_data) + parent_organ_data["has_children"]++ for(var/organ_tag in has_organ) var/obj/item/organ/organ = has_organ[organ_tag] @@ -664,9 +669,6 @@ var/global/list/bodytypes_by_category = list() var/list/organ_data = has_limbs[limb_type] var/limb_path = organ_data["path"] var/obj/item/organ/external/E = new limb_path(H, null, supplied_data) //explicitly specify the dna and bodytype - if(E.parent_organ) - var/list/parent_organ_data = has_limbs[E.parent_organ] - parent_organ_data["has_children"]++ H.add_organ(E, GET_EXTERNAL_ORGAN(H, E.parent_organ), FALSE, FALSE, skip_health_update = TRUE) //Create missing internal organs @@ -825,8 +827,7 @@ var/global/list/bodytypes_by_category = list() to_chat(victim, SPAN_DANGER(pick(heat_discomfort_strings))) /decl/bodytype/proc/get_user_species_for_validation() - for(var/species_name in get_all_species()) - var/decl/species/species = get_species_by_key(species_name) + for(var/decl/species/species as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) if(src in species.available_bodytypes) return species diff --git a/code/modules/bodytype/bodytype_helpers.dm b/code/modules/bodytype/bodytype_helpers.dm index 53e30984d13b..e5d4488ef346 100644 --- a/code/modules/bodytype/bodytype_helpers.dm +++ b/code/modules/bodytype/bodytype_helpers.dm @@ -38,7 +38,7 @@ // Markings used to be cleared outside of here, but it was always done before every call, so it was moved in here. // remove invalid accessories for our new bodytype. don't clear the list directly as we did before, to preserve in the case of no default - var/decl/species/mob_species = get_species_by_key(pref.species) + var/decl/species/mob_species = pref.get_species_decl() var/decl/bodytype/mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype for(var/acc_cat in pref.sprite_accessories) if(!(acc_cat in mob_species.available_accessory_categories)) diff --git a/code/modules/bodytype/bodytype_prosthetic.dm b/code/modules/bodytype/bodytype_prosthetic.dm index c01812a75787..7423faf51b70 100644 --- a/code/modules/bodytype/bodytype_prosthetic.dm +++ b/code/modules/bodytype/bodytype_prosthetic.dm @@ -60,8 +60,7 @@ /decl/bodytype/prosthetic/get_user_species_for_validation() if(bodytype_category) - for(var/species_name in get_all_species()) - var/decl/species/species = get_species_by_key(species_name) + for(var/decl/species/species as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) for(var/decl/bodytype/bodytype_data in species.available_bodytypes) if(bodytype_data.bodytype_category == bodytype_category) return species diff --git a/code/modules/bodytype/bodytype_quadruped.dm b/code/modules/bodytype/bodytype_quadruped.dm index 359a7d0d28a9..5d7b75e4a15d 100644 --- a/code/modules/bodytype/bodytype_quadruped.dm +++ b/code/modules/bodytype/bodytype_quadruped.dm @@ -17,7 +17,7 @@ BP_R_FOOT = list("path" = /obj/item/organ/external/foot/right/quadruped) ) var/rideable = TRUE - var/riding_offset = @"{'x':0,'y':0,'z':8}" + var/riding_offset = @'{"x":0,"y":0,"z":8}' /decl/bodytype/quadruped/apply_appearance(var/mob/living/human/H) . = ..() diff --git a/code/modules/bodytype/bodytype_random.dm b/code/modules/bodytype/bodytype_random.dm index 2e79046a92fd..fac34e32ebce 100644 --- a/code/modules/bodytype/bodytype_random.dm +++ b/code/modules/bodytype/bodytype_random.dm @@ -4,8 +4,8 @@ if((Z && !(appearance_flags & Z)) || !random_##Y.len){\ return;\ }\ - var/decl/color_generator/CG = GET_DECL(pickweight(random_##Y));\ - return CG && CG.generate_random_colour();\ + var/decl/color_generator/color_gen = GET_DECL(pickweight(random_##Y));\ + return color_gen?.generate_random_colour();\ } #define SETUP_RANDOM_COLOR_SETTER(X, Y)\ diff --git a/code/modules/brain_interface/_brain_interface.dm b/code/modules/brain_interface/_brain_interface.dm index 2bca80610c73..abd19c34b0f9 100644 --- a/code/modules/brain_interface/_brain_interface.dm +++ b/code/modules/brain_interface/_brain_interface.dm @@ -41,6 +41,7 @@ return holding_brain?.get_brainmob(create_if_missing) /obj/item/organ/internal/brain_interface/on_update_icon() + . = ..() icon_state = get_world_inventory_state() if(holding_brain) var/mob/living/brainmob = get_brainmob() @@ -59,26 +60,26 @@ else . += SPAN_NOTICE("It is undamaged.") -/obj/item/organ/internal/brain_interface/attackby(var/obj/item/O, var/mob/user) +/obj/item/organ/internal/brain_interface/attackby(var/obj/item/used_item, var/mob/user) - if(istype(O, /obj/item/stack/nanopaste)) + if(istype(used_item, /obj/item/stack/nanopaste)) var/mob/living/brain/brainmob = get_brainmob() if(!istype(brainmob) || !brainmob.emp_damage) to_chat(user, SPAN_WARNING("\The [src] has no damage to repair.")) return TRUE - var/obj/item/stack/nanopaste/pasta = O + var/obj/item/stack/nanopaste/pasta = used_item pasta.use(1) to_chat(user, SPAN_NOTICE("You repair some of the damage to \the [src]'s electronics with the nanopaste.")) brainmob.emp_damage = max(brainmob.emp_damage - rand(5,10), 0) return TRUE - if(istype(O, /obj/item/organ/internal/brain)) + if(istype(used_item, /obj/item/organ/internal/brain)) if(holding_brain) to_chat(user, SPAN_WARNING("\The [src] already has a brain in it.")) return TRUE - var/obj/item/organ/internal/brain/inserting_brain = O + var/obj/item/organ/internal/brain/inserting_brain = used_item if(BP_IS_PROSTHETIC(inserting_brain)) to_chat(user, SPAN_WARNING("You don't need to put a robotic brain into an interface.")) return TRUE @@ -91,7 +92,7 @@ to_chat(user, SPAN_WARNING("\The [inserting_brain] is completely useless.")) return TRUE - if(user.try_unequip(O, src)) + if(user.try_unequip(used_item, src)) user.visible_message(SPAN_NOTICE("\The [user] sticks \the [inserting_brain] into \the [src].")) SetName("[initial(name)] (\the [inserting_brain])") holding_brain = inserting_brain @@ -100,7 +101,7 @@ SSstatistics.add_field("cyborg_mmis_filled",1) return TRUE - if(istype(O,/obj/item/card/id) || istype(O,/obj/item/modular_computer)) + if(istype(used_item,/obj/item/card/id) || istype(used_item,/obj/item/modular_computer)) if(allowed(user)) locked = !locked to_chat(user, SPAN_NOTICE("You [locked ? "lock" : "unlock"] \the [src].")) @@ -109,7 +110,7 @@ return TRUE if(holding_brain) - return holding_brain.attackby(O, user) + return holding_brain.attackby(used_item, user) . = ..() diff --git a/code/modules/butchery/butchery_hook.dm b/code/modules/butchery/butchery_hook.dm index 58945994cd87..37695ac70f86 100644 --- a/code/modules/butchery/butchery_hook.dm +++ b/code/modules/butchery/butchery_hook.dm @@ -13,6 +13,7 @@ icon = 'icons/obj/structures/butchery.dmi' icon_state = "spike" material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME matter = list( DEFAULT_FURNITURE_MATERIAL = MATTER_AMOUNT_PRIMARY @@ -60,10 +61,10 @@ return TRUE return ..() -/obj/structure/meat_hook/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/holder)) - var/mob/victim = (locate() in W) - if(istype(victim) && user.try_unequip(W)) +/obj/structure/meat_hook/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/holder)) + var/mob/victim = (locate() in used_item) + if(istype(victim) && user.try_unequip(used_item)) try_spike(victim, user, 1) // Delay to allow the holder to despawn and drop the mob in the loc. return TRUE return ..() @@ -176,9 +177,9 @@ clear_occupant() else if(occupant_state == CARCASS_EMPTY) for(var/obj/item/embedded in occupant.embedded) - occupant.remove_implant(occupant.embedded, TRUE) // surgical removal to prevent pointless damage pre-deletion - for(var/obj/item/W in occupant) - occupant.drop_from_inventory(W) + occupant.remove_implant(embedded, TRUE) // surgical removal to prevent pointless damage pre-deletion + for(var/obj/item/thing in occupant) + occupant.drop_from_inventory(thing) qdel(occupant) clear_occupant() update_icon() @@ -221,9 +222,9 @@ return FALSE -/obj/structure/meat_hook/attackby(var/obj/item/thing, var/mob/user) +/obj/structure/meat_hook/attackby(var/obj/item/used_item, var/mob/user) - if(!IS_KNIFE(thing)) + if(!IS_KNIFE(used_item)) return ..() if(!occupant) @@ -237,22 +238,22 @@ busy = TRUE if(occupant_state == CARCASS_FRESH) if(occupant.currently_has_skin()) - do_butchery_step(user, thing, CARCASS_SKINNED, "skinning") + do_butchery_step(user, used_item, CARCASS_SKINNED, "skinning") else set_carcass_state(CARCASS_SKINNED, apply_damage = FALSE) if(occupant_state == CARCASS_SKINNED) if(occupant.currently_has_innards()) - do_butchery_step(user, thing, CARCASS_GUTTED, "gutting") + do_butchery_step(user, used_item, CARCASS_GUTTED, "gutting") else set_carcass_state(CARCASS_GUTTED, apply_damage = FALSE) if(occupant_state == CARCASS_GUTTED) if(occupant.currently_has_bones()) - do_butchery_step(user, thing, CARCASS_JOINTED, "deboning") + do_butchery_step(user, used_item, CARCASS_JOINTED, "deboning") else set_carcass_state(CARCASS_JOINTED, apply_damage = FALSE) if(occupant_state == CARCASS_JOINTED) if(occupant.currently_has_meat()) - do_butchery_step(user, thing, CARCASS_EMPTY, "butchering") + do_butchery_step(user, used_item, CARCASS_EMPTY, "butchering") else set_carcass_state(CARCASS_EMPTY, apply_damage = FALSE) busy = FALSE diff --git a/code/modules/butchery/butchery_products.dm b/code/modules/butchery/butchery_products.dm index bc653e3776f9..659416ea06c3 100644 --- a/code/modules/butchery/butchery_products.dm +++ b/code/modules/butchery/butchery_products.dm @@ -3,6 +3,7 @@ material_alteration = MAT_FLAG_ALTERATION_COLOR icon_state = ICON_STATE_WORLD material = /decl/material/solid/organic/meat + color = /decl/material/solid/organic/meat::color w_class = ITEM_SIZE_NORMAL volume = 20 nutriment_type = /decl/material/solid/organic/meat @@ -147,9 +148,9 @@ else if(!drying_wetness) . += "\The [src] can be soaked in water to prepare it for drying." -/obj/item/food/butchery/offal/attackby(obj/item/W, mob/user) - if(IS_KNIFE(W) && !_cleaned && !dry) - if(W.do_tool_interaction(TOOL_KNIFE, user, src, 3 SECONDS, "scraping", "scraping", check_skill = work_skill, set_cooldown = TRUE) && !_cleaned) +/obj/item/food/butchery/offal/attackby(obj/item/used_item, mob/user) + if(IS_KNIFE(used_item) && !_cleaned && !dry) + if(used_item.do_tool_interaction(TOOL_KNIFE, user, src, 3 SECONDS, "scraping", "scraping", check_skill = work_skill, set_cooldown = TRUE) && !_cleaned) _cleaned = TRUE SetName("cleaned [name]") return TRUE diff --git a/code/modules/butchery/butchery_products_meat.dm b/code/modules/butchery/butchery_products_meat.dm index 9907f21994ce..c9d2ca23778b 100644 --- a/code/modules/butchery/butchery_products_meat.dm +++ b/code/modules/butchery/butchery_products_meat.dm @@ -53,6 +53,7 @@ name = "piece" desc = "It tastes like you'd expect." material = /decl/material/solid/organic/meat/chicken + color = /decl/material/solid/organic/meat/chicken::color butchery_data = /decl/butchery_data/animal/small/fowl/chicken /obj/item/food/butchery/meat/chicken/game @@ -66,7 +67,8 @@ /obj/item/food/butchery/meat/xeno desc = "A slab of green meat. Smells like acid." icon_state = "xenomeat" - color = "#43de18" + color = "#43de18" // todo: add xenomeat material and use material alteration + material_alteration = MAT_FLAG_ALTERATION_NONE center_of_mass = @'{"x":16,"y":10}' bitesize = 6 butchery_data = /decl/butchery_data/xeno diff --git a/code/modules/butchery/butchery_products_meat_fish.dm b/code/modules/butchery/butchery_products_meat_fish.dm index 90040989b1ff..f0171f3ef6a3 100644 --- a/code/modules/butchery/butchery_products_meat_fish.dm +++ b/code/modules/butchery/butchery_products_meat_fish.dm @@ -8,6 +8,7 @@ nutriment_amt = 6 nutriment_type = /decl/material/solid/organic/meat/fish material = /decl/material/solid/organic/meat/fish + color = /decl/material/solid/organic/meat/fish::color drying_wetness = 60 dried_type = /obj/item/food/jerky/fish backyard_grilling_product = /obj/item/food/butchery/meat/fish/grilled diff --git a/code/modules/character_info/_comment.dm b/code/modules/character_info/_comment.dm index ef15898c550b..3ab52a26d2e1 100644 --- a/code/modules/character_info/_comment.dm +++ b/code/modules/character_info/_comment.dm @@ -25,7 +25,7 @@ /datum/character_comment/proc/is_stale() return !get_config_value(/decl/config/num/hide_comments_older_than) || (REALTIMEOFDAY - last_updated) > (get_config_value(/decl/config/num/hide_comments_older_than)) -/datum/character_comment/proc/get_comment_html(var/datum/character_information/presenting, var/mob/usr, var/row_bkg_color) +/datum/character_comment/proc/get_comment_html(var/datum/character_information/presenting, var/mob/user, var/row_bkg_color) if(!istype(main_mood)) main_mood = GET_DECL(/decl/comment_mood/unknown) @@ -39,14 +39,14 @@ "
    [body]
    ", "" ) - if(usr) + if(user) . += "
    " - if(author_ckey == usr.ckey || check_rights(R_MOD)) + if(author_ckey == user.ckey || check_rights(R_MOD)) . += "Edit
    " . += "Delete
    " . += "Change primary mood
    " . += "Change border mood" - else if(usr.ckey == presenting.ckey) + else if(user.ckey == presenting.ckey) . += "Delete" else . += "Not editable." diff --git a/code/modules/chat_filter/_chat_filter.dm b/code/modules/chat_filter/_chat_filter.dm index 7e9ce18e77a0..ea96abac60af 100644 --- a/code/modules/chat_filter/_chat_filter.dm +++ b/code/modules/chat_filter/_chat_filter.dm @@ -1,21 +1,29 @@ var/global/list/chat_blockers_in_use var/global/list/chat_modifiers_in_use -/proc/build_filter_lists() +/proc/_get_chat_filters_in_use() global.chat_blockers_in_use = list() global.chat_modifiers_in_use = list() - var/list/all_filters = decls_repository.get_decls_of_type(/decl/chat_filter) - for(var/filtertype in all_filters) - var/decl/chat_filter/chat_filter = all_filters[filtertype] - if(!chat_filter.disabled) - if(chat_filter.can_deny_message) - global.chat_blockers_in_use += chat_filter - if(chat_filter.can_modify_message) - global.chat_modifiers_in_use += chat_filter - return TRUE + for(var/decl/chat_filter/chat_filter in decls_repository.get_decls_of_type_unassociated(/decl/chat_filter)) + if(chat_filter.disabled) + continue + if(chat_filter.can_deny_message) + global.chat_blockers_in_use += chat_filter + if(chat_filter.can_modify_message) + global.chat_modifiers_in_use += chat_filter + +/proc/get_chat_blockers_in_use() + if(!global.chat_blockers_in_use) + _get_chat_filters_in_use() + return global.chat_blockers_in_use + +/proc/get_chat_modifiers_in_use() + if(!global.chat_modifiers_in_use) + _get_chat_filters_in_use() + return global.chat_modifiers_in_use /proc/filter_block_message(var/mob/speaker, var/msg) - for(var/decl/chat_filter/chat_filter in global.chat_blockers_in_use) + for(var/decl/chat_filter/chat_filter in get_chat_blockers_in_use()) var/match = chat_filter.match(msg) if(match) var/deny_msg = chat_filter.deny(speaker, match) @@ -25,7 +33,7 @@ var/global/list/chat_modifiers_in_use /proc/filter_modify_message(var/msg) . = msg - for(var/decl/chat_filter/chat_filter in global.chat_modifiers_in_use) + for(var/decl/chat_filter/chat_filter in get_chat_modifiers_in_use()) var/match = chat_filter.match(.) if(match) . = chat_filter.replace(., match) @@ -50,9 +58,10 @@ var/global/list/chat_modifiers_in_use /client/verb/check_message_filters() set name = "Check Message Filters" set category = "OOC" - if(length(global.chat_blockers_in_use)) + var/list/blockers_in_use = get_chat_blockers_in_use() + if(length(blockers_in_use)) to_chat(usr, "The following filters are being used to block messages:
    ") - for(var/decl/chat_filter/chat_filter in global.chat_blockers_in_use) + for(var/decl/chat_filter/chat_filter in blockers_in_use) to_chat(usr, "[chat_filter.name]
    [chat_filter.summary]
    ") else to_chat(usr, "There are no filters being used to block messages currently.") @@ -60,9 +69,10 @@ var/global/list/chat_modifiers_in_use /client/verb/check_message_modifiers() set name = "Check Message Modifiers" set category = "OOC" - if(length(global.chat_modifiers_in_use)) + var/list/modifiers_in_use = get_chat_modifiers_in_use() + if(length(modifiers_in_use)) to_chat(usr, "The following filters can be used to modify messages:
    ") - for(var/decl/chat_filter/chat_filter in global.chat_modifiers_in_use) + for(var/decl/chat_filter/chat_filter in modifiers_in_use) to_chat(usr, "[chat_filter.name]
    [chat_filter.summary]
    ") else - to_chat(usr, "There are no avaiable filters for modifying messages currently.") + to_chat(usr, "There are no available filters for modifying messages currently.") diff --git a/code/modules/chatter/_chatter.dm b/code/modules/chatter/_chatter.dm index 9dbbc5b0c963..06fd5c76bac1 100644 --- a/code/modules/chatter/_chatter.dm +++ b/code/modules/chatter/_chatter.dm @@ -14,7 +14,7 @@ calls_and_responses = list( new /datum/chatter_conversation/debug_one ) - + /datum/chatter_conversation/debug_one/create_lines() chatter_lines = list( new /datum/chatter_line("Sir One", "Dame Two", "This is $NAME$ to $TARGET$, what's our vector, Victor?"), @@ -48,7 +48,7 @@ create_conversations() next_chatter_time = world.time + rand(min_chatter_time_elapsed, max_chatter_time_elapsed) if(listener_landmark && ispath(listener_instance)) - for(var/obj/abstract/landmark/landmark in global.landmarks_list) + for(var/obj/abstract/landmark/landmark in global.all_landmarks) if(landmark.name != listener_landmark) continue var/turf/T = get_turf(landmark) @@ -94,7 +94,7 @@ next_chatter_time = world.time + rand(min_chatter_time_elapsed, max_chatter_time_elapsed) else next_chatter_time = world.time + rand(min_line_time, max_line_time) - + /decl/radio_chatter/proc/hear_chat() if(current_dialogue_sequence) interrupted = TRUE diff --git a/code/modules/client/movement.dm b/code/modules/client/movement.dm index efcf51c02ee2..47b5ff8c256f 100644 --- a/code/modules/client/movement.dm +++ b/code/modules/client/movement.dm @@ -2,7 +2,7 @@ /client/New() ..() dir = NORTH - +/* Commenting out due to being very broken. Consider removing and officially not supporting client dir changes. /client/verb/spinleft() set name = "Spin View CCW" set category = "OOC" @@ -12,4 +12,4 @@ set name = "Spin View CW" set category = "OOC" dir = turn(dir, -90) - +*/ \ No newline at end of file diff --git a/code/modules/client/preference_setup/antagonism/01_candidacy.dm b/code/modules/client/preference_setup/antagonism/01_candidacy.dm index 40ad53d76f03..59d4a7cf8968 100644 --- a/code/modules/client/preference_setup/antagonism/01_candidacy.dm +++ b/code/modules/client/preference_setup/antagonism/01_candidacy.dm @@ -2,6 +2,9 @@ var/list/may_be_special_role var/list/be_special_role +/datum/category_item/player_setup_item/antagonism + abstract_type = /datum/category_item/player_setup_item/antagonism + /datum/category_item/player_setup_item/antagonism/candidacy name = "Candidacy" sort_order = 1 @@ -10,9 +13,9 @@ pref.be_special_role = R.read("be_special") pref.may_be_special_role = R.read("may_be_special") -/datum/category_item/player_setup_item/antagonism/candidacy/save_character(datum/pref_record_writer/W) - W.write("be_special", pref.be_special_role) - W.write("may_be_special", pref.may_be_special_role) +/datum/category_item/player_setup_item/antagonism/candidacy/save_character(datum/pref_record_writer/writer) + writer.write("be_special", pref.be_special_role) + writer.write("may_be_special", pref.may_be_special_role) /datum/category_item/player_setup_item/antagonism/candidacy/sanitize_character() if(!istype(pref.be_special_role)) diff --git a/code/modules/client/preference_setup/antagonism/02_setup.dm b/code/modules/client/preference_setup/antagonism/02_setup.dm index efd83fc0e06e..83488006cfcb 100644 --- a/code/modules/client/preference_setup/antagonism/02_setup.dm +++ b/code/modules/client/preference_setup/antagonism/02_setup.dm @@ -24,14 +24,14 @@ if(uplink_source) pref.uplink_sources += uplink_source -/datum/category_item/player_setup_item/antagonism/basic/save_character(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/antagonism/basic/save_character(datum/pref_record_writer/writer) var/uplink_order = list() for(var/entry in pref.uplink_sources) - var/decl/uplink_source/UL = entry - uplink_order += UL.name + var/decl/uplink_source/uplink_source = entry + uplink_order += uplink_source.name - W.write("uplink_sources", uplink_order) - W.write("exploit_record", pref.exploit_record) + writer.write("uplink_sources", uplink_order) + writer.write("exploit_record", pref.exploit_record) /datum/category_item/player_setup_item/antagonism/basic/sanitize_character() if(!istype(pref.uplink_sources)) @@ -43,10 +43,10 @@ . +="Antag Setup:
    " . +="Uplink Source Priority: Add
    " for(var/entry in pref.uplink_sources) - var/decl/uplink_source/US = entry - . +="[US.name] Move Up Move Down Remove
    " - if(US.desc) - . += "[US.desc]
    " + var/decl/uplink_source/uplink = entry + . +="[uplink.name] Move Up Move Down Remove
    " + if(uplink.desc) + . += "[uplink.desc]
    " if(!pref.uplink_sources.len) . += "You will not receive an uplink unless you add an uplink source!" . +="
    " @@ -64,25 +64,25 @@ return TOPIC_REFRESH if(href_list["remove_source"]) - var/decl/uplink_source/US = locate(href_list["remove_source"]) in pref.uplink_sources - if(US && pref.uplink_sources.Remove(US)) + var/decl/uplink_source/uplink = locate(href_list["remove_source"]) in pref.uplink_sources + if(uplink && pref.uplink_sources.Remove(uplink)) return TOPIC_REFRESH if(href_list["move_source_up"]) - var/decl/uplink_source/US = locate(href_list["move_source_up"]) in pref.uplink_sources - if(!US) + var/decl/uplink_source/uplink = locate(href_list["move_source_up"]) in pref.uplink_sources + if(!uplink) return TOPIC_NOACTION - var/index = pref.uplink_sources.Find(US) + var/index = pref.uplink_sources.Find(uplink) if(index <= 1) return TOPIC_NOACTION pref.uplink_sources.Swap(index, index - 1) return TOPIC_REFRESH if(href_list["move_source_down"]) - var/decl/uplink_source/US = locate(href_list["move_source_down"]) in pref.uplink_sources - if(!US) + var/decl/uplink_source/uplink = locate(href_list["move_source_down"]) in pref.uplink_sources + if(!uplink) return TOPIC_NOACTION - var/index = pref.uplink_sources.Find(US) + var/index = pref.uplink_sources.Find(uplink) if(index >= pref.uplink_sources.len) return TOPIC_NOACTION pref.uplink_sources.Swap(index, index + 1) diff --git a/code/modules/client/preference_setup/background/01_species.dm b/code/modules/client/preference_setup/background/01_species.dm index 3f8e52d19e78..68992453f584 100644 --- a/code/modules/client/preference_setup/background/01_species.dm +++ b/code/modules/client/preference_setup/background/01_species.dm @@ -1,13 +1,29 @@ +/datum/category_item/player_setup_item/background + abstract_type = /datum/category_item/player_setup_item/background + /datum/category_item/player_setup_item/background/species name = "Species" sort_order = 1 var/hide_species = TRUE -/datum/category_item/player_setup_item/background/species/save_character(datum/pref_record_writer/W) - W.write("species", pref.species) +/datum/category_item/player_setup_item/background/species/populate_mob_snapshot(datum/mob_snapshot/snapshot, is_preview_copy = FALSE) + snapshot.root_species = pref.get_species_decl() + +// This must always return a decl, NEVER null. +/datum/preferences/proc/get_species_decl() + RETURN_TYPE(/decl/species) + species ||= global.using_map.default_species + . = decls_repository.get_decl_by_id(species, validate_decl_type = FALSE) + if(!.) + species = global.using_map.default_species + return decls_repository.get_decl_by_id(species) + +/datum/category_item/player_setup_item/background/species/save_character(datum/pref_record_writer/writer) + writer.write("species", pref.species) /datum/category_item/player_setup_item/background/species/preload_character(datum/pref_record_reader/R) - pref.species = R.read("species") + var/decl/species/loaded_species = decls_repository.get_decl_by_id_or_var(R.read("species"), /decl/species) + pref.species = loaded_species?.uid || decls_repository.get_decl_by_id(global.using_map.default_species) /datum/category_item/player_setup_item/background/species/sanitize_character() . = ..() @@ -15,9 +31,9 @@ /datum/category_item/player_setup_item/background/species/proc/sanitize_species() - if(!pref.species || !get_species_by_key(pref.species)) + if(!pref.species || !pref.get_species_decl()) pref.set_species(global.using_map.default_species) - var/decl/species/mob_species = get_species_by_key(pref.species) + var/decl/species/mob_species = pref.get_species_decl() var/decl/bodytype/mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype var/decl/pronouns/pronouns = get_pronouns_by_gender(pref.gender) if(!istype(pronouns) || !(pronouns in mob_species.available_pronouns)) @@ -30,13 +46,13 @@ pref.all_underwear.Cut() /datum/category_item/player_setup_item/background/species/content(var/mob/user) - var/decl/species/current_species = get_species_by_key(pref.species) + var/decl/species/current_species = pref.get_species_decl() var/list/prefilter = get_playable_species() var/list/playables = list() for(var/s in prefilter) if(!check_rights(R_ADMIN, 0) && get_config_value(/decl/config/toggle/use_alien_whitelist)) - var/decl/species/checking_species = get_species_by_key(s) + var/decl/species/checking_species = decls_repository.get_decl_by_id(s) if(!(checking_species.spawn_flags & SPECIES_CAN_JOIN)) continue else if((checking_species.spawn_flags & SPECIES_IS_WHITELISTED) && !is_alien_whitelisted(preference_mob(),checking_species)) @@ -47,12 +63,12 @@ . += "" . += "" . += "" . += "" @@ -68,10 +84,12 @@ if(current_species.roleplay_summary) desc = "[desc]

    Roleplaying Summary

    [current_species.roleplay_summary]

    " - if(hide_species && length(desc) > 200) + var/was_hidden = hide_species && length(desc) > 200 + if(was_hidden) desc = "[copytext(desc, 1, 194)] \[...\]" . += "" - . += "" + if(was_hidden) + . += "" . += "" @@ -89,6 +107,16 @@ var/choice = href_list["set_species"] if(choice != pref.species) + + if(!check_rights(R_ADMIN, 0) && get_config_value(/decl/config/toggle/use_alien_whitelist)) + var/decl/species/new_species = decls_repository.get_decl_by_id(choice) + if(!new_species) + return TOPIC_REFRESH + if(!(new_species.spawn_flags & SPECIES_CAN_JOIN)) + return TOPIC_REFRESH + else if((new_species.spawn_flags & SPECIES_IS_WHITELISTED) && !is_alien_whitelisted(preference_mob(), new_species)) + return TOPIC_REFRESH + pref.set_species(choice) return TOPIC_REFRESH_UPDATE_PREVIEW diff --git a/code/modules/client/preference_setup/background/02_background.dm b/code/modules/client/preference_setup/background/02_background.dm index 29a06ce70059..6ce982e37d81 100644 --- a/code/modules/client/preference_setup/background/02_background.dm +++ b/code/modules/client/preference_setup/background/02_background.dm @@ -1,5 +1,5 @@ #define GET_ALLOWED_VALUES(write_to, check_key) \ - var/decl/species/S = get_species_by_key(pref.species); \ + var/decl/species/S = pref.get_species_decl(); \ if(!S) { \ write_to = list(); \ } else if(S.force_background_info[check_key]) { \ @@ -25,6 +25,13 @@ hidden[cat_type] = TRUE ..() +/datum/category_item/player_setup_item/background/details/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + if(is_preview_copy) + return + for(var/token in pref.background_info) + character.set_background_value(token, pref.background_info[token], defer_language_update = TRUE) + character.update_languages() + /datum/category_item/player_setup_item/background/details/sanitize_character() if(!islist(pref.background_info)) @@ -77,12 +84,12 @@ if(istype(background)) pref.background_info[cat.type] = background.type -/datum/category_item/player_setup_item/background/details/save_character(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/background/details/save_character(datum/pref_record_writer/writer) for(var/background_cat_type in pref.background_info) var/decl/background_category/cat = GET_DECL(background_cat_type) var/decl/background_detail/entry = GET_DECL(pref.background_info[background_cat_type]) if(istype(cat) && istype(entry)) - W.write(cat.uid, entry.uid) + writer.write(cat.uid, entry.uid) /datum/category_item/player_setup_item/background/details/content() . = list() @@ -112,9 +119,11 @@ . += "[background_strings["details"] || "No additional details."]" . += "" + . += "" + // Only show the button to expand/hide if the text overflows the limit. + if(background.is_long()) + . += "" + . += "" . += "

    Species

    " - for(var/s in get_playable_species()) - var/decl/species/list_species = get_species_by_key(s) - if(pref.species == list_species.name) + for(var/s in playables) + var/decl/species/list_species = decls_repository.get_decl_by_id(s) + if(pref.species == list_species.uid) . += "[list_species.name] " else - . += "[list_species.name] " + . += "[list_species.name] " . += "

    [desc][hide_species ? "Expand" : "Collapse"][hide_species ? "Expand" : "Collapse"]
    " . += "[background_strings["body"] || "No description."]" - . += "" - . += "[hidden[cat.type] ? "Expand" : "Collapse"]" - . += "
    [hidden[cat.type] ? "Expand" : "Collapse"]

    " . = jointext(.,null) diff --git a/code/modules/client/preference_setup/background/03_language.dm b/code/modules/client/preference_setup/background/03_language.dm index 9196389ebc21..486d6bffd109 100644 --- a/code/modules/client/preference_setup/background/03_language.dm +++ b/code/modules/client/preference_setup/background/03_language.dm @@ -7,6 +7,12 @@ var/list/allowed_languages var/list/free_languages +/datum/category_item/player_setup_item/background/languages/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + if(is_preview_copy) + return + for(var/lang in pref.alternate_languages) + character.add_language(lang) + /datum/category_item/player_setup_item/background/languages/load_character(datum/pref_record_reader/R) pref.alternate_languages = list() var/list/language_names = R.read("language") @@ -15,13 +21,13 @@ if(istype(lang_decl)) pref.alternate_languages |= lang_decl.type -/datum/category_item/player_setup_item/background/languages/save_character(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/background/languages/save_character(datum/pref_record_writer/writer) var/list/language_names = list() for(var/lang in pref.alternate_languages) var/decl/language/lang_decl = GET_DECL(lang) if(istype(lang_decl)) language_names |= lang_decl.name - W.write("language", language_names) + writer.write("language", language_names) /datum/category_item/player_setup_item/background/languages/sanitize_character() if(!islist(pref.alternate_languages)) diff --git a/code/modules/client/preference_setup/controls/01_keybindings.dm b/code/modules/client/preference_setup/controls/01_keybindings.dm index eccfd9ecccf3..5400207e6508 100644 --- a/code/modules/client/preference_setup/controls/01_keybindings.dm +++ b/code/modules/client/preference_setup/controls/01_keybindings.dm @@ -47,6 +47,9 @@ to_chat(client, SPAN_DANGER("[conflicted.category]: [conflicted.full_name] needs updating.")) LAZYADD(key_bindings["Unbound"], conflicted.name) // set it to unbound to prevent this from opening up again in the future +/datum/category_item/player_setup_item/controls + abstract_type = /datum/category_item/player_setup_item/controls + /datum/category_item/player_setup_item/controls/keybindings name = "Keybindings" sort_order = 1 @@ -58,8 +61,8 @@ pref.key_bindings = sanitize_keybindings(pref.key_bindings) pref.check_keybindings() -/datum/category_item/player_setup_item/controls/keybindings/save_preferences(datum/pref_record_writer/W) - W.write("key_bindings", pref.key_bindings) +/datum/category_item/player_setup_item/controls/keybindings/save_preferences(datum/pref_record_writer/writer) + writer.write("key_bindings", pref.key_bindings) /datum/category_item/player_setup_item/controls/keybindings/content(mob/user) . = list() diff --git a/code/modules/client/preference_setup/general/01_basic.dm b/code/modules/client/preference_setup/general/01_basic.dm index b33b09d48bf7..83a11ec1a5d4 100644 --- a/code/modules/client/preference_setup/general/01_basic.dm +++ b/code/modules/client/preference_setup/general/01_basic.dm @@ -5,20 +5,22 @@ var/real_name //our character's name var/be_random_name = 0 //whether we are a random name every round -// These two should always return a decl, NEVER null. -/datum/preferences/proc/get_species_decl() - RETURN_TYPE(/decl/species) - return get_species_by_key(species || global.using_map.default_species) - +// This must always return a decl, NEVER null. /datum/preferences/proc/get_bodytype_decl() RETURN_TYPE(/decl/bodytype) var/decl/species/species_decl = get_species_decl() return species_decl.get_bodytype_by_name(bodytype) || species_decl.default_bodytype +/datum/category_item/player_setup_item/physical + abstract_type = /datum/category_item/player_setup_item/physical + /datum/category_item/player_setup_item/physical/basic name = "Basic" sort_order = 1 +/datum/category_item/player_setup_item/physical/basic/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + character.set_gender(pref.gender) + /datum/category_item/player_setup_item/physical/basic/preload_character(datum/pref_record_reader/R) pref.gender = R.read("gender") pref.bodytype = R.read("bodytype") @@ -32,14 +34,14 @@ else pref.spawnpoint = global.using_map.default_spawn -/datum/category_item/player_setup_item/physical/basic/save_character(datum/pref_record_writer/W) - W.write("gender", pref.gender) - W.write("bodytype", pref.bodytype) - W.write("real_name", pref.real_name) - W.write("name_is_always_random", pref.be_random_name) +/datum/category_item/player_setup_item/physical/basic/save_character(datum/pref_record_writer/writer) + writer.write("gender", pref.gender) + writer.write("bodytype", pref.bodytype) + writer.write("real_name", pref.real_name) + writer.write("name_is_always_random", pref.be_random_name) var/decl/spawnpoint/spawnpoint = GET_DECL(pref.spawnpoint) if(spawnpoint) - W.write("spawnpoint", spawnpoint.uid) + writer.write("spawnpoint", spawnpoint.uid) /datum/category_item/player_setup_item/physical/basic/sanitize_character() @@ -51,7 +53,7 @@ if(!valid_spawn) pref.spawnpoint = global.using_map.default_spawn - var/decl/species/S = get_species_by_key(pref.species) || get_species_by_key(global.using_map.default_species) + var/decl/species/S = pref.get_species_decl() pref.be_random_name = sanitize_integer(pref.be_random_name, 0, 1, initial(pref.be_random_name)) var/decl/pronouns/pronouns @@ -68,6 +70,22 @@ bodytype = S.get_bodytype_by_pronouns(pronouns) pref.set_bodytype(bodytype.name) +/datum/category_item/player_setup_item/physical/basic/populate_mob_snapshot(datum/mob_snapshot/snapshot, is_preview_copy = FALSE) + snapshot.root_bodytype = pref.get_bodytype_decl() + var/new_real_name = pref.real_name + if(pref.be_random_name) + var/decl/background_detail/background = pref.get_background_datum_by_flag(BACKGROUND_FLAG_NAMING) + if(background) + new_real_name = background.get_random_name(pref.gender) + if(get_config_value(/decl/config/toggle/humans_need_surnames)) + var/firstspace = findtext(new_real_name, " ") + var/name_length = length(new_real_name) + if(!firstspace) //we need a surname + new_real_name += " [pick(global.using_map.last_names)]" + else if(firstspace == name_length) // someone tried to cheese it by putting a space at the end + new_real_name += "[pick(global.using_map.last_names)]" + snapshot.real_name = new_real_name + /datum/category_item/player_setup_item/physical/basic/content() . = list() @@ -78,7 +96,7 @@ . += "
    " . += "Bodytype: " - var/decl/species/S = get_species_by_key(pref.species) + var/decl/species/S = pref.get_species_decl() for(var/decl/bodytype/B in S.available_bodytypes) if(B.name == pref.bodytype) . += "[capitalize(B.pref_name)]" @@ -102,7 +120,7 @@ . = jointext(.,null) /datum/category_item/player_setup_item/physical/basic/OnTopic(var/href,var/list/href_list, var/mob/user) - var/decl/species/S = get_species_by_key(pref.species) + var/decl/species/S = pref.get_species_decl() if(href_list["rename"]) var/raw_name = input(user, "Choose your character's name:", "Character Name") as text|null diff --git a/code/modules/client/preference_setup/general/02_body.dm b/code/modules/client/preference_setup/general/02_body.dm index 4c24a880b2f4..fc96fa6b3d29 100644 --- a/code/modules/client/preference_setup/general/02_body.dm +++ b/code/modules/client/preference_setup/general/02_body.dm @@ -14,6 +14,53 @@ name = "Body" sort_order = 2 +/datum/category_item/player_setup_item/physical/body/populate_mob_snapshot(datum/mob_snapshot/snapshot, is_preview_copy = FALSE) + snapshot.blood_type = pref.blood_type + // we don't check appearance_flags here, apply_appearance_to does that + snapshot.skin_color = pref.skin_colour + snapshot.skin_tone = pref.skin_tone + snapshot.eye_color = pref.eye_colour + // so this is the hellish part. + // pref.sprite_accessories is sprite_accessories[accessory_category.type][loaded_accessory.type] = metadata + // snapshot.sprite_accessories is sprite_accessories[organ_tag][accessory_category.type][loaded_accessory.type] = metadata + // we have to convert it here + // on the bright side bodytype.default_sprite_accessories uses the same format + var/list/new_sprite_accessories = list() + // THIS IS HACKY. PLEASE FIND A BETTER WAY TO DO THIS + // Adds default bodytype accessories to the snapshot. + var/decl/bodytype/the_bodytype = pref.get_bodytype_decl() + for(var/accessory_category in the_bodytype.default_sprite_accessories) + var/decl/sprite_accessory_category/acc_cat = GET_DECL(accessory_category) + if(!acc_cat.always_apply_defaults) + continue + var/list/accessories = the_bodytype.default_sprite_accessories[accessory_category] + acc_cat.prepare_mob_snapshot(snapshot, accessories) + for(var/accessory in accessories) + var/decl/sprite_accessory/accessory_decl = GET_DECL(accessory) + var/accessory_metadata = accessories[accessory] + for(var/bodypart in accessory_decl.body_parts) + LAZYINITLIST(new_sprite_accessories[bodypart]) + LAZYSET(new_sprite_accessories[bodypart][accessory_category], accessory, accessory_metadata) + // jank shit end + for(var/accessory_category in pref.sprite_accessories) + var/decl/sprite_accessory_category/acc_cat = GET_DECL(accessory_category) + var/list/accessories = pref.sprite_accessories[accessory_category] + acc_cat.prepare_mob_snapshot(snapshot, accessories) + // todo: copy this elsewhere + // ^ i have no clue if i ever did this or not. presumably bc i don't know what i meant needed copying + for(var/accessory in accessories) + var/decl/sprite_accessory/accessory_decl = GET_DECL(accessory) + var/accessory_metadata = accessories[accessory] + for(var/bodypart in accessory_decl.body_parts) + LAZYINITLIST(new_sprite_accessories[bodypart]) + LAZYSET(new_sprite_accessories[bodypart][accessory_category], accessory, accessory_metadata) + if(length(new_sprite_accessories)) + snapshot.sprite_accessories = new_sprite_accessories + +/datum/category_item/player_setup_item/physical/body/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + if(LAZYLEN(pref.appearance_descriptors)) + character.appearance_descriptors = pref.appearance_descriptors.Copy() + /datum/category_item/player_setup_item/physical/body/load_character(datum/pref_record_reader/R) pref.skin_colour = R.read("skin_colour") @@ -82,9 +129,9 @@ if(!pref.bgstate || !(pref.bgstate in global.using_map.char_preview_bgstate_options)) pref.bgstate = global.using_map.char_preview_bgstate_options[1] -/datum/category_item/player_setup_item/physical/body/save_character(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/physical/body/save_character(datum/pref_record_writer/writer) - var/decl/species/mob_species = get_species_by_key(pref.species) + var/decl/species/mob_species = pref.get_species_decl() var/list/save_accessories = list() for(var/acc_cat in mob_species.available_accessory_categories) if(!(acc_cat in pref.sprite_accessories)) @@ -99,17 +146,20 @@ serialize_metadata[metadata.uid] = pref.sprite_accessories[acc_cat][acc][metadata_type] save_accessories[accessory_category.uid][accessory.uid] = serialize_metadata - W.write("sprite_accessories", save_accessories) - W.write("skin_tone", pref.skin_tone) - W.write("skin_colour", pref.skin_colour) - W.write("eye_colour", pref.eye_colour) - W.write("b_type", pref.blood_type) - W.write("appearance_descriptors", pref.appearance_descriptors) - W.write("bgstate", pref.bgstate) + writer.write("sprite_accessories", save_accessories) + writer.write("skin_tone", pref.skin_tone) + writer.write("skin_colour", pref.skin_colour) + writer.write("eye_colour", pref.eye_colour) + writer.write("b_type", pref.blood_type) + writer.write("appearance_descriptors", pref.appearance_descriptors) + writer.write("bgstate", pref.bgstate) /datum/category_item/player_setup_item/physical/body/sanitize_character() - var/decl/species/mob_species = get_species_by_key(pref.species) + var/decl/species/mob_species = pref.get_species_decl() + if(!mob_species || (mob_species.spawn_flags & SPECIES_IS_RESTRICTED)) + pref.species = global.using_map.default_species + mob_species = pref.get_species_decl() var/decl/bodytype/mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype if(mob_bodytype.appearance_flags & HAS_SKIN_COLOR) pref.skin_colour = pref.skin_colour || mob_bodytype.base_color || COLOR_BLACK @@ -122,9 +172,6 @@ pref.blood_type = sanitize_text(pref.blood_type, initial(pref.blood_type)) - if(!pref.species || !(pref.species in get_playable_species())) - pref.species = global.using_map.default_species - if(!pref.blood_type || !(pref.blood_type in mob_species.blood_types)) pref.blood_type = pickweight(mob_species.blood_types) @@ -186,7 +233,7 @@ /datum/category_item/player_setup_item/physical/body/content(var/mob/user) . = list() - var/decl/species/mob_species = get_species_by_key(pref.species) + var/decl/species/mob_species = pref.get_species_decl() var/decl/bodytype/mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype . += "Blood Type: [pref.blood_type]
    " . += "Randomize Appearance
    " @@ -211,31 +258,34 @@ . += "" . += "" + // Items in this list are only added if there are entries in accessory_strings. + var/list/accessory_header = list() + var/list/accessory_strings = list() if((mob_bodytype.appearance_flags & (HAS_EYE_COLOR|HAS_SKIN_COLOR|HAS_A_SKIN_TONE)) || length(mob_species.available_accessory_categories)) - . += "

    Colouration and accessories

    " - . += "" + accessory_header += "

    Colouration and accessories

    " + accessory_header += "
    " if(mob_bodytype.appearance_flags & HAS_A_SKIN_TONE) - . += "" - . += "" - . += "" - . += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" if(mob_bodytype.appearance_flags & HAS_SKIN_COLOR) - . += "" - . += "" - . += "" - . += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" if(mob_bodytype.appearance_flags & HAS_EYE_COLOR) - . += "" - . += "" - . += "" - . += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" var/const/up_arrow = "⇧" var/const/down_arrow = "⇩" @@ -261,22 +311,22 @@ var/list/accessory_metadata = length(current_accessories) ? current_accessories[current_accessory] : accessory_decl.get_default_accessory_metadata() var/list/metadata_strings = list() for(var/metadata_type in accessory_decl.accessory_metadata_types) - var/decl/sprite_accessory_metadata/sam = GET_DECL(metadata_type) - metadata_strings += sam.get_metadata_options_string(src, accessory_cat_decl, accessory_decl, LAZYACCESS(accessory_metadata, metadata_type)) + var/decl/sprite_accessory_metadata/metadata = GET_DECL(metadata_type) + metadata_strings += metadata.get_metadata_options_string(src, accessory_cat_decl, accessory_decl, LAZYACCESS(accessory_metadata, metadata_type)) var/acc_decl_ref = "\ref[accessory_decl]" - . += "" - . += "" - . += "" - . += "" - . += "" - . += "" - . += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" continue - . += "" - . += "" - . += "" - . += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" var/i = 0 for(var/accessory in current_accessories) i++ @@ -284,18 +334,22 @@ var/list/accessory_metadata = current_accessories[accessory] var/list/metadata_strings = list() for(var/metadata_type in accessory_decl.accessory_metadata_types) - var/decl/sprite_accessory_metadata/sam = GET_DECL(metadata_type) - metadata_strings += sam.get_metadata_options_string(src, accessory_cat_decl, accessory_decl, LAZYACCESS(accessory_metadata, metadata_type)) + var/decl/sprite_accessory_metadata/metadata = GET_DECL(metadata_type) + metadata_strings += metadata.get_metadata_options_string(src, accessory_cat_decl, accessory_decl, LAZYACCESS(accessory_metadata, metadata_type)) var/acc_decl_ref = "\ref[accessory_decl]" - . += "" - . += "" - . += "" - . += "" - . += "" - . += "" - . += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" + accessory_strings += "" if(isnull(accessory_cat_decl.max_selections) || i < accessory_cat_decl.max_selections) - . += "" + accessory_strings += "" + + if(length(accessory_strings)) + . += accessory_header + . += accessory_strings . += "
    Skin tone[-pref.skin_tone + 35]/[mob_bodytype.max_skin_tone()]" - . += "
    Skin tone[-pref.skin_tone + 35]/[mob_bodytype.max_skin_tone()]" + accessory_strings += "
    Skin color[COLORED_SQUARE(pref.skin_colour)] Change" - . += "
    Skin color[COLORED_SQUARE(pref.skin_colour)] Change" + accessory_strings += "
    Eyes[COLORED_SQUARE(pref.eye_colour)] Change" - . += "
    Eyes[COLORED_SQUARE(pref.eye_colour)] Change" + accessory_strings += "
    [accessory_cat_decl.name][jointext(metadata_strings, "
    ")]
    [left_arrow][accessory_decl.name][right_arrow]
    [accessory_cat_decl.name][jointext(metadata_strings, "
    ")]
    [left_arrow][accessory_decl.name][right_arrow]
    [accessory_cat_decl.name]
    [accessory_cat_decl.name]
    Remove[jointext(metadata_strings, "
    ")]
    [up_arrow][accessory_decl.name][down_arrow]
    Remove[jointext(metadata_strings, "
    ")]
    [up_arrow][accessory_decl.name][down_arrow]
    Add marking
    Add marking
    " @@ -303,7 +357,7 @@ /datum/category_item/player_setup_item/physical/body/OnTopic(var/href,var/list/href_list, var/mob/user) - var/decl/species/mob_species = get_species_by_key(pref.species) + var/decl/species/mob_species = pref.get_species_decl() var/decl/bodytype/mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype if(href_list["set_descriptor"]) @@ -327,7 +381,7 @@ else if(href_list["blood_type"]) var/new_b_type = input(user, "Choose your character's blood type:", CHARACTER_PREFERENCE_INPUT_TITLE) as null|anything in mob_species.blood_types if(new_b_type && CanUseTopic(user)) - mob_species = get_species_by_key(pref.species) + mob_species = pref.get_species_decl() if(new_b_type in mob_species.blood_types) pref.blood_type = new_b_type return TOPIC_REFRESH @@ -436,7 +490,7 @@ if(!(mob_bodytype.appearance_flags & HAS_EYE_COLOR)) return TOPIC_NOACTION var/new_eyes = input(user, "Choose your character's eye colour:", CHARACTER_PREFERENCE_INPUT_TITLE, pref.eye_colour) as color|null - mob_species = get_species_by_key(pref.species) + mob_species = pref.get_species_decl() mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype if(new_eyes && (mob_bodytype.appearance_flags & HAS_EYE_COLOR) && CanUseTopic(user)) pref.eye_colour = new_eyes @@ -446,7 +500,7 @@ if(!(mob_bodytype.appearance_flags & HAS_A_SKIN_TONE)) return TOPIC_NOACTION var/new_s_tone = input(user, "Choose your character's skin-tone. Lower numbers are lighter, higher are darker. Range: 1 to [mob_bodytype.max_skin_tone()]", CHARACTER_PREFERENCE_INPUT_TITLE, (-pref.skin_tone) + 35) as num|null - mob_species = get_species_by_key(pref.species) + mob_species = pref.get_species_decl() mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype if(new_s_tone && (mob_bodytype.appearance_flags & HAS_A_SKIN_TONE) && CanUseTopic(user)) pref.skin_tone = 35 - max(min(round(new_s_tone), mob_bodytype.max_skin_tone()), 1) @@ -456,7 +510,7 @@ if(!(mob_bodytype.appearance_flags & HAS_SKIN_COLOR)) return TOPIC_NOACTION var/new_skin = input(user, "Choose your character's skin colour: ", CHARACTER_PREFERENCE_INPUT_TITLE, pref.skin_colour) as color|null - mob_species = get_species_by_key(pref.species) + mob_species = pref.get_species_decl() mob_bodytype = mob_species.get_bodytype_by_name(pref.bodytype) || mob_species.default_bodytype if(new_skin && (mob_bodytype.appearance_flags & HAS_SKIN_COLOR) && CanUseTopic(user)) pref.skin_colour = new_skin diff --git a/code/modules/client/preference_setup/general/03_traits.dm b/code/modules/client/preference_setup/general/03_traits.dm index 22f02be9f2b2..b61d8b02b201 100644 --- a/code/modules/client/preference_setup/general/03_traits.dm +++ b/code/modules/client/preference_setup/general/03_traits.dm @@ -39,13 +39,18 @@ else pref.prune_invalid_traits() -/datum/category_item/player_setup_item/traits/save_character(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/traits/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + character.clear_extrinsic_traits() + for(var/trait_type in pref.traits) + character.set_trait(trait_type, (pref.traits[trait_type] || TRAIT_LEVEL_EXISTS)) + +/datum/category_item/player_setup_item/traits/save_character(datum/pref_record_writer/writer) var/list/trait_ids = list() for(var/trait_type in pref.traits) var/decl/trait/trait_decl = GET_DECL(trait_type) if(istype(trait_decl)) trait_ids |= trait_decl.uid - W.write("traits", trait_ids) + writer.write("traits", trait_ids) /datum/category_item/player_setup_item/traits/proc/get_trait_total() var/trait_cost = 0 diff --git a/code/modules/client/preference_setup/general/04_equipment.dm b/code/modules/client/preference_setup/general/04_equipment.dm index 4f24dd14b785..437ec1c4cc46 100644 --- a/code/modules/client/preference_setup/general/04_equipment.dm +++ b/code/modules/client/preference_setup/general/04_equipment.dm @@ -18,10 +18,26 @@ if(!backpacks_by_name) backpacks_by_name = list() var/bos = global.using_map.get_available_backpacks() - for(var/bo in bos) - var/decl/backpack_outfit/backpack_outfit = bos[bo] + for(var/backpack_option in bos) + var/decl/backpack_outfit/backpack_outfit = bos[backpack_option] backpacks_by_name[backpack_outfit.name] = backpack_outfit +/datum/category_item/player_setup_item/physical/equipment/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + QDEL_NULL_LIST(character.worn_underwear) + character.worn_underwear = list() + for(var/underwear_category_name in pref.all_underwear) + var/datum/category_group/underwear/underwear_category = global.underwear.categories_by_name[underwear_category_name] + if(underwear_category) + var/underwear_item_name = pref.all_underwear[underwear_category_name] + var/datum/category_item/underwear/UWD = underwear_category.items_by_name[underwear_item_name] + var/metadata = pref.all_underwear_metadata[underwear_category_name] + var/obj/item/underwear/UW = UWD.create_underwear(character, metadata) + if(UW) + UW.ForceEquipUnderwear(character, FALSE) + else + pref.all_underwear -= underwear_category_name + character.backpack_setup = new(pref.backpack, pref.backpack_metadata["[pref.backpack]"]) + /datum/category_item/player_setup_item/physical/equipment/load_character(datum/pref_record_reader/R) pref.all_underwear = R.read("all_underwear") pref.all_underwear_metadata = R.read("all_underwear_metadata") @@ -36,14 +52,14 @@ var/load_backbag = R.read("backpack") pref.backpack = backpacks_by_name[load_backbag] || get_default_outfit_backpack() -/datum/category_item/player_setup_item/physical/equipment/save_character(datum/pref_record_writer/W) - W.write("all_underwear", pref.all_underwear) - W.write("all_underwear_metadata", pref.all_underwear_metadata) - W.write("backpack", pref.backpack.name) - W.write("backpack_metadata", pref.backpack_metadata) - W.write("survival_box", pref.survival_box_choice?.uid) - W.write("starting_cash_choice", pref.starting_cash_choice?.uid) - W.write("passport", pref.give_passport) +/datum/category_item/player_setup_item/physical/equipment/save_character(datum/pref_record_writer/writer) + writer.write("all_underwear", pref.all_underwear) + writer.write("all_underwear_metadata", pref.all_underwear_metadata) + writer.write("backpack", pref.backpack.name) + writer.write("backpack_metadata", pref.backpack_metadata) + writer.write("survival_box", pref.survival_box_choice?.uid) + writer.write("starting_cash_choice", pref.starting_cash_choice?.uid) + writer.write("passport", pref.give_passport) /datum/category_item/player_setup_item/physical/equipment/sanitize_character() if(!istype(pref.all_underwear)) @@ -210,13 +226,13 @@ var/backpack_name = href_list["backpack"] if(!(backpack_name in backpacks_by_name)) return TOPIC_NOACTION - var/decl/backpack_outfit/bo = backpacks_by_name[backpack_name] - var/datum/backpack_tweak/bt = locate(href_list["tweak"]) in bo.tweaks + var/decl/backpack_outfit/backpack_option = backpacks_by_name[backpack_name] + var/datum/backpack_tweak/bt = locate(href_list["tweak"]) in backpack_option.tweaks if(!bt) return TOPIC_NOACTION - var/new_metadata = bt.get_metadata(user, get_backpack_metadata(bo, bt)) + var/new_metadata = bt.get_metadata(user, get_backpack_metadata(backpack_option, bt)) if(new_metadata) - set_backpack_metadata(bo, bt, new_metadata) + set_backpack_metadata(backpack_option, bt, new_metadata) return TOPIC_REFRESH_UPDATE_PREVIEW else if(href_list["change_cash_choice"]) var/list/display_choices = list() diff --git a/code/modules/client/preference_setup/general/05_flavor.dm b/code/modules/client/preference_setup/general/05_flavor.dm index 803e65cee7cb..f10579925758 100644 --- a/code/modules/client/preference_setup/general/05_flavor.dm +++ b/code/modules/client/preference_setup/general/05_flavor.dm @@ -6,6 +6,11 @@ name = "Flavor" sort_order = 5 +/datum/category_item/player_setup_item/physical/flavor/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + if(is_preview_copy) + return + character.flavor_texts = pref.flavor_texts.Copy() + /datum/category_item/player_setup_item/physical/flavor/load_character(datum/pref_record_reader/R) pref.flavor_texts["general"] = R.read("flavor_texts_general") pref.flavor_texts["head"] = R.read("flavor_texts_head") @@ -22,20 +27,20 @@ for(var/module in SSrobots.all_module_names) pref.flavour_texts_robot[module] = R.read("flavour_texts_robot_[module]") -/datum/category_item/player_setup_item/physical/flavor/save_character(datum/pref_record_writer/W) - W.write("flavor_texts_general", pref.flavor_texts["general"]) - W.write("flavor_texts_head", pref.flavor_texts["head"]) - W.write("flavor_texts_face", pref.flavor_texts["face"]) - W.write("flavor_texts_eyes", pref.flavor_texts["eyes"]) - W.write("flavor_texts_torso", pref.flavor_texts["torso"]) - W.write("flavor_texts_arms", pref.flavor_texts["arms"]) - W.write("flavor_texts_hands", pref.flavor_texts["hands"]) - W.write("flavor_texts_legs", pref.flavor_texts["legs"]) - W.write("flavor_texts_feet", pref.flavor_texts["feet"]) +/datum/category_item/player_setup_item/physical/flavor/save_character(datum/pref_record_writer/writer) + writer.write("flavor_texts_general", pref.flavor_texts["general"]) + writer.write("flavor_texts_head", pref.flavor_texts["head"]) + writer.write("flavor_texts_face", pref.flavor_texts["face"]) + writer.write("flavor_texts_eyes", pref.flavor_texts["eyes"]) + writer.write("flavor_texts_torso", pref.flavor_texts["torso"]) + writer.write("flavor_texts_arms", pref.flavor_texts["arms"]) + writer.write("flavor_texts_hands", pref.flavor_texts["hands"]) + writer.write("flavor_texts_legs", pref.flavor_texts["legs"]) + writer.write("flavor_texts_feet", pref.flavor_texts["feet"]) - W.write("flavour_texts_robot_Default", pref.flavour_texts_robot["Default"]) + writer.write("flavour_texts_robot_Default", pref.flavour_texts_robot["Default"]) for(var/module in SSrobots.all_module_names) - W.write("flavour_texts_robot_[module]", pref.flavour_texts_robot[module]) + writer.write("flavour_texts_robot_[module]", pref.flavour_texts_robot[module]) /datum/category_item/player_setup_item/physical/flavor/sanitize_character() if(!istype(pref.flavor_texts)) pref.flavor_texts = list() diff --git a/code/modules/client/preference_setup/global/01_ui.dm b/code/modules/client/preference_setup/global/01_ui.dm index f48998316cc7..462e46c2b32b 100644 --- a/code/modules/client/preference_setup/global/01_ui.dm +++ b/code/modules/client/preference_setup/global/01_ui.dm @@ -13,6 +13,9 @@ var/global/list/valid_icon_sizes = list(32, 48, 64, 96, 128) //Style for popup tooltips var/tooltip_style = "Midnight" +/datum/category_item/player_setup_item/player_global + abstract_type = /datum/category_item/player_setup_item/player_global + /datum/category_item/player_setup_item/player_global/ui name = "UI" sort_order = 1 @@ -35,19 +38,19 @@ var/global/list/valid_icon_sizes = list(32, 48, 64, 96, 128) pref.ooccolor = R.read("ooccolor") pref.clientfps = R.read("clientfps") -/datum/category_item/player_setup_item/player_global/ui/save_preferences(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/player_global/ui/save_preferences(datum/pref_record_writer/writer) var/decl/ui_style/ui_style = GET_DECL(pref.UI_style) - W.write("UI_style", ui_style.uid) + writer.write("UI_style", ui_style.uid) - W.write("icon_size", pref.icon_size) - W.write("UI_mouseover_color", pref.UI_mouseover_color) - W.write("UI_mouseover_alpha", pref.UI_mouseover_alpha) - W.write("UI_style_color", pref.UI_style_color) - W.write("UI_style_highlight_color", pref.UI_style_highlight_color) - W.write("UI_style_alpha", pref.UI_style_alpha) - W.write("ooccolor", pref.ooccolor) - W.write("clientfps", pref.clientfps) + writer.write("icon_size", pref.icon_size) + writer.write("UI_mouseover_color", pref.UI_mouseover_color) + writer.write("UI_mouseover_alpha", pref.UI_mouseover_alpha) + writer.write("UI_style_color", pref.UI_style_color) + writer.write("UI_style_highlight_color", pref.UI_style_highlight_color) + writer.write("UI_style_alpha", pref.UI_style_alpha) + writer.write("ooccolor", pref.ooccolor) + writer.write("clientfps", pref.clientfps) /datum/category_item/player_setup_item/player_global/ui/sanitize_preferences() @@ -131,7 +134,7 @@ var/global/list/valid_icon_sizes = list(32, 48, 64, 96, 128) var/UI_style_highlight_color_new = input(user, "Choose UI highlight color, dark colors are not recommended!", "Global Preference", pref.UI_style_highlight_color) as color|null if(isnull(UI_style_highlight_color_new) || !CanUseTopic(user)) return TOPIC_NOACTION pref.UI_style_highlight_color = UI_style_highlight_color_new - return TOPIC_REFRESH + . = TOPIC_REFRESH else if(href_list["select_alpha"]) var/UI_style_alpha_new = input(user, "Select UI alpha (transparency) level, between 50 and 255.", "Global Preference", pref.UI_style_alpha) as num|null diff --git a/code/modules/client/preference_setup/global/02_prefixes.dm b/code/modules/client/preference_setup/global/02_prefixes.dm index 935feeda7f22..974dfbf03650 100644 --- a/code/modules/client/preference_setup/global/02_prefixes.dm +++ b/code/modules/client/preference_setup/global/02_prefixes.dm @@ -22,13 +22,13 @@ if(prefix_instance) pref.prefix_keys_by_type[prefix_instance.type] = prefix_keys_by_name[prefix_name] -/datum/category_item/player_setup_item/player_global/prefixes/save_preferences(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/player_global/prefixes/save_preferences(datum/pref_record_writer/writer) var/list/prefix_keys_by_name = list() for(var/prefix_type in pref.prefix_keys_by_type) var/decl/prefix/prefix_instance = GET_DECL(prefix_type) prefix_keys_by_name[prefix_instance.name] = pref.prefix_keys_by_type[prefix_type] - W.write("prefix_keys", prefix_keys_by_name) + writer.write("prefix_keys", prefix_keys_by_name) /datum/category_item/player_setup_item/player_global/prefixes/sanitize_preferences() if(!istype(pref.prefix_keys_by_type)) @@ -100,8 +100,8 @@ continue var/prefix_key = pref.prefix_keys_by_type[prefix_type] if(prefix_key == new_key) - var/decl/prefix/pi = GET_DECL(prefix_type) - pref.prefix_keys_by_type[pi.type] = pi.default_key + var/decl/prefix/prefix = GET_DECL(prefix_type) + pref.prefix_keys_by_type[prefix.type] = prefix.default_key // Then we reset any and all duplicates reset_duplicate_keys() // Then, if the new key was reset it means it matched a default key. diff --git a/code/modules/client/preference_setup/global/03_pai.dm b/code/modules/client/preference_setup/global/03_pai.dm index aeef174d4ffd..fe206bf11696 100644 --- a/code/modules/client/preference_setup/global/03_pai.dm +++ b/code/modules/client/preference_setup/global/03_pai.dm @@ -16,7 +16,7 @@ candidate.savefile_load(preference_mob()) update_pai_preview() -/datum/category_item/player_setup_item/player_global/pai/save_preferences(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/player_global/pai/save_preferences(datum/pref_record_writer/writer) if(!candidate) return diff --git a/code/modules/client/preference_setup/global/04_ooc.dm b/code/modules/client/preference_setup/global/04_ooc.dm index 923d75f458ee..17146b980818 100644 --- a/code/modules/client/preference_setup/global/04_ooc.dm +++ b/code/modules/client/preference_setup/global/04_ooc.dm @@ -10,8 +10,8 @@ pref.ignored_players = R.read("ignored_players") -/datum/category_item/player_setup_item/player_global/ooc/save_preferences(datum/pref_record_writer/W) - W.write("ignored_players", pref.ignored_players) +/datum/category_item/player_setup_item/player_global/ooc/save_preferences(datum/pref_record_writer/writer) + writer.write("ignored_players", pref.ignored_players) /datum/category_item/player_setup_item/player_global/ooc/sanitize_preferences() diff --git a/code/modules/client/preference_setup/global/05_settings.dm b/code/modules/client/preference_setup/global/05_settings.dm index 0548d22fc6e8..42ee3bdecdce 100644 --- a/code/modules/client/preference_setup/global/05_settings.dm +++ b/code/modules/client/preference_setup/global/05_settings.dm @@ -11,11 +11,11 @@ pref.slot_names = R.read("slot_names") pref.preference_values = R.read("preference_values") -/datum/category_item/player_setup_item/player_global/settings/save_preferences(datum/pref_record_writer/W) - W.write("lastchangelog", pref.lastchangelog) - W.write("default_slot", pref.default_slot) - W.write("slot_names", pref.slot_names) - W.write("preference_values", pref.preference_values) +/datum/category_item/player_setup_item/player_global/settings/save_preferences(datum/pref_record_writer/writer) + writer.write("lastchangelog", pref.lastchangelog) + writer.write("default_slot", pref.default_slot) + writer.write("slot_names", pref.slot_names) + writer.write("preference_values", pref.preference_values) /datum/category_item/player_setup_item/player_global/settings/sanitize_preferences() // Ensure our preferences are lists. diff --git a/code/modules/client/preference_setup/loadout/lists/accessories.dm b/code/modules/client/preference_setup/loadout/lists/accessories.dm index 739dc589b36c..b79e0f9f4710 100644 --- a/code/modules/client/preference_setup/loadout/lists/accessories.dm +++ b/code/modules/client/preference_setup/loadout/lists/accessories.dm @@ -85,7 +85,7 @@ /decl/loadout_option/accessory/bow/color name = "bowtie, color select" - path = /obj/item/clothing/neck/tie/bow/color + path = /obj/item/clothing/neck/tie/bow loadout_flags = GEAR_HAS_COLOR_SELECTION uid = "gear_accessory_bowtie_color" diff --git a/code/modules/client/preference_setup/loadout/lists/headwear.dm b/code/modules/client/preference_setup/loadout/lists/headwear.dm index 5c6dcf32ce3b..08184fa964cd 100644 --- a/code/modules/client/preference_setup/loadout/lists/headwear.dm +++ b/code/modules/client/preference_setup/loadout/lists/headwear.dm @@ -169,7 +169,15 @@ path = /obj/item/clothing/mask/balaclava uid = "gear_head_balaclava" +/decl/loadout_option/head/monitor_head + name = "monitor head (synthetics only)" + path = /obj/item/clothing/mask/monitor + loadout_flags = GEAR_HAS_TYPE_SELECTION + slot = slot_wear_mask_str + uid = "gear_utility_monitorhead" + /decl/loadout_option/head/nurse name = "nurse's hat" path = /obj/item/clothing/head/nursehat uid = "gear_head_nursehat" + diff --git a/code/modules/client/preference_setup/loadout/loadout.dm b/code/modules/client/preference_setup/loadout/loadout.dm index 1555f26fd222..17f52a97ce8a 100644 --- a/code/modules/client/preference_setup/loadout/loadout.dm +++ b/code/modules/client/preference_setup/loadout/loadout.dm @@ -21,9 +21,9 @@ pref.gear_list = R.read("gear_list") pref.gear_slot = R.read("gear_slot") -/datum/category_item/player_setup_item/loadout/save_character(datum/pref_record_writer/W) - W.write("gear_list", pref.gear_list) - W.write("gear_slot", pref.gear_slot) +/datum/category_item/player_setup_item/loadout/save_character(datum/pref_record_writer/writer) + writer.write("gear_list", pref.gear_list) + writer.write("gear_slot", pref.gear_slot) /datum/category_item/player_setup_item/loadout/proc/skill_check(var/list/jobs, var/list/skills_required) for(var/datum/job/J in jobs) @@ -38,8 +38,8 @@ /decl/loadout_option/proc/can_afford(var/mob/user, var/datum/preferences/pref) if(cost > 0 && (pref.total_loadout_cost + cost) > get_config_value(/decl/config/num/max_gear_cost)) return FALSE - var/decl/loadout_category/LC = GET_DECL(category) - if(!LC || pref.total_loadout_selections[category] >= LC.max_selections) + var/decl/loadout_category/loadout_cat = GET_DECL(category) + if(!loadout_cat || pref.total_loadout_selections[category] >= loadout_cat.max_selections) return FALSE return TRUE @@ -89,25 +89,25 @@ pref.total_loadout_cost = 0 pref.total_loadout_selections = list() - var/list/gears = pref.gear_list[index] - if(istype(gears)) - for(var/gear_id in gears) + var/list/loadout = pref.gear_list[index] + if(istype(loadout)) + for(var/gear_id in loadout) var/mob/user = preference_mob() - var/decl/loadout_option/LO = decls_repository.get_decl_by_id_or_var(gear_id, /decl/loadout_option) + var/decl/loadout_option/gear = decls_repository.get_decl_by_id_or_var(gear_id, /decl/loadout_option) - if(!istype(LO)) - gears -= gear_id + if(!istype(gear)) + loadout -= gear_id continue // Swap names for UIDs to grandfather in old saves. - if(LO.uid != gear_id) - gears[LO.uid] = gears[gear_id] - gears -= gear_id - gear_id = LO.uid - - if(LO && (GET_DECL(LO.category) in global.using_map.loadout_categories) && LO.can_be_taken_by(user, pref) && LO.can_afford(user, pref)) - pref.total_loadout_cost += LO.cost - pref.total_loadout_selections[LO.category] = (pref.total_loadout_selections[LO.category] + 1) + if(gear.uid != gear_id) + loadout[gear.uid] = loadout[gear_id] + loadout -= gear_id + gear_id = gear.uid + + if(gear && (GET_DECL(gear.category) in global.using_map.loadout_categories) && gear.can_be_taken_by(user, pref) && gear.can_afford(user, pref)) + pref.total_loadout_cost += gear.cost + pref.total_loadout_selections[gear.category] = (pref.total_loadout_selections[gear.category] + 1) else pref.gear_list[index] = list() @@ -116,12 +116,12 @@ pref.total_loadout_cost = 0 pref.total_loadout_selections = list() - var/list/gears = pref.gear_list[pref.gear_slot] - for(var/i = 1; i <= gears.len; i++) - var/decl/loadout_option/G = decls_repository.get_decl_by_id_or_var(gears[i], /decl/loadout_option) - if(G) - pref.total_loadout_cost += G.cost - pref.total_loadout_selections[G.category] = (pref.total_loadout_selections[G.category] + 1) + var/list/loadout = pref.gear_list[pref.gear_slot] + for(var/i = 1; i <= loadout.len; i++) + var/decl/loadout_option/gear = decls_repository.get_decl_by_id_or_var(loadout[i], /decl/loadout_option) + if(gear) + pref.total_loadout_cost += gear.cost + pref.total_loadout_selections[gear.category] = (pref.total_loadout_selections[gear.category] + 1) /datum/category_item/player_setup_item/loadout/content() . = list() @@ -145,7 +145,7 @@ var/firstcat = 1 current_tab = current_tab || global.using_map.loadout_categories[1].type var/decl/loadout_category/current_category_decl = GET_DECL(current_tab) - for(var/decl/loadout_category/LC as anything in global.using_map.loadout_categories) + for(var/decl/loadout_category/loadout_cat as anything in global.using_map.loadout_categories) if(firstcat) firstcat = FALSE @@ -153,21 +153,21 @@ . += " |" var/category_cost = 0 - for(var/gear in LC.gear) - var/decl/loadout_option/G = LC.gear[gear] - if(gear in pref.gear_list[pref.gear_slot]) - category_cost += G.cost + for(var/gear_id in loadout_cat.gear) + if(gear_id in pref.gear_list[pref.gear_slot]) + var/decl/loadout_option/gear = loadout_cat.gear[gear_id] + category_cost += gear.cost if(category == current_category_decl.type) - . += " [LC.name] - [category_cost] " + . += " [loadout_cat.name] - [category_cost] " else var/category_selections - if(LC.max_selections < INFINITY) - category_selections = " - [LC.max_selections - pref.total_loadout_selections[category]] remaining" + if(loadout_cat.max_selections < INFINITY) + category_selections = " - [loadout_cat.max_selections - pref.total_loadout_selections[category]] remaining" if(category_cost) - . += " [LC.name] - [category_cost][category_selections] " + . += " [loadout_cat.name] - [category_cost][category_selections] " else - . += " [LC.name] - 0[category_selections] " + . += " [loadout_cat.name] - 0[category_selections] " . += "
    " . += "
    " @@ -179,14 +179,14 @@ var/list/other_gear = list() var/i = 0 - for(var/gear in current_loadout) - var/decl/loadout_option/G = decls_repository.get_decl_by_id(gear, validate_decl_type = FALSE) - if(istype(G)) - if(G.slot) + for(var/gear_id in current_loadout) + var/decl/loadout_option/gear = decls_repository.get_decl_by_id(gear_id, validate_decl_type = FALSE) + if(istype(gear)) + if(gear.slot) i++ - . += "
    Layer [i]: [G.name]
    Layer underLayer overRemove" + . += "
    Layer [i]: [gear.name]
    Layer underLayer overRemove" else - other_gear += "
    [G.name]
    Remove" + other_gear += "
    [gear.name]
    Remove" if(length(other_gear)) . += "
    Other gear
    " @@ -207,24 +207,24 @@ var/mob/user = preference_mob() for(var/gear_id in current_category_decl.gear) - var/decl/loadout_option/G = current_category_decl.gear[gear_id] - if(!G.can_be_taken_by(user, pref)) + var/decl/loadout_option/gear = current_category_decl.gear[gear_id] + if(!gear.can_be_taken_by(user, pref)) continue - var/ticked = (G.uid in pref.gear_list[pref.gear_slot]) + var/ticked = (gear.uid in pref.gear_list[pref.gear_slot]) var/list/entry = list() - entry += "[G.name]" - entry += "[G.cost]" - entry += "[G.get_description(get_gear_metadata(G, TRUE))]" + entry += "[gear.name]" + entry += "[gear.cost]" + entry += "[gear.get_description(get_gear_metadata(gear, TRUE))]" var/allowed = 1 - if(allowed && G.allowed_roles) + if(allowed && gear.allowed_roles) var/good_job = 0 var/bad_job = 0 entry += "
    " var/list/jobchecks = list() for(var/datum/job/J in jobs) - if(J.type in G.allowed_roles) + if(J.type in gear.allowed_roles) jobchecks += "[J.title]" good_job = 1 else @@ -233,7 +233,7 @@ allowed = good_job || !bad_job entry += "[english_list(jobchecks)]" - if(allowed && G.allowed_branches) + if(allowed && gear.allowed_branches) var/list/branches = list() for(var/datum/job/J in jobs) if(pref.branches[J.title]) @@ -244,7 +244,7 @@ entry += "
    " for(var/branch in branches) var/datum/mil_branch/player_branch = mil_branches.get_branch(branch) - if(player_branch.type in G.allowed_branches) + if(player_branch.type in gear.allowed_branches) branch_checks += "[player_branch.name]" good_branch = 1 else @@ -253,24 +253,23 @@ entry += "[english_list(branch_checks)]" - if(allowed && G.allowed_skills) + if(allowed && gear.allowed_skills) var/list/skills_required = list()//make it into instances? instead of path - for(var/skill in G.allowed_skills) + for(var/skill in gear.allowed_skills) var/decl/skill/instance = GET_DECL(skill) - skills_required[instance] = G.allowed_skills[skill] + skills_required[instance] = gear.allowed_skills[skill] allowed = skill_check(jobs, skills_required)//Checks if a single job has all the skills required entry += "
    " var/list/skill_checks = list() - for(var/R in skills_required) - var/decl/skill/S = R + for(var/decl/skill/required_skill in skills_required) var/skill_entry - skill_entry += "[S.levels[skills_required[R]]]" + skill_entry += "[required_skill.levels[skills_required[required_skill]]]" if(allowed) - skill_entry = "[skill_entry] [R]" + skill_entry = "[skill_entry] [required_skill]" else - skill_entry = "[skill_entry] [R]" + skill_entry = "[skill_entry] [required_skill]" skill_checks += skill_entry entry += "[english_list(skill_checks)]" @@ -278,44 +277,44 @@ entry += "" if(ticked) entry += "" - for(var/datum/gear_tweak/tweak in G.gear_tweaks) - var/contents = tweak.get_contents(get_tweak_metadata(G, tweak)) + for(var/datum/gear_tweak/tweak in gear.gear_tweaks) + var/contents = tweak.get_contents(get_tweak_metadata(gear, tweak)) if(contents) - entry += " [contents]" + entry += " [contents]" entry += "" if(!hide_unavailable_gear || allowed || ticked) . += entry . += "" . = jointext(.,null) -/datum/category_item/player_setup_item/loadout/proc/get_gear_metadata(var/decl/loadout_option/G, var/readonly) - var/list/gear = pref.gear_list[pref.gear_slot] - . = gear[G.uid] +/datum/category_item/player_setup_item/loadout/proc/get_gear_metadata(var/decl/loadout_option/gear, var/readonly) + var/list/gears = pref.gear_list[pref.gear_slot] + . = gears[gear.uid] if(!.) . = list() if(!readonly) - gear[G.uid] = . + gears[gear.uid] = . -/datum/category_item/player_setup_item/loadout/proc/get_tweak_metadata(var/decl/loadout_option/G, var/datum/gear_tweak/tweak) - var/list/metadata = get_gear_metadata(G) +/datum/category_item/player_setup_item/loadout/proc/get_tweak_metadata(var/decl/loadout_option/gear, var/datum/gear_tweak/tweak) + var/list/metadata = get_gear_metadata(gear) . = metadata["[tweak]"] if(!.) . = tweak.get_default() metadata["[tweak]"] = . -/datum/category_item/player_setup_item/loadout/proc/set_tweak_metadata(var/decl/loadout_option/G, var/datum/gear_tweak/tweak, var/new_metadata) - var/list/metadata = get_gear_metadata(G) +/datum/category_item/player_setup_item/loadout/proc/set_tweak_metadata(var/decl/loadout_option/gear, var/datum/gear_tweak/tweak, var/new_metadata) + var/list/metadata = get_gear_metadata(gear) metadata["[tweak]"] = new_metadata /datum/category_item/player_setup_item/loadout/OnTopic(href, href_list, user) if(href_list["toggle_gear"]) - var/decl/loadout_option/TG = locate(href_list["toggle_gear"]) - if(!istype(TG)) + var/decl/loadout_option/gear_to_toggle = locate(href_list["toggle_gear"]) + if(!istype(gear_to_toggle)) return TOPIC_REFRESH - if(TG.uid in pref.gear_list[pref.gear_slot]) - pref.gear_list[pref.gear_slot] -= TG.uid - else if(TG.can_afford(preference_mob(), pref)) - pref.gear_list[pref.gear_slot] += TG.uid + if(gear_to_toggle.uid in pref.gear_list[pref.gear_slot]) + pref.gear_list[pref.gear_slot] -= gear_to_toggle.uid + else if(gear_to_toggle.can_afford(preference_mob(), pref)) + pref.gear_list[pref.gear_slot] += gear_to_toggle.uid return TOPIC_REFRESH_UPDATE_PREVIEW if(href_list["gear"]) @@ -367,15 +366,15 @@ recalculate_loadout_cost() return TOPIC_REFRESH_UPDATE_PREVIEW if(href_list["select_category"]) - var/decl/loadout_category/LC = locate(href_list["select_category"]) - if(istype(LC) && (LC in global.using_map.loadout_categories)) - current_tab = LC.type + var/decl/loadout_category/loadout_cat = locate(href_list["select_category"]) + if(istype(loadout_cat) && (loadout_cat in global.using_map.loadout_categories)) + current_tab = loadout_cat.type else current_tab = global.using_map.loadout_categories[1].type return TOPIC_REFRESH if(href_list["clear_loadout"]) - var/list/gear = pref.gear_list[pref.gear_slot] - gear.Cut() + var/list/current_gear = pref.gear_list[pref.gear_slot] + current_gear.Cut() return TOPIC_REFRESH_UPDATE_PREVIEW if(href_list["toggle_hiding"]) hide_unavailable_gear = !hide_unavailable_gear @@ -436,9 +435,9 @@ . = ..() if(!global.using_map.loadout_blacklist || !(type in global.using_map.loadout_blacklist)) - var/decl/loadout_category/LC = GET_DECL(category) - ADD_SORTED(LC.gear, uid, /proc/cmp_text_asc) - LC.gear[uid] = src + var/decl/loadout_category/loadout_cat = GET_DECL(category) + ADD_SORTED(loadout_cat.gear, uid, /proc/cmp_text_asc) + loadout_cat.gear[uid] = src if(FLAGS_EQUALS(loadout_flags, GEAR_HAS_TYPE_SELECTION|GEAR_HAS_SUBTYPE_SELECTION)) CRASH("May not have both type and subtype selection tweaks") @@ -537,22 +536,23 @@ item.loadout_setup(wearer, metadata) var/obj/item/old_item = wearer.get_equipped_item(slot) - var/attached_as_accessory = FALSE if(istype(old_item, /obj/item/clothing) && istype(item, /obj/item/clothing)) var/obj/item/clothing/worn = old_item if(worn.can_attach_accessory(item, wearer)) worn.attach_accessory(wearer, item) - attached_as_accessory = TRUE return TRUE - if(!attached_as_accessory && wearer.equip_to_slot_if_possible(item, slot, del_on_fail = TRUE, force = TRUE, delete_old_item = FALSE, ignore_equipped = replace_equipped)) + var/resolution_strategy = old_item?.loadout_should_keep(item, wearer) + if(resolution_strategy == LOADOUT_CONFLICT_KEEP) + place_in_storage_or_drop(wearer, item) + else if(wearer.equip_to_slot_if_possible(item, slot, del_on_fail = TRUE, force = TRUE, delete_old_item = FALSE, ignore_equipped = replace_equipped)) if(old_item && wearer.get_equipped_item(slot) != old_item) item.handle_loadout_equip_replacement(old_item) - if(old_item.loadout_should_keep(item, wearer)) + if(resolution_strategy == LOADOUT_CONFLICT_STORAGE) place_in_storage_or_drop(wearer, old_item) else qdel(old_item) - return item + return item /decl/loadout_option/proc/spawn_in_storage_or_drop(mob/living/human/wearer, metadata) var/obj/item/item = spawn_and_validate_item(wearer, metadata) @@ -572,9 +572,6 @@ else to_chat(wearer, SPAN_DANGER("Dropping \the [item] on the ground!")) -/decl/loadout_option/proc/can_replace_existing(obj/item/candidate) - return istype(candidate, path) - /decl/loadout_option/proc/spawn_and_validate_item(mob/living/human/H, metadata) PRIVATE_PROC(TRUE) diff --git a/code/modules/client/preference_setup/occupation/occupation.dm b/code/modules/client/preference_setup/occupation/occupation.dm index d4a99e6b0252..3d1b29c1a54f 100644 --- a/code/modules/client/preference_setup/occupation/occupation.dm +++ b/code/modules/client/preference_setup/occupation/occupation.dm @@ -34,17 +34,17 @@ pref.hiding_maps = R.read("hiding_maps") load_skills() -/datum/category_item/player_setup_item/occupation/save_character(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/occupation/save_character(datum/pref_record_writer/writer) save_skills() - W.write("alternate_option", pref.alternate_option) - W.write("job_high", pref.job_high) - W.write("job_medium", pref.job_medium) - W.write("job_low", pref.job_low) - W.write("player_alt_titles", pref.player_alt_titles) - W.write("skills_saved", pref.skills_saved) - W.write("branches", pref.branches) - W.write("ranks", pref.ranks) - W.write("hiding_maps", pref.hiding_maps) + writer.write("alternate_option", pref.alternate_option) + writer.write("job_high", pref.job_high) + writer.write("job_medium", pref.job_medium) + writer.write("job_low", pref.job_low) + writer.write("player_alt_titles", pref.player_alt_titles) + writer.write("skills_saved", pref.skills_saved) + writer.write("branches", pref.branches) + writer.write("ranks", pref.ranks) + writer.write("hiding_maps", pref.hiding_maps) /datum/category_item/player_setup_item/occupation/sanitize_character() if(!istype(pref.job_medium)) pref.job_medium = list() @@ -150,7 +150,7 @@ var/help_link = "?" lastJob = job - var/species_name = S.get_root_species_name() + var/species_uid = S.uid var/bad_message = "" if(job.total_positions == 0 && job.spawn_positions == 0) bad_message = "\[UNAVAILABLE]" @@ -159,8 +159,8 @@ else if(!job.player_old_enough(user.client)) var/available_in_days = job.available_in_days(user.client) bad_message = "\[IN [(available_in_days)] DAYS]" - else if(LAZYACCESS(job.minimum_character_age, species_name) && user.client && (user.client.prefs.get_character_age() < job.minimum_character_age[species_name])) - bad_message = "\[MIN CHAR AGE: [job.minimum_character_age[species_name]]]" + else if(LAZYACCESS(job.minimum_character_age, species_uid) && user.client && (user.client.prefs.get_character_age() < job.minimum_character_age[species_uid])) + bad_message = "\[MIN CHAR AGE: [job.minimum_character_age[species_uid]]]" else if(!job.is_species_allowed(S)) bad_message = "\[SPECIES RESTRICTED]" else if(!S.check_background(job, user.client.prefs)) diff --git a/code/modules/client/preference_setup/occupation/skill_selection.dm b/code/modules/client/preference_setup/occupation/skill_selection.dm index 0399006bab6c..ec4b0ba348db 100644 --- a/code/modules/client/preference_setup/occupation/skill_selection.dm +++ b/code/modules/client/preference_setup/occupation/skill_selection.dm @@ -87,7 +87,7 @@ //Sets up skills_allocated /datum/preferences/proc/sanitize_skills(var/list/input) . = list() - var/decl/species/S = get_species_by_key(species) + var/decl/species/S = get_species_decl() for(var/job_name in SSjobs.titles_to_datums) var/datum/job/job = SSjobs.get_by_title(job_name) var/input_skills = list() diff --git a/code/modules/client/preference_setup/preference_setup.dm b/code/modules/client/preference_setup/preference_setup.dm index 06bdf434ba50..f6621d517a73 100644 --- a/code/modules/client/preference_setup/preference_setup.dm +++ b/code/modules/client/preference_setup/preference_setup.dm @@ -1,5 +1,8 @@ var/global/const/CHARACTER_PREFERENCE_INPUT_TITLE = "Character Preference" +/datum/category_group/player_setup_category + abstract_type = /datum/category_group/player_setup_category + /datum/category_group/player_setup_category/background_preferences name = "Background" sort_order = 1 // must go first because species @@ -79,17 +82,30 @@ var/global/const/CHARACTER_PREFERENCE_INPUT_TITLE = "Character Preference" for(var/datum/category_group/player_setup_category/PS in categories) PS.load_character(R) -/datum/category_collection/player_setup_collection/proc/save_character(datum/pref_record_writer/W) +/datum/category_collection/player_setup_collection/proc/save_character(datum/pref_record_writer/writer) for(var/datum/category_group/player_setup_category/PS in categories) - PS.save_character(W) + PS.save_character(writer) /datum/category_collection/player_setup_collection/proc/load_preferences(datum/pref_record_reader/R) for(var/datum/category_group/player_setup_category/PS in categories) PS.load_preferences(R) -/datum/category_collection/player_setup_collection/proc/save_preferences(datum/pref_record_writer/W) +/datum/category_collection/player_setup_collection/proc/save_preferences(datum/pref_record_writer/writer) + for(var/datum/category_group/player_setup_category/PS in categories) + PS.save_preferences(writer) + +/datum/category_collection/player_setup_collection/proc/apply_snapshot_to_mob(mob/living/human/character, is_preview_copy = FALSE) + // Assumes a character has already been loaded. + for(var/datum/category_group/player_setup_category/PS in categories) + PS.apply_snapshot_to_mob(character, is_preview_copy) + +/datum/category_collection/player_setup_collection/proc/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) for(var/datum/category_group/player_setup_category/PS in categories) - PS.save_preferences(W) + PS.apply_post_snapshot_preferences(character, is_preview_copy) + +/datum/category_collection/player_setup_collection/proc/populate_mob_snapshot(datum/mob_snapshot/snapshot, is_preview_copy = FALSE) + for(var/datum/category_group/player_setup_category/PG in categories) + PG.populate_mob_snapshot(snapshot, is_preview_copy) /datum/category_collection/player_setup_collection/proc/header() var/dat = "" @@ -143,24 +159,37 @@ var/global/const/CHARACTER_PREFERENCE_INPUT_TITLE = "Character Preference" for(var/datum/category_item/player_setup_item/PI in items) PI.finalize_character() -/datum/category_group/player_setup_category/proc/save_character(datum/pref_record_writer/W) +/datum/category_group/player_setup_category/proc/save_character(datum/pref_record_writer/writer) // Sanitize all data, then save it for(var/datum/category_item/player_setup_item/PI in items) PI.sanitize_character() for(var/datum/category_item/player_setup_item/PI in items) PI.finalize_character() for(var/datum/category_item/player_setup_item/PI in items) - PI.save_character(W) + PI.save_character(writer) /datum/category_group/player_setup_category/proc/load_preferences(datum/pref_record_reader/R) for(var/datum/category_item/player_setup_item/PI in items) PI.load_preferences(R) -/datum/category_group/player_setup_category/proc/save_preferences(datum/pref_record_writer/W) +/datum/category_group/player_setup_category/proc/save_preferences(datum/pref_record_writer/writer) for(var/datum/category_item/player_setup_item/PI in items) PI.sanitize_preferences() for(var/datum/category_item/player_setup_item/PI in items) - PI.save_preferences(W) + PI.save_preferences(writer) + +/datum/category_group/player_setup_category/proc/apply_snapshot_to_mob(mob/living/human/character, is_preview_copy = FALSE) + // Assumes a character has already been loaded. + for(var/datum/category_item/player_setup_item/PI in items) + PI.apply_snapshot_to_mob(character, is_preview_copy) + +/datum/category_group/player_setup_category/proc/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + for(var/datum/category_item/player_setup_item/PI in items) + PI.apply_post_snapshot_preferences(character, is_preview_copy) + +/datum/category_group/player_setup_category/proc/populate_mob_snapshot(datum/mob_snapshot/snapshot, is_preview_copy = FALSE) + for(var/datum/category_item/player_setup_item/PI in items) + PI.populate_mob_snapshot(snapshot, is_preview_copy) /datum/category_group/player_setup_category/proc/content(var/mob/user) . = "" + . = "" else . = "" @@ -157,6 +157,6 @@ RemoveValue(value) . = TRUE if(.) - var/mob/user = locate(href_list["caller"]) + var/mob/user = locate(href_list["user"]) if(user) SSpersistence.show_info(user) diff --git a/code/modules/persistence/persistence_datum_book.dm b/code/modules/persistence/persistence_datum_book.dm index cf33c5df07d4..839f0ed29a63 100644 --- a/code/modules/persistence/persistence_datum_book.dm +++ b/code/modules/persistence/persistence_datum_book.dm @@ -78,6 +78,6 @@ /decl/persistence_handler/book/GetAdminDataStringFor(var/thing, var/can_modify, var/mob/user) var/obj/item/book/book = thing if(can_modify) - . = "" + . = "" else . = "" diff --git a/code/modules/persistence/persistence_datum_graffiti.dm b/code/modules/persistence/persistence_datum_graffiti.dm index 83861418d67e..0bc733ab2f07 100644 --- a/code/modules/persistence/persistence_datum_graffiti.dm +++ b/code/modules/persistence/persistence_datum_graffiti.dm @@ -10,7 +10,7 @@ /decl/persistence_handler/graffiti/CheckTurfContents(var/turf/T, var/list/tokens) var/too_much_graffiti = 0 - for(var/obj/effect/decal/writing/W in .) + for(var/obj/effect/decal/writing/writing in .) too_much_graffiti++ if(too_much_graffiti >= 5) return FALSE @@ -38,6 +38,6 @@ /decl/persistence_handler/graffiti/GetAdminDataStringFor(var/thing, var/can_modify, var/mob/user) var/obj/effect/decal/writing/save_graffiti = thing if(can_modify) - . = "" + . = "" else . = "" diff --git a/code/modules/persistence/persistence_datum_paper.dm b/code/modules/persistence/persistence_datum_paper.dm index 4615ebe28e55..94749f01deda 100644 --- a/code/modules/persistence/persistence_datum_paper.dm +++ b/code/modules/persistence/persistence_datum_paper.dm @@ -14,7 +14,7 @@ var/obj/structure/noticeboard/board = locate() in creating if(!board) var/decl/material/mat = decls_repository.get_decl_by_id_or_var(tokens["noticeboard_material"], /decl/material, "name") - board = new(creating, (mat?.type || /decl/material/solid/organic/wood)) + board = new(creating, (mat?.type || /decl/material/solid/organic/wood/oak)) if("noticeboard_direction" in tokens) board.set_dir(tokens["noticeboard_direction"]) if(LAZYLEN(board.notices) < board.max_notices) @@ -41,7 +41,7 @@ /decl/persistence_handler/paper/GetAdminDataStringFor(var/thing, var/can_modify, var/mob/user) var/obj/item/paper/paper = thing if(can_modify) - . = "" + . = "" else . = "" diff --git a/code/modules/pointdefense/pointdefense.dm b/code/modules/pointdefense/pointdefense.dm index dfec4c84562a..ce55afe2f299 100644 --- a/code/modules/pointdefense/pointdefense.dm +++ b/code/modules/pointdefense/pointdefense.dm @@ -85,8 +85,8 @@ data["turrets"] = turrets return data -/obj/machinery/pointdefense_control/attackby(var/obj/item/thing, var/mob/user) - if(IS_MULTITOOL(thing)) +/obj/machinery/pointdefense_control/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/pointdefense = get_extension(src, /datum/extension/local_network_member) pointdefense.get_new_tag(user) //Check if there is more than 1 controller @@ -137,8 +137,8 @@ new_dir = SOUTH . = ..() -/obj/machinery/pointdefense/attackby(var/obj/item/thing, var/mob/user) - if(IS_MULTITOOL(thing)) +/obj/machinery/pointdefense/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/pointdefense = get_extension(src, /datum/extension/local_network_member) pointdefense.get_new_tag(user) return TRUE diff --git a/code/modules/posters/_poster.dm b/code/modules/posters/_poster.dm index d874171cc744..93b1dbe141bc 100644 --- a/code/modules/posters/_poster.dm +++ b/code/modules/posters/_poster.dm @@ -46,9 +46,9 @@ //If we weren't ruined, mark us as ruined, so next time we get destroyed set_ruined(TRUE) -/obj/structure/sign/poster/attackby(obj/item/W, mob/user) +/obj/structure/sign/poster/attackby(obj/item/used_item, mob/user) //Prevent the sign implementation from removing us from the wall via unscrewing us - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) return FALSE //#FIXME: once /obj/structure/sign use the generic structure tools procs we won't need to intercept this here anymore. return ..() @@ -129,16 +129,14 @@ icon_state = "rolled_poster" _base_attack_force = 0 material = /decl/material/solid/organic/paper - ///The description for the item/medium without any reference to the design. - var/base_desc = "The poster comes with its own automatic adhesive mechanism, for easy pinning to any vertical surface." + ///Type path to the /decl for the design on this poster. At runtime is changed for a reference to the decl var/decl/poster_design/poster_design /obj/item/poster/Initialize(ml, material_key, var/given_poster_type = null) //Init design - base_name ||= name + . = ..(ml, material_key) set_design(given_poster_type || poster_design || pick(decls_repository.get_decl_paths_of_subtype(/decl/poster_design))) - return ..(ml, material_key) /obj/item/poster/proc/set_design(var/decl/poster_design/_design_path) if(ispath(_design_path, /decl)) @@ -158,44 +156,44 @@ return //must place on a wall and user must not be inside a closet/exosuit/whatever - var/turf/W = get_turf(A) - if(!istype(W) || !W.is_wall() || !isturf(user.loc)) + var/turf/used_item = get_turf(A) + if(!istype(used_item) || !used_item.is_wall() || !isturf(user.loc)) to_chat(user, SPAN_WARNING("You can't place this here!")) return - var/placement_dir = get_dir(user, W) + var/placement_dir = get_dir(user, used_item) if (!(placement_dir in global.cardinal)) to_chat(user, SPAN_WARNING("You must stand directly in front of the wall you wish to place that on.")) return - if (ArePostersOnWall(W)) + if (ArePostersOnWall(used_item)) to_chat(user, SPAN_WARNING("There is already a poster there!")) return user.visible_message( - SPAN_NOTICE("\The [user] starts placing a poster on \the [W]."), - SPAN_NOTICE("You start placing the poster on \the [W].")) + SPAN_NOTICE("\The [user] starts placing a poster on \the [used_item]."), + SPAN_NOTICE("You start placing the poster on \the [used_item].")) var/obj/structure/sign/poster/P = new (user.loc, null, null, placement_dir, poster_design) qdel(src) flick("poster_being_set", P) // Time to place is equal to the time needed to play the flick animation - if(do_after(user, 28, W) && W.is_wall() && !ArePostersOnWall(W, P)) + if(do_after(user, 28, used_item) && used_item.is_wall() && !ArePostersOnWall(used_item, P)) user.visible_message( - SPAN_NOTICE("\The [user] has placed a poster on \the [W]."), - SPAN_NOTICE("You have placed the poster on \the [W].")) + SPAN_NOTICE("\The [user] has placed a poster on \the [used_item]."), + SPAN_NOTICE("You have placed the poster on \the [used_item].")) else // We cannot rely on user being on the appropriate turf when placement fails P.dismantle_structure(user) -/obj/item/poster/proc/ArePostersOnWall(var/turf/W, var/placed_poster) +/obj/item/poster/proc/ArePostersOnWall(var/turf/used_item, var/placed_poster) //just check if there is a poster on or adjacent to the wall - if (locate(/obj/structure/sign/poster) in W) + if (locate(/obj/structure/sign/poster) in used_item) return TRUE //crude, but will cover most cases. We could do stuff like check pixel_x/y but it's not really worth it. for (var/dir in global.cardinal) - var/turf/T = get_step(W, dir) + var/turf/T = get_step(used_item, dir) var/poster = locate(/obj/structure/sign/poster) in T if (poster && placed_poster != poster) return TRUE diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 52776be8e59f..0df866c15b71 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -438,8 +438,8 @@ var/global/list/all_apcs = list() panel_open = TRUE queue_icon_update() -/obj/machinery/power/apc/attackby(obj/item/W, mob/user) - if (istype(construct_state, /decl/machine_construction/wall_frame/panel_closed/hackable/hacking) && (IS_MULTITOOL(W) || IS_WIRECUTTER(W) || istype(W, /obj/item/assembly/signaler))) +/obj/machinery/power/apc/attackby(obj/item/used_item, mob/user) + if (istype(construct_state, /decl/machine_construction/wall_frame/panel_closed/hackable/hacking) && (IS_MULTITOOL(used_item) || IS_WIRECUTTER(used_item) || istype(used_item, /obj/item/assembly/signaler))) wires.Interact(user) return TRUE return ..() diff --git a/code/modules/power/batteryrack.dm b/code/modules/power/batteryrack.dm index 27524a6eb2c4..144d6f5b2703 100644 --- a/code/modules/power/batteryrack.dm +++ b/code/modules/power/batteryrack.dm @@ -37,8 +37,8 @@ ..() /obj/machinery/power/smes/batteryrack/Destroy() - for(var/obj/item/cell/C in internal_cells) - qdel(C) + for(var/obj/item/cell/cell in internal_cells) + qdel(cell) internal_cells = null return ..() @@ -52,19 +52,19 @@ overlays += "charge[charge_level]" - for(var/obj/item/cell/C in internal_cells) + for(var/obj/item/cell/cell in internal_cells) cellcount++ overlays += "cell[cellcount]" - if(C.fully_charged()) + if(cell.fully_charged()) overlays += "cell[cellcount]f" - else if(!C.charge) + else if(!cell.charge) overlays += "cell[cellcount]e" // Recalculate maxcharge and similar variables. /obj/machinery/power/smes/batteryrack/proc/update_maxcharge() var/newmaxcharge = 0 - for(var/obj/item/cell/C in internal_cells) - newmaxcharge += C.maxcharge + for(var/obj/item/cell/cell in internal_cells) + newmaxcharge += cell.maxcharge capacity = newmaxcharge charge = clamp(charge, 0, newmaxcharge) @@ -99,8 +99,8 @@ if(!amount) return // We're still here, so it means the least charged cell was full OR we don't care about equalising the charge. Give power to other cells instead. - for(var/obj/item/cell/C in internal_cells) - amount -= C.give(amount) + for(var/obj/item/cell/cell in internal_cells) + amount -= cell.give(amount) // No more power to input so return. if(!amount) return @@ -115,8 +115,8 @@ if(!amount) return // We're still here, so it means the most charged cell didn't have enough power OR we don't care about equalising the charge. Use power from other cells instead. - for(var/obj/item/cell/C in internal_cells) - amount -= C.use(amount) + for(var/obj/item/cell/cell in internal_cells) + amount -= cell.use(amount) // No more power to output so return. if(!amount) return @@ -124,31 +124,31 @@ // Helper procs to get most/least charged cells. /obj/machinery/power/smes/batteryrack/proc/get_most_charged_cell() var/obj/item/cell/CL = null - for(var/obj/item/cell/C in internal_cells) + for(var/obj/item/cell/cell in internal_cells) if(CL == null) - CL = C - else if(CL.percent() < C.percent()) - CL = C + CL = cell + else if(CL.percent() < cell.percent()) + CL = cell return CL /obj/machinery/power/smes/batteryrack/proc/get_least_charged_cell() var/obj/item/cell/CL = null - for(var/obj/item/cell/C in internal_cells) + for(var/obj/item/cell/cell in internal_cells) if(CL == null) - CL = C - else if(CL.percent() > C.percent()) - CL = C + CL = cell + else if(CL.percent() > cell.percent()) + CL = cell return CL -/obj/machinery/power/smes/batteryrack/proc/insert_cell(var/obj/item/cell/C, var/mob/user) - if(!istype(C)) +/obj/machinery/power/smes/batteryrack/proc/insert_cell(var/obj/item/cell/cell, var/mob/user) + if(!istype(cell)) return 0 if(internal_cells.len >= max_cells) return 0 - if(user && !user.try_unequip(C)) + if(user && !user.try_unequip(cell)) return 0 - internal_cells.Add(C) - C.forceMove(src) + internal_cells.Add(cell) + cell.forceMove(src) RefreshParts() update_maxcharge() update_icon() @@ -157,8 +157,8 @@ /obj/machinery/power/smes/batteryrack/Process() charge = 0 - for(var/obj/item/cell/C in internal_cells) - charge += C.charge + for(var/obj/item/cell/cell in internal_cells) + charge += cell.charge ..() ui_tick = !ui_tick @@ -200,19 +200,19 @@ data["cells_cur"] = internal_cells.len var/list/cells = list() var/cell_index = 1 - for(var/obj/item/cell/C in internal_cells) - var/list/cell[0] - cell["slot"] = cell_index - cell["used"] = 1 - cell["percentage"] = round(C.percent(), 0.01) + for(var/obj/item/cell/cell in internal_cells) + var/list/cell_data = list() + cell_data["slot"] = cell_index + cell_data["used"] = 1 + cell_data["percentage"] = round(cell.percent(), 0.01) cell_index++ - cells += list(cell) + cells += list(cell_data) while(cell_index <= PSU_MAXCELLS) - var/list/cell[0] - cell["slot"] = cell_index - cell["used"] = 0 + var/list/cell_data = list() + cell_data["slot"] = cell_index + cell_data["used"] = 0 cell_index++ - cells += list(cell) + cells += list(cell_data) data["cells_list"] = cells ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) @@ -223,20 +223,20 @@ ui.set_auto_update(1) /obj/machinery/power/smes/batteryrack/dismantle() - for(var/obj/item/cell/C in internal_cells) - C.dropInto(loc) - internal_cells -= C + for(var/obj/item/cell/cell in internal_cells) + cell.dropInto(loc) + internal_cells -= cell return ..() -/obj/machinery/power/smes/batteryrack/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/power/smes/batteryrack/attackby(var/obj/item/used_item, var/mob/user) . = ..() if(.) return - if(istype(W, /obj/item/cell)) // ID Card, try to insert it. - if(insert_cell(W, user)) - to_chat(user, "You insert \the [W] into \the [src].") + if(istype(used_item, /obj/item/cell)) // ID Card, try to insert it. + if(insert_cell(used_item, user)) + to_chat(user, "You insert \the [used_item] into \the [src].") else - to_chat(user, "\The [src] has no empty slot for \the [W].") + to_chat(user, "\The [src] has no empty slot for \the [used_item].") return TRUE /obj/machinery/power/smes/batteryrack/interface_interact(var/mob/user) @@ -273,10 +273,10 @@ var/slot_number = text2num(href_list["ejectcell"]) if(slot_number != clamp(round(slot_number), 1, length(internal_cells))) return TOPIC_HANDLED - var/obj/item/cell/C = internal_cells[slot_number] + var/obj/item/cell/cell = internal_cells[slot_number] - C.dropInto(loc) - internal_cells -= C + cell.dropInto(loc) + internal_cells -= cell RefreshParts() update_maxcharge() return TOPIC_REFRESH \ No newline at end of file diff --git a/code/modules/power/breaker_box.dm b/code/modules/power/breaker_box.dm index 38477765ac00..9674fb2e47e8 100644 --- a/code/modules/power/breaker_box.dm +++ b/code/modules/power/breaker_box.dm @@ -85,8 +85,8 @@ busy = 0 return TRUE -/obj/machinery/power/breakerbox/attackby(var/obj/item/W, var/mob/user) - if(IS_MULTITOOL(W)) +/obj/machinery/power/breakerbox/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/newtag = input(user, "Enter new RCON tag. Use \"NO_TAG\" to disable RCON or leave empty to cancel.", "SMES RCON system") as text if(!CanPhysicallyInteract(user)) return TRUE diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index f00722b2d3c9..56ef6ac56bf9 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -22,6 +22,8 @@ If d1 = dir1 and d2 = dir2, it's a full X-X cable, getting from dir1 to dir2 By design, d1 is the smallest direction and d2 is the highest */ +/// Tracks all cable instances, so that powernets don't have to look through the entire world all the time +var/global/list/obj/structure/cable/all_cables = list() /obj/structure/cable name = "power cable" desc = "A flexible superconducting cable for heavy-duty power transfer." @@ -100,12 +102,12 @@ By design, d1 is the smallest direction and d2 is the highest var/turf/T = src.loc // hide if turf is not intact if(level == LEVEL_BELOW_PLATING && T) hide(!T.is_plating()) - global.cable_list += src //add it to the global cable list + global.all_cables += src //add it to the global cable list /obj/structure/cable/Destroy() // called when a cable is deleted if(powernet) cut_cable_from_powernet() // update the powernets - global.cable_list -= src // remove it from global cable list + global.all_cables -= src // remove it from global cable list . = ..() // then go ahead and delete the cable // Ghost examining the cable -> tells him the power @@ -899,8 +901,8 @@ By design, d1 is the smallest direction and d2 is the highest var/obj/item/rig_module/module = loc return module.get_cell() if(isrobot(loc)) - var/mob/living/silicon/robot/R = loc - return R.get_cell() + var/mob/living/silicon/robot/robot = loc + return robot.get_cell() /obj/item/stack/cable_coil/fabricator/use(var/used) var/obj/item/cell/cell = get_cell() diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 8af653291679..dc9234516221 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -88,8 +88,8 @@ // remove this if EMPs are ever rebalanced so that they don't instantly drain borg cells // todo: containers (partially) shielding contents? if(isrobot(loc)) - var/mob/living/silicon/robot/R = loc - severity *= R.cell_emp_mult + var/mob/living/silicon/robot/robot = loc + severity *= robot.cell_emp_mult // Lose 1/2, 1/4, 1/6 of the current charge per hit or 1/4, 1/8, 1/12 of the max charge per hit, whichever is highest charge -= max(charge / (2 * severity), maxcharge/(4 * severity)) diff --git a/code/modules/power/fission/core.dm b/code/modules/power/fission/core.dm index d8a6abb38b29..06ca2a1f6740 100644 --- a/code/modules/power/fission/core.dm +++ b/code/modules/power/fission/core.dm @@ -198,8 +198,8 @@ /obj/machinery/atmospherics/unary/fission_core/proc/check_active() return neutron_flux >= ACTIVE_THRESHOLD -/obj/machinery/atmospherics/unary/fission_core/attackby(var/obj/item/W, var/mob/user) - if(IS_MULTITOOL(W)) +/obj/machinery/atmospherics/unary/fission_core/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/fission = get_extension(src, /datum/extension/local_network_member) fission.get_new_tag(user) return TRUE @@ -209,14 +209,14 @@ to_chat(user, SPAN_WARNING("You cannot do that while \the [src] is active!")) return TRUE - if(istype(W, /obj/item/fuel_assembly)) + if(istype(used_item, /obj/item/fuel_assembly)) if(length(fuel_rods) >= MAX_RODS) to_chat(user, SPAN_WARNING("\The [src] is full!")) return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - fuel_rods[W] = FALSE // Rod is not exposed to begin with. - user.visible_message(SPAN_NOTICE("\The [user] inserts \a [W] into \the [src]."), SPAN_NOTICE("You insert \a [W] into \the [src].")) + fuel_rods[used_item] = FALSE // Rod is not exposed to begin with. + user.visible_message(SPAN_NOTICE("\The [user] inserts \a [used_item] into \the [src]."), SPAN_NOTICE("You insert \a [used_item] into \the [src].")) return TRUE . = ..() diff --git a/code/modules/power/fission/core_control.dm b/code/modules/power/fission/core_control.dm index 8432ef6463be..2b56f3d892ab 100644 --- a/code/modules/power/fission/core_control.dm +++ b/code/modules/power/fission/core_control.dm @@ -18,8 +18,8 @@ var/datum/extension/local_network_member/fission = get_extension(src, /datum/extension/local_network_member) fission.set_tag(null, initial_id_tag) -/obj/machinery/computer/fission/attackby(var/obj/item/W, var/mob/user) - if(IS_MULTITOOL(W)) +/obj/machinery/computer/fission/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/fission = get_extension(src, /datum/extension/local_network_member) fission.get_new_tag(user) return TRUE diff --git a/code/modules/power/floorlamp.dm b/code/modules/power/floorlamp.dm index 62d4208e5905..067ee2b484be 100644 --- a/code/modules/power/floorlamp.dm +++ b/code/modules/power/floorlamp.dm @@ -18,15 +18,15 @@ base_state = "flamp" . = ..() -/obj/machinery/light/flamp/attackby(obj/item/held_item, mob/user) +/obj/machinery/light/flamp/attackby(obj/item/used_item, mob/user) if(!lampshade) - if(istype(held_item, /obj/item/lampshade)) - lampshade = held_item - user.drop_from_inventory(held_item, src) + if(istype(used_item, /obj/item/lampshade)) + lampshade = used_item + user.drop_from_inventory(used_item, src) update_light_status(FALSE) update_icon() return TRUE - else if(held_item.do_tool_interaction(TOOL_SCREWDRIVER, user, src, 1 SECOND, "unscrewing", "unscrewing")) + else if(used_item.do_tool_interaction(TOOL_SCREWDRIVER, user, src, 1 SECOND, "unscrewing", "unscrewing")) lampshade.dropInto(loc) lampshade = null update_light_status(FALSE) diff --git a/code/modules/power/fuel_assembly/fuel_compressor.dm b/code/modules/power/fuel_assembly/fuel_compressor.dm index 0488d360f935..d07651603a4a 100644 --- a/code/modules/power/fuel_assembly/fuel_compressor.dm +++ b/code/modules/power/fuel_assembly/fuel_compressor.dm @@ -116,15 +116,15 @@ return return !add_material(dropping, user) -/obj/machinery/fuel_compressor/attackby(var/obj/item/thing, var/mob/user) - return add_material(thing, user) || ..() +/obj/machinery/fuel_compressor/attackby(var/obj/item/used_item, var/mob/user) + return add_material(used_item, user) || ..() /obj/machinery/fuel_compressor/proc/add_material(var/obj/item/thing, var/mob/user) if(istype(thing) && thing.reagents && thing.reagents.total_volume && ATOM_IS_OPEN_CONTAINER(thing)) - for(var/R in thing.reagents.reagent_volumes) - var/taking_reagent = REAGENT_VOLUME(thing.reagents, R) - thing.remove_from_reagents(R, taking_reagent) - stored_material[R] += taking_reagent + for(var/decl/material/reagent as anything in thing.reagents.reagent_volumes) + var/taking_reagent = REAGENT_VOLUME(thing.reagents, reagent) + thing.remove_from_reagents(reagent, taking_reagent) + stored_material[reagent.type] += taking_reagent to_chat(user, SPAN_NOTICE("You add the contents of \the [thing] to \the [src]'s material buffer.")) return TRUE diff --git a/code/modules/power/fusion/consoles/_consoles.dm b/code/modules/power/fusion/consoles/_consoles.dm index f6e16cfae341..c5bae885e06c 100644 --- a/code/modules/power/fusion/consoles/_consoles.dm +++ b/code/modules/power/fusion/consoles/_consoles.dm @@ -22,8 +22,8 @@ var/datum/extension/local_network_member/fusion = get_extension(src, /datum/extension/local_network_member) return fusion.get_local_network() -/obj/machinery/computer/fusion/attackby(var/obj/item/thing, var/mob/user) - if(IS_MULTITOOL(thing)) +/obj/machinery/computer/fusion/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/fusion = get_extension(src, /datum/extension/local_network_member) fusion.get_new_tag(user) return TRUE diff --git a/code/modules/power/fusion/core/_core.dm b/code/modules/power/fusion/core/_core.dm index 31a3fff21fa3..e9b94cc7f7e3 100644 --- a/code/modules/power/fusion/core/_core.dm +++ b/code/modules/power/fusion/core/_core.dm @@ -14,7 +14,7 @@ anchored = FALSE construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 + stat_immune = NOINPUT base_type = /obj/machinery/fusion_core stock_part_presets = list(/decl/stock_part_preset/terminal_setup) @@ -43,17 +43,6 @@ else owned_field.handle_tick() -/obj/machinery/fusion_core/OnTopic(mob/user, href_list) - if((. = ..())) - return - if(href_list["str"]) - var/dif = text2num(href_list["str"]) - field_strength = min(max(field_strength + dif, MIN_FIELD_STR), MAX_FIELD_STR) - change_power_consumption(500 * field_strength, POWER_USE_ACTIVE) - if(owned_field) - owned_field.ChangeFieldStrength(field_strength) - return TOPIC_REFRESH - /obj/machinery/fusion_core/update_use_power(new_use_power) . = ..() if(use_power == POWER_USE_IDLE && owned_field) @@ -99,28 +88,30 @@ Shutdown() return TRUE -/obj/machinery/fusion_core/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/fusion_core/attackby(var/obj/item/used_item, var/mob/user) if(owned_field) - to_chat(user,"Shut \the [src] off first!") + to_chat(user, SPAN_WARNING("Shut \the [src] off first!")) return TRUE - if(IS_MULTITOOL(W)) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/fusion = get_extension(src, /datum/extension/local_network_member) fusion.get_new_tag(user) return TRUE - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) anchored = !anchored playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) if(anchored) - user.visible_message("[user.name] secures [src.name] to the floor.", \ - "You secure \the [src] to the floor.", \ - "You hear a ratchet.") + user.visible_message("\The [user] secures \the [src] to the floor.", + "You secure \the [src] to the floor.", + "You hear a ratchet." + ) else - user.visible_message("[user.name] unsecures [src.name] from the floor.", \ - "You unsecure \the [src] from the floor.", \ - "You hear a ratchet.") + user.visible_message("\The [user] unsecures \the [src] from the floor.", + "You unsecure \the [src] from the floor.", + "You hear a ratchet." + ) return TRUE return ..() diff --git a/code/modules/power/fusion/fuel_injector/fuel_injector.dm b/code/modules/power/fusion/fuel_injector/fuel_injector.dm index 3bbf1a2dcfbf..111c4f73fe12 100644 --- a/code/modules/power/fusion/fuel_injector/fuel_injector.dm +++ b/code/modules/power/fusion/fuel_injector/fuel_injector.dm @@ -9,7 +9,6 @@ active_power_usage = 500 construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 base_type = /obj/machinery/fusion_fuel_injector var/fuel_usage = 0.001 @@ -45,31 +44,31 @@ else Inject() -/obj/machinery/fusion_fuel_injector/attackby(obj/item/W, mob/user) +/obj/machinery/fusion_fuel_injector/attackby(obj/item/used_item, mob/user) - if(IS_MULTITOOL(W)) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/fusion = get_extension(src, /datum/extension/local_network_member) fusion.get_new_tag(user) return TRUE - if(istype(W, /obj/item/fuel_assembly)) + if(istype(used_item, /obj/item/fuel_assembly)) if(injecting) to_chat(user, "Shut \the [src] off before playing with the fuel rod!") return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE if(cur_assembly) - visible_message("\The [user] swaps \the [src]'s [cur_assembly] for \a [W].") + visible_message("\The [user] swaps \the [src]'s [cur_assembly] for \a [used_item].") else - visible_message("\The [user] inserts \a [W] into \the [src].") + visible_message("\The [user] inserts \a [used_item] into \the [src].") if(cur_assembly) cur_assembly.dropInto(loc) user.put_in_hands(cur_assembly) - cur_assembly = W + cur_assembly = used_item return TRUE - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) if(injecting) to_chat(user, "Shut \the [src] off first!") return TRUE diff --git a/code/modules/power/fusion/gyrotron/gyrotron.dm b/code/modules/power/fusion/gyrotron/gyrotron.dm index d8a6425977eb..f70c73ffb5d1 100644 --- a/code/modules/power/fusion/gyrotron/gyrotron.dm +++ b/code/modules/power/fusion/gyrotron/gyrotron.dm @@ -57,8 +57,8 @@ else icon_state = "emitter-off" -/obj/machinery/emitter/gyrotron/attackby(var/obj/item/W, var/mob/user) - if(IS_MULTITOOL(W)) +/obj/machinery/emitter/gyrotron/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/fusion = get_extension(src, /datum/extension/local_network_member) fusion.get_new_tag(user) return TRUE diff --git a/code/modules/power/fusion/kinetic_harvester.dm b/code/modules/power/fusion/kinetic_harvester.dm index d866bf68034a..51d150e0c8d0 100644 --- a/code/modules/power/fusion/kinetic_harvester.dm +++ b/code/modules/power/fusion/kinetic_harvester.dm @@ -32,8 +32,8 @@ ui_interact(user) return TRUE -/obj/machinery/kinetic_harvester/attackby(var/obj/item/thing, var/mob/user) - if(IS_MULTITOOL(thing)) +/obj/machinery/kinetic_harvester/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/lanm = get_extension(src, /datum/extension/local_network_member) if(lanm.get_new_tag(user)) find_core() diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 06b68c985316..01ab115896a3 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -153,8 +153,8 @@ generate_power(effective_gen) -/obj/machinery/generator/attackby(obj/item/W, mob/user) - if(!IS_WRENCH(W)) +/obj/machinery/generator/attackby(obj/item/used_item, mob/user) + if(!IS_WRENCH(used_item)) return ..() playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) anchored = !anchored diff --git a/code/modules/power/heavycable.dm b/code/modules/power/heavycable.dm index b0a37913ceb3..ed452d7e1fb8 100644 --- a/code/modules/power/heavycable.dm +++ b/code/modules/power/heavycable.dm @@ -16,16 +16,16 @@ can_have_color = FALSE #define IS_TOOL_WITH_QUALITY(A, T, Q) (isatom(A) && A.get_tool_quality(T) >= Q) -/obj/structure/cable/heavyduty/attackby(obj/item/item, mob/user) - if(IS_WIRECUTTER(item)) +/obj/structure/cable/heavyduty/attackby(obj/item/used_item, mob/user) + if(IS_WIRECUTTER(used_item)) // Must be cut with power tools like the hydraulic clamp. - if(IS_TOOL_WITH_QUALITY(item, TOOL_WIRECUTTERS, TOOL_QUALITY_GOOD)) - cut_wire(item, user) + if(IS_TOOL_WITH_QUALITY(used_item, TOOL_WIRECUTTERS, TOOL_QUALITY_GOOD)) + cut_wire(used_item, user) else - to_chat(user, SPAN_WARNING("\The [item] isn't strong enough to cut \the [src].")) + to_chat(user, SPAN_WARNING("\The [used_item] isn't strong enough to cut \the [src].")) return TRUE - if(istype(item, /obj/item/stack/cable_coil) && !istype(item, /obj/item/stack/cable_coil/heavyduty)) - to_chat(user, SPAN_WARNING("\The [item] isn't heavy enough to connect to \the [src].")) + if(istype(used_item, /obj/item/stack/cable_coil) && !istype(used_item, /obj/item/stack/cable_coil/heavyduty)) + to_chat(user, SPAN_WARNING("\The [used_item] isn't heavy enough to connect to \the [src].")) return TRUE return ..() diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index c2866b277c96..39184fecc631 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -164,9 +164,9 @@ _state = "[base_state]_broken" if(istype(lightbulb, /obj/item/light)) - var/image/I = image(icon, _state) - I.color = get_mode_color() - add_overlay(I) + var/image/overlay_image = image(icon, _state) + overlay_image.color = get_mode_color() + add_overlay(overlay_image) if(on) compile_overlays() // force a compile so that we update prior to the light being set @@ -250,28 +250,32 @@ update_light_status(TRUE) update_icon() +// Just... skip the entire test. We don't need to remove the bulbs from every single light just to test this. +/obj/machinery/light/fail_construct_state_unit_test() + return FALSE + /obj/machinery/light/cannot_transition_to(state_path, mob/user) if(lightbulb && !ispath(state_path, /decl/machine_construction/wall_frame/panel_closed)) return SPAN_WARNING("You must first remove the lightbulb!") return ..() -/obj/machinery/light/attackby(obj/item/W, mob/user) +/obj/machinery/light/attackby(obj/item/used_item, mob/user) . = ..() if(. || panel_open) return // attempt to insert light - if(istype(W, /obj/item/light)) + if(istype(used_item, /obj/item/light)) if(lightbulb) to_chat(user, "There is a [get_fitting_name()] already inserted.") return - if(!istype(W, accepts_light_type)) + if(!istype(used_item, accepts_light_type)) to_chat(user, "This type of light requires a [get_fitting_name()].") return - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return - to_chat(user, "You insert [W].") - insert_bulb(W) + to_chat(user, "You insert [used_item].") + insert_bulb(used_item) src.add_fingerprint(user) // attempt to break the light @@ -279,10 +283,10 @@ else if(lightbulb && (lightbulb.status != LIGHT_BROKEN) && !user.check_intent(I_FLAG_HELP)) - if(prob(1 + W.expend_attack_force(user) * 5)) + if(prob(1 + used_item.expend_attack_force(user) * 5)) user.visible_message("[user.name] smashed the light!", "You smash the light!", "You hear a tinkle of breaking glass.") - if(on && (W.obj_flags & OBJ_FLAG_CONDUCTIBLE)) + if(on && (used_item.obj_flags & OBJ_FLAG_CONDUCTIBLE)) if (prob(12)) electrocute_mob(user, get_area(src), src, 0.3) broken() @@ -292,8 +296,8 @@ // attempt to stick weapon into light socket else if(!lightbulb) - to_chat(user, "You stick \the [W] into the light socket!") - if(expected_to_be_on() && (W.obj_flags & OBJ_FLAG_CONDUCTIBLE)) + to_chat(user, "You stick \the [used_item] into the light socket!") + if(expected_to_be_on() && (used_item.obj_flags & OBJ_FLAG_CONDUCTIBLE)) spark_at(src, cardinal_only = TRUE) if (prob(75)) electrocute_mob(user, get_area(src), src, rand(0.7,1.0)) @@ -455,9 +459,9 @@ . = ..() // this will handle pixel offsets icon_state = "nav[delay][!!(lightbulb && on)]" -/obj/machinery/light/navigation/attackby(obj/item/W, mob/user) +/obj/machinery/light/navigation/attackby(obj/item/used_item, mob/user) . = ..() - if(!. && IS_MULTITOOL(W)) + if(!. && IS_MULTITOOL(used_item)) delay = 5 + ((delay + 1) % 5) to_chat(user, SPAN_NOTICE("You adjust the delay on \the [src].")) return TRUE @@ -591,14 +595,13 @@ // attack bulb/tube with object // if a syringe, can inject flammable liquids to make it explode -/obj/item/light/attackby(var/obj/item/I, var/mob/user) +/obj/item/light/attackby(var/obj/item/used_item, var/mob/user) ..() - if(istype(I, /obj/item/chems/syringe) && I.reagents?.total_volume) - var/obj/item/chems/syringe/S = I + if(istype(used_item, /obj/item/chems/syringe) && used_item.reagents?.total_volume) + var/obj/item/chems/syringe/S = used_item to_chat(user, "You inject the solution into \the [src].") - for(var/rtype in S.reagents?.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - if(R.accelerant_value > FUEL_VALUE_ACCELERANT) + for(var/decl/material/reagent as anything in S.reagents?.reagent_volumes) + if(reagent.accelerant_value > FUEL_VALUE_ACCELERANT) rigged = TRUE log_and_message_admins("injected a light with flammable reagents, rigging it to explode.", user) break @@ -652,3 +655,18 @@ if(lightbulb) remove_bulb() return TRUE + +// Partially-constructed presets for mapping +/obj/machinery/light/fixture + icon_state = "tube-construct-stage1" + +/obj/machinery/light/fixture/Initialize(mapload, d, populate_parts) + . = ..(mapload, d, populate_parts = FALSE) + construct_state.post_construct(src) + +/obj/machinery/light/small/fixture + icon_state = "bulb-construct-stage1" + +/obj/machinery/light/small/fixture/Initialize(mapload, d, populate_parts) + . = ..(mapload, d, populate_parts = FALSE) + construct_state.post_construct(src) \ No newline at end of file diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index e10a4f9c6d13..526fefb07ed4 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -113,7 +113,7 @@ /* These values were chosen so that the generator can run safely up to 80 kW - A full 50 deuterium sheet stack should last 20 minutes at power_output = 4 + A full 50 graphite sheet stack should last 20 minutes at power_output = 4 temperature_gain and max_temperature are set so that the max safe power level is 4. Setting to 5 or higher can only be done temporarily before the generator overheats. */ @@ -300,9 +300,9 @@ return SPAN_WARNING("You cannot do this while \the [src] is running!") return ..() -/obj/machinery/port_gen/pacman/attackby(var/obj/item/O, var/mob/user) - if(istype(O, sheet_path) && (isnull(sheet_material) || sheet_material == O.get_material_type())) - var/obj/item/stack/addstack = O +/obj/machinery/port_gen/pacman/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, sheet_path) && (isnull(sheet_material) || sheet_material == used_item.get_material_type())) + var/obj/item/stack/addstack = used_item var/amount = min((max_sheets - sheets), addstack.amount) if(amount < 1) to_chat(user, "\The [src] is full!") @@ -312,7 +312,7 @@ addstack.use(amount) updateUsrDialog() return TRUE - if(IS_WRENCH(O) && !active) + if(IS_WRENCH(used_item) && !active) if(!anchored) to_chat(user, "You secure \the [src] to the floor.") else @@ -321,7 +321,7 @@ playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) anchored = !anchored return TRUE - return component_attackby(O, user) + return component_attackby(used_item, user) /obj/machinery/port_gen/pacman/dismantle() while (sheets > 0) @@ -485,9 +485,9 @@ if(power_output > max_safe_output) icon_state = "potatodanger" -/obj/machinery/port_gen/pacman/super/potato/attackby(var/obj/item/hit_with, var/mob/user) - if(istype(hit_with, /obj/item/chems)) - var/obj/item/chems/chem_container = hit_with +/obj/machinery/port_gen/pacman/super/potato/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/chems)) + var/obj/item/chems/chem_container = used_item var/old_vodka_amount = REAGENT_VOLUME(reagents, /decl/material/liquid/alcohol/vodka) if(chem_container.standard_pour_into(src,user)) if(REAGENT_VOLUME(reagents, /decl/material/liquid/alcohol/vodka) > old_vodka_amount) // yay, booze! diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 8afd72314cea..a3560b8c8db9 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -82,11 +82,11 @@ // attach a wire to a power machine - leads from the turf you are standing on //almost never called, overwritten by all power machines but terminal and generator -/obj/machinery/power/attackby(obj/item/W, mob/user) +/obj/machinery/power/attackby(obj/item/used_item, mob/user) if((. = ..())) return - if(IS_COIL(W)) - var/obj/item/stack/cable_coil/coil = W + if(IS_COIL(used_item)) + var/obj/item/stack/cable_coil/coil = used_item var/turf/T = user.loc if(!istype(T) || T.density || T.cannot_build_cable()) return diff --git a/code/modules/power/sensors/powernet_sensor.dm b/code/modules/power/sensors/powernet_sensor.dm index 6a0134664cd3..66e5cee66f83 100644 --- a/code/modules/power/sensors/powernet_sensor.dm +++ b/code/modules/power/sensors/powernet_sensor.dm @@ -88,55 +88,6 @@ return L - -// Proc: return_reading_text() -// Parameters: None -// Description: Generates string which contains HTML table with reading data. -/obj/machinery/power/sensor/proc/return_reading_text() - // No powernet. Try to connect to one first. - if(!powernet) - connect_to_network() - var/out = "" - if(!powernet) // No powernet. - out = "# SYSTEM ERROR - NO POWERNET #" - return out - - - var/list/L = find_apcs() - var/total_apc_load = 0 - if(L.len <= 0) // No APCs found. - out = "No APCs located in connected powernet!" - else // APCs found. Create very ugly (but working!) HTML table. - - out += "
    " @@ -181,6 +210,7 @@ var/global/const/CHARACTER_PREFERENCE_INPUT_TITLE = "Character Preference" * Category Item Setup * **********************/ /datum/category_item/player_setup_item + abstract_type = /datum/category_item/player_setup_item var/sort_order = 0 var/datum/preferences/pref @@ -211,7 +241,7 @@ var/global/const/CHARACTER_PREFERENCE_INPUT_TITLE = "Character Preference" /* * Called when the item is asked to save per character settings */ -/datum/category_item/player_setup_item/proc/save_character(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/proc/save_character(datum/pref_record_writer/writer) return /* @@ -223,7 +253,29 @@ var/global/const/CHARACTER_PREFERENCE_INPUT_TITLE = "Character Preference" /* * Called when the item is asked to save user/global settings */ -/datum/category_item/player_setup_item/proc/save_preferences(datum/pref_record_writer/W) +/datum/category_item/player_setup_item/proc/save_preferences(datum/pref_record_writer/writer) + return + +/* +* Called when actually populating a character based on character creation preferences +*/ +/datum/category_item/player_setup_item/proc/apply_snapshot_to_mob(mob/living/human/character, is_preview_copy = FALSE) + return // Note that the prefs-level call will apply anything already done in populate_mob_snapshot + +/datum/category_item/player_setup_item/proc/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + return + +/* need overrides for: +- name (done) +- eye colour (done) +- blood type (done) +- skin colour/tone (done) +- species (done) +- bodytype (done) +- sprite accessories (done) +- maybe genetic conditions from traits? +*/ +/datum/category_item/player_setup_item/proc/populate_mob_snapshot(datum/mob_snapshot/snapshot, is_preview_copy = FALSE) return /datum/category_item/player_setup_item/proc/content() diff --git a/code/modules/client/preference_setup/records/00_records.dm b/code/modules/client/preference_setup/records/00_records.dm index 17146b1067dd..85a40a1a8f81 100644 --- a/code/modules/client/preference_setup/records/00_records.dm +++ b/code/modules/client/preference_setup/records/00_records.dm @@ -2,6 +2,7 @@ var/list/records = list() /datum/category_item/player_setup_item/records + abstract_type = /datum/category_item/player_setup_item/records var/record_key /datum/category_item/player_setup_item/records/content(var/mob/user) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index c4ec78c13cf2..cdfe05e2c66c 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -77,7 +77,7 @@ var/global/list/time_prefs_fixed = list() gender = pick(MALE, FEMALE) real_name = get_random_name() - var/decl/species/species = get_species_by_key(global.using_map.default_species) + var/decl/species/species = decls_repository.get_decl_by_id(global.using_map.default_species) blood_type = pickweight(species.blood_types) if(client) @@ -346,91 +346,49 @@ var/global/list/time_prefs_fixed = list() update_setup_window(usr) return 1 -/datum/preferences/proc/copy_to(mob/living/human/character, is_preview_copy = FALSE) - - if(!player_setup) - return // WHY IS THIS EVEN HAPPENING. +/datum/category_item/player_setup_item/records/character_info/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + if(is_preview_copy) + return + pref.validate_comments_record() // Make sure a record has been generated for this character. + character.comments_record_id = pref.comments_record_id - // Sanitizing rather than saving as someone might still be editing when copy_to occurs. +/datum/preferences/proc/create_character_from_snapshot(spawn_turf) + // Sanitizing rather than saving as someone might still be editing. player_setup.sanitize_setup() - validate_comments_record() // Make sure a record has been generated for this character. - character.comments_record_id = comments_record_id - character.traits = null + // first, handle basic appearance stuff via mob_snapshot + var/datum/mob_snapshot/new_character_snapshot = new /datum/mob_snapshot + player_setup.populate_mob_snapshot(new_character_snapshot, FALSE) + var/mob/living/human/character = new(spawn_turf, null, new_character_snapshot) + apply_post_snapshot_preferences(character, FALSE) + return character - var/decl/bodytype/new_bodytype = get_bodytype_decl() - if(species == character.get_species_name()) - character.set_bodytype(new_bodytype) - else - character.change_species(species, new_bodytype) - - if(be_random_name) - var/decl/background_detail/background = get_background_datum_by_flag(BACKGROUND_FLAG_NAMING) - if(background) - real_name = background.get_random_name(gender) - - if(get_config_value(/decl/config/toggle/humans_need_surnames)) - var/firstspace = findtext(real_name, " ") - var/name_length = length(real_name) - if(!firstspace) //we need a surname - real_name += " [pick(global.using_map.last_names)]" - else if(firstspace == name_length) - real_name += "[pick(global.using_map.last_names)]" - - character.fully_replace_character_name(real_name) - - character.set_gender(gender) - character.blood_type = blood_type - - character.set_skin_colour(skin_colour, skip_update = TRUE) - character.skin_tone = skin_tone - - QDEL_NULL_LIST(character.worn_underwear) - character.worn_underwear = list() - - for(var/underwear_category_name in all_underwear) - var/datum/category_group/underwear/underwear_category = global.underwear.categories_by_name[underwear_category_name] - if(underwear_category) - var/underwear_item_name = all_underwear[underwear_category_name] - var/datum/category_item/underwear/UWD = underwear_category.items_by_name[underwear_item_name] - var/metadata = all_underwear_metadata[underwear_category_name] - var/obj/item/underwear/UW = UWD.create_underwear(character, metadata) - if(UW) - UW.ForceEquipUnderwear(character, FALSE) - else - all_underwear -= underwear_category_name - character.backpack_setup = new(backpack, backpack_metadata["[backpack]"]) +/datum/preferences/proc/copy_to(mob/living/human/character, is_preview_copy = FALSE) + apply_snapshot_to_mob(character, is_preview_copy) // this is effectively what create_character_from_snapshot does, but on an existing mob + apply_post_snapshot_preferences(character, is_preview_copy) // this is the stuff we need to share - if(length(traits)) - for(var/trait_type in traits) - character.set_trait(trait_type, (traits[trait_type] || TRAIT_LEVEL_EXISTS)) +/datum/preferences/proc/apply_snapshot_to_mob(mob/living/human/character, is_preview_copy = FALSE) + // Sanitizing rather than saving as someone might still be editing when copy_to occurs. + player_setup.sanitize_setup() + // todo: move this part into some sort of pre-copy sanitizing? move it into the trait stuff? check if it's even necessary? + // i guess this is for if we're using it to refresh an existing character from prefs via admin tools + character.clear_extrinsic_traits() + // first, handle basic appearance stuff via mob_snapshot + var/datum/mob_snapshot/new_character_snapshot = new /datum/mob_snapshot // we assume we want a full repopulation, so don't persist anything from the donor + player_setup.populate_mob_snapshot(new_character_snapshot, is_preview_copy) + new_character_snapshot.apply_appearance_to(character, do_update = FALSE) + // not sure why we have real_name on snapshot; it's only used in one spot in setup_human + character.set_real_name(new_character_snapshot.real_name) + // now actually load everything else + player_setup.apply_snapshot_to_mob(character, is_preview_copy) + return character - character.set_eye_colour(eye_colour, skip_update = TRUE) +/datum/preferences/proc/apply_post_snapshot_preferences(mob/living/human/character, is_preview_copy = FALSE) + player_setup.apply_post_snapshot_preferences(character, is_preview_copy) - for(var/obj/item/organ/external/O in character.get_external_organs()) - for(var/decl/sprite_accessory_category/sprite_category in O.get_sprite_accessory_categories()) - if(!sprite_category.clear_in_pref_apply) - continue - O.clear_sprite_accessories_by_category(sprite_category.type, skip_update = TRUE) - - for(var/accessory_category in sprite_accessories) - var/decl/sprite_accessory_category/acc_cat = GET_DECL(accessory_category) - var/list/accessories = sprite_accessories[accessory_category] - acc_cat.prepare_character(character, accessories) - for(var/accessory in accessories) - var/decl/sprite_accessory/accessory_decl = GET_DECL(accessory) - var/accessory_metadata = accessories[accessory] - for(var/bodypart in accessory_decl.body_parts) - var/obj/item/organ/external/O = GET_EXTERNAL_ORGAN(character, bodypart) - if(O) - O.set_sprite_accessory(accessory, accessory_category, accessory_metadata, skip_update = TRUE) - - if(LAZYLEN(appearance_descriptors)) - character.appearance_descriptors = appearance_descriptors.Copy() - - character.force_update_limbs() + // this happens here because i didn't want to duplicate it between apply_snapshot_to_mob and create_character_from_snapshot + character.force_update_limbs() // contains update_body(0) character.update_genetic_conditions(0) - character.update_body(0) character.update_underwear(0) character.update_hair(0) character.update_icon() @@ -439,22 +397,7 @@ var/global/list/time_prefs_fixed = list() if(is_preview_copy) return - for(var/token in background_info) - character.set_background_value(token, background_info[token], defer_language_update = TRUE) - character.update_languages() - for(var/lang in alternate_languages) - character.add_language(lang) - - character.flavor_texts["general"] = flavor_texts["general"] - character.flavor_texts["head"] = flavor_texts["head"] - character.flavor_texts["face"] = flavor_texts["face"] - character.flavor_texts["eyes"] = flavor_texts["eyes"] - character.flavor_texts["torso"] = flavor_texts["torso"] - character.flavor_texts["arms"] = flavor_texts["arms"] - character.flavor_texts["hands"] = flavor_texts["hands"] - character.flavor_texts["legs"] = flavor_texts["legs"] - character.flavor_texts["feet"] = flavor_texts["feet"] - + // why is this in copy_to? jfc if(!character.isSynthetic()) character.set_nutrition(rand(140,360)) character.set_hydration(rand(140,360)) @@ -492,7 +435,7 @@ var/global/list/time_prefs_fixed = list() if(!client) return - if(client.get_preference_value(/datum/client_preference/fullscreen_mode) != PREF_OFF) + if(client.get_preference_value(/datum/client_preference/fullscreen_mode) != PREF_NO) client.toggle_fullscreen(client.get_preference_value(/datum/client_preference/fullscreen_mode)) /datum/preferences/proc/setup_preferences() @@ -512,6 +455,7 @@ var/global/list/time_prefs_fixed = list() var/decl/bodytype/mob_bodytype = get_bodytype_decl() set_bodytype(mob_bodytype) + /datum/preferences/proc/set_bodytype(new_bodytype) bodytype = new_bodytype sanitize_preferences() diff --git a/code/modules/client/preferences_persist.dm b/code/modules/client/preferences_persist.dm index a5fbeba06604..c537e3adb84e 100644 --- a/code/modules/client/preferences_persist.dm +++ b/code/modules/client/preferences_persist.dm @@ -62,11 +62,11 @@ comments_record_id = comments.record_id /datum/preferences/proc/save_preferences() - var/datum/pref_record_writer/json_list/W = new(PREF_SER_VERSION) - player_setup.save_preferences(W) + var/datum/pref_record_writer/json_list/writer = new(PREF_SER_VERSION) + player_setup.save_preferences(writer) if(istext(comments_record_id) && length(comments_record_id)) SScharacter_info.queue_to_save(comments_record_id) - save_pref_record("preferences", W.data) + save_pref_record("preferences", writer.data) /datum/preferences/proc/get_slot_key(slot) return "character_[global.using_map.preferences_key()]_[slot]" @@ -98,14 +98,14 @@ update_preview_icon() /datum/preferences/proc/save_character(override_key=null) - var/datum/pref_record_writer/json_list/W = new(PREF_SER_VERSION) - player_setup.save_character(W) + var/datum/pref_record_writer/json_list/writer = new(PREF_SER_VERSION) + player_setup.save_character(writer) var/record_key = override_key || get_slot_key(default_slot) - save_pref_record(record_key, W.data) + save_pref_record(record_key, writer.data) // Cache the character's name for listing - LAZYSET(slot_names, record_key, W.data["real_name"]) + LAZYSET(slot_names, record_key, writer.data["real_name"]) SScharacter_setup.queue_preferences_save(src) /datum/preferences/proc/sanitize_preferences() diff --git a/code/modules/client/ui_styles/_helpers.dm b/code/modules/client/ui_styles/_helpers.dm index c7c7cc06da71..d0ea5baffa33 100644 --- a/code/modules/client/ui_styles/_helpers.dm +++ b/code/modules/client/ui_styles/_helpers.dm @@ -1,9 +1,9 @@ /proc/get_ui_styles(var/filter_available = TRUE) var/list/all_ui_styles = decls_repository.get_decls_of_subtype(/decl/ui_style) for(var/ui_type in all_ui_styles) - var/decl/ui_style/ui = all_ui_styles[ui_type] - if(!ui.restricted || !filter_available) - LAZYADD(., ui) + var/decl/ui_style/style = all_ui_styles[ui_type] + if(!style.restricted || !filter_available) + LAZYADD(., style) /proc/get_ui_icon(decl/ui_style/ui_style, ui_key) diff --git a/code/modules/client/ui_styles/_ui_style.dm b/code/modules/client/ui_styles/_ui_style.dm index 808709107dcd..a1a4664efe0e 100644 --- a/code/modules/client/ui_styles/_ui_style.dm +++ b/code/modules/client/ui_styles/_ui_style.dm @@ -29,7 +29,8 @@ (HUD_UP_HINT) = 'icons/mob/screen/styles/midnight/uphint.dmi', (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/midnight/zone_selector.dmi', (HUD_CHARGE) = 'icons/mob/screen/styles/charge.dmi', - (HUD_INTENT) = 'icons/screen/intents.dmi' + (HUD_INTENT) = 'icons/screen/intents.dmi', + (HUD_MODIFIERS) = 'icons/mob/screen/styles/midnight/modifiers.dmi' ) /// A subset of UI keys to icon files used to override the above. var/list/override_icons diff --git a/code/modules/client/ui_styles/_ui_style_states.dm b/code/modules/client/ui_styles/_ui_style_states.dm index 95f6558e61a6..6a060e6dbdef 100644 --- a/code/modules/client/ui_styles/_ui_style_states.dm +++ b/code/modules/client/ui_styles/_ui_style_states.dm @@ -20,7 +20,8 @@ var/global/list/_ui_all_keys = list( (HUD_CHARGE), (HUD_THROW), (HUD_MANEUVER), - (HUD_INTENT) + (HUD_INTENT), + (HUD_MODIFIERS) ) var/global/list/_ui_expected_states @@ -175,6 +176,10 @@ var/global/list/_ui_expected_states (HUD_THROW) = list( "act_throw_on", "act_throw_off" + ), + (HUD_MODIFIERS) = list( + "blank", + "modifier_base" ) ) diff --git a/code/modules/client/ui_styles/ui_style_subtypes.dm b/code/modules/client/ui_styles/ui_style_subtypes.dm index 7de6cc1183cd..e37aef4a9aba 100644 --- a/code/modules/client/ui_styles/ui_style_subtypes.dm +++ b/code/modules/client/ui_styles/ui_style_subtypes.dm @@ -17,7 +17,8 @@ (HUD_INVENTORY) = 'icons/mob/screen/styles/orange/inventory.dmi', (HUD_MOVEMENT) = 'icons/mob/screen/styles/orange/movement.dmi', (HUD_UP_HINT) = 'icons/mob/screen/styles/orange/uphint.dmi', - (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/orange/zone_selector.dmi' + (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/orange/zone_selector.dmi', + (HUD_MODIFIERS) = 'icons/mob/screen/styles/orange/modifiers.dmi' ) /decl/ui_style/old @@ -34,7 +35,8 @@ (HUD_INVENTORY) = 'icons/mob/screen/styles/old/inventory.dmi', (HUD_MOVEMENT) = 'icons/mob/screen/styles/old/movement.dmi', (HUD_UP_HINT) = 'icons/mob/screen/styles/old/uphint.dmi', - (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/old/zone_selector.dmi' + (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/old/zone_selector.dmi', + (HUD_MODIFIERS) = 'icons/mob/screen/styles/old/modifiers.dmi' ) /decl/ui_style/old_noborder @@ -51,7 +53,8 @@ (HUD_INVENTORY) = 'icons/mob/screen/styles/old_noborder/inventory.dmi', (HUD_MOVEMENT) = 'icons/mob/screen/styles/old/movement.dmi', (HUD_UP_HINT) = 'icons/mob/screen/styles/old_noborder/uphint.dmi', - (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/old_noborder/zone_selector.dmi' + (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/old_noborder/zone_selector.dmi', + (HUD_MODIFIERS) = 'icons/mob/screen/styles/old_noborder/modifiers.dmi' ) /decl/ui_style/white @@ -68,7 +71,8 @@ (HUD_INVENTORY) = 'icons/mob/screen/styles/white/inventory.dmi', (HUD_MOVEMENT) = 'icons/mob/screen/styles/white/movement.dmi', (HUD_UP_HINT) = 'icons/mob/screen/styles/white/uphint.dmi', - (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/white/zone_selector.dmi' + (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/white/zone_selector.dmi', + (HUD_MODIFIERS) = 'icons/mob/screen/styles/white/modifiers.dmi' ) use_overlay_color = TRUE use_ui_color = TRUE @@ -87,7 +91,8 @@ (HUD_INVENTORY) = 'icons/mob/screen/styles/minimalist/inventory.dmi', (HUD_MOVEMENT) = 'icons/mob/screen/styles/minimalist/movement.dmi', (HUD_UP_HINT) = 'icons/mob/screen/styles/minimalist/uphint.dmi', - (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/minimalist/zone_selector.dmi' + (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/minimalist/zone_selector.dmi', + (HUD_MODIFIERS) = 'icons/mob/screen/styles/minimalist/modifiers.dmi' ) use_overlay_color = TRUE use_ui_color = TRUE @@ -106,7 +111,8 @@ (HUD_INVENTORY) = 'icons/mob/screen/styles/underworld/inventory.dmi', (HUD_MOVEMENT) = 'icons/mob/screen/styles/underworld/movement.dmi', (HUD_UP_HINT) = 'icons/mob/screen/styles/underworld/uphint.dmi', - (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/underworld/zone_selector.dmi' + (HUD_ZONE_SELECT) = 'icons/mob/screen/styles/underworld/zone_selector.dmi', + (HUD_MODIFIERS) = 'icons/mob/screen/styles/underworld/modifiers.dmi' ) use_overlay_color = TRUE use_ui_color = TRUE diff --git a/code/modules/clothing/_clothing.dm b/code/modules/clothing/_clothing.dm index 64d08080a018..354290fd7b2a 100644 --- a/code/modules/clothing/_clothing.dm +++ b/code/modules/clothing/_clothing.dm @@ -4,7 +4,7 @@ origin_tech = @'{"materials":1,"engineering":1}' material = /decl/material/solid/organic/cloth paint_verb = "dyed" - replaced_in_loadout = TRUE + replaced_in_loadout = LOADOUT_CONFLICT_DELETE w_class = ITEM_SIZE_SMALL icon_state = ICON_STATE_WORLD _base_attack_force = 3 @@ -38,9 +38,6 @@ var/markings_color // for things like colored parts of labcoats or shoes var/should_display_id = TRUE var/fallback_slot - // Used to track our icon, or custom icon, for resetting when accessories are added/removed - var/base_clothing_icon - var/base_clothing_state /obj/item/clothing/get_equipment_tint() return tint @@ -71,7 +68,7 @@ /obj/item/clothing/Destroy() if(is_accessory()) - on_removed() + on_accessory_removed() return ..() /obj/item/clothing/get_fallback_slot(slot) @@ -98,9 +95,9 @@ // Sort of a placeholder for proper tailoring. #define RAG_COUNT(X) ceil((LAZYACCESS(X.matter, /decl/material/solid/organic/cloth) * 0.65) / SHEET_MATERIAL_AMOUNT) -/obj/item/clothing/attackby(obj/item/I, mob/user) +/obj/item/clothing/attackby(obj/item/used_item, mob/user) var/rags = RAG_COUNT(src) - if(istype(material) && material.default_solid_form && rags && (I.is_sharp() || I.has_edge()) && user.check_intent(I_FLAG_HARM)) + if(istype(material) && material.default_solid_form && rags && (used_item.is_sharp() || used_item.has_edge()) && user.check_intent(I_FLAG_HARM)) if(length(accessories)) to_chat(user, SPAN_WARNING("You should remove the accessories attached to \the [src] first.")) return TRUE @@ -109,9 +106,9 @@ to_chat(user, SPAN_WARNING("You must either be holding \the [src], or [it] must be on the ground, before you can shred [it].")) return TRUE playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1) - user.visible_message(SPAN_DANGER("\The [user] begins ripping apart \the [src] with \the [I].")) + user.visible_message(SPAN_DANGER("\The [user] begins ripping apart \the [src] with \the [used_item].")) if(do_after(user, 5 SECONDS, src)) - user.visible_message(SPAN_DANGER("\The [user] tears \the [src] apart with \the [I].")) + user.visible_message(SPAN_DANGER("\The [user] tears \the [src] apart with \the [used_item].")) material.create_object(get_turf(src), rags) if(loc == user) user.drop_from_inventory(src) @@ -219,24 +216,18 @@ // Clothing does not generally align with each other's world icons, so we just use the mob overlay in this case. if(should_use_combined_accessory_appearance()) - var/image/I = get_mob_overlay(ismob(loc) ? loc : null, get_fallback_slot()) - if(I?.icon) // Null or invisible overlay, we don't want to make our clothing invisible just because it has an accessory. - I.plane = plane - I.layer = layer - I.color = color - I.alpha = alpha - I.name = name - appearance = I + var/image/overlay_image = get_mob_overlay(ismob(loc) ? loc : null, get_fallback_slot()) + if(overlay_image?.icon) // Null or invisible overlay, we don't want to make our clothing invisible just because it has an accessory. + overlay_image.plane = plane + overlay_image.layer = layer + overlay_image.color = color + overlay_image.alpha = alpha + overlay_image.name = name + appearance = overlay_image set_dir(SOUTH) update_clothing_icon() return - if(!base_clothing_icon) - base_clothing_icon = initial(icon) - set_icon(base_clothing_icon) - if(!base_clothing_state) - base_clothing_state = initial(icon_state) - set_icon_state(base_clothing_state) icon_state = JOINTEXT(list(get_world_inventory_state(), get_clothing_state_modifier())) if(markings_state_modifier && markings_color) add_overlay(mutable_appearance(icon, "[icon_state][markings_state_modifier]", markings_color)) @@ -294,7 +285,8 @@ var/last_icon = icon var/species_icon = LAZYACCESS(sprite_sheets, target_bodytype) - if(species_icon && (check_state_in_icon(ICON_STATE_INV, species_icon) || check_state_in_icon(ICON_STATE_WORLD, species_icon))) + // If we use the single icon system we need a world or icon state, otherwise we don't. + if(species_icon && check_state_in_icon(ICON_STATE_WORLD, species_icon)) icon = species_icon if(!skip_rename) @@ -405,7 +397,7 @@ /obj/item/clothing/proc/set_sensors(mob/user) if (isobserver(user) || user.incapacitated()) return - var/obj/item/clothing/sensor/vitals/sensor = locate() in accessories + var/obj/item/clothing/sensor/vitals/sensor = get_vitals_sensor() if(sensor) sensor.user_set_sensors(user) @@ -440,6 +432,12 @@ remove_hood(skip_update = TRUE) update_icon() +/obj/item/clothing/proc/get_vitals_sensor() + for(var/obj/item/clothing/accessory in accessories) + var/obj/item/sensor = accessory.get_vitals_sensor() + if(sensor) + return sensor + /obj/item/clothing/get_alt_interactions(var/mob/user) . = ..() var/list/all_clothing_state_modifiers = list() @@ -450,14 +448,19 @@ var/decl/clothing_state_modifier/modifier = GET_DECL(modifier_type) if(modifier.alt_interaction_type) LAZYADD(., modifier.alt_interaction_type) - LAZYADD(., /decl/interaction_handler/clothing_set_sensors) + if(get_vitals_sensor()) + LAZYADD(., /decl/interaction_handler/clothing_set_sensors) /decl/interaction_handler/clothing_set_sensors name = "Set Sensors Level" expected_target_type = /obj/item/clothing examine_desc = "adjust vitals sensors" +/decl/interaction_handler/clothing_set_sensors/is_possible(atom/target, mob/user, obj/item/prop) + var/obj/item/clothing/clothing = target + return ..() && istype(clothing) && clothing.get_vitals_sensor() + /decl/interaction_handler/clothing_set_sensors/invoked(atom/target, mob/user, obj/item/prop) - var/obj/item/clothing/clothes = target - clothes.set_sensors(user) + var/obj/item/clothing/clothing = target + clothing.set_sensors(user) diff --git a/code/modules/clothing/_clothing_accessories.dm b/code/modules/clothing/_clothing_accessories.dm index 0469f605d014..fcee791c31a7 100644 --- a/code/modules/clothing/_clothing_accessories.dm +++ b/code/modules/clothing/_clothing_accessories.dm @@ -49,22 +49,22 @@ return TRUE return ..() -/obj/item/clothing/attackby(var/obj/item/I, var/mob/user) +/obj/item/clothing/attackby(var/obj/item/used_item, var/mob/user) - if(istype(I, /obj/item/clothing)) + if(istype(used_item, /obj/item/clothing)) - var/obj/item/clothing/accessory = I + var/obj/item/clothing/accessory = used_item if(!isnull(accessory.accessory_slot)) if(can_attach_accessory(accessory, user)) if(user.try_unequip(accessory)) attach_accessory(user, accessory) else - to_chat(user, SPAN_WARNING("You cannot attach \the [I] to \the [src].")) + to_chat(user, SPAN_WARNING("You cannot attach \the [used_item] to \the [src].")) return TRUE if(length(accessories)) for(var/obj/item/clothing/accessory in accessories) - accessory.attackby(I, user) + accessory.attackby(used_item, user) return TRUE . = ..() @@ -91,7 +91,7 @@ /obj/item/clothing/proc/remove_accessory(mob/user, obj/item/clothing/accessory) if(!accessory || !(accessory in accessories) || !accessory.accessory_removable || !accessory.canremove) return - accessory.on_removed(user) + accessory.on_accessory_removed(user) update_icon() /obj/item/clothing/proc/removetie_verb() @@ -178,7 +178,7 @@ return TRUE return FALSE -/obj/item/clothing/proc/on_removed(var/mob/user) +/obj/item/clothing/proc/on_accessory_removed(var/mob/user) var/obj/item/clothing/holder = loc if(istype(holder)) if(user) diff --git a/code/modules/clothing/badges/holobadge.dm b/code/modules/clothing/badges/holobadge.dm index 90a5cd0e0411..b4f8888574fe 100644 --- a/code/modules/clothing/badges/holobadge.dm +++ b/code/modules/clothing/badges/holobadge.dm @@ -40,10 +40,10 @@ to_chat(user, "You crack the holobadge security checks.") return 1 -/obj/item/clothing/badge/holo/attackby(var/obj/item/O, var/mob/user) - if(istype(O, /obj/item/card/id) || istype(O, /obj/item/modular_computer)) +/obj/item/clothing/badge/holo/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/card/id) || istype(used_item, /obj/item/modular_computer)) - var/obj/item/card/id/id_card = O.GetIdCard() + var/obj/item/card/id/id_card = used_item.GetIdCard() if(!id_card) return TRUE diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index 39ea1c743a97..50adae6297ca 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -2,7 +2,19 @@ //**Cham Jumpsuit** //***************** +#define CHAMELEON_VERB(TYPE, VERB_NAME)\ +##TYPE/verb/change(picked in disguise_choices){ \ + set name = VERB_NAME; \ + set category = "Chameleon Items"; \ + set src in usr; \ + if(usr.incapacitated()) return; \ + if(!ispath(disguise_choices[picked])) return; \ + disguise(disguise_choices[picked], usr); \ + update_clothing_icon(); \ +} + /obj/item/proc/disguise(var/newtype, var/mob/user) + SHOULD_NOT_OVERRIDE(TRUE) if(user && CanPhysicallyInteract(user)) return OnDisguise(atom_info_repository.get_instance_of(newtype), user) return FALSE @@ -20,7 +32,7 @@ body_parts_covered = copy.body_parts_covered sprite_sheets = copy.sprite_sheets?.Copy() flags_inv = copy.flags_inv - set_gender(copy.gender) + set_gender(copy.gender) // mostly for plural/neuter, e.g. "some prayer beads" versus "a necklace" /proc/generate_chameleon_choices(var/basetype) . = list() @@ -44,26 +56,18 @@ icon = 'icons/clothing/pants/slacks.dmi' origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/pants/chameleon/Initialize() . = ..() - if(!clothing_choices) + if(!disguise_choices) var/static/list/clothing_types = list( /obj/item/clothing/pants, /obj/item/clothing/skirt ) - clothing_choices = generate_chameleon_choices(clothing_types) - -/obj/item/clothing/pants/chameleon/verb/change(picked in clothing_choices) - set name = "Change Pants Appearance" - set category = "Chameleon Items" - set src in usr - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - disguise(clothing_choices[picked], usr) - update_clothing_icon() + disguise_choices = generate_chameleon_choices(clothing_types) + +CHAMELEON_VERB(/obj/item/clothing/pants/chameleon, "Change Pants Appearance") /obj/item/clothing/shirt/chameleon name = "dress shirt" @@ -71,25 +75,17 @@ icon = 'icons/clothing/shirts/button_up.dmi' origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/shirt/chameleon/Initialize() . = ..() - if(!clothing_choices) + if(!disguise_choices) var/static/list/clothing_types = list( /obj/item/clothing/shirt ) - clothing_choices = generate_chameleon_choices(clothing_types) - -/obj/item/clothing/shirt/chameleon/verb/change(picked in clothing_choices) - set name = "Change Shirt Appearance" - set category = "Chameleon Items" - set src in usr - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - disguise(clothing_choices[picked], usr) - update_clothing_icon() + disguise_choices = generate_chameleon_choices(clothing_types) + +CHAMELEON_VERB(/obj/item/clothing/shirt/chameleon, "Change Shirt Appearance") //starts off as a jumpsuit /obj/item/clothing/jumpsuit/chameleon @@ -99,29 +95,19 @@ origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON bodytype_equip_flags = null - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/jumpsuit/chameleon/Initialize() . = ..() - if(!clothing_choices) + if(!disguise_choices) var/static/list/clothing_types = list( /obj/item/clothing/jumpsuit, /obj/item/clothing/dress, /obj/item/clothing/costume ) - clothing_choices = generate_chameleon_choices(clothing_types) - -/obj/item/clothing/jumpsuit/chameleon/verb/change(picked in clothing_choices) - set name = "Change Jumpsuit Appearance" - set category = "Chameleon Items" - set src in usr + disguise_choices = generate_chameleon_choices(clothing_types) - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/jumpsuit/chameleon, "Change Jumpsuit Appearance") //***************** //**Chameleon Hat** @@ -135,24 +121,14 @@ body_parts_covered = 0 item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON bodytype_equip_flags = null - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/head/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/clothing/head) - -/obj/item/clothing/head/chameleon/verb/change(picked in clothing_choices) - set name = "Change Hat/Helmet Appearance" - set category = "Chameleon Items" - set src in usr - - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/clothing/head) - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/head/chameleon, "Change Hat/Helmet Appearance") //****************** //**Chameleon Suit** @@ -165,24 +141,14 @@ origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON bodytype_equip_flags = null - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/suit/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/clothing/suit) + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/clothing/suit) -/obj/item/clothing/suit/chameleon/verb/change(picked in clothing_choices) - set name = "Change Oversuit Appearance" - set category = "Chameleon Items" - set src in usr - - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/suit/chameleon, "Change Oversuit Appearance") //******************* //**Chameleon Shoes** @@ -194,24 +160,14 @@ origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON bodytype_equip_flags = null - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/shoes/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/clothing/shoes) - -/obj/item/clothing/shoes/chameleon/verb/change(picked in clothing_choices) - set name = "Change Footwear Appearance" - set category = "Chameleon Items" - set src in usr + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/clothing/shoes) - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/shoes/chameleon, "Change Footwear Appearance") //********************** //**Chameleon Backpack** @@ -222,28 +178,14 @@ origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON icon = 'icons/obj/items/storage/backpack/backpack.dmi' - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/backpack/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/backpack) - -/obj/item/backpack/chameleon/verb/change(picked in clothing_choices) - set name = "Change Backpack Appearance" - set category = "Chameleon Items" - set src in usr - - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/backpack) - disguise(clothing_choices[picked], usr) - - //so our overlays update. - if (ismob(src.loc)) - var/mob/M = src.loc - M.update_equipment_overlay(slot_back_str) +CHAMELEON_VERB(/obj/item/backpack/chameleon, "Change Backpack Appearance") //******************** //**Chameleon Gloves** @@ -258,24 +200,14 @@ origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON bodytype_equip_flags = null - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/gloves/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/clothing/gloves) - -/obj/item/clothing/gloves/chameleon/verb/change(picked in clothing_choices) - set name = "Change Gloves Appearance" - set category = "Chameleon Items" - set src in usr + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/clothing/gloves) - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/gloves/chameleon, "Change Gloves Appearance") //****************** //**Chameleon Mask** @@ -288,24 +220,14 @@ origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON bodytype_equip_flags = null - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/mask/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/clothing/mask) - -/obj/item/clothing/mask/chameleon/verb/change(picked in clothing_choices) - set name = "Change Mask Appearance" - set category = "Chameleon Items" - set src in usr + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/clothing/mask) - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/mask/chameleon, "Change Mask Appearance") //********************* //**Chameleon Glasses** @@ -318,24 +240,14 @@ origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON bodytype_equip_flags = null - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/clothing/glasses/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/clothing/glasses) - -/obj/item/clothing/glasses/chameleon/verb/change(picked in clothing_choices) - set name = "Change Glasses Appearance" - set category = "Chameleon Items" - set src in usr - - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/clothing/glasses) - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/glasses/chameleon, "Change Glasses Appearance") //********************* //**Chameleon Headset** @@ -347,27 +259,14 @@ desc = "An updated, modular intercom that fits over the head. This one seems to have a small dial on it." origin_tech = @'{"esoteric":3}' item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON - var/static/list/clothing_choices + var/static/list/disguise_choices /obj/item/radio/headset/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(/obj/item/radio/headset) + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/radio/headset) -/obj/item/radio/headset/chameleon/verb/change(picked in clothing_choices) - set name = "Change Headset Appearance" - set category = "Chameleon Items" - set src in usr - - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - - disguise(clothing_choices[picked], usr) - if (ismob(src.loc)) - var/mob/M = src.loc - M.update_equipment_overlay(slot_l_ear_str, FALSE) - M.update_equipment_overlay(slot_r_ear_str) +CHAMELEON_VERB(/obj/item/radio/headset/chameleon, "Change Headset Appearance") //*********************** //**Chameleon Accessory** @@ -381,7 +280,7 @@ item_flags = ITEM_FLAG_INVALID_FOR_CHAMELEON w_class = ITEM_SIZE_SMALL fallback_slot = slot_wear_mask_str - var/static/list/clothing_choices + var/static/list/disguise_choices var/static/list/decor_types = list( /obj/item/clothing/neck, /obj/item/clothing/badge, @@ -394,19 +293,10 @@ /obj/item/clothing/chameleon/Initialize() . = ..() - if(!clothing_choices) - clothing_choices = generate_chameleon_choices(get_non_abstract_types(decor_types)) - -/obj/item/clothing/chameleon/verb/change(picked in clothing_choices) - set name = "Change Accessory Appearance" - set category = "Chameleon Items" - set src in usr + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(get_non_abstract_types(decor_types)) - if (!(usr.incapacitated())) - if(!ispath(clothing_choices[picked])) - return - disguise(clothing_choices[picked], usr) - update_clothing_icon() //so our overlays update. +CHAMELEON_VERB(/obj/item/clothing/chameleon, "Change Accessory Appearance") //***************** //**Chameleon Gun** @@ -428,12 +318,12 @@ max_shots = 50 var/obj/item/projectile/copy_projectile - var/static/list/gun_choices + var/static/list/disguise_choices /obj/item/gun/energy/chameleon/Initialize() . = ..() - if(!gun_choices) - gun_choices = generate_chameleon_choices(/obj/item/gun) + if(!disguise_choices) + disguise_choices = generate_chameleon_choices(/obj/item/gun) /obj/item/gun/energy/chameleon/consume_next_projectile() var/obj/item/projectile/P = ..() @@ -466,18 +356,4 @@ copy_projectile = null //charge_meter = 0 -/obj/item/gun/energy/chameleon/verb/change(picked in gun_choices) - set name = "Change Gun Appearance" - set category = "Chameleon Items" - set src in usr - - if (!(usr.incapacitated())) - if(!ispath(gun_choices[picked])) - return - - disguise(gun_choices[picked], usr) - - //so our overlays update. - if (ismob(src.loc)) - var/mob/M = src.loc - M.update_inhand_overlays() \ No newline at end of file +CHAMELEON_VERB(/obj/item/gun/energy/chameleon, "Change Gun Appearance") \ No newline at end of file diff --git a/code/modules/clothing/costumes/misc.dm b/code/modules/clothing/costumes/misc.dm index b44cfb42bc78..09b0b04ae8e7 100644 --- a/code/modules/clothing/costumes/misc.dm +++ b/code/modules/clothing/costumes/misc.dm @@ -105,3 +105,25 @@ name = "rogue's uniform" desc = "For the man who doesn't care because he's still free." icon = 'icons/clothing/rogue_captain.dmi' + +/obj/item/clothing/costume/mailman + name = "mailman's jumpsuit" + desc = "'Special delivery!'" + icon = 'icons/clothing/jumpsuits/jumpsuit_mailman.dmi' + +/obj/item/clothing/costume/psyche + name = "psychedelic jumpsuit" + desc = "Groovy!" + icon = 'icons/clothing/jumpsuits/jumpsuit_psychadelic.dmi' + +/obj/item/clothing/costume/wetsuit + name = "tactical wetsuit" + desc = "For when you want to scuba dive your way into an enemy base but still want to show off a little skin." + icon = 'icons/clothing/jumpsuits/wetsuit.dmi' + body_parts_covered = SLOT_UPPER_BODY|SLOT_LOWER_BODY + +/obj/item/clothing/costume/psysuit + name = "dark undersuit" + desc = "A thick, layered grey undersuit lined with power cables. Feels a little like wearing an electrical storm." + icon = 'icons/clothing/jumpsuits/jumpsuit_psionic.dmi' + body_parts_covered = SLOT_UPPER_BODY|SLOT_LOWER_BODY|SLOT_LEGS|SLOT_FEET|SLOT_ARMS|SLOT_HANDS diff --git a/code/modules/clothing/costumes/rank.dm b/code/modules/clothing/costumes/rank.dm index 3d4030b7b1e6..b2bc5a1fc940 100644 --- a/code/modules/clothing/costumes/rank.dm +++ b/code/modules/clothing/costumes/rank.dm @@ -38,3 +38,22 @@ /decl/material/solid/metal/steel = MATTER_AMOUNT_TRACE ) +/obj/item/clothing/costume/research_director_suit + desc = "A dress suit and slacks stained with hard work and dedication to science. Perhaps other things as well, but mostly hard work and dedication." + name = "head researcher uniform" + icon = 'icons/clothing/uniform_rd_alt.dmi' + armor = list( + ARMOR_BIO = ARMOR_BIO_MINOR + ) + +// Copied from jumpsuits, with the rolled-down modifier removed. +/obj/item/clothing/costume/research_director_suit/get_assumed_clothing_state_modifiers() + var/static/list/expected_state_modifiers = list( + GET_DECL(/decl/clothing_state_modifier/rolled_sleeves) + ) + return expected_state_modifiers + +/obj/item/clothing/costume/captainformal + name = "captain's formal uniform" + desc = "A captain's formal-wear, for special occasions." + icon = 'icons/clothing/uniform_captain_formal.dmi' \ No newline at end of file diff --git a/code/modules/clothing/dresses/misc.dm b/code/modules/clothing/dresses/misc.dm index 49c74faa645e..b6c623159b25 100644 --- a/code/modules/clothing/dresses/misc.dm +++ b/code/modules/clothing/dresses/misc.dm @@ -4,7 +4,7 @@ icon = 'icons/clothing/dresses/dress_green.dmi' /obj/item/clothing/dress/yellow - name = "green dress" + name = "yellow dress" desc = "A simple yellow dress." icon = 'icons/clothing/dresses/dress_yellow.dmi' @@ -20,7 +20,7 @@ /obj/item/clothing/dress/purple name = "purple dress" - desc= "A simple, tight-fitting purple dress." + desc = "A simple, tight-fitting purple dress." icon = 'icons/clothing/dresses/dress_purple.dmi' /obj/item/clothing/dress/saloon diff --git a/code/modules/clothing/gloves/_gloves.dm b/code/modules/clothing/gloves/_gloves.dm index 78696640604a..2f23bab0d14d 100644 --- a/code/modules/clothing/gloves/_gloves.dm +++ b/code/modules/clothing/gloves/_gloves.dm @@ -11,7 +11,7 @@ siemens_coefficient = 0.75 body_parts_covered = SLOT_HANDS slot_flags = SLOT_HANDS - attack_verb = list("challenged") + attack_verb = "challenged" blood_overlay_type = "bloodyhands" bodytype_equip_flags = BODY_EQUIP_FLAG_HUMANOID fallback_slot = slot_gloves_str diff --git a/code/modules/clothing/gloves/jewelry/rings/_ring.dm b/code/modules/clothing/gloves/jewelry/rings/_ring.dm index ea58b6662b83..a62f2449b2f8 100644 --- a/code/modules/clothing/gloves/jewelry/rings/_ring.dm +++ b/code/modules/clothing/gloves/jewelry/rings/_ring.dm @@ -11,12 +11,6 @@ var/can_fit_under_gloves = TRUE var/can_inscribe = TRUE var/inscription - var/base_desc - -/obj/item/clothing/gloves/ring/Initialize() - if(desc) - base_desc = desc - . = ..() /obj/item/clothing/gloves/ring/get_decoration_icon(default_icon, obj/item/thing, on_mob = FALSE) if(!on_mob && istype(thing, /obj/item/gemstone)) @@ -53,10 +47,10 @@ if(base_desc) desc = "[base_desc] [desc]" -/obj/item/clothing/gloves/ring/attackby(var/obj/item/tool, var/mob/user) - if(can_inscribe && tool.is_sharp() && user.check_intent(I_FLAG_HELP)) +/obj/item/clothing/gloves/ring/attackby(var/obj/item/used_item, var/mob/user) + if(can_inscribe && used_item.is_sharp() && user.check_intent(I_FLAG_HELP)) var/new_inscription = sanitize(input("Enter an inscription to engrave.", "Inscription") as null|text) - if(user.stat || !user.incapacitated() || !user.Adjacent(src) || tool.loc != user) + if(user.stat || !user.incapacitated() || !user.Adjacent(src) || used_item.loc != user) return TRUE if(!new_inscription) return TRUE diff --git a/code/modules/clothing/gloves/jewelry/rings/ring_aura.dm b/code/modules/clothing/gloves/jewelry/rings/ring_aura.dm deleted file mode 100644 index 2a6c167d7feb..000000000000 --- a/code/modules/clothing/gloves/jewelry/rings/ring_aura.dm +++ /dev/null @@ -1,29 +0,0 @@ -/obj/item/clothing/gloves/ring/aura_ring - icon = 'icons/clothing/accessories/jewelry/rings/ring_band_thick.dmi' - can_inscribe = FALSE - material = /decl/material/solid/metal/silver - abstract_type = /obj/item/clothing/gloves/ring/aura_ring - material_alteration = MAT_FLAG_ALTERATION_COLOR - var/obj/aura/granted_aura - -/obj/item/clothing/gloves/ring/aura_ring/update_name() - return - -/obj/item/clothing/gloves/ring/aura_ring/Initialize() - if(ispath(granted_aura)) - granted_aura = new granted_aura - . = ..() - -/obj/item/clothing/gloves/ring/aura_ring/Destroy() - QDEL_NULL(granted_aura) - . = ..() - -/obj/item/clothing/gloves/ring/aura_ring/equipped(var/mob/living/L, var/slot) - ..() - if(istype(granted_aura) && slot == slot_gloves_str) - L.add_aura(granted_aura) - -/obj/item/clothing/gloves/ring/aura_ring/dropped(var/mob/living/L) - ..() - if(istype(granted_aura)) - L.remove_aura(granted_aura) diff --git a/code/modules/clothing/gloves/jewelry/rings/ring_effect.dm b/code/modules/clothing/gloves/jewelry/rings/ring_effect.dm new file mode 100644 index 000000000000..cf46a141cceb --- /dev/null +++ b/code/modules/clothing/gloves/jewelry/rings/ring_effect.dm @@ -0,0 +1,18 @@ +/obj/item/clothing/gloves/ring/effect + icon = 'icons/clothing/accessories/jewelry/rings/ring_band_thick.dmi' + can_inscribe = FALSE + material = /decl/material/solid/metal/silver + abstract_type = /obj/item/clothing/gloves/ring/effect + material_alteration = MAT_FLAG_ALTERATION_COLOR + var/granted_effect + +/obj/item/clothing/gloves/ring/effect/update_name() + return + +/obj/item/clothing/gloves/ring/effect/Initialize() + if(granted_effect) + add_item_effect(granted_effect, list( + (IE_CAT_EXAMINE), + (IE_CAT_WIELDED) + )) + . = ..() diff --git a/code/modules/clothing/gloves/jewelry/rings/ring_seal.dm b/code/modules/clothing/gloves/jewelry/rings/ring_seal.dm index 9ba92ac56595..c2714a60d36a 100644 --- a/code/modules/clothing/gloves/jewelry/rings/ring_seal.dm +++ b/code/modules/clothing/gloves/jewelry/rings/ring_seal.dm @@ -10,11 +10,6 @@ . = ..() set_extension(src, /datum/extension/tool, list(TOOL_STAMP = TOOL_QUALITY_DEFAULT)) -/obj/item/clothing/gloves/ring/seal/secretary - name = "\improper Secretary-General's official seal" - desc = "The official seal of the Secretary-General of the Sol Central Government, featured prominently on a silver ring." - use_material_name = FALSE - /obj/item/clothing/gloves/ring/seal/mason name = "masonic ring" desc = "The Square and Compasses feature prominently on this Masonic ring." diff --git a/code/modules/clothing/gloves/latex.dm b/code/modules/clothing/gloves/latex.dm index ee9fb1eae344..a0d80536d8f6 100644 --- a/code/modules/clothing/gloves/latex.dm +++ b/code/modules/clothing/gloves/latex.dm @@ -7,7 +7,7 @@ icon_state = ICON_STATE_WORLD anomaly_shielding = 0.1 material = /decl/material/solid/organic/plastic //todo: latex - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE /obj/item/clothing/gloves/latex/nitrile name = "nitrile gloves" diff --git a/code/modules/clothing/gloves/miscellaneous.dm b/code/modules/clothing/gloves/miscellaneous.dm index 8d4f1d315e7f..d69926ce69ec 100644 --- a/code/modules/clothing/gloves/miscellaneous.dm +++ b/code/modules/clothing/gloves/miscellaneous.dm @@ -12,7 +12,7 @@ icon_state = ICON_STATE_WORLD material = /decl/material/solid/organic/plastic //TODO: rubber matter = list(/decl/material/solid/organic/cloth = MATTER_AMOUNT_REINFORCEMENT) - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE /obj/item/clothing/gloves/insulated/cheap //Cheap Chinese Crap desc = "These gloves are cheap copies of the coveted gloves, no way this can end badly." diff --git a/code/modules/clothing/gloves/thick.dm b/code/modules/clothing/gloves/thick.dm index 92a0268b4b73..2f3e6a063523 100644 --- a/code/modules/clothing/gloves/thick.dm +++ b/code/modules/clothing/gloves/thick.dm @@ -19,7 +19,7 @@ ARMOR_BOMB = ARMOR_BOMB_RESISTANT, ARMOR_BIO = ARMOR_BIO_MINOR) material = /decl/material/solid/organic/leather - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE /obj/item/clothing/gloves/thick/swat desc = "These tactical gloves are somewhat fire and impact-resistant." diff --git a/code/modules/clothing/head/fated_key.dm b/code/modules/clothing/head/fated_key.dm index 626126d50c93..7b0052e22387 100644 --- a/code/modules/clothing/head/fated_key.dm +++ b/code/modules/clothing/head/fated_key.dm @@ -26,7 +26,7 @@ if(istype(starbearer) && !canremove) name = "halo of starfire" desc = "Beware the fire of the star-bearers; it is too terrible to touch." - starbearer.add_aura(new /obj/aura/regenerating(starbearer)) + starbearer.add_mob_modifier(/decl/mob_modifier/regeneration, source = src) body_parts_covered = SLOT_UPPER_BODY|SLOT_LOWER_BODY|SLOT_LEGS|SLOT_ARMS|SLOT_HEAD|SLOT_FACE|SLOT_EYES|SLOT_HANDS|SLOT_FEET|SLOT_TAIL item_flags |= ITEM_FLAG_AIRTIGHT diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm index f47c6d25b1d7..1b86752f107d 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -22,7 +22,7 @@ material = /decl/material/solid/organic/plastic matter = list(/decl/material/solid/metal/steel = MATTER_AMOUNT_REINFORCEMENT) origin_tech = @'{"materials":1,"engineering":1,"combat":1}' - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE _base_attack_force = 5 /obj/item/clothing/head/hardhat/orange diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 3e71ff98b2c1..307574dc9aca 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -25,7 +25,7 @@ matter = list(/decl/material/solid/metal/plasteel = MATTER_AMOUNT_TRACE) origin_tech = @'{"materials":1,"engineering":1,"combat":1}' protects_against_weather = TRUE - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE _base_attack_force = 8 /obj/item/clothing/head/helmet/tactical diff --git a/code/modules/clothing/head/misc.dm b/code/modules/clothing/head/misc.dm index dd2a2d3cac89..bc558bece992 100644 --- a/code/modules/clothing/head/misc.dm +++ b/code/modules/clothing/head/misc.dm @@ -16,7 +16,7 @@ flags_inv = 0 /obj/item/clothing/head/hairflower/blue - icon = 'icons/clothing/head/hairflower/pink.dmi' + icon = 'icons/clothing/head/hairflower/blue.dmi' /obj/item/clothing/head/hairflower/pink icon = 'icons/clothing/head/hairflower/pink.dmi' /obj/item/clothing/head/hairflower/yellow diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index b4ffdd62b8f6..5a70b4bc7773 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -31,7 +31,7 @@ w_class = ITEM_SIZE_NORMAL flash_protection = FLASH_PROTECTION_MAJOR tint = TINT_HEAVY - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE accessory_slot = null // cannot be equipped on top of helmets var/up = 0 var/base_state @@ -152,16 +152,16 @@ var/plant_type = "pumpkin" // Duplicated from growns for now. TODO: move sliceability down to other objects like clay. -/obj/item/clothing/head/pumpkinhead/attackby(obj/item/W, mob/user) - if(IS_KNIFE(W) && !user.check_intent(I_FLAG_HARM)) +/obj/item/clothing/head/pumpkinhead/attackby(obj/item/used_item, mob/user) + if(IS_KNIFE(used_item) && !user.check_intent(I_FLAG_HARM)) var/datum/seed/plant = SSplants.seeds[plant_type] if(!plant) return ..() var/slice_amount = plant.slice_amount - if(W.w_class > ITEM_SIZE_NORMAL || !user.skill_check(SKILL_COOKING, SKILL_BASIC)) + if(used_item.w_class > ITEM_SIZE_NORMAL || !user.skill_check(SKILL_COOKING, SKILL_BASIC)) user.visible_message( - SPAN_NOTICE("\The [user] crudely slices \the [src] with \the [W]!"), - SPAN_NOTICE("You crudely slice \the [src] with your [W.name]!") + SPAN_NOTICE("\The [user] crudely slices \the [src] with \the [used_item]!"), + SPAN_NOTICE("You crudely slice \the [src] with your [used_item.name]!") ) slice_amount = rand(1, max(1, round(slice_amount*0.5))) else diff --git a/code/modules/clothing/jumpsuits/job.dm b/code/modules/clothing/jumpsuits/job.dm index 5c637e6e892e..b12fdf88f23b 100644 --- a/code/modules/clothing/jumpsuits/job.dm +++ b/code/modules/clothing/jumpsuits/job.dm @@ -97,14 +97,6 @@ ARMOR_BIO = ARMOR_BIO_MINOR ) -/obj/item/clothing/jumpsuit/research_director/rdalt - desc = "A dress suit and slacks stained with hard work and dedication to science. Perhaps other things as well, but mostly hard work and dedication." - name = "head researcher uniform" - icon = 'icons/clothing/uniform_rd_alt.dmi' - armor = list( - ARMOR_BIO = ARMOR_BIO_MINOR - ) - /obj/item/clothing/jumpsuit/chemist desc = "It's made of a special fiber that gives special protection against biohazards. It has a chemist rank stripe on it." name = "pharmacist's jumpsuit" @@ -216,8 +208,3 @@ matter = list( /decl/material/solid/metal/steel = MATTER_AMOUNT_TRACE ) - -/obj/item/clothing/jumpsuit/captainformal - name = "captain's formal uniform" - desc = "A captain's formal-wear, for special occasions." - icon = 'icons/clothing/uniform_captain_formal.dmi' diff --git a/code/modules/clothing/jumpsuits/misc.dm b/code/modules/clothing/jumpsuits/misc.dm index afb30f30c5a3..54fd1367f62d 100644 --- a/code/modules/clothing/jumpsuits/misc.dm +++ b/code/modules/clothing/jumpsuits/misc.dm @@ -1,41 +1,3 @@ -/obj/item/clothing/jumpsuit/mailman - name = "mailman's jumpsuit" - desc = "'Special delivery!'" - icon = 'icons/clothing/jumpsuits/jumpsuit_mailman.dmi' - -/obj/item/clothing/jumpsuit/vice - name = "vice officer's jumpsuit" - desc = "It's the standard issue pretty-boy outfit, as seen on Holo-Vision." - icon = 'icons/clothing/uniform_vice.dmi' - -/obj/item/clothing/jumpsuit/johnny - name = "brown jumpsuit" - desc = "A label on the inside of the collar reads, 'johnny~~~'." - icon = 'icons/clothing/jumpsuits/jumpsuit_johnny.dmi' - /obj/item/clothing/jumpsuit/rainbow name = "rainbow" icon = 'icons/clothing/jumpsuits/jumpsuit_rainbow.dmi' - -/obj/item/clothing/jumpsuit/psyche - name = "psychedelic jumpsuit" - desc = "Groovy!" - icon = 'icons/clothing/jumpsuits/jumpsuit_psychadelic.dmi' - -/obj/item/clothing/jumpsuit/wetsuit - name = "tactical wetsuit" - desc = "For when you want to scuba dive your way into an enemy base but still want to show off a little skin." - icon = 'icons/clothing/jumpsuits/wetsuit.dmi' - body_parts_covered = SLOT_UPPER_BODY|SLOT_LOWER_BODY - -/obj/item/clothing/jumpsuit/psysuit - name = "dark undersuit" - desc = "A thick, layered grey undersuit lined with power cables. Feels a little like wearing an electrical storm." - icon = 'icons/clothing/jumpsuits/jumpsuit_psionic.dmi' - body_parts_covered = SLOT_UPPER_BODY|SLOT_LOWER_BODY|SLOT_LEGS|SLOT_FEET|SLOT_ARMS|SLOT_HANDS - -/obj/item/clothing/jumpsuit/caretaker - name = "caretaker's jumpsuit" - desc = "A holy jumpsuit. Treat it well." - icon = 'icons/clothing/jumpsuits/caretaker.dmi' - bodytype_equip_flags = BODY_EQUIP_FLAG_HUMANOID diff --git a/code/modules/clothing/masks/chewable.dm b/code/modules/clothing/masks/chewable.dm index 682c68bc51fd..1df74f5bc5fa 100644 --- a/code/modules/clothing/masks/chewable.dm +++ b/code/modules/clothing/masks/chewable.dm @@ -210,8 +210,8 @@ /decl/material/liquid/regenerator, /decl/material/liquid/amphetamines, /decl/material/liquid/antirads, - /decl/material/liquid/stimulants, - /decl/material/liquid/antidepressants, + /decl/material/liquid/accumulated/stimulants, + /decl/material/liquid/accumulated/antidepressants, /decl/material/liquid/antitoxins, /decl/material/liquid/brute_meds, /decl/material/liquid/burn_meds, diff --git a/code/modules/clothing/masks/cig_crafting.dm b/code/modules/clothing/masks/cig_crafting.dm index 1fbe74668f2b..4ffe22101d57 100644 --- a/code/modules/clothing/masks/cig_crafting.dm +++ b/code/modules/clothing/masks/cig_crafting.dm @@ -57,8 +57,8 @@ /obj/item/food/grown/dried_tobacco/fine seed = "finetobacco" -/obj/item/clothing/mask/smokable/cigarette/rolled/attackby(obj/item/I, mob/user) - if(!istype(I, /obj/item/cigarette_filter)) +/obj/item/clothing/mask/smokable/cigarette/rolled/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/cigarette_filter)) return ..() if(filter) to_chat(user, "[src] already has a filter!") @@ -66,12 +66,12 @@ if(lit) to_chat(user, "[src] is lit already!") return TRUE - if(!user.try_unequip(I)) + if(!user.try_unequip(used_item)) return TRUE - to_chat(user, "You stick [I] into \the [src]") + to_chat(user, "You stick [used_item] into \the [src]") filter = 1 SetName("filtered [name]") brand = "[brand] with a filter" update_icon() - qdel(I) + qdel(used_item) return TRUE diff --git a/code/modules/clothing/masks/miscellaneous.dm b/code/modules/clothing/masks/miscellaneous.dm index afabff1f337f..05ee28f68f4a 100644 --- a/code/modules/clothing/masks/miscellaneous.dm +++ b/code/modules/clothing/masks/miscellaneous.dm @@ -144,34 +144,16 @@ body_parts_covered = SLOT_HEAD|SLOT_FACE|SLOT_EYES material = /decl/material/solid/organic/cloth -/obj/item/clothing/mask/rubber/barros - name = "Amaya Barros mask" - desc = "Current Secretary-General of Sol Central Government. Not that the real thing would visit this pigsty." - icon = 'icons/clothing/mask/barros.dmi' - visible_name = "Amaya Barros" - -/obj/item/clothing/mask/rubber/admiral - name = "Admiral Diwali mask" - desc = "Admiral that led the infamous last stand at Helios against the Independent Navy in the Gaia conflict. For bridge officers who wish they'd achieve a fraction of that." - icon = 'icons/clothing/mask/admiral.dmi' - visible_name = "Admiral Diwali" - -/obj/item/clothing/mask/rubber/turner - name = "Charles Turner mask" - desc = "Premier of the Gilgamesh Colonial Confederation. Probably shouldn't wear this in front of your veteran uncle." - icon = 'icons/clothing/mask/turner.dmi' - visible_name = "Charles Turner" - /obj/item/clothing/mask/rubber/species name = "human mask" desc = "A rubber human mask." icon = 'icons/clothing/mask/human.dmi' - var/species = SPECIES_HUMAN + var/species = /decl/species/human::uid /obj/item/clothing/mask/rubber/species/Initialize() . = ..() visible_name = species - var/decl/species/S = get_species_by_key(species) + var/decl/species/S = decls_repository.get_decl_by_id(species) if(istype(S)) var/decl/background_detail/C = GET_DECL(S.default_background_info[/decl/background_category/heritage]) if(istype(C)) diff --git a/code/modules/clothing/masks/smokable.dm b/code/modules/clothing/masks/smokable.dm index 4aa4fd8cb5ef..49aa63a031dd 100644 --- a/code/modules/clothing/masks/smokable.dm +++ b/code/modules/clothing/masks/smokable.dm @@ -172,24 +172,24 @@ to_chat(M, SPAN_NOTICE("Your [name] goes out.")) qdel(src) -/obj/item/clothing/mask/smokable/attackby(var/obj/item/W, var/mob/user) - if(W.isflamesource() || W.get_heat() >= T100C) +/obj/item/clothing/mask/smokable/attackby(var/obj/item/used_item, var/mob/user) + if(used_item.isflamesource() || used_item.get_heat() >= T100C) var/text = matchmes - if(istype(W, /obj/item/flame/match)) + if(istype(used_item, /obj/item/flame/match)) text = matchmes - else if(istype(W, /obj/item/flame/fuelled/lighter/zippo)) + else if(istype(used_item, /obj/item/flame/fuelled/lighter/zippo)) text = zippomes - else if(istype(W, /obj/item/flame/fuelled/lighter)) + else if(istype(used_item, /obj/item/flame/fuelled/lighter)) text = lightermes - else if(IS_WELDER(W)) + else if(IS_WELDER(used_item)) text = weldermes - else if(istype(W, /obj/item/assembly/igniter)) + else if(istype(used_item, /obj/item/assembly/igniter)) text = ignitermes else text = genericmes text = replacetext(text, "USER", "[user]") text = replacetext(text, "NAME", "[name]") - text = replacetext(text, "FLAME", "[W.name]") + text = replacetext(text, "FLAME", "[used_item.name]") light(text) return TRUE return ..() @@ -357,11 +357,11 @@ desc = "A wooden mouthpiece from a cigar. Smells rather bad." material = /decl/material/solid/organic/wood/oak -/obj/item/clothing/mask/smokable/cigarette/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/energy_blade/sword)) - var/obj/item/energy_blade/sword/S = W +/obj/item/clothing/mask/smokable/cigarette/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/energy_blade/sword)) + var/obj/item/energy_blade/sword/S = used_item if(S.active) - light(SPAN_WARNING("[user] swings their [W], barely missing their nose. They light their [name] in the process.")) + light(SPAN_WARNING("[user] swings their [used_item], barely missing their nose. They light their [name] in the process.")) return TRUE return ..() @@ -539,11 +539,11 @@ reagents.clear_reagents() SetName("empty [initial(name)]") -/obj/item/clothing/mask/smokable/pipe/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/energy_blade/sword)) // Can't light a pipe with an esword +/obj/item/clothing/mask/smokable/pipe/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/energy_blade/sword)) // Can't light a pipe with an esword return TRUE - if (istype(W, /obj/item/food/grown)) - var/obj/item/food/grown/grown = W + if (istype(used_item, /obj/item/food/grown)) + var/obj/item/food/grown/grown = used_item if (!grown.dry) to_chat(user, SPAN_NOTICE("\The [grown] must be dried before you stuff it into \the [src].")) return TRUE diff --git a/code/modules/clothing/misc/insignia.dm b/code/modules/clothing/misc/insignia.dm index f2cceb0ca979..04330b237371 100644 --- a/code/modules/clothing/misc/insignia.dm +++ b/code/modules/clothing/misc/insignia.dm @@ -10,49 +10,3 @@ /decl/clothing_state_modifier/rolled_down ) return initial_accessory_hide_on_states - -// Subtypes below. -/obj/item/clothing/insignia/christian - name = "chaplain insignia (christianity)" - desc = "An insignia worn by chaplains. The cross represents Christianity." - icon = 'icons/clothing/accessories/jewelry/religious/icon_christianity.dmi' - -/obj/item/clothing/insignia/judaism - name = "chaplain insignia (Judaism)" - desc = "An insignia worn by chaplains. The Star of David represents Judaism." - icon = 'icons/clothing/accessories/jewelry/religious/icon_judaism.dmi' - -/obj/item/clothing/insignia/islam - name = "chaplain insignia (Islam)" - desc = "An insignia worn by chaplains. The star & crescent represent Islam." - icon = 'icons/clothing/accessories/jewelry/religious/icon_islam.dmi' - -/obj/item/clothing/insignia/buddhism - name = "chaplain insignia (Buddhism)" - desc = "An insignia worn by chaplains. The Dharma Chakra represents Buddhism." - icon = 'icons/clothing/accessories/jewelry/religious/icon_buddhism.dmi' - -/obj/item/clothing/insignia/hinduism - name = "chaplain insignia (Hinduism)" - desc = "An insignia worn by chaplains. The Om represents Hinduism." - icon = 'icons/clothing/accessories/jewelry/religious/icon_hinduism.dmi' - -/obj/item/clothing/insignia/sikhism - name = "chaplain insignia (Sikhism)" - desc = "An insignia worn by chaplains. The Khanda represents Sikhism." - icon = 'icons/clothing/accessories/jewelry/religious/icon_sikh.dmi' - -/obj/item/clothing/insignia/bahaifaith - name = "chaplain insignia (Baha'i faith)" - desc = "An insignia worn by chaplains. The nine-pointed star represents the Baha'i faith." - icon = 'icons/clothing/accessories/jewelry/religious/icon_baha.dmi' - -/obj/item/clothing/insignia/jainism - name = "chaplain insignia (Jainism)" - desc = "An insignia worn by chaplains. The symbol of Ahimsa represents Jainism." - icon = 'icons/clothing/accessories/jewelry/religious/icon_jain.dmi' - -/obj/item/clothing/insignia/taoism - name = "chaplain insignia (Taoism)" - desc = "An insignia worn by chaplains. The yin yang represents Taoism." - icon = 'icons/clothing/accessories/jewelry/religious/icon_taoist.dmi' diff --git a/code/modules/clothing/neck/bowties.dm b/code/modules/clothing/neck/bowties.dm index 593be612f068..e70b3215857b 100644 --- a/code/modules/clothing/neck/bowties.dm +++ b/code/modules/clothing/neck/bowties.dm @@ -1,16 +1,16 @@ //Bowties +/obj/item/clothing/neck/tie/bow + name = "bowtie" + desc = "A neosilk hand-tied bowtie." + icon = 'icons/clothing/accessories/ties/bowtie.dmi' + /obj/item/clothing/neck/tie/bow/get_assumed_clothing_state_modifiers() var/static/list/expected_state_modifiers = list( GET_DECL(/decl/clothing_state_modifier/untied) ) return expected_state_modifiers -/obj/item/clothing/neck/tie/bow/color - name = "bowtie" - desc = "A neosilk hand-tied bowtie." - icon = 'icons/clothing/accessories/ties/bowtie.dmi' - -/obj/item/clothing/neck/tie/bow/color/red +/obj/item/clothing/neck/tie/bow/red paint_color = COLOR_RED /obj/item/clothing/neck/tie/bow/ugly diff --git a/code/modules/clothing/neck/necklace/_pendant.dm b/code/modules/clothing/neck/necklace/_pendant.dm index d29a9e6af27f..8b87b69213df 100644 --- a/code/modules/clothing/neck/necklace/_pendant.dm +++ b/code/modules/clothing/neck/necklace/_pendant.dm @@ -2,6 +2,7 @@ name = "pendant" desc = "A simple pendant." icon = 'icons/clothing/accessories/jewelry/pendants/square.dmi' + icon_state = ICON_STATE_WORLD abstract_type = /obj/item/pendant material = /decl/material/solid/metal/silver material_alteration = MAT_FLAG_ALTERATION_COLOR // We do manual name/desc handling for the gem. diff --git a/code/modules/clothing/permits/_permit.dm b/code/modules/clothing/permits/_permit.dm new file mode 100644 index 000000000000..1f42fce9e5cf --- /dev/null +++ b/code/modules/clothing/permits/_permit.dm @@ -0,0 +1,86 @@ +// Permits (drone identification, gun permit, etc) +/obj/item/clothing/permit + name = "permit" + desc = "A permit for something." + icon = 'icons/clothing/accessories/permits.dmi' + w_class = ITEM_SIZE_TINY + accessory_slot = ACCESSORY_SLOT_MEDAL + /// If set, the accents on the ID are set to this color using an overlay. + var/detail_color = COLOR_GUNMETAL + /// Each string in this list is an overlay applied to the permit icon. Example: list("goldstripe") + var/list/extra_details + /// Set to TRUE when someone names the permit by using it in hand rather than using a labeler. Prevents doing so again. + var/hand_name_used = FALSE + /// String. When set, owner is set to this on initialize. + var/default_owner = null + +/obj/item/clothing/permit/Initialize() + . = ..() + get_or_create_extension(src, /datum/extension/labels/single) + if(istext(default_owner)) + set_owner(default_owner, force = TRUE) + +/obj/item/clothing/permit/adjust_mob_overlay(var/mob/living/user_mob, var/bodytype, var/image/overlay, var/slot, var/bodypart) + if(overlay && detail_color) + overlay.overlays += overlay_image(overlay.icon, "[overlay.icon_state]-colors", detail_color, RESET_COLOR) + . = ..() + +/obj/item/clothing/permit/on_update_icon() + . = ..() + if(detail_color) + add_overlay(overlay_image(icon, "[icon_state]-colors", detail_color, RESET_COLOR)) + for(var/detail in extra_details) + add_overlay(overlay_image(icon, "[icon_state]-[detail]", flags = RESET_COLOR)) + +/obj/item/clothing/permit/attack_self(mob/living/user) + var/datum/extension/labels/label_ext = get_extension(src, /datum/extension/labels) + if(length(label_ext.labels)) + to_chat(user, SPAN_WARNING("This permit's integrated labeler can't function if a label is already present. Please remove any existing labels or blockages and try again.")) + return + if(hand_name_used) + to_chat(user, SPAN_WARNING("This permit's integrated ink cartridge has already been used. New labels must be applied manually using a hand labeler.")) + return + var/name_to_use = user.get_authentification_name(if_no_id = null) + if(!name_to_use) + to_chat(user, SPAN_WARNING("Unable to link permit with ID card. Please ensure your ID card is in range of the permit and try again.")) + return + if(alert(user, "Claim this [name] for [name_to_use]? Once you claim it, the name can only be replaced using a hand labeler.", "Claim \the [src]?", "Yes", "No") != "Yes") + return + hand_name_used = TRUE + to_chat(user, SPAN_NOTICE("You claim \the [src] for [name_to_use].")) // must be here so that the label isn't included already + set_owner(name_to_use) + +/obj/item/clothing/permit/proc/set_owner(owner_name, force = FALSE) + var/datum/extension/labels/label_ext = get_extension(src, /datum/extension/labels) + if(force) + label_ext.RemoveAllLabels() + if(!length(label_ext.labels)) + label_ext.AttachLabel(null, owner_name) + +/obj/item/clothing/permit/gun + name = "weapon permit" + desc = "A card indicating that the owner is allowed to carry a weapon." + detail_color = COLOR_NT_RED + +/obj/item/clothing/permit/gun/bar + name = "bar shotgun permit" + desc = "A card indicating that the owner is allowed to carry a shotgun in the bar." + +/obj/item/clothing/permit/gun/planetside + name = "planetside weapon permit" + desc = "A card indicating that the owner is allowed to carry a weapon while on the surface." + detail_color = COLOR_PALE_PINK + +/obj/item/clothing/permit/gun/paramedic + name = "paramedic weapon permit" + desc = "A card indicating that the owner is allowed to carry a weapon while on EVA retrieval missions." + detail_color = COLOR_SKY_BLUE + +/obj/item/clothing/permit/chaplain + name = "holy weapon permit" + desc = "A card indicating that the owner is allowed to carry a weapon for religious rites and purposes." + detail_color = COLOR_GRAY15 + +/obj/item/clothing/permit/gun/planetside/exploration + name = "explorer weapon permit" + desc = "A card indicating that the owner is allowed to carry weaponry during active exploration missions." \ No newline at end of file diff --git a/code/modules/clothing/sensors/vitals_sensor.dm b/code/modules/clothing/sensors/vitals_sensor.dm index 706d9b99dd2d..4a905ec74663 100644 --- a/code/modules/clothing/sensors/vitals_sensor.dm +++ b/code/modules/clothing/sensors/vitals_sensor.dm @@ -11,6 +11,9 @@ "Tracking beacon" ) +/obj/item/clothing/sensor/vitals/get_vitals_sensor() + return src + /obj/item/clothing/sensor/vitals/Initialize() . = ..() if(isnull(sensor_mode) || sensor_mode < VITALS_SENSOR_OFF || sensor_mode > VITALS_SENSOR_TRACKING) @@ -44,7 +47,7 @@ . = ..() update_removable() -/obj/item/clothing/sensor/vitals/on_removed(mob/user) +/obj/item/clothing/sensor/vitals/on_accessory_removed(mob/user) . = ..() update_removable() diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index ee2399b9cd40..589a7f0d79e1 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -58,11 +58,11 @@ try_remove_cuffs(user) ..() -/obj/item/clothing/shoes/attackby(var/obj/item/I, var/mob/user) - if (istype(I, /obj/item/handcuffs)) - add_cuffs(I, user) +/obj/item/clothing/shoes/attackby(var/obj/item/used_item, var/mob/user) + if (istype(used_item, /obj/item/handcuffs)) + add_cuffs(used_item, user) return TRUE - . = add_hidden(I, user) + . = add_hidden(used_item, user) if(!.) . = ..() @@ -109,8 +109,8 @@ verbs -= /obj/item/clothing/shoes/proc/try_remove_cuffs attached_cuffs = null -/obj/item/clothing/shoes/proc/add_hidden(var/obj/item/I, var/mob/user) - if (!(I.item_flags & ITEM_FLAG_CAN_HIDE_IN_SHOES)) // fail silently +/obj/item/clothing/shoes/proc/add_hidden(var/obj/item/used_item, var/mob/user) + if (!(used_item.item_flags & ITEM_FLAG_CAN_HIDE_IN_SHOES)) // fail silently return FALSE if (!can_add_hidden_item) to_chat(user, SPAN_WARNING("\The [src] can't hold anything.")) @@ -118,15 +118,15 @@ if (hidden_item) to_chat(user, SPAN_WARNING("\The [src] already holds \an [hidden_item].")) return TRUE - if (I.w_class > hidden_item_max_w_class) - to_chat(user, SPAN_WARNING("\The [I] is too large to fit in \the [src].")) + if (used_item.w_class > hidden_item_max_w_class) + to_chat(user, SPAN_WARNING("\The [used_item] is too large to fit in \the [src].")) return TRUE if (do_after(user, 1 SECONDS)) - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - user.visible_message(SPAN_ITALIC("\The [user] shoves \the [I] into \the [src]."), range = 1) + user.visible_message(SPAN_ITALIC("\The [user] shoves \the [used_item] into \the [src]."), range = 1) verbs |= /obj/item/clothing/shoes/proc/remove_hidden - hidden_item = I + hidden_item = used_item return TRUE /obj/item/clothing/shoes/proc/remove_hidden(var/mob/user) diff --git a/code/modules/clothing/spacesuits/breaches.dm b/code/modules/clothing/spacesuits/breaches.dm index 158b3754b767..87213ef88351 100644 --- a/code/modules/clothing/spacesuits/breaches.dm +++ b/code/modules/clothing/spacesuits/breaches.dm @@ -180,10 +180,10 @@ //Handles repairs (and also upgrades). -/obj/item/clothing/suit/space/attackby(obj/item/W, mob/user) - if(istype(W,/obj/item/stack/material)) +/obj/item/clothing/suit/space/attackby(obj/item/used_item, mob/user) + if(istype(used_item,/obj/item/stack/material)) var/repair_power = 0 - switch(W.get_material_type()) + switch(used_item.get_material_type()) if(/decl/material/solid/metal/steel) repair_power = 2 if(/decl/material/solid/organic/plastic) @@ -202,13 +202,13 @@ to_chat(user, "There is no surface damage on \the [src] to repair.") //maybe change the descriptor to more obvious? idk what return TRUE - var/obj/item/stack/P = W + var/obj/item/stack/P = used_item var/use_amt = min(P.get_amount(), 3) if(use_amt && P.use(use_amt)) repair_breaches(BURN, use_amt * repair_power, user) return TRUE - else if(IS_WELDER(W)) + else if(IS_WELDER(used_item)) if(ishuman(loc)) var/mob/living/human/H = loc @@ -220,15 +220,15 @@ to_chat(user, "There is no structural damage on \the [src] to repair.") return TRUE - var/obj/item/weldingtool/WT = W - if(!WT.weld(5)) + var/obj/item/weldingtool/welder = used_item + if(!welder.weld(5)) to_chat(user, SPAN_WARNING("You need more welding fuel to repair this suit.")) return TRUE repair_breaches(BRUTE, 3, user) return TRUE - else if(istype(W, /obj/item/stack/tape_roll/duct_tape)) + else if(istype(used_item, /obj/item/stack/tape_roll/duct_tape)) var/datum/breach/target_breach //Target the largest unpatched breach. for(var/datum/breach/B in breaches) if(B.patched) @@ -237,9 +237,9 @@ target_breach = B if(!target_breach) - to_chat(user, "There are no open breaches to seal with \the [W].") + to_chat(user, "There are no open breaches to seal with \the [used_item].") else - var/obj/item/stack/tape_roll/duct_tape/D = W + var/obj/item/stack/tape_roll/duct_tape/D = used_item var/amount_needed = ceil(target_breach.class * 2) if(!D.can_use(amount_needed)) to_chat(user, SPAN_WARNING("There's not enough [D.plural_name] in your [src] to seal \the [target_breach.descriptor] on \the [src]! You need at least [amount_needed] [D.plural_name].")) @@ -250,7 +250,7 @@ playsound(src, 'sound/effects/tape.ogg',25) user.visible_message( SPAN_NOTICE("\The [user] uses some [D.plural_name] to seal \the [target_breach.descriptor] on \the [src]."), - SPAN_NOTICE("You use [amount_needed] [D.plural_name] of \the [W] to seal \the [target_breach.descriptor] on \the [src].") + SPAN_NOTICE("You use [amount_needed] [D.plural_name] of \the [used_item] to seal \the [target_breach.descriptor] on \the [src].") ) target_breach.patched = TRUE target_breach.update_descriptor() diff --git a/code/modules/clothing/spacesuits/rig/modules/computer.dm b/code/modules/clothing/spacesuits/rig/modules/computer.dm index 5536a7500307..68570144c141 100644 --- a/code/modules/clothing/spacesuits/rig/modules/computer.dm +++ b/code/modules/clothing/spacesuits/rig/modules/computer.dm @@ -56,11 +56,11 @@ ) origin_tech = @'{"programming":6,"materials":5,"engineering":6}' - var/mob/integrated_ai // Direct reference to the actual mob held in the suit. + var/mob/living/integrated_ai // Direct reference to the actual mob held in the suit. var/obj/item/ai_card // Reference to the object previously holding the AI. var/obj/item/ai_verbs/verb_holder -/mob +/mob/living var/get_rig_stats = 0 /obj/item/rig_module/ai_container/Process() diff --git a/code/modules/clothing/spacesuits/rig/modules/infiltration.dm b/code/modules/clothing/spacesuits/rig/modules/infiltration.dm index 59df2f32fcbc..0fe76208c172 100644 --- a/code/modules/clothing/spacesuits/rig/modules/infiltration.dm +++ b/code/modules/clothing/spacesuits/rig/modules/infiltration.dm @@ -46,7 +46,7 @@ var/mob/living/human/H = holder.wearer - if(H.add_cloaking_source(src)) + if(H.add_mob_modifier(/decl/mob_modifier/cloaked, source = src)) anim(H, 'icons/effects/effects.dmi', "electricity",null,20,null) /obj/item/rig_module/stealth_field/deactivate() @@ -56,7 +56,7 @@ var/mob/living/human/H = holder.wearer - if(H.remove_cloaking_source(src)) + if(H.remove_mob_modifier(/decl/mob_modifier/cloaked, source = src)) anim(H,'icons/mob/mob.dmi',,"uncloak",,H.dir) anim(H, 'icons/effects/effects.dmi', "electricity",null,20,null) diff --git a/code/modules/clothing/spacesuits/rig/modules/modules.dm b/code/modules/clothing/spacesuits/rig/modules/modules.dm index 1e7b7d610017..2a8833f0c58f 100644 --- a/code/modules/clothing/spacesuits/rig/modules/modules.dm +++ b/code/modules/clothing/spacesuits/rig/modules/modules.dm @@ -69,9 +69,9 @@ if(2) . += "It is almost completely destroyed." -/obj/item/rig_module/attackby(obj/item/W, mob/user) +/obj/item/rig_module/attackby(obj/item/used_item, mob/user) - if(istype(W,/obj/item/stack/nanopaste)) + if(istype(used_item,/obj/item/stack/nanopaste)) if(damage == 0) to_chat(user, "There is no damage to mend.") @@ -79,16 +79,16 @@ to_chat(user, "You start mending the damaged portions of \the [src]...") - if(!do_after(user,30,src) || !W || !src) + if(!do_after(user,30,src) || !used_item || !src) return TRUE - var/obj/item/stack/nanopaste/paste = W + var/obj/item/stack/nanopaste/paste = used_item damage = 0 - to_chat(user, "You mend the damage to [src] with [W].") + to_chat(user, "You mend the damage to [src] with [used_item].") paste.use(1) return TRUE - else if(IS_COIL(W)) + else if(IS_COIL(used_item)) switch(damage) if(0) @@ -98,17 +98,17 @@ to_chat(user, "There is no damage that you are capable of mending with such crude tools.") return TRUE - var/obj/item/stack/cable_coil/cable = W + var/obj/item/stack/cable_coil/cable = used_item if(!cable.can_use(5)) to_chat(user, "You need five units of cable to repair \the [src].") return TRUE to_chat(user, "You start mending the damaged portions of \the [src]...") - if(!do_after(user,30,src) || !W || !src) + if(!do_after(user,30,src) || !used_item || !src) return TRUE damage = 1 - to_chat(user, "You mend some of the damage to [src] with [W], but you will need more advanced tools to fix it completely.") + to_chat(user, "You mend some of the damage to [src] with [used_item], but you will need more advanced tools to fix it completely.") cable.use(5) return TRUE return ..() diff --git a/code/modules/clothing/spacesuits/rig/modules/utility.dm b/code/modules/clothing/spacesuits/rig/modules/utility.dm index abf699315de8..b024ab15dae1 100644 --- a/code/modules/clothing/spacesuits/rig/modules/utility.dm +++ b/code/modules/clothing/spacesuits/rig/modules/utility.dm @@ -198,15 +198,15 @@ // Magical chemical filtration system, do not question it. var/total_transferred = 0 - for(var/rtype in input_item.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in input_item.reagents.reagent_volumes) for(var/chargetype in charges) var/datum/rig_charge/charge = charges[chargetype] - if(charge.product_type == rtype) - var/chems_to_transfer = REAGENT_VOLUME(input_item.reagents, rtype) + if(charge.product_type == reagent.type) + var/chems_to_transfer = REAGENT_VOLUME(input_item.reagents, reagent) if((charge.charges + chems_to_transfer) > max_reagent_volume) chems_to_transfer = max_reagent_volume - charge.charges charge.charges += chems_to_transfer - input_item.remove_from_reagents(rtype, chems_to_transfer) + input_item.remove_from_reagents(reagent, chems_to_transfer) total_transferred += chems_to_transfer break @@ -265,11 +265,11 @@ desc = "A complex web of tubing and needles suitable for hardsuit use." charges = list( - list("antidepressants", "antidepressants", /decl/material/liquid/antidepressants, 30), - list("stimulants", "stimulants", /decl/material/liquid/stimulants, 30), - list("amphetamines", "amphetamines", /decl/material/liquid/amphetamines, 30), - list("painkillers", "painkillers", /decl/material/liquid/painkillers/strong, 30), - list("glucose", "glucose", /decl/material/liquid/nutriment/glucose, 80) + list("antidepressants", "antidepressants", /decl/material/liquid/accumulated/antidepressants, 30), + list("stimulants", "stimulants", /decl/material/liquid/accumulated/stimulants, 30), + list("amphetamines", "amphetamines", /decl/material/liquid/amphetamines, 30), + list("painkillers", "painkillers", /decl/material/liquid/painkillers/strong, 30), + list("glucose", "glucose", /decl/material/liquid/nutriment/glucose, 80) ) interface_name = "combat chem dispenser" @@ -379,21 +379,21 @@ ) var/obj/item/tank/jetpack/rig/jets -/obj/item/rig_module/maneuvering_jets/attackby(obj/item/W, mob/user) - if(W.do_tool_interaction(TOOL_WRENCH, user, src, 1, "removing the propellant tank", "removing the propellant tank")) +/obj/item/rig_module/maneuvering_jets/attackby(obj/item/used_item, mob/user) + if(used_item.do_tool_interaction(TOOL_WRENCH, user, src, 1, "removing the propellant tank", "removing the propellant tank")) jets.forceMove(get_turf(user)) user.put_in_hands(jets) jets = null return TRUE - if(istype(W, /obj/item/tank/jetpack/rig)) + if(istype(used_item, /obj/item/tank/jetpack/rig)) if(jets) to_chat(user, SPAN_WARNING("There's already a propellant tank inside of \the [src]!")) return TRUE - if(user.try_unequip(W)) - to_chat(user, SPAN_NOTICE("You insert \the [W] into [src].")) - W.forceMove(src) - jets = W + if(user.try_unequip(used_item)) + to_chat(user, SPAN_NOTICE("You insert \the [used_item] into [src].")) + used_item.forceMove(src) + jets = used_item return TRUE . = ..() diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index 0eeb19c3a578..a132830f78d1 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -565,7 +565,7 @@ for(var/obj/item/thing in list(chest, boots, gloves, helmet)) thing.update_icon() - if(equipment_overlay_icon && LAZYLEN(installed_modules)) + if(equipment_overlay_icon && LAZYLEN(installed_modules) && istype(chest, /obj/item)) for(var/obj/item/rig_module/module in installed_modules) if(module.suit_overlay) chest.add_overlay(image("icon" = equipment_overlay_icon, "icon_state" = "[module.suit_overlay]", "dir" = SOUTH)) diff --git a/code/modules/clothing/spacesuits/rig/rig_attackby.dm b/code/modules/clothing/spacesuits/rig/rig_attackby.dm index 9c15918e7cab..46b880bac891 100644 --- a/code/modules/clothing/spacesuits/rig/rig_attackby.dm +++ b/code/modules/clothing/spacesuits/rig/rig_attackby.dm @@ -1,4 +1,4 @@ -/obj/item/rig/attackby(obj/item/W, mob/user) +/obj/item/rig/attackby(obj/item/used_item, mob/user) if(!isliving(user)) return FALSE @@ -7,11 +7,11 @@ return TRUE // Pass repair items on to the chestpiece. - if(chest && (istype(W,/obj/item/stack/material) || IS_WELDER(W))) - return chest.attackby(W,user) + if(chest && (istype(used_item,/obj/item/stack/material) || IS_WELDER(used_item))) + return chest.attackby(used_item,user) // Lock or unlock the access panel. - if(W.GetIdCard()) + if(used_item.GetIdCard()) if(subverted) locked = 0 to_chat(user, "It looks like the locking system has been shorted out.") @@ -30,7 +30,7 @@ to_chat(user, "You [locked ? "lock" : "unlock"] \the [src] access panel.") return TRUE - else if(IS_CROWBAR(W)) + else if(IS_CROWBAR(used_item)) if(!open && locked) to_chat(user, "The access panel is locked shut.") @@ -40,13 +40,13 @@ to_chat(user, "You [open ? "open" : "close"] the access panel.") return TRUE - else if(IS_SCREWDRIVER(W)) + else if(IS_SCREWDRIVER(used_item)) p_open = !p_open to_chat(user, "You [p_open ? "open" : "close"] the wire cover.") return TRUE // Hacking. - else if(IS_WIRECUTTER(W) || IS_MULTITOOL(W)) + else if(IS_WIRECUTTER(used_item) || IS_MULTITOOL(used_item)) if(p_open) wires.Interact(user) else @@ -57,21 +57,21 @@ // Air tank. - if(istype(W,/obj/item/tank)) //Todo, some kind of check for suits without integrated air supplies. + if(istype(used_item,/obj/item/tank)) //Todo, some kind of check for suits without integrated air supplies. if(air_supply) to_chat(user, "\The [src] already has a tank installed.") return TRUE - if(!user.try_unequip(W)) + if(!user.try_unequip(used_item)) return TRUE - air_supply = W - W.forceMove(src) - to_chat(user, "You slot [W] into [src] and tighten the connecting valve.") + air_supply = used_item + used_item.forceMove(src) + to_chat(user, "You slot [used_item] into [src] and tighten the connecting valve.") return TRUE // Check if this is a hardsuit upgrade or a modification. - else if(istype(W,/obj/item/rig_module)) + else if(istype(used_item,/obj/item/rig_module)) if(ishuman(src.loc)) var/mob/living/human/H = src.loc @@ -79,11 +79,11 @@ to_chat(user, "You can't install a hardsuit module while the suit is being worn.") return TRUE - if(is_type_in_list(W,banned_modules)) + if(is_type_in_list(used_item,banned_modules)) to_chat(user, SPAN_DANGER("\The [src] cannot mount this type of module.")) return TRUE - var/obj/item/rig_module/mod = W + var/obj/item/rig_module/mod = used_item if(!installed_modules) installed_modules = list() if(installed_modules.len) @@ -92,17 +92,17 @@ to_chat(user, SPAN_DANGER("\The [installed_mod] is incompatible with this module.")) return TRUE if(installed_mod.banned_modules.len) - if(is_type_in_list(W,installed_mod.banned_modules)) + if(is_type_in_list(used_item,installed_mod.banned_modules)) to_chat(user, SPAN_DANGER("\The [installed_mod] is incompatible with this module.")) return TRUE - if(!installed_mod.redundant && installed_mod.type == W.type) + if(!installed_mod.redundant && installed_mod.type == used_item.type) to_chat(user, "The hardsuit already has a module of that class installed.") return TRUE to_chat(user, "You begin installing \the [mod] into \the [src].") if(!do_after(user,40,src)) return TRUE - if(!user || !W) + if(!user || !used_item) return TRUE if(!user.try_unequip(mod)) return TRUE to_chat(user, "You install \the [mod] into \the [src].") @@ -112,15 +112,15 @@ update_icon() return TRUE - else if(!cell && istype(W,/obj/item/cell)) + else if(!cell && istype(used_item,/obj/item/cell)) - if(!user.try_unequip(W)) return TRUE - to_chat(user, "You jack \the [W] into \the [src]'s battery mount.") - W.forceMove(src) - src.cell = W + if(!user.try_unequip(used_item)) return TRUE + to_chat(user, "You jack \the [used_item] into \the [src]'s battery mount.") + used_item.forceMove(src) + src.cell = used_item return TRUE - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) var/list/current_mounts = list() if(cell) current_mounts += "cell" @@ -182,8 +182,8 @@ installed_modules -= removed update_icon() - else if(istype(W,/obj/item/stack/nanopaste)) //EMP repair - var/obj/item/stack/S = W + else if(istype(used_item,/obj/item/stack/nanopaste)) //EMP repair + var/obj/item/stack/S = used_item if(malfunctioning || malfunction_delay) if(S.use(1)) to_chat(user, "You pour some of \the [S] over \the [src]'s control circuitry and watch as the nanites do their work with impressive speed and precision.") @@ -198,7 +198,7 @@ // If we've gotten this far, all we have left to do before we pass off to root procs // is check if any of the loaded modules want to use the item we've been given. for(var/obj/item/rig_module/module in installed_modules) - if(module.accepts_item(W,user)) //Item is handled in this proc + if(module.accepts_item(used_item,user)) //Item is handled in this proc return TRUE return ..() diff --git a/code/modules/clothing/spacesuits/spacesuits.dm b/code/modules/clothing/spacesuits/spacesuits.dm index 95b0612b4f9e..3f1787a89264 100644 --- a/code/modules/clothing/spacesuits/spacesuits.dm +++ b/code/modules/clothing/spacesuits/spacesuits.dm @@ -26,7 +26,7 @@ brightness_on = 4 light_wedge = LIGHT_WIDE on = 0 - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_KEEP var/obj/machinery/camera/camera var/tinted = null //Set to non-null for toggleable tint helmets @@ -60,10 +60,10 @@ if(ispath(camera)) camera = new camera(src) - camera.set_status(0) + camera.set_camera_status(0) if(camera) - camera.set_status(!camera.status) + camera.set_camera_status(!camera.status) if(camera.status) camera.c_tag = user.get_id_name() to_chat(user, "User scanned as [camera.c_tag]. Camera activated.") @@ -144,7 +144,7 @@ /decl/material/solid/organic/plastic = MATTER_AMOUNT_REINFORCEMENT ) protects_against_weather = TRUE - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_KEEP /obj/item/clothing/suit/space/Initialize() . = ..() diff --git a/code/modules/clothing/spacesuits/void/void.dm b/code/modules/clothing/spacesuits/void/void.dm index 37c5d360b4d2..6155cf7da0a0 100644 --- a/code/modules/clothing/spacesuits/void/void.dm +++ b/code/modules/clothing/spacesuits/void/void.dm @@ -183,7 +183,7 @@ else if(##equipment_var) {\ to_chat(H, "You cannot deploy your helmet while wearing \the [head].") return if(H.equip_to_slot_if_possible(helmet, slot_head_str)) - helmet.on_picked_up(H) + helmet.on_picked_up(H, src) helmet.canremove = 0 playsound(loc, helmet_deploy_sound, 30) to_chat(H, "You deploy your suit helmet, sealing you off from the world.") @@ -216,9 +216,9 @@ else if(##equipment_var) {\ src.tank = null playsound(loc, 'sound/effects/spray3.ogg', 50) -/obj/item/clothing/suit/space/void/attackby(obj/item/W, mob/user) +/obj/item/clothing/suit/space/void/attackby(obj/item/used_item, mob/user) - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) if(user.get_equipped_slot_for_item(src) == slot_wear_suit_str)//maybe I should make this into a proc? to_chat(user, "You cannot modify \the [src] while it is being worn.") else if(helmet || boots || tank) @@ -241,36 +241,36 @@ else if(##equipment_var) {\ to_chat(user, "\The [src] does not have anything installed.") return TRUE - if(istype(W,/obj/item/clothing/head/helmet/space)) + if(istype(used_item,/obj/item/clothing/head/helmet/space)) if(user.get_equipped_slot_for_item(src) == slot_wear_suit_str) to_chat(user, "You cannot modify \the [src] while it is being worn.") else if(helmet) to_chat(user, "\The [src] already has a helmet installed.") - else if(user.try_unequip(W, src)) - to_chat(user, "You attach \the [W] to \the [src]'s helmet mount.") - src.helmet = W + else if(user.try_unequip(used_item, src)) + to_chat(user, "You attach \the [used_item] to \the [src]'s helmet mount.") + src.helmet = used_item playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) return TRUE - if(istype(W,/obj/item/clothing/shoes/magboots)) + if(istype(used_item,/obj/item/clothing/shoes/magboots)) if(user.get_equipped_slot_for_item(src) == slot_wear_suit_str) to_chat(user, "You cannot modify \the [src] while it is being worn.") else if(boots) to_chat(user, "\The [src] already has magboots installed.") - else if(user.try_unequip(W, src)) - to_chat(user, "You attach \the [W] to \the [src]'s boot mounts.") - boots = W + else if(user.try_unequip(used_item, src)) + to_chat(user, "You attach \the [used_item] to \the [src]'s boot mounts.") + boots = used_item playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) return TRUE - if(istype(W,/obj/item/tank)) + if(istype(used_item,/obj/item/tank)) if(user.get_equipped_slot_for_item(src) == slot_wear_suit_str) to_chat(user, "You cannot modify \the [src] while it is being worn.") else if(tank) to_chat(user, "\The [src] already has an airtank installed.") - else if(user.try_unequip(W, src)) - to_chat(user, "You insert \the [W] into \the [src]'s storage compartment.") - tank = W + else if(user.try_unequip(used_item, src)) + to_chat(user, "You insert \the [used_item] into \the [src]'s storage compartment.") + tank = used_item playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) return TRUE diff --git a/code/modules/clothing/suits/armor/_armor.dm b/code/modules/clothing/suits/armor/_armor.dm index eef73b5c8fa4..32f489cbc111 100644 --- a/code/modules/clothing/suits/armor/_armor.dm +++ b/code/modules/clothing/suits/armor/_armor.dm @@ -29,5 +29,5 @@ siemens_coefficient = 0.6 blood_overlay_type = "armor" origin_tech = @'{"materials":1,"engineering":1,"combat":1}' - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE _base_attack_force = 5 diff --git a/code/modules/clothing/suits/armor/forged/_forged.dm b/code/modules/clothing/suits/armor/forged/_forged.dm index 8a9b2aa3db4d..d04b1a7c84e6 100644 --- a/code/modules/clothing/suits/armor/forged/_forged.dm +++ b/code/modules/clothing/suits/armor/forged/_forged.dm @@ -2,6 +2,7 @@ abstract_type = /obj/item/clothing/suit/armor/forged icon_state = ICON_STATE_WORLD material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color material_alteration = MAT_FLAG_ALTERATION_ALL armor_degradation_speed = 1 armor_type = /datum/extension/armor/ablative diff --git a/code/modules/clothing/suits/armor/forged/plate.dm b/code/modules/clothing/suits/armor/forged/plate.dm index dbd83bd806db..362908c31c1a 100644 --- a/code/modules/clothing/suits/armor/forged/plate.dm +++ b/code/modules/clothing/suits/armor/forged/plate.dm @@ -11,6 +11,7 @@ desc = "A form of segmented armor that covers the hands and arms, typically worn as part of plate mail." icon = 'icons/clothing/plate_armour/vambrace.dmi' material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color material_alteration = MAT_FLAG_ALTERATION_ALL body_parts_covered = SLOT_HANDS|SLOT_ARMS accessory_slot = ACCESSORY_SLOT_GREAVES @@ -20,6 +21,7 @@ desc = "Segmented armour that protects the feet and legs, typically worn as part of plate mail." icon = 'icons/clothing/plate_armour/sabatons.dmi' material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color material_alteration = MAT_FLAG_ALTERATION_ALL body_parts_covered = SLOT_FEET|SLOT_LOWER_BODY|SLOT_LEGS accessory_slot = ACCESSORY_SLOT_GAUNTLETS @@ -29,6 +31,7 @@ desc = "A visored helmet that covers the entire face and skull." icon = 'icons/clothing/plate_armour/helm.dmi' material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color material_alteration = MAT_FLAG_ALTERATION_ALL markings_color = COLOR_PURPLE markings_state_modifier = "-plume" diff --git a/code/modules/clothing/suits/bio.dm b/code/modules/clothing/suits/bio.dm index bce77c8c0725..5ebee0a05689 100644 --- a/code/modules/clothing/suits/bio.dm +++ b/code/modules/clothing/suits/bio.dm @@ -17,7 +17,7 @@ /decl/material/solid/organic/plastic = MATTER_AMOUNT_REINFORCEMENT, /decl/material/solid/metal/silver = MATTER_AMOUNT_REINFORCEMENT ) - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_KEEP /obj/item/clothing/suit/bio_suit name = "bio suit" @@ -40,7 +40,7 @@ /decl/material/solid/organic/plastic = MATTER_AMOUNT_REINFORCEMENT, /decl/material/solid/metal/silver = MATTER_AMOUNT_REINFORCEMENT ) - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_KEEP /obj/item/clothing/suit/bio_suit/Initialize() . = ..() diff --git a/code/modules/clothing/suits/jackets/letterman.dm b/code/modules/clothing/suits/jackets/letterman.dm index fad6634e1e13..5dde2a967eaa 100644 --- a/code/modules/clothing/suits/jackets/letterman.dm +++ b/code/modules/clothing/suits/jackets/letterman.dm @@ -3,7 +3,7 @@ desc = "A letter jacket often given to members of a varsity team." color = "#ee1511" icon = 'icons/clothing/suits/letterman.dmi' - markings_state_modifier = "_sleeves" + markings_state_modifier = "-sleeves" markings_color = "#ffffff" /obj/item/clothing/suit/jacket/letterman/red diff --git a/code/modules/clothing/suits/labcoat.dm b/code/modules/clothing/suits/labcoat.dm index 764b696000de..debe4b4097b7 100644 --- a/code/modules/clothing/suits/labcoat.dm +++ b/code/modules/clothing/suits/labcoat.dm @@ -24,7 +24,7 @@ ) valid_accessory_slots = list(ACCESSORY_SLOT_ARMBAND) restricted_accessory_slots = list(ACCESSORY_SLOT_ARMBAND) - markings_state_modifier = "_marking" + markings_state_modifier = "-marking" matter = list(/decl/material/solid/metal/silver = MATTER_AMOUNT_TRACE) origin_tech = @'{"materials":1,"engineering":1,"biotech":1}' @@ -36,6 +36,7 @@ name = "chief medical officer labcoat" desc = "A labcoat with command blue highlights." icon = 'icons/clothing/suits/labcoat/cmo.dmi' + markings_state_modifier = null /obj/item/clothing/suit/toggle/labcoat/mad name = "The Mad's labcoat" @@ -57,6 +58,7 @@ /obj/item/clothing/suit/toggle/labcoat/blue name = "blue-edged labcoat" icon = 'icons/clothing/suits/labcoat/blue_edge.dmi' + markings_state_modifier = null /obj/item/clothing/suit/toggle/labcoat/coat name = "coat" @@ -73,4 +75,3 @@ icon = 'icons/clothing/suits/labcoat/rd.dmi' body_parts_covered = SLOT_UPPER_BODY|SLOT_LOWER_BODY|SLOT_LEGS|SLOT_ARMS markings_color = COLOR_BOTTLE_GREEN - markings_state_modifier = "_marking" diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index b7bb868f7774..4394643b6e5e 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -2,7 +2,7 @@ /obj/item/clothing/suit/toggle abstract_type = /obj/item/clothing/suit/toggle storage = /datum/storage/pockets/suit - replaced_in_loadout = FALSE + replaced_in_loadout = LOADOUT_CONFLICT_STORAGE /obj/item/clothing/suit/toggle/get_assumed_clothing_state_modifiers() var/static/list/expected_state_modifiers = list( diff --git a/code/modules/clothing/webbing/holster.dm b/code/modules/clothing/webbing/holster.dm index c607d16c13e9..9269f35844ed 100644 --- a/code/modules/clothing/webbing/holster.dm +++ b/code/modules/clothing/webbing/holster.dm @@ -36,7 +36,7 @@ if(istype(holder)) holder.verbs |= /atom/proc/holster_verb -/obj/item/clothing/webbing/holster/on_removed(mob/user) +/obj/item/clothing/webbing/holster/on_accessory_removed(mob/user) var/obj/item/clothing/holder = loc if(istype(holder)) var/remove_verb = TRUE diff --git a/code/modules/codex/categories/category_cultures.dm b/code/modules/codex/categories/category_cultures.dm index 3c51bbf65f42..0aef22c0c0cd 100644 --- a/code/modules/codex/categories/category_cultures.dm +++ b/code/modules/codex/categories/category_cultures.dm @@ -1,5 +1,5 @@ /decl/codex_category/cultures - name = "Factions and Culture" + name = "Places, Factions and Culture" desc = "Prominent planets, cultures, factions and religions of known space." /decl/codex_category/cultures/Populate() diff --git a/code/modules/codex/categories/category_recipes.dm b/code/modules/codex/categories/category_recipes.dm index caf8064f577f..46403278f40d 100644 --- a/code/modules/codex/categories/category_recipes.dm +++ b/code/modules/codex/categories/category_recipes.dm @@ -33,13 +33,18 @@ if(!product) continue category_name = "mix recipe" - lore_text = initial(product.desc) - mechanics_text = "This recipe produces \a [initial(product.name)].
    It should be performed in a mixing bowl or beaker, and requires the following ingredients:" + var/product_name = initial(product.name) + if(ispath(product, /atom/movable) && TYPE_IS_SPAWNABLE(product)) + product_name = atom_info_repository.get_name_for(product) + lore_text = atom_info_repository.get_description_for(product) + else + lore_text = initial(product.desc) + mechanics_text = "This recipe produces \a [product_name].
    It should be performed in a mixing bowl or beaker, and requires the following ingredients:" else var/decl/material/product = GET_DECL(food.result) if(!product) continue - lore_text = initial(product.lore_text) + lore_text = product.lore_text if(ispath(food.result, /decl/material/liquid/drink) || ispath(food.result, /decl/material/liquid/alcohol)) category_name = "drink recipe" mechanics_text = "This recipe produces [food.result_amount]u [product.name].
    It should be performed in a glass or shaker, and requires the following ingredients:" @@ -84,13 +89,18 @@ for(var/thing in recipe.reagents) var/decl/material/thing_reagent = GET_DECL(thing) ingredients += "[recipe.reagents[thing]]u [thing_reagent.name]" - for(var/thing in recipe.items) - var/atom/thing_atom = thing + for(var/atom/thing as anything in recipe.items) var/count = recipe.items[thing] - var/thing_name = initial(thing_atom.name) + var/thing_name = initial(thing.name) + if(ispath(thing, /atom/movable) && TYPE_IS_SPAWNABLE(thing)) + thing_name = atom_info_repository.get_name_for(thing) if(SScodex.get_entry_by_string(thing_name)) thing_name = "[thing_name]" - ingredients += (count > 1) ? "[count]x [thing_name]" : "\a [initial(thing_atom.name)]" + else + var/datum/codex_entry/result_entry = SScodex.get_codex_entry(thing) + if(result_entry) + thing_name = "[thing_name]" + ingredients += (count > 1) ? "[count]x [thing_name]" : "\a [thing_name]" for(var/thing in recipe.fruit) ingredients += "[recipe.fruit[thing]] [thing]\s" mechanics_text += "
    • [jointext(ingredients, "
    • ")]
    " @@ -100,13 +110,25 @@ cooking_methods += "\a [cooking_method]" var/atom/recipe_product = recipe.result - mechanics_text += "
    This recipe takes [ceil(recipe.cooking_time/10)] second\s to cook in [english_list(cooking_methods, and_text = " or ")] and creates \a [initial(recipe_product.name)]." + var/product_name + var/product_link var/lore_text = recipe.lore_text - if(!lore_text) - lore_text = initial(recipe_product.desc) + if(ispath(recipe_product, /atom/movable) && TYPE_IS_SPAWNABLE(recipe_product)) + product_name = atom_info_repository.get_name_for(recipe_product) + lore_text ||= atom_info_repository.get_description_for(recipe_product) + else if(ispath(recipe.result, /decl/material)) + var/decl/material/result_reagent = GET_DECL(recipe.result) + product_name = result_reagent.use_name + product_link = "some [product_name]" + lore_text ||= result_reagent.lore_text + else // some things can't be spawned by the atom info repository because they need extra args we can't pass + product_name = initial(recipe_product.name) + lore_text ||= initial(recipe_product.desc) + product_link ||= "\a [product_name]" + mechanics_text += "
    This recipe takes [ceil(recipe.cooking_time/(1 SECOND))] second\s to cook in [english_list(cooking_methods, and_text = " or ")] and creates [product_link]." - var/recipe_name = recipe.display_name || sanitize(initial(recipe_product.name)) - guide_html += "

    [capitalize(recipe_name)]

    Cook [english_list(ingredients)] for [ceil(recipe.cooking_time/10)] second\s." + var/recipe_name = recipe.display_name || sanitize(product_name) + guide_html += "

    [capitalize(recipe_name)]

    Cook [english_list(ingredients)] for [ceil(recipe.cooking_time/(1 SECOND))] second\s." entries_to_register += new /datum/codex_entry( \ _display_name = "[recipe_name] (cooking recipe)", \ diff --git a/code/modules/codex/categories/category_species.dm b/code/modules/codex/categories/category_species.dm index c35f3bce307b..d0ca4089cb5f 100644 --- a/code/modules/codex/categories/category_species.dm +++ b/code/modules/codex/categories/category_species.dm @@ -4,10 +4,8 @@ /decl/codex_category/species/Populate() - for(var/thing in get_all_species()) - var/decl/species/species = get_species_by_key(thing) + for(var/decl/species/species as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) if(!species.hidden_from_codex) - var/entry_type = (species.secret_codex_info) ? /datum/codex_entry/scannable : /datum/codex_entry var/datum/codex_entry/entry = new entry_type( _display_name = "[species.name] (species)", diff --git a/code/modules/codex/categories/category_substances.dm b/code/modules/codex/categories/category_substances.dm index e8c96d49b729..acd97e206bcb 100644 --- a/code/modules/codex/categories/category_substances.dm +++ b/code/modules/codex/categories/category_substances.dm @@ -3,13 +3,13 @@ desc = "Various natural and artificial substances." /decl/codex_category/substances/Populate() - - for(var/decl/material/mat as anything in SSmaterials.materials) + var/list/decl/material/alphabetized_materials = sortTim(decls_repository.get_decls_of_subtype_unassociated(/decl/material), /proc/cmp_name_asc) + for(var/decl/material/mat as anything in alphabetized_materials) if(mat.hidden_from_codex) continue - var/new_lore_text = initial(mat.lore_text) + var/new_lore_text = mat.lore_text if(mat.taste_description) if(new_lore_text) new_lore_text = "[new_lore_text]

    " @@ -35,16 +35,15 @@ var/decl/material/catalyst = GET_DECL(catalyst_id) catalysts += "[reaction.catalysts[catalyst_id]]u [catalyst.name]" - var/decl/material/result = reaction.result var/mix_link = "Mixing" if(istype(reaction, /decl/chemical_reaction/alloy)) mix_link = "Alloying" mix_link = "[mix_link]" if(catalysts.len) - production_strings += "[mix_link] [english_list(reactant_values)], catalyzed by [english_list(catalysts)], producing [reaction.result_amount]u [lowertext(initial(result.name))]." + production_strings += "[mix_link] [english_list(reactant_values)], catalyzed by [english_list(catalysts)], producing [reaction.result_amount]u [mat.name]." else - production_strings += "[mix_link] [english_list(reactant_values)], producing [reaction.result_amount]u [lowertext(initial(result.name))]." + production_strings += "[mix_link] [english_list(reactant_values)], producing [reaction.result_amount]u [mat.name]." // Todo: smelting and compressing if(length(production_strings)) @@ -67,8 +66,11 @@ if(mat.dissolves_in != MAT_SOLVENT_IMMUNE && LAZYLEN(mat.dissolves_into)) var/chems = list() for(var/chemical in mat.dissolves_into) - var/decl/material/R = chemical - chems += "[initial(R.name)] ([mat.dissolves_into[chemical]*100]%)" + var/decl/material/material = GET_DECL(chemical) + var/material_link = "[material.name]" + if(material.hidden_from_codex) + material_link = material.name + chems += "[material_link] ([mat.dissolves_into[chemical]*100]%)" var/solvent_needed if(mat.dissolves_in <= MAT_SOLVENT_NONE) solvent_needed = "any liquid" diff --git a/code/modules/codex/codex_cataloguer.dm b/code/modules/codex/codex_cataloguer.dm index 2d9dc6a4803c..a465ab387b48 100644 --- a/code/modules/codex/codex_cataloguer.dm +++ b/code/modules/codex/codex_cataloguer.dm @@ -100,14 +100,14 @@ return TRUE return ..() -/obj/item/cataloguer/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/disk/survey)) +/obj/item/cataloguer/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/disk/survey)) if(loaded_disk) to_chat(user, SPAN_WARNING("\The [src] already has a disk loaded.")) - else if(user.try_unequip(W, src)) - loaded_disk = W + else if(user.try_unequip(used_item, src)) + loaded_disk = used_item playsound(user.loc, 'sound/weapons/flipblade.ogg', 50, 1) - to_chat(user, SPAN_NOTICE("You slot \the [W] into \the [src].")) + to_chat(user, SPAN_NOTICE("You slot \the [used_item] into \the [src].")) return TRUE return ..() diff --git a/code/modules/codex/entries/_codex_entry.dm b/code/modules/codex/entries/_codex_entry.dm index 3aad339753be..62f5b134b64e 100644 --- a/code/modules/codex/entries/_codex_entry.dm +++ b/code/modules/codex/entries/_codex_entry.dm @@ -46,9 +46,11 @@ if(_antag_text) antag_text = _antag_text if(store_codex_entry && length(associated_paths)) - for(var/tpath in associated_paths) - var/atom/thing = tpath - var/thing_name = codex_sanitize(initial(thing.name)) + for(var/atom/thing as anything in associated_paths) + var/thing_name = initial(thing.name) + if(ispath(thing, /atom/movable) && TYPE_IS_SPAWNABLE(thing)) + thing_name = atom_info_repository.get_name_for(thing) + thing_name = codex_sanitize(thing_name) if(disambiguator) thing_name = "[thing_name] ([disambiguator])" LAZYDISTINCTADD(associated_strings, thing_name) diff --git a/code/modules/codex/entries/atmospherics.dm b/code/modules/codex/entries/atmospherics.dm index 5b0b67fb8fbf..4c7e8993f078 100644 --- a/code/modules/codex/entries/atmospherics.dm +++ b/code/modules/codex/entries/atmospherics.dm @@ -147,7 +147,7 @@ /datum/codex_entry/transfer_valve associated_paths = list(/obj/item/transfer_valve) mechanics_text = "This machine is used to merge the contents of two different gas tanks. Plug the tanks into the transfer, then open the valve to mix them together. You can also attach various assembly devices to trigger this process." - antag_text = "With a tank of hot hydrogen and cold oxygen, this benign little atmospheric device becomes an incredibly deadly bomb. You don't want to be anywhere near it when it goes off." + antag_text = "With a tank of hot accelerant and cold oxidiser, this benign little atmospheric device becomes an incredibly deadly bomb. You don't want to be anywhere near it when it goes off." disambiguator = "component" available_to_map_tech_level = MAP_TECH_LEVEL_SPACE diff --git a/code/modules/crafting/handmade_items.dm b/code/modules/crafting/handmade_items.dm index 93ae530b1134..75a8ac9650f2 100644 --- a/code/modules/crafting/handmade_items.dm +++ b/code/modules/crafting/handmade_items.dm @@ -2,6 +2,7 @@ abstract_type = /obj/item/chems/glass/handmade icon_state = ICON_STATE_WORLD material = /decl/material/solid/stone/pottery + color = /decl/material/solid/stone/pottery::color material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME presentation_flags = PRESENTATION_FLAG_NAME diff --git a/code/modules/crafting/metalwork/metalwork_items.dm b/code/modules/crafting/metalwork/metalwork_items.dm index 5278aaf343ec..2727db4ada8f 100644 --- a/code/modules/crafting/metalwork/metalwork_items.dm +++ b/code/modules/crafting/metalwork/metalwork_items.dm @@ -17,7 +17,6 @@ material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME storage = /datum/storage/crucible obj_flags = OBJ_FLAG_NO_STORAGE - var/max_held = 10 /obj/item/chems/crucible/attackby(obj/item/used_item, mob/user) diff --git a/code/modules/crafting/pottery/pottery_moulds.dm b/code/modules/crafting/pottery/pottery_moulds.dm index 0075f90ea29f..6057a7a626a3 100644 --- a/code/modules/crafting/pottery/pottery_moulds.dm +++ b/code/modules/crafting/pottery/pottery_moulds.dm @@ -57,7 +57,7 @@ else QDEL_NULL(reagents) -/obj/item/chems/mould/attackby(obj/item/W, mob/user) +/obj/item/chems/mould/attackby(obj/item/used_item, mob/user) if(user.check_intent(I_FLAG_HARM)) return ..() @@ -65,20 +65,20 @@ // This is kind of gross but getting /chems/attackby() // standard_pour_into() to cooperate is a bit beyond me // at the moment. - if(istype(W, /obj/item/chems/crucible)) + if(istype(used_item, /obj/item/chems/crucible)) if(material?.hardness <= MAT_VALUE_MALLEABLE) to_chat(user, SPAN_WARNING("\The [src] is currently too soft to be used as a mould.")) return TRUE - var/obj/item/chems/vessel = W + var/obj/item/chems/vessel = used_item if(vessel.standard_pour_into(user, src)) return TRUE - if(try_crack_mold(user, W)) + if(try_crack_mold(user, used_item)) return TRUE - if(try_take_impression(user, W)) + if(try_take_impression(user, used_item)) return TRUE return ..() @@ -96,8 +96,7 @@ to_chat(user, SPAN_WARNING("\The [src] is not full yet!")) return TRUE - for(var/reagent_type in reagents.reagent_volumes) - var/decl/material/reagent = GET_DECL(reagent_type) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) if(reagent.melting_point && temperature >= reagent.melting_point) to_chat(user, SPAN_WARNING("The contents of \the [src] are still molten! Wait for it to cool down.")) return TRUE @@ -116,11 +115,11 @@ product.dropInto(loc) reagents.remove_reagent(product_mat.type, REAGENT_VOLUME(reagents, product_mat.type)) - for(var/reagent_type in reagents.reagent_volumes) - if(reagent_type == product_mat.type) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(reagent.type == product_mat.type) continue LAZYINITLIST(product.matter) - product.matter[reagent_type] += max(1, round(reagents.reagent_volumes[reagent_type] / REAGENT_UNITS_PER_MATERIAL_UNIT)) + product.matter[reagent.type] += max(1, round(reagents.reagent_volumes[reagent] / REAGENT_UNITS_PER_MATERIAL_UNIT)) reagents.clear_reagents() if(length(product_metadata)) product.take_mould_metadata(product_metadata) diff --git a/code/modules/crafting/slapcrafting/_crafting_holder.dm b/code/modules/crafting/slapcrafting/_crafting_holder.dm index 4cb7990226cb..28a469af87f6 100644 --- a/code/modules/crafting/slapcrafting/_crafting_holder.dm +++ b/code/modules/crafting/slapcrafting/_crafting_holder.dm @@ -62,19 +62,19 @@ qdel(src) return TRUE -/obj/item/crafting_holder/try_slapcrafting(obj/item/W, mob/user) +/obj/item/crafting_holder/try_slapcrafting(obj/item/used_item, mob/user) if(current_crafting_stage) - var/decl/crafting_stage/next_stage = current_crafting_stage.get_next_stage(W) - if(next_stage && next_stage.is_appropriate_tool(W, src) && next_stage.is_sufficient_amount(user, W) && next_stage.progress_to(W, user, src)) - advance_to(next_stage, user, W) + var/decl/crafting_stage/next_stage = current_crafting_stage.get_next_stage(used_item) + if(next_stage && next_stage.is_appropriate_tool(used_item, src) && next_stage.is_sufficient_amount(user, used_item) && next_stage.progress_to(used_item, user, src)) + advance_to(next_stage, user, used_item) return TRUE return FALSE -/obj/item/crafting_holder/attackby(var/obj/item/W, var/mob/user) +/obj/item/crafting_holder/attackby(var/obj/item/used_item, var/mob/user) - if(IS_PEN(W)) + if(IS_PEN(used_item)) var/new_label = sanitize_safe(input(user, "What do you wish to label this assembly?", "Assembly Labelling", label_name), MAX_NAME_LEN) - if(new_label && !user.incapacitated() && W.loc == user && user.Adjacent(src) && !QDELETED(src)) + if(new_label && !user.incapacitated() && used_item.loc == user && user.Adjacent(src) && !QDELETED(src)) to_chat(user, SPAN_NOTICE("You label \the [src] with '[new_label]'.")) label_name = new_label return TRUE diff --git a/code/modules/crafting/stack_recipes/_recipe.dm b/code/modules/crafting/stack_recipes/_recipe.dm index 527af535c37f..205948de85e2 100644 --- a/code/modules/crafting/stack_recipes/_recipe.dm +++ b/code/modules/crafting/stack_recipes/_recipe.dm @@ -23,9 +23,6 @@ var/gender /// Object path to the desired product. var/result_type - /// Object path to use in unit testing; leave null to use result_type instead. - /// Useful for items that require a material to Initialize() correctly as testing tries to use a null material. - var/test_result_type /// Amount of matter units needed for this recipe. If null, generates from result matter. var/req_amount /// Time it takes for this recipe to be crafted (not including skill and tool modifiers). If null, generates from product w_class and difficulty. @@ -78,6 +75,10 @@ /// Can this recipe use a reinforced material? Set to type for a specific material. var/required_reinforce_material = MATERIAL_FORBIDDEN + /// In cases where required_material is MATERIAL_REQUIRED and not a typepath, + /// this is the material type used for setup, validation, and tests. + var/validation_material + /// Minimum material wall support value. var/required_wall_support_value /// Minimum material integrity value. @@ -131,17 +132,29 @@ else if(!ispath(result_type, expected_product_type)) . += "result type [result_type || "NULL"] is not subtype of expected product type [expected_product_type || "NULL"]" - if(isnull(required_material) || required_material == MATERIAL_FORBIDDEN) - if(!isnull(required_wall_support_value)) - . += "null required material but non-null wall support value" - if(!isnull(required_integrity)) - . += "null required material but non-null integrity value" - if(!isnull(required_max_opacity)) - . += "null required material but non-null max opacity value" - if(!isnull(required_min_hardness)) - . += "null required material but non-null min hardness value" - if(!isnull(required_max_hardness)) - . += "null required material but non-null max hardness value" + switch(required_material) + if(null) + . += "null required material value is deprecated, use MATERIAL_FORBIDDEN" + if(MATERIAL_FORBIDDEN) + if(!isnull(validation_material)) + . += "material is forbidden but non-null validation material" + if(!isnull(required_wall_support_value)) + . += "material is forbidden but non-null wall support value" + if(!isnull(required_integrity)) + . += "material is forbidden but non-null integrity value" + if(!isnull(required_max_opacity)) + . += "material is forbidden but non-null max opacity value" + if(!isnull(required_min_hardness)) + . += "material is forbidden but non-null min hardness value" + if(!isnull(required_max_hardness)) + . += "material is forbidden but non-null max hardness value" + if(MATERIAL_REQUIRED) + if(isnull(validation_material)) + . += "material is required but validation material was null" + else + var/list/material_failures = get_missing_material_properties(RESOLVE_TO_DECL(validation_material)) + if(LAZYLEN(material_failures)) + . += "validation material is [english_list(material_failures)]" // 'material is too soft, too opaque, and unable to support enough weight' if(recipe_skill && !isnull(difficulty)) var/decl/skill/used_skill = GET_DECL(recipe_skill) @@ -162,8 +175,13 @@ if((stack_type in check_craft_stack_types) && (stack_type in check_forbidden_craft_stack_types)) . += "[stack_type] is in both forbidden and craftable stack types" -/decl/stack_recipe/proc/get_required_stack_amount(obj/item/stack/stack) - return max(1, ceil(req_amount / max(1, (SHEET_MATERIAL_AMOUNT * stack?.matter_multiplier)))) +/// Returns the required stack units to create product_amount products (default 1). +/decl/stack_recipe/proc/get_required_stack_amount(obj/item/stack/stack, product_amount = 1) + /// The number of sheets, unrounded, to produce a single unit of product. May be less than 1. + var/sheets_per_product = req_amount / ceil(SHEET_MATERIAL_AMOUNT * stack.matter_multiplier) + var/total_needed = sheets_per_product * product_amount + // We can't use less than 1 sheet, or only part of a sheet, so we have to round up. + return max(1, ceil(total_needed)) /decl/stack_recipe/proc/get_list_display(mob/user, obj/item/stack/stack, datum/stack_recipe_list/sublist) @@ -230,6 +248,21 @@ . = JOINTEXT(.) +/// Returns a list of descriptive error strings e.g. "too soft/hard/opaque" if material properties are not satisfied. +/decl/stack_recipe/proc/get_missing_material_properties(decl/material/mat) + ASSERT(mat) + // Check if the material has the appropriate properties. + if(!isnull(required_wall_support_value) && mat.wall_support_value < required_wall_support_value) + LAZYADD(., "unable to support enough weight") + if(!isnull(required_integrity) && mat.integrity < required_integrity) + LAZYADD(., "too weak") + if(!isnull(required_min_hardness) && mat.hardness < required_min_hardness) + LAZYADD(., "too soft") + if(!isnull(required_max_hardness) && mat.hardness > required_max_hardness) + LAZYADD(., "too hard") + if(!isnull(required_max_opacity) && mat.opacity > required_max_opacity) + LAZYADD(., "too opaque") + /decl/stack_recipe/proc/can_be_made_from(stack_type, tool_type, decl/material/mat, decl/material/reinf_mat) // Early checks to avoid letting recipes make themselves. @@ -254,17 +287,8 @@ return FALSE // Check if the material has the appropriate properties. - if(mat) - if(!isnull(required_wall_support_value) && mat.wall_support_value < required_wall_support_value) - return FALSE - if(!isnull(required_integrity) && mat.integrity < required_integrity) - return FALSE - if(!isnull(required_min_hardness) && mat.hardness < required_min_hardness) - return FALSE - if(!isnull(required_max_hardness) && mat.hardness > required_max_hardness) - return FALSE - if(!isnull(required_max_opacity) && mat.opacity > required_max_opacity) - return FALSE + if(mat && length(get_missing_material_properties(mat))) + return FALSE // Check if they're using the right tool. if(required_tool) @@ -320,7 +344,8 @@ if(result_type && isnull(req_amount)) req_amount = 0 var/list/materials - materials = atom_info_repository.get_matter_for((test_result_type || result_type), (ispath(required_material) ? required_material : null)) + var/decl/material/validation_material_path = ispath(required_material) ? decls_repository.get_first_concrete_decl_path_of_type(required_material) : validation_material + materials = atom_info_repository.get_matter_for(result_type, validation_material_path) for(var/mat in materials) req_amount += round(materials[mat]) req_amount = ceil(req_amount*crafting_extra_cost_factor) diff --git a/code/modules/crafting/stack_recipes/recipes_bricks.dm b/code/modules/crafting/stack_recipes/recipes_bricks.dm index 8be3160ba95c..0c9670fbcd9a 100644 --- a/code/modules/crafting/stack_recipes/recipes_bricks.dm +++ b/code/modules/crafting/stack_recipes/recipes_bricks.dm @@ -9,6 +9,7 @@ /obj/item/stack/material/log, /obj/item/stack/material/lump ) + validation_material = /decl/material/solid/stone/basalt category = "structures" /decl/stack_recipe/bricks/cup @@ -121,6 +122,7 @@ result_type = /turf/wall/brick craft_stack_types = /obj/item/stack/material/brick difficulty = MAT_VALUE_HARD_DIY + validation_material = /decl/material/solid/stone/basalt /decl/stack_recipe/turfs/wall/brick/shutter name = "shuttered brick wall" @@ -129,8 +131,8 @@ /decl/stack_recipe/turfs/floor/brick name = "cobblestone path" result_type = /turf/floor/path - expected_product_type = /turf/floor/path craft_stack_types = /obj/item/stack/material/brick + validation_material = /decl/material/solid/stone/basalt /decl/stack_recipe/turfs/floor/brick/herringbone name = "herringbone path" diff --git a/code/modules/crafting/stack_recipes/recipes_cardstock.dm b/code/modules/crafting/stack_recipes/recipes_cardstock.dm index 30e9e6f5e3a4..12ef76c3ecd8 100644 --- a/code/modules/crafting/stack_recipes/recipes_cardstock.dm +++ b/code/modules/crafting/stack_recipes/recipes_cardstock.dm @@ -1,6 +1,7 @@ /decl/stack_recipe/cardstock abstract_type = /decl/stack_recipe/cardstock craft_stack_types = /obj/item/stack/material/cardstock + validation_material = /decl/material/solid/organic/cardboard available_to_map_tech_level = MAP_TECH_LEVEL_SPACE // not exactly high-tech, but donuts etc are not medieval /decl/stack_recipe/cardstock/box diff --git a/code/modules/crafting/stack_recipes/recipes_fodder.dm b/code/modules/crafting/stack_recipes/recipes_fodder.dm index a84f3c45cf67..f6002a657768 100644 --- a/code/modules/crafting/stack_recipes/recipes_fodder.dm +++ b/code/modules/crafting/stack_recipes/recipes_fodder.dm @@ -7,9 +7,7 @@ on_floor = TRUE difficulty = MAT_VALUE_EASY_DIY recipe_skill = SKILL_BOTANY - -/decl/stack_recipe/fodder/get_required_stack_amount(obj/item/stack/stack) - return 30 // Arbitrary amount to make 20 food items. + req_amount = 30 * SHEET_MATERIAL_AMOUNT // Arbitrary amount to make 20 food items. /decl/stack_recipe/fodder/bale result_type = /obj/structure/haystack/bale diff --git a/code/modules/crafting/stack_recipes/recipes_grass.dm b/code/modules/crafting/stack_recipes/recipes_grass.dm index 17caba7e0c49..776dfb49589e 100644 --- a/code/modules/crafting/stack_recipes/recipes_grass.dm +++ b/code/modules/crafting/stack_recipes/recipes_grass.dm @@ -3,7 +3,10 @@ craft_stack_types = /obj/item/stack/material/bundle category = "woven items" forbidden_craft_stack_types = null + validation_material = /decl/material/solid/organic/plantmatter/grass/dry +// TODO: make this check a material property. tensile strength? dryness? +// literally anything but a direct type equality check please /decl/stack_recipe/woven/can_be_made_from(stack_type, tool_type, decl/material/mat, decl/material/reinf_mat) if((istype(mat) ? mat.type : mat) == /decl/material/solid/organic/plantmatter/grass) return FALSE diff --git a/code/modules/crafting/stack_recipes/recipes_hardness.dm b/code/modules/crafting/stack_recipes/recipes_hardness.dm index 903769244d6e..5f8f43e2a4b7 100644 --- a/code/modules/crafting/stack_recipes/recipes_hardness.dm +++ b/code/modules/crafting/stack_recipes/recipes_hardness.dm @@ -1,6 +1,7 @@ /decl/stack_recipe/hardness abstract_type = /decl/stack_recipe/hardness required_min_hardness = MAT_VALUE_FLEXIBLE + 10 + validation_material = DEFAULT_FURNITURE_MATERIAL /decl/stack_recipe/hardness/improvised_armour result_type = /obj/item/clothing/suit/armor/crafted @@ -74,21 +75,6 @@ /decl/stack_recipe/hardness/mortar result_type = /obj/item/chems/glass/mortar -/decl/stack_recipe/ring - result_type = /obj/item/clothing/gloves/ring - -/decl/stack_recipe/ring_thin - name = "ring, thin" - result_type = /obj/item/clothing/gloves/ring/thin - -/decl/stack_recipe/ring_thick - name = "ring, thick" - result_type = /obj/item/clothing/gloves/ring/thick - -/decl/stack_recipe/ring_split - name = "ring, split" - result_type = /obj/item/clothing/gloves/ring/split - /decl/stack_recipe/hardness/clipboard result_type = /obj/item/clipboard available_to_map_tech_level = MAP_TECH_LEVEL_SPACE diff --git a/code/modules/crafting/stack_recipes/recipes_hardness_integrity.dm b/code/modules/crafting/stack_recipes/recipes_hardness_integrity.dm index bf877bfbab75..57fc74fddf57 100644 --- a/code/modules/crafting/stack_recipes/recipes_hardness_integrity.dm +++ b/code/modules/crafting/stack_recipes/recipes_hardness_integrity.dm @@ -63,7 +63,7 @@ result_type = /obj/structure/closet /decl/stack_recipe/hardness/integrity/furniture/tank_dispenser - result_type = /obj/structure/tank_rack + result_type = /obj/structure/tank_rack/empty available_to_map_tech_level = MAP_TECH_LEVEL_SPACE /decl/stack_recipe/hardness/integrity/furniture/coffin diff --git a/code/modules/crafting/stack_recipes/recipes_items.dm b/code/modules/crafting/stack_recipes/recipes_items.dm index d98f860c3f3f..e09b5b933cf9 100644 --- a/code/modules/crafting/stack_recipes/recipes_items.dm +++ b/code/modules/crafting/stack_recipes/recipes_items.dm @@ -37,4 +37,22 @@ bundle = new(location) bundles += bundle bundle.merge(paper) - return bundles \ No newline at end of file + return bundles + +// These don't check hardness so that you can make them out of clay and fire them, I guess? +// They used to be in the hardness-based recipes file but aren't now. +/decl/stack_recipe/ring + result_type = /obj/item/clothing/gloves/ring + validation_material = /decl/material/solid/metal/silver + +/decl/stack_recipe/ring/thin + name = "ring, thin" + result_type = /obj/item/clothing/gloves/ring/thin + +/decl/stack_recipe/ring/thick + name = "ring, thick" + result_type = /obj/item/clothing/gloves/ring/thick + +/decl/stack_recipe/ring/split + name = "ring, split" + result_type = /obj/item/clothing/gloves/ring/split \ No newline at end of file diff --git a/code/modules/crafting/stack_recipes/recipes_logs.dm b/code/modules/crafting/stack_recipes/recipes_logs.dm index 150f36cd1021..02010e3a9252 100644 --- a/code/modules/crafting/stack_recipes/recipes_logs.dm +++ b/code/modules/crafting/stack_recipes/recipes_logs.dm @@ -2,6 +2,7 @@ abstract_type = /decl/stack_recipe/logs craft_stack_types = /obj/item/stack/material/log forbidden_craft_stack_types = /obj/item/stack/material/ore + validation_material = /decl/material/solid/organic/wood/oak /decl/stack_recipe/logs/travois result_type = /obj/structure/travois @@ -12,6 +13,7 @@ result_type = /turf/wall/log craft_stack_types = /obj/item/stack/material/log forbidden_craft_stack_types = /obj/item/stack/material/ore + validation_material = /decl/material/solid/organic/wood/oak difficulty = MAT_VALUE_HARD_DIY /decl/stack_recipe/turfs/wall/logs/shutter diff --git a/code/modules/crafting/stack_recipes/recipes_opacity.dm b/code/modules/crafting/stack_recipes/recipes_opacity.dm index 6efdd97db9d3..c712344f2464 100644 --- a/code/modules/crafting/stack_recipes/recipes_opacity.dm +++ b/code/modules/crafting/stack_recipes/recipes_opacity.dm @@ -9,6 +9,7 @@ /obj/item/stack/material/sheet, /obj/item/stack/material/panel ) + validation_material = /decl/material/solid/glass /decl/stack_recipe/opacity/fullwindow name = "full-tile window" @@ -25,7 +26,7 @@ return FALSE /decl/stack_recipe/opacity/fullwindow/spawn_result(mob/user, location, amount, decl/material/mat, decl/material/reinf_mat, paint_color, spent_type, spent_amount = 1) - . = list(new result_type(user?.loc, MATERIAL_RECIPE_PARAMS, SOUTHWEST, TRUE)) + . = list(new result_type(user?.loc, MATERIAL_RECIPE_PARAMS, SOUTHWEST, FALSE)) if(paint_color) for(var/obj/structure/window/window in .) window.set_color(paint_color) @@ -45,9 +46,9 @@ return FALSE /decl/stack_recipe/opacity/borderwindow/spawn_result(mob/user, location, amount, decl/material/mat, decl/material/reinf_mat, paint_color, spent_type, spent_amount = 1) - . = list(new result_type(user?.loc, MATERIAL_RECIPE_PARAMS, user?.dir, TRUE)) - if(paint_color) - for(var/obj/structure/window/window in .) + . = list(new result_type(user?.loc, MATERIAL_RECIPE_PARAMS, user?.dir, FALSE)) + for(var/obj/structure/window/window in .) + if(paint_color) window.set_color(paint_color) /decl/stack_recipe/opacity/windoor diff --git a/code/modules/crafting/stack_recipes/recipes_panels.dm b/code/modules/crafting/stack_recipes/recipes_panels.dm index a78196e388b4..dc21533bd6a7 100644 --- a/code/modules/crafting/stack_recipes/recipes_panels.dm +++ b/code/modules/crafting/stack_recipes/recipes_panels.dm @@ -2,6 +2,7 @@ abstract_type = /decl/stack_recipe/panels craft_stack_types = /obj/item/stack/material/panel available_to_map_tech_level = MAP_TECH_LEVEL_SPACE + validation_material = /decl/material/solid/organic/plastic /decl/stack_recipe/panels/bag result_type = /obj/item/bag/flimsy diff --git a/code/modules/crafting/stack_recipes/recipes_planks.dm b/code/modules/crafting/stack_recipes/recipes_planks.dm index e1e762675cfb..03464a086a4e 100644 --- a/code/modules/crafting/stack_recipes/recipes_planks.dm +++ b/code/modules/crafting/stack_recipes/recipes_planks.dm @@ -1,6 +1,7 @@ /decl/stack_recipe/planks abstract_type = /decl/stack_recipe/planks craft_stack_types = /obj/item/stack/material/plank + validation_material = /decl/material/solid/organic/wood/oak /decl/stack_recipe/planks/sandals result_type = /obj/item/clothing/shoes/sandal @@ -104,7 +105,7 @@ abstract_type = /decl/stack_recipe/planks/prosthetic difficulty = MAT_VALUE_EASY_DIY category = "prosthetics" - var/prosthetic_species = SPECIES_HUMAN + var/prosthetic_species = /decl/species/human::uid var/prosthetic_model = /decl/bodytype/prosthetic/wooden /decl/stack_recipe/planks/prosthetic/spawn_result(mob/user, location, amount, decl/material/mat, decl/material/reinf_mat, paint_color, spent_type, spent_amount = 1) diff --git a/code/modules/crafting/stack_recipes/recipes_reinforced.dm b/code/modules/crafting/stack_recipes/recipes_reinforced.dm index c5335e7132f0..6a918cac0ef8 100644 --- a/code/modules/crafting/stack_recipes/recipes_reinforced.dm +++ b/code/modules/crafting/stack_recipes/recipes_reinforced.dm @@ -1,9 +1,10 @@ /decl/stack_recipe/reinforced - abstract_type = /decl/stack_recipe/reinforced - craft_stack_types = /obj/item/stack/material/sheet/reinforced - one_per_turf = TRUE - difficulty = MAT_VALUE_HARD_DIY + abstract_type = /decl/stack_recipe/reinforced + craft_stack_types = /obj/item/stack/material/sheet/reinforced + one_per_turf = TRUE + difficulty = MAT_VALUE_HARD_DIY available_to_map_tech_level = MAP_TECH_LEVEL_SPACE + validation_material = /decl/material/solid/metal/plasteel /decl/stack_recipe/reinforced/ai_core result_type = /obj/structure/aicore diff --git a/code/modules/crafting/stack_recipes/recipes_rods.dm b/code/modules/crafting/stack_recipes/recipes_rods.dm index c010556a990d..8483c2346746 100644 --- a/code/modules/crafting/stack_recipes/recipes_rods.dm +++ b/code/modules/crafting/stack_recipes/recipes_rods.dm @@ -10,6 +10,7 @@ difficulty = MAT_VALUE_HARD_DIY available_to_map_tech_level = MAP_TECH_LEVEL_MEDIEVAL category = "structures" + validation_material = /decl/material/solid/metal/steel /decl/stack_recipe/rods/stick result_type = /obj/item/stick diff --git a/code/modules/crafting/stack_recipes/recipes_soft.dm b/code/modules/crafting/stack_recipes/recipes_soft.dm index 27f9c6328ceb..e7e6d12d924f 100644 --- a/code/modules/crafting/stack_recipes/recipes_soft.dm +++ b/code/modules/crafting/stack_recipes/recipes_soft.dm @@ -9,6 +9,7 @@ ) required_min_hardness = 0 required_max_hardness = MAT_VALUE_SOFT + validation_material = /decl/material/solid/clay crafting_extra_cost_factor = 1 // No wastage for just resculpting materials. /decl/stack_recipe/soft/teapot @@ -42,13 +43,11 @@ name = "brick" name_plural = "bricks" result_type = /obj/item/stack/material/brick - test_result_type = /obj/item/stack/material/brick/clay /decl/stack_recipe/soft/bar name = "bar" name_plural = "bars" result_type = /obj/item/stack/material/bar - test_result_type = /obj/item/stack/material/bar/wax /decl/stack_recipe/soft/stack/spawn_result(mob/user, location, amount, decl/material/mat, decl/material/reinf_mat, paint_color, spent_type, spent_amount = 1) var/obj/item/stack/S = ..() @@ -68,13 +67,11 @@ name = "large lump" name_plural = "large lumps" result_type = /obj/item/stack/material/lump/large - test_result_type = /obj/item/stack/material/lump/large/clay /decl/stack_recipe/soft/stack/small_lump name = "small lump" name_plural = "small lumps" result_type = /obj/item/stack/material/lump - test_result_type = /obj/item/stack/material/lump/clay /decl/stack_recipe/soft/crucible result_type = /obj/item/chems/crucible diff --git a/code/modules/crafting/stack_recipes/recipes_stacks.dm b/code/modules/crafting/stack_recipes/recipes_stacks.dm index 06c19604fbfc..5b45b2c90f42 100644 --- a/code/modules/crafting/stack_recipes/recipes_stacks.dm +++ b/code/modules/crafting/stack_recipes/recipes_stacks.dm @@ -112,6 +112,7 @@ abstract_type = /decl/stack_recipe/tile/panels craft_stack_types = /obj/item/stack/material/panel available_to_map_tech_level = MAP_TECH_LEVEL_SPACE + validation_material = /decl/material/solid/organic/plastic /decl/stack_recipe/tile/panels/floor result_type = /obj/item/stack/tile/floor_white diff --git a/code/modules/crafting/stack_recipes/recipes_textiles.dm b/code/modules/crafting/stack_recipes/recipes_textiles.dm index 4b49616eef76..0e0a5e20271a 100644 --- a/code/modules/crafting/stack_recipes/recipes_textiles.dm +++ b/code/modules/crafting/stack_recipes/recipes_textiles.dm @@ -6,6 +6,7 @@ difficulty = null // Autoset from material difficulty crafting_extra_cost_factor = 1.5 // measure twice, cut once; material is lost. todo: produce scraps? abstract_type = /decl/stack_recipe/textiles + validation_material = /decl/material/solid/organic/cloth /decl/stack_recipe/textiles/rug result_type = /obj/structure/rug/crafted @@ -62,6 +63,7 @@ /decl/stack_recipe/textiles/leather abstract_type = /decl/stack_recipe/textiles/leather + validation_material = /decl/material/solid/organic/leather craft_stack_types = /obj/item/stack/material/skin category = "clothing" @@ -105,6 +107,7 @@ /decl/stack_recipe/textiles/cloth abstract_type = /decl/stack_recipe/textiles/cloth + validation_material = /decl/material/solid/organic/cloth craft_stack_types = /obj/item/stack/material/bolt category = "clothing" @@ -141,6 +144,7 @@ /decl/stack_recipe/textiles/fur abstract_type = /decl/stack_recipe/textiles/fur craft_stack_types = /obj/item/stack/material/skin/pelt + validation_material = /decl/material/solid/organic/skin/fur /decl/stack_recipe/textiles/fur/bedding difficulty = MAT_VALUE_EASY_DIY diff --git a/code/modules/crafting/working/textiles/twisting_bench.dm b/code/modules/crafting/working/textiles/twisting_bench.dm index f4934dfb94bb..a434924ca678 100644 --- a/code/modules/crafting/working/textiles/twisting_bench.dm +++ b/code/modules/crafting/working/textiles/twisting_bench.dm @@ -5,9 +5,9 @@ work_sound = /datum/composite_sound/spinning_wheel_working var/accepts_gut_material = /decl/material/solid/organic/leather/gut -/obj/structure/working/spinning_wheel/twisting_bench/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/food/butchery/offal) && !istype(W, /obj/item/food/butchery/offal/small)) - to_chat(user, SPAN_WARNING("\The [W] is too large for \the [src], cut it up first.")) +/obj/structure/working/spinning_wheel/twisting_bench/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/food/butchery/offal) && !istype(used_item, /obj/item/food/butchery/offal/small)) + to_chat(user, SPAN_WARNING("\The [used_item] is too large for \the [src], cut it up first.")) return TRUE return ..() diff --git a/code/modules/detectivework/microscope/_forensic_machine.dm b/code/modules/detectivework/microscope/_forensic_machine.dm index c3db366ce4bb..b9819400f75b 100644 --- a/code/modules/detectivework/microscope/_forensic_machine.dm +++ b/code/modules/detectivework/microscope/_forensic_machine.dm @@ -41,8 +41,8 @@ var/list/res = list("Use harm intent when manipulating with machine with tools.") return res + ..() -/obj/machinery/forensic/attackby(obj/item/W, mob/user) - if((. = component_attackby(W, user))) +/obj/machinery/forensic/attackby(obj/item/used_item, mob/user) + if((. = component_attackby(used_item, user))) return if(user?.check_intent(I_FLAG_HARM)) @@ -52,18 +52,18 @@ to_chat(user, SPAN_WARNING("There is already a sample in \the [src].")) return TRUE - if(istype(W, /obj/item/evidencebag)) - var/obj/item/evidencebag/B = W + if(istype(used_item, /obj/item/evidencebag)) + var/obj/item/evidencebag/B = used_item if(B.stored_item) to_chat(user, SPAN_NOTICE("You insert \the [B.stored_item] from \the [B].")) B.stored_item.forceMove(src) set_sample(B.stored_item) B.empty() return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, SPAN_NOTICE("You insert \the [W] into \the [src].")) - set_sample(W) + to_chat(user, SPAN_NOTICE("You insert \the [used_item] into \the [src].")) + set_sample(used_item) update_icon() return TRUE diff --git a/code/modules/detectivework/tools/rag.dm b/code/modules/detectivework/tools/rag.dm index 3bfc7ebe8944..60717340915e 100644 --- a/code/modules/detectivework/tools/rag.dm +++ b/code/modules/detectivework/tools/rag.dm @@ -45,16 +45,16 @@ return ..() -/obj/item/chems/rag/attackby(obj/item/W, mob/user) - if(W.isflamesource()) +/obj/item/chems/rag/attackby(obj/item/used_item, mob/user) + if(used_item.isflamesource()) if(is_on_fire()) to_chat(user, SPAN_WARNING("\The [src] is already blazing merrily!")) return TRUE ignite_fire() if(is_on_fire()) - visible_message(SPAN_DANGER("\The [user] lights \the [src] with \the [W].")) + visible_message(SPAN_DANGER("\The [user] lights \the [src] with \the [used_item].")) else - to_chat(user, SPAN_WARNING("You attempt to light \the [src] with \the [W], but it doesn't seem to be flammable.")) + to_chat(user, SPAN_WARNING("You attempt to light \the [src] with \the [used_item], but it doesn't seem to be flammable.")) update_name() return TRUE return ..() @@ -185,9 +185,8 @@ var/total_volume = 0 if(reagents) total_volume += reagents.total_volume - for(var/rtype in reagents.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - total_fuel += REAGENT_VOLUME(reagents, rtype) * R.accelerant_value + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + total_fuel += REAGENT_VOLUME(reagents, reagent) * reagent.accelerant_value . = (total_fuel >= 2 && total_fuel >= total_volume*0.5) /obj/item/chems/rag/ignite_fire() diff --git a/code/modules/detectivework/tools/sample_kits/_sample.dm b/code/modules/detectivework/tools/sample_kits/_sample.dm index d56d685faaa9..657e77ecb843 100644 --- a/code/modules/detectivework/tools/sample_kits/_sample.dm +++ b/code/modules/detectivework/tools/sample_kits/_sample.dm @@ -49,9 +49,9 @@ /obj/item/forensics/sample/proc/merge_evidence_list(var/list/new_evidence) LAZYDISTINCTADD(evidence, new_evidence) -/obj/item/forensics/sample/attackby(var/obj/O, var/mob/user) - if(O.type == src.type) - if(user.try_unequip(O) && merge_evidence(O, user)) - qdel(O) +/obj/item/forensics/sample/attackby(var/obj/used_item, var/mob/user) + if(used_item.type == src.type) + if(user.try_unequip(used_item) && merge_evidence(used_item, user)) + qdel(used_item) return 1 return ..() \ No newline at end of file diff --git a/code/modules/economy/_worth.dm b/code/modules/economy/_worth.dm index 9642a67019ef..7e623d2907d0 100644 --- a/code/modules/economy/_worth.dm +++ b/code/modules/economy/_worth.dm @@ -10,9 +10,8 @@ /atom/proc/get_single_monetary_worth() . = get_base_value() * get_value_multiplier() if(reagents) - for(var/a in reagents.reagent_volumes) - var/decl/material/reg = GET_DECL(a) - . += reg.get_value() * REAGENT_VOLUME(reagents, a) * REAGENT_WORTH_MULTIPLIER + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + . += reagent.get_value() * REAGENT_VOLUME(reagents, reagent) * REAGENT_WORTH_MULTIPLIER . = max(0, round(.)) /atom/proc/get_contents_monetary_worth() diff --git a/code/modules/economy/cael/ATM.dm b/code/modules/economy/cael/ATM.dm index c2e50a639305..dd440576bc61 100644 --- a/code/modules/economy/cael/ATM.dm +++ b/code/modules/economy/cael/ATM.dm @@ -75,8 +75,8 @@ to_chat(user, "[html_icon(src)] [src] beeps: \"[response]\"") return 1 -/obj/machinery/atm/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/card/id)) +/obj/machinery/atm/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/card/id)) if(emagged > 0) //prevent inserting id into an emagged ATM to_chat(user, "[html_icon(src)] CARD READER ERROR. This system has been compromised!") @@ -85,7 +85,7 @@ to_chat(user, "You try to insert your card into [src], but nothing happens.") return TRUE - var/obj/item/card/id/idcard = I + var/obj/item/card/id/idcard = used_item if(!held_card) if(!user.try_unequip(idcard, src)) return TRUE @@ -96,30 +96,30 @@ return TRUE else if(authenticated_account) - if(istype(I,/obj/item/cash)) - var/obj/item/cash/dolla = I + if(istype(used_item,/obj/item/cash)) + var/obj/item/cash/dolla = used_item //deposit the cash if(authenticated_account.deposit(dolla.absolute_worth, "Credit deposit", machine_id)) playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 50, 1) - to_chat(user, "You insert [I] into [src].") + to_chat(user, "You insert [used_item] into [src].") attack_hand_with_interaction_checks(user) - qdel(I) + qdel(used_item) return TRUE - if(istype(I,/obj/item/charge_stick)) - var/obj/item/charge_stick/stick = I - var/datum/extension/lockable/lock = get_extension(I, /datum/extension/lockable) + if(istype(used_item,/obj/item/charge_stick)) + var/obj/item/charge_stick/stick = used_item + var/datum/extension/lockable/lock = get_extension(used_item, /datum/extension/lockable) if(lock.locked) to_chat(user, SPAN_WARNING("Cannot transfer funds from a locked [stick.name].")) else if(authenticated_account.deposit(stick.loaded_worth, "Credit deposit", machine_id)) playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 50, 1) - to_chat(user, "You insert [I] into [src].") + to_chat(user, "You insert [used_item] into [src].") attack_hand_with_interaction_checks(user) - qdel(I) + qdel(used_item) return TRUE return ..() @@ -430,11 +430,11 @@ if(emagged > 0) to_chat(user, "[html_icon(src)] The ATM card reader rejected your ID because this machine has been sabotaged!") else - var/obj/item/I = user.get_active_held_item() - if (istype(I, /obj/item/card/id)) - if(!user.try_unequip(I, src)) + var/obj/item/thing = user.get_active_held_item() + if (istype(thing, /obj/item/card/id)) + if(!user.try_unequip(thing, src)) return - held_card = I + held_card = thing else release_held_id(user) if("logout") @@ -445,9 +445,9 @@ /obj/machinery/atm/proc/scan_user(mob/living/human/human_user) if(!authenticated_account) - var/obj/item/card/id/I = human_user.GetIdCard() - if(istype(I)) - return I + var/obj/item/card/id/thing = human_user.GetIdCard() + if(istype(thing)) + return thing // put the currently held id on the ground or in the hand of the user /obj/machinery/atm/proc/release_held_id(mob/living/human/human_user) diff --git a/code/modules/economy/cael/Accounts_DB.dm b/code/modules/economy/cael/Accounts_DB.dm index 8d8b7f4c8a5b..64cea625b356 100644 --- a/code/modules/economy/cael/Accounts_DB.dm +++ b/code/modules/economy/cael/Accounts_DB.dm @@ -21,10 +21,10 @@ . = ..() machine_id = "[station_name()] Acc. DB #[num_financial_terminals++]" -/obj/machinery/computer/account_database/attackby(obj/O, mob/user) - if(istype(O, /obj/item/card/id) && !held_card) - if(user.try_unequip(O, src)) - held_card = O +/obj/machinery/computer/account_database/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/card/id) && !held_card) + if(user.try_unequip(used_item, src)) + held_card = used_item SSnano.update_uis(src) return TRUE return ..() diff --git a/code/modules/economy/cael/EFTPOS.dm b/code/modules/economy/cael/EFTPOS.dm index 551e88a70c01..519938245c6d 100644 --- a/code/modules/economy/cael/EFTPOS.dm +++ b/code/modules/economy/cael/EFTPOS.dm @@ -79,18 +79,18 @@ else close_browser(user, "window=eftpos") -/obj/item/eftpos/attackby(obj/item/O, user) +/obj/item/eftpos/attackby(obj/item/used_item, user) - var/obj/item/card/id/I = O.GetIdCard() + var/obj/item/card/id/I = used_item.GetIdCard() if(I) if(linked_account) - scan_card(I, O) + scan_card(I, used_item) else to_chat(user, "[html_icon(src)]Unable to connect to linked account.") return TRUE - else if (istype(O, /obj/item/charge_stick)) - var/obj/item/charge_stick/E = O + else if (istype(used_item, /obj/item/charge_stick)) + var/obj/item/charge_stick/E = used_item if (linked_account) if(transaction_locked && !transaction_paid) if(!E.is_locked() && transaction_amount <= E.loaded_worth) @@ -105,7 +105,7 @@ else to_chat(user, "[html_icon(src)]Transaction failed! Please try again.") else - to_chat(user, "[html_icon(src)]\The [O] doesn't have that much money!") + to_chat(user, "[html_icon(src)]\The [used_item] doesn't have that much money!") else to_chat(user, "[html_icon(src)]EFTPOS is not connected to an account.") return TRUE diff --git a/code/modules/economy/worth_cash.dm b/code/modules/economy/worth_cash.dm index 6f6c38ca5811..49d04f24ebdf 100644 --- a/code/modules/economy/worth_cash.dm +++ b/code/modules/economy/worth_cash.dm @@ -59,21 +59,21 @@ var/decl/currency/cur = GET_DECL(currency) . = floor(absolute_worth / cur.absolute_value) -/obj/item/cash/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/cash)) - var/obj/item/cash/cash = W +/obj/item/cash/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/cash)) + var/obj/item/cash/cash = used_item if(cash.currency != currency) to_chat(user, SPAN_WARNING("You can't mix two different currencies, it would be uncivilized.")) return TRUE - if(user.try_unequip(W)) + if(user.try_unequip(used_item)) adjust_worth(cash.absolute_worth) var/decl/currency/cur = GET_DECL(currency) to_chat(user, SPAN_NOTICE("You add [cash.get_worth()] [cur.name] to the pile.")) to_chat(user, SPAN_NOTICE("It holds [get_worth()] [cur.name] now.")) - qdel(W) + qdel(used_item) return TRUE - else if(istype(W, /obj/item/gun/launcher/money)) - var/obj/item/gun/launcher/money/L = W + else if(istype(used_item, /obj/item/gun/launcher/money)) + var/obj/item/gun/launcher/money/L = used_item L.absorb_cash(src, user) return TRUE return ..() @@ -247,17 +247,17 @@ /obj/item/charge_stick/get_base_value() . = holographic ? 0 : loaded_worth -/obj/item/charge_stick/attackby(var/obj/item/W, var/mob/user) +/obj/item/charge_stick/attackby(var/obj/item/used_item, var/mob/user) var/datum/extension/lockable/lock = get_extension(src, /datum/extension/lockable) - if(istype(W, /obj/item/charge_stick)) - var/obj/item/charge_stick/sender = W - var/datum/extension/lockable/W_lock = get_extension(W, /datum/extension/lockable) + if(istype(used_item, /obj/item/charge_stick)) + var/obj/item/charge_stick/sender = used_item + var/datum/extension/lockable/W_lock = get_extension(used_item, /datum/extension/lockable) if(lock.locked) to_chat(user, SPAN_WARNING("Cannot transfer funds to a locked [src].")) return TRUE if(W_lock.locked) - to_chat(user, SPAN_WARNING("Cannot transfer funds from a locked [W].")) + to_chat(user, SPAN_WARNING("Cannot transfer funds from a locked [used_item].")) return TRUE if(sender.currency != currency) to_chat(user, SPAN_WARNING("[html_icon(src)] [src] chirps, \"Mismatched currency detected. Unable to transfer.\"")) @@ -276,7 +276,7 @@ to_chat(user, SPAN_NOTICE("[html_icon(src)] [src] chirps, \"Completed transfer of [amount] [cur.name].\"")) return TRUE - if(lock.attackby(W, user)) + if(lock.attackby(used_item, user)) return TRUE return ..() diff --git a/code/modules/emotes/definitions/audible_slap.dm b/code/modules/emotes/definitions/audible_slap.dm index b489d9e6a8fd..93abaa6e9a96 100644 --- a/code/modules/emotes/definitions/audible_slap.dm +++ b/code/modules/emotes/definitions/audible_slap.dm @@ -18,8 +18,8 @@ /decl/emote/audible/slap/do_extra(atom/user, atom/target) . = ..() - if(ismob(user)) - var/mob/user_mob = user - var/obj/item/clothing/mask/smokable/cig = user_mob.get_equipped_item(slot_wear_mask_str) + var/mob/victim_mob = target || user + if(ismob(victim_mob)) + var/obj/item/clothing/mask/smokable/cig = victim_mob.get_equipped_item(slot_wear_mask_str) if(istype(cig)) - user_mob.try_unequip(cig, user.loc) + victim_mob.try_unequip(cig) diff --git a/code/modules/emotes/definitions/tail.dm b/code/modules/emotes/definitions/tail.dm index c0b73c26ff60..deded3daa95a 100644 --- a/code/modules/emotes/definitions/tail.dm +++ b/code/modules/emotes/definitions/tail.dm @@ -1,6 +1,8 @@ /decl/emote/visible/tail abstract_type = /decl/emote/visible/tail + key = "tail" + emote_message_3p = "$USER$ waves $USER_THEIR$ tail." /decl/emote/visible/tail/mob_can_use(mob/living/user, assume_available = FALSE) return istype(user) && ..() diff --git a/code/modules/emotes/definitions/visible.dm b/code/modules/emotes/definitions/visible.dm index 414327646f5e..377e582d0f39 100644 --- a/code/modules/emotes/definitions/visible.dm +++ b/code/modules/emotes/definitions/visible.dm @@ -1,6 +1,5 @@ /decl/emote/visible - key = "tail" - emote_message_3p = "$USER$ waves $USER_THEIR$ tail." + abstract_type = /decl/emote/visible message_type = VISIBLE_MESSAGE /decl/emote/visible/scratch @@ -310,6 +309,15 @@ check_restraints = TRUE emote_message_3p = "$USER$ shoves $USER_THEIR$ hands in $USER_THEIR$ pockets." +/decl/emote/visible/pocket/mob_can_use(mob/living/user, assume_available) + . = ..() + if(!.) + return + // You need a uniform to have pockets. + var/datum/inventory_slot/check_slot = user.get_inventory_slot_datum(slot_w_uniform_str) + if(!check_slot?.get_equipped_item()) + return FALSE + /decl/emote/visible/rsalute key = "rsalute" check_restraints = TRUE diff --git a/code/modules/emotes/emote_define.dm b/code/modules/emotes/emote_define.dm index 0223e3f3185b..b76c74f5c98a 100644 --- a/code/modules/emotes/emote_define.dm +++ b/code/modules/emotes/emote_define.dm @@ -7,7 +7,7 @@ . = replacetext(., "$TARGET_THEM$", target_gender.him) . = replacetext(., "$TARGET_THEIR$", target_gender.his) . = replacetext(., "$TARGET_SELF$", target_gender.self) - . = replacetext(., "$TARGET$", "\the [target]") + . = replacetext(., "$TARGET$", "[target]") /proc/emote_replace_user_tokens(var/msg, var/atom/user) . = msg @@ -18,7 +18,7 @@ . = replacetext(., "$USER_THEM$", user_gender.him) . = replacetext(., "$USER_THEIR$", user_gender.his) . = replacetext(., "$USER_SELF$", user_gender.self) - . = replacetext(., "$USER$", "\the [user]") + . = replacetext(., "$USER$", "[user]") // Note about emote messages: // - $USER$ / $TARGET$ will be replaced with the relevant name, in bold. diff --git a/code/modules/events/ailments.dm b/code/modules/events/ailments.dm index a1d6fc894e85..cf49cd2110d1 100644 --- a/code/modules/events/ailments.dm +++ b/code/modules/events/ailments.dm @@ -1,7 +1,7 @@ /datum/event/ailments/start() var/list/candidates = list() for(var/mob/living/human/H in global.living_mob_list_) - if(H.client && !length(H.stasis_sources)) + if(H.client && !H.has_mob_modifier(/decl/mob_modifier/stasis)) candidates += H if(!length(candidates)) return diff --git a/code/modules/events/apc_damage.dm b/code/modules/events/apc_damage.dm index a3af950e8e23..4855cc37b22d 100644 --- a/code/modules/events/apc_damage.dm +++ b/code/modules/events/apc_damage.dm @@ -22,7 +22,7 @@ var/list/possibleEpicentres = list() var/list/apcs = list() - for(var/obj/abstract/landmark/newEpicentre in global.landmarks_list) + for(var/obj/abstract/landmark/newEpicentre in global.all_landmarks) if(newEpicentre.name == "lightsout") possibleEpicentres += newEpicentre diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index 89032c9e88de..76d24cbcb800 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -19,8 +19,8 @@ if(!vendingMachines.len) kill() return - var/weakref/W = pick_n_take(vendingMachines) - originMachine = W.resolve() + var/weakref/vendor_ref = pick_n_take(vendingMachines) + originMachine = vendor_ref.resolve() originMachine.shut_up = 0 originMachine.shoot_inventory = 1 originMachine.shooting_chance = 15 @@ -31,11 +31,11 @@ return if(IsMultiple(activeFor, 5) && prob(15)) - var/weakref/W = pick(vendingMachines) - vendingMachines -= W - var/obj/machinery/vending/infectedMachine = W.resolve() + var/weakref/vendor_ref = pick(vendingMachines) + vendingMachines -= vendor_ref + var/obj/machinery/vending/infectedMachine = vendor_ref.resolve() if(infectedMachine) - infectedVendingMachines += W + infectedVendingMachines += vendor_ref infectedMachine.shut_up = 0 infectedMachine.shoot_inventory = 1 @@ -53,8 +53,8 @@ originMachine.shut_up = 1 originMachine.shooting_chance = initial(originMachine.shooting_chance) originMachine = null - for(var/weakref/W in infectedVendingMachines) - var/obj/machinery/vending/infectedMachine = W.resolve() + for(var/weakref/vendor_ref in infectedVendingMachines) + var/obj/machinery/vending/infectedMachine = vendor_ref.resolve() if(!infectedMachine) continue infectedMachine.shut_up = 1 diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index 2e0256a4706b..275ce04101b2 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -178,7 +178,6 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT severity = EVENT_LEVEL_MAJOR available_events = list( new /datum/event_meta(EVENT_LEVEL_MAJOR, "Nothing", /datum/event/nothing, 1320), - new /datum/event_meta(EVENT_LEVEL_MAJOR, "Blob", /datum/event/blob, 0, list(ASSIGNMENT_ENGINEER = 40), 1), new /datum/event_meta/no_overmap(EVENT_LEVEL_MAJOR, "Carp Migration", /datum/event/carp_migration, 0, list(ASSIGNMENT_SECURITY = 5), 1), new /datum/event_meta(EVENT_LEVEL_MAJOR, "Containment Breach", /datum/event/prison_break/station, 0, list(ASSIGNMENT_ANY = 5)), new /datum/event_meta/no_overmap(EVENT_LEVEL_MAJOR, "Meteor Wave", /datum/event/meteor_wave, 0, list(ASSIGNMENT_ENGINEER = 10), 1), diff --git a/code/modules/events/event_dynamic.dm b/code/modules/events/event_dynamic.dm index 5b854a937467..e70154af3f76 100644 --- a/code/modules/events/event_dynamic.dm +++ b/code/modules/events/event_dynamic.dm @@ -12,9 +12,9 @@ .["Any"]++ if(isrobot(M)) - var/mob/living/silicon/robot/R = M - if(R.module?.associated_department) - var/decl/department/dept = GET_DECL(R.module.associated_department) + var/mob/living/silicon/robot/robot = M + if(robot.module?.associated_department) + var/decl/department/dept = GET_DECL(robot.module.associated_department) .[dept.name] = .[dept.name] + 1 else for(var/dtype in M.mind?.assigned_job?.department_types) diff --git a/code/modules/events/gravity.dm b/code/modules/events/gravity.dm index 60e8c51bc91c..4bbc5e3a50ba 100644 --- a/code/modules/events/gravity.dm +++ b/code/modules/events/gravity.dm @@ -8,17 +8,13 @@ command_announcement.Announce("Feedback surge detected in mass-distributions systems. Artificial gravity has been disabled whilst the system reinitializes.", "[location_name()] Gravity Subsystem", zlevels = affecting_z) /datum/event/gravity/start() - gravity_is_on = 0 for(var/area/A in global.areas) if(A.z in affecting_z) - A.gravitychange(gravity_is_on) + A.gravitychange(FALSE) /datum/event/gravity/end() - if(!gravity_is_on) - gravity_is_on = 1 - - for(var/area/A in global.areas) - if((A.z in affecting_z) && initial(A.has_gravity)) - A.gravitychange(gravity_is_on) + for(var/area/A in global.areas) + if((A.z in affecting_z) && initial(A.has_gravity)) + A.gravitychange(TRUE) - command_announcement.Announce("Gravity generators are again functioning within normal parameters. Sorry for any inconvenience.", "[location_name()] Gravity Subsystem", zlevels = affecting_z) + command_announcement.Announce("Gravity generators are again functioning within normal parameters. Sorry for any inconvenience.", "[location_name()] Gravity Subsystem", zlevels = affecting_z) diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm index c19e7c42b325..48702089f434 100644 --- a/code/modules/events/ion_storm.dm +++ b/code/modules/events/ion_storm.dm @@ -37,8 +37,8 @@ if(!(S.z in affecting_z)) continue if(isrobot(S)) - var/mob/living/silicon/robot/R = S - if(R.connected_ai) + var/mob/living/silicon/robot/robot = S + if(robot.connected_ai) continue var/random_player = get_random_humanoid_player_name("The Captain") var/list/laws = list( "You must always lie.", @@ -142,14 +142,10 @@ return pick(players) return default_if_none -/datum/event/ionstorm/proc/get_random_species_name(var/default_if_none) - if(!default_if_none) - default_if_none = global.using_map.default_species - . = length(global.all_species) ? pick(global.all_species) : default_if_none - if(.) - var/decl/species/species = all_species[.] - if(species) - . = species.name_plural +/datum/event/ionstorm/proc/get_random_species_name() + var/list/decl/species/all_species = decls_repository.get_decls_of_subtype_unassociated(/decl/species) + var/decl/species/species = pick(all_species) // this should never fail. + return species.name_plural /datum/event/ionstorm/proc/get_random_language(var/mob/living/silicon/S) var/list/languages = S.speech_synthesizer_langs.Copy() diff --git a/code/modules/events/meteors.dm b/code/modules/events/meteors.dm index 521a4bbb2f2c..5a4d60f7f628 100644 --- a/code/modules/events/meteors.dm +++ b/code/modules/events/meteors.dm @@ -293,8 +293,8 @@ var/global/list/meteors_major = list( SHOULD_CALL_PARENT(FALSE) return -/obj/effect/meteor/attackby(obj/item/W, mob/user, params) - if(IS_PICK(W)) +/obj/effect/meteor/attackby(obj/item/used_item, mob/user, params) + if(IS_PICK(used_item)) qdel(src) return TRUE return ..() diff --git a/code/modules/events/rogue_drones.dm b/code/modules/events/rogue_drones.dm index c5d0df69341e..2ea63e27e717 100644 --- a/code/modules/events/rogue_drones.dm +++ b/code/modules/events/rogue_drones.dm @@ -5,7 +5,7 @@ /datum/event/rogue_drone/start() //spawn them at the same place as carp var/list/possible_spawns = list() - for(var/obj/abstract/landmark/C in global.landmarks_list) + for(var/obj/abstract/landmark/C in global.all_landmarks) if(C.name == "carpspawn") possible_spawns.Add(C) diff --git a/code/modules/events/shipping_error.dm b/code/modules/events/shipping_error.dm index bd2d81fe75b0..772381d7a37d 100644 --- a/code/modules/events/shipping_error.dm +++ b/code/modules/events/shipping_error.dm @@ -1,6 +1,6 @@ /datum/event/shipping_error/start() - var/datum/supply_order/O = new /datum/supply_order() - O.ordernum = SSsupply.ordernum - O.object = pick(SSsupply.master_supply_list) - O.orderedby = random_name(pick(MALE,FEMALE), species = global.using_map.default_species) - SSsupply.shoppinglist += O + var/datum/supply_order/order = new /datum/supply_order() + order.ordernum = SSsupply.ordernum + order.object = pick(SSsupply.master_supply_list) + order.orderedby = random_name(pick(MALE,FEMALE), species = global.using_map.default_species) + SSsupply.shoppinglist += order diff --git a/code/modules/events/wallrot.dm b/code/modules/events/wallrot.dm index e57cc6ed4f73..2e20e58a2c40 100644 --- a/code/modules/events/wallrot.dm +++ b/code/modules/events/wallrot.dm @@ -22,8 +22,8 @@ // Have a chance to rot lots of other walls. var/rotcount = 0 var/actual_severity = severity * rand(5, 10) - for(var/turf/wall/W in range(5, center)) if(prob(50)) - W.rot() + for(var/turf/wall/wall in range(5, center)) if(prob(50)) + wall.rot() rotcount++ // Only rot up to severity walls diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm index 8d7626575850..98b2eceb41f6 100644 --- a/code/modules/events/wormholes.dm +++ b/code/modules/events/wormholes.dm @@ -50,6 +50,6 @@ /proc/create_wormhole(turf/enter, turf/exit) if(!enter || !exit) return - var/obj/effect/portal/wormhole/W = new (enter) - W.target = exit - return W + var/obj/effect/portal/wormhole/wormhole = new (enter) + wormhole.target = exit + return wormhole diff --git a/code/modules/fabrication/_fabricator.dm b/code/modules/fabrication/_fabricator.dm index b4c227c101a6..d10d5064bc4f 100644 --- a/code/modules/fabrication/_fabricator.dm +++ b/code/modules/fabrication/_fabricator.dm @@ -230,6 +230,6 @@ return pipe_colors //override with null for hex color selections // Our stored_material is just the right format to be added to the matter list. -/obj/machinery/fabricator/get_contained_matter() +/obj/machinery/fabricator/get_contained_matter(include_reagents = TRUE) . = ..() . = MERGE_ASSOCS_WITH_NUM_VALUES(., stored_material) \ No newline at end of file diff --git a/code/modules/fabrication/designs/imprinter/designs_misc_circuits.dm b/code/modules/fabrication/designs/imprinter/designs_misc_circuits.dm index 845dfd8ed1c1..48070e2e7e7a 100644 --- a/code/modules/fabrication/designs/imprinter/designs_misc_circuits.dm +++ b/code/modules/fabrication/designs/imprinter/designs_misc_circuits.dm @@ -344,6 +344,9 @@ /datum/fabricator_recipe/imprinter/circuit/cooker path = /obj/item/stock_parts/circuitboard/cooker +/datum/fabricator_recipe/imprinter/circuit/centrifuge + path = /obj/item/stock_parts/circuitboard/centrifuge + /datum/fabricator_recipe/imprinter/circuit/seed_extractor path = /obj/item/stock_parts/circuitboard/seed_extractor diff --git a/code/modules/fabrication/designs/pipe/pipe_datum_base.dm b/code/modules/fabrication/designs/pipe/pipe_datum_base.dm index 75c5b9e1773b..8dd28b296eb2 100644 --- a/code/modules/fabrication/designs/pipe/pipe_datum_base.dm +++ b/code/modules/fabrication/designs/pipe/pipe_datum_base.dm @@ -41,9 +41,9 @@ new_item.rotate_class = rotate_class new_item.constructed_path = constructed_path if(colorable) - new_item.color = order.get_data("selected_color", PIPE_COLOR_WHITE) + new_item.set_color(order.get_data("selected_color", PIPE_COLOR_WHITE)) else if (pipe_color != null) - new_item.color = pipe_color + new_item.set_color(pipe_color) new_item.SetName(name) if(desc) new_item.desc = desc diff --git a/code/modules/fabrication/designs/protolathe/designs_power_cells.dm b/code/modules/fabrication/designs/protolathe/designs_power_cells.dm index 829d07e5de2e..cbf075f8fc08 100644 --- a/code/modules/fabrication/designs/protolathe/designs_power_cells.dm +++ b/code/modules/fabrication/designs/protolathe/designs_power_cells.dm @@ -8,8 +8,8 @@ /datum/fabricator_recipe/protolathe/cell/build() . = ..() - for(var/obj/item/cell/C in .) - C.charge = 0 + for(var/obj/item/cell/cell in .) + cell.charge = 0 /datum/fabricator_recipe/protolathe/cell/get_product_name() . = "power cell model ([..()])" diff --git a/code/modules/fabrication/designs/robotics/designs_organs.dm b/code/modules/fabrication/designs/robotics/designs_organs.dm index baaad0b945e5..bce2a16e8e93 100644 --- a/code/modules/fabrication/designs/robotics/designs_organs.dm +++ b/code/modules/fabrication/designs/robotics/designs_organs.dm @@ -20,7 +20,7 @@ /datum/fabricator_recipe/robotics/organ/build(turf/location, datum/fabricator_build_order/order) . = ..() - var/decl/species/species = get_species_by_key(order.get_data("species", global.using_map.default_species)) + var/decl/species/species = decls_repository.get_decl_by_id(order.get_data("species", global.using_map.default_species)) for(var/obj/item/organ/internal/I in .) I.set_species(species) I.set_bodytype(species.base_internal_prosthetics_model) diff --git a/code/modules/fabrication/designs/robotics/designs_prosthetics.dm b/code/modules/fabrication/designs/robotics/designs_prosthetics.dm index d8d93cc9feae..fcec37a7beef 100644 --- a/code/modules/fabrication/designs/robotics/designs_prosthetics.dm +++ b/code/modules/fabrication/designs/robotics/designs_prosthetics.dm @@ -62,7 +62,7 @@ var/decl/bodytype/prosthetic/company = GET_DECL(model) if(!istype(company)) return FALSE - var/decl/species/species = get_species_by_key(robofab.picked_prosthetic_species) + var/decl/species/species = decls_repository.get_decl_by_id(robofab.picked_prosthetic_species) if(!istype(species)) return FALSE var/obj/item/organ/target_limb = path @@ -92,7 +92,7 @@ /datum/fabricator_recipe/robotics/prosthetic/build(var/turf/location, var/datum/fabricator_build_order/order) . = ..() var/species_name = order.get_data("species", global.using_map.default_species) - var/decl/species/species = get_species_by_key(species_name) + var/decl/species/species = decls_repository.get_decl_by_id(species_name) if(species) for(var/obj/item/organ/external/E in .) E.set_species(species_name) diff --git a/code/modules/fabrication/designs/textile/job.dm b/code/modules/fabrication/designs/textile/job.dm index e0f376636b25..39ba3626a2ed 100644 --- a/code/modules/fabrication/designs/textile/job.dm +++ b/code/modules/fabrication/designs/textile/job.dm @@ -25,7 +25,7 @@ path = /obj/item/clothing/jumpsuit/research_director /datum/fabricator_recipe/textiles/job/medical/rdalt - path = /obj/item/clothing/jumpsuit/research_director/rdalt + path = /obj/item/clothing/costume/research_director_suit /datum/fabricator_recipe/textiles/job/medical/dress_rd path = /obj/item/clothing/skirt/research_director diff --git a/code/modules/fabrication/fabricator_bioprinter.dm b/code/modules/fabrication/fabricator_bioprinter.dm index 305322cb3d66..26e548f8d627 100644 --- a/code/modules/fabrication/fabricator_bioprinter.dm +++ b/code/modules/fabrication/fabricator_bioprinter.dm @@ -32,9 +32,9 @@ O.copy_from_mob_snapshot(D) O.status |= ORGAN_CUT_AWAY -/obj/machinery/fabricator/bioprinter/attackby(obj/item/W, mob/user) - if(istype(W,/obj/item/chems/syringe)) - var/obj/item/chems/syringe/S = W +/obj/machinery/fabricator/bioprinter/attackby(obj/item/used_item, mob/user) + if(istype(used_item,/obj/item/chems/syringe)) + var/obj/item/chems/syringe/S = used_item if(REAGENT_VOLUME(S.reagents, /decl/material/liquid/blood)) var/sample = REAGENT_DATA(S.reagents, /decl/material/liquid/blood) if(islist(sample)) @@ -48,7 +48,7 @@ //Tell nano to do its job SSnano.update_uis(src) return TRUE - to_chat(user, SPAN_WARNING("\The [src] displays an error: no viable blood sample could be obtained from \the [W].")) + to_chat(user, SPAN_WARNING("\The [src] displays an error: no viable blood sample could be obtained from \the [used_item].")) return TRUE . = ..() @@ -67,7 +67,7 @@ return list( "real_name" = loaded_dna.real_name, "UE" = loaded_dna.unique_enzymes, - "species" = loaded_dna.root_species.name, + "species" = loaded_dna.root_species.uid, "btype" = loaded_dna.blood_type, ) diff --git a/code/modules/fabrication/fabricator_intake.dm b/code/modules/fabrication/fabricator_intake.dm index 433bd25913ba..f3458e04a45f 100644 --- a/code/modules/fabrication/fabricator_intake.dm +++ b/code/modules/fabrication/fabricator_intake.dm @@ -6,23 +6,23 @@ /obj/machinery/fabricator/proc/take_reagents(var/obj/item/thing, var/mob/user, var/destructive = FALSE) if(!thing.reagents || (!destructive && !ATOM_IS_OPEN_CONTAINER(thing))) return SUBSTANCE_TAKEN_NONE - for(var/R in thing.reagents.reagent_volumes) - if(!base_storage_capacity[R]) + for(var/decl/material/reagent as anything in thing.reagents.reagent_volumes) + if(!base_storage_capacity[reagent.type]) continue - var/taking_reagent = min(REAGENT_VOLUME(thing.reagents, R), floor((storage_capacity[R] - stored_material[R]) * REAGENT_UNITS_PER_MATERIAL_UNIT)) + var/taking_reagent = min(REAGENT_VOLUME(thing.reagents, reagent), floor((storage_capacity[reagent.type] - stored_material[reagent.type]) * REAGENT_UNITS_PER_MATERIAL_UNIT)) if(taking_reagent <= 0) continue var/reagent_matter = round(taking_reagent / REAGENT_UNITS_PER_MATERIAL_UNIT) if(reagent_matter <= 0) continue - thing.remove_from_reagents(R, taking_reagent) - stored_material[R] += reagent_matter + thing.remove_from_reagents(reagent, taking_reagent) + stored_material[reagent.type] += reagent_matter // If we're destroying this, take everything. if(destructive) . = SUBSTANCE_TAKEN_ALL continue // Otherwise take the first applicable and useful reagent. - if(stored_material[R] == storage_capacity[R]) + if(stored_material[reagent.type] == storage_capacity[reagent.type]) return SUBSTANCE_TAKEN_FULL else if(thing.reagents.total_volume > 0) return SUBSTANCE_TAKEN_SOME @@ -91,13 +91,13 @@ else to_chat(user, SPAN_WARNING("\The [src] cannot process \the [thing].")) -/obj/machinery/fabricator/attackby(var/obj/item/O, var/mob/user) - if((. = component_attackby(O, user))) +/obj/machinery/fabricator/attackby(var/obj/item/used_item, var/mob/user) + if((. = component_attackby(used_item, user))) return - if(panel_open && (IS_MULTITOOL(O) || IS_WIRECUTTER(O))) + if(panel_open && (IS_MULTITOOL(used_item) || IS_WIRECUTTER(used_item))) attack_hand_with_interaction_checks(user) return TRUE - if((obj_flags & OBJ_FLAG_ANCHORABLE) && (IS_WRENCH(O) || IS_HAMMER(O))) + if((obj_flags & OBJ_FLAG_ANCHORABLE) && (IS_WRENCH(used_item) || IS_HAMMER(used_item))) return ..() if(stat & (NOPOWER | BROKEN)) return TRUE @@ -106,57 +106,62 @@ if(!user.check_intent(I_FLAG_HARM)) // Set or update our local network. - if(IS_MULTITOOL(O)) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/fabnet = get_extension(src, /datum/extension/local_network_member) fabnet.get_new_tag(user) return TRUE // Install new designs. - if(istype(O, /obj/item/disk/design_disk)) - var/obj/item/disk/design_disk/disk = O + if(istype(used_item, /obj/item/disk/design_disk)) + var/obj/item/disk/design_disk/disk = used_item if(!disk.blueprint) - to_chat(user, SPAN_WARNING("\The [O] is blank.")) + to_chat(user, SPAN_WARNING("\The [used_item] is blank.")) return TRUE if(disk.blueprint in installed_designs) - to_chat(user, SPAN_WARNING("\The [src] is already loaded with the blueprint stored on \the [O].")) + to_chat(user, SPAN_WARNING("\The [src] is already loaded with the blueprint stored on \the [used_item].")) return TRUE installed_designs += disk.blueprint design_cache |= disk.blueprint - visible_message(SPAN_NOTICE("\The [user] inserts \the [O] into \the [src], and after a second or so of loud clicking, the fabricator beeps and spits it out again.")) + visible_message(SPAN_NOTICE("\The [user] inserts \the [used_item] into \the [src], and after a second or so of loud clicking, the fabricator beeps and spits it out again.")) return TRUE + // Attempt to bash on harm intent. + // I'd like for this to be a more general parent call but instead it's just a direct check-and-call. + else if(!(used_item.item_flags & ITEM_FLAG_NO_BLUDGEON) && (. = bash(used_item, user))) // Bash successful, no need to try intake. + return + // TEMP HACK FIX: // Autolathes currently do not process atom contents. As a workaround, refuse all atoms with contents. - if(length(O.contents) && !ignore_input_contents_length) + if(length(used_item.contents) && !ignore_input_contents_length) to_chat(user, SPAN_WARNING("\The [src] cannot process an object containing other objects. Empty it out first.")) return TRUE // REMOVE FIX WHEN LATHES TAKE CONTENTS PLS. // Take reagents, if any are applicable. - var/atom_name = O.name - var/reagents_taken = take_reagents(O, user) + var/atom_name = used_item.name + var/reagents_taken = take_reagents(used_item, user) if(reagents_taken != SUBSTANCE_TAKEN_NONE) show_intake_message(user, reagents_taken, atom_name, took_reagents = TRUE) updateUsrDialog() return TRUE - if(!can_ingest(O)) - to_chat(user, SPAN_WARNING("\The [src] cannot process \the [O].")) + if(!can_ingest(used_item)) + to_chat(user, SPAN_WARNING("\The [src] cannot process \the [used_item].")) return TRUE // Take everything if we have a recycler. - if(!is_robot_module(O) && user.try_unequip(O)) - var/result = max(take_materials(O, user), max(reagents_taken, take_reagents(O, user, TRUE))) + if(!is_robot_module(used_item) && user.try_unequip(used_item)) + var/result = max(take_materials(used_item, user), max(reagents_taken, take_reagents(used_item, user, TRUE))) show_intake_message(user, result, atom_name) if(result == SUBSTANCE_TAKEN_NONE) - user.put_in_active_hand(O) + user.put_in_active_hand(used_item) return TRUE - if(istype(O, /obj/item/stack)) - var/obj/item/stack/stack = O + if(istype(used_item, /obj/item/stack)) + var/obj/item/stack/stack = used_item if(!QDELETED(stack) && stack.amount > 0) user.put_in_active_hand(stack) else - qdel(O) + qdel(used_item) updateUsrDialog() return TRUE . = ..() diff --git a/code/modules/fabrication/recycler.dm b/code/modules/fabrication/recycler.dm index 2d4fcb6299ec..d6da2d6efd70 100644 --- a/code/modules/fabrication/recycler.dm +++ b/code/modules/fabrication/recycler.dm @@ -73,7 +73,9 @@ qdel(munching) for(var/obj/item/thing in fell_out) - if(storage?.can_be_inserted(thing)) + if(QDELETED(thing)) + fell_out -= thing + else if(storage?.can_be_inserted(thing)) fell_out -= thing storage.handle_item_insertion(null, thing) @@ -112,29 +114,29 @@ if(munched_matter[mat] > 0) trace_matter[mat] += munched_matter[mat] * recycling_efficiency -/obj/machinery/recycler/attackby(obj/item/W, mob/user) +/obj/machinery/recycler/attackby(obj/item/used_item, mob/user) if(use_power == POWER_USE_ACTIVE) to_chat(user, SPAN_WARNING("\The [src] is currently processing, please wait for it to finish.")) return TRUE - if(W.storage && !user.check_intent(I_FLAG_HARM)) + if(used_item.storage && !user.check_intent(I_FLAG_HARM)) var/emptied = FALSE - for(var/obj/item/O in W.get_stored_inventory()) + for(var/obj/item/O in used_item.get_stored_inventory()) if(storage.can_be_inserted(O)) - W.storage.remove_from_storage(null, O, loc, skip_update = TRUE) + used_item.storage.remove_from_storage(null, O, loc, skip_update = TRUE) storage.handle_item_insertion(null, O, skip_update = TRUE) emptied = TRUE if(emptied) - W.storage.finish_bulk_removal() + used_item.storage.finish_bulk_removal() storage.update_ui_after_item_insertion() - if(length(W.get_stored_inventory())) - to_chat(user, SPAN_NOTICE("You partially empty \the [W] into \the [src]'s hopper.")) + if(length(used_item.get_stored_inventory())) + to_chat(user, SPAN_NOTICE("You partially empty \the [used_item] into \the [src]'s hopper.")) else - to_chat(user, SPAN_NOTICE("You empty \the [W] into \the [src]'s hopper.")) - W.update_icon() + to_chat(user, SPAN_NOTICE("You empty \the [used_item] into \the [src]'s hopper.")) + used_item.update_icon() return TRUE // Parent call so we can interact with the machinery aspect diff --git a/code/modules/fishing/fishing_rod.dm b/code/modules/fishing/fishing_rod.dm index 33961e74c429..ae8342c0f677 100644 --- a/code/modules/fishing/fishing_rod.dm +++ b/code/modules/fishing/fishing_rod.dm @@ -6,6 +6,7 @@ name = "fishing rod" desc = "A simple fishing rod with eyelets for stringing a line." material = /decl/material/solid/organic/wood/oak + color = /decl/material/solid/organic/wood/oak::color matter = null material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC icon = 'icons/obj/fishing_rod.dmi' @@ -231,12 +232,12 @@ return ..() -/obj/item/fishing_rod/attackby(obj/item/W, mob/user) +/obj/item/fishing_rod/attackby(obj/item/used_item, mob/user) - if(load_line(user, W)) + if(load_line(user, used_item)) return TRUE - if(istype(W, /obj/item/food)) + if(istype(used_item, /obj/item/food)) if(bait) to_chat(user, SPAN_WARNING("\The [src] already has \a [bait] on the hook.")) @@ -246,9 +247,9 @@ to_chat(user, SPAN_WARNING("\The [src] needs a line before you can bait it.")) return TRUE - if(user.try_unequip(W, src)) - bait = W - to_chat(user, SPAN_NOTICE("You thread \the [W] onto \the [src]'s hook.")) + if(user.try_unequip(used_item, src)) + bait = used_item + to_chat(user, SPAN_NOTICE("You thread \the [used_item] onto \the [src]'s hook.")) update_icon() return TRUE @@ -341,6 +342,7 @@ name = "advanced fishing rod" desc = "It's a fishing rod, an enhanced fiberglass Telescope Ultralight 47; the latest model." material = /decl/material/solid/fiberglass + color = /decl/material/solid/fiberglass::color matter = list( /decl/material/solid/metal/steel = MATTER_AMOUNT_REINFORCEMENT ) diff --git a/code/modules/food/assembled.dm b/code/modules/food/assembled.dm index 9df85094417f..861cb9494194 100644 --- a/code/modules/food/assembled.dm +++ b/code/modules/food/assembled.dm @@ -6,31 +6,31 @@ /obj/item/food/proc/get_combined_food_products() return -/obj/item/food/attackby(obj/item/W, mob/living/user) +/obj/item/food/attackby(obj/item/used_item, mob/living/user) - if(W?.storage) + if(used_item?.storage) return ..() // Plating food. - if(istype(W, /obj/item/plate)) - var/obj/item/plate/plate = W + if(istype(used_item, /obj/item/plate)) + var/obj/item/plate/plate = used_item if(plate.try_plate_food(src, user)) return TRUE // Eating with forks - if(user.check_intent(I_FLAG_HELP) && do_utensil_interaction(W, user)) + if(user.check_intent(I_FLAG_HELP) && do_utensil_interaction(used_item, user)) return TRUE // Hiding items inside larger food items. - if(!user.check_intent(I_FLAG_HARM) && is_sliceable() && W.w_class < w_class && !is_robot_module(W) && !istype(W, /obj/item/chems/condiment)) - if(user.try_unequip(W, src)) - to_chat(user, SPAN_NOTICE("You slip \the [W] inside \the [src].")) + if(!user.check_intent(I_FLAG_HARM) && is_sliceable() && used_item.w_class < w_class && !is_robot_module(used_item) && !istype(used_item, /obj/item/chems/condiment)) + if(user.try_unequip(used_item, src)) + to_chat(user, SPAN_NOTICE("You slip \the [used_item] inside \the [src].")) add_fingerprint(user) - W.forceMove(src) + used_item.forceMove(src) return TRUE // Creating food combinations. - if(try_create_combination(W, user)) + if(try_create_combination(used_item, user)) return TRUE return ..() @@ -38,8 +38,8 @@ /obj/item/food/proc/get_grown_tag() return -/obj/item/food/proc/try_create_combination(obj/item/W, mob/user) - if(!length(get_combined_food_products()) || !istype(W) || QDELETED(src) || QDELETED(W)) +/obj/item/food/proc/try_create_combination(obj/item/used_item, mob/user) + if(!length(get_combined_food_products()) || !istype(used_item) || QDELETED(src) || QDELETED(used_item)) return FALSE // See if we can make anything with this. @@ -47,9 +47,9 @@ if(!length(combined_food_products)) return FALSE - var/create_type = combined_food_products[W.type] - if(!create_type && istype(W, /obj/item/food)) - var/obj/item/food/food = W + var/create_type = combined_food_products[used_item.type] + if(!create_type && istype(used_item, /obj/item/food)) + var/obj/item/food/food = used_item var/check_grown_tag = food.get_grown_tag() if(check_grown_tag) create_type = combined_food_products[check_grown_tag] @@ -59,20 +59,20 @@ for(var/food_type in create_type) names[atom_info_repository.get_name_for(food_type)] = food_type create_type = input(user, "What do you want to make?", "Food Assembly") as null|anything in names - if(!create_type || QDELETED(user) || user.incapacitated() || QDELETED(src) || QDELETED(W)) + if(!create_type || QDELETED(user) || user.incapacitated() || QDELETED(src) || QDELETED(used_item)) return TRUE create_type = names[create_type] // TODO: move reagents/matter into produced food object. - if(ispath(create_type) && user.canUnEquip(src)) + if(ispath(create_type) && user.can_unequip_item(src)) var/obj/item/food/result if(ispath(create_type, /obj/item/food)) // Create the food with no plate, and move over any existing plate. result = new create_type(null, null, TRUE) // Skip plate creation. - if(istype(W, /obj/item/food)) - var/obj/item/food/other_food = W + if(istype(used_item, /obj/item/food)) + var/obj/item/food/other_food = used_item result.plate = other_food.plate other_food.plate = null @@ -92,13 +92,13 @@ user.put_in_hands(result) else result.dropInto(loc) - qdel(W) + qdel(used_item) qdel(src) to_chat(user, SPAN_NOTICE("You make \the [result]!")) return TRUE // Reverse the interaction to avoid the dumb thing where combinations aren't commutative. - var/obj/item/food/food = W + var/obj/item/food/food = used_item if(istype(food)) return food.try_create_combination(src, user) return FALSE diff --git a/code/modules/food/cooking/_recipe.dm b/code/modules/food/cooking/_recipe.dm index 1cbafb646903..aaba7b53fca2 100644 --- a/code/modules/food/cooking/_recipe.dm +++ b/code/modules/food/cooking/_recipe.dm @@ -121,11 +121,11 @@ var/global/list/_cooking_recipe_cache = list() return TRUE /decl/recipe/proc/check_reagents(datum/reagents/avail_reagents) - SHOULD_BE_PURE(TRUE) + // SHOULD_BE_PURE(TRUE) Due to use of GET_DECL() in REAGENT_VOLUME, this cannot be pure. if(length(avail_reagents?.reagent_volumes) < length(reagents)) return FALSE - for(var/rtype in reagents) - if(REAGENT_VOLUME(avail_reagents, rtype) < reagents[rtype]) + for(var/reagent in reagents) + if(REAGENT_VOLUME(avail_reagents, reagent) < reagents[reagent]) return FALSE return TRUE @@ -351,27 +351,27 @@ var/global/list/_cooking_recipe_cache = list() if(REAGENT_MAX) //We want the highest of each. //Iterate through everything in buffer. If the target has less than the buffer, then top it up - for (var/reagent_type in buffer.reagent_volumes) - var/rvol = REAGENT_VOLUME(holder, reagent_type) - var/bvol = REAGENT_VOLUME(buffer, reagent_type) + for (var/decl/material/reagent as anything in buffer.reagent_volumes) + var/rvol = REAGENT_VOLUME(holder, reagent) + var/bvol = REAGENT_VOLUME(buffer, reagent) if (rvol < bvol) //Transfer the difference - buffer.trans_type_to_holder(holder, reagent_type, bvol-rvol) + buffer.trans_type_to_holder(holder, reagent, bvol-rvol) if(REAGENT_MIN) //Min is slightly more complex. We want the result to have the lowest from each side //But zero will not count. Where a side has zero its ignored and the side with a nonzero value is used - for (var/reagent_type in buffer.reagent_volumes) - var/rvol = REAGENT_VOLUME(holder, reagent_type) - var/bvol = REAGENT_VOLUME(buffer, reagent_type) + for (var/decl/material/reagent as anything in buffer.reagent_volumes) + var/rvol = REAGENT_VOLUME(holder, reagent) + var/bvol = REAGENT_VOLUME(buffer, reagent) if (rvol == 0) //If the target has zero of this reagent - buffer.trans_type_to_holder(holder, reagent_type, bvol) + buffer.trans_type_to_holder(holder, reagent, bvol) //Then transfer all of ours else if (rvol > bvol) //if the target has more than ours //Remove the difference - holder.remove_reagent(reagent_type, rvol-bvol) + holder.remove_reagent(reagent, rvol-bvol) if(length(.) > 1) // If we're here, then holder is a buffer containing the total reagents diff --git a/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm b/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm index 0258f2e665a8..0efd5985f304 100644 --- a/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm +++ b/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm @@ -11,24 +11,38 @@ color = /decl/material/solid/metal/stainlesssteel::color amount_per_transfer_from_this = 15 + // Used for work sounds. + var/datum/sound_token/work_sound_token + var/sound_id + var/work_sound + var/cooking_category var/started_cooking var/decl/recipe/last_recipe +/obj/item/chems/cooking_vessel/Initialize(ml, material_key) + . = ..() + if(work_sound) + sound_id = "[work_sound]" + +/obj/item/chems/cooking_vessel/Destroy() + QDEL_NULL(work_sound_token) + return ..() + // TODO: ladle -/obj/item/chems/cooking_vessel/attackby(obj/item/W, mob/user) +/obj/item/chems/cooking_vessel/attackby(obj/item/used_item, mob/user) if(user.check_intent(I_FLAG_HARM)) return ..() // Fill or take from the vessel. - if(W.reagents && ATOM_IS_OPEN_CONTAINER(W)) - if(W.reagents.total_volume) - if(istype(W, /obj/item/chems)) - var/obj/item/chems/vessel = W + if(used_item.reagents && ATOM_IS_OPEN_CONTAINER(used_item)) + if(used_item.reagents.total_volume) + if(istype(used_item, /obj/item/chems)) + var/obj/item/chems/vessel = used_item if(vessel.standard_pour_into(user, src)) return TRUE - else if(standard_pour_into(user, W)) + else if(standard_pour_into(user, used_item)) return TRUE return ..() @@ -74,18 +88,15 @@ . += "\the [thing]" if(reagents?.total_volume) - for(var/solid_type in reagents.solid_volumes) - var/decl/material/reagent = GET_DECL(solid_type) - var/reagent_name = reagent.get_reagent_name(reagents, MAT_PHASE_SOLID) - . += "[reagents.solid_volumes[solid_type]]u of [reagent_name]" + for(var/decl/material/reagent as anything in reagents.solid_volumes) + . += "[reagents.solid_volumes[reagent]]u of [reagent.get_reagent_name(reagents, MAT_PHASE_SOLID)]" - for(var/liquid_type in reagents.liquid_volumes) - var/decl/material/reagent = GET_DECL(liquid_type) + for(var/decl/material/reagent as anything in reagents.liquid_volumes) var/reagent_name = reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID) if(!isnull(reagent.boiling_point) && temperature >= reagent.boiling_point && reagent.soup_hot_desc) - . += "[reagents.liquid_volumes[liquid_type]]u of [reagent.soup_hot_desc] [reagent_name]" + . += "[reagents.liquid_volumes[reagent]]u of [reagent.soup_hot_desc] [reagent_name]" else - . += "[reagents.liquid_volumes[liquid_type]]u of [reagent_name]" + . += "[reagents.liquid_volumes[reagent]]u of [reagent_name]" /obj/item/chems/cooking_vessel/get_examine_strings(mob/user, distance, infix, suffix) . = ..() @@ -104,6 +115,7 @@ //TODO fail last recipe started_cooking = null last_recipe = null + QDEL_NULL(work_sound_token) return PROCESS_KILL if(isnull(started_cooking) || recipe != last_recipe) started_cooking = world.time @@ -113,12 +125,14 @@ if(recipe && recipe == last_recipe && recipe.can_bulk_cook) // Bulk cooking has benefits like reduced cook time // we don't just do it instantly because there's messages each time - started_cooking = world.time + (recipe.cooking_time / 2) + started_cooking = world.time + (recipe.cooking_time / 5) else started_cooking = null last_recipe = null return last_recipe = recipe + if(!work_sound_token) + work_sound_token = play_looping_sound(src, sound_id, work_sound, volume = 30) update_icon() /obj/item/chems/cooking_vessel/on_update_icon() diff --git a/code/modules/food/cooking/cooking_vessels/pot.dm b/code/modules/food/cooking/cooking_vessels/pot.dm index b463944f3ed4..72e07956854d 100644 --- a/code/modules/food/cooking/cooking_vessels/pot.dm +++ b/code/modules/food/cooking/cooking_vessels/pot.dm @@ -6,6 +6,7 @@ cooking_category = RECIPE_CATEGORY_POT presentation_flags = PRESENTATION_FLAG_NAME obj_flags = OBJ_FLAG_HOLLOW | OBJ_FLAG_INSULATED_HANDLE + work_sound = 'sound/effects/boiling-water.ogg' var/last_boil_status var/last_boil_temp @@ -25,16 +26,19 @@ . = ..() /obj/item/chems/cooking_vessel/pot/ProcessAtomTemperature() + var/prior_temperature = temperature . = ..() + // to avoid issues with it cooling down in ..() and reheating the same tick, we use the highest of the two + // todo: just prevent the cooling instead, for a less-hacky solution + var/use_temperature = max(temperature, prior_temperature) // Largely ignore return value so we don't skip this update on the final time we temperature process. - if(temperature != last_boil_temp) + if(use_temperature != last_boil_temp) - last_boil_temp = temperature + last_boil_temp = use_temperature var/next_boil_status = FALSE - for(var/reagent_type in reagents?.reagent_volumes) - var/decl/material/reagent = GET_DECL(reagent_type) - if(!isnull(reagent.boiling_point) && temperature >= reagent.boiling_point) + for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + if(!isnull(reagent.boiling_point) && use_temperature >= reagent.boiling_point) next_boil_status = TRUE break diff --git a/code/modules/food/cooking/recipes/recipe_fried.dm b/code/modules/food/cooking/recipes/recipe_fried.dm index 3d4af90fc98d..7d6dcc2bc77c 100644 --- a/code/modules/food/cooking/recipes/recipe_fried.dm +++ b/code/modules/food/cooking/recipes/recipe_fried.dm @@ -11,7 +11,8 @@ ) /decl/recipe/fried/waffles - reagents = list(/decl/material/liquid/nutriment/batter/cakebatter = 20) + // salt is to disambiguate from vanilla cake + reagents = list(/decl/material/liquid/nutriment/batter/cakebatter = 20, /decl/material/solid/sodiumchloride = 1) result = /obj/item/food/waffles completion_message = "The waffles firm up and brown as the batter is cooked through." diff --git a/code/modules/food/plates/_plate.dm b/code/modules/food/plates/_plate.dm index 869b44baab8e..79cae23dbd0a 100644 --- a/code/modules/food/plates/_plate.dm +++ b/code/modules/food/plates/_plate.dm @@ -53,9 +53,9 @@ food.update_icon() return TRUE -/obj/item/plate/attackby(obj/item/W, mob/living/user) +/obj/item/plate/attackby(obj/item/used_item, mob/living/user) // Plating food. - if(try_plate_food(W, user)) + if(try_plate_food(used_item, user)) return TRUE return ..() diff --git a/code/modules/food/plates/plate_tray.dm b/code/modules/food/plates/plate_tray.dm index d38ce43225d5..0f6e01a1666a 100644 --- a/code/modules/food/plates/plate_tray.dm +++ b/code/modules/food/plates/plate_tray.dm @@ -50,23 +50,23 @@ if(.) scatter_contents() -/obj/item/plate/tray/attackby(obj/item/W, mob/user, click_params) - if(istype(W, /obj/item/kitchen/rollingpin)) +/obj/item/plate/tray/attackby(obj/item/used_item, mob/user, click_params) + if(istype(used_item, /obj/item/rollingpin)) if(cooldown < world.time - 25) - user.visible_message(SPAN_WARNING("\The [user] bashes \the [src] with \the [W]!")) + user.visible_message(SPAN_WARNING("\The [user] bashes \the [src] with \the [used_item]!")) playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1) cooldown = world.time return TRUE . = ..() if (.) - auto_align(W, click_params) + auto_align(used_item, click_params) //This proc handles alignment on trays, a la tables. -/obj/item/plate/tray/proc/auto_align(obj/item/W, click_params) - if (!W.center_of_mass) // Clothing, material stacks, generally items with large sprites where exact placement would be unhandy. - W.pixel_x = rand(-W.randpixel, W.randpixel) - W.pixel_y = rand(-W.randpixel, W.randpixel) - W.pixel_z = 0 +/obj/item/plate/tray/proc/auto_align(obj/item/aligning, click_params) + if (!aligning.center_of_mass) // Clothing, material stacks, generally items with large sprites where exact placement would be unhandy. + aligning.pixel_x = rand(-aligning.randpixel, aligning.randpixel) + aligning.pixel_y = rand(-aligning.randpixel, aligning.randpixel) + aligning.pixel_z = 0 return if (!click_params) @@ -83,11 +83,11 @@ var/cell_x = clamp(round(mouse_x/CELLSIZE), 0, CELLS-1) // Ranging from 0 to CELLS-1 var/cell_y = clamp(round(mouse_y/CELLSIZE), 0, CELLS-1) - var/list/center = cached_json_decode(W.center_of_mass) + var/list/center = cached_json_decode(aligning.center_of_mass) - W.pixel_x = (CELLSIZE * (cell_x + 0.5)) - center["x"] - W.pixel_y = (CELLSIZE * (cell_y + 0.5)) - center["y"] - W.pixel_z = 0 + aligning.pixel_x = (CELLSIZE * (cell_x + 0.5)) - center["x"] + aligning.pixel_y = (CELLSIZE * (cell_y + 0.5)) - center["y"] + aligning.pixel_z = 0 /obj/item/plate/tray/dump_contents(atom/forced_loc = loc, mob/user) if(!isturf(forced_loc)) //to handle hand switching diff --git a/code/modules/food/utensils/_utensil.dm b/code/modules/food/utensils/_utensil.dm index 7bc767b24e00..856ecd502bfb 100644 --- a/code/modules/food/utensils/_utensil.dm +++ b/code/modules/food/utensils/_utensil.dm @@ -59,14 +59,14 @@ add_overlay(overlay_image(icon, loaded_state, loaded_food.reagents?.get_color() || loaded_food.filling_color || get_color(), RESET_COLOR)) /obj/item/food/proc/handle_utensil_collection(obj/item/utensil/utensil, mob/user) - seperate_food_chunk(utensil, user) + separate_food_chunk(utensil, user) if(utensil.loaded_food) to_chat(user, SPAN_NOTICE("You collect [utensil.loaded_food] with \the [utensil].")) return TRUE return FALSE /obj/item/food/proc/handle_utensil_scooping(obj/item/utensil/utensil, mob/user) - seperate_food_chunk(utensil, user) + separate_food_chunk(utensil, user) if(utensil.loaded_food) to_chat(user, SPAN_NOTICE("You scoop up [utensil.loaded_food] with \the [utensil].")) return TRUE diff --git a/code/modules/games/boardgame.dm b/code/modules/games/boardgame.dm index 263020f25f41..266a7030ea99 100644 --- a/code/modules/games/boardgame.dm +++ b/code/modules/games/boardgame.dm @@ -23,14 +23,14 @@ M.examine_verb(src) return TRUE -/obj/item/board/attackby(obj/item/I, mob/user) - if(addPiece(I,user)) +/obj/item/board/attackby(obj/item/used_item, mob/user) + if(addPiece(used_item,user)) return TRUE return ..() -/obj/item/board/proc/addPiece(obj/item/I, mob/user, var/tile = 0) - if(I.w_class != ITEM_SIZE_TINY) //only small stuff - user.show_message("\The [I] is too big to be used as a board piece.") +/obj/item/board/proc/addPiece(obj/item/used_item, mob/user, var/tile = 0) + if(used_item.w_class != ITEM_SIZE_TINY) //only small stuff + user.show_message("\The [used_item] is too big to be used as a board piece.") return 0 if(num == 64) user.show_message("\The [src] is already full!") @@ -40,22 +40,22 @@ return 0 if(!user.Adjacent(src)) return 0 - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return 0 num++ - if(!board_icons["[I.icon] [I.icon_state]"]) - board_icons["[I.icon] [I.icon_state]"] = new /icon(I.icon,I.icon_state) + if(!board_icons["[used_item.icon] [used_item.icon_state]"]) + board_icons["[used_item.icon] [used_item.icon_state]"] = new /icon(used_item.icon,used_item.icon_state) if(tile == 0) var i; for(i=0;i<64;i++) if(!board["[i]"]) - board["[i]"] = I + board["[i]"] = used_item break else - board["[tile]"] = I + board["[tile]"] = used_item src.updateDialog() @@ -87,9 +87,9 @@ dat += "
    = 0) //check to see if clicked on tile is currently selected one if(text2num(s) == selected) selected = -1 //deselect it else - if(I) //cant put items on other items. + if(thing) //cant put items on other items. return //put item in new spot. - I = board["[selected]"] + thing = board["[selected]"] board["[selected]"] = null board -= "[selected]" board -= null - board["[s]"] = I + board["[s]"] = thing selected = -1 else - if(I) + if(thing) selected = text2num(s) else var/mob/living/human/H = locate(href_list["person"]) @@ -141,25 +141,25 @@ return addPiece(O,H,text2num(s)) if(href_list["remove"]) - var/obj/item/I = board["[selected]"] - if(!I) + var/obj/item/thing = board["[selected]"] + if(!thing) return board["[selected]"] = null board -= "[selected]" board -= null - I.forceMove(src.loc) + thing.forceMove(src.loc) num-- selected = -1 var j for(j=0;j<64;j++) if(board["[j]"]) var/obj/item/K = board["[j]"] - if(K.icon == I.icon && cmptext(K.icon_state,I.icon_state)) + if(K.icon == thing.icon && cmptext(K.icon_state,thing.icon_state)) src.updateDialog() return //Didn't find it in use, remove it and allow GC to delete it. - board_icons["[I.icon] [I.icon_state]"] = null - board_icons -= "[I.icon] [I.icon_state]" + board_icons["[thing.icon] [thing.icon_state]"] = null + board_icons -= "[thing.icon] [thing.icon_state]" board_icons -= null src.updateDialog() diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index 069c27f6b493..8f729cbb4bcb 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -145,13 +145,13 @@ var/global/list/card_decks = list() . += "
    There [cards.len == 1 ? "is" : "are"] still [cards.len] card\s." . += SPAN_NOTICE("You can deal cards at a table by clicking on it with grab intent.") -/obj/item/deck/attackby(obj/O, mob/user) - if(istype(O,/obj/item/hand)) - var/obj/item/hand/H = O +/obj/item/deck/attackby(obj/item/used_item, mob/user) + if(istype(used_item,/obj/item/hand)) + var/obj/item/hand/H = used_item for(var/datum/playingcard/P in H.cards) cards += P - qdel(O) + qdel(used_item) to_chat(user, "You place your cards on the bottom of \the [src].") return TRUE return ..() @@ -227,10 +227,10 @@ var/global/list/card_decks = list() H.throw_at(get_step(target, ismob(target) ? target.dir : target), 10, 1,user) -/obj/item/hand/attackby(obj/item/O, mob/user) +/obj/item/hand/attackby(obj/item/used_item, mob/user) - if(istype(O,/obj/item/hand)) - var/obj/item/hand/H = O + if(istype(used_item,/obj/item/hand)) + var/obj/item/hand/H = used_item for(var/datum/playingcard/P in cards) H.cards += P H.concealed = src.concealed @@ -239,7 +239,7 @@ var/global/list/card_decks = list() H.name = "hand of [(H.cards.len)] card\s" return TRUE - if(length(cards) == 1 && IS_PEN(O)) + if(length(cards) == 1 && IS_PEN(used_item)) var/datum/playingcard/P = cards[1] if(lowertext(P.name) != "blank card") to_chat(user, SPAN_WARNING("You cannot write on that card.")) @@ -408,7 +408,7 @@ var/global/list/card_decks = list() set_dir(initial(dir)) update_icon() -/obj/item/hand/on_picked_up(mob/user) +/obj/item/hand/on_picked_up(mob/user, atom/old_loc) ..() is_on_table = FALSE set_dir(initial(dir)) diff --git a/code/modules/gemstones/_gemstone.dm b/code/modules/gemstones/_gemstone.dm index d4e51499dd1f..b95cb57181d3 100644 --- a/code/modules/gemstones/_gemstone.dm +++ b/code/modules/gemstones/_gemstone.dm @@ -12,9 +12,11 @@ var/global/list/_available_gemstone_cuts name = "uncut gemstone" desc = "A hunk of uncut gemstone." icon = 'icons/obj/items/gemstones/uncut.dmi' + icon_state = ICON_STATE_WORLD w_class = ITEM_SIZE_TINY material = /decl/material/solid/gemstone/diamond material_alteration = MAT_FLAG_ALTERATION_COLOR // Name and desc are handled manually. + color = /decl/material/solid/gemstone/diamond::color var/decl/gemstone_cut/cut = /decl/gemstone_cut/uncut var/work_skill = SKILL_CONSTRUCTION @@ -90,38 +92,24 @@ var/global/list/_available_gemstone_cuts // Material subtypes. -/obj/item/gemstone/baguette/topaz - material = /decl/material/solid/gemstone/topaz - -/obj/item/gemstone/baguette/sapphire - material = /decl/material/solid/gemstone/sapphire - -/obj/item/gemstone/baguette/ruby - material = /decl/material/solid/gemstone/ruby - -/obj/item/gemstone/hexagon/topaz - material = /decl/material/solid/gemstone/topaz - -/obj/item/gemstone/hexagon/sapphire - material = /decl/material/solid/gemstone/sapphire - -/obj/item/gemstone/hexagon/ruby - material = /decl/material/solid/gemstone/ruby - -/obj/item/gemstone/octagon/topaz - material = /decl/material/solid/gemstone/topaz - -/obj/item/gemstone/octagon/sapphire - material = /decl/material/solid/gemstone/sapphire - -/obj/item/gemstone/octagon/ruby - material = /decl/material/solid/gemstone/ruby - -/obj/item/gemstone/round/topaz - material = /decl/material/solid/gemstone/topaz - -/obj/item/gemstone/round/sapphire - material = /decl/material/solid/gemstone/sapphire - -/obj/item/gemstone/round/ruby - material = /decl/material/solid/gemstone/ruby +#define MATERIAL_CUT_GEMSTONES(MAT)\ +/obj/item/gemstone/baguette/##MAT{\ + material = /decl/material/solid/gemstone/##MAT;\ + color = /decl/material/solid/gemstone/##MAT::color;\ +}\ +/obj/item/gemstone/hexagon/##MAT{\ + material = /decl/material/solid/gemstone/##MAT;\ + color = /decl/material/solid/gemstone/##MAT::color;\ +}\ +/obj/item/gemstone/octagon/##MAT{\ + material = /decl/material/solid/gemstone/##MAT;\ + color = /decl/material/solid/gemstone/##MAT::color;\ +}\ +/obj/item/gemstone/round/##MAT{\ + material = /decl/material/solid/gemstone/##MAT;\ + color = /decl/material/solid/gemstone/##MAT::color;\ +} + +MATERIAL_CUT_GEMSTONES(topaz) +MATERIAL_CUT_GEMSTONES(sapphire) +MATERIAL_CUT_GEMSTONES(ruby) \ No newline at end of file diff --git a/code/modules/genetics/plants/gene_special.dm b/code/modules/genetics/plants/gene_special.dm index 4d45d5cf599c..2e864d759695 100644 --- a/code/modules/genetics/plants/gene_special.dm +++ b/code/modules/genetics/plants/gene_special.dm @@ -4,6 +4,6 @@ TRAIT_TELEPORTING ) -/decl/plant_gene/special/mutate(datum/seed/seed, turf/location) +/decl/plant_gene/special/mutate(datum/seed/seed, atom/location) if(prob(65)) seed.set_trait(TRAIT_TELEPORTING, !seed.get_trait(TRAIT_TELEPORTING)) diff --git a/code/modules/genetics/plants/gene_vigour.dm b/code/modules/genetics/plants/gene_vigour.dm index 1d98a5480a2c..335556230cd6 100644 --- a/code/modules/genetics/plants/gene_vigour.dm +++ b/code/modules/genetics/plants/gene_vigour.dm @@ -7,7 +7,7 @@ TRAIT_SPREAD ) -/decl/plant_gene/vigour/mutate(datum/seed/seed, turf/location) +/decl/plant_gene/vigour/mutate(datum/seed/seed, atom/location) if(prob(65)) seed.set_trait(TRAIT_PRODUCTION, seed.get_trait(TRAIT_PRODUCTION)+rand(-1,1),10,0) if(prob(65)) diff --git a/code/modules/goals/_goal.dm b/code/modules/goals/_goal.dm index b36b7b50a406..9793c69f26ed 100644 --- a/code/modules/goals/_goal.dm +++ b/code/modules/goals/_goal.dm @@ -23,13 +23,13 @@ owner = null . = ..() -/datum/goal/proc/summarize(var/show_success = FALSE, var/allow_modification = FALSE, var/mob/caller ,var/position = 1) +/datum/goal/proc/summarize(var/show_success = FALSE, var/allow_modification = FALSE, var/mob/user ,var/position = 1) . = "[description][get_summary_value()]" if(show_success) . += get_success_string() if(allow_modification) - if(can_abandon) . += " (Abandon)" - if(can_reroll) . += " (Reroll)" + if(can_abandon) . += " (Abandon)" + if(can_reroll) . += " (Reroll)" /datum/goal/proc/get_success_string() return check_success() ? " Success!" : " Failure." diff --git a/code/modules/goals/definitions/department_clerical.dm b/code/modules/goals/definitions/department_clerical.dm index 75ac548eb873..99f093b7ea9b 100644 --- a/code/modules/goals/definitions/department_clerical.dm +++ b/code/modules/goals/definitions/department_clerical.dm @@ -20,8 +20,7 @@ SSgoals.pending_goals -= src return paperwork_type = pick(paperwork_types) - var/obj/item/paperwork/paperwork_type_obj = paperwork_type - waiting_for_signatories_description = replacetext(waiting_for_signatories_description, "%PAPERWORK%", "\the [initial(paperwork_type_obj.name)]") + waiting_for_signatories_description = replacetext(waiting_for_signatories_description, "%PAPERWORK%", "\the [atom_info_repository.get_name_for(paperwork_type)]") ..() @@ -74,8 +73,7 @@ if(!generated_paperwork) description = waiting_for_signatories_description else if(QDELETED(paperwork_instance)) - var/obj/item/paperwork/paperwork_type_obj = paperwork_type - description = "\The [initial(paperwork_type_obj.name)] has been destroyed." + description = "\The [atom_info_repository.get_name_for(paperwork_type)] has been destroyed." else if(length(paperwork_instance.needs_signed)) description = "Have \the [paperwork_instance] signed by [english_list(paperwork_instance.all_signatories)]." else @@ -128,8 +126,8 @@ if(length(has_signed)) . += SPAN_NOTICE("It has been signed by: [english_list(has_signed)].") -/obj/item/paperwork/attackby(obj/item/W, mob/user) - if(IS_PEN(W)) +/obj/item/paperwork/attackby(obj/item/used_item, mob/user) + if(IS_PEN(used_item)) if(user.real_name in has_signed) to_chat(user, SPAN_WARNING("You have already signed \the [src].")) return TRUE @@ -138,7 +136,7 @@ return TRUE LAZYADD(has_signed, user.real_name) LAZYREMOVE(needs_signed, user.real_name) - user.visible_message(SPAN_NOTICE("\The [user] signs \the [src] with \the [W].")) + user.visible_message(SPAN_NOTICE("\The [user] signs \the [src] with \the [used_item].")) associated_goal?.update_strings() update_icon() return TRUE diff --git a/code/modules/goals/definitions/personal_achievement_specific_object.dm b/code/modules/goals/definitions/personal_achievement_specific_object.dm index 722a4dbb199b..93c4883eedf9 100644 --- a/code/modules/goals/definitions/personal_achievement_specific_object.dm +++ b/code/modules/goals/definitions/personal_achievement_specific_object.dm @@ -65,4 +65,4 @@ /datum/goal/achievement/specific_object/pet/update_strings() ..() var/mob/animal = object_path - description = "Pet \a [initial(animal.name)]." + description = "Pet \a [initial(animal.name)]." // probably best not to use the atom info repository for this, lest we get 'Pet a monkey (666).' diff --git a/code/modules/goals/goal_ambition.dm b/code/modules/goals/goal_ambition.dm index 2029bc5cf23f..aa44ad99b10a 100644 --- a/code/modules/goals/goal_ambition.dm +++ b/code/modules/goals/goal_ambition.dm @@ -13,5 +13,5 @@ /datum/goal/ambition/get_success_string() return "" -/datum/goal/ambition/summarize(var/show_success = FALSE, var/allow_modification = FALSE, var/mob/caller ,var/position = 1) +/datum/goal/ambition/summarize(var/show_success = FALSE, var/allow_modification = FALSE, var/mob/user ,var/position = 1) . = SPAN_DANGER(..(show_success)) diff --git a/code/modules/goals/goal_mind.dm b/code/modules/goals/goal_mind.dm index debd412f1f57..a195dbd48e6b 100644 --- a/code/modules/goals/goal_mind.dm +++ b/code/modules/goals/goal_mind.dm @@ -8,12 +8,12 @@ if(LAZYLEN(goals)) to_chat(current, SPAN_NOTICE("

    You had the following personal goals this round:
    [jointext(summarize_goals(TRUE), "
    ")]")) -/datum/mind/proc/summarize_goals(var/show_success = FALSE, var/allow_modification = FALSE, var/mob/caller) +/datum/mind/proc/summarize_goals(var/show_success = FALSE, var/allow_modification = FALSE, var/mob/user) . = list() if(LAZYLEN(goals)) for(var/i = 1 to LAZYLEN(goals)) var/datum/goal/goal = goals[i] - . += "[i]. [goal.summarize(show_success, allow_modification, caller, position = i)]" + . += "[i]. [goal.summarize(show_success, allow_modification, user, position = i)]" // Create and display personal goals for this round. /datum/mind/proc/generate_goals(var/datum/job/job, var/adding_goals = FALSE, var/add_amount, var/is_spawning = FALSE) diff --git a/code/modules/goals/goal_mob.dm b/code/modules/goals/goal_mob.dm index ddd87767c254..ea3d8ce41261 100644 --- a/code/modules/goals/goal_mob.dm +++ b/code/modules/goals/goal_mob.dm @@ -30,7 +30,7 @@ else to_chat(src, SPAN_NOTICE("You have no personal goals this round.")) if(allow_modification && LAZYLEN(mind.goals) < 5) - to_chat(src, SPAN_NOTICE("Add Random Goal")) + to_chat(src, SPAN_NOTICE("Add Random Goal")) for(var/dept_key in mind.assigned_job?.department_types) var/decl/department/dept = SSjobs.get_department_by_type(dept_key) diff --git a/code/modules/holodeck/HolodeckObjects.dm b/code/modules/holodeck/HolodeckObjects.dm index f6da2d3ceaac..407b1b196dad 100644 --- a/code/modules/holodeck/HolodeckObjects.dm +++ b/code/modules/holodeck/HolodeckObjects.dm @@ -9,7 +9,7 @@ /turf/floor/holofloor/get_lumcount(var/minlum = 0, var/maxlum = 1) return 0.8 -/turf/floor/holofloor/attackby(obj/item/W, mob/user) +/turf/floor/holofloor/attackby(obj/item/used_item, mob/user) return TRUE // HOLOFLOOR DOES NOT GIVE A FUCK @@ -132,11 +132,11 @@ dir = NORTHEAST icon_state = "rwindow_full" -/obj/structure/window/reinforced/holowindow/attackby(obj/item/weapon, mob/user) - if(IS_SCREWDRIVER(weapon) || IS_CROWBAR(weapon) || IS_WRENCH(weapon)) +/obj/structure/window/reinforced/holowindow/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item) || IS_CROWBAR(used_item) || IS_WRENCH(used_item)) to_chat(user, SPAN_NOTICE("It's a holowindow, you can't dismantle it!")) return TRUE - return bash(weapon, user) + return bash(used_item, user) /obj/structure/window/reinforced/holowindow/shatter(var/display_message = 1) playsound(src, "shatter", 70, 1) @@ -148,16 +148,16 @@ // This subtype is deleted when a ready button in the same area is pressed. /obj/structure/window/reinforced/holowindow/disappearing -/obj/machinery/door/window/holowindoor/attackby(obj/item/I, mob/user) +/obj/machinery/door/window/holowindoor/attackby(obj/item/used_item, mob/user) if (src.operating == 1) return TRUE - if(src.density && istype(I, /obj/item) && !istype(I, /obj/item/card)) + if(src.density && istype(used_item, /obj/item) && !istype(used_item, /obj/item/card)) playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) - visible_message("\The [src] was hit by \the [I].") - if(I.atom_damage_type == BRUTE || I.atom_damage_type == BURN) - take_damage(I.expend_attack_force(user)) + visible_message("\The [src] was hit by \the [used_item].") + if(used_item.atom_damage_type == BRUTE || used_item.atom_damage_type == BURN) + take_damage(used_item.expend_attack_force(user)) return TRUE src.add_fingerprint(user) @@ -261,14 +261,14 @@ /obj/structure/holohoop/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if (istype(mover,/obj/item) && mover.throwing) - var/obj/item/I = mover - if(istype(I, /obj/item/projectile)) + var/obj/item/thing = mover + if(istype(thing, /obj/item/projectile)) return if(prob(50)) - I.dropInto(loc) - visible_message("Swish! \the [I] lands in \the [src].", range = 3) + thing.dropInto(loc) + visible_message("Swish! \the [thing] lands in \the [src].", range = 3) else - visible_message("\The [I] bounces off of \the [src]'s rim!", range = 3) + visible_message("\The [thing] bounces off of \the [src]'s rim!", range = 3) return 0 else return ..(mover, target, height, air_group) @@ -290,12 +290,12 @@ /obj/structure/holonet/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if (istype(mover,/obj/item) && mover.throwing) - var/obj/item/I = mover - if(istype(I, /obj/item/projectile)) + var/obj/item/thing = mover + if(istype(thing, /obj/item/projectile)) return if(prob(10)) - I.dropInto(loc) - visible_message("Swish! \the [I] gets caught in \the [src].", range = 3) + thing.dropInto(loc) + visible_message("Swish! \the [thing] gets caught in \the [src].", range = 3) return 0 else return 1 @@ -320,7 +320,7 @@ to_chat(user, "The AI is not to interact with these devices!") return -/obj/machinery/readybutton/attackby(obj/item/W, mob/user) +/obj/machinery/readybutton/attackby(obj/item/used_item, mob/user) to_chat(user, "The device is a solid button, there's nothing you can do with it!") return TRUE @@ -359,8 +359,8 @@ eventstarted = 1 - for(var/obj/structure/window/reinforced/holowindow/disappearing/W in currentarea) - qdel(W) + for(var/obj/structure/window/reinforced/holowindow/disappearing/window in currentarea) + qdel(window) for(var/mob/M in currentarea) to_chat(M, "FIGHT!") diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index e453199fe213..3f9b4b7f1503 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -15,6 +15,18 @@ var/seeds_extracted = FALSE var/datum/seed/seed +// This is sort of pointless while food is a valid input on the ChemMaster but maybe +// in the future there will be some more interesting ways to process growns/food. +/obj/item/food/grown/handle_centrifuge_process(obj/machinery/centrifuge/centrifuge) + if(!(. = ..())) + return + if(reagents?.total_volume) + reagents.trans_to_holder(centrifuge.loaded_beaker.reagents, reagents.total_volume) + for(var/obj/item/thing in contents) + thing.dropInto(centrifuge.loc) + for(var/atom/movable/thing in convert_matter_to_lumps()) + thing.dropInto(centrifuge.loc) + /obj/item/food/grown/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(user && distance <= 1 && seed && user.skill_check(work_skill, SKILL_BASIC)) @@ -126,19 +138,18 @@ var/list/descriptors = list() - for(var/rtype in reagents.reagent_volumes) - var/decl/material/chem = GET_DECL(rtype) - if(chem.fruit_descriptor) - descriptors |= chem.fruit_descriptor - if(chem.reflectiveness >= MAT_VALUE_SHINY) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(reagent.fruit_descriptor) + descriptors |= reagent.fruit_descriptor + if(reagent.reflectiveness >= MAT_VALUE_SHINY) descriptors |= "shiny" - if(chem.slipperiness >= 10) + if(reagent.slipperiness >= 10) descriptors |= "slippery" - if(chem.toxicity >= 3) + if(reagent.toxicity >= 3) descriptors |= "poisonous" - if(chem.radioactivity) + if(reagent.radioactivity) descriptors |= "radioactive" - if(chem.solvent_power >= MAT_SOLVENT_STRONG) + if(reagent.solvent_power >= MAT_SOLVENT_STRONG) descriptors |= "acidic" if(seed.get_trait(TRAIT_JUICY)) @@ -219,13 +230,13 @@ var/global/list/_wood_materials = list( if(!seed?.show_slice_message_poor(user, tool, src)) ..() -/obj/item/food/grown/attackby(var/obj/item/W, var/mob/user) +/obj/item/food/grown/attackby(var/obj/item/used_item, var/mob/user) if(!seed || user.check_intent(I_FLAG_HARM)) return ..() - if(seed.get_trait(TRAIT_PRODUCES_POWER) && IS_COIL(W)) - var/obj/item/stack/cable_coil/C = W + if(seed.get_trait(TRAIT_PRODUCES_POWER) && IS_COIL(used_item)) + var/obj/item/stack/cable_coil/C = used_item if(C.use(5)) //TODO: generalize this. to_chat(user, SPAN_NOTICE("You add some cable to \the [src] and slide it inside the battery casing.")) @@ -236,15 +247,15 @@ var/global/list/_wood_materials = list( pocell.charge = pocell.maxcharge return TRUE - if(IS_KNIFE(W) && !seeds_extracted && !seed.grown_is_seed && seed.min_seed_extracted && user.skill_check(work_skill, SKILL_BASIC)) + if(IS_KNIFE(used_item) && !seeds_extracted && !seed.grown_is_seed && seed.min_seed_extracted && user.skill_check(work_skill, SKILL_BASIC)) var/seed_result = max(1, rand(seed.min_seed_extracted, seed.max_seed_extracted)) - visible_message(SPAN_NOTICE("\The [user] uses \the [W] to lever [seed_result] seed\s out of \the [src].")) + visible_message(SPAN_NOTICE("\The [user] uses \the [used_item] to lever [seed_result] seed\s out of \the [src].")) for(var/i = 1 to seed_result) new /obj/item/seeds/extracted(get_turf(user), material?.type, seed) seeds_extracted = TRUE return TRUE - if(IS_HATCHET(W) && seed.chems) + if(IS_HATCHET(used_item) && seed.chems) for(var/wood_mat in global._wood_materials) if(!isnull(seed.chems[wood_mat])) user.visible_message(SPAN_NOTICE("\The [user] makes planks out of \the [src].")) @@ -253,13 +264,13 @@ var/global/list/_wood_materials = list( qdel(src) return TRUE - if(istype(W, /obj/item/paper)) + if(istype(used_item, /obj/item/paper)) if(!dry) to_chat(user, SPAN_WARNING("You need to dry \the [src] first!")) return TRUE - if(!user.try_unequip(W)) + if(!user.try_unequip(used_item)) return TRUE var/obj/item/clothing/mask/smokable/cigarette/rolled/R = new(get_turf(src)) @@ -270,11 +281,11 @@ var/global/list/_wood_materials = list( else R.create_reagents(R.chem_volume) - R.brand = "[src] handrolled in \the [W]." + R.brand = "[src] handrolled in \the [used_item]." reagents.trans_to_holder(R.reagents, R.chem_volume) - to_chat(user, SPAN_NOTICE("You roll \the [src] into \the [W].")) + to_chat(user, SPAN_NOTICE("You roll \the [src] into \the [used_item].")) user.put_in_active_hand(R) - qdel(W) + qdel(used_item) qdel(src) return TRUE @@ -323,7 +334,7 @@ var/global/list/_wood_materials = list( return ..() -/obj/item/food/grown/on_picked_up(mob/user) +/obj/item/food/grown/on_picked_up(mob/user, atom/old_loc) ..() if(!seed) return diff --git a/code/modules/hydroponics/grown_inedible.dm b/code/modules/hydroponics/grown_inedible.dm index e9cdda705d9f..173d19639f9d 100644 --- a/code/modules/hydroponics/grown_inedible.dm +++ b/code/modules/hydroponics/grown_inedible.dm @@ -9,9 +9,9 @@ throw_range = 20 material = /decl/material/solid/organic/plantmatter -/obj/item/corncob/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/circular_saw) || IS_HATCHET(W) || istype(W, /obj/item/knife)) - to_chat(user, "You use [W] to fashion a pipe out of the corn cob!") +/obj/item/corncob/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/circular_saw) || IS_HATCHET(used_item) || istype(used_item, /obj/item/knife)) + to_chat(user, "You use [used_item] to fashion a pipe out of the corn cob!") new /obj/item/clothing/mask/smokable/pipe/cobpipe (user.loc) qdel(src) return TRUE diff --git a/code/modules/hydroponics/plant_types/seeds_misc.dm b/code/modules/hydroponics/plant_types/seeds_misc.dm index 8ee10be8c9dd..a36f8486b7f3 100644 --- a/code/modules/hydroponics/plant_types/seeds_misc.dm +++ b/code/modules/hydroponics/plant_types/seeds_misc.dm @@ -414,8 +414,8 @@ chems = list( /decl/material/liquid/nutriment = list(1), /decl/material/liquid/brute_meds = list(1,8), - /decl/material/liquid/antidepressants = list(1,8,1), - /decl/material/liquid/stimulants = list(1,8,1), + /decl/material/liquid/accumulated/antidepressants = list(1,8,1), + /decl/material/liquid/accumulated/stimulants = list(1,8,1), /decl/material/liquid/amphetamines = list(1,10,1), /decl/material/liquid/psychoactives = list(1,10) ) @@ -560,6 +560,7 @@ set_trait(TRAIT_POTENCY,10) set_trait(TRAIT_PRODUCT_ICON,"mushroom") set_trait(TRAIT_PRODUCT_COLOUR,"#ff4545") + set_trait(TRAIT_LEAVES_COLOUR,"#ff4545") // to make it so they aren't pale while immature set_trait(TRAIT_PLANT_COLOUR,"#e0ddba") set_trait(TRAIT_PLANT_ICON,"mushroom4") @@ -579,6 +580,7 @@ set_trait(TRAIT_PRODUCT_COLOUR,"#ede8ea") set_trait(TRAIT_PLANT_COLOUR,"#e6d8dd") set_trait(TRAIT_PLANT_ICON,"mushroom5") + set_trait(TRAIT_LEAVES_COLOUR,null) /datum/seed/mushroom/towercap name = "towercap" @@ -1528,8 +1530,8 @@ set_trait(TRAIT_YIELD,5) set_trait(TRAIT_PRODUCT_ICON,"treefruit") set_trait(TRAIT_PRODUCT_COLOUR,"#a80000") - set_trait(TRAIT_PLANT_COLOUR,"#749733") - set_trait(TRAIT_PLANT_ICON,"vine2") + set_trait(TRAIT_PLANT_COLOUR,"#7acf3c") + set_trait(TRAIT_PLANT_ICON,"tree2") set_trait(TRAIT_IDEAL_HEAT, 299) set_trait(TRAIT_IDEAL_LIGHT, 6) set_trait(TRAIT_WATER_CONSUMPTION, 6) diff --git a/code/modules/hydroponics/seed.dm b/code/modules/hydroponics/seed.dm index d61f42d51ba0..bf56a5e39f18 100644 --- a/code/modules/hydroponics/seed.dm +++ b/code/modules/hydroponics/seed.dm @@ -511,11 +511,11 @@ return pick(mutants) //Mutates the plant overall (randomly). -/datum/seed/proc/mutate(var/degree,var/turf/source_turf) +/datum/seed/proc/mutate(var/degree, var/atom/location) if(!degree || get_trait(TRAIT_IMMUTABLE) > 0) return - source_turf.visible_message("\The [display_name] quivers!") + location.visible_message("\The [display_name] quivers!") //This looks like shit, but it's a lot easier to read/change this way. var/total_mutations = rand(1,1+degree) @@ -523,7 +523,7 @@ switch(rand(0,11)) if(0) //Plant cancer! set_trait(TRAIT_ENDURANCE,get_trait(TRAIT_ENDURANCE)-rand(10,20),null,0) - source_turf.visible_message("\The [display_name] withers rapidly!") + location.visible_message("\The [display_name] withers rapidly!") if(1) set_trait(TRAIT_NUTRIENT_CONSUMPTION,get_trait(TRAIT_NUTRIENT_CONSUMPTION)+rand(-(degree*0.1),(degree*0.1)),5,0) set_trait(TRAIT_WATER_CONSUMPTION, get_trait(TRAIT_WATER_CONSUMPTION) +rand(-degree,degree),50,0) @@ -545,7 +545,7 @@ if(prob(degree*5)) set_trait(TRAIT_CARNIVOROUS, get_trait(TRAIT_CARNIVOROUS)+rand(-degree,degree),2, 0) if(get_trait(TRAIT_CARNIVOROUS)) - source_turf.visible_message("\The [display_name] shudders hungrily.") + location.visible_message("\The [display_name] shudders hungrily.") if(6) set_trait(TRAIT_WEED_TOLERANCE, get_trait(TRAIT_WEED_TOLERANCE)+(rand(-2,2)*degree),10, 0) if(prob(degree*5)) @@ -559,7 +559,7 @@ set_trait(TRAIT_POTENCY, get_trait(TRAIT_POTENCY)+(rand(-20,20)*degree),200, 0) if(prob(degree*5)) set_trait(TRAIT_SPREAD, get_trait(TRAIT_SPREAD)+rand(-1,1),2, 0) - source_turf.visible_message("\The [display_name] spasms visibly, shifting in the tray.") + location.visible_message("\The [display_name] spasms visibly, shifting in the tray.") if(9) set_trait(TRAIT_MATURATION, get_trait(TRAIT_MATURATION)+(rand(-1,1)*degree),30, 0) if(prob(degree*5)) @@ -568,12 +568,12 @@ if(prob(degree*2)) set_trait(TRAIT_BIOLUM, !get_trait(TRAIT_BIOLUM)) if(get_trait(TRAIT_BIOLUM)) - source_turf.visible_message("\The [display_name] begins to glow!") + location.visible_message("\The [display_name] begins to glow!") if(prob(degree*2)) set_trait(TRAIT_BIOLUM_COLOUR,get_random_colour(0,75,190)) - source_turf.visible_message("\The [display_name]'s glow changes colour!") + location.visible_message("\The [display_name]'s glow changes colour!") else - source_turf.visible_message("\The [display_name]'s glow dims...") + location.visible_message("\The [display_name]'s glow dims...") if(11) set_trait(TRAIT_TELEPORTING,1) diff --git a/code/modules/hydroponics/seed_gene_mut.dm b/code/modules/hydroponics/seed_gene_mut.dm index a80cf2fd106f..1dbb3b1baf87 100644 --- a/code/modules/hydroponics/seed_gene_mut.dm +++ b/code/modules/hydroponics/seed_gene_mut.dm @@ -1,11 +1,11 @@ -/datum/seed/proc/diverge_mutate_gene(var/decl/plant_gene/G, var/turf/T) - if(!istype(G)) +/datum/seed/proc/diverge_mutate_gene(var/decl/plant_gene/gene, var/atom/location) + if(!istype(gene)) log_debug("Attempted to mutate [src] with a non-plantgene var.") return src - var/datum/seed/S = diverge() //Let's not modify all of the seeds. - T.visible_message("\The [S.display_name] quivers!") //Mimicks the normal mutation. - G.mutate(S, T) + var/datum/seed/seed = diverge() //Let's not modify all of the seeds. + location.visible_message("\The [seed.display_name] quivers!") //Mimicks the normal mutation. + gene.mutate(seed, location) - return S + return seed diff --git a/code/modules/hydroponics/seed_machines.dm b/code/modules/hydroponics/seed_machines.dm index 17fbe753529f..af1d79e8cbd5 100644 --- a/code/modules/hydroponics/seed_machines.dm +++ b/code/modules/hydroponics/seed_machines.dm @@ -66,33 +66,33 @@ visible_message("[html_icon(src)] [src] beeps and spits out [loaded_disk].") loaded_disk = null -/obj/machinery/botany/attackby(obj/item/W, mob/user) - if(istype(W,/obj/item/seeds)) +/obj/machinery/botany/attackby(obj/item/used_item, mob/user) + if(istype(used_item,/obj/item/seeds)) if(seed) to_chat(user, "There is already a seed loaded.") return TRUE - var/obj/item/seeds/S = W + var/obj/item/seeds/S = used_item if(S.seed && S.seed.get_trait(TRAIT_IMMUTABLE) > 0) to_chat(user, "That seed is not compatible with our genetics technology.") - else if(user.try_unequip(W, src)) - seed = W - to_chat(user, "You load [W] into [src].") + else if(user.try_unequip(used_item, src)) + seed = used_item + to_chat(user, "You load [used_item] into [src].") return TRUE - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) open = !open to_chat(user, "You [open ? "open" : "close"] the maintenance panel.") return TRUE - if(open && IS_CROWBAR(W)) + if(open && IS_CROWBAR(used_item)) dismantle() return TRUE - if(istype(W,/obj/item/disk/botany)) + if(istype(used_item,/obj/item/disk/botany)) if(loaded_disk) to_chat(user, "There is already a data disk loaded.") return TRUE - var/obj/item/disk/botany/B = W + var/obj/item/disk/botany/B = used_item if(B.genes && B.genes.len) if(!disk_needs_genes) to_chat(user, "That disk already has gene data loaded.") @@ -101,10 +101,10 @@ if(disk_needs_genes) to_chat(user, "That disk does not have any gene data loaded.") return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - loaded_disk = W - to_chat(user, "You load [W] into [src].") + loaded_disk = used_item + to_chat(user, "You load [used_item] into [src].") return TRUE return ..() diff --git a/code/modules/hydroponics/seed_mobs.dm b/code/modules/hydroponics/seed_mobs.dm index 852c7eaae74f..6f12b930e6e0 100644 --- a/code/modules/hydroponics/seed_mobs.dm +++ b/code/modules/hydroponics/seed_mobs.dm @@ -7,7 +7,7 @@ spawn(15 SECONDS) if(!host.ckey && !host.client) - host.death() // This seems redundant, but a lot of mobs don't + host.death() // This seems redundant, but a lot of mobs don't host.set_stat(DEAD) // handle death() properly. Better safe than etc. host.visible_message("\The [host] is malformed and unable to survive. It expires pitifully, leaving behind some seeds.") diff --git a/code/modules/hydroponics/seed_storage.dm b/code/modules/hydroponics/seed_storage.dm index 6aa7d2372d15..d854110a206f 100644 --- a/code/modules/hydroponics/seed_storage.dm +++ b/code/modules/hydroponics/seed_storage.dm @@ -4,14 +4,14 @@ var/datum/seed/seed_type // Keeps track of what our seed is var/list/obj/item/seeds/seeds = list() // Tracks actual objects contained in the pile -/datum/seed_pile/New(var/obj/item/seeds/O) - name = O.name +/datum/seed_pile/New(var/obj/item/seeds/new_seeds) + name = new_seeds.name amount = 1 - seed_type = O.seed - seeds += O + seed_type = new_seeds.seed + seeds += new_seeds -/datum/seed_pile/proc/matches(var/obj/item/seeds/O) - if (O.seed == seed_type) +/datum/seed_pile/proc/matches(var/obj/item/seeds/check_seeds) + if (check_seeds.seed == seed_type) return 1 return 0 @@ -45,8 +45,7 @@ if(isnull(amount)) amount = 1 for (var/i = 1 to amount) - var/O = new typepath - add(O) + add(new typepath) /obj/machinery/seed_storage/Destroy() QDEL_NULL_LIST(piles) @@ -295,15 +294,15 @@ switch(task) if ("vend") - var/obj/O = pick(our_pile.seeds) - if (O) + var/obj/vending_seeds = pick(our_pile.seeds) + if (vending_seeds) --our_pile.amount - our_pile.seeds -= O + our_pile.seeds -= vending_seeds if (our_pile.amount <= 0 || our_pile.seeds.len <= 0) piles -= our_pile qdel(our_pile) flick("[initial(icon_state)]-vend", src) - O.dropInto(loc) + vending_seeds.dropInto(loc) . = TOPIC_REFRESH if ("purge") QDEL_LIST(our_pile.seeds) @@ -313,45 +312,45 @@ piles -= our_pile QDEL_NULL(our_pile) -/obj/machinery/seed_storage/attackby(var/obj/item/O, var/mob/user) +/obj/machinery/seed_storage/attackby(var/obj/item/used_item, var/mob/user) - if(istype(O, /obj/item/seeds)) - add(O) - user.visible_message(SPAN_NOTICE("\The [user] puts \the [O] into \the [src].")) + if(istype(used_item, /obj/item/seeds)) + add(used_item) + user.visible_message(SPAN_NOTICE("\The [user] puts \the [used_item] into \the [src].")) return TRUE - if(istype(O, /obj/item/plants) && O.storage) + if(istype(used_item, /obj/item/plants) && used_item.storage) var/loaded = 0 for(var/obj/item/seeds/G in storage.get_contents()) ++loaded - O.storage.remove_from_storage(user, G, src, TRUE) + used_item.storage.remove_from_storage(user, G, src, TRUE) add(G, 1) - O.storage.finish_bulk_removal() + used_item.storage.finish_bulk_removal() if (loaded) - user.visible_message(SPAN_NOTICE("\The [user] puts the seeds from \the [O] into \the [src].")) + user.visible_message(SPAN_NOTICE("\The [user] puts the seeds from \the [used_item] into \the [src].")) else - to_chat(user, SPAN_WARNING("There are no seeds in \the [O].")) + to_chat(user, SPAN_WARNING("There are no seeds in \the [used_item].")) return TRUE return ..() -/obj/machinery/seed_storage/proc/add(var/obj/item/seeds/O, bypass_removal = 0) +/obj/machinery/seed_storage/proc/add(var/obj/item/seeds/adding_seeds, bypass_removal = 0) if(!bypass_removal) - if (ismob(O.loc)) - var/mob/user = O.loc - if(!user.try_unequip(O, src)) + if (ismob(adding_seeds.loc)) + var/mob/user = adding_seeds.loc + if(!user.try_unequip(adding_seeds, src)) return - else if(isobj(O.loc)) - O.loc?.storage?.remove_from_storage(null, O, src) + else if(isobj(adding_seeds.loc)) + adding_seeds.loc?.storage?.remove_from_storage(null, adding_seeds, src) - O.forceMove(src) + adding_seeds.forceMove(src) for (var/datum/seed_pile/N in piles) - if (N.matches(O)) + if (N.matches(adding_seeds)) ++N.amount - N.seeds += (O) + N.seeds += adding_seeds return - piles += new /datum/seed_pile(O) + piles += new /datum/seed_pile(adding_seeds) flick("[initial(icon_state)]-vend", src) return diff --git a/code/modules/hydroponics/spreading/spreading.dm b/code/modules/hydroponics/spreading/spreading.dm index 0980347c73d7..2b772c7f15f4 100644 --- a/code/modules/hydroponics/spreading/spreading.dm +++ b/code/modules/hydroponics/spreading/spreading.dm @@ -197,10 +197,10 @@ floor = 1 return 1 -/obj/effect/vine/attackby(var/obj/item/W, var/mob/user) +/obj/effect/vine/attackby(var/obj/item/used_item, var/mob/user) START_PROCESSING(SSvines, src) - if(W.has_edge() && W.w_class < ITEM_SIZE_NORMAL && !user.check_intent(I_FLAG_HARM)) + if(used_item.has_edge() && used_item.w_class < ITEM_SIZE_NORMAL && !user.check_intent(I_FLAG_HARM)) if(!is_mature()) to_chat(user, SPAN_WARNING("\The [src] is not mature enough to yield a sample yet.")) return TRUE @@ -216,11 +216,11 @@ return TRUE else . = ..() - var/damage = W.expend_attack_force(user) - if(W.has_edge()) + var/damage = used_item.expend_attack_force(user) + if(used_item.has_edge()) damage *= 2 adjust_health(-damage) - playsound(get_turf(src), W.hitsound, 100, 1) + playsound(get_turf(src), used_item.hitsound, 100, 1) //handles being overrun by vines - note that attacker_parent may be null in some cases /obj/effect/vine/proc/vine_overrun(datum/seed/attacker_seed, obj/effect/vine/attacker_parent) diff --git a/code/modules/hydroponics/spreading/spreading_response.dm b/code/modules/hydroponics/spreading/spreading_response.dm index 1eaa5fba5651..ad0400849daa 100644 --- a/code/modules/hydroponics/spreading/spreading_response.dm +++ b/code/modules/hydroponics/spreading/spreading_response.dm @@ -78,7 +78,7 @@ if(H.species.species_flags & SPECIES_FLAG_NO_TANGLE) return - if(victim.loc != loc && victim.can_slip()) + if(victim.loc != loc && !victim.can_slip()) visible_message("Tendrils lash to drag \the [victim] but \the [src] can't pull them across the ground!") return diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index 6745fdaf11c9..f3e74bd61470 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -194,7 +194,7 @@ if(istype(Proj, /obj/item/projectile/energy/floramut/gene)) var/obj/item/projectile/energy/floramut/gene/G = Proj if(seed) - set_seed(seed.diverge_mutate_gene(G.gene, get_turf(loc)), reset_values = FALSE) //get_turf just in case it's not in a turf. + set_seed(seed.diverge_mutate_gene(G.gene, src), reset_values = FALSE) else mutate(1) return @@ -236,37 +236,37 @@ reagents.trans_to_obj(temp_chem_holder, min(reagents.total_volume,rand(1,3))) - for(var/R in temp_chem_holder.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in temp_chem_holder.reagents.reagent_volumes) - var/reagent_total = REAGENT_VOLUME(temp_chem_holder.reagents, R) + var/reagent_total = REAGENT_VOLUME(temp_chem_holder.reagents, reagent) if(seed && !dead) //Handle some general level adjustments. - if(toxic_reagents[R]) - toxins += toxic_reagents[R] * reagent_total - if(weedkiller_reagents[R]) - weedlevel += weedkiller_reagents[R] * reagent_total - if(pestkiller_reagents[R]) - pestlevel += pestkiller_reagents[R] * reagent_total + if(toxic_reagents[reagent.type]) + toxins += toxic_reagents[reagent.type] * reagent_total + if(weedkiller_reagents[reagent.type]) + weedlevel += weedkiller_reagents[reagent.type] * reagent_total + if(pestkiller_reagents[reagent.type]) + pestlevel += pestkiller_reagents[reagent.type] * reagent_total // Beneficial reagents have a few impacts along with health buffs. - if(beneficial_reagents[R]) - plant_health += beneficial_reagents[R][1] * reagent_total - yield_mod += beneficial_reagents[R][2] * reagent_total - mutation_mod += beneficial_reagents[R][3] * reagent_total + if(beneficial_reagents[reagent.type]) + plant_health += beneficial_reagents[reagent.type][1] * reagent_total + yield_mod += beneficial_reagents[reagent.type][2] * reagent_total + mutation_mod += beneficial_reagents[reagent.type][3] * reagent_total // Mutagen is distinct from the previous types and mostly has a chance of proccing a mutation. - if(mutagenic_reagents[R]) - mutation_level += reagent_total*mutagenic_reagents[R]+mutation_mod + if(mutagenic_reagents[reagent.type]) + mutation_level += reagent_total*mutagenic_reagents[reagent.type]+mutation_mod // Handle nutrient refilling. - if(nutrient_reagents[R]) - nutrilevel += nutrient_reagents[R] * reagent_total + if(nutrient_reagents[reagent.type]) + nutrilevel += nutrient_reagents[reagent.type] * reagent_total // Handle water and water refilling. var/water_added = 0 - if(water_reagents[R]) - var/water_input = water_reagents[R] * reagent_total + if(water_reagents[reagent.type]) + var/water_input = water_reagents[reagent.type] * reagent_total water_added += water_input waterlevel += water_input @@ -354,7 +354,7 @@ // harvested yet and it's safe to assume it's restricted to this tray. if(!isnull(SSplants.seeds[seed.name])) set_seed(seed.diverge(), reset_values = FALSE) - seed.mutate(severity,get_turf(src)) + seed.mutate(severity, src) return @@ -497,7 +497,7 @@ to_chat(user, "You [anchored ? "wrench" : "unwrench"] \the [src].") return TRUE - if(seed) + if(user.check_intent(I_FLAG_HARM) && seed) var/force = used_item.expend_attack_force(user) if(force) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) diff --git a/code/modules/hydroponics/trays/tray_soil.dm b/code/modules/hydroponics/trays/tray_soil.dm index 279cc704d58d..e0c42fa58163 100644 --- a/code/modules/hydroponics/trays/tray_soil.dm +++ b/code/modules/hydroponics/trays/tray_soil.dm @@ -91,13 +91,13 @@ break return ..() -/obj/machinery/portable_atmospherics/hydroponics/soil/attackby(var/obj/item/O, var/mob/user) +/obj/machinery/portable_atmospherics/hydroponics/soil/attackby(var/obj/item/used_item, var/mob/user) - if(istype(O, /obj/item/stack/material/brick)) + if(istype(used_item, /obj/item/stack/material/brick)) if(reinforced_with) to_chat(user, SPAN_WARNING("\The [src] has already been fenced with bricks.")) return TRUE - var/obj/item/stack/material/brick/bricks = O + var/obj/item/stack/material/brick/bricks = used_item if(bricks.get_amount() < 4) to_chat(user, SPAN_WARNING("You need at least four bricks to fence off \the [src].")) return TRUE @@ -111,13 +111,13 @@ neighbor.update_icon() return TRUE - if(!seed && user.check_intent(I_FLAG_HARM) && (IS_SHOVEL(O) || IS_HOE(O))) - var/use_tool = O.get_tool_quality(TOOL_SHOVEL) > O.get_tool_quality(TOOL_HOE) ? TOOL_SHOVEL : TOOL_HOE + if(!seed && user.check_intent(I_FLAG_HARM) && (IS_SHOVEL(used_item) || IS_HOE(used_item))) + var/use_tool = used_item.get_tool_quality(TOOL_SHOVEL) > used_item.get_tool_quality(TOOL_HOE) ? TOOL_SHOVEL : TOOL_HOE if(use_tool) - if(O.do_tool_interaction(use_tool, user, src, 3 SECONDS, "filling in", "filling in", check_skill = SKILL_BOTANY)) + if(used_item.do_tool_interaction(use_tool, user, src, 3 SECONDS, "filling in", "filling in", check_skill = SKILL_BOTANY)) qdel(src) return TRUE - if(istype(O, /obj/item/tank)) + if(istype(used_item, /obj/item/tank)) return TRUE return ..() diff --git a/code/modules/implants/implant_types/adrenaline.dm b/code/modules/implants/implant_types/adrenaline.dm index e93b99158db2..ec6f6166e42b 100644 --- a/code/modules/implants/implant_types/adrenaline.dm +++ b/code/modules/implants/implant_types/adrenaline.dm @@ -26,9 +26,9 @@ uses-- to_chat(imp_in, "You feel a sudden surge of energy!") - imp_in.set_status(STAT_STUN, 0) - imp_in.set_status(STAT_WEAK, 0) - imp_in.set_status(STAT_PARA, 0) + imp_in.set_status_condition(STAT_STUN, 0) + imp_in.set_status_condition(STAT_WEAK, 0) + imp_in.set_status_condition(STAT_PARA, 0) /obj/item/implant/adrenalin/implanted(mob/source) source.StoreMemory("\A [src] can be activated by using the pale emote, say *pale to attempt to activate.", /decl/memory_options/system) diff --git a/code/modules/implants/implant_types/chem.dm b/code/modules/implants/implant_types/chem.dm index ccb8f8467b1f..a98016b2d583 100644 --- a/code/modules/implants/implant_types/chem.dm +++ b/code/modules/implants/implant_types/chem.dm @@ -40,14 +40,14 @@ var/global/list/chem_implants = list() reagents.trans_to_mob(R, amount, CHEM_INJECT) to_chat(R, "You hear a faint *beep*.") -/obj/item/implant/chem/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/chems/syringe)) +/obj/item/implant/chem/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/chems/syringe)) if(reagents.total_volume >= reagents.maximum_volume) to_chat(user, "\The [src] is full.") else if(do_after(user,5,src)) - I.reagents.trans_to_obj(src, 5) - to_chat(user, "You inject 5 units of the solution. The syringe now contains [I.reagents.total_volume] units.") + used_item.reagents.trans_to_obj(src, 5) + to_chat(user, "You inject 5 units of the solution. The syringe now contains [used_item.reagents.total_volume] units.") return TRUE else return ..() diff --git a/code/modules/implants/implantcase.dm b/code/modules/implants/implantcase.dm index 36bb284a2c51..9f754b9c8685 100644 --- a/code/modules/implants/implantcase.dm +++ b/code/modules/implants/implantcase.dm @@ -40,10 +40,10 @@ icon_state = "implantcase-0" // TODO: the name stuff here probably doesn't work, this needs an update_name override -/obj/item/implantcase/attackby(obj/item/I, mob/user) - if (IS_PEN(I)) +/obj/item/implantcase/attackby(obj/item/used_item, mob/user) + if (IS_PEN(used_item)) var/t = input(user, "What would you like the label to be?", src.name, null) - if (user.get_active_held_item() != I) + if (user.get_active_held_item() != used_item) return TRUE if((!in_range(src, usr) && loc != user)) return TRUE @@ -55,10 +55,10 @@ SetName(initial(name)) desc = "A case containing an implant." return TRUE - else if(istype(I, /obj/item/chems/syringe) && istype(imp,/obj/item/implant/chem)) - return imp.attackby(I,user) - else if (istype(I, /obj/item/implanter)) - var/obj/item/implanter/M = I + else if(istype(used_item, /obj/item/chems/syringe) && istype(imp,/obj/item/implant/chem)) + return imp.attackby(used_item,user) + else if (istype(used_item, /obj/item/implanter)) + var/obj/item/implanter/M = used_item if (M.imp && !imp && !M.imp.implanted) M.imp.forceMove(src) imp = M.imp @@ -71,9 +71,9 @@ update_icon() M.update_icon() return TRUE - else if (istype(I, /obj/item/implant) && user.try_unequip(I, src)) - to_chat(usr, "You slide \the [I] into \the [src].") - imp = I + else if (istype(used_item, /obj/item/implant) && user.try_unequip(used_item, src)) + to_chat(usr, "You slide \the [used_item] into \the [src].") + imp = used_item update_description() update_icon() return TRUE diff --git a/code/modules/implants/implanter.dm b/code/modules/implants/implanter.dm index ccc430483419..409c2cb362a3 100644 --- a/code/modules/implants/implanter.dm +++ b/code/modules/implants/implanter.dm @@ -59,10 +59,10 @@ return 1 return 0 -/obj/item/implanter/attackby(obj/item/I, mob/user) - if(!imp && istype(I, /obj/item/implant) && user.try_unequip(I,src)) - to_chat(usr, SPAN_NOTICE("You slide \the [I] into \the [src].")) - imp = I +/obj/item/implanter/attackby(obj/item/used_item, mob/user) + if(!imp && istype(used_item, /obj/item/implant) && user.try_unequip(used_item,src)) + to_chat(usr, SPAN_NOTICE("You slide \the [used_item] into \the [src].")) + imp = used_item update_icon() return TRUE return ..() diff --git a/code/modules/implants/implantpad.dm b/code/modules/implants/implantpad.dm index a2b1afb11fb4..4e6f78b10013 100644 --- a/code/modules/implants/implantpad.dm +++ b/code/modules/implants/implantpad.dm @@ -22,9 +22,9 @@ update_icon() return TRUE -/obj/item/implantpad/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/implantcase)) - var/obj/item/implantcase/C = I +/obj/item/implantpad/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/implantcase)) + var/obj/item/implantcase/C = used_item if(!imp && C.imp) C.imp.forceMove(src) imp = C.imp @@ -35,8 +35,8 @@ imp = null C.update_icon() . = TRUE - else if(istype(I, /obj/item/implanter)) - var/obj/item/implanter/C = I + else if(istype(used_item, /obj/item/implanter)) + var/obj/item/implanter/C = used_item if(!imp && C.imp) C.imp.forceMove(src) imp = C.imp @@ -47,8 +47,8 @@ imp = null C.update_icon() . = TRUE - else if(istype(I, /obj/item/implant) && user.try_unequip(I, src)) - imp = I + else if(istype(used_item, /obj/item/implant) && user.try_unequip(used_item, src)) + imp = used_item . = TRUE if(.) update_icon() diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index e8637643e086..4e784c115474 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -64,11 +64,10 @@ /obj/item/electronic_assembly/examined_by(mob/user, distance, infix, suffix) . = ..() - for(var/I in assembly_components) - var/obj/item/integrated_circuit/IC = I - IC.external_examine(user) + for(var/obj/item/integrated_circuit/component as anything in assembly_components) + component.external_examine(user) if(opened) - IC.internal_examine(user) + component.internal_examine(user) if(opened) interact(user) @@ -123,11 +122,10 @@ visible_message(SPAN_WARNING("\The [src] shudders and sparks.")) power_failure = TRUE // Now spend it. - for(var/I in assembly_components) - var/obj/item/integrated_circuit/IC = I - if(IC.power_draw_idle) - if(power_failure || !draw_power(IC.power_draw_idle)) - IC.power_fail() + for(var/obj/item/integrated_circuit/component as anything in assembly_components) + if(component.power_draw_idle) + if(power_failure || !draw_power(component.power_draw_idle)) + component.power_fail() /obj/item/electronic_assembly/receive_mouse_drop(atom/dropping, mob/user, params) . = ..() @@ -306,9 +304,8 @@ //This only happens when this EA is loaded via the printer /obj/item/electronic_assembly/proc/post_load() - for(var/I in assembly_components) - var/obj/item/integrated_circuit/IC = I - IC.on_data_written() + for(var/obj/item/integrated_circuit/component as anything in assembly_components) + component.on_data_written() /obj/item/electronic_assembly/proc/return_total_complexity() . = 0 @@ -325,36 +322,36 @@ . += part.size // Returns true if the circuit made it inside. -/obj/item/electronic_assembly/proc/try_add_component(obj/item/integrated_circuit/IC, mob/user) +/obj/item/electronic_assembly/proc/try_add_component(obj/item/integrated_circuit/component, mob/user) if(!opened) to_chat(user, "\The [src]'s hatch is closed, you can't put anything inside.") return FALSE - if(IC.w_class > w_class) - to_chat(user, "\The [IC] is way too big to fit into \the [src].") + if(component.w_class > w_class) + to_chat(user, "\The [component] is way too big to fit into \the [src].") return FALSE var/total_part_size = return_total_size() var/total_complexity = return_total_complexity() - if((total_part_size + IC.size) > max_components) - to_chat(user, "You can't seem to add the '[IC]', as there's insufficient space.") + if((total_part_size + component.size) > max_components) + to_chat(user, "You can't seem to add the '[component]', as there's insufficient space.") return FALSE - if((total_complexity + IC.complexity) > max_complexity) - to_chat(user, "You can't seem to add the '[IC]', since this setup's too complicated for the case.") + if((total_complexity + component.complexity) > max_complexity) + to_chat(user, "You can't seem to add the '[component]', since this setup's too complicated for the case.") return FALSE - if((allowed_circuit_action_flags & IC.action_flags) != IC.action_flags) - to_chat(user, "You can't seem to add the '[IC]', since the case doesn't support the circuit type.") + if((allowed_circuit_action_flags & component.action_flags) != component.action_flags) + to_chat(user, "You can't seem to add the '[component]', since the case doesn't support the circuit type.") return FALSE - if(!user.try_unequip(IC,src)) + if(!user.try_unequip(component,src)) return FALSE - to_chat(user, "You slide [IC] inside [src].") + to_chat(user, "You slide [component] inside [src].") playsound(src, 'sound/items/Deconstruct.ogg', 50, 1) add_allowed_scanner(user.ckey) - add_component(IC) + add_component(component) return TRUE @@ -365,22 +362,22 @@ assembly_components |= component -/obj/item/electronic_assembly/proc/try_remove_component(obj/item/integrated_circuit/IC, mob/user, silent) +/obj/item/electronic_assembly/proc/try_remove_component(obj/item/integrated_circuit/component, mob/user, silent) if(!opened) if(!silent) to_chat(user, "[src]'s hatch is closed, so you can't fiddle with the internal components.") return FALSE - if(!IC.removable) + if(!component.removable) if(!silent) to_chat(user, "[src] is permanently attached to the case.") return FALSE - remove_component(IC) + remove_component(component) if(!silent) - to_chat(user, "You pop \the [IC] out of the case, and slide it out.") + to_chat(user, "You pop \the [component] out of the case, and slide it out.") playsound(src, 'sound/items/crowbar.ogg', 50, 1) - user.put_in_hands(IC) + user.put_in_hands(component) add_allowed_scanner(user.ckey) // Make sure we're not on an invalid page @@ -406,50 +403,50 @@ visible_message("\The [user] points \the [src] towards \the [target].") -/obj/item/electronic_assembly/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/integrated_circuit)) - if(!user.canUnEquip(I)) +/obj/item/electronic_assembly/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/integrated_circuit)) + if(!user.can_unequip_item(used_item)) return FALSE - if(try_add_component(I, user)) + if(try_add_component(used_item, user)) return TRUE else for(var/obj/item/integrated_circuit/input/S in assembly_components) - S.attackby_react(I, user, user.get_intent()) + S.attackby_react(used_item, user, user.get_intent()) return ..() - else if(IS_MULTITOOL(I) || istype(I, /obj/item/integrated_electronics/wirer) || istype(I, /obj/item/integrated_electronics/debugger)) + else if(IS_MULTITOOL(used_item) || istype(used_item, /obj/item/integrated_electronics/wirer) || istype(used_item, /obj/item/integrated_electronics/debugger)) if(opened) interact(user) return TRUE else to_chat(user, "[src]'s hatch is closed, so you can't fiddle with the internal components.") for(var/obj/item/integrated_circuit/input/S in assembly_components) - S.attackby_react(I, user, user.get_intent()) + S.attackby_react(used_item, user, user.get_intent()) return ..() - else if(istype(I, /obj/item/cell)) + else if(istype(used_item, /obj/item/cell)) if(!opened) to_chat(user, "[src]'s hatch is closed, so you can't access \the [src]'s power supplier.") for(var/obj/item/integrated_circuit/input/S in assembly_components) - S.attackby_react(I, user, user.get_intent()) + S.attackby_react(used_item, user, user.get_intent()) return ..() if(battery) to_chat(user, "[src] already has \a [battery] installed. Remove it first if you want to replace it.") for(var/obj/item/integrated_circuit/input/S in assembly_components) - S.attackby_react(I, user, user.get_intent()) + S.attackby_react(used_item, user, user.get_intent()) return ..() - var/obj/item/cell/cell = I - if(user.try_unequip(I,loc)) - user.drop_from_inventory(I, loc) + var/obj/item/cell/cell = used_item + if(user.try_unequip(used_item,loc)) + user.drop_from_inventory(used_item, loc) cell.forceMove(src) battery = cell playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) to_chat(user, "You slot \the [cell] inside \the [src]'s power supplier.") return TRUE return FALSE - else if(istype(I, /obj/item/integrated_electronics/detailer)) - var/obj/item/integrated_electronics/detailer/D = I + else if(istype(used_item, /obj/item/integrated_electronics/detailer)) + var/obj/item/integrated_electronics/detailer/D = used_item detail_color = D.detail_color update_icon() - else if(IS_SCREWDRIVER(I)) + else if(IS_SCREWDRIVER(used_item)) var/hatch_locked = FALSE for(var/obj/item/integrated_circuit/manipulation/hatchlock/H in assembly_components) // If there's more than one hatch lock, only one needs to be enabled for the assembly to be locked @@ -467,8 +464,8 @@ update_icon() return TRUE - else if(IS_COIL(I)) - var/obj/item/stack/cable_coil/C = I + else if(IS_COIL(used_item)) + var/obj/item/stack/cable_coil/C = used_item if(is_damaged() && do_after(user, 10, src) && C.use(1)) user.visible_message("\The [user] patches up \the [src].") current_health = min(get_max_health(), current_health + 5) @@ -476,7 +473,7 @@ else if(!user.check_intent(I_FLAG_HARM)) for(var/obj/item/integrated_circuit/input/S in assembly_components) - S.attackby_react(I, user, user.get_intent()) + S.attackby_react(used_item, user, user.get_intent()) return TRUE return ..() //Handle weapon attacks and etc @@ -489,9 +486,8 @@ /obj/item/electronic_assembly/emp_act(severity) . = ..() - for(var/I in src) - var/atom/movable/AM = I - AM.emp_act(severity) + for(var/atom/movable/thing as anything in get_contained_external_atoms()) + thing.emp_act(severity) // Returns true if power was successfully drawn. /obj/item/electronic_assembly/proc/draw_power(amount) diff --git a/code/modules/integrated_electronics/core/printer.dm b/code/modules/integrated_electronics/core/printer.dm index 52bd8428adde..a27fd59fe930 100644 --- a/code/modules/integrated_electronics/core/printer.dm +++ b/code/modules/integrated_electronics/core/printer.dm @@ -46,59 +46,59 @@ assembly.creator = key_name(user) cloning = FALSE -/obj/item/integrated_circuit_printer/proc/recycle(obj/item/O, mob/user, obj/item/electronic_assembly/assembly) - if(!O.canremove) //in case we have an augment circuit +/obj/item/integrated_circuit_printer/proc/recycle(obj/item/used_item, mob/user, obj/item/electronic_assembly/assembly) + if(!used_item.canremove) //in case we have an augment circuit return - for(var/material in O.matter) - if(materials[material] + O.matter[material] > metal_max) + for(var/material in used_item.matter) + if(materials[material] + used_item.matter[material] > metal_max) var/decl/material/material_datum = GET_DECL(material) if(material_datum) to_chat(user, "[src] can't hold any more [material_datum.name]!") return - for(var/material in O.matter) - materials[material] += O.matter[material] + for(var/material in used_item.matter) + materials[material] += used_item.matter[material] if(assembly) - assembly.remove_component(O) + assembly.remove_component(used_item) if(user) - to_chat(user, "You recycle [O]!") - qdel(O) + to_chat(user, "You recycle [used_item]!") + qdel(used_item) return TRUE -/obj/item/integrated_circuit_printer/attackby(obj/item/O, mob/user) - if(istype(O, /obj/item/stack/material)) - var/obj/item/stack/material/M = O - var/amt = M.amount - if(amt * SHEET_MATERIAL_AMOUNT + materials[M.material.type] > metal_max) - amt = ceil((metal_max - materials[M.material.type]) / SHEET_MATERIAL_AMOUNT) - if(!M.use(amt)) +/obj/item/integrated_circuit_printer/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/stack/material)) + var/obj/item/stack/material/stack = used_item + var/amt = stack.amount + if(amt * SHEET_MATERIAL_AMOUNT + materials[stack.material.type] > metal_max) + amt = ceil((metal_max - materials[stack.material.type]) / SHEET_MATERIAL_AMOUNT) + if(!stack.use(amt)) return FALSE - materials[M.material.type] = min(metal_max, materials[M.material.type] + amt * SHEET_MATERIAL_AMOUNT) - to_chat(user, "You insert [M.material.solid_name] into \the [src].") + materials[stack.material.type] = min(metal_max, materials[stack.material.type] + amt * SHEET_MATERIAL_AMOUNT) + to_chat(user, "You insert [stack.material.solid_name] into \the [src].") if(user) attack_self(user) // We're really bad at refreshing the UI, so this is the best we've got. return TRUE - if(istype(O, /obj/item/disk/integrated_circuit/upgrade/advanced)) + if(istype(used_item, /obj/item/disk/integrated_circuit/upgrade/advanced)) if(upgraded) to_chat(user, "[src] already has this upgrade. ") return TRUE - to_chat(user, "You install [O] into [src]. ") + to_chat(user, "You install [used_item] into [src]. ") upgraded = TRUE if(user) attack_self(user) return TRUE - if(istype(O, /obj/item/disk/integrated_circuit/upgrade/clone)) + if(istype(used_item, /obj/item/disk/integrated_circuit/upgrade/clone)) if(fast_clone) to_chat(user, "[src] already has this upgrade. ") return TRUE - to_chat(user, "You install [O] into [src]. Circuit cloning will now be instant. ") + to_chat(user, "You install [used_item] into [src]. Circuit cloning will now be instant. ") fast_clone = TRUE if(user) attack_self(user) return TRUE - if(istype(O, /obj/item/electronic_assembly)) - var/obj/item/electronic_assembly/EA = O //microtransactions not included + if(istype(used_item, /obj/item/electronic_assembly)) + var/obj/item/electronic_assembly/EA = used_item //microtransactions not included if(EA.battery) to_chat(user, "Remove [EA]'s power cell first!") return TRUE @@ -127,8 +127,8 @@ else return recycle(EA, user) - if(istype(O, /obj/item/integrated_circuit)) - return recycle(O, user) + if(istype(used_item, /obj/item/integrated_circuit)) + return recycle(used_item, user) return ..() @@ -191,16 +191,16 @@ var/list/current_list = SScircuit.circuit_fabricator_recipe_list[current_category] for(var/path in current_list) - var/obj/O = path + var/obj/building = path var/can_build = TRUE if(ispath(path, /obj/item/integrated_circuit)) var/obj/item/integrated_circuit/IC = path if((initial(IC.spawn_flags) & IC_SPAWN_RESEARCH) && (!(initial(IC.spawn_flags) & IC_SPAWN_DEFAULT)) && !upgraded) can_build = FALSE if(can_build) - HTML += "\[[initial(O.name)]\]: [initial(O.desc)]
    " + HTML += "\[[initial(building.name)]\]: [initial(building.desc)]
    " else - HTML += "\[[initial(O.name)]\]: [initial(O.desc)]
    " + HTML += "\[[initial(building.name)]\]: [initial(building.desc)]
    " popup.set_content(JOINTEXT(HTML)) popup.open() diff --git a/code/modules/integrated_electronics/subtypes/converters.dm b/code/modules/integrated_electronics/subtypes/converters.dm index 2b91f12b1ec4..f76195c1c7ce 100644 --- a/code/modules/integrated_electronics/subtypes/converters.dm +++ b/code/modules/integrated_electronics/subtypes/converters.dm @@ -411,8 +411,8 @@ var/hue = get_pin_data(IC_INPUT, 1) var/saturation = get_pin_data(IC_INPUT, 2) var/value = get_pin_data(IC_INPUT, 3) - if(isnum(hue)&&isnum(saturation)&&isnum(value)) - result = HSVtoRGB(hsv(AngleToHue(hue),saturation,value)) + if(isnum(hue) && isnum(saturation) && isnum(value)) + result = hsv(hue, saturation, value) set_pin_data(IC_OUTPUT, 1, result) push_data() diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index 336cf7b55443..0e0492966ced 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -292,16 +292,15 @@ /obj/item/integrated_circuit/input/gene_scanner/do_work() var/list/greagents = list() - var/obj/machinery/portable_atmospherics/hydroponics/H = get_pin_data_as_type(IC_INPUT, 1, /obj/machinery/portable_atmospherics/hydroponics) - if(!istype(H)) //Invalid input + var/obj/machinery/portable_atmospherics/hydroponics/plant = get_pin_data_as_type(IC_INPUT, 1, /obj/machinery/portable_atmospherics/hydroponics) + if(!istype(plant)) //Invalid input return for(var/i=1, i<=outputs.len, i++) set_pin_data(IC_OUTPUT, i, null) - if(H in view(get_turf(src))) // Like the medbot's analyzer it can be used at range. - if(H.seed) - for(var/chem_path in H.seed.chems) - var/decl/material/R = chem_path - greagents.Add(initial(R.name)) + if(plant.seed && (plant in view(get_turf(src)))) // Like the medbot's analyzer it can be used at range. + for(var/chem_path in plant.seed.chems) + var/decl/material/material = GET_DECL(chem_path) + greagents.Add(material.use_name) set_pin_data(IC_OUTPUT, 1, greagents) push_data() @@ -987,13 +986,13 @@ set_pin_data(IC_OUTPUT, 2, null) set_pin_data(IC_OUTPUT, 3, null) if(O) - var/obj/item/cell/C = O.get_cell() - if(C) + var/obj/item/cell/cell = O.get_cell() + if(cell) var/turf/A = get_turf(src) if(get_turf(O) in view(A)) - set_pin_data(IC_OUTPUT, 1, C.charge) - set_pin_data(IC_OUTPUT, 2, C.maxcharge) - set_pin_data(IC_OUTPUT, 3, C.percent()) + set_pin_data(IC_OUTPUT, 1, cell.charge) + set_pin_data(IC_OUTPUT, 2, cell.maxcharge) + set_pin_data(IC_OUTPUT, 3, cell.percent()) push_data() activate_pin(2) return diff --git a/code/modules/integrated_electronics/subtypes/manipulation.dm b/code/modules/integrated_electronics/subtypes/manipulation.dm index 82449cc6ab6f..4148ac842ee5 100644 --- a/code/modules/integrated_electronics/subtypes/manipulation.dm +++ b/code/modules/integrated_electronics/subtypes/manipulation.dm @@ -34,9 +34,9 @@ QDEL_NULL(installed_gun) return ..() -/obj/item/integrated_circuit/manipulation/weapon_firing/attackby(var/obj/O, var/mob/user) - if(istype(O, /obj/item/gun/energy)) - var/obj/item/gun/energy/gun = O +/obj/item/integrated_circuit/manipulation/weapon_firing/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/gun/energy)) + var/obj/item/gun/energy/gun = used_item if(installed_gun) to_chat(user, "There's already a weapon installed.") return TRUE @@ -181,15 +181,18 @@ detach_grenade() return ..() -/obj/item/integrated_circuit/manipulation/grenade/attackby(var/obj/item/grenade/G, var/mob/user) - if(istype(G)) +/obj/item/integrated_circuit/manipulation/grenade/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/grenade)) if(attached_grenade) to_chat(user, "There is already a grenade attached!") return TRUE - if(user.try_unequip(G,src)) - user.visible_message("\The [user] attaches \a [G] to \the [src]!", "You attach \the [G] to \the [src].") - attach_grenade(G) - G.forceMove(src) + if(user.try_unequip(used_item,src)) + user.visible_message( + SPAN_WARNING("\The [user] attaches \a [used_item] to \the [src]!"), + SPAN_NOTICE("You attach \the [used_item] to \the [src].") + ) + attach_grenade(used_item) + used_item.forceMove(src) return TRUE else return ..() @@ -215,9 +218,9 @@ log_and_message_admins("activated a grenade assembly. Last touches: Assembly: [holder.fingerprintslast] Circuit: [fingerprintslast] Grenade: [attached_grenade.fingerprintslast]") // These procs do not relocate the grenade, that's the callers responsibility -/obj/item/integrated_circuit/manipulation/grenade/proc/attach_grenade(var/obj/item/grenade/G) - attached_grenade = G - G.forceMove(src) +/obj/item/integrated_circuit/manipulation/grenade/proc/attach_grenade(var/obj/item/grenade/grenade) + attached_grenade = grenade + grenade.forceMove(src) desc += " \An [attached_grenade] is attached to it!" /obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade() @@ -245,25 +248,25 @@ /obj/item/integrated_circuit/manipulation/plant_module/do_work() ..() var/obj/acting_object = get_object() - var/obj/OM = get_pin_data_as_type(IC_INPUT, 1, /obj) - var/obj/O = get_pin_data_as_type(IC_INPUT, 3, /obj/item) + var/obj/input_obj = get_pin_data_as_type(IC_INPUT, 1, /obj) + var/obj/input_item = get_pin_data_as_type(IC_INPUT, 3, /obj/item) - if(!check_target(OM)) + if(!check_target(input_obj)) push_data() activate_pin(2) return - if(istype(OM,/obj/effect/vine) && check_target(OM) && get_pin_data(IC_INPUT, 2) == 2) - qdel(OM) + if(istype(input_obj,/obj/effect/vine) && check_target(input_obj) && get_pin_data(IC_INPUT, 2) == 2) + qdel(input_obj) push_data() activate_pin(2) return - var/obj/machinery/portable_atmospherics/hydroponics/TR = OM - if(istype(TR)) + var/obj/machinery/portable_atmospherics/hydroponics/hydrotray = input_obj + if(istype(hydrotray)) switch(get_pin_data(IC_INPUT, 2)) if(0) - var/list/harvest_output = TR.harvest() + var/list/harvest_output = hydrotray.harvest() if(harvest_output && !islist(harvest_output)) harvest_output = list(harvest_output) for(var/i in 1 to length(harvest_output)) @@ -273,30 +276,30 @@ set_pin_data(IC_OUTPUT, 1, harvest_output) push_data() if(1) - TR.weedlevel = 0 - TR.update_icon() + hydrotray.weedlevel = 0 + hydrotray.update_icon() if(2) - if(TR.seed) //Could be that they're just using it as a de-weeder - TR.age = 0 - TR.plant_health = 0 - if(TR.harvest) - TR.harvest = FALSE //To make sure they can't just put in another seed and insta-harvest it - qdel(TR.seed) - TR.seed = null - TR.weedlevel = 0 //Has a side effect of cleaning up those nasty weeds - TR.dead = 0 - TR.update_icon() + if(hydrotray.seed) //Could be that they're just using it as a de-weeder + hydrotray.age = 0 + hydrotray.plant_health = 0 + if(hydrotray.harvest) + hydrotray.harvest = FALSE //To make sure they can't just put in another seed and insta-harvest it + qdel(hydrotray.seed) + hydrotray.seed = null + hydrotray.weedlevel = 0 //Has a side effect of cleaning up those nasty weeds + hydrotray.dead = 0 + hydrotray.update_icon() if(3) - if(!check_target(O)) + if(!check_target(input_item)) activate_pin(2) return FALSE - else if(istype(O, /obj/item/seeds) && !istype(O, /obj/item/seeds/extracted/cutting)) - if(!TR.seed) - var/obj/item/seeds/seed = O - acting_object.visible_message("[acting_object] plants [O].") - TR.set_seed(seed.seed) - QDEL_NULL(O) + else if(istype(input_item, /obj/item/seeds) && !istype(input_item, /obj/item/seeds/extracted/cutting)) + if(!hydrotray.seed) + var/obj/item/seeds/seed = input_item + acting_object.visible_message("[acting_object] plants [input_item].") + hydrotray.set_seed(seed.seed) + QDEL_NULL(input_item) activate_pin(2) /obj/item/integrated_circuit/manipulation/seed_extractor @@ -313,15 +316,15 @@ /obj/item/integrated_circuit/manipulation/seed_extractor/do_work() ..() - var/obj/item/food/grown/O = get_pin_data_as_type(IC_INPUT, 1, /obj/item/food/grown) - if(!check_target(O)) + var/obj/item/food/grown/grown = get_pin_data_as_type(IC_INPUT, 1, /obj/item/food/grown) + if(!check_target(grown)) push_data() activate_pin(2) return var/list/seed_output = list() for(var/i in 1 to rand(1,4)) - seed_output += weakref(new /obj/item/seeds(get_turf(O), null, O.seed)) - qdel(O) + seed_output += weakref(new /obj/item/seeds(get_turf(grown), null, grown.seed)) + qdel(grown) if(seed_output.len) set_pin_data(IC_OUTPUT, 1, seed_output) @@ -437,8 +440,8 @@ step_towards(pulling, F) activate_pin(2) -/obj/item/integrated_circuit/manipulation/claw/proc/can_pull(var/obj/item/I) - return assembly && I && I.w_class <= assembly.w_class && !I.anchored +/obj/item/integrated_circuit/manipulation/claw/proc/can_pull(var/obj/item/used_item) + return assembly && used_item && used_item.w_class <= assembly.w_class && !used_item.anchored /obj/item/integrated_circuit/manipulation/claw/proc/pull() var/obj/acting_object = get_object() @@ -519,7 +522,7 @@ return // If the item is in a grabber circuit we'll update the grabber's outputs after we've thrown it. - var/obj/item/integrated_circuit/manipulation/grabber/G = A.loc + var/obj/item/integrated_circuit/manipulation/grabber/grabber = A.loc var/x_abs = clamp(T.x + target_x_rel, 0, world.maxx) var/y_abs = clamp(T.y + target_y_rel, 0, world.maxy) @@ -531,8 +534,8 @@ A.throw_at(locate(x_abs, y_abs, T.z), range, 3) // If the item came from a grabber now we can update the outputs since we've thrown it. - if(istype(G)) - G.update_outputs() + if(istype(grabber)) + grabber.update_outputs() /obj/item/integrated_circuit/manipulation/wormhole name = "wormhole generator" @@ -650,9 +653,9 @@ controlling = null -/obj/item/integrated_circuit/manipulation/ai/attackby(var/obj/item/I, var/mob/user) - if(is_type_in_list(I, list(/obj/item/aicard, /obj/item/paicard, /obj/item/organ/internal/brain_interface))) - load_ai(user, I) +/obj/item/integrated_circuit/manipulation/ai/attackby(var/obj/item/used_item, var/mob/user) + if(is_type_in_list(used_item, list(/obj/item/aicard, /obj/item/paicard, /obj/item/organ/internal/brain_interface))) + load_ai(user, used_item) return TRUE else return ..() diff --git a/code/modules/integrated_electronics/subtypes/reagents.dm b/code/modules/integrated_electronics/subtypes/reagents.dm index 777bc82a7b46..b29a7e1c21c3 100644 --- a/code/modules/integrated_electronics/subtypes/reagents.dm +++ b/code/modules/integrated_electronics/subtypes/reagents.dm @@ -417,9 +417,8 @@ switch(ord) if(1) var/cont[0] - for(var/rtype in reagents.reagent_volumes) - var/decl/material/RE = GET_DECL(rtype) - cont += RE.name + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + cont += reagent.name set_pin_data(IC_OUTPUT, 3, cont) push_data() if(2) @@ -484,14 +483,13 @@ if(target.reagents.maximum_volume - target.reagents.total_volume <= 0) return - for(var/rtype in source.reagents.reagent_volumes) - var/decl/material/mat = GET_DECL(rtype) + for(var/decl/material/reagent as anything in source.reagents.reagent_volumes) if(!direction_mode) - if(mat.name in demand) - source.reagents.trans_type_to(target, rtype, transfer_amount) + if(reagent.name in demand) + source.reagents.trans_type_to(target, reagent, transfer_amount) else - if(!(mat.name in demand)) - source.reagents.trans_type_to(target, rtype, transfer_amount) + if(!(reagent.name in demand)) + source.reagents.trans_type_to(target, reagent, transfer_amount) activate_pin(2) push_data() diff --git a/code/modules/item_effects/item_effect_aura.dm b/code/modules/item_effects/item_effect_aura.dm deleted file mode 100644 index c30e3a36461a..000000000000 --- a/code/modules/item_effects/item_effect_aura.dm +++ /dev/null @@ -1,28 +0,0 @@ -/decl/item_effect/aura - abstract_type = /decl/item_effect/aura - var/aura_type - -/decl/item_effect/aura/can_do_wielded_effect(mob/user, obj/item/item, list/parameters) - return !!aura_type -/decl/item_effect/aura/do_wielded_effect(mob/user, obj/item/item, list/parameters) - if(!user.has_aura(aura_type)) - user.add_aura(aura_type) - return TRUE - -/decl/item_effect/aura/can_do_unwielded_effect(mob/user, obj/item/item, list/parameters) - return !!aura_type -/decl/item_effect/aura/do_unwielded_effect(mob/user, obj/item/item, list/parameters) - if(user.has_aura(aura_type)) - user.remove_aura(aura_type) - return TRUE - -/decl/item_effect/aura/on_examined(obj/item/item, mob/user) - var/obj/aura/aura = aura_type - to_chat(user, SPAN_NOTICE("\The [item] grants \a [initial(aura.name)] to the wielder.")) - -// Example effect; applies a regeneration aura. -/decl/item_effect/aura/regeneration - aura_type = /obj/aura/regenerating/item - -// Distinct type to avoid removing the wrong type on unwield. -/obj/aura/regenerating/item diff --git a/code/modules/item_effects/item_effect_debug.dm b/code/modules/item_effects/item_effect_debug.dm index 1533abda4836..ae834c4bf2c5 100644 --- a/code/modules/item_effects/item_effect_debug.dm +++ b/code/modules/item_effects/item_effect_debug.dm @@ -58,7 +58,7 @@ (IE_CAT_EXAMINE), (IE_CAT_RANGED) = list(IE_PAR_USES = 5) )) - add_item_effect(/decl/item_effect/aura/regeneration, list( + add_item_effect(/decl/item_effect/mob_modifier/regeneration, list( (IE_CAT_EXAMINE), (IE_CAT_WIELDED) )) diff --git a/code/modules/item_effects/item_effect_modifier.dm b/code/modules/item_effects/item_effect_modifier.dm new file mode 100644 index 000000000000..4535ccf073a1 --- /dev/null +++ b/code/modules/item_effects/item_effect_modifier.dm @@ -0,0 +1,27 @@ +/decl/item_effect/mob_modifier + abstract_type = /decl/item_effect/mob_modifier + var/modifier_archetype + +/decl/item_effect/mob_modifier/can_do_wielded_effect(mob/user, obj/item/item, list/parameters) + return !!modifier_archetype + +/decl/item_effect/mob_modifier/do_wielded_effect(mob/user, obj/item/item, list/parameters) + if(!user.has_mob_modifier(modifier_archetype, source = src)) + user.add_mob_modifier(modifier_archetype, source = item) + return TRUE + +/decl/item_effect/mob_modifier/can_do_unwielded_effect(mob/user, obj/item/item, list/parameters) + return !!modifier_archetype + +/decl/item_effect/mob_modifier/do_unwielded_effect(mob/user, obj/item/item, list/parameters) + if(user.has_mob_modifier(modifier_archetype, source = src)) + user.remove_mob_modifier(modifier_archetype, source = src) + return TRUE + +/decl/item_effect/mob_modifier/on_examined(obj/item/item, mob/user) + var/decl/mob_modifier/archetype = GET_DECL(modifier_archetype) + to_chat(user, SPAN_NOTICE("\The [item] grants \a [archetype] to the wielder.")) + +// Example effect; applies a regeneration modifier. +/decl/item_effect/mob_modifier/regeneration + modifier_archetype = /decl/mob_modifier/regeneration/item diff --git a/code/modules/keybindings/_defines.dm b/code/modules/keybindings/_defines.dm index 469a4f57fc28..f80cbd168bd1 100644 --- a/code/modules/keybindings/_defines.dm +++ b/code/modules/keybindings/_defines.dm @@ -3,7 +3,6 @@ #define CATEGORY_MOB "MOB" #define CATEGORY_LIVING "LIVING" #define CATEGORY_HUMAN "HUMAN" -#define CATEGORY_ROBOT "ROBOT" #define CATEGORY_MISC "MISC" #define CATEGORY_MOVEMENT "MOVEMENT" #define CATEGORY_COMMUNICATION "COMMUNICATION" diff --git a/code/modules/keybindings/_keybindings.dm b/code/modules/keybindings/_keybindings.dm index d23b116879ed..67710245b909 100644 --- a/code/modules/keybindings/_keybindings.dm +++ b/code/modules/keybindings/_keybindings.dm @@ -1,9 +1,11 @@ /datum/keybinding + abstract_type = /datum/keybinding /// A default hotkey keys. var/list/hotkey_keys /// A classic hotkey keys when client don't use hotkey mode. Uses `hotkey_keys` if not defined. var/list/classic_keys + // TODO: convert to /decl/keybinding, replace name with uid and full_name with name /// A unique keybind id for preference storing. var/name /// A full keybind name for displaying. diff --git a/code/modules/keybindings/admin.dm b/code/modules/keybindings/admin.dm index 9b433212567e..23a6d425f974 100644 --- a/code/modules/keybindings/admin.dm +++ b/code/modules/keybindings/admin.dm @@ -1,4 +1,5 @@ /datum/keybinding/admin + abstract_type = /datum/keybinding/admin category = CATEGORY_ADMIN /datum/keybinding/admin/can_use(client/user) diff --git a/code/modules/keybindings/client.dm b/code/modules/keybindings/client.dm index e6f5ea8ec35b..8e1cc489b6e6 100644 --- a/code/modules/keybindings/client.dm +++ b/code/modules/keybindings/client.dm @@ -1,4 +1,5 @@ /datum/keybinding/client + abstract_type = /datum/keybinding/client category = CATEGORY_CLIENT /datum/keybinding/client/hotkey_mode diff --git a/code/modules/keybindings/communication.dm b/code/modules/keybindings/communication.dm index 9d6fadf4a1cb..7f1b6f76ac72 100644 --- a/code/modules/keybindings/communication.dm +++ b/code/modules/keybindings/communication.dm @@ -1,4 +1,5 @@ /datum/keybinding/client/communication + abstract_type = /datum/keybinding/client/communication category = CATEGORY_COMMUNICATION /datum/keybinding/client/communication/ooc diff --git a/code/modules/keybindings/human.dm b/code/modules/keybindings/human.dm index c93ddcc13cfd..cc283c2f1580 100644 --- a/code/modules/keybindings/human.dm +++ b/code/modules/keybindings/human.dm @@ -1,4 +1,5 @@ /datum/keybinding/human + abstract_type = /datum/keybinding/human category = CATEGORY_HUMAN /datum/keybinding/human/can_use(client/user) diff --git a/code/modules/keybindings/living.dm b/code/modules/keybindings/living.dm index 334811f9524c..7f9ba3530a2c 100644 --- a/code/modules/keybindings/living.dm +++ b/code/modules/keybindings/living.dm @@ -1,4 +1,5 @@ /datum/keybinding/living + abstract_type = /datum/keybinding/living category = CATEGORY_LIVING /datum/keybinding/living/can_use(client/user) diff --git a/code/modules/keybindings/mob.dm b/code/modules/keybindings/mob.dm index 4ab7f0f14f96..73a6bc128a75 100644 --- a/code/modules/keybindings/mob.dm +++ b/code/modules/keybindings/mob.dm @@ -1,4 +1,5 @@ /datum/keybinding/mob + abstract_type = /datum/keybinding/mob category = CATEGORY_MOB /datum/keybinding/mob/can_use(client/user) diff --git a/code/modules/keybindings/movement.dm b/code/modules/keybindings/movement.dm index df313a4fd83d..78e1b4417c86 100644 --- a/code/modules/keybindings/movement.dm +++ b/code/modules/keybindings/movement.dm @@ -1,4 +1,5 @@ /datum/keybinding/movement + abstract_type = /datum/keybinding/movement category = CATEGORY_MOVEMENT /datum/keybinding/movement/north diff --git a/code/modules/keybindings/robot.dm b/code/modules/keybindings/robot.dm deleted file mode 100644 index e01ab94ae717..000000000000 --- a/code/modules/keybindings/robot.dm +++ /dev/null @@ -1,71 +0,0 @@ -/datum/keybinding/robot - category = CATEGORY_ROBOT - -/datum/keybinding/robot/can_use(client/user) - return isrobot(user.mob) - -/datum/keybinding/robot/moduleone - hotkey_keys = list("1") - name = "module_one" - full_name = "Toggle Module 1" - description = "Equips or unequips the first module" - -/datum/keybinding/robot/moduleone/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.toggle_module(1) - return TRUE - -/datum/keybinding/robot/moduletwo - hotkey_keys = list("2") - name = "module_two" - full_name = "Toggle Module 2" - description = "Equips or unequips the second module" - -/datum/keybinding/robot/moduletwo/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.toggle_module(2) - return TRUE - -/datum/keybinding/robot/modulethree - hotkey_keys = list("3") - name = "module_three" - full_name = "Toggle Module 3" - description = "Equips or unequips the third module" - -/datum/keybinding/robot/modulethree/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.toggle_module(3) - return TRUE - -/datum/keybinding/robot/intent_cycle - hotkey_keys = list("4") - name = "cycle_intent" - full_name = "Cycle Intent Left" - description = "Cycles the intent left" - -/datum/keybinding/robot/intent_cycle/down(client/user) - user.mob.cycle_intent(INTENT_HOTKEY_LEFT) - return TRUE - -/datum/keybinding/robot/module_cycle - hotkey_keys = list("X") - name = "cycle_modules" - full_name = "Cycle Modules" - description = "Cycles your modules" - -/datum/keybinding/robot/module_cycle/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.cycle_modules() - return TRUE - -/datum/keybinding/robot/unequip_module - hotkey_keys = list("Q") - name = "unequip_module" - full_name = "Unequip Module" - description = "Unequips the active module" - -/datum/keybinding/robot/unequip_module/down(client/user) - var/mob/living/silicon/robot/R = user.mob - if(R.module) - R.uneq_active() - return TRUE diff --git a/code/modules/lighting/ambient_group.dm b/code/modules/lighting/ambient_group.dm new file mode 100644 index 000000000000..7b4665e79c0a --- /dev/null +++ b/code/modules/lighting/ambient_group.dm @@ -0,0 +1,121 @@ +#define BITWISE_MAX_BITS 24 + +/// A bitmap of free ambience group indexes. +var/global/ambience_group_free_bitmap = ~0 +var/global/ambience_group_map[BITWISE_MAX_BITS] + +/datum/ambience_group + var/global_index + var/list/member_turfs_by_z = list() + var/apparent_r + var/apparent_g + var/apparent_b + var/invalid = FALSE + var/busy = FALSE + +/datum/ambience_group/New() + global_index = allocate_index() + if (!global_index) + invalid = TRUE + return + + global.ambience_group_map[global_index] = src + +/datum/ambience_group/Destroy() + if (!invalid) + global.ambience_group_map[global_index] = null + global.ambience_group_free_bitmap |= (1 << global_index) + return ..() + +/datum/ambience_group/proc/allocate_index() + if (global.ambience_group_free_bitmap == 0) + CRASH("Failed to allocate ambience_group: index bitmap is exhausted") + + // Find the first free index in the bitmap. + var/index = 1 + while (!(global.ambience_group_free_bitmap & (1 << index)) && index < BITWISE_MAX_BITS) + index += 1 + + global.ambience_group_free_bitmap &= ~(1 << index) + + return index + +/datum/ambience_group/proc/add_turf(turf/T) + set waitfor = FALSE + + UNTIL(!busy) + if (T.z > member_turfs_by_z.len) + member_turfs_by_z.len = T.z + + LAZYADD(member_turfs_by_z[T.z], T) + T.add_ambient_light_raw(apparent_r, apparent_g, apparent_b) + T.ambience_active_groups += 1 + +/datum/ambience_group/proc/remove_turf(turf/T) + set waitfor = FALSE + + UNTIL(!busy) + if (T.z > member_turfs_by_z.len) + CRASH("Attempt to remove member turf with Z greater than local max -- this turf is not a member") + T.add_ambient_light_raw(-apparent_r, -apparent_g, -apparent_b) + member_turfs_by_z[T.z] -= T + T.ambience_active_groups -= 1 + +/datum/ambience_group/proc/set_ambient_light(color, multiplier) + var/list/new_parts = rgb2num(color) + + var/dr = (new_parts[1] / 255) * multiplier - apparent_r + var/dg = (new_parts[2] / 255) * multiplier - apparent_g + var/db = (new_parts[3] / 255) * multiplier - apparent_b + + if (round(dr/4, LIGHTING_ROUND_VALUE) == 0 && round(dg/4, LIGHTING_ROUND_VALUE) == 0 && round(db/4, LIGHTING_ROUND_VALUE) == 0) + // no-op + return + + busy = TRUE + + // Doing it ordered by zlev should ensure that it looks vaguely coherent mid-update regardless of turf insertion order. + for (var/zlev in 1 to member_turfs_by_z.len) + for (var/turf/T as anything in member_turfs_by_z[zlev]) + T.add_ambient_light_raw(dr, dg, db) + CHECK_TICK + + apparent_r += dr + apparent_g += dg + apparent_b += db + + busy = FALSE + +/turf + /// A bitfield of which global ambience groups are affecting this turf. + var/tmp/ambience_affecting_bitmap = 0 + /// A counter of how many ambience groups are affecting this turf, used to avoid pointlessly iterating the entire 24-bit bitfield. + var/tmp/ambience_active_groups = 0 + +/turf/Destroy() + if (ambience_affecting_bitmap) + var/remaining_groups = ambience_active_groups + for (var/i in 1 to BITWISE_MAX_BITS) + if (ambience_affecting_bitmap & (1 << i)) + var/datum/ambience_group/group = global.ambience_group_map[i] + add_ambient_light_raw(-group.apparent_r, -group.apparent_g, -group.apparent_b) + + remaining_groups -= 1 + + if (!remaining_groups) + break + + return ..() + +/turf/Initialize() + . = ..() + if (ambience_affecting_bitmap) + var/remaining_groups = ambience_active_groups + for (var/i in 1 to BITWISE_MAX_BITS) + if (ambience_affecting_bitmap & (1 << i)) + var/datum/ambience_group/group = global.ambience_group_map[i] + add_ambient_light_raw(group.apparent_r, group.apparent_g, group.apparent_b) + remaining_groups -= 1 + + if (!remaining_groups) + break diff --git a/code/modules/lighting/ambient_turf.dm b/code/modules/lighting/ambient_turf.dm new file mode 100644 index 000000000000..5b9ba5a03d9a --- /dev/null +++ b/code/modules/lighting/ambient_turf.dm @@ -0,0 +1,124 @@ +/turf + /// If non-null, a hex RGB light color that should be applied to this turf. + var/ambient_light + /// The power of the above is multiplied by this. Setting too high may drown out normal lights on the same turf. + var/ambient_light_multiplier = 0.3 + + /// If this is TRUE, an above turf's ambient light is affecting this turf. + var/tmp/ambient_has_indirect = FALSE + + // Record-keeping, do not touch -- that means you, admins. + var/tmp/ambient_active = FALSE //! Do we have non-zero ambient light? Use [TURF_IS_AMBIENT_LIT] instead of reading this directly. + var/tmp/ambient_light_old_r = 0 + var/tmp/ambient_light_old_g = 0 + var/tmp/ambient_light_old_b = 0 + +/// Set the turf's self-ambience channel. This can only contain one value at a time, so it should generally only be used by the turf itself. +/turf/proc/set_ambient_light(color, multiplier) + if (color == ambient_light && multiplier == ambient_light_multiplier) + return + + ambient_light = isnull(color) ? ambient_light : color + ambient_light_multiplier = isnull(multiplier) ? ambient_light_multiplier : multiplier + + update_ambient_light() + +/// Replace one ambient light with another. This is effectively a delta update, but it can be used to pretend that our one channel is doing color blending. +/turf/proc/replace_ambient_light(old_color, new_color, old_multiplier, new_multiplier = 0) + if (!TURF_IS_AMBIENT_LIT_UNSAFE(src)) + add_ambient_light(new_color, new_multiplier) + return + + ASSERT(!isnull(old_multiplier)) // omitting new_multiplier is allowed for removing light nondestructively + + old_color ||= COLOR_WHITE + new_color ||= COLOR_WHITE + + var/list/old_parts = rgb2num(old_color) + var/list/new_parts = rgb2num(new_color) + + var/dr = (new_parts[1] / 255) * new_multiplier - (old_parts[1] / 255) * old_multiplier + var/dg = (new_parts[2] / 255) * new_multiplier - (old_parts[2] / 255) * old_multiplier + var/db = (new_parts[3] / 255) * new_multiplier - (old_parts[3] / 255) * old_multiplier + + if (!dr && !dg && !db) + return + + add_ambient_light_raw(dr, dg, db) + +/// Add an ambient light to the turf's self-channel. This is a delta update, retain your applied color if you want to be able to remove it later. +/turf/proc/add_ambient_light(color, multiplier, update = TRUE) + if (!color) + return + + multiplier ||= ambient_light_multiplier + + var/list/ambient_parts = rgb2num(color) + + var/ambient_r = (ambient_parts[1] / 255) * multiplier + var/ambient_g = (ambient_parts[2] / 255) * multiplier + var/ambient_b = (ambient_parts[3] / 255) * multiplier + + add_ambient_light_raw(ambient_r, ambient_g, ambient_b, update) + +/// Directly manipulate the state of the self-ambience channel. Don't use unless you know what you're doing and how ambience works internally. +/turf/proc/add_ambient_light_raw(lr, lg, lb, update = TRUE) + if (!lr && !lg && !lb) + if (!ambient_light_old_r || !ambient_light_old_g || !ambient_light_old_b) + ambient_active = FALSE + SSlighting.total_ambient_turfs -= 1 + return + + if (!ambient_active) + SSlighting.total_ambient_turfs += 1 + ambient_active = TRUE + + // There are four corners per (lit) turf, we don't want to apply our light 4 times -- compensate by dividing by 4. + lr /= 4 + lg /= 4 + lb /= 4 + + lr = round(lr, LIGHTING_ROUND_VALUE) + lg = round(lg, LIGHTING_ROUND_VALUE) + lb = round(lb, LIGHTING_ROUND_VALUE) + + ambient_light_old_r += lr + ambient_light_old_g += lg + ambient_light_old_b += lb + + if (!corners || !lighting_corners_initialised) + if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(src)) + generate_missing_corners() + else + return + + // This list can contain nulls on things like space turfs -- they only have their neighbors' corners. + for (var/datum/lighting_corner/C in corners) + C.update_ambient_lumcount(lr, lg, lb, !update) + +/// Wipe the entire self-ambience channel. This will preserve ambience from ambience groups. +/turf/proc/clear_ambient_light() + if (ambient_light == null) + return + + replace_ambient_light(ambient_light, COLOR_WHITE, ambient_light_multiplier, 0) + ambient_light = null + ambient_light_multiplier = initial(ambient_light_multiplier) + +/turf/proc/update_ambient_light(no_corner_update = FALSE) + // These are deltas. + var/ambient_r = 0 + var/ambient_g = 0 + var/ambient_b = 0 + + if (ambient_light) + var/list/parts = rgb2num(ambient_light) + ambient_r = ((parts[1] / 255) * ambient_light_multiplier) - ambient_light_old_r + ambient_g = ((parts[2] / 255) * ambient_light_multiplier) - ambient_light_old_g + ambient_b = ((parts[3] / 255) * ambient_light_multiplier) - ambient_light_old_b + else + ambient_r = -ambient_light_old_r + ambient_g = -ambient_light_old_g + ambient_b = -ambient_light_old_b + + add_ambient_light_raw(ambient_r, ambient_g, ambient_b, !no_corner_update) diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index 3e0d6f6bcada..227cec8bb2dd 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -85,15 +85,3 @@ T.recalc_atom_opacity() if (old_has_opaque_atom != T.has_opaque_atom) T.reconsider_lights() - -/atom/movable/forceMove() - . = ..() - - if (light_source_solo) - light_source_solo.source_atom.update_light() - else if (light_source_multi) - var/datum/light_source/L - var/thing - for (thing in light_source_multi) - L = thing - L.source_atom.update_light() diff --git a/code/modules/lighting/lighting_corner.dm b/code/modules/lighting/lighting_corner.dm index b1e8d111ed79..3170ed85d090 100644 --- a/code/modules/lighting/lighting_corner.dm +++ b/code/modules/lighting/lighting_corner.dm @@ -56,13 +56,16 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, var/needs_update = FALSE - var/cache_r = LIGHTING_SOFT_THRESHOLD - var/cache_g = LIGHTING_SOFT_THRESHOLD - var/cache_b = LIGHTING_SOFT_THRESHOLD + var/cache_r = 0 + var/cache_g = 0 + var/cache_b = 0 var/cache_mx = 0 + /// Used for planet lighting. Probably needs a better system to prevent over-updating when not needed at some point. + var/update_gen = 0 + /datum/lighting_corner/New(turf/new_turf, diagonal, oi) - SSlighting.lighting_corners += src + SSlighting.total_lighting_corners += 1 var/has_ambience = FALSE @@ -70,7 +73,7 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, z = t1.z t1i = oi - if (t1.ambient_light) + if (TURF_IS_AMBIENT_LIT_UNSAFE(new_turf)) has_ambience = TRUE var/vertical = diagonal & ~(diagonal - 1) // The horizontal directions (4 and 8) are bigger than the vertical ones (1 and 2), so we can reliably say the lsb is the horizontal direction. @@ -96,7 +99,7 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, t2 = T t2i = REVERSE_LIGHTING_CORNER_DIAGONAL[diagonal] T.corners[t2i] = src - if (T.ambient_light) + if (TURF_IS_AMBIENT_LIT_UNSAFE(T)) has_ambience = TRUE // Now the horizontal one. @@ -109,7 +112,7 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, t3 = T t3i = REVERSE_LIGHTING_CORNER_DIAGONAL[((Tc > x) ? EAST : WEST) | ((t1.y > y) ? NORTH : SOUTH)] // Get the dir based on coordinates. T.corners[t3i] = src - if (T.ambient_light) + if (TURF_IS_AMBIENT_LIT_UNSAFE(T)) has_ambience = TRUE // And finally the vertical one. @@ -122,7 +125,7 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, t4 = T t4i = REVERSE_LIGHTING_CORNER_DIAGONAL[((t1.x > x) ? EAST : WEST) | ((Tc > y) ? NORTH : SOUTH)] // Get the dir based on coordinates. T.corners[t4i] = src - if (T.ambient_light) + if (TURF_IS_AMBIENT_LIT_UNSAFE(T)) has_ambience = TRUE update_active() @@ -161,9 +164,11 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, if (!T || !T.ambient_light) continue - sum_r += (HEX_RED(T.ambient_light) / 255) * T.ambient_light_multiplier - sum_g += (HEX_GREEN(T.ambient_light) / 255) * T.ambient_light_multiplier - sum_b += (HEX_BLUE(T.ambient_light) / 255) * T.ambient_light_multiplier + var/list/parts = rgb2num(T.ambient_light) + + sum_r += (parts[1] / 255) * T.ambient_light_multiplier + sum_g += (parts[2] / 255) * T.ambient_light_multiplier + sum_b += (parts[3] / 255) * T.ambient_light_multiplier sum_r /= 4 sum_g /= 4 @@ -314,15 +319,9 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, if (mx > 1) . = 1 / mx - else if (mx < LIGHTING_SOFT_THRESHOLD) - . = 0 // 0 means soft lighting. - - if (.) - cache_r = round(lr * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD - cache_g = round(lg * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD - cache_b = round(lb * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD - else - cache_r = cache_g = cache_b = LIGHTING_SOFT_THRESHOLD + cache_r = round(lr * ., LIGHTING_ROUND_VALUE) + cache_g = round(lg * ., LIGHTING_ROUND_VALUE) + cache_b = round(lb * ., LIGHTING_ROUND_VALUE) cache_mx = round(mx, LIGHTING_ROUND_VALUE) @@ -348,7 +347,7 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, if (!force) return QDEL_HINT_LETMELIVE - SSlighting.lighting_corners -= src + SSlighting.total_lighting_corners -= 1 return ..() /datum/lighting_corner/dummy/New() diff --git a/code/modules/lighting/lighting_overlay.dm b/code/modules/lighting/lighting_overlay.dm index c7fae9674340..c4900999b891 100644 --- a/code/modules/lighting/lighting_overlay.dm +++ b/code/modules/lighting/lighting_overlay.dm @@ -77,7 +77,7 @@ ca = corners[1] || dummy_lighting_corner var/max = max(cr.cache_mx, cg.cache_mx, cb.cache_mx, ca.cache_mx) - luminosity = max > LIGHTING_SOFT_THRESHOLD + luminosity = max > 0 var/rr = cr.cache_r var/rg = cr.cache_g diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index 53e59fa5b9b0..724b2d46182e 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -1,10 +1,6 @@ /turf var/dynamic_lighting = TRUE - /// If non-null, a hex RGB light color that should be applied to this turf. - var/ambient_light - /// The power of the above is multiplied by this. Setting too high may drown out normal lights on the same turf. - var/ambient_light_multiplier = 0.3 - luminosity = 1 + luminosity = 1 var/tmp/lighting_corners_initialised = FALSE @@ -15,78 +11,6 @@ var/tmp/list/datum/lighting_corner/corners /// Not to be confused with opacity, this will be TRUE if there's any opaque atom on the tile. var/tmp/has_opaque_atom = FALSE - /// If this is TRUE, an above turf's ambient light is affecting this turf. - var/tmp/ambient_has_indirect = FALSE - - // Record-keeping, do not touch -- that means you, admins. - var/tmp/ambient_light_old - var/tmp/ambient_light_old_r = 0 - var/tmp/ambient_light_old_g = 0 - var/tmp/ambient_light_old_b = 0 - -/turf/proc/set_ambient_light(color, multiplier) - if (color == ambient_light && multiplier == ambient_light_multiplier) - return - - ambient_light = color || ambient_light - ambient_light_multiplier = multiplier || ambient_light_multiplier - if (!ambient_light_multiplier) - ambient_light_multiplier = initial(ambient_light_multiplier) - - update_ambient_light() - -/turf/proc/clear_ambient_light() - if (ambient_light == null) - return - - ambient_light = null - update_ambient_light() - -/turf/proc/update_ambient_light(no_corner_update = FALSE) - // These are deltas. - var/ambient_r = 0 - var/ambient_g = 0 - var/ambient_b = 0 - - if (ambient_light) - ambient_r = round(((HEX_RED(ambient_light) / 255) * ambient_light_multiplier)/4 - ambient_light_old_r, LIGHTING_ROUND_VALUE) - ambient_g = round(((HEX_GREEN(ambient_light) / 255) * ambient_light_multiplier)/4 - ambient_light_old_g, LIGHTING_ROUND_VALUE) - ambient_b = round(((HEX_BLUE(ambient_light) / 255) * ambient_light_multiplier)/4 - ambient_light_old_b, LIGHTING_ROUND_VALUE) - else - ambient_r = -ambient_light_old_r - ambient_g = -ambient_light_old_g - ambient_b = -ambient_light_old_b - - ambient_light_old_r += ambient_r - ambient_light_old_g += ambient_g - ambient_light_old_b += ambient_b - - if (abs(ambient_r + ambient_g + ambient_b) == 0) - return - - // Unlit turfs will have corners if they have a lit neighbor -- don't generate corners for them, but do update them if they're there. - if (!corners) - var/force_build_corners = FALSE - for (var/turf/T as anything in RANGE_TURFS(src, 1)) - if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(T)) - force_build_corners = TRUE - break - - if (force_build_corners || TURF_IS_DYNAMICALLY_LIT_UNSAFE(src)) - generate_missing_corners() - else - return - - // This list can contain nulls on things like space turfs -- they only have their neighbors' corners. - for (var/datum/lighting_corner/C in corners) - C.update_ambient_lumcount(ambient_r, ambient_g, ambient_b, no_corner_update) - - if (ambient_light_old == null && ambient_light != ambient_light_old) - SSlighting.total_ambient_turfs += 1 - else if (ambient_light_old != null && ambient_light == null) - SSlighting.total_ambient_turfs -= 1 - - ambient_light_old = ambient_light /// Causes any affecting light sources to be queued for a visibility update, for example a door got opened. /turf/proc/reconsider_lights() @@ -146,9 +70,9 @@ lum_g += L.apparent_g lum_b += L.apparent_b - lum_r = CLAMP01(lum_r / length(corners)) * 255 - lum_g = CLAMP01(lum_g / length(corners)) * 255 - lum_b = CLAMP01(lum_b / length(corners)) * 255 + lum_r = CLAMP01(lum_r / 4) * 255 + lum_g = CLAMP01(lum_g / 4) * 255 + lum_b = CLAMP01(lum_b / 4) * 255 return rgb(lum_r, lum_g, lum_b) diff --git a/code/modules/locks/lock.dm b/code/modules/locks/lock.dm index 20f148f194c6..abb183d04b2f 100644 --- a/code/modules/locks/lock.dm +++ b/code/modules/locks/lock.dm @@ -5,13 +5,14 @@ name = "locked door" var/lock_preset_id = "default" var/lock_material = /decl/material/solid/metal/iron + /// If lock_preset_id is null, a random key with this complexity will be generated instead. var/lock_complexity = 1 /obj/abstract/landmark/lock_preset/Initialize() ..() for(var/obj/structure/thing in loc) if(!thing.lock && thing.can_install_lock()) - thing.lock = new /datum/lock(thing, lock_preset_id, lock_material) + thing.lock = new /datum/lock(thing, lock_preset_id || lock_complexity, lock_material) thing.update_icon() return INITIALIZE_HINT_QDEL diff --git a/code/modules/locks/lock_construct.dm b/code/modules/locks/lock_construct.dm index e36d93797a60..e8561f9b5b69 100644 --- a/code/modules/locks/lock_construct.dm +++ b/code/modules/locks/lock_construct.dm @@ -19,17 +19,17 @@ else . += SPAN_NOTICE("\The [src] is blank. Use a key on the lock to pair the two items.") -/obj/item/lock_construct/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/key)) - var/obj/item/key/K = I +/obj/item/lock_construct/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/key)) + var/obj/item/key/K = used_item if(!K.key_data) - to_chat(user, SPAN_NOTICE("You fashion \the [I] to unlock \the [src].")) + to_chat(user, SPAN_NOTICE("You fashion \the [used_item] to unlock \the [src].")) K.key_data = lock_data else - to_chat(user, SPAN_WARNING("\The [I] already unlocks something...")) + to_chat(user, SPAN_WARNING("\The [used_item] already unlocks something...")) return TRUE - if(istype(I,/obj/item/lock_construct)) - var/obj/item/lock_construct/L = I + if(istype(used_item,/obj/item/lock_construct)) + var/obj/item/lock_construct/L = used_item src.lock_data = L.lock_data to_chat(user, SPAN_NOTICE("You copy the lock from \the [L] to \the [src], making them identical.")) return TRUE diff --git a/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm b/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm index 8947d15a5de3..95df86b82f93 100644 --- a/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm +++ b/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm @@ -30,10 +30,6 @@ var/habitability_class = HABITABILITY_DEAD ///The cached planet's atmosphere that sub-levels of this planet should use. Can be a type path at definition, and an instance at runtime. var/datum/gas_mixture/atmosphere - ///The minimum temperature that can be reached on the planet.(For instance via meteo or sunlight/shade or whatever) - var/temperature_min = 0 CELSIUS - ///The maximum temperature that can be reached on the planet.(For instance via meteo or sunlight/shade or whatever) - var/temperature_max = 25 CELSIUS ///What weather state to use for this planet initially. If null, will not initialize any weather system. Must be a typepath rather than an instance. var/decl/state/weather/initial_weather_state = /decl/state/weather/calm @@ -155,8 +151,8 @@ atmosphere = A.Clone() ///Resets the given weather state to our planet replacing the old one, and trigger updates. Can be a type path or instance. -/datum/planetoid_data/proc/reset_weather(var/decl/state/weather/W) - initial_weather_state = W +/datum/planetoid_data/proc/reset_weather(var/decl/state/weather/weather) + initial_weather_state = weather if(!(topmost_level_id in SSmapping.levels_by_id)) return //It's entire possible the levels weren't initialized yet, so don't bother. //Tells all our levels exposed to the sky to force change the weather. @@ -489,7 +485,7 @@ //Adjust for species habitability if(habitability_class == HABITABILITY_OKAY || habitability_class == HABITABILITY_IDEAL) - var/decl/species/S = global.get_species_by_key(global.using_map.default_species) + var/decl/species/S = decls_repository.get_decl_by_id(global.using_map.default_species) if(habitability_class == HABITABILITY_IDEAL) . = clamp(., S.default_bodytype.cold_discomfort_level + rand(1,5), S.default_bodytype.heat_discomfort_level - rand(1,5)) //Clamp between comfortable levels since we're ideal else @@ -501,7 +497,7 @@ //Adjust for species habitability if(habitability_class == HABITABILITY_OKAY || habitability_class == HABITABILITY_IDEAL) - var/decl/species/S = global.get_species_by_key(global.using_map.default_species) + var/decl/species/S = decls_repository.get_decl_by_id(global.using_map.default_species) var/breathed_min_pressure = S.breath_pressure var/safe_max_pressure = S.get_hazard_high_pressure() var/safe_min_pressure = S.get_hazard_low_pressure() @@ -550,7 +546,7 @@ blacklisted_flags |= XGM_GAS_CONTAMINANT //Make sure temperature can't damage people on casual planets (Only when not forcing an atmosphere) - var/decl/species/S = global.get_species_by_key(global.using_map.default_species) + var/decl/species/S = decls_repository.get_decl_by_id(global.using_map.default_species) var/lower_temp = max(S.default_bodytype.cold_level_1, atmosphere_gen_temperature_min) var/higher_temp = min(S.default_bodytype.heat_level_1, atmosphere_gen_temperature_max) var/breathed_gas = S.breath_type diff --git a/code/modules/materials/_material_stack.dm b/code/modules/materials/_material_stack.dm index a956e5678de8..eab2ce44036a 100644 --- a/code/modules/materials/_material_stack.dm +++ b/code/modules/materials/_material_stack.dm @@ -120,36 +120,36 @@ /obj/item/stack/material/proc/get_stack_conversion_dictionary() return -/obj/item/stack/material/attackby(var/obj/item/W, var/mob/user) +/obj/item/stack/material/attackby(var/obj/item/used_item, var/mob/user) - if(can_be_reinforced && istype(W, /obj/item/stack/material)) - if(is_same(W)) + if(can_be_reinforced && istype(used_item, /obj/item/stack/material)) + if(is_same(used_item)) return ..() if(!reinf_material) - material.reinforce(user, W, src) + material.reinforce(user, used_item, src) return TRUE // TODO: convert to converts_into entry. - if(can_be_pulverized && IS_HAMMER(W) && material?.hardness >= MAT_VALUE_RIGID && user.check_intent(I_FLAG_HARM)) + if(can_be_pulverized && IS_HAMMER(used_item) && material?.hardness >= MAT_VALUE_RIGID && user.check_intent(I_FLAG_HARM)) - if(W.material?.hardness < material.hardness) - to_chat(user, SPAN_WARNING("\The [W] is not hard enough to pulverize [material.solid_name].")) + if(used_item.material?.hardness < material.hardness) + to_chat(user, SPAN_WARNING("\The [used_item] is not hard enough to pulverize [material.solid_name].")) return TRUE var/converting = clamp(get_amount(), 0, 5) - if(converting && W.do_tool_interaction(TOOL_HAMMER, user, src, 1 SECOND, "pulverizing", "pulverizing", set_cooldown = TRUE) && !QDELETED(src) && get_amount() >= converting) + if(converting && used_item.do_tool_interaction(TOOL_HAMMER, user, src, 1 SECOND, "pulverizing", "pulverizing", set_cooldown = TRUE) && !QDELETED(src) && get_amount() >= converting) // TODO: make a gravel type? // TODO: pass actual stone material to gravel? new /obj/item/stack/material/ore/handful/sand(get_turf(user), converting) - user.visible_message("\The [user] pulverizes [converting == 1 ? "a [singular_name]" : "some [plural_name]"] with \the [W].") + user.visible_message("\The [user] pulverizes [converting == 1 ? "a [singular_name]" : "some [plural_name]"] with \the [used_item].") use(converting) return TRUE - if(reinf_material?.default_solid_form && IS_WELDER(W)) - var/obj/item/weldingtool/WT = W - if(WT.isOn() && WT.get_fuel() > 2 && use(2)) - WT.weld(2, user) + if(reinf_material?.default_solid_form && IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(welder.isOn() && welder.get_fuel() > 2 && use(2)) + welder.weld(2, user) to_chat(user, SPAN_NOTICE("You recover some [reinf_material.use_name] from \the [src].")) reinf_material.create_object(get_turf(user), 1) return TRUE @@ -160,7 +160,7 @@ var/convert_tool var/obj/item/stack/convert_type for(var/tool_type in can_be_converted_into) - if(IS_TOOL(W, tool_type)) + if(IS_TOOL(used_item, tool_type)) convert_tool = tool_type convert_type = can_be_converted_into[tool_type] break @@ -172,7 +172,7 @@ if(get_amount() < minimum_per_one_product) to_chat(user, SPAN_WARNING("You will need [minimum_per_one_product] [minimum_per_one_product == 1 ? singular_name : plural_name] to produce [product_per_sheet] [product_per_sheet == 1 ? initial(convert_type.singular_name) : initial(convert_type.plural_name)].")) - else if(W.do_tool_interaction(convert_tool, user, src, 1 SECOND, set_cooldown = TRUE) && !QDELETED(src) && get_amount() >= minimum_per_one_product) + else if(used_item.do_tool_interaction(convert_tool, user, src, 1 SECOND, set_cooldown = TRUE) && !QDELETED(src) && get_amount() >= minimum_per_one_product) var/obj/item/stack/product = new convert_type(loc, ceil(product_per_sheet), material?.type, reinf_material?.type) product.dropInto(loc) use(minimum_per_one_product) diff --git a/code/modules/materials/_materials.dm b/code/modules/materials/_materials.dm index 8a54511cbb3f..47ce38daf2c5 100644 --- a/code/modules/materials/_materials.dm +++ b/code/modules/materials/_materials.dm @@ -119,7 +119,6 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) var/shard_name = SHARD_SHRAPNEL as text // Path of debris object. var/shard_icon // Related to above. var/shard_can_repair = 1 // Can shards be turned into sheets with a welder? - var/list/recipes // Holder for all recipes usable with a sheet of this material. var/destruction_desc = "breaks apart" // Fancy string for barricades/tables/objects exploding. var/destruction_sound = "fracture" // As above, but the sound that plays. @@ -182,7 +181,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) /// General-use HP value for products. var/integrity = 150 /// Is the material transparent? 0.5< makes transparent walls/doors. - var/opacity = TRUE + var/opacity = 1.0 /// Only used by walls currently. var/explosion_resistance = 5 /// Objects with this var add CONDUCTS to flags on spawn. @@ -270,6 +269,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) var/overdose = 0 var/scannable = 0 // Shows up on health analyzers. var/color = COLOR_BEIGE + // How much variance in color do objects of this material have, in fraction of maximum brightness/hue. + var/color_variance = 0.04 var/color_weight = 1 var/cocktail_ingredient var/defoliant @@ -357,7 +358,6 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) var/compost_value = 0 /// Nutrition values! - var/nutriment_animal = FALSE var/nutriment_factor = 0 // Per removed amount each tick var/hydration_factor = 0 // Per removed amount each tick var/injectable_nutrition = FALSE @@ -743,8 +743,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) O.visible_message(SPAN_NOTICE("The solution dissolves the ink on the paper."), range = 1) else if(istype(O, /obj/item/book) && amount >= FLUID_PUDDLE) var/obj/item/book/affectedbook = O - if(affectedbook.can_dissolve_text) - affectedbook.dat = null + if(affectedbook.clear_text()) O.visible_message(SPAN_NOTICE("The solution dissolves the ink on the book."), range = 1) else O.visible_message(SPAN_WARNING("The solution does nothing. Whatever this is, it isn't normal ink."), range = 1) @@ -752,7 +751,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) if(solvent_power >= MAT_SOLVENT_STRONG && O.solvent_can_melt(solvent_power) && (istype(O, /obj/item) || istype(O, /obj/effect/vine)) && (amount > solvent_melt_dose)) O.visible_message(SPAN_DANGER("\The [O] dissolves!")) O.handle_melting() - holder?.remove_reagent(type, solvent_melt_dose) + holder?.remove_reagent(src, solvent_melt_dose) else if(defoliant && istype(O, /obj/effect/vine)) qdel(O) else @@ -776,7 +775,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) /decl/material/proc/touch_turf(var/turf/touching_turf, var/amount, var/datum/reagents/holder) // Cleaner cleaning, lube lubbing, etc, all go here - if(REAGENT_VOLUME(holder, type) < turf_touch_threshold) + if(REAGENT_VOLUME(holder, src) < turf_touch_threshold) return if(istype(touching_turf) && touching_turf.simulated) @@ -787,15 +786,15 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) if(slipperiness != 0 && !touching_turf.check_fluid_depth()) // Don't make floors slippery if they have an active fluid on top of them please. if(slipperiness < 0) touching_turf.unwet_floor(TRUE) - else if (REAGENT_VOLUME(holder, type) >= slippery_amount) + else if (REAGENT_VOLUME(holder, src) >= slippery_amount) touching_turf.wet_floor(slipperiness) if(length(vapor_products)) - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) var/temperature = holder?.my_atom?.temperature || T20C for(var/vapor in vapor_products) touching_turf.assume_gas(vapor, (volume * vapor_products[vapor]), temperature) - holder.remove_reagent(type, volume) + holder.remove_reagent(src, volume) /decl/material/proc/on_mob_life(var/mob/living/M, var/metabolism_class, var/datum/reagents/holder, var/list/life_dose_tracker) @@ -808,7 +807,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) // Keep track of dosage of chems across holders for overdosing purposes if(overdose && metabolism_class != CHEM_TOUCH && islist(life_dose_tracker)) - life_dose_tracker[src] += REAGENT_VOLUME(holder, type) + life_dose_tracker[src] += REAGENT_VOLUME(holder, src) //determine the metabolism rate var/removed @@ -830,8 +829,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) if(!(flags & IGNORE_MOB_SIZE)) effective *= (MOB_SIZE_MEDIUM/M.mob_size) if(metabolism_class != CHEM_TOUCH) - var/dose = LAZYACCESS(M.chem_doses, type) + effective - LAZYSET(M.chem_doses, type, dose) + var/dose = CHEM_DOSE(M, src) + effective + LAZYSET(M._chem_doses, src, dose) var/remove_dose = TRUE if(effective >= (metabolism * 0.1) || effective >= 0.1) // If there's too little chemical, don't affect the mob, just remove it @@ -845,7 +844,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) if(CHEM_INHALE) affect_inhale(M, effective, holder) if(remove_dose) - holder.remove_reagent(type, removed) + holder.remove_reagent(src, removed) /decl/material/proc/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) @@ -857,9 +856,9 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) if(antibiotic_strength) M.adjust_immunity(-0.1 * antibiotic_strength) M.add_chemical_effect(CE_ANTIBIOTIC, antibiotic_strength) - if(REAGENT_VOLUME(holder, type) > 10) + if(REAGENT_VOLUME(holder, src) > 10) M.adjust_immunity(-0.3 * antibiotic_strength) - if(LAZYACCESS(M.chem_doses, type) > 15) + if(CHEM_DOSE(M, src) > 15) M.adjust_immunity(-0.25 * antibiotic_strength) if(nutriment_factor || hydration_factor) @@ -944,7 +943,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) /decl/material/proc/apply_intolerances(mob/living/subject, removed, datum/reagents/holder, ingestion_method) - var/list/data = REAGENT_DATA(holder, type) + var/list/data = REAGENT_DATA(holder, src) var/check_flags = LAZYACCESS(data, DATA_INGREDIENT_FLAGS) | allergen_flags if(!check_flags) return 1 @@ -955,7 +954,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) var/malus_level = 0 for(var/decl/trait/intolerance as anything in intolerances) - malus_level = max(malus_level, subject.GetTraitLevel(intolerance.type)) + malus_level = max(malus_level, subject.get_trait_level(intolerance.type)) if(!malus_level) return 1 @@ -1026,7 +1025,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) victim.clean() if(solvent_power > MAT_SOLVENT_NONE && removed >= solvent_melt_dose && victim.solvent_act(min(removed * solvent_power * ((removed < solvent_melt_dose) ? 0.1 : 0.2), solvent_max_damage), solvent_melt_dose, solvent_power)) - holder.remove_reagent(type, REAGENT_VOLUME(holder, type)) + holder.remove_reagent(src, REAGENT_VOLUME(holder, src)) . = TRUE /decl/material/proc/affect_overdose(mob/living/victim, total_dose) // Overdose effect. Doesn't happen instantly. @@ -1041,7 +1040,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) /decl/material/proc/mix_data(var/datum/reagents/reagents, var/list/newdata, var/amount) reagents.cached_color = null // colour masking may change - . = REAGENT_DATA(reagents, type) + . = REAGENT_DATA(reagents, src) if(!length(newdata) || !islist(newdata)) return @@ -1053,7 +1052,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) // Sum our existing taste data with the incoming taste data. var/total_taste = 0 - var/new_fraction = amount / REAGENT_VOLUME(reagents, type) // the fraction of the total reagent volume that the new data is associated with + var/new_fraction = amount / REAGENT_VOLUME(reagents, src) // the fraction of the total reagent volume that the new data is associated with var/list/tastes = list() var/list/newtastes = LAZYACCESS(newdata, DATA_TASTE) for(var/taste in newtastes) @@ -1088,7 +1087,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) // Blend our extra_colour... var/new_extra_color = newdata?[DATA_EXTRA_COLOR] if(new_extra_color) - .[DATA_EXTRA_COLOR] = BlendRGBasHSV(new_extra_color, .[DATA_EXTRA_COLOR], new_fraction) + .[DATA_EXTRA_COLOR] = BlendHSV(new_extra_color, .[DATA_EXTRA_COLOR], new_fraction) /decl/material/proc/explosion_act(obj/item/chems/holder, severity) SHOULD_CALL_PARENT(TRUE) @@ -1099,8 +1098,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) /decl/material/proc/get_presentation_name(var/obj/item/prop) if(islist(prop?.reagents?.reagent_data)) - . = LAZYACCESS(prop.reagents.reagent_data[type], DATA_MASK_NAME) - . ||= glass_name || liquid_name + . = LAZYACCESS(prop.reagents.reagent_data[src], DATA_MASK_NAME) + . ||= glass_name || get_reagent_name(prop?.reagents) if(prop?.reagents?.total_volume) . = build_presentation_name_from_reagents(prop, .) @@ -1171,12 +1170,12 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) // If it's not ignitable but can be boiled, consider vaporizing it. if(!isnull(boiling_point) && burn_temperature >= boiling_point) - LAZYSET(., type, amount) + LAZYSET(., src, amount) /decl/material/proc/get_reagent_name(datum/reagents/holder, phase = MAT_PHASE_LIQUID) if(istype(holder) && holder.reagent_data) - var/list/rdata = holder.reagent_data[type] + var/list/rdata = holder.reagent_data[src] if(rdata) var/data_name = rdata[DATA_MASK_NAME] if(data_name) @@ -1201,7 +1200,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) /decl/material/proc/get_reagent_color(datum/reagents/holder) if(istype(holder) && holder.reagent_data) - var/list/rdata = holder.reagent_data[type] + var/list/rdata = holder.reagent_data[src] if(rdata) var/data_color = rdata[DATA_MASK_COLOR] if(data_color) @@ -1209,7 +1208,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) return color /decl/material/proc/get_reagent_overlay_color(datum/reagents/holder) - var/list/rdata = REAGENT_DATA(holder, type) + var/list/rdata = REAGENT_DATA(holder, src) return LAZYACCESS(rdata, DATA_EXTRA_COLOR) || get_reagent_color(holder) + num2hex(opacity * 255) /decl/material/proc/can_hold_sharpness() diff --git a/code/modules/materials/definitions/gasses/material_gas_mundane.dm b/code/modules/materials/definitions/gasses/material_gas_mundane.dm index 9ed5c8ded417..cff373e83716 100644 --- a/code/modules/materials/definitions/gasses/material_gas_mundane.dm +++ b/code/modules/materials/definitions/gasses/material_gas_mundane.dm @@ -65,7 +65,7 @@ . = ..() var/warning_message var/warning_prob = 10 - var/dosage = LAZYACCESS(M.chem_doses, type) + var/dosage = CHEM_DOSE(M, src) var/mob/living/human/H = M if(dosage >= 3) warning_message = pick("extremely dizzy","short of breath","faint","confused") @@ -81,8 +81,8 @@ else if(dosage >= 0.25) warning_message = pick("a little dizzy","short of breath") warning_prob = 10 - if(istype(H) && dosage > 1 && H.ticks_since_last_successful_breath < 15) - H.ticks_since_last_successful_breath++ + if(istype(H) && dosage > 1 && H.suffocation_counter < 15) + H.suffocation_counter++ if(warning_message && prob(warning_prob)) to_chat(M, SPAN_WARNING("You feel [warning_message].")) @@ -133,7 +133,7 @@ /decl/material/gas/nitrous_oxide/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() - var/dosage = LAZYACCESS(M.chem_doses, type) + var/dosage = CHEM_DOSE(M, src) if(dosage >= 1) if(prob(5)) SET_STATUS_MAX(M, STAT_ASLEEP, 3) SET_STATUS_MAX(M, STAT_DIZZY, 3) @@ -257,7 +257,7 @@ /decl/material/gas/xenon/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() - var/dosage = LAZYACCESS(M.chem_doses, type) + var/dosage = CHEM_DOSE(M, src) if(dosage >= 1) if(prob(5)) SET_STATUS_MAX(M, STAT_ASLEEP, 3) SET_STATUS_MAX(M, STAT_DIZZY, 3) diff --git a/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm b/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm index 08eaa22b0c95..348abd21f1c3 100644 --- a/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm +++ b/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm @@ -65,7 +65,7 @@ name = "spider venom" uid = "liquid_spider_venom" lore_text = "A deadly necrotic toxin produced by giant spiders to disable their prey." - taste_description = "absolutely vile" + taste_description = "vile poison" color = "#91d895" toxicity_targets_organ = BP_LIVER toxicity = 5 @@ -88,7 +88,7 @@ /decl/material/liquid/venom/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) if(M.has_trait(/decl/trait/metabolically_inert)) return - if(prob(REAGENT_VOLUME(holder, type)*2)) + if(prob(REAGENT_VOLUME(holder, src)*2)) SET_STATUS_MAX(M, STAT_CONFUSE, 3) ..() @@ -131,8 +131,8 @@ /decl/material/liquid/heartstopper/affect_overdose(mob/living/victim, total_dose) ..() if(victim.stat != UNCONSCIOUS) - if(victim.ticks_since_last_successful_breath >= 10) - victim.ticks_since_last_successful_breath = max(10, victim.ticks_since_last_successful_breath-10) + if(victim.suffocation_counter >= 10) + victim.suffocation_counter = max(10, victim.suffocation_counter-10) victim.take_damage(2, OXY) SET_STATUS_MAX(victim, STAT_WEAK, 10) victim.add_chemical_effect(CE_NOPULSE, 1) @@ -163,7 +163,7 @@ M.take_damage(3 * removed, OXY) SET_STATUS_MAX(M, STAT_WEAK, 10) SET_STATUS_MAX(M, STAT_SILENCE, 10) - if(LAZYACCESS(M.chem_doses, type) <= removed) //half-assed attempt to make timeofdeath update only at the onset + if(CHEM_DOSE(M, src) <= removed) //half-assed attempt to make timeofdeath update only at the onset M.timeofdeath = world.time M.add_chemical_effect(CE_NOPULSE, 1) @@ -243,7 +243,7 @@ /decl/material/liquid/hair_remover/affect_touch(var/mob/M, var/removed, var/datum/reagents/holder) . = ..() M.lose_hair() - holder.remove_reagent(type, REAGENT_VOLUME(holder, type)) + holder.remove_reagent(type, REAGENT_VOLUME(holder, src)) return TRUE /decl/material/liquid/zombie @@ -270,7 +270,7 @@ ..() if (ishuman(M)) var/mob/living/human/H = M - var/true_dose = LAZYACCESS(H.chem_doses, type) + REAGENT_VOLUME(holder, type) + var/true_dose = CHEM_DOSE(H, src) + REAGENT_VOLUME(holder, src) if (true_dose >= amount_to_zombify) H.zombify() else if (true_dose > 1 && prob(20)) diff --git a/code/modules/materials/definitions/liquids/materials_liquid_water.dm b/code/modules/materials/definitions/liquids/materials_liquid_water.dm index 099b762761fb..3c1a5adbc39a 100644 --- a/code/modules/materials/definitions/liquids/materials_liquid_water.dm +++ b/code/modules/materials/definitions/liquids/materials_liquid_water.dm @@ -57,8 +57,8 @@ /decl/material/liquid/water/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) ..() if(ishuman(M)) - var/list/data = REAGENT_DATA(holder, type) - if(data?["holy"]) + var/list/data = REAGENT_DATA(holder, src) + if(data?[DATA_WATER_HOLINESS]) affect_holy(M, removed, holder) /decl/material/liquid/water/proc/affect_holy(mob/living/M, removed, datum/reagents/holder) @@ -89,15 +89,15 @@ touching_turf.assume_air(lowertemp) qdel(hotspot) - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) if (environment && environment.temperature > min_temperature) // Abstracted as steam or something var/removed_heat = clamp(volume * WATER_LATENT_HEAT, 0, -environment.get_thermal_energy_change(min_temperature)) environment.add_thermal_energy(-removed_heat) if (prob(5) && environment && environment.temperature > T100C) touching_turf.visible_message(SPAN_NOTICE("The water sizzles as it lands on \the [touching_turf]!")) - var/list/data = REAGENT_DATA(holder, type) - if(LAZYACCESS(data, "holy")) + var/list/data = REAGENT_DATA(holder, src) + if(LAZYACCESS(data, DATA_WATER_HOLINESS)) touching_turf.turf_flags |= TURF_FLAG_HOLY /decl/material/liquid/water/touch_obj(var/obj/O, var/amount, var/datum/reagents/holder) diff --git a/code/modules/materials/definitions/solids/materials_solid_butchery.dm b/code/modules/materials/definitions/solids/materials_solid_butchery.dm index f1bdababb123..fb78922a5f65 100644 --- a/code/modules/materials/definitions/solids/materials_solid_butchery.dm +++ b/code/modules/materials/definitions/solids/materials_solid_butchery.dm @@ -20,7 +20,6 @@ sound_dropped = 'sound/foley/meat2.ogg' hitsound = 'sound/effects/squelch1.ogg' fishing_bait_value = 1 - nutriment_animal = TRUE reagent_overlay = "soup_chunks" nutriment_factor = 10 allergen_flags = ALLERGEN_MEAT @@ -84,11 +83,9 @@ sound_manipulate = 'sound/foley/meat1.ogg' sound_dropped = 'sound/foley/meat2.ogg' hitsound = "punch" - exoplanet_rarity_gas = MAT_RARITY_NOWHERE fishing_bait_value = 0.75 tans_to = /decl/material/solid/organic/leather compost_value = 0.8 - nutriment_animal = TRUE allergen_flags = ALLERGEN_MEAT /decl/material/solid/organic/skin/lizard @@ -98,8 +95,6 @@ tans_to = /decl/material/solid/organic/leather/lizard hardness = MAT_VALUE_FLEXIBLE weight = MAT_VALUE_VERY_LIGHT - exoplanet_rarity_plant = MAT_RARITY_NOWHERE - exoplanet_rarity_gas = MAT_RARITY_NOWHERE /decl/material/solid/organic/skin/insect name = "chitin" @@ -227,7 +222,8 @@ sound_manipulate = 'sound/foley/stickspickup1.ogg' sound_dropped = 'sound/foley/sticksdrop1.ogg' compost_value = 0.5 - nutriment_animal = TRUE + allergen_flags = ALLERGEN_MEAT + exoplanet_rarity_plant = MAT_RARITY_EXOTIC // Stub to stop eggs melting while being boiled. /decl/material/solid/organic/bone/eggshell @@ -237,8 +233,6 @@ default_solid_form = /obj/item/stack/material/lump hardness = MAT_VALUE_FLEXIBLE weight = MAT_VALUE_VERY_LIGHT - exoplanet_rarity_gas = MAT_RARITY_NOWHERE - exoplanet_rarity_plant = MAT_RARITY_NOWHERE // Stub for earrings. TODO: put it in clams /decl/material/solid/organic/bone/pearl @@ -248,21 +242,15 @@ default_solid_form = /obj/item/stack/material/lump hardness = MAT_VALUE_FLEXIBLE weight = MAT_VALUE_VERY_LIGHT - exoplanet_rarity_gas = MAT_RARITY_NOWHERE - exoplanet_rarity_plant = MAT_RARITY_NOWHERE /decl/material/solid/organic/bone/fish name = "fishbone" uid = "solid_fishbone" hardness = MAT_VALUE_FLEXIBLE weight = MAT_VALUE_VERY_LIGHT - exoplanet_rarity_plant = MAT_RARITY_NOWHERE - exoplanet_rarity_gas = MAT_RARITY_NOWHERE /decl/material/solid/organic/bone/cartilage name = "cartilage" uid = "solid_cartilage" hardness = 0 weight = MAT_VALUE_EXTREMELY_LIGHT - exoplanet_rarity_plant = MAT_RARITY_NOWHERE - exoplanet_rarity_gas = MAT_RARITY_NOWHERE diff --git a/code/modules/materials/definitions/solids/materials_solid_elements.dm b/code/modules/materials/definitions/solids/materials_solid_elements.dm index 9375b255330f..330c11ada5ab 100644 --- a/code/modules/materials/definitions/solids/materials_solid_elements.dm +++ b/code/modules/materials/definitions/solids/materials_solid_elements.dm @@ -45,9 +45,9 @@ var/datum/reagents/ingested = M.get_ingested_reagents() if(ingested && LAZYLEN(ingested.reagent_volumes) > 1) var/effect = 1 / (LAZYLEN(ingested.reagent_volumes) - 1) - for(var/R in ingested.reagent_volumes) - if(R != type) - ingested.remove_reagent(R, removed * effect) + for(var/decl/material/reagent as anything in ingested.reagent_volumes) + if(reagent.type != type) + ingested.remove_reagent(reagent, removed * effect) /decl/material/solid/carbon/ashes name = "ashes" @@ -109,7 +109,7 @@ /decl/material/solid/potassium/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) if(volume > 3) M.add_chemical_effect(CE_PULSE, 1) if(volume > 10) diff --git a/code/modules/materials/definitions/solids/materials_solid_mineral.dm b/code/modules/materials/definitions/solids/materials_solid_mineral.dm index 9b619de94902..805cff68e0ef 100644 --- a/code/modules/materials/definitions/solids/materials_solid_mineral.dm +++ b/code/modules/materials/definitions/solids/materials_solid_mineral.dm @@ -184,7 +184,7 @@ /decl/material/solid/potash/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) if(volume > 3) M.add_chemical_effect(CE_PULSE, 1) if(volume > 10) diff --git a/code/modules/materials/definitions/solids/materials_solid_mundane.dm b/code/modules/materials/definitions/solids/materials_solid_mundane.dm index 8579088f2f26..039405d95068 100644 --- a/code/modules/materials/definitions/solids/materials_solid_mundane.dm +++ b/code/modules/materials/definitions/solids/materials_solid_mundane.dm @@ -5,7 +5,6 @@ ore_name = "slag" ore_desc = "Someone messed up..." ore_icon_overlay = "lump" - hidden_from_codex = TRUE reflectiveness = MAT_VALUE_DULL wall_support_value = MAT_VALUE_LIGHT value = 0.1 diff --git a/code/modules/materials/definitions/solids/materials_solid_organic.dm b/code/modules/materials/definitions/solids/materials_solid_organic.dm index e4e065676e6f..7bfb29fb0ab5 100644 --- a/code/modules/materials/definitions/solids/materials_solid_organic.dm +++ b/code/modules/materials/definitions/solids/materials_solid_organic.dm @@ -6,7 +6,8 @@ boiling_point = null melting_point = null compost_value = 1 - + exoplanet_rarity_gas = MAT_RARITY_NOWHERE + exoplanet_rarity_plant = MAT_RARITY_UNCOMMON /* TODO: burn products for solids bakes_into_at_temperature = T0C+500 bakes_into_material = /decl/material/solid/carbon @@ -69,6 +70,7 @@ boiling_point = 643 compost_value = 0.2 paint_verb = "colored" + exoplanet_rarity_plant = MAT_RARITY_MUNDANE /decl/material/solid/organic/plastic/holographic name = "holographic plastic" @@ -99,8 +101,7 @@ reflectiveness = MAT_VALUE_DULL wall_support_value = MAT_VALUE_EXTREMELY_LIGHT default_solid_form = /obj/item/stack/material/cardstock - exoplanet_rarity_plant = MAT_RARITY_NOWHERE - exoplanet_rarity_gas = MAT_RARITY_NOWHERE + exoplanet_rarity_plant = MAT_RARITY_EXOTIC sound_manipulate = 'sound/foley/paperpickup2.ogg' sound_dropped = 'sound/foley/paperpickup1.ogg' compost_value = 0.8 @@ -132,8 +133,7 @@ default_solid_form = /obj/item/stack/material/bolt shard_name = SHARD_NONE shard_type = /obj/item/shreddedp - exoplanet_rarity_plant = MAT_RARITY_NOWHERE - exoplanet_rarity_gas = MAT_RARITY_NOWHERE + exoplanet_rarity_plant = MAT_RARITY_EXOTIC sound_manipulate = 'sound/foley/paperpickup2.ogg' sound_dropped = 'sound/foley/paperpickup1.ogg' compost_value = 0.8 @@ -157,8 +157,6 @@ wall_support_value = MAT_VALUE_EXTREMELY_LIGHT default_solid_form = /obj/item/stack/material/bolt dug_drop_type = /obj/item/stack/material/bolt - exoplanet_rarity_plant = MAT_RARITY_NOWHERE - exoplanet_rarity_gas = MAT_RARITY_NOWHERE sound_manipulate = 'sound/foley/paperpickup2.ogg' sound_dropped = 'sound/foley/paperpickup1.ogg' compost_value = 0.8 @@ -220,6 +218,7 @@ sound_dropped = 'sound/foley/paperpickup1.ogg' fishing_bait_value = 0.75 allergen_flags = ALLERGEN_VEGETABLE + exoplanet_rarity_plant = MAT_RARITY_MUNDANE /// Used for plant products that aren't quite wood, but are still tougher than normal plant matter. /decl/material/solid/organic/plantmatter/pith @@ -268,8 +267,6 @@ reflectiveness = MAT_VALUE_MATTE wall_support_value = MAT_VALUE_EXTREMELY_LIGHT default_solid_form = /obj/item/stack/material/skin - exoplanet_rarity_plant = MAT_RARITY_NOWHERE - exoplanet_rarity_gas = MAT_RARITY_NOWHERE sound_manipulate = 'sound/foley/paperpickup2.ogg' sound_dropped = 'sound/foley/paperpickup1.ogg' tensile_strength = 0.8 // TODO: dried sinew? Should this be crappier than plastic/metal? @@ -287,6 +284,7 @@ ignition_point = T0C+150 melting_point = T0C+100 // Assuming synthetic leather. compost_value = 0 + exoplanet_rarity_plant = MAT_RARITY_NOWHERE /decl/material/solid/organic/leather/lizard name = "scaled hide" diff --git a/code/modules/materials/definitions/solids/materials_solid_stone.dm b/code/modules/materials/definitions/solids/materials_solid_stone.dm index 99c4a2bd31c3..5cdac448041c 100644 --- a/code/modules/materials/definitions/solids/materials_solid_stone.dm +++ b/code/modules/materials/definitions/solids/materials_solid_stone.dm @@ -15,6 +15,8 @@ 'icons/turf/walls/wood.dmi' = TRUE, 'icons/turf/walls/brick.dmi' = TRUE, 'icons/turf/walls/log.dmi' = TRUE, + 'icons/turf/walls/wattle.dmi' = TRUE, + 'icons/turf/walls/wattledaub.dmi' = TRUE, 'icons/turf/walls/metal.dmi' = TRUE ) dissolves_into = list( @@ -23,6 +25,15 @@ ore_result_amount = 4 sound_manipulate = 'sound/foley/rockscrape.ogg' sound_dropped = 'sound/foley/rockscrape.ogg' + var/image/texture + +/decl/material/solid/stone/Initialize() + . = ..() + texture = image('icons/turf/wall_texture.dmi', "concrete") + texture.blend_mode = BLEND_MULTIPLY + +/decl/material/solid/stone/get_wall_texture() + return texture /decl/material/solid/stone/sandstone name = "sandstone" @@ -112,12 +123,3 @@ melting_point = T0C + 1200 exoplanet_rarity_plant = MAT_RARITY_NOWHERE exoplanet_rarity_gas = MAT_RARITY_NOWHERE - var/image/texture - -/decl/material/solid/stone/concrete/Initialize() - . = ..() - texture = image('icons/turf/wall_texture.dmi', "concrete") - texture.blend_mode = BLEND_MULTIPLY - -/decl/material/solid/stone/concrete/get_wall_texture() - return texture diff --git a/code/modules/materials/definitions/solids/materials_solid_wood.dm b/code/modules/materials/definitions/solids/materials_solid_wood.dm index 6402e6aa627f..a20bd4d5a986 100644 --- a/code/modules/materials/definitions/solids/materials_solid_wood.dm +++ b/code/modules/materials/definitions/solids/materials_solid_wood.dm @@ -10,6 +10,8 @@ 'icons/turf/walls/stone.dmi' = TRUE, 'icons/turf/walls/brick.dmi' = TRUE, 'icons/turf/walls/log.dmi' = TRUE, + 'icons/turf/walls/wattle.dmi' = TRUE, + 'icons/turf/walls/wattledaub.dmi' = TRUE, 'icons/turf/walls/metal.dmi' = TRUE ) icon_reinf = list( @@ -37,7 +39,7 @@ dooropen_noise = 'sound/effects/doorcreaky.ogg' door_icon_base = "wood" destruction_desc = "splinters" - hitsound = 'sound/effects/woodhit.ogg' + hitsound = 'sound/effects/hit_wood.ogg' conductive = 0 construction_difficulty = MAT_VALUE_NORMAL_DIY dissolves_into = list( diff --git a/code/modules/materials/material_debris.dm b/code/modules/materials/material_debris.dm index 8c4844a81247..aa5a3ffed5c3 100644 --- a/code/modules/materials/material_debris.dm +++ b/code/modules/materials/material_debris.dm @@ -71,9 +71,9 @@ return ..() -/obj/item/debris/scraps/attackby(obj/item/W, mob/user) - if(istype(W, type) && user.try_unequip(W)) - var/obj/item/debris/scraps/other = W +/obj/item/debris/scraps/attackby(obj/item/used_item, mob/user) + if(istype(used_item, type) && user.try_unequip(used_item)) + var/obj/item/debris/scraps/other = used_item var/space_remaining = MAX_SCRAP_MATTER - get_total_matter() var/other_total_matter = other.get_total_matter() LAZYINITLIST(matter) @@ -105,6 +105,9 @@ if(!QDELETED(other)) user.put_in_hands(other) + if(isatom(loc) && !QDELETED(loc?.storage)) + loc.storage.update_ui_after_item_insertion() + UNSETEMPTY(matter) return TRUE diff --git a/code/modules/materials/material_stack_animal.dm b/code/modules/materials/material_stack_animal.dm index f4d1d30f8090..eaa7a353bb21 100644 --- a/code/modules/materials/material_stack_animal.dm +++ b/code/modules/materials/material_stack_animal.dm @@ -26,12 +26,12 @@ _cleaned = TRUE name_modifier = "cleaned" -/obj/item/stack/material/skin/attackby(obj/item/W, mob/user) - if(IS_KNIFE(W) && !_cleaned) +/obj/item/stack/material/skin/attackby(obj/item/used_item, mob/user) + if(IS_KNIFE(used_item) && !_cleaned) var/cleaned_sheets = 0 - while(W.do_tool_interaction(TOOL_KNIFE, user, src, 2 SECONDS, "scraping", "scraping", check_skill = work_skill, set_cooldown = TRUE)) + while(used_item.do_tool_interaction(TOOL_KNIFE, user, src, 2 SECONDS, "scraping", "scraping", check_skill = work_skill, set_cooldown = TRUE)) - if(QDELETED(src) || _cleaned || get_amount() <= 0 || QDELETED(user) || (loc != user && !user.Adjacent(src)) || QDELETED(W) || user.get_active_held_item() != W) + if(QDELETED(src) || _cleaned || get_amount() <= 0 || QDELETED(user) || (loc != user && !user.Adjacent(src)) || QDELETED(used_item) || user.get_active_held_item() != used_item) break var/sheets = min(5, get_amount()) diff --git a/code/modules/materials/material_stack_misc.dm b/code/modules/materials/material_stack_misc.dm index 606d829b8e1e..a9d5c479118b 100644 --- a/code/modules/materials/material_stack_misc.dm +++ b/code/modules/materials/material_stack_misc.dm @@ -113,7 +113,7 @@ plural_icon_state = "cube-mult" max_icon_state = "cube-max" max_amount = 100 - attack_verb = list("cubed") + attack_verb = "cubed" stack_merge_type = /obj/item/stack/material/cubes crafting_stack_type = /obj/item/stack/material // cubes can be used for any crafting can_be_pulverized = TRUE diff --git a/code/modules/materials/materials_ore.dm b/code/modules/materials/materials_ore.dm index b2eb776014b3..4ac278611253 100644 --- a/code/modules/materials/materials_ore.dm +++ b/code/modules/materials/materials_ore.dm @@ -99,10 +99,10 @@ SetName("[(material.ore_name ? material.ore_name : "[material.name] chunk")][(amount > 1? " pile" : "")]") desc = material.ore_desc ? material.ore_desc : "A lump of ore." -/obj/item/stack/material/ore/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/stack/material) && !is_same(W)) +/obj/item/stack/material/ore/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/stack/material) && !is_same(used_item)) return FALSE //Don't reinforce - if(reinf_material && reinf_material.default_solid_form && IS_WELDER(W)) + if(reinf_material && reinf_material.default_solid_form && IS_WELDER(used_item)) return FALSE //Don't melt stuff with welder return ..() diff --git a/code/modules/mechs/components/_components.dm b/code/modules/mechs/components/_components.dm index 6f93e83e1a93..e3f6f5617cdb 100644 --- a/code/modules/mechs/components/_components.dm +++ b/code/modules/mechs/components/_components.dm @@ -40,7 +40,7 @@ //These icons have multiple directions but before they're attached we only want south. /obj/item/mech_component/set_dir() - ..(SOUTH) + return ..(SOUTH) /obj/item/mech_component/proc/show_missing_parts(var/mob/user) return @@ -96,9 +96,9 @@ qdel(RC) update_components() -/obj/item/mech_component/attackby(var/obj/item/thing, var/mob/user) +/obj/item/mech_component/attackby(var/obj/item/used_item, var/mob/user) - if(IS_SCREWDRIVER(thing)) + if(IS_SCREWDRIVER(used_item)) if(contents.len) //Filter non movables var/list/valid_contents = list() @@ -118,15 +118,15 @@ to_chat(user, SPAN_WARNING("There is nothing to remove.")) return TRUE - if(IS_WELDER(thing)) - repair_brute_generic(thing, user) + if(IS_WELDER(used_item)) + repair_brute_generic(used_item, user) return TRUE - if(IS_COIL(thing)) - repair_burn_generic(thing, user) + if(IS_COIL(used_item)) + repair_burn_generic(used_item, user) return TRUE - if(istype(thing, /obj/item/robotanalyzer)) + if(istype(used_item, /obj/item/robotanalyzer)) to_chat(user, SPAN_NOTICE("Diagnostic Report for \the [src]:")) return_diagnostics(user) return TRUE @@ -136,16 +136,16 @@ /obj/item/mech_component/proc/update_components() return -/obj/item/mech_component/proc/repair_brute_generic(var/obj/item/weldingtool/WT, var/mob/user) - if(!istype(WT)) +/obj/item/mech_component/proc/repair_brute_generic(var/obj/item/weldingtool/welder, var/mob/user) + if(!istype(welder)) return if(!brute_damage) to_chat(user, SPAN_NOTICE("You inspect \the [src] but find nothing to weld.")) return - if(!WT.isOn()) - to_chat(user, SPAN_WARNING("Turn \the [WT] on, first.")) + if(!welder.isOn()) + to_chat(user, SPAN_WARNING("Turn \the [welder] on, first.")) return - if(WT.weld((SKILL_MAX + 1) - user.get_skill_value(SKILL_CONSTRUCTION), user)) + if(welder.weld((SKILL_MAX + 1) - user.get_skill_value(SKILL_CONSTRUCTION), user)) user.visible_message( SPAN_NOTICE("\The [user] begins welding the damage on \the [src]..."), SPAN_NOTICE("You begin welding the damage on \the [src]...") diff --git a/code/modules/mechs/components/arms.dm b/code/modules/mechs/components/arms.dm index 9d5fe7a3a7d5..f420a8b3d853 100644 --- a/code/modules/mechs/components/arms.dm +++ b/code/modules/mechs/components/arms.dm @@ -24,13 +24,13 @@ /obj/item/mech_component/manipulators/prebuild() motivator = new(src) -/obj/item/mech_component/manipulators/attackby(var/obj/item/thing, var/mob/user) - if(istype(thing,/obj/item/robot_parts/robot_component/actuator)) +/obj/item/mech_component/manipulators/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item,/obj/item/robot_parts/robot_component/actuator)) if(motivator) to_chat(user, SPAN_WARNING("\The [src] already has an actuator installed.")) return TRUE - if(install_component(thing, user)) - motivator = thing + if(install_component(used_item, user)) + motivator = used_item return TRUE return FALSE else diff --git a/code/modules/mechs/components/body.dm b/code/modules/mechs/components/body.dm index ca4a65fadc05..16fe9e6f62f0 100644 --- a/code/modules/mechs/components/body.dm +++ b/code/modules/mechs/components/body.dm @@ -138,29 +138,29 @@ cell = new /obj/item/cell/exosuit(src) cell.charge = cell.maxcharge -/obj/item/mech_component/chassis/attackby(var/obj/item/thing, var/mob/user) - if(istype(thing,/obj/item/robot_parts/robot_component/diagnosis_unit)) +/obj/item/mech_component/chassis/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item,/obj/item/robot_parts/robot_component/diagnosis_unit)) if(diagnostics) to_chat(user, SPAN_WARNING("\The [src] already has a diagnostic system installed.")) return TRUE - if(install_component(thing, user)) - diagnostics = thing + if(install_component(used_item, user)) + diagnostics = used_item return TRUE return FALSE - else if(istype(thing, /obj/item/cell)) + else if(istype(used_item, /obj/item/cell)) if(cell) to_chat(user, SPAN_WARNING("\The [src] already has a cell installed.")) return TRUE - if(install_component(thing,user)) - cell = thing + if(install_component(used_item,user)) + cell = used_item return TRUE return FALSE - else if(istype(thing, /obj/item/robot_parts/robot_component/armour/exosuit)) + else if(istype(used_item, /obj/item/robot_parts/robot_component/armour/exosuit)) if(m_armour) to_chat(user, SPAN_WARNING("\The [src] already has armour installed.")) return TRUE - if(install_component(thing, user)) - m_armour = thing + if(install_component(used_item, user)) + m_armour = used_item return TRUE return FALSE else diff --git a/code/modules/mechs/components/frame.dm b/code/modules/mechs/components/frame.dm index 16a24e639de0..6ad92e633602 100644 --- a/code/modules/mechs/components/frame.dm +++ b/code/modules/mechs/components/frame.dm @@ -71,9 +71,9 @@ /obj/structure/heavy_vehicle_frame/set_dir() return ..(SOUTH) -/obj/structure/heavy_vehicle_frame/attackby(var/obj/item/thing, var/mob/user) +/obj/structure/heavy_vehicle_frame/attackby(var/obj/item/used_item, var/mob/user) // Removing components. - if(IS_CROWBAR(thing)) + if(IS_CROWBAR(used_item)) if(is_reinforced == FRAME_REINFORCED) if(!user.do_skilled(0.5 SECONDS, SKILL_DEVICES, src) || !material) return TRUE @@ -103,7 +103,7 @@ return TRUE // Final construction step. - else if(IS_SCREWDRIVER(thing)) + else if(IS_SCREWDRIVER(used_item)) // Check for basic components. if(!(arms && legs && head && body)) @@ -149,13 +149,13 @@ return TRUE // Installing wiring. - else if(IS_COIL(thing)) + else if(IS_COIL(used_item)) if(is_wired) to_chat(user, SPAN_WARNING("\The [src] has already been wired.")) return TRUE - var/obj/item/stack/cable_coil/CC = thing + var/obj/item/stack/cable_coil/CC = used_item if(CC.get_amount() < 10) to_chat(user, SPAN_WARNING("You need at least ten units of cable to complete the exosuit.")) return TRUE @@ -173,7 +173,7 @@ playsound(user.loc, 'sound/items/Deconstruct.ogg', 50, 1) is_wired = FRAME_WIRED // Securing wiring. - else if(IS_WIRECUTTER(thing)) + else if(IS_WIRECUTTER(used_item)) if(!is_wired) to_chat(user, "There is no wiring in \the [src] to neaten.") return TRUE @@ -187,8 +187,8 @@ playsound(user.loc, 'sound/items/Wirecutter.ogg', 100, 1) is_wired = (is_wired == FRAME_WIRED_ADJUSTED) ? FRAME_WIRED : FRAME_WIRED_ADJUSTED // Installing metal. - else if(istype(thing, /obj/item/stack/material)) - var/obj/item/stack/material/M = thing + else if(istype(used_item, /obj/item/stack/material)) + var/obj/item/stack/material/M = used_item if(M.material) if(is_reinforced) to_chat(user, SPAN_WARNING("There is already a material reinforcement installed in \the [src].")) @@ -210,7 +210,7 @@ else return ..() // Securing metal. - else if(IS_WRENCH(thing)) + else if(IS_WRENCH(used_item)) if(!is_reinforced) to_chat(user, SPAN_WARNING("There is no metal to secure inside \the [src].")) return TRUE @@ -228,18 +228,18 @@ playsound(user.loc, 'sound/items/Ratchet.ogg', 100, 1) is_reinforced = (is_reinforced == FRAME_REINFORCED_SECURE) ? FRAME_REINFORCED : FRAME_REINFORCED_SECURE // Welding metal. - else if(IS_WELDER(thing)) - var/obj/item/weldingtool/WT = thing + else if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item if(!is_reinforced) to_chat(user, SPAN_WARNING("There is no metal to secure inside \the [src].")) return TRUE if(is_reinforced == FRAME_REINFORCED) to_chat(user, SPAN_WARNING("The reinforcement inside \the [src] has not been secured.")) return TRUE - if(!WT.isOn()) - to_chat(user, SPAN_WARNING("Turn \the [WT] on, first.")) + if(!welder.isOn()) + to_chat(user, SPAN_WARNING("Turn \the [welder] on, first.")) return TRUE - if(WT.weld(1, user)) + if(welder.weld(1, user)) var/last_reinforced_state = is_reinforced visible_message("\The [user] begins welding the metal reinforcement inside \the [src].") @@ -253,42 +253,42 @@ to_chat(user, SPAN_WARNING("Not enough fuel!")) return TRUE // Installing basic components. - else if(istype(thing,/obj/item/mech_component/manipulators)) + else if(istype(used_item,/obj/item/mech_component/manipulators)) if(arms) to_chat(user, SPAN_WARNING("\The [src] already has manipulators installed.")) return TRUE - if(install_component(thing, user)) + if(install_component(used_item, user)) if(arms) - thing.dropInto(loc) + used_item.dropInto(loc) return TRUE - arms = thing - else if(istype(thing,/obj/item/mech_component/propulsion)) + arms = used_item + else if(istype(used_item,/obj/item/mech_component/propulsion)) if(legs) to_chat(user, SPAN_WARNING("\The [src] already has a propulsion system installed.")) return TRUE - if(install_component(thing, user)) + if(install_component(used_item, user)) if(legs) - thing.dropInto(loc) + used_item.dropInto(loc) return TRUE - legs = thing - else if(istype(thing,/obj/item/mech_component/sensors)) + legs = used_item + else if(istype(used_item,/obj/item/mech_component/sensors)) if(head) to_chat(user, SPAN_WARNING("\The [src] already has a sensor array installed.")) return TRUE - if(install_component(thing, user)) + if(install_component(used_item, user)) if(head) - thing.dropInto(loc) + used_item.dropInto(loc) return TRUE - head = thing - else if(istype(thing,/obj/item/mech_component/chassis)) + head = used_item + else if(istype(used_item,/obj/item/mech_component/chassis)) if(body) to_chat(user, SPAN_WARNING("\The [src] already has an outer chassis installed.")) return TRUE - if(install_component(thing, user)) + if(install_component(used_item, user)) if(body) - thing.dropInto(loc) + used_item.dropInto(loc) return TRUE - body = thing + body = used_item else return ..() update_icon() @@ -301,7 +301,7 @@ return 0 if(user) visible_message(SPAN_NOTICE("\The [user] begins installing \the [thing] into \the [src].")) - if(!user.canUnEquip(thing) || !user.do_skilled(3 SECONDS, SKILL_DEVICES, src) || user.get_active_held_item() != thing) + if(!user.can_unequip_item(thing) || !user.do_skilled(3 SECONDS, SKILL_DEVICES, src) || user.get_active_held_item() != thing) return if(!user.try_unequip(thing)) return diff --git a/code/modules/mechs/components/head.dm b/code/modules/mechs/components/head.dm index 84791a488886..8c4869494e1d 100644 --- a/code/modules/mechs/components/head.dm +++ b/code/modules/mechs/components/head.dm @@ -56,29 +56,29 @@ /obj/item/mech_component/sensors/ready_to_install() return (radio && camera) -/obj/item/mech_component/sensors/attackby(var/obj/item/thing, var/mob/user) - if(istype(thing, /obj/item/mech_component/control_module)) +/obj/item/mech_component/sensors/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/mech_component/control_module)) if(software) to_chat(user, SPAN_WARNING("\The [src] already has a control modules installed.")) return TRUE - if(install_component(thing, user)) - software = thing + if(install_component(used_item, user)) + software = used_item return TRUE return FALSE - else if(istype(thing,/obj/item/robot_parts/robot_component/radio)) + else if(istype(used_item,/obj/item/robot_parts/robot_component/radio)) if(radio) to_chat(user, SPAN_WARNING("\The [src] already has a radio installed.")) return TRUE - if(install_component(thing, user)) - radio = thing + if(install_component(used_item, user)) + radio = used_item return TRUE return FALSE - else if(istype(thing,/obj/item/robot_parts/robot_component/camera)) + else if(istype(used_item,/obj/item/robot_parts/robot_component/camera)) if(camera) to_chat(user, SPAN_WARNING("\The [src] already has a camera installed.")) return TRUE - if(install_component(thing, user)) - camera = thing + if(install_component(used_item, user)) + camera = used_item return TRUE return FALSE else @@ -116,12 +116,12 @@ . = ..() . += SPAN_NOTICE("It has [max_installed_software - LAZYLEN(installed_software)] empty slot\s remaining out of [max_installed_software].") -/obj/item/mech_component/control_module/attackby(var/obj/item/thing, var/mob/user) - if(istype(thing, /obj/item/stock_parts/circuitboard/exosystem)) - install_software(thing, user) +/obj/item/mech_component/control_module/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/stock_parts/circuitboard/exosystem)) + install_software(used_item, user) return TRUE - if(IS_SCREWDRIVER(thing)) + if(IS_SCREWDRIVER(used_item)) . = ..() update_software() return diff --git a/code/modules/mechs/components/legs.dm b/code/modules/mechs/components/legs.dm index 40bf191e02f6..1270dbfda92f 100644 --- a/code/modules/mechs/components/legs.dm +++ b/code/modules/mechs/components/legs.dm @@ -22,13 +22,13 @@ /obj/item/mech_component/propulsion/update_components() motivator = locate() in src -/obj/item/mech_component/propulsion/attackby(var/obj/item/thing, var/mob/user) - if(istype(thing,/obj/item/robot_parts/robot_component/actuator)) +/obj/item/mech_component/propulsion/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item,/obj/item/robot_parts/robot_component/actuator)) if(motivator) to_chat(user, SPAN_WARNING("\The [src] already has an actuator installed.")) return TRUE - if(install_component(thing, user)) - motivator = thing + if(install_component(used_item, user)) + motivator = used_item return TRUE return FALSE else diff --git a/code/modules/mechs/equipment/combat.dm b/code/modules/mechs/equipment/combat.dm index fbc24657a603..750d69df49de 100644 --- a/code/modules/mechs/equipment/combat.dm +++ b/code/modules/mechs/equipment/combat.dm @@ -45,9 +45,9 @@ return "[round(power_supply.charge / charge_cost)]/[max_shots]" /obj/item/gun/energy/get_hardpoint_status_value() - var/obj/item/cell/C = get_cell() - if(istype(C)) - return C.charge/C.maxcharge + var/obj/item/cell/cell = get_cell() + if(istype(cell)) + return cell.charge/cell.maxcharge return null /obj/item/mech_equipment/shields @@ -62,8 +62,6 @@ /decl/material/solid/metal/silver = MATTER_AMOUNT_REINFORCEMENT, /decl/material/solid/metal/gold = MATTER_AMOUNT_TRACE ) - - var/obj/aura/mechshield/aura = null var/max_charge = 150 var/charge = 150 var/last_recharge = 0 @@ -72,10 +70,12 @@ /obj/item/mech_equipment/shields/installed(var/mob/living/exosuit/_owner) . = ..() - aura = new(owner, src) + if(owner) + owner.add_mob_modifier(/decl/mob_modifier/mechshield, source = src) /obj/item/mech_equipment/shields/uninstalled() - QDEL_NULL(aura) + if(owner) + owner.remove_mob_modifier(/decl/mob_modifier/mechshield, source = src) . = ..() /obj/item/mech_equipment/shields/attack_self(var/mob/user) @@ -91,23 +91,27 @@ if(difference > 0) for(var/mob/pilot in owner.pilots) - to_chat(pilot, SPAN_DANGER("Warning: Deflector shield failure detect, shutting down!")) + to_chat(pilot, SPAN_DANGER("Warning: Deflector shield failure detected, shutting down!")) toggle() playsound(owner.loc,'sound/mecha/internaldmgalarm.ogg',35,1) return difference else return 0 /obj/item/mech_equipment/shields/proc/toggle() - if(!aura) - return - aura.toggle() + + if(owner?.has_mob_modifier(/decl/mob_modifier/mechshield, source = src)) + owner.remove_mob_modifier(/decl/mob_modifier/mechshield, source = src) + else if(owner) + owner.add_mob_modifier(/decl/mob_modifier/mechshield, source = src) + + active = owner?.has_mob_modifier(/decl/mob_modifier/mechshield, source = src) + playsound(owner,'sound/weapons/flash.ogg',35,1) update_icon() - if(aura.active) + if(active) START_PROCESSING(SSobj, src) else STOP_PROCESSING(SSobj, src) - active = aura.active passive_power_use = active ? 1 KILOWATTS : 0 owner.update_icon() @@ -118,9 +122,7 @@ /obj/item/mech_equipment/shields/on_update_icon() . = ..() - if(!aura) - return - if(aura.active) + if(owner?.has_mob_modifier(/decl/mob_modifier/mechshield, source = src)) icon_state = "shield_droid_a" else icon_state = "shield_droid" @@ -141,91 +143,7 @@ return charge / max_charge /obj/item/mech_equipment/shields/get_hardpoint_maptext() - return "[(aura && aura.active) ? "ONLINE" : "OFFLINE"]: [round((charge / max_charge) * 100)]%" - -/obj/aura/mechshield - icon = 'icons/mecha/shield.dmi' - name = "mechshield" - var/obj/item/mech_equipment/shields/shields = null - var/active = 0 - layer = ABOVE_HUMAN_LAYER - var/north_layer = MECH_UNDER_LAYER - plane = DEFAULT_PLANE - pixel_x = 8 - pixel_y = 4 - mouse_opacity = MOUSE_OPACITY_UNCLICKABLE - -/obj/aura/mechshield/Initialize(var/maploading, var/obj/item/mech_equipment/shields/holder) - . = ..() - shields = holder - -/obj/aura/mechshield/added_to(var/mob/living/target) - . = ..() - target.add_vis_contents(src) - set_dir(target.dir) - events_repository.register(/decl/observ/dir_set, user, src, TYPE_PROC_REF(/obj/aura/mechshield, update_dir)) - -/obj/aura/mechshield/proc/update_dir(var/user, var/old_dir, var/dir) - set_dir(dir) - -/obj/aura/mechshield/set_dir(new_dir) - . = ..() - if(dir == NORTH) - layer = north_layer - else layer = initial(layer) - -/obj/aura/mechshield/Destroy() - if(user) - events_repository.unregister(/decl/observ/dir_set, user, src, TYPE_PROC_REF(/obj/aura/mechshield, update_dir)) - user.remove_vis_contents(src) - shields = null - . = ..() - -/obj/aura/mechshield/proc/toggle() - active = !active - - update_icon() - - if(active) - flick("shield_raise", src) - else - flick("shield_drop", src) - - -/obj/aura/mechshield/on_update_icon() - . = ..() - if(active) - icon_state = "shield" - else - icon_state = "shield_null" - -/obj/aura/mechshield/bullet_act(var/obj/item/projectile/P, var/def_zone) - if(!active) - return - if(shields) - if(shields.charge) - P.damage = shields.stop_damage(P.damage) - user.visible_message(SPAN_WARNING("\The [shields.owner]'s shields flash and crackle.")) - flick("shield_impact", src) - playsound(user,'sound/effects/basscannon.ogg',35,1) - //light up the night. - new /obj/effect/effect/smoke/illumination(user.loc, 5, 4, 1, "#ffffff") - if(P.damage <= 0) - return AURA_FALSE|AURA_CANCEL - - spark_at(user, amount=5) - -/obj/aura/mechshield/hitby(atom/movable/M, var/datum/thrownthing/TT) - . = ..() - if(.) - if(!active) - return - if(shields.charge && TT.speed <= 5) - user.visible_message(SPAN_WARNING("\The [shields.owner]'s shields flash briefly as they deflect \the [M].")) - flick("shield_impact", src) - playsound(user,'sound/effects/basscannon.ogg',10,1) - return AURA_FALSE|AURA_CANCEL - //Too fast! + return "[owner?.has_mob_modifier(/decl/mob_modifier/mechshield, source = src) ? "ONLINE" : "OFFLINE"]: [round((charge / max_charge) * 100)]%" //Melee! As a general rule I would recommend using regular objects and putting logic in them. /obj/item/mech_equipment/mounted_system/melee @@ -287,11 +205,10 @@ /obj/item/mech_equipment/ballistic_shield name = "exosuit ballistic shield" desc = "This formidable line of defense, sees widespread use in planetary peacekeeping operations and military formations alike." - icon_state = "mech_shield" //Rendering is handled by aura due to layering issues: TODO, figure out a better way to do this + icon_state = "mech_shield" restricted_hardpoints = list(HARDPOINT_LEFT_HAND, HARDPOINT_RIGHT_HAND) restricted_software = list(MECH_SOFTWARE_UTILITY) origin_tech = @'{"materials":2,"engineering":2}' - var/obj/aura/mech_ballistic/aura = null var/last_push = 0 var/chance = 60 //For attacks from the front, diminishing returns var/last_max_block = 0 //Blocking during a perfect block window resets this, else there is an anti spam @@ -300,10 +217,10 @@ /obj/item/mech_equipment/ballistic_shield/installed(mob/living/exosuit/_owner) . = ..() - aura = new(owner, src) + owner?.add_mob_modifier(/decl/mob_modifier/mech_ballistic, source = src) /obj/item/mech_equipment/ballistic_shield/uninstalled() - QDEL_NULL(aura) + owner?.remove_mob_modifier(/decl/mob_modifier/mech_ballistic, source = src) . = ..() /obj/item/mech_equipment/ballistic_shield/afterattack(atom/target, mob/living/user, inrange, params) @@ -379,70 +296,6 @@ //Reset timer for maximum chainblocks last_max_block = 0 -/obj/aura/mech_ballistic - icon = 'icons/mecha/ballistic_shield.dmi' - name = "mech_ballistic_shield" - var/obj/item/mech_equipment/ballistic_shield/shield = null - layer = MECH_UNDER_LAYER - plane = DEFAULT_PLANE - mouse_opacity = MOUSE_OPACITY_UNCLICKABLE - -/obj/aura/mech_ballistic/Initialize(maploading, obj/item/mech_equipment/ballistic_shield/holder) - . = ..() - shield = holder - - //Get where we are attached so we know what icon to use - if (holder && holder.owner) - var/mob/living/exosuit/E = holder.owner - for (var/hardpoint in E.hardpoints) - var/obj/item/mech_equipment/hardpoint_object = E.hardpoints[hardpoint] - if (holder == hardpoint_object) - icon_state = "mech_shield_[hardpoint]" - var/image/I = image(icon, "[icon_state]_over") - I.layer = ABOVE_HUMAN_LAYER - overlays.Add(I) - -/obj/aura/mech_ballistic/added_to(mob/living/target) - . = ..() - target.add_vis_contents(src) - set_dir(target.dir) - global.events_repository.register(/decl/observ/dir_set, user, src, TYPE_PROC_REF(/obj/aura/mech_ballistic, update_dir)) - -/obj/aura/mech_ballistic/proc/update_dir(user, old_dir, dir) - set_dir(dir) - -/obj/aura/mech_ballistic/Destroy() - if (user) - global.events_repository.unregister(/decl/observ/dir_set, user, src, TYPE_PROC_REF(/obj/aura/mech_ballistic, update_dir)) - user.remove_vis_contents(src) - shield = null - . = ..() - -/obj/aura/mech_ballistic/bullet_act(obj/item/projectile/P, def_zone) - . = ..() - if (shield && prob(shield.block_chance(P.damage, P.armor_penetration, source = P))) - user.visible_message(SPAN_WARNING("\The [P] is blocked by \the [user]'s [shield.name].")) - user.bullet_impact_visuals(P, def_zone, 0) - shield.on_block_attack() - return AURA_FALSE|AURA_CANCEL - -/obj/aura/mech_ballistic/hitby(atom/movable/AM, datum/thrownthing/TT) - . = ..() - if (. && shield) - var/throw_damage = AM.get_thrown_attack_force() * (TT.speed/THROWFORCE_SPEED_DIVISOR) - if (prob(shield.block_chance(throw_damage, 0, source = AM, attacker = TT.thrower))) - user.visible_message(SPAN_WARNING("\The [AM] bounces off \the [user]'s [shield].")) - playsound(user.loc, 'sound/weapons/Genhit.ogg', 50, 1) - shield.on_block_attack() - return AURA_FALSE|AURA_CANCEL - -/obj/aura/mech_ballistic/attackby(obj/item/I, mob/user) - . = ..() - if (shield && prob(shield.block_chance(I.get_attack_force(), I.armor_penetration, source = I, attacker = user))) - user.visible_message(SPAN_WARNING("\The [I] is blocked by \the [user]'s [shield.name].")) - playsound(user.loc, 'sound/weapons/Genhit.ogg', 50, 1) - return AURA_FALSE|AURA_CANCEL - /obj/item/mech_equipment/flash name = "exosuit flash" icon_state = "mech_flash" @@ -459,28 +312,12 @@ playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1) var/flash_time = (rand(flash_min,flash_max) - 1) - var/obj/item/cell/C = owner.get_cell() - C.use(active_power_use * CELLRATE) + var/obj/item/cell/cell = owner.get_cell() + cell.use(active_power_use * CELLRATE) for (var/mob/living/O in oviewers(flash_range, owner)) if(istype(O)) - var/protection = O.eyecheck() - if(protection >= FLASH_PROTECTION_MODERATE) - return - - if(protection >= FLASH_PROTECTION_MINOR) - flash_time /= 2 - - if(ishuman(O)) - var/mob/living/human/H = O - flash_time = round(H.get_flash_mod() * flash_time) - if(flash_time <= 0) - return - - if(!O.is_blind()) - O.flash_eyes(FLASH_PROTECTION_MODERATE - protection) - SET_STATUS_MAX(O, STAT_BLURRY, flash_time) - SET_STATUS_MAX(O, STAT_CONFUSE, (flash_time + 2)) + O.handle_flashed(flash_time, do_stun = FALSE) /obj/item/mech_equipment/flash/attack_self(mob/user) . = ..() @@ -507,33 +344,7 @@ playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1) var/flash_time = (rand(flash_min,flash_max)) - var/obj/item/cell/C = owner.get_cell() - C.use(active_power_use * CELLRATE) - - var/protection = O.eyecheck() - if(protection >= FLASH_PROTECTION_MAJOR) - return - - if(protection >= FLASH_PROTECTION_MODERATE) - flash_time /= 2 - - if(ishuman(O)) - var/mob/living/human/H = O - flash_time = round(H.get_flash_mod() * flash_time) - if(flash_time <= 0) - return - - if(!O.is_blind()) - O.flash_eyes(FLASH_PROTECTION_MAJOR - protection) - SET_STATUS_MAX(O, STAT_BLURRY, flash_time) - SET_STATUS_MAX(O, STAT_CONFUSE, (flash_time + 2)) - - if(isanimal(O)) //Hit animals a bit harder - SET_STATUS_MAX(O, STAT_STUN, flash_time) - else - SET_STATUS_MAX(O, STAT_STUN, (flash_time / 2)) + var/obj/item/cell/cell = owner.get_cell() + cell.use(active_power_use * CELLRATE) - if(flash_time > 3) - O.drop_held_items() - if(flash_time > 5) - SET_STATUS_MAX(O, STAT_WEAK, 2) + O.handle_flashed(flash_time) diff --git a/code/modules/mechs/equipment/combat_projectile.dm b/code/modules/mechs/equipment/combat_projectile.dm index 16756e060d6a..f71d5a2a5e59 100644 --- a/code/modules/mechs/equipment/combat_projectile.dm +++ b/code/modules/mechs/equipment/combat_projectile.dm @@ -1,12 +1,12 @@ -/obj/item/mech_equipment/mounted_system/projectile/attackby(var/obj/item/O, var/mob/user) +/obj/item/mech_equipment/mounted_system/projectile/attackby(var/obj/item/used_item, var/mob/user) var/obj/item/gun/projectile/automatic/A = holding if(!istype(A)) return FALSE - if(istype(O, /obj/item/crowbar)) + if(istype(used_item, /obj/item/crowbar)) A.unload_ammo(user) to_chat(user, SPAN_NOTICE("You remove the ammo magazine from \the [src].")) - else if(istype(O, A.magazine_type)) - A.load_ammo(O, user) + else if(istype(used_item, A.magazine_type)) + A.load_ammo(used_item, user) to_chat(user, SPAN_NOTICE("You load the ammo magazine into \the [src].")) return TRUE diff --git a/code/modules/mechs/equipment/engineering.dm b/code/modules/mechs/equipment/engineering.dm index f2f7448b2d64..b287ef5713e3 100644 --- a/code/modules/mechs/equipment/engineering.dm +++ b/code/modules/mechs/equipment/engineering.dm @@ -14,17 +14,17 @@ /obj/item/rcd/mounted/get_hardpoint_maptext() var/obj/item/mech_equipment/mounted_system/MS = loc if(istype(MS) && MS.owner) - var/obj/item/cell/C = MS.owner.get_cell() - if(istype(C)) - return "[round(C.charge)]/[round(C.maxcharge)]" + var/obj/item/cell/cell = MS.owner.get_cell() + if(istype(cell)) + return "[round(cell.charge)]/[round(cell.maxcharge)]" return null /obj/item/rcd/mounted/get_hardpoint_status_value() var/obj/item/mech_equipment/mounted_system/MS = loc if(istype(MS) && MS.owner) - var/obj/item/cell/C = MS.owner.get_cell() - if(istype(C)) - return C.charge/C.maxcharge + var/obj/item/cell/cell = MS.owner.get_cell() + if(istype(cell)) + return cell.charge/cell.maxcharge return null /obj/item/chems/spray/extinguisher/mech diff --git a/code/modules/mechs/equipment/medical.dm b/code/modules/mechs/equipment/medical.dm index b9f6b5da59b6..373af3a552e2 100644 --- a/code/modules/mechs/equipment/medical.dm +++ b/code/modules/mechs/equipment/medical.dm @@ -29,9 +29,9 @@ if(.) sleeper.ui_interact(user) -/obj/item/mech_equipment/sleeper/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/chems/glass)) - return sleeper.attackby(I, user) +/obj/item/mech_equipment/sleeper/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/chems/glass)) + return sleeper.attackby(used_item, user) else return ..() @@ -78,14 +78,14 @@ return null //You cannot modify these, it'd probably end with something in nullspace. In any case basic meds are plenty for an ambulance -/obj/machinery/sleeper/mounted/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/chems/glass)) - if(!user.try_unequip(I, src)) +/obj/machinery/sleeper/mounted/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/chems/glass)) + if(!user.try_unequip(used_item, src)) return TRUE if(beaker) user.put_in_hands(beaker) user.visible_message("\The [user] removes \the [beaker] from \the [src].", "You remove \the [beaker] from \the [src].") - beaker = I - user.visible_message("\The [user] adds \a [I] to \the [src].", "You add \a [I] to \the [src].") + beaker = used_item + user.visible_message("\The [user] adds \a [used_item] to \the [src].", "You add \a [used_item] to \the [src].") return TRUE return FALSE diff --git a/code/modules/mechs/equipment/utility.dm b/code/modules/mechs/equipment/utility.dm index bfd2be06d01f..37b955a8ddfe 100644 --- a/code/modules/mechs/equipment/utility.dm +++ b/code/modules/mechs/equipment/utility.dm @@ -305,9 +305,9 @@ log_and_message_admins("used [src] to throw [locked] at [target].", user, owner.loc) locked = null - var/obj/item/cell/C = owner.get_cell() - if(istype(C)) - C.use(active_power_use * CELLRATE) + var/obj/item/cell/cell = owner.get_cell() + if(istype(cell)) + cell.use(active_power_use * CELLRATE) else locked = null @@ -326,9 +326,9 @@ log_and_message_admins("used [src]'s area throw on [target].", user, owner.loc) - var/obj/item/cell/C = owner.get_cell() - if(istype(C)) - C.use(active_power_use * CELLRATE * 2) //bit more expensive to throw all + var/obj/item/cell/cell = owner.get_cell() + if(istype(cell)) + cell.use(active_power_use * CELLRATE * 2) //bit more expensive to throw all @@ -423,9 +423,9 @@ DH.forceMove(src) drill_head = DH -/obj/item/mech_equipment/drill/attackby(obj/item/I, mob/user) - if (istype(I, /obj/item/drill_head)) - attach_head(I, user) +/obj/item/mech_equipment/drill/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/drill_head)) + attach_head(used_item, user) return TRUE . = ..() @@ -755,10 +755,10 @@ passive_power_use = 0 . = ..() -/obj/item/mech_equipment/camera/attackby(obj/item/W, mob/user) +/obj/item/mech_equipment/camera/attackby(obj/item/used_item, mob/user) . = ..() - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) var/datum/extension/network_device/camera/mech/D = get_extension(src, /datum/extension/network_device) D.ui_interact(user) diff --git a/code/modules/mechs/interface/_interface.dm b/code/modules/mechs/interface/_interface.dm index e314bcf27a81..f9090602be10 100644 --- a/code/modules/mechs/interface/_interface.dm +++ b/code/modules/mechs/interface/_interface.dm @@ -72,8 +72,8 @@ handle_hud_icons_health() var/maptext_string = "CHECK
    POWER" - var/obj/item/cell/C = get_cell() - if(istype(C)) + var/obj/item/cell/cell = get_cell() + if(istype(cell)) maptext_string = "[round(get_cell().charge)]/[round(get_cell().maxcharge)]" hud_power.maptext = STYLE_SMALLFONTS_OUTLINE("
    [maptext_string]
    ", 5, COLOR_WHITE, COLOR_BLACK) refresh_hud() diff --git a/code/modules/mechs/mech.dm b/code/modules/mechs/mech.dm index c3dc8ec0e892..ca7f1783cc39 100644 --- a/code/modules/mechs/mech.dm +++ b/code/modules/mechs/mech.dm @@ -257,3 +257,9 @@ /mob/living/exosuit/handle_stance() stance_damage = 0 return + +/mob/living/exosuit/is_valid_merchant_pad_target() + if(current_user) + return FALSE + return ..() + diff --git a/code/modules/mechs/mech_damage_immunity.dm b/code/modules/mechs/mech_damage_immunity.dm index 067c613d56d0..01a8ef4a0f13 100644 --- a/code/modules/mechs/mech_damage_immunity.dm +++ b/code/modules/mechs/mech_damage_immunity.dm @@ -5,7 +5,7 @@ STAT_PARA ) -/mob/living/exosuit/set_status(condition, amount) +/mob/living/exosuit/set_status_condition(condition, amount) . = !(condition in ignore_status_conditions) && ..() /mob/living/exosuit/getOxyLoss() diff --git a/code/modules/mechs/mech_interaction.dm b/code/modules/mechs/mech_interaction.dm index 50188cb87fc2..8a8e9b671675 100644 --- a/code/modules/mechs/mech_interaction.dm +++ b/code/modules/mechs/mech_interaction.dm @@ -332,14 +332,14 @@ update_pilots() return 1 -/mob/living/exosuit/attackby(var/obj/item/thing, var/mob/user) +/mob/living/exosuit/attackby(var/obj/item/used_item, var/mob/user) // Install equipment. - if(!user.check_intent(I_FLAG_HARM) && istype(thing, /obj/item/mech_equipment)) + if(!user.check_intent(I_FLAG_HARM) && istype(used_item, /obj/item/mech_equipment)) if(hardpoints_locked) to_chat(user, SPAN_WARNING("Hardpoint system access is disabled.")) return TRUE - var/obj/item/mech_equipment/realThing = thing + var/obj/item/mech_equipment/realThing = used_item if(realThing.owner) return TRUE var/free_hardpoints = list() @@ -348,16 +348,16 @@ free_hardpoints += hardpoint var/to_place = input("Where would you like to install it?") as null|anything in (realThing.restricted_hardpoints & free_hardpoints) if(!to_place) - to_chat(user, SPAN_WARNING("There is no room to install \the [thing].")) - else if(!install_system(thing, to_place, user)) - to_chat(user, SPAN_WARNING("\The [thing] could not be installed in that hardpoint.")) + to_chat(user, SPAN_WARNING("There is no room to install \the [used_item].")) + else if(!install_system(used_item, to_place, user)) + to_chat(user, SPAN_WARNING("\The [used_item] could not be installed in that hardpoint.")) return TRUE // Apply customisation. - if(istype(thing, /obj/item/kit/paint)) - user.visible_message(SPAN_NOTICE("\The [user] opens \the [thing] and spends some quality time customising \the [src].")) + if(istype(used_item, /obj/item/kit/paint)) + user.visible_message(SPAN_NOTICE("\The [user] opens \the [used_item] and spends some quality time customising \the [src].")) - var/obj/item/kit/paint/P = thing + var/obj/item/kit/paint/P = used_item SetName(P.new_name) desc = P.new_desc @@ -381,7 +381,7 @@ if(!user.check_intent(I_FLAG_HARM)) // Removing systems from hardpoints. - if(IS_MULTITOOL(thing)) + if(IS_MULTITOOL(used_item)) if(hardpoints_locked) to_chat(user, SPAN_WARNING("Hardpoint system access is disabled.")) return TRUE @@ -395,7 +395,7 @@ return TRUE // Dismantling an exosuit entirely. - if(IS_WRENCH(thing)) + if(IS_WRENCH(used_item)) if(!maintenance_protocols) to_chat(user, SPAN_WARNING("The securing bolts are not visible while maintenance protocols are disabled.")) return TRUE @@ -406,7 +406,7 @@ return TRUE // Brute damage repair. - if(IS_WELDER(thing)) + if(IS_WELDER(used_item)) if(!get_damage(BRUTE)) return TRUE var/list/damaged_parts = list() @@ -415,11 +415,11 @@ damaged_parts += MC var/obj/item/mech_component/to_fix = input(user,"Which component would you like to fix") as null|anything in damaged_parts if(CanPhysicallyInteract(user) && !QDELETED(to_fix) && (to_fix in src) && to_fix.brute_damage) - to_fix.repair_brute_generic(thing, user) + to_fix.repair_brute_generic(used_item, user) return TRUE // Burn damage repair. - if(IS_COIL(thing)) + if(IS_COIL(used_item)) if(!get_damage(BURN)) return TRUE var/list/damaged_parts = list() @@ -428,11 +428,11 @@ damaged_parts += MC var/obj/item/mech_component/to_fix = input(user,"Which component would you like to fix") as null|anything in damaged_parts if(CanPhysicallyInteract(user) && !QDELETED(to_fix) && (to_fix in src) && to_fix.burn_damage) - to_fix.repair_burn_generic(thing, user) + to_fix.repair_burn_generic(used_item, user) return TRUE // Cell removal. - if(IS_SCREWDRIVER(thing)) + if(IS_SCREWDRIVER(used_item)) if(!maintenance_protocols) to_chat(user, SPAN_WARNING("The cell compartment remains locked while maintenance protocols are disabled.")) return TRUE @@ -444,23 +444,23 @@ user.put_in_hands(body.cell) to_chat(user, SPAN_NOTICE("You remove \the [body.cell] from \the [src].")) playsound(user.loc, 'sound/items/Crowbar.ogg', 50, 1) - visible_message(SPAN_NOTICE("\The [user] pries out \the [body.cell] using \the [thing].")) + visible_message(SPAN_NOTICE("\The [user] pries out \the [body.cell] using \the [used_item].")) power = MECH_POWER_OFF hud_power_control.queue_icon_update() body.cell = null return TRUE // Force-opening the cockpit. - if(IS_CROWBAR(thing)) + if(IS_CROWBAR(used_item)) if(!hatch_locked) to_chat(user, SPAN_NOTICE("The cockpit isn't locked. There is no need for this.")) return TRUE if(!body) //Error return TRUE var/delay = min(5 SECONDS * user.skill_delay_mult(SKILL_DEVICES), 5 SECONDS * user.skill_delay_mult(SKILL_EVA)) - visible_message(SPAN_NOTICE("\The [user] starts forcing \the [src]'s emergency [body.hatch_descriptor] release using \the [thing].")) + visible_message(SPAN_NOTICE("\The [user] starts forcing \the [src]'s emergency [body.hatch_descriptor] release using \the [used_item].")) if(do_after(user, delay, src)) - visible_message(SPAN_NOTICE("\The [user] forces \the [src]'s [body.hatch_descriptor] open using \the [thing].")) + visible_message(SPAN_NOTICE("\The [user] forces \the [src]'s [body.hatch_descriptor] open using \the [used_item].")) playsound(user.loc, 'sound/machines/bolts_up.ogg', 25, 1) hatch_locked = FALSE hatch_closed = FALSE @@ -471,23 +471,23 @@ return TRUE // Cell replacement. - if(istype(thing, /obj/item/cell)) + if(istype(used_item, /obj/item/cell)) if(!maintenance_protocols) to_chat(user, SPAN_WARNING("The cell compartment remains locked while maintenance protocols are disabled.")) return TRUE if(body?.cell) to_chat(user, SPAN_WARNING("There is already a cell in there!")) return TRUE - if(user.try_unequip(thing)) - thing.forceMove(body) - body.cell = thing + if(user.try_unequip(used_item)) + used_item.forceMove(body) + body.cell = used_item to_chat(user, SPAN_NOTICE("You install \the [body.cell] into \the [src].")) playsound(user.loc, 'sound/items/Screwdriver.ogg', 50, 1) visible_message(SPAN_NOTICE("\The [user] installs \the [body.cell] into \the [src].")) return TRUE // Diagnostic scan. - if(istype(thing, /obj/item/robotanalyzer)) + if(istype(used_item, /obj/item/robotanalyzer)) to_chat(user, SPAN_NOTICE("Diagnostic Report for \the [src]:")) for(var/obj/item/mech_component/MC in list(arms, legs, body, head)) if(MC) diff --git a/code/modules/mechs/mech_movement.dm b/code/modules/mechs/mech_movement.dm index 790bce7f715c..7bc1f6bae1b1 100644 --- a/code/modules/mechs/mech_movement.dm +++ b/code/modules/mechs/mech_movement.dm @@ -72,8 +72,8 @@ to_chat(mover, SPAN_WARNING("Maintenance protocols are in effect.")) exosuit.SetMoveCooldown(3) return MOVEMENT_STOP - var/obj/item/cell/C = exosuit.get_cell() - if(!C || !C.check_charge(exosuit.legs.power_use * CELLRATE)) + var/obj/item/cell/cell = exosuit.get_cell() + if(!cell || !cell.check_charge(exosuit.legs.power_use * CELLRATE)) to_chat(mover, SPAN_WARNING("The power indicator flashes briefly.")) exosuit.SetMoveCooldown(3) //On fast exosuits this got annoying fast return MOVEMENT_STOP @@ -140,12 +140,22 @@ . = SPACE_MOVE_FORBIDDEN anchored = FALSE //Regardless of modules, emp prevents control - if(has_gravity() || throwing || !isturf(loc) || length(grabbed_by) || !can_slip(magboots_only = TRUE) || locate(/obj/structure/lattice) in range(1, get_turf(src))) - . = SPACE_MOVE_PERMITTED - else - var/obj/item/mech_equipment/ionjets/J = hardpoints[HARDPOINT_BACK] - if(istype(J) && ((allow_movement || J.stabilizers) && J.provides_thrust())) + + if(length(grabbed_by)) + for(var/obj/item/grab/grab as anything in grabbed_by) + if(grab.assailant == src) + continue . = SPACE_MOVE_PERMITTED + break + + if(. != SPACE_MOVE_PERMITTED) + if(has_gravity() || throwing || !isturf(loc) || length(grabbed_by) || !can_slip(magboots_only = TRUE) || locate(/obj/structure/lattice) in range(1, get_turf(src))) + . = SPACE_MOVE_PERMITTED + else + var/obj/item/mech_equipment/ionjets/J = hardpoints[HARDPOINT_BACK] + if(istype(J) && ((allow_movement || J.stabilizers) && J.provides_thrust())) + . = SPACE_MOVE_PERMITTED + if(. == SPACE_MOVE_PERMITTED) anchored = TRUE diff --git a/code/modules/mechs/mech_wreckage.dm b/code/modules/mechs/mech_wreckage.dm index 3f0c08020156..f52c3812e14a 100644 --- a/code/modules/mechs/mech_wreckage.dm +++ b/code/modules/mechs/mech_wreckage.dm @@ -58,16 +58,16 @@ to_chat(user, "You retrieve \the [thing] from \the [src].") return TRUE -/obj/structure/mech_wreckage/attackby(var/obj/item/W, var/mob/user) +/obj/structure/mech_wreckage/attackby(var/obj/item/used_item, var/mob/user) var/cutting - if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W - if(WT.isOn()) + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(welder.isOn()) cutting = TRUE else - to_chat(user, SPAN_WARNING("Turn \the [WT] on, first.")) - else if(istype(W, /obj/item/gun/energy/plasmacutter)) + to_chat(user, SPAN_WARNING("Turn \the [welder] on, first.")) + else if(istype(used_item, /obj/item/gun/energy/plasmacutter)) cutting = TRUE if(cutting) @@ -78,7 +78,7 @@ to_chat(user, SPAN_WARNING("\The [src] has already been weakened.")) return 1 - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) if(prepared) to_chat(user, SPAN_NOTICE("You finish dismantling \the [src].")) SSmaterials.create_object(/decl/material/solid/metal/steel, get_turf(src), rand(5, 10)) @@ -86,8 +86,8 @@ else to_chat(user, SPAN_WARNING("It's too solid to dismantle. Try cutting through some of the bigger bits.")) return 1 - else if(istype(W) && W.expend_attack_force(user) > 20) - visible_message(SPAN_DANGER("\The [src] has been smashed with \the [W] by \the [user]!")) + else if(istype(used_item) && used_item.expend_attack_force(user) > 20) + visible_message(SPAN_DANGER("\The [src] has been smashed with \the [used_item] by \the [user]!")) if(prob(20)) physically_destroyed() return 1 diff --git a/code/modules/merchant/merchant_machinery.dm b/code/modules/merchant/merchant_machinery.dm index 7cb3b15a7354..5a61211ae088 100644 --- a/code/modules/merchant/merchant_machinery.dm +++ b/code/modules/merchant/merchant_machinery.dm @@ -12,7 +12,7 @@ /obj/machinery/merchant_pad/proc/get_target() var/turf/T = get_turf(src) for(var/a in T) - if(a == src || (!istype(a,/obj) && !isliving(a)) || istype(a,/obj/effect)) + if(!is_valid_target(a)) continue return a @@ -20,6 +20,13 @@ . = list() var/turf/T = get_turf(src) for(var/a in T) - if(a == src || (!istype(a,/obj) && !isliving(a)) || istype(a,/obj/effect)) + if(!is_valid_target(a)) continue - . += a \ No newline at end of file + . += a + +/obj/machinery/merchant_pad/proc/is_valid_target(atom/movable/thing) + if(!istype(thing)) + return FALSE + if(thing == src) + return FALSE + return thing.is_valid_merchant_pad_target() \ No newline at end of file diff --git a/code/modules/merchant/merchant_programs.dm b/code/modules/merchant/merchant_programs.dm index bd3c35a5a1e1..9eaf55156e0a 100644 --- a/code/modules/merchant/merchant_programs.dm +++ b/code/modules/merchant/merchant_programs.dm @@ -39,7 +39,7 @@ /datum/computer_file/program/merchant/proc/get_available_hubs() . = list() - var/turf/T = get_turf(holder) + var/turf/T = get_turf(holder.resolve()) for(var/datum/trade_hub/hub in SStrade.trade_hubs) if(hub.is_accessible_from(T)) . |= hub diff --git a/code/modules/mining/abandonedcrates.dm b/code/modules/mining/abandonedcrates.dm index 15c5846a8a46..06ff4ce3e1b9 100644 --- a/code/modules/mining/abandonedcrates.dm +++ b/code/modules/mining/abandonedcrates.dm @@ -172,8 +172,8 @@ if(guesschar != code[i]) . = 0 -/obj/structure/closet/crate/secure/loot/attackby(obj/item/W, mob/user) - if(!locked || !IS_MULTITOOL(W)) +/obj/structure/closet/crate/secure/loot/attackby(obj/item/used_item, mob/user) + if(!locked || !IS_MULTITOOL(used_item)) return ..() // Greetings Urist McProfessor, how about a nice game of cows and bulls? to_chat(user, "DECA-CODE LOCK ANALYSIS:") diff --git a/code/modules/mining/drilling/drill.dm b/code/modules/mining/drilling/drill.dm index cd4354ee4d0d..5203f417e0e1 100644 --- a/code/modules/mining/drilling/drill.dm +++ b/code/modules/mining/drilling/drill.dm @@ -12,7 +12,6 @@ idle_power_usage = 500 construct_state = /decl/machine_construction/default/panel_closed uncreated_component_parts = null - stat_immune = 0 base_type = /obj/machinery/mining_drill z_flags = ZMM_WIDE_LOAD @@ -172,7 +171,7 @@ turfs_to_mine -= T if(has_extension(T, /datum/extension/buried_resources)) remove_extension(T, /datum/extension/buried_resources) - + // TODO: suppress the message if no screen is installed? /obj/machinery/mining_drill/proc/choose_turf_to_mine() current_turf = turfs_to_mine[1] diff --git a/code/modules/mining/machinery/material_compressor.dm b/code/modules/mining/machinery/material_compressor.dm index a899178e234c..5814e0edc7a9 100644 --- a/code/modules/mining/machinery/material_compressor.dm +++ b/code/modules/mining/machinery/material_compressor.dm @@ -16,8 +16,8 @@ for(var/obj/item/O in input_turf) if(!O.simulated || O.anchored) continue - for(var/mat in O.reagents?.reagent_volumes) - stored[mat] = stored[mat] + floor((O.reagents.reagent_volumes[mat] / REAGENT_UNITS_PER_MATERIAL_UNIT) * 0.75) // liquid reagents, lossy + for(var/decl/material/reagent as anything in O.reagents?.reagent_volumes) + stored[reagent.type] = stored[reagent.type] + floor((O.reagents.reagent_volumes[reagent] / REAGENT_UNITS_PER_MATERIAL_UNIT) * 0.75) // liquid reagents, lossy for(var/mat in O.matter) stored[mat] = stored[mat] + O.matter[mat] qdel(O) diff --git a/code/modules/mining/machinery/material_extractor.dm b/code/modules/mining/machinery/material_extractor.dm index 863f9fc59b21..809c4af4ac04 100644 --- a/code/modules/mining/machinery/material_extractor.dm +++ b/code/modules/mining/machinery/material_extractor.dm @@ -97,8 +97,8 @@ return var/adjusted_reagents = FALSE - for(var/mtype in reagents.reagent_volumes) - adjusted_reagents = max(adjusted_reagents, process_non_liquid(mtype)) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + adjusted_reagents = max(adjusted_reagents, process_non_liquid(reagent)) if(adjusted_reagents) if(gas_contents) @@ -108,7 +108,7 @@ /obj/machinery/material_processing/extractor/proc/process_non_liquid(var/mtype) var/adjusted_reagents = FALSE var/flashed_warning = FALSE - var/decl/material/mat = GET_DECL(mtype) + var/decl/material/mat = RESOLVE_TO_DECL(mtype) // TODO: Change this to ambient/tank pressure when phase changes are properly implemented. switch(mat.phase_at_temperature(temperature, ONE_ATMOSPHERE)) if(MAT_PHASE_GAS) @@ -149,8 +149,8 @@ return adjusted_reagents -/obj/machinery/material_processing/extractor/attackby(obj/item/I, mob/user) - if(IS_WRENCH(I) && !panel_open) +/obj/machinery/material_processing/extractor/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item) && !panel_open) var/datum/extension/atmospherics_connection/connection = get_extension(src, /datum/extension/atmospherics_connection) if(connection.disconnect()) to_chat(user, SPAN_NOTICE("You disconnect \the [src] from the port.")) @@ -165,13 +165,13 @@ to_chat(user, SPAN_WARNING("\The [src] failed to connect to the port.")) return TRUE - if(istype(I, /obj/item/chems/glass)) + if(istype(used_item, /obj/item/chems/glass)) if(isnull(output_container)) - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - output_container = I + output_container = used_item events_repository.register(/decl/observ/destroyed, output_container, src, TYPE_PROC_REF(/obj/machinery/material_processing/extractor, remove_container)) - user.visible_message(SPAN_NOTICE("\The [user] places \a [I] in \the [src]."), SPAN_NOTICE("You place \a [I] in \the [src].")) + user.visible_message(SPAN_NOTICE("\The [user] places \a [used_item] in \the [src]."), SPAN_NOTICE("You place \a [used_item] in \the [src].")) return TRUE to_chat(user, SPAN_WARNING("\The [src] already has an output container!")) @@ -239,14 +239,11 @@ data["reagents"] = list() var/index = 0 - for(var/mtype in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) index += 1 - var/decl/material/mat = GET_DECL(mtype) - // TODO: Must be revised once state changes are in. Reagent names might be a litle odd in the meantime. - var/is_liquid = mat.phase_at_temperature(temperature, ONE_ATMOSPHERE) == MAT_PHASE_LIQUID - - data["reagents"] += list(list("label" = "[mat.liquid_name] ([reagents.reagent_volumes[mtype]] U)", "index" = index, "liquid" = is_liquid)) + var/is_liquid = reagent.phase_at_temperature(temperature, ONE_ATMOSPHERE) == MAT_PHASE_LIQUID + data["reagents"] += list(list("label" = "[reagent.liquid_name] ([reagents.reagent_volumes[reagent]] U)", "index" = index, "liquid" = is_liquid)) data["full"] = reagents.total_volume >= max_liquid data["gas_pressure"] = gas_contents?.return_pressure() diff --git a/code/modules/mining/machinery/material_smelter.dm b/code/modules/mining/machinery/material_smelter.dm index 3d54d262330b..43cd4b1cf63a 100644 --- a/code/modules/mining/machinery/material_smelter.dm +++ b/code/modules/mining/machinery/material_smelter.dm @@ -30,8 +30,8 @@ if(!(. = ..()) || !reagents) return - for(var/mtype in reagents.reagent_volumes) - show_materials |= mtype + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + show_materials |= reagent.type /obj/machinery/material_processing/smeltery/ProcessAtomTemperature() if(use_power) diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index 5836b2ed9796..bd70d153e5e8 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -58,7 +58,7 @@ . = ..() update_icon() -/obj/item/stack/flag/attackby(var/obj/item/W, var/mob/user) +/obj/item/stack/flag/attackby(var/obj/item/used_item, var/mob/user) if(upright) return attack_hand_with_interaction_checks(user) return ..() diff --git a/code/modules/mining/ore_box.dm b/code/modules/mining/ore_box.dm index 84acc94e834e..ab20aa117d11 100644 --- a/code/modules/mining/ore_box.dm +++ b/code/modules/mining/ore_box.dm @@ -26,21 +26,21 @@ to_chat(user, SPAN_NOTICE("You grab a random ore pile from \the [src].")) return TRUE -/obj/structure/ore_box/attackby(obj/item/W, mob/user) - if (istype(W, /obj/item/stack/material/ore)) - return insert_ore(W, user) - if(W.storage) +/obj/structure/ore_box/attackby(obj/item/used_item, mob/user) + if (istype(used_item, /obj/item/stack/material/ore)) + return insert_ore(used_item, user) + if(used_item.storage) var/added_ore = FALSE - W.storage.hide_from(user) - for(var/obj/item/stack/material/ore/O in W.storage.get_contents()) + used_item.storage.hide_from(user) + for(var/obj/item/stack/material/ore/O in used_item.storage.get_contents()) if(total_ores >= maximum_ores) break - W.storage.remove_from_storage(user, O, src, TRUE) + used_item.storage.remove_from_storage(user, O, src, TRUE) insert_ore(O) added_ore = TRUE if(added_ore) - W.storage.finish_bulk_removal() - to_chat(user, SPAN_NOTICE("You empty \the [W] into \the [src].")) + used_item.storage.finish_bulk_removal() + to_chat(user, SPAN_NOTICE("You empty \the [used_item] into \the [src].")) return TRUE return ..() diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm index 0ae0efae9437..65c207b4ec7c 100644 --- a/code/modules/mob/death.dm +++ b/code/modules/mob/death.dm @@ -92,7 +92,7 @@ reset_plane_and_layer() update_posture() if(!gibbed) - clear_status_effects() + clear_status_conditions() set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS) set_see_in_dark(8) diff --git a/code/modules/mob/examine.dm b/code/modules/mob/examine.dm index c9e19f366257..6eb5ade8cbcf 100644 --- a/code/modules/mob/examine.dm +++ b/code/modules/mob/examine.dm @@ -4,18 +4,17 @@ return GET_DECL(/decl/pronouns) return get_pronouns() +/mob/proc/get_visible_pronouns_for_viewer(mob/viewer, hideflags) + if(viewer == src) + return GET_DECL(/decl/pronouns/self) + return get_visible_pronouns(hideflags) + /mob/proc/get_equipment_visibility() . = 0 for(var/obj/item/thing in get_equipped_items(include_carried = FALSE)) . |= thing.flags_inv return . & EQUIPMENT_VISIBILITY_FLAGS -/mob/proc/get_examined_short_description(mob/user, distance, infix, suffix, hideflags, decl/pronouns/pronouns) - . = list() - . += "[html_icon(src)] That's \a [src][infix]. [suffix]" - if(desc) - . += desc - /mob/proc/get_examined_worn_held_items(mob/user, distance, infix, suffix, hideflags, decl/pronouns/pronouns) . = list() var/slot_datums = get_inventory_slots() @@ -34,7 +33,11 @@ . += SPAN_WARNING("[pronouns.He] [pronouns.is] [html_icon(buckled)] buckled to [buckled]!") /mob/proc/get_other_examine_strings(mob/user, distance, infix, suffix, hideflags, decl/pronouns/pronouns) - return + return list() + +// We add a default parameter here for hidden inventory flags. +/mob/get_examine_header(mob/user, distance, infix, suffix, hideflags) + return ..(user, distance, infix, suffix) /mob/get_examine_strings(mob/user, distance, infix, suffix) @@ -48,9 +51,10 @@ hideflags |= HIDEEARS // Show our equipment, held items, desc, etc. - var/decl/pronouns/pronouns = get_visible_pronouns(hideflags) - // to_chat(user, "
    ") // these don't work in BYOND's native output panel. If we switch to browser output instead, you can readd this - . += get_examined_short_description(user, distance, infix, suffix, hideflags, pronouns) - . += get_examined_worn_held_items(user, distance, infix, suffix, hideflags, pronouns) - . += get_other_examine_strings(user, distance, infix, suffix, hideflags, pronouns) - // to_chat(user, "
    ") // see above + var/decl/pronouns/pronouns = get_visible_pronouns_for_viewer(user, hideflags) // handles second-person if src == user + var/list/examine_items = get_examined_worn_held_items(user, distance, infix, suffix, hideflags, pronouns) + if(length(examine_items)) + . += examine_items + var/list/other_items = get_other_examine_strings(user, distance, infix, suffix, hideflags, pronouns) + if(length(other_items)) + . += other_items diff --git a/code/modules/mob/grab/grab_object.dm b/code/modules/mob/grab/grab_object.dm index 5c5e427cea5a..f4861ede315f 100644 --- a/code/modules/mob/grab/grab_object.dm +++ b/code/modules/mob/grab/grab_object.dm @@ -178,7 +178,7 @@ current_grab.let_go(src) /obj/item/grab/proc/on_affecting_move() - if(!affecting || !isturf(affecting.loc) || get_dist(affecting, assailant) > 1) + if(!affecting || !isturf(affecting.loc) || (get_dist_3d(affecting, assailant) > 1 && affecting.moving_diagonally != /atom/movable::FIRST_DIAGONAL_STEP)) force_drop() /obj/item/grab/proc/force_drop() @@ -204,7 +204,7 @@ /obj/item/grab/proc/action_used() if(ishuman(assailant)) var/mob/living/human/H = assailant - H.remove_cloaking_source(H.species) + H.remove_mob_modifier(/decl/mob_modifier/cloaked, source = H.species) last_action = world.time leave_forensic_traces() @@ -279,9 +279,9 @@ /obj/item/grab/proc/stop_move() return current_grab.stop_move -/obj/item/grab/attackby(obj/W, mob/user) +/obj/item/grab/attackby(obj/item/used_item, mob/user) if(user == assailant) - return current_grab.item_attack(src, W) + return current_grab.item_attack(src, used_item) return FALSE /obj/item/grab/proc/assailant_reverse_facing() diff --git a/code/modules/mob/grab/normal/grab_normal.dm b/code/modules/mob/grab/normal/grab_normal.dm index df950514b867..dc9af610c6c9 100644 --- a/code/modules/mob/grab/normal/grab_normal.dm +++ b/code/modules/mob/grab/normal/grab_normal.dm @@ -221,16 +221,16 @@ else return attack_tendons(grab, I, user, grab.target_zone) -/decl/grab/normal/proc/attack_throat(var/obj/item/grab/grab, var/obj/item/W, mob/user) +/decl/grab/normal/proc/attack_throat(var/obj/item/grab/grab, var/obj/item/used_item, mob/user) var/mob/living/affecting = grab.get_affecting_mob() if(!affecting) return if(!user.check_intent(I_FLAG_HARM)) return 0 // Not trying to hurt them. - if(!W.has_edge() || !W.get_attack_force(user) || W.atom_damage_type != BRUTE) + if(!used_item.has_edge() || !used_item.get_attack_force(user) || used_item.atom_damage_type != BRUTE) return 0 //unsuitable weapon - user.visible_message("\The [user] begins to slit [affecting]'s throat with \the [W]!") + user.visible_message("\The [user] begins to slit [affecting]'s throat with \the [used_item]!") user.next_move = world.time + 20 //also should prevent user from triggering this repeatedly if(!do_after(user, 20*user.skill_delay_mult(SKILL_COMBAT) , progress = 0)) @@ -239,33 +239,33 @@ return 0 var/damage_mod = 1 - var/damage_flags = W.damage_flags() + var/damage_flags = used_item.damage_flags() //presumably, if they are wearing a helmet that stops pressure effects, then it probably covers the throat as well - var/force = W.expend_attack_force(user) + var/force = used_item.expend_attack_force(user) var/obj/item/clothing/head/helmet = affecting.get_equipped_item(slot_head_str) if(istype(helmet) && (helmet.body_parts_covered & SLOT_HEAD) && (helmet.item_flags & ITEM_FLAG_AIRTIGHT) && !isnull(helmet.max_pressure_protection)) var/datum/extension/armor/armor_datum = get_extension(helmet, /datum/extension/armor) if(armor_datum) - damage_mod -= armor_datum.get_blocked(BRUTE, damage_flags, W.armor_penetration, force*1.5) + damage_mod -= armor_datum.get_blocked(BRUTE, damage_flags, used_item.armor_penetration, force*1.5) var/total_damage = 0 for(var/i in 1 to 3) var/damage = min(force*1.5, 20)*damage_mod - affecting.apply_damage(damage, W.atom_damage_type, BP_HEAD, damage_flags, armor_pen = 100, used_weapon=W) + affecting.apply_damage(damage, used_item.atom_damage_type, BP_HEAD, damage_flags, armor_pen = 100, used_weapon=used_item) total_damage += damage if(total_damage) - user.visible_message("\The [user] slit [affecting]'s throat open with \the [W]!") + user.visible_message("\The [user] slit [affecting]'s throat open with \the [used_item]!") - if(W.hitsound) - playsound(affecting.loc, W.hitsound, 50, 1, -1) + if(used_item.hitsound) + playsound(affecting.loc, used_item.hitsound, 50, 1, -1) grab.last_action = world.time admin_attack_log(user, affecting, "Knifed their victim", "Was knifed", "knifed") return 1 -/decl/grab/normal/proc/attack_tendons(var/obj/item/grab/grab, var/obj/item/W, mob/user, var/target_zone) +/decl/grab/normal/proc/attack_tendons(var/obj/item/grab/grab, var/obj/item/used_item, mob/user, var/target_zone) var/mob/living/affecting = grab.get_affecting_mob() if(!affecting) return @@ -273,12 +273,12 @@ return if(!user.check_intent(I_FLAG_HARM)) return 0 // Not trying to hurt them. - if(!W.has_edge() || !W.expend_attack_force(user) || W.atom_damage_type != BRUTE) + if(!used_item.has_edge() || !used_item.expend_attack_force(user) || used_item.atom_damage_type != BRUTE) return 0 //unsuitable weapon var/obj/item/organ/external/O = grab.get_targeted_organ() if(!O || !(O.limb_flags & ORGAN_FLAG_HAS_TENDON) || (O.status & ORGAN_TENDON_CUT)) return FALSE - user.visible_message(SPAN_DANGER("\The [user] begins to cut \the [affecting]'s [O.tendon_name] with \the [W]!")) + user.visible_message(SPAN_DANGER("\The [user] begins to cut \the [affecting]'s [O.tendon_name] with \the [used_item]!")) user.next_move = world.time + 20 if(!do_after(user, 20, progress=0)) return 0 @@ -286,8 +286,8 @@ return 0 if(!O || !O.sever_tendon()) return 0 - user.visible_message(SPAN_DANGER("\The [user] cut \the [affecting]'s [O.tendon_name] with \the [W]!")) - if(W.hitsound) playsound(affecting.loc, W.hitsound, 50, 1, -1) + user.visible_message(SPAN_DANGER("\The [user] cut \the [affecting]'s [O.tendon_name] with \the [used_item]!")) + if(used_item.hitsound) playsound(affecting.loc, used_item.hitsound, 50, 1, -1) grab.last_action = world.time admin_attack_log(user, affecting, "hamstrung their victim", "was hamstrung", "hamstrung") return 1 diff --git a/code/modules/mob/grab/normal/norm_kill.dm b/code/modules/mob/grab/normal/norm_kill.dm index 28762d0cbc8a..e716be668640 100644 --- a/code/modules/mob/grab/normal/norm_kill.dm +++ b/code/modules/mob/grab/normal/norm_kill.dm @@ -27,4 +27,4 @@ SET_STATUS_MAX(affecting, STAT_WEAK, 5) //Should keep you down unless you get help. if(isliving(affecting)) var/mob/living/M = affecting - M.ticks_since_last_successful_breath = max(M.ticks_since_last_successful_breath + 2, 3) + M.suffocation_counter = max(M.suffocation_counter + 2, 3) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index a1f9db81bd94..b306780544b9 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -11,18 +11,18 @@ equip_to_slot_if_possible(holding, slot) //This is a SAFE proc. Use this instead of equip_to_slot()! -//set del_on_fail to have it delete W if it fails to equip +//set del_on_fail to have it delete prop if it fails to equip //set disable_warning to disable the 'you are unable to equip that' warning. //unset redraw_mob to prevent the mob from being redrawn at the end. //set force to replace items in the slot and ignore blocking overwear -/mob/proc/equip_to_slot_if_possible(obj/item/W, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1, force = FALSE, delete_old_item = TRUE, ignore_equipped = FALSE) - if(!istype(W) || !slot) +/mob/proc/equip_to_slot_if_possible(obj/item/prop, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1, force = FALSE, delete_old_item = TRUE, ignore_equipped = FALSE) + if(!istype(prop) || !slot) return FALSE - . = (canUnEquip(W) && can_equip_anything_to_slot(slot) && has_organ_for_slot(slot) && W.mob_can_equip(src, slot, disable_warning, force, ignore_equipped = ignore_equipped)) + . = (can_unequip_item(prop) && can_equip_anything_to_slot(slot) && has_organ_for_slot(slot) && prop.mob_can_equip(src, slot, disable_warning, force, ignore_equipped = ignore_equipped)) if(.) - equip_to_slot(W, slot, redraw_mob, delete_old_item = delete_old_item) //This proc should not ever fail. + equip_to_slot(prop, slot, redraw_mob, delete_old_item = delete_old_item) //This proc should not ever fail. else if(del_on_fail) - qdel(W) + qdel(prop) else if(!disable_warning) to_chat(src, SPAN_WARNING("You are unable to equip that.")) @@ -47,19 +47,19 @@ //This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't eqip need to be done before! Use mob_can_equip() for that task. //In most cases you will want to use equip_to_slot_if_possible() -/mob/proc/equip_to_slot(obj/item/W, slot, redraw_mob = TRUE, delete_old_item = TRUE) +/mob/proc/equip_to_slot(obj/item/prop, slot, redraw_mob = TRUE, delete_old_item = TRUE) SHOULD_CALL_PARENT(TRUE) - if(!istype(W) || isnull(slot)) + if(!istype(prop) || isnull(slot)) return FALSE // Handle some special slots. if(slot == slot_in_backpack_str) - remove_from_mob(W) + remove_from_mob(prop) var/obj/item/back = get_equipped_item(slot_back_str) if(back) - W.forceMove(back) + prop.forceMove(back) else - W.dropInto(loc) + prop.dropInto(loc) return TRUE // Attempt to equip accessories if the slot is already blocked. @@ -75,51 +75,51 @@ check_slots -= slot check_slots.Insert(1, slot) - var/try_equip_slot = W.get_fallback_slot() + var/try_equip_slot = prop.get_fallback_slot() if(try_equip_slot && slot != try_equip_slot) check_slots -= try_equip_slot check_slots.Insert(1, try_equip_slot) for(var/slot_string in check_slots) var/obj/item/clothing/clothes = get_equipped_item(slot_string) - if(istype(clothes) && clothes.can_attach_accessory(W, src)) - clothes.attach_accessory(src, W) + if(istype(clothes) && clothes.can_attach_accessory(prop, src)) + clothes.attach_accessory(src, prop) attached = TRUE break if(attached) return TRUE - unequip(W) + unequip(prop) var/datum/inventory_slot/inv_slot = get_inventory_slot_datum(slot) if(inv_slot) - inv_slot.equipped(src, W, redraw_mob, delete_old_item) - if(W.action_button_name) + inv_slot.equipped(src, prop, redraw_mob, delete_old_item) + if(prop.action_button_name) update_action_buttons() return TRUE to_chat(src, SPAN_WARNING("You are trying to equip this item to an unsupported inventory slot. If possible, please write a ticket with steps to reproduce. Slot was: [slot]")) return FALSE //This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such. -/mob/proc/equip_to_slot_or_del(obj/item/W, slot) - return equip_to_slot_if_possible(W, slot, 1, 1, 0) +/mob/proc/equip_to_slot_or_del(obj/item/prop, slot) + return equip_to_slot_if_possible(prop, slot, 1, 1, 0) -/mob/proc/equip_to_slot_or_store_or_drop(obj/item/W, slot) - var/store = equip_to_slot_if_possible(W, slot, 0, 1, 0) +/mob/proc/equip_to_slot_or_store_or_drop(obj/item/prop, slot) + var/store = equip_to_slot_if_possible(prop, slot, 0, 1, 0) if(!store) - return equip_to_storage_or_drop(W) + return equip_to_storage_or_drop(prop) return store -//puts the item "W" into an appropriate slot in a human's inventory +//puts the item "prop" into an appropriate slot in a human's inventory //returns 0 if it cannot, 1 if successful -/mob/proc/equip_to_appropriate_slot(obj/item/W, var/skip_store = 0) - if(!istype(W)) +/mob/proc/equip_to_appropriate_slot(obj/item/prop, var/skip_store = 0) + if(!istype(prop)) return FALSE for(var/slot in get_inventory_slot_priorities()) if(skip_store) if(slot == slot_s_store_str || slot == slot_l_store_str || slot == slot_r_store_str) continue - if(equip_to_slot_if_possible(W, slot, del_on_fail=0, disable_warning=1, redraw_mob=1)) + if(equip_to_slot_if_possible(prop, slot, del_on_fail=0, disable_warning=1, redraw_mob=1)) return TRUE return FALSE @@ -176,39 +176,39 @@ /mob/proc/get_empty_hand_slots() return -/mob/proc/put_in_active_hand(var/obj/item/W) - . = equip_to_slot_if_possible(W, get_active_held_item_slot(), disable_warning = TRUE) +/mob/proc/put_in_active_hand(var/obj/item/prop) + . = equip_to_slot_if_possible(prop, get_active_held_item_slot(), disable_warning = TRUE) //Puts the item into (one of) our inactive hand(s) if possible. returns 1 on success. -/mob/proc/put_in_inactive_hand(var/obj/item/W) +/mob/proc/put_in_inactive_hand(var/obj/item/prop) var/active_slot = get_active_held_item_slot() for(var/slot in get_empty_hand_slots()) if(slot == active_slot) continue - . = equip_to_slot_if_possible(W, slot, disable_warning = TRUE) + . = equip_to_slot_if_possible(prop, slot, disable_warning = TRUE) if(.) break //Puts the item our active hand if possible. Failing that it tries our inactive hand. Returns 1 on success. //If both fail it drops it on the floor and returns 0. //This is probably the main one you need to know :) -/mob/proc/put_in_hands_or_del(var/obj/item/W) - . = put_in_hands(W) - if(!. && !QDELETED(W)) - qdel(W) +/mob/proc/put_in_hands_or_del(var/obj/item/prop) + . = put_in_hands(prop) + if(!. && !QDELETED(prop)) + qdel(prop) -/mob/proc/put_in_hands(var/obj/item/W) - if(!W) +/mob/proc/put_in_hands(var/obj/item/prop) + if(!prop) return FALSE - if(put_in_active_hand(W) || put_in_inactive_hand(W)) + if(put_in_active_hand(prop) || put_in_inactive_hand(prop)) return TRUE - drop_from_inventory(W) + drop_from_inventory(prop) return FALSE -/mob/proc/put_in_hands_or_store_or_drop(var/obj/item/W) - . = put_in_hands(W) +/mob/proc/put_in_hands_or_store_or_drop(var/obj/item/prop) + . = put_in_hands(prop) if(!.) - . = equip_to_storage_or_drop(W) + . = equip_to_storage_or_drop(prop) // Removes an item from inventory and places it in the target atom. // If canremove or other conditions need to be checked then use unEquip instead. @@ -249,13 +249,13 @@ As far as I can tell the proc exists so that mobs with different inventory slots can override the search through all the slots, without having to duplicate the rest of the item dropping. */ -/mob/proc/unequip(obj/W) +/mob/proc/unequip(obj/prop) SHOULD_CALL_PARENT(TRUE) - if(!istype(W)) + if(!istype(prop)) return FALSE - var/datum/inventory_slot/inv_slot = get_inventory_slot_datum(get_equipped_slot_for_item(W)) + var/datum/inventory_slot/inv_slot = get_inventory_slot_datum(get_equipped_slot_for_item(prop)) if(inv_slot) - return inv_slot.unequipped(src, W) + return inv_slot.unequipped(src, prop) return FALSE /mob/proc/isEquipped(obj/item/I) @@ -263,12 +263,14 @@ return FALSE return !!get_equipped_slot_for_item(I) -/mob/proc/canUnEquip(obj/item/I) +/mob/proc/can_unequip_item(obj/item/I) if(!I) //If there's nothing to drop, the drop is automatically successful. return TRUE + if(I in get_organs()) + return FALSE var/slot = get_equipped_slot_for_item(I) if(!slot && !istype(I.loc, /obj/item/rig_module)) - return 1 //already unequipped, so success + return TRUE //already unequipped, so success return I.mob_can_unequip(src, slot) /// Gets the inventory slot string ID for the mob whose contents we're in, if any. @@ -343,7 +345,7 @@ //This differs from remove_from_mob() in that it checks if the item can be unequipped first. Use drop_from_inventory if you don't want to check. /mob/proc/try_unequip(obj/item/I, var/atom/target, var/play_dropsound = TRUE) - if(!canUnEquip(I)) + if(!can_unequip_item(I)) return FALSE drop_from_inventory(I, target, play_dropsound) return TRUE @@ -369,9 +371,9 @@ object.compile_overlays() // avoid world overlays on inventory state and vice versa return TRUE -/mob/proc/drop_held_items() +/mob/proc/drop_held_items(drop_loc = loc) for(var/thing in get_held_items()) - try_unequip(thing) + try_unequip(thing, drop_loc) //Returns the item equipped to the specified slot, if any. /mob/proc/get_equipped_item(var/slot) diff --git a/code/modules/mob/language/generic.dm b/code/modules/mob/language/generic.dm index 78301a7ca87a..1665c0b215c2 100644 --- a/code/modules/mob/language/generic.dm +++ b/code/modules/mob/language/generic.dm @@ -21,7 +21,8 @@ /decl/language/sign name = "Sign Language" - desc = "A sign language commonly used for those who are deaf or mute." + desc = "In an age of commonplace extra-vehicular activity and habitation of airless worlds, \ + sign language is often an essential communication tool for large portions of the population." signlang_verb = list("gestures") colour = "say_quote" key = "s" diff --git a/code/modules/mob/language/language.dm b/code/modules/mob/language/language.dm index 02b5199b390c..03b2c4330527 100644 --- a/code/modules/mob/language/language.dm +++ b/code/modules/mob/language/language.dm @@ -75,9 +75,9 @@ return capitalize(pick(global.using_map.first_names_male)) + " " + capitalize(pick(global.using_map.last_names)) var/possible_syllables = allow_repeated_syllables ? syllables : syllables.Copy() - for(var/i = 0;i0;x--) + for(var/x in rand(floor(syllable_count/syllable_divisor), syllable_count) to 1 step -1) if(!length(possible_syllables)) break new_name += allow_repeated_syllables ? pick(possible_syllables) : pick_n_take(possible_syllables) diff --git a/code/modules/mob/language/synthetic.dm b/code/modules/mob/language/synthetic.dm index 6f8a751bcac5..ffcc87c400cd 100644 --- a/code/modules/mob/language/synthetic.dm +++ b/code/modules/mob/language/synthetic.dm @@ -71,9 +71,9 @@ //robot binary xmitter component power usage if (isrobot(speaker)) - var/mob/living/silicon/robot/R = speaker - var/datum/robot_component/C = R.components["comms"] - R.cell_use_power(C.active_usage) + var/mob/living/silicon/robot/robot = speaker + var/datum/robot_component/C = robot.components["comms"] + robot.cell_use_power(C.active_usage) /decl/language/binary/drone name = "Drone Talk" diff --git a/code/modules/mob/living/bot/bot.dm b/code/modules/mob/living/bot/bot.dm index b553c2c59af0..fca88bfd2e25 100644 --- a/code/modules/mob/living/bot/bot.dm +++ b/code/modules/mob/living/bot/bot.dm @@ -57,9 +57,9 @@ /mob/living/bot/handle_regular_status_updates() . = ..() if(.) - set_status(STAT_WEAK, 0) - set_status(STAT_STUN, 0) - set_status(STAT_PARA, 0) + set_status_condition(STAT_WEAK, 0) + set_status_condition(STAT_STUN, 0) + set_status_condition(STAT_PARA, 0) /mob/living/bot/get_life_damage_types() var/static/list/life_damage_types = list( @@ -91,8 +91,8 @@ /mob/living/bot/try_awaken(mob/user) return FALSE -/mob/living/bot/attackby(var/obj/item/O, var/mob/user) - if(O.GetIdCard()) +/mob/living/bot/attackby(var/obj/item/used_item, var/mob/user) + if(used_item.GetIdCard()) if(access_scanner.allowed(user) && !open) locked = !locked to_chat(user, "Controls are now [locked ? "locked." : "unlocked."]") @@ -102,7 +102,7 @@ else to_chat(user, "Access denied.") return TRUE - else if(IS_SCREWDRIVER(O)) + else if(IS_SCREWDRIVER(used_item)) if(!locked) open = !open to_chat(user, "Maintenance panel is now [open ? "opened" : "closed"].") @@ -110,7 +110,7 @@ else to_chat(user, "You need to unlock the controls first.") return TRUE - else if(IS_WELDER(O)) + else if(IS_WELDER(used_item)) if(current_health < get_max_health()) if(open) heal_overall_damage(10) diff --git a/code/modules/mob/living/bot/cleanbot.dm b/code/modules/mob/living/bot/cleanbot.dm index 95fac4ce948e..22c803e19495 100644 --- a/code/modules/mob/living/bot/cleanbot.dm +++ b/code/modules/mob/living/bot/cleanbot.dm @@ -56,12 +56,7 @@ if(get_turf(target) == src.loc) UnarmedAttack(target, TRUE) -/mob/living/bot/cleanbot/UnarmedAttack(var/obj/effect/decal/cleanable/decal, var/proximity) - - . = ..() - if(.) - return - +/mob/living/bot/cleanbot/ResolveUnarmedAttack(var/obj/effect/decal/cleanable/decal) if(!istype(decal)) return TRUE diff --git a/code/modules/mob/living/bot/farmbot.dm b/code/modules/mob/living/bot/farmbot.dm index b706ce3450d5..79229f89faf0 100644 --- a/code/modules/mob/living/bot/farmbot.dm +++ b/code/modules/mob/living/bot/farmbot.dm @@ -123,11 +123,7 @@ target = source return -/mob/living/bot/farmbot/UnarmedAttack(var/atom/A, var/proximity) - . = ..() - if(.) - return - +/mob/living/bot/farmbot/ResolveUnarmedAttack(var/atom/A, var/proximity) if(busy) return TRUE diff --git a/code/modules/mob/living/bot/floorbot.dm b/code/modules/mob/living/bot/floorbot.dm index 5f924e281515..00ae50e7a086 100644 --- a/code/modules/mob/living/bot/floorbot.dm +++ b/code/modules/mob/living/bot/floorbot.dm @@ -128,12 +128,7 @@ return emagged || (amount && (my_turf.is_floor_damaged() || (improvefloors && !my_turf.has_flooring()))) -/mob/living/bot/floorbot/UnarmedAttack(var/atom/A, var/proximity) - - . = ..() - if(.) - return - +/mob/living/bot/floorbot/ResolveUnarmedAttack(var/atom/A) if(busy) return TRUE diff --git a/code/modules/mob/living/bot/medibot.dm b/code/modules/mob/living/bot/medibot.dm index 037c13b9ffa2..9d1b66b783d5 100644 --- a/code/modules/mob/living/bot/medibot.dm +++ b/code/modules/mob/living/bot/medibot.dm @@ -95,11 +95,7 @@ last_newpatient_speak = world.time break -/mob/living/bot/medbot/UnarmedAttack(var/mob/living/human/target, var/proximity) - . = ..() - if(.) - return - +/mob/living/bot/medbot/ResolveUnarmedAttack(var/mob/living/human/target) if(!on || !istype(target)) return FALSE @@ -155,8 +151,8 @@ else icon_state = "medibot[on]" -/mob/living/bot/medbot/attackby(var/obj/item/O, var/mob/user) - if(istype(O, /obj/item/chems/glass)) +/mob/living/bot/medbot/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/chems/glass)) if(locked) to_chat(user, "You cannot insert a beaker because the panel is locked.") return TRUE @@ -164,10 +160,10 @@ to_chat(user, "There is already a beaker loaded.") return TRUE - if(!user.try_unequip(O, src)) + if(!user.try_unequip(used_item, src)) return TRUE - reagent_glass = O - to_chat(user, "You insert [O].") + reagent_glass = used_item + to_chat(user, "You insert [used_item].") return TRUE else return ..() @@ -310,8 +306,8 @@ // If they're injured, we're using a beaker, and they don't have on of the chems in the beaker if(reagent_glass && use_beaker && ((patient.get_damage(BRUTE) >= heal_threshold) || (patient.get_damage(TOX) >= heal_threshold) || (patient.get_damage(TOX) >= heal_threshold) || (patient.get_damage(OXY) >= (heal_threshold + 15)))) - for(var/R in reagent_glass.reagents.reagent_volumes) - if(!patient.reagents.has_reagent(R)) + for(var/decl/material/reagent as anything in reagent_glass.reagents.reagent_volumes) + if(!patient.reagents.has_reagent(reagent)) return 1 continue diff --git a/code/modules/mob/living/bot/mulebot.dm b/code/modules/mob/living/bot/mulebot.dm index 078dee2a3827..7648229f6ff9 100644 --- a/code/modules/mob/living/bot/mulebot.dm +++ b/code/modules/mob/living/bot/mulebot.dm @@ -115,7 +115,7 @@ if("safety") safety = !safety -/mob/living/bot/mulebot/attackby(var/obj/item/O, var/mob/user) +/mob/living/bot/mulebot/attackby(var/obj/item/used_item, var/mob/user) . = ..() update_icon() @@ -193,7 +193,7 @@ return ..() -/mob/living/bot/mulebot/UnarmedAttack(var/turf/T) +/mob/living/bot/mulebot/ResolveUnarmedAttack(var/turf/T) if(T == src.loc) unload(dir) diff --git a/code/modules/mob/living/bot/remotebot.dm b/code/modules/mob/living/bot/remotebot.dm index fa28520aa3e5..ffdf2de4119d 100644 --- a/code/modules/mob/living/bot/remotebot.dm +++ b/code/modules/mob/living/bot/remotebot.dm @@ -34,11 +34,11 @@ if(prob(50)) C.forceMove(get_step(src, pick(global.alldirs))) -/mob/living/bot/remotebot/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/bot_controller) && !controller) - user.visible_message("\The [user] waves \the [I] over \the [src].") - to_chat(user, "You link \the [src] to \the [I].") - var/obj/item/bot_controller/B = I +/mob/living/bot/remotebot/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/bot_controller) && !controller) + user.visible_message("\The [user] waves \the [used_item] over \the [src].") + to_chat(user, "You link \the [src] to \the [used_item].") + var/obj/item/bot_controller/B = used_item B.bot = src controller = B return ..() @@ -53,16 +53,16 @@ holding = null return ..() -/mob/living/bot/remotebot/proc/pickup(var/obj/item/I) - if(holding || get_dist(src,I) > 1) +/mob/living/bot/remotebot/proc/pickup(var/obj/item/used_item) + if(holding || get_dist(src,used_item) > 1) return - src.visible_message("\The [src] picks up \the [I].") + src.visible_message("\The [src] picks up \the [used_item].") flick("fetchbot-c", src) working = 1 sleep(10) working = 0 - I.forceMove(src) - holding = I + used_item.forceMove(src) + holding = used_item /mob/living/bot/remotebot/proc/drop() if(working || !holding) diff --git a/code/modules/mob/living/bot/secbot.dm b/code/modules/mob/living/bot/secbot.dm index faca3a286c20..380a8ab66a45 100644 --- a/code/modules/mob/living/bot/secbot.dm +++ b/code/modules/mob/living/bot/secbot.dm @@ -51,11 +51,11 @@ /mob/living/bot/secbot/turn_on() ..() - stun_baton.set_status(on, null) + stun_baton.set_cell_status(on, null) /mob/living/bot/secbot/turn_off() ..() - stun_baton.set_status(on, null) + stun_baton.set_cell_status(on, null) /mob/living/bot/secbot/on_update_icon() ..() @@ -103,7 +103,7 @@ if(emagged < 2) emagged = !emagged -/mob/living/bot/secbot/attackby(var/obj/item/O, var/mob/user) +/mob/living/bot/secbot/attackby(var/obj/item/used_item, var/mob/user) var/curhealth = current_health . = ..() if(current_health < curhealth) @@ -194,12 +194,7 @@ return BP_CHEST return ..() -/mob/living/bot/secbot/UnarmedAttack(var/mob/M, var/proximity) - - . = ..() - if(.) - return - +/mob/living/bot/secbot/ResolveUnarmedAttack(var/mob/M) if(!istype(M)) return FALSE diff --git a/code/modules/mob/living/human/examine.dm b/code/modules/mob/living/human/examine.dm index 1c3dabe29148..d33940b0c301 100644 --- a/code/modules/mob/living/human/examine.dm +++ b/code/modules/mob/living/human/examine.dm @@ -1,157 +1,166 @@ -/mob/living/human/get_examined_short_description(mob/user, distance, infix, suffix, hideflags, decl/pronouns/pronouns) - var/msg = list("*---------*
    [user == src ? "You are" : "This is"] [name]") +/mob/living/human/get_examine_header(mob/user, distance, infix, suffix, hideflags) + SHOULD_CALL_PARENT(FALSE) + . = list(SPAN_INFO("*---------*")) + var/list/mob_intro = "[user == src ? "You are" : "This is"] [name]" if(!(hideflags & HIDEJUMPSUIT) || !(hideflags & HIDEFACE)) var/species_name = "\improper " if(isSynthetic() && species.cyborg_noun) - species_name += "[species.cyborg_noun] [species.get_root_species_name(src)]" + species_name += "[species.cyborg_noun] [species.name]" else species_name += "[species.name]" - msg += ", \a [species_name]![(user.can_use_codex() && SScodex.get_codex_entry(get_codex_value(user))) ? SPAN_NOTICE(" \[?\]") : ""]" + mob_intro += ", \a [species_name]![(user.can_use_codex() && SScodex.get_codex_entry(get_codex_value(user))) ? SPAN_NOTICE(" \[?\]") : ""]" + . += SPAN_INFO(JOINTEXT(mob_intro)) var/extra_species_text = species.get_additional_examine_text(src) if(extra_species_text) - msg += "
    [extra_species_text]" + . += "[extra_species_text]" var/show_descs = show_descriptors_to(user) if(show_descs) - msg += "
    [jointext(show_descs, "
    ")]
    " + . += SPAN_INFO(jointext(show_descs, "
    ")) var/print_flavour = print_flavor_text() if(print_flavour) - msg += "
    *---------*" - msg += "
    [print_flavour]" - msg += "
    *---------*" - return list(jointext(msg, null)) + . += SPAN_INFO("*---------*") + . += SPAN_INFO("[print_flavour]") + . += SPAN_INFO("*---------*") + . = list(jointext(., "
    ")) + +/decl/human_examination/jitters/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + var/jitteriness = GET_STATUS(source, STAT_JITTER) + switch(jitteriness) + if(300 to INFINITY) + return SPAN_DANGER("[pronouns.He] [pronouns.is] convulsing violently!") + if(200 to 300) + return SPAN_WARNING("[pronouns.He] [pronouns.is] extremely jittery.") + if(100 to 200) + return SPAN_WARNING("[pronouns.He] [pronouns.is] twitching ever so slightly.") + else + pass() -/mob/living/human/get_other_examine_strings(mob/user, distance, infix, suffix, hideflags, decl/pronouns/pronouns) +/decl/human_examination/disfigured + priority = /decl/human_examination/jitters::priority + 1 - . = ..() +/decl/human_examination/disfigured/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + //Disfigured face + if(hideflags & HIDEFACE) //Disfigurement only matters for the head currently. + return + var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(source, BP_HEAD) + if(!limb || !(limb.status & ORGAN_DISFIGURED)) //Check to see if we even have a head and if the head's disfigured. + return + if(limb.species) //Check to make sure we have a species + return limb.species.disfigure_msg(source) + else //Just in case they lack a species for whatever reason. + return SPAN_WARNING("[pronouns.His] face is horribly mangled!") - var/self_examine = (user == src) - var/use_He = self_examine ? "You" : pronouns.He - var/use_he = self_examine ? "you" : pronouns.he - var/use_His = self_examine ? "Your" : pronouns.His - var/use_his = self_examine ? "your" : pronouns.his - var/use_is = self_examine ? "are" : pronouns.is - var/use_does = self_examine ? "do" : pronouns.does - var/use_has = self_examine ? "have" : pronouns.has - var/use_him = self_examine ? "you" : pronouns.him - var/use_looks = self_examine ? "look" : "looks" - - //Jitters - var/jitteriness = GET_STATUS(src, STAT_JITTER) - if(jitteriness >= 300) - . += "[use_He] [use_is] convulsing violently!" - else if(jitteriness >= 200) - . += "[use_He] [use_is] extremely jittery." - else if(jitteriness >= 100) - . += "[use_He] [use_is] twitching ever so slightly." +/decl/human_examination/stat + priority = /decl/human_examination/disfigured::priority + 1 - //Disfigured face - if(!(hideflags & HIDEFACE)) //Disfigurement only matters for the head currently. - var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(src, BP_HEAD) - if(limb && (limb.status & ORGAN_DISFIGURED)) //Check to see if we even have a head and if the head's disfigured. - if(limb.species) //Check to make sure we have a species - . += limb.species.disfigure_msg(src) - else //Just in case they lack a species for whatever reason. - . += "[use_His] face is horribly mangled!" - - //splints - for(var/organ in list(BP_L_LEG, BP_R_LEG, BP_L_ARM, BP_R_ARM)) - var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(src, organ) - if(limb && limb.splinted && limb.splinted.loc == limb) - . += "[use_He] [use_has] \a [limb.splinted] on [use_his] [limb.name]!" - - if (src.stat) - . += "[use_He] [use_is]n't responding to anything around [use_him] and seems to be unconscious." - if((stat == DEAD || is_asystole() || src.ticks_since_last_successful_breath) && distance <= 3) - . += "[use_He] [use_does] not appear to be breathing." - - var/datum/reagents/touching_reagents = get_contact_reagents() +/decl/human_examination/stat/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + if (source.stat) + . = list(SPAN_WARNING("[pronouns.He] [pronouns.is]n't responding to anything around [pronouns.him] and seems to be unconscious.")) + if((source.stat == DEAD || source.is_asystole() || source.suffocation_counter) && distance <= 3) + . += SPAN_WARNING("[pronouns.He] [pronouns.does] not appear to be breathing.") + +/decl/human_examination/contact_reagents + priority = /decl/human_examination/stat::priority + 1 + +/decl/human_examination/contact_reagents/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + var/datum/reagents/touching_reagents = source.get_contact_reagents() if(touching_reagents?.total_volume >= 1) var/saturation = touching_reagents.total_volume / touching_reagents.maximum_volume if(saturation > 0.9) - . += "[use_He] [use_is] completely saturated." + . += "[pronouns.He] [pronouns.is] completely saturated." else if(saturation > 0.6) - . += "[use_He] [use_is] looking half-drowned." + . += "[pronouns.He] [pronouns.is] looking half-drowned." else if(saturation > 0.3) - . += "[use_He] [use_is] looking notably soggy." + . += "[pronouns.He] [pronouns.is] looking notably soggy." else - . += "[use_He] [use_is] looking a bit soggy." + . += "[pronouns.He] [pronouns.is] looking a bit soggy." + +/decl/human_examination/fire + priority = /decl/human_examination/contact_reagents::priority + 1 - var/fire_level = get_fire_intensity() +/decl/human_examination/fire/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + . = list() + var/fire_level = source.get_fire_intensity() if(fire_level > 0) - . += "[use_He] [use_is] looking highly flammable!" + . += "[pronouns.He] [pronouns.is] looking highly flammable!" else if(fire_level < 0) - . += "[use_He] [use_is] looking rather incombustible." + . += "[pronouns.He] [pronouns.is] looking rather incombustible." - if(is_on_fire()) - . += "[use_He] [use_is] on fire!" + if(source.is_on_fire()) + . += SPAN_WARNING("[pronouns.He] [pronouns.is] on fire!") - var/ssd_msg = species.get_ssd(src) - if(ssd_msg && (!should_have_organ(BP_BRAIN) || has_brain()) && stat != DEAD) - if(!key) - . += "[use_He] [use_is] [ssd_msg]. It doesn't look like [use_he] [use_is] waking up anytime soon." - else if(!client) - . += "[use_He] [use_is] [ssd_msg]." +/decl/human_examination/ssd + priority = /decl/human_examination/fire::priority + 1 - var/obj/item/organ/external/head/H = get_organ(BP_HEAD, /obj/item/organ/external/head) +/decl/human_examination/ssd/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + var/ssd_msg = source.species.get_ssd(source) + if(ssd_msg && (!source.should_have_organ(BP_BRAIN) || source.has_brain()) && source.stat != DEAD) + if(!source.key) + . += SPAN_DEADSAY("[pronouns.He] [pronouns.is] [ssd_msg]. It doesn't look like [pronouns.he] [pronouns.is] waking up anytime soon.") + else if(!source.client) + . += SPAN_DEADSAY("[pronouns.He] [pronouns.is] [ssd_msg].") + +// TODO: generalize and fold this into limb examine +/decl/human_examination/graffiti + priority = /decl/human_examination/ssd::priority + 1 + +/decl/human_examination/graffiti/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + var/obj/item/organ/external/head/H = source.get_organ(BP_HEAD, /obj/item/organ/external/head) if(istype(H) && H.forehead_graffiti && H.graffiti_style) - . += "[use_He] [use_has] \"[H.forehead_graffiti]\" written on [use_his] [H.name] in [H.graffiti_style]!" + . += SPAN_NOTICE("[pronouns.He] [pronouns.has] \"[H.forehead_graffiti]\" written on [pronouns.his] [H.name] in [H.graffiti_style]!") - if(became_younger) - . += "[use_He] [use_looks] a lot younger than you remember." - if(became_older) - . += "[use_He] [use_looks] a lot older than you remember." +/decl/human_examination/limb_examine + priority = /decl/human_examination/graffiti::priority + 1 +// This is still kind of a mess. TODO: /decl/organ_examination? lol +/decl/human_examination/limb_examine/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + . = list() var/list/wound_flavor_text = list() var/applying_pressure = "" var/list/shown_objects = list() var/list/hidden_bleeders = list() - var/decl/bodytype/root_bodytype = get_bodytype() + var/decl/bodytype/root_bodytype = source.get_bodytype() for(var/organ_tag in root_bodytype.has_limbs) - var/list/organ_data = root_bodytype.has_limbs[organ_tag] - var/organ_descriptor = organ_data["descriptor"] - var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(src, organ_tag) + var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(source, organ_tag) if(!limb) - wound_flavor_text[organ_descriptor] = "[use_He] [use_is] missing [use_his] [organ_descriptor]." + wound_flavor_text[organ_tag] = list(SPAN_DANGER("[pronouns.He] [pronouns.is] missing [pronouns.his] [organ_data["descriptor"]].")) continue - wound_flavor_text[limb.name] = "" + wound_flavor_text[limb.organ_tag] = list() - if(limb.applied_pressure == src) - applying_pressure = "[use_He] [use_is] applying pressure to [use_his] [limb.name]." + if(limb.applied_pressure == source) + applying_pressure = SPAN_INFO("[pronouns.He] [pronouns.is] applying pressure to [pronouns.his] [limb.name].") - var/obj/item/clothing/hidden - for(var/slot in global.standard_clothing_slots) - var/obj/item/clothing/C = get_equipped_item(slot) - if(istype(C) && (C.body_parts_covered & limb.body_part)) - hidden = C - break + var/obj/item/clothing/hidden = source.get_covering_equipped_item(limb.body_part) - if(hidden && user != src) + if(hidden && user != source) if(limb.status & ORGAN_BLEEDING && !(hidden.item_flags & ITEM_FLAG_THICKMATERIAL)) //not through a spacesuit if(!hidden_bleeders[hidden]) hidden_bleeders[hidden] = list() - hidden_bleeders[hidden] += limb.name + hidden_bleeders[hidden] += limb.organ_tag else - if(!isSynthetic() && BP_IS_PROSTHETIC(limb) && (limb.parent && !BP_IS_PROSTHETIC(limb.parent))) - wound_flavor_text[limb.name] = "[use_He] [use_has] a [limb.name].\n" + // TODO: Make this just report if the bodytype is different than root and parent? + // That way a robotic right arm would show up but the hand attached to it wouldn't. + if(!source.isSynthetic() && BP_IS_PROSTHETIC(limb) && (limb.parent && !BP_IS_PROSTHETIC(limb.parent))) + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.He] [pronouns.has] a [limb.name].") var/wounddesc = limb.get_wounds_desc() if(wounddesc != "nothing") - wound_flavor_text[limb.name] += "[use_He] [use_has] [wounddesc] on [use_his] [limb.name]." + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.He] [pronouns.has] [wounddesc] on [pronouns.his] [limb.name].") if(!hidden || distance <=1) if(limb.is_dislocated()) - wound_flavor_text[limb.name] += "[use_His] [limb.joint] is dislocated!
    " + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.His] [limb.joint] is dislocated!") if(((limb.status & ORGAN_BROKEN) && limb.brute_dam > limb.min_broken_damage) || (limb.status & ORGAN_MUTATED)) - wound_flavor_text[limb.name] += "[use_His] [limb.name] is dented and swollen!
    " + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.His] [limb.name] is dented and swollen!") if(limb.status & ORGAN_DEAD) if(BP_IS_PROSTHETIC(limb) || BP_IS_CRYSTAL(limb)) - wound_flavor_text[limb.name] += "[use_His] [limb.name] is irrecoverably damaged!" + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.His] [limb.name] is irrecoverably damaged!") else - wound_flavor_text[limb.name] += "[use_His] [limb.name] is grey and necrotic!
    " + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.His] [limb.name] is grey and necrotic!") else if((limb.brute_dam + limb.burn_dam) >= limb.max_damage && limb.germ_level >= INFECTION_LEVEL_TWO) - wound_flavor_text[limb.name] += "[use_His] [limb.name] is likely beyond saving, and has begun to decay!" + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.His] [limb.name] is likely beyond saving, and has begun to decay!") for(var/datum/wound/wound in limb.wounds) var/list/embedlist = wound.embedded_objects @@ -164,105 +173,138 @@ else if(!parsedembed.Find("multiple [embedded.name]")) parsedembed.Remove(embedded.name) parsedembed.Add("multiple "+embedded.name) - wound_flavor_text["[limb.name]"] += "The [wound.desc] on [use_his] [limb.name] has \a [english_list(parsedembed, and_text = " and a ", comma_text = ", a ")] sticking out of it!" + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("The [wound.desc] on [pronouns.his] [limb.name] has \a [english_list(parsedembed, and_text = " and a ", comma_text = ", a ")] sticking out of it!") + + if(limb.splinted && limb.splinted.loc == limb) + wound_flavor_text[limb.organ_tag] += SPAN_WARNING("[pronouns.He] [pronouns.has] \a [limb.splinted] on [pronouns.his] [limb.name]!") + for(var/hidden in hidden_bleeders) - wound_flavor_text[hidden] = "[use_He] [use_has] blood soaking through [hidden] around [use_his] [english_list(hidden_bleeders[hidden])]!" + wound_flavor_text[hidden] = SPAN_WARNING("[pronouns.He] [pronouns.has] blood soaking through [hidden] around [pronouns.his] [english_list(hidden_bleeders[hidden])]!") - . += "" - for(var/limb in wound_flavor_text) - . += wound_flavor_text[limb] - . += "" + for(var/section in wound_flavor_text) // originally named limb, but can also include clothes + if(length(wound_flavor_text[section])) + . += jointext(wound_flavor_text[section], "
    ") - for(var/obj/implant in get_visible_implants(0)) + if(applying_pressure) + . += applying_pressure + + // TODO: move this into the limb for loop? + for(var/obj/implant in source.get_visible_implants(0)) if(implant in shown_objects) continue - . += "[src] [use_has] \a [implant.name] sticking out of [use_his] flesh!" - if(digitalcamo) - . += "[use_He] [use_is] repulsively uncanny!" + . += SPAN_DANGER("[source] [pronouns.has] \a [implant.name] sticking out of [pronouns.his] flesh!") - if(hasHUD(user, HUD_SECURITY)) - var/perpname = "wot" - var/criminal = "None" +/decl/human_examination/digicamo + priority = /decl/human_examination/limb_examine::priority + 1 - var/obj/item/card/id/check_id = GetIdCard() - if(istype(check_id)) - perpname = check_id.registered_name - else - perpname = src.name +/decl/human_examination/digicamo/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + if(source.digitalcamo) + return SPAN_WARNING("[pronouns.He] [pronouns.is] repulsively uncanny!") - if(perpname) - var/datum/computer_network/network = user.getHUDnetwork(HUD_SECURITY) - if(network) - var/datum/computer_file/report/crew_record/R = network.get_crew_record_by_name(perpname) - if(R) - criminal = R.get_criminalStatus() +/decl/human_examination/hud + priority = /decl/human_examination/digicamo::priority + 1 - . += "Criminal status: \[[criminal]\]" - . += "Security records: \[View\]" - - if(hasHUD(user, HUD_MEDICAL)) - var/perpname = "wot" - var/medical = "None" +/decl/human_examination/hud/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + var/perpname = source.get_authentification_name(source.get_face_name()) + if(!perpname) + return - var/obj/item/card/id/check_id = GetIdCard() - if(istype(check_id)) - perpname = check_id.registered_name - else - perpname = src.name + if(hasHUD(user, HUD_SECURITY)) + var/datum/computer_network/network = user.getHUDnetwork(HUD_SECURITY) + if(network) + var/datum/computer_file/report/crew_record/R = network.get_crew_record_by_name(perpname) + LAZYINITLIST(.) + . += "Criminal status: \[[R?.get_criminalStatus() || "None"]\]" + . += "Security records: \[View\]" + if(hasHUD(user, HUD_MEDICAL)) var/datum/computer_network/network = user.getHUDnetwork(HUD_MEDICAL) if(network) var/datum/computer_file/report/crew_record/R = network.get_crew_record_by_name(perpname) - if(R) - medical = R.get_status() + LAZYINITLIST(.) + . += "Physical status: \[[R?.get_status() || "None"]\]" + . += "Medical records: \[View\]" - . += "Physical status: \[[medical]\]" - . += "Medical records: \[View\]" +/decl/human_examination/pose + priority = /decl/human_examination/hud::priority + 1 + section_prefix = "*---------*" +/decl/human_examination/pose/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) + if (!source.pose) + return + var/treated_pose = trim(source.handle_autopunctuation(source.pose)) + // if the pose starts with is, are, do, does, or doesn't, apply basic verb correction + if(starts_with(treated_pose, "is ")) // if the pose starts with is + treated_pose = "[pronouns.is] [copytext(treated_pose, 1, 4)]" + if(starts_with(treated_pose, "are ")) // if the pose starts with are + treated_pose = "[pronouns.is] [copytext(treated_pose, 1, 5)]" + else if(starts_with(treated_pose, "does ")) + treated_pose = "[pronouns.does] [copytext(treated_pose, 1, 6)]" + else if(starts_with(treated_pose, "do ")) + treated_pose = "[pronouns.does] [copytext(treated_pose, 1, 4)]" + else if(starts_with(treated_pose, "doesn't ")) + treated_pose = "[pronouns.does]n't [copytext(treated_pose, 1, 9)]" + else if(starts_with(treated_pose, "don't ")) + treated_pose = "[pronouns.does]n't [copytext(treated_pose, 1, 7)]" + return "[pronouns.He] [source.handle_autopunctuation(source.pose)]" + +/decl/human_examination/comments + priority = /decl/human_examination/pose::priority + 99 // OOC info should show up pretty late. + section_prefix = "*---------*" + section_postfix = "*---------*" // this only applies if there is something after it + +/decl/human_examination/comments/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) // Show IC/OOC info if available. - if(comments_record_id) - var/datum/character_information/comments = SScharacter_info.get_record(comments_record_id) - if(comments?.show_info_on_examine && (comments.ic_info || comments.ooc_info)) - . += "*---------*" - if(comments.ic_info) - if(length(comments.ic_info) <= 40) - . += "IC Info:" - . += "    [comments.ic_info]" - else - . += "IC Info:" - . += "    [copytext_preserve_html(comments.ic_info,1,37)]... More..." - if(comments.ooc_info) - if(length(comments.ooc_info) <= 40) - . += "OOC Info:" - . += "    [comments.ooc_info]" - else - . += "OOC Info:" - . += "    [copytext_preserve_html(comments.ooc_info,1,37)]... More..." - - . += "*---------*
    " - . += applying_pressure - - if (pose) - if( findtext(pose,".",length(pose)) == 0 && findtext(pose,"!",length(pose)) == 0 && findtext(pose,"?",length(pose)) == 0 ) - pose = addtext(pose,".") //Makes sure all emotes end with a period. - . += "[use_He] [pose]" - - var/list/human_examines = decls_repository.get_decls_of_subtype(/decl/human_examination) - for(var/exam in human_examines) - var/decl/human_examination/HE = human_examines[exam] - var/adding_text = HE.do_examine(user, distance, src) - if(adding_text) - . += adding_text - - // Foul, todo fix this - if(stat && ishuman(user) && !user.incapacitated() && Adjacent(user)) - spawn(0) - user.visible_message("\The [user] checks \the [src]'s pulse.", "You check \the [src]'s pulse.") - if(do_after(user, 15, src)) - if(get_pulse() == PULSE_NONE) - to_chat(user, "[use_He] [use_has] no pulse.") - else - to_chat(user, "[use_He] [use_has] a pulse!") + if(!source.comments_record_id) + return + var/datum/character_information/comments = SScharacter_info.get_record(source.comments_record_id) + if(comments?.show_info_on_examine && (comments.ic_info || comments.ooc_info)) + if(comments.ic_info) + if(length(comments.ic_info) <= 40) + . += "IC Info:" + . += "    [comments.ic_info]" + else + . += "IC Info:" + . += "    [copytext_preserve_html(comments.ic_info,1,37)]... More..." + if(comments.ooc_info) + if(length(comments.ooc_info) <= 40) + . += "OOC Info:" + . += "    [comments.ooc_info]" + else + . += "OOC Info:" + . += "    [copytext_preserve_html(comments.ooc_info,1,37)]... More..." + +/mob/living/human/get_other_examine_strings(mob/user, distance, infix, suffix, hideflags, decl/pronouns/pronouns) + . = ..() + var/static/list/priority_examine_decls = sortTim(decls_repository.get_decls_of_subtype_unassociated(/decl/human_examination), /proc/cmp_human_examine_priority) + var/last_divider = null + for(var/decl/human_examination/examiner in priority_examine_decls) + var/adding_text = examiner.do_examine(user, distance, src, hideflags, pronouns) + if(!LAZYLEN(adding_text)) + continue + if(last_divider) // insert the divider from the last entry + . += last_divider + else if(length(.)) // we already have prior entries, insert our prefix + . += examiner.section_prefix + . += adding_text + last_divider = examiner.section_postfix + +/mob/living/human/examined_by(mob/user, distance, infix, suffix) + . = ..() + if(!stat || !ishuman(user) || user.incapacitated() || !Adjacent(user)) + return + INVOKE_ASYNC(src, PROC_REF(check_heartbeat), user) + +/mob/living/human/proc/check_heartbeat(mob/living/human/user) + if(!stat || !ishuman(user) || user.incapacitated() || !Adjacent(user)) + return + user.visible_message("\The [user] checks \the [src]'s pulse.", "You check \the [src]'s pulse.") + if(do_after(user, 1.5 SECONDS, src)) + var/decl/pronouns/seen_pronouns = get_pronouns() + if(get_pulse() == PULSE_NONE) + to_chat(user, SPAN_DEADSAY("[seen_pronouns.He] [seen_pronouns.has] no pulse.")) + else + to_chat(user, SPAN_DEADSAY("[seen_pronouns.He] [seen_pronouns.has] a pulse!")) //Helper procedure. Called by /mob/living/human/examined_by() and /mob/living/human/Topic() to determine HUD access to security and medical records. /proc/hasHUD(mob/M, hudtype) @@ -281,7 +323,7 @@ return glasses.hud /mob/living/silicon/robot/getHUDsource(hudtype) - for(var/obj/item/borg/sight/sight in list(module_state_1, module_state_2, module_state_3)) + for(var/obj/item/borg/sight/sight in get_held_items()) if(istype(sight) && (sight.glasses_hud_type & hudtype)) return sight diff --git a/code/modules/mob/living/human/human.dm b/code/modules/mob/living/human/human.dm index 6ffaebad41b9..992bbe7c5449 100644 --- a/code/modules/mob/living/human/human.dm +++ b/code/modules/mob/living/human/human.dm @@ -7,7 +7,7 @@ max_health = 150 var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us. -/mob/living/human/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) current_health = max_health reset_hud_overlays() @@ -389,7 +389,7 @@ brain.mind.transfer_to(src) qdel(brain.loc) break - ticks_since_last_successful_breath = 0 + suffocation_counter = 0 ..() /mob/living/add_blood(mob/living/M, amount = 2, list/blood_data) @@ -479,24 +479,23 @@ update_eyes() return TRUE -/mob/proc/set_species(var/new_species_name, var/new_bodytype = null) +/mob/proc/set_species(var/new_species_uid, var/new_bodytype = null) return //set_species should not handle the entirety of initing the mob, and should not trigger deep updates //It focuses on setting up species-related data, without force applying them uppon organs and the mob's appearance. // For transforming an existing mob, look at change_species() -/mob/living/human/set_species(var/new_species_name, var/new_bodytype = null) - if(!new_species_name) - CRASH("set_species on mob '[src]' was passed a null species name '[new_species_name]'!") - var/new_species = get_species_by_key(new_species_name) - if(species?.name == new_species_name) +/mob/living/human/set_species(var/new_species_uid, var/new_bodytype = null) + if(!new_species_uid) + CRASH("set_species on mob '[src]' was passed a null species uid!") + var/decl/species/new_species = decls_repository.get_decl_by_id(new_species_uid) + if(species?.uid == new_species_uid) return if(!new_species) - CRASH("set_species on mob '[src]' was passed a bad species name '[new_species_name]'!") + CRASH("set_species on mob '[src]' was passed a bad species uid '[new_species_uid]'!") //Handle old species transition if(species) - species.remove_base_auras(src) species.remove_inherent_verbs(src) //Update our species @@ -546,7 +545,7 @@ //Syncs background categories/values to the currently set species, and may trigger a language update /mob/living/human/proc/apply_species_background_info() var/update_lang - for(var/cat_type in global.using_map.get_background_categories()) + for(var/cat_type in decls_repository.get_decls_of_subtype(/decl/background_category)) if(species.force_background_info && species.force_background_info[cat_type]) update_lang = TRUE set_background_value(cat_type, species.force_background_info[cat_type], defer_language_update = TRUE) @@ -560,7 +559,8 @@ //Drop anything that cannot be worn by the current species of the mob /mob/living/human/proc/apply_species_inventory_restrictions() - if(!(get_bodytype().appearance_flags & HAS_UNDERWEAR)) + var/decl/bodytype/check_bodytype = get_bodytype() + if(!istype(check_bodytype) || !(check_bodytype.appearance_flags & HAS_UNDERWEAR)) QDEL_NULL_LIST(worn_underwear) var/list/new_slots @@ -587,7 +587,7 @@ // Triggers deep update of limbs and hud /mob/living/human/proc/apply_species_appearance() if(!species) - icon_state = lowertext(SPECIES_HUMAN) + icon_state = null // this used to set it to "human" but that's not even an icon state that exists, so else species.apply_appearance(src) @@ -974,14 +974,15 @@ mind.name = newname //Human mob specific init code. Meant to be used only on init. -/mob/living/human/proc/setup_human(species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/proc/setup_human(species_uid, datum/mob_snapshot/supplied_appearance) if(supplied_appearance) - species_name = supplied_appearance.root_species - else if(!species_name) - species_name = global.using_map.default_species //Humans cannot exist without a species! + species_uid = supplied_appearance.root_species.uid + else if(!species_uid) + species_uid = global.using_map.default_species //Humans cannot exist without a species! - set_species(species_name, supplied_appearance?.root_bodytype) + set_species(species_uid, supplied_appearance?.root_bodytype) var/decl/bodytype/root_bodytype = get_bodytype() // root bodytype is set in set_species + ASSERT((!supplied_appearance?.root_bodytype) || (root_bodytype == supplied_appearance.root_bodytype)) if(!get_skin_colour()) set_skin_colour(root_bodytype.base_color, skip_update = TRUE) if(!get_eye_colour()) @@ -1016,10 +1017,10 @@ SetName(initial(name)) //Runs last after setup and after the parent init has been executed. -/mob/living/human/proc/post_setup(species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/proc/post_setup(species_uid, datum/mob_snapshot/supplied_appearance) try_refresh_visible_overlays() //Do this exactly once per setup -/mob/living/human/handle_flashed(var/flash_strength) +/mob/living/human/handle_flashed(var/flash_strength, do_stun = FALSE) var/safety = eyecheck() if(safety < FLASH_PROTECTION_MODERATE) flash_strength = round(get_flash_mod() * flash_strength) @@ -1079,8 +1080,10 @@ return //no feet no footsteps return TRUE -/mob/living/human/get_skin_tone(value) - return skin_tone +/mob/living/human/get_skin_tone() + if(get_bodytype()?.appearance_flags & HAS_A_SKIN_TONE) + return skin_tone + return null /mob/living/human/set_skin_tone(value) skin_tone = value @@ -1142,7 +1145,7 @@ /mob/living/human/get_attack_telegraph_delay() return client ? 0 : DEFAULT_ATTACK_COOLDOWN -/mob/living/human/set_status(condition, amount) +/mob/living/human/set_status_condition(condition, amount) if(has_trait(/decl/trait/undead)) var/static/list/ignore_status_conditions = list( STAT_BLIND, diff --git a/code/modules/mob/living/human/human_appearance.dm b/code/modules/mob/living/human/human_appearance.dm index 272f2165b4a4..c85c641c8d87 100644 --- a/code/modules/mob/living/human/human_appearance.dm +++ b/code/modules/mob/living/human/human_appearance.dm @@ -7,7 +7,9 @@ AC.ui_interact(user, state = state) /mob/living/human/get_skin_colour() - return _skin_colour + if(get_bodytype()?.appearance_flags & HAS_SKIN_COLOR) + return _skin_colour + return null /mob/living/human/set_skin_colour(var/new_color, var/skip_update = FALSE) if((. = ..())) @@ -21,10 +23,7 @@ if(!new_species) return - if(species?.name == new_species) - return - - if(!(new_species in get_all_species())) + if(species?.uid == new_species) return set_species(new_species, new_bodytype) @@ -90,19 +89,17 @@ /mob/living/human/proc/generate_valid_species(var/check_whitelist = 1, var/list/whitelist = list(), var/list/blacklist = list()) var/list/valid_species = new() - for(var/current_species_name in get_all_species()) - var/decl/species/current_species = get_species_by_key(current_species_name) - + for(var/decl/species/current_species as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) if(check_whitelist) //If we're using the whitelist, make sure to check it! if((current_species.spawn_flags & SPECIES_IS_RESTRICTED) && !check_rights(R_ADMIN, 0, src)) continue if(!is_alien_whitelisted(src, current_species)) continue - if(whitelist.len && !(current_species_name in whitelist)) + if(whitelist.len && !(current_species.uid in whitelist)) continue - if(blacklist.len && (current_species_name in blacklist)) + if(blacklist.len && (current_species.uid in blacklist)) continue - valid_species += current_species_name + valid_species += current_species.uid return valid_species diff --git a/code/modules/mob/living/human/human_attackhand.dm b/code/modules/mob/living/human/human_attackhand.dm index 00c8a932b860..dfcc31cb4120 100644 --- a/code/modules/mob/living/human/human_attackhand.dm +++ b/code/modules/mob/living/human/human_attackhand.dm @@ -3,11 +3,12 @@ hit_zone = get_target_zone() var/list/available_attacks = get_mob_natural_attacks() var/decl/natural_attack/use_attack = default_attack - if(!use_attack || !use_attack.is_usable(src, target, hit_zone) || !(use_attack.type in available_attacks)) + if(!use_attack || !use_attack.attack_is_usable(src, target, hit_zone) || !(use_attack in available_attacks)) + var/alert_non_default_attack = use_attack?.name use_attack = null var/list/other_attacks = list() for(var/decl/natural_attack/u_attack as anything in available_attacks) - if(!u_attack.is_usable(src, target, hit_zone)) + if(!u_attack.attack_is_usable(src, target, hit_zone)) continue if(u_attack.is_starting_default) use_attack = u_attack @@ -15,6 +16,9 @@ other_attacks += u_attack if(!use_attack && length(other_attacks)) use_attack = pick(other_attacks) + if(use_attack && alert_non_default_attack) + to_chat(src, SPAN_WARNING("You cannot [alert_non_default_attack] \the [target] currently, so you switch attacks.")) + . = use_attack?.resolve_to_soft_variant(src) /obj/item/organ/external/proc/get_natural_attacks() @@ -232,7 +236,7 @@ /mob/living/human/attack_hand(mob/user) - remove_cloaking_source(species) + remove_mob_modifier(/decl/mob_modifier/cloaked, source = species) if(!user.check_intent(I_FLAG_GRAB)) for (var/obj/item/grab/grab as anything in user.get_active_grabs()) if(grab.assailant == user && grab.affecting == src && grab.resolve_openhand_attack()) @@ -336,7 +340,7 @@ if(!lungs.handle_owner_breath(H.get_breath_from_environment(), 1)) if(!lungs.is_bruised()) - ticks_since_last_successful_breath = 0 + suffocation_counter = 0 to_chat(src, SPAN_NOTICE("You feel a breath of fresh air enter your lungs. It feels good.")) // Again. @@ -378,6 +382,7 @@ user.visible_message( \ SPAN_NOTICE("\The [user] starts applying pressure to \the [src]'s [organ.name]!"), \ SPAN_NOTICE("You start applying pressure to \the [src]'s [organ.name]!")) + // TODO: refactor applying pressure to use grabs instead? would probably require making grabs locked to the zone they were started on spawn(0) organ.applied_pressure = user @@ -420,7 +425,7 @@ to_chat(src, SPAN_NOTICE(summary)) refresh_hud_element(HUD_ATTACK) -/mob/living/human/UnarmedAttack(atom/A, proximity_flag) +/mob/living/human/ResolveUnarmedAttack(atom/A) // Hackfix for humans trying to attack someone without hands. // Dexterity ect. should be checked in these procs regardless, // but unarmed attacks that don't require hands should still diff --git a/code/modules/mob/living/human/human_defense.dm b/code/modules/mob/living/human/human_defense.dm index 6b25c9c15803..333e52101631 100644 --- a/code/modules/mob/living/human/human_defense.dm +++ b/code/modules/mob/living/human/human_defense.dm @@ -124,9 +124,9 @@ meteor_act if(I.attack_message_name()) weapon_mention = " with [I.attack_message_name()]" if(effective_force) - visible_message("[src] has been [I.attack_verb.len? pick(I.attack_verb) : "attacked"] in the [affecting.name][weapon_mention] by [user]!") + visible_message("[src] has been [I.pick_attack_verb()] in the [affecting.name][weapon_mention] by [user]!") else - visible_message("[src] has been [I.attack_verb.len? pick(I.attack_verb) : "attacked"] in the [affecting.name][weapon_mention] by [user]!") + visible_message("[src] has been [I.pick_attack_verb()] in the [affecting.name][weapon_mention] by [user]!") return // If it has no force then no need to do anything else. . = standard_weapon_hit_effects(I, user, effective_force, hit_zone) @@ -175,22 +175,22 @@ meteor_act animate_receive_damage(src) return 1 -/mob/living/human/proc/attack_bloody(obj/item/W, mob/attacker, var/effective_force, var/hit_zone) - if(W.atom_damage_type != BRUTE) +/mob/living/human/proc/attack_bloody(obj/item/used_item, mob/attacker, var/effective_force, var/hit_zone) + if(used_item.atom_damage_type != BRUTE) return if(!should_have_organ(BP_HEART)) return //make non-sharp low-force weapons less likely to be bloodied - if(W.is_sharp() || prob(effective_force*4)) - if(!(W.atom_flags & ATOM_FLAG_NO_BLOOD)) - W.add_blood(src) + if(used_item.is_sharp() || prob(effective_force*4)) + if(!(used_item.atom_flags & ATOM_FLAG_NO_BLOOD)) + used_item.add_blood(src) else return //if the weapon itself didn't get bloodied than it makes little sense for the target to be bloodied either //getting the weapon bloodied is easier than getting the target covered in blood, so run prob() again - if(prob(33 + W.is_sharp() * 10)) + if(prob(33 + used_item.is_sharp() * 10)) var/turf/location = loc if(istype(location) && location.simulated) location.add_blood(src) @@ -234,10 +234,10 @@ meteor_act C.add_blood(src) C.update_clothing_icon() -/mob/living/human/proc/attack_joint(var/obj/item/organ/external/organ, var/obj/item/W, var/effective_force, var/dislocate_mult, var/blocked) +/mob/living/human/proc/attack_joint(var/obj/item/organ/external/organ, var/obj/item/used_item, var/effective_force, var/dislocate_mult, var/blocked) if(!organ || organ.is_dislocated() || !(organ.limb_flags & ORGAN_FLAG_CAN_DISLOCATE) || blocked >= 100) return 0 - if(W.atom_damage_type != BRUTE) + if(used_item.atom_damage_type != BRUTE) return 0 //want the dislocation chance to be such that the limb is expected to dislocate after dealing a fraction of the damage needed to break the limb diff --git a/code/modules/mob/living/human/human_defines.dm b/code/modules/mob/living/human/human_defines.dm index 8108d6b8d3ee..9983f7eb7a4b 100644 --- a/code/modules/mob/living/human/human_defines.dm +++ b/code/modules/mob/living/human/human_defines.dm @@ -49,9 +49,6 @@ var/obj/machinery/machine_visual var/shock_stage var/rounded_shock_stage - /// vars for fountain of youth examine lines - var/became_older - var/became_younger /// var for caching last pain calc to avoid looping through organs over and over and over again var/last_pain var/vital_organ_missing_time diff --git a/code/modules/mob/living/human/human_examine_decl.dm b/code/modules/mob/living/human/human_examine_decl.dm index b791442cea3b..bad406e8b985 100644 --- a/code/modules/mob/living/human/human_examine_decl.dm +++ b/code/modules/mob/living/human/human_examine_decl.dm @@ -1,4 +1,9 @@ /decl/human_examination //This is essentially a stub-method for modpacks to be able to add onto the human examination stuff due to ... messy stuff. + var/priority = 0 + /// If non-null, this is inserted before this entry if there is not already a postfix before it. + var/section_prefix = null + /// If non-null, this is inserted after this entry if there exist entries after it. + var/section_postfix = null -/decl/human_examination/proc/do_examine(var/user, var/distance, var/source) //These can either return text, or should return nothing at all if you're doing to_chat() +/decl/human_examination/proc/do_examine(mob/user, distance, mob/living/human/source, hideflags, decl/pronouns/pronouns) //These can either return text, or should return nothing at all if you're doing to_chat() return diff --git a/code/modules/mob/living/human/human_grabs.dm b/code/modules/mob/living/human/human_grabs.dm index c9fadf93e18a..38987122e3b7 100644 --- a/code/modules/mob/living/human/human_grabs.dm +++ b/code/modules/mob/living/human/human_grabs.dm @@ -25,4 +25,4 @@ /mob/living/human/make_grab(atom/movable/target, grab_tag = /decl/grab/simple, defer_hand = FALSE, force_grab_tag = FALSE) . = ..() if(.) - remove_cloaking_source(species) + remove_mob_modifier(/decl/mob_modifier/cloaked, source = species) diff --git a/code/modules/mob/living/human/human_helpers.dm b/code/modules/mob/living/human/human_helpers.dm index 90035988c32d..39847bceef8c 100644 --- a/code/modules/mob/living/human/human_helpers.dm +++ b/code/modules/mob/living/human/human_helpers.dm @@ -181,72 +181,6 @@ SET_STATUS_MAX(src, STAT_BLURRY, 5) add_genetic_condition(GENE_COND_NEARSIGHTED, 10 SECONDS) -/mob/living/human - var/list/cloaking_sources - -// Returns true if, and only if, the human has gone from uncloaked to cloaked -/mob/living/human/proc/add_cloaking_source(var/datum/cloaking_source) - var/has_uncloaked = clean_cloaking_sources() - LAZYDISTINCTADD(cloaking_sources, weakref(cloaking_source)) - - // We don't present the cloaking message if the human was already cloaked just before cleanup. - if(!has_uncloaked && LAZYLEN(cloaking_sources) == 1) - update_icon() - src.visible_message("\The [src] seems to disappear before your eyes!", "You feel completely invisible.") - return TRUE - return FALSE - -#define CLOAK_APPEAR_OTHER "\The [src] appears from thin air!" -#define CLOAK_APPEAR_SELF "You have re-appeared." - -// Returns true if, and only if, the human has gone from cloaked to uncloaked -/mob/living/human/proc/remove_cloaking_source(var/datum/cloaking_source) - var/was_cloaked = LAZYLEN(cloaking_sources) - clean_cloaking_sources() - LAZYREMOVE(cloaking_sources, weakref(cloaking_source)) - - if(was_cloaked && !LAZYLEN(cloaking_sources)) - update_icon() - visible_message(CLOAK_APPEAR_OTHER, CLOAK_APPEAR_SELF) - return TRUE - return FALSE - -// Returns true if the human is cloaked, otherwise false (technically returns the number of cloaking sources) -/mob/proc/is_cloaked() - return FALSE - -/mob/living/human/is_cloaked() - if(clean_cloaking_sources()) - update_icon() - visible_message(CLOAK_APPEAR_OTHER, CLOAK_APPEAR_SELF) - return LAZYLEN(cloaking_sources) - -#undef CLOAK_APPEAR_OTHER -#undef CLOAK_APPEAR_SELF - -// Returns true if the human is cloaked by the given source -/mob/living/human/proc/is_cloaked_by(var/cloaking_source) - return LAZYISIN(cloaking_sources, weakref(cloaking_source)) - -// Returns true if this operation caused the mob to go from cloaked to uncloaked -/mob/living/human/proc/clean_cloaking_sources() - if(!cloaking_sources) - return FALSE - - var/list/rogue_entries = list() - for(var/entry in cloaking_sources) - var/weakref/W = entry - if(!W.resolve()) - cloaking_sources -= W - rogue_entries += W - - if(rogue_entries.len) // These entries did not cleanup after themselves before being destroyed - var/rogue_entries_as_string = jointext(map(rogue_entries, /proc/log_info_line), ", ") - PRINT_STACK_TRACE("[log_info_line(src)] - Following cloaking entries were removed during cleanup: [rogue_entries_as_string]") - - UNSETEMPTY(cloaking_sources) - return !cloaking_sources // If cloaking_sources wasn't initially null but is now, we've uncloaked - /mob/living/human/proc/has_meson_effect() var/datum/global_hud/global_hud = get_global_hud() return (global_hud.meson in equipment_overlays) diff --git a/code/modules/mob/living/human/human_organs.dm b/code/modules/mob/living/human/human_organs.dm index b08b5525d8ce..44283cf84669 100644 --- a/code/modules/mob/living/human/human_organs.dm +++ b/code/modules/mob/living/human/human_organs.dm @@ -214,20 +214,9 @@ SET_STATUS_MAX(src, STAT_STUN, 2) //Moving makes open wounds get infected much faster - for(var/datum/wound/W in E.wounds) - if (W.infection_check()) - W.germ_level += 1 - -/mob/living/human/proc/Check_Proppable_Object() - for(var/turf/T as anything in RANGE_TURFS(src, 1)) //we only care for non-space turfs - if(T.density && T.simulated) //walls work - return 1 - - for(var/obj/O in orange(1, src)) - if(O && O.density && O.anchored) - return 1 - - return 0 + for(var/datum/wound/wound in E.wounds) + if (wound.infection_check()) + wound.germ_level += 1 /mob/living/human/on_lost_organ(var/obj/item/organ/O) if(!(. = ..())) diff --git a/code/modules/mob/living/human/human_species.dm b/code/modules/mob/living/human/human_presets.dm similarity index 65% rename from code/modules/mob/living/human/human_species.dm rename to code/modules/mob/living/human/human_presets.dm index 90977e6035a7..7a4d8bb44cba 100644 --- a/code/modules/mob/living/human/human_species.dm +++ b/code/modules/mob/living/human/human_presets.dm @@ -3,12 +3,21 @@ status_flags = GODMODE|CANPUSH virtual_mob = null -/mob/living/human/dummy/mannequin/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) +/proc/get_mannequin(var/ckey) + var/static/list/mob/living/human/dummy/mannequin/mannequins = list() + if(SSatoms.atom_init_stage < INITIALIZATION_INNEW_REGULAR) + return + . = mannequins[ckey] + if(!.) + . = new /mob/living/human/dummy/mannequin() + mannequins[ckey] = . + +/mob/living/human/dummy/mannequin/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) . = ..() STOP_PROCESSING(SSmobs, src) global.human_mob_list -= src -/mob/living/human/dummy/selfdress/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/dummy/selfdress/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) ..() return INITIALIZE_HINT_LATELOAD @@ -22,18 +31,18 @@ /mob/living/human/corpse/get_death_message(gibbed) return SKIP_DEATH_MESSAGE -/mob/living/human/corpse/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance, obj/abstract/landmark/corpse/corpse) - . = ..(mapload, species_name, supplied_appearance) // do not pass the corpse landmark +/mob/living/human/corpse/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance, obj/abstract/landmark/corpse/corpse) + . = ..(mapload, species_uid, supplied_appearance) // do not pass the corpse landmark var/decl/background_detail/background = get_background_datum_by_flag(BACKGROUND_FLAG_NAMING) if(background) - var/newname = background.get_random_name(src, gender, species.name) + var/newname = background.get_random_name(src, gender, species.uid) if(newname && newname != name) real_name = newname SetName(newname) if(mind) mind.name = real_name if(corpse) - corpse.randomize_appearance(src, get_species_name()) + corpse.randomize_appearance(src, get_species()?.uid) corpse.equip_corpse_outfit(src) return INITIALIZE_HINT_LATELOAD @@ -62,8 +71,8 @@ /mob/living/human/monkey gender = PLURAL -/mob/living/human/monkey/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/monkey/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) if(gender == PLURAL) gender = pick(MALE, FEMALE) - species_name = SPECIES_MONKEY + species_uid = /decl/species/monkey::uid . = ..() diff --git a/code/modules/mob/living/human/human_verbs.dm b/code/modules/mob/living/human/human_verbs.dm index 35812110f18b..7fc6f619c808 100644 --- a/code/modules/mob/living/human/human_verbs.dm +++ b/code/modules/mob/living/human/human_verbs.dm @@ -162,7 +162,7 @@ return var/num_doodles = 0 - for (var/obj/effect/decal/cleanable/blood/writing/W in T) + for (var/obj/effect/decal/cleanable/blood/writing/writing in T) num_doodles++ if (num_doodles > 4) to_chat(src, "There is no space to write on!") @@ -179,11 +179,11 @@ if (length(message) > max_length) message += "-" to_chat(src, "You ran out of blood to write with!") - var/obj/effect/decal/cleanable/blood/writing/W = new(T) - W.basecolor = (hand_blood_color) ? hand_blood_color : COLOR_BLOOD_HUMAN - W.update_icon() - W.message = message - W.add_fingerprint(src) + var/obj/effect/decal/cleanable/blood/writing/writing = new(T) + writing.basecolor = (hand_blood_color) ? hand_blood_color : COLOR_BLOOD_HUMAN + writing.update_icon() + writing.message = message + writing.add_fingerprint(src) /mob/living/human/proc/undislocate() set category = "Object" diff --git a/code/modules/mob/living/human/life.dm b/code/modules/mob/living/human/life.dm index 83b79d2bf9cd..b6b9c2961886 100644 --- a/code/modules/mob/living/human/life.dm +++ b/code/modules/mob/living/human/life.dm @@ -88,13 +88,10 @@ // Calculate how much of the environment pressure-difference affects the human. /mob/living/human/calculate_affecting_pressure(var/pressure) var/pressure_difference + var/species_safe_pressure = species.get_safe_pressure(src) // First get the absolute pressure difference. - if(pressure < ONE_ATMOSPHERE) // We are in an underpressure. - pressure_difference = ONE_ATMOSPHERE - pressure - - else //We are in an overpressure or standard atmosphere. - pressure_difference = pressure - ONE_ATMOSPHERE + pressure_difference = abs(pressure - species_safe_pressure) if(pressure_difference < 5) // If the difference is small, don't bother calculating the fraction. pressure_difference = 0 @@ -107,10 +104,10 @@ // The difference is always positive to avoid extra calculations. // Apply the relative difference on a standard atmosphere to get the final result. // The return value will be the adjusted_pressure of the human that is the basis of pressure warnings and damage. - if(pressure < ONE_ATMOSPHERE) - return ONE_ATMOSPHERE - pressure_difference + if(pressure < species_safe_pressure) + return species_safe_pressure - pressure_difference else - return ONE_ATMOSPHERE + pressure_difference + return species_safe_pressure + pressure_difference /mob/living/human/handle_impaired_vision() @@ -125,8 +122,8 @@ vision = GET_INTERNAL_ORGAN(src, vision_organ_tag) if(!vision_organ_tag) // Presumably if a species has no vision organs, they see via some other means. - set_status(STAT_BLIND, 0) - set_status(STAT_BLURRY, 0) + set_status_condition(STAT_BLIND, 0) + set_status_condition(STAT_BLURRY, 0) else if(!vision || (vision && !vision.is_usable())) // Vision organs cut out or broken? Permablind. SET_STATUS_MAX(src, STAT_BLIND, 2) SET_STATUS_MAX(src, STAT_BLURRY, 1) @@ -224,7 +221,7 @@ burn_dam = COLD_DAMAGE_LEVEL_2 else burn_dam = COLD_DAMAGE_LEVEL_3 - set_stasis(get_cryogenic_factor(bodytemperature), STASIS_COLD) + add_mob_modifier(/decl/mob_modifier/stasis, 2 SECONDS, source = src) if(!has_chemical_effect(CE_CRYO, 1)) take_overall_damage(burn=burn_dam, used_weapon = "Low Body Temperature") SET_HUD_ALERT_MAX(src, HUD_FIRE, 1) diff --git a/code/modules/mob/living/human/npcs.dm b/code/modules/mob/living/human/npcs.dm index dbe4b30ea876..3b49bbc28542 100644 --- a/code/modules/mob/living/human/npcs.dm +++ b/code/modules/mob/living/human/npcs.dm @@ -2,7 +2,7 @@ real_name = "Pun Pun" gender = MALE -/mob/living/human/monkey/punpun/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/monkey/punpun/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) ..() return INITIALIZE_HINT_LATELOAD @@ -11,7 +11,7 @@ if(prob(50)) equip_to_appropriate_slot(new /obj/item/clothing/pants/slacks/black(src)) equip_to_appropriate_slot(new /obj/item/clothing/shirt/button(src)) - equip_to_appropriate_slot(new /obj/item/clothing/neck/tie/bow/color/red(src)) + equip_to_appropriate_slot(new /obj/item/clothing/neck/tie/bow/red(src)) equip_to_appropriate_slot(new /obj/item/clothing/suit/jacket/vest/blue(src)) else var/obj/item/clothing/C = new /obj/item/clothing/pants/casual/mustangjeans(src) @@ -35,8 +35,8 @@ sensor.set_sensor_mode(VITALS_SENSOR_OFF) attach_accessory(null, sensor) -/mob/living/human/blank/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - species_name = SPECIES_HUMAN +/mob/living/human/blank/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + species_uid = /decl/species/human::uid ..() return INITIALIZE_HINT_LATELOAD diff --git a/code/modules/mob/living/human/unarmed_attack.dm b/code/modules/mob/living/human/unarmed_attack.dm index ce18cfa97bfb..33728d7201cd 100644 --- a/code/modules/mob/living/human/unarmed_attack.dm +++ b/code/modules/mob/living/human/unarmed_attack.dm @@ -63,7 +63,7 @@ /decl/natural_attack/proc/get_sparring_variant() return GET_DECL(sparring_variant_type) -/decl/natural_attack/proc/is_usable(var/mob/living/human/user, var/mob/target, var/zone) +/decl/natural_attack/proc/attack_is_usable(var/mob/living/human/user, var/mob/target, var/zone) if(!user.restrained() && !user.incapacitated()) for(var/etype in usable_with_limbs) var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(user, etype) @@ -127,9 +127,9 @@ target.visible_message("[target] has been weakened!") target.apply_effect(3, WEAKEN, armour * 100) - var/obj/item/clothing/C = target.get_covering_equipped_item_by_zone(zone) - if(istype(C) && prob(10)) - C.leave_evidence(user) + var/obj/item/clothing/gear = target.get_covering_equipped_item_by_zone(zone) + if(istype(gear) && prob(10)) + gear.leave_evidence(user) return TRUE @@ -178,17 +178,16 @@ sharp = TRUE edge = TRUE -/decl/natural_attack/bite/is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) - +/decl/natural_attack/bite/attack_is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) if(user.get_item_blocking_speech()) - return 0 + return FALSE for(var/slot in list(slot_wear_mask_str, slot_head_str, slot_wear_suit_str)) - var/obj/item/clothing/C = user.get_equipped_item(slot) - if(istype(C) && (C.body_parts_covered & SLOT_FACE) && (C.item_flags & ITEM_FLAG_THICKMATERIAL)) - return 0 //prevent biting through a space helmet or similar + var/obj/item/clothing/gear = user.get_equipped_item(slot) + if(istype(gear) && (gear.body_parts_covered & SLOT_FACE) && (gear.item_flags & ITEM_FLAG_THICKMATERIAL)) + return FALSE //prevent biting through a space helmet or similar if (user == target && (zone == BP_HEAD || zone == BP_EYES || zone == BP_MOUTH)) - return 0 //how do you bite yourself in the head? - return 1 + return FALSE //how do you bite yourself in the head? + return TRUE /decl/natural_attack/punch name = "punch" @@ -264,7 +263,7 @@ usable_with_limbs = list(BP_L_FOOT, BP_R_FOOT) sparring_variant_type = /decl/natural_attack/light_strike/kick -/decl/natural_attack/kick/is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) +/decl/natural_attack/kick/attack_is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) if(zone == BP_HEAD || zone == BP_EYES || zone == BP_MOUTH) zone = BP_CHEST . = ..() @@ -296,7 +295,7 @@ damage = 0 usable_with_limbs = list(BP_L_FOOT, BP_R_FOOT) -/decl/natural_attack/stomp/is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) +/decl/natural_attack/stomp/attack_is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) if(!istype(target)) return FALSE if (!user.current_posture.prone && (target.current_posture.prone || (zone in list(BP_L_FOOT, BP_R_FOOT)))) @@ -359,7 +358,7 @@ attack_noun = list("foot") usable_with_limbs = list(BP_L_FOOT, BP_R_FOOT) -/decl/natural_attack/light_strike/kick/is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) +/decl/natural_attack/light_strike/kick/attack_is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) if(zone == BP_HEAD || zone == BP_EYES || zone == BP_MOUTH) zone = BP_CHEST . = ..() diff --git a/code/modules/mob/living/human/update_icons.dm b/code/modules/mob/living/human/update_icons.dm index ff824d2389b8..07d4bbbf6b9e 100644 --- a/code/modules/mob/living/human/update_icons.dm +++ b/code/modules/mob/living/human/update_icons.dm @@ -340,7 +340,7 @@ Please contact me on #coderbus IRC. ~Carn x /mob/living/human/update_hair(var/update_icons=1) var/obj/item/organ/external/head/head_organ = get_organ(BP_HEAD, /obj/item/organ/external/head) - var/list/new_accessories = head_organ?.get_mob_overlays() + var/list/new_accessories = head_organ?.get_limb_mob_overlays() set_current_mob_overlay(HO_HAIR_LAYER, new_accessories, update_icons) /mob/living/human/proc/update_skin(var/update_icons=1) diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index cbfd9853c9cc..21b92392fbdd 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -195,12 +195,12 @@ if(!equip_to_appropriate_slot(I)) to_chat(src, SPAN_WARNING("You are unable to equip that.")) -/mob/living/proc/equip_in_one_of_slots(obj/item/W, list/slots, del_on_fail = 1) +/mob/living/proc/equip_in_one_of_slots(obj/item/prop, list/slots, del_on_fail = 1) for (var/slot in slots) - if (equip_to_slot_if_possible(W, slots[slot], del_on_fail = 0)) + if (equip_to_slot_if_possible(prop, slots[slot], del_on_fail = 0)) return slot if (del_on_fail) - qdel(W) + qdel(prop) return null //Same as get_covering_equipped_items, but using target zone instead of bodyparts flags diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 7c8dd1bf7c89..189965c89c8c 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -25,12 +25,9 @@ if(QDELETED(src)) // Destroyed by fire or pressure damage in handle_environment() return PROCESS_KILL handle_regular_status_updates() // Status & health update, are we dead or alive etc. - handle_stasis() - if(stat != DEAD) - if(!is_in_stasis()) - . = handle_living_non_stasis_processes() - aura_check(AURA_TYPE_LIFE) + if(stat != DEAD && !has_mob_modifier(/decl/mob_modifier/stasis)) + . = handle_living_non_stasis_processes() for(var/obj/item/grab/grab as anything in get_active_grabs()) grab.Process() @@ -42,7 +39,8 @@ handle_grasp() handle_stance() handle_regular_hud_updates() - handle_status_effects() + handle_status_conditions() + handle_mob_modifiers() return 1 /mob/living/proc/handle_grasp() @@ -236,21 +234,20 @@ // Update chem dosage. // TODO: refactor chem dosage above isSynthetic() and GODMODE checks. - if(length(chem_doses)) - for(var/T in chem_doses) + if(length(_chem_doses)) + for(var/decl/material/reagent as anything in _chem_doses) var/still_processing_reagent = FALSE for(var/datum/reagents/holder as anything in metabolizing_holders) - if(holder.has_reagent(T)) + if(holder.has_reagent(reagent)) still_processing_reagent = TRUE break if(still_processing_reagent) continue - var/decl/material/R = GET_DECL(T) - var/dose = LAZYACCESS(chem_doses, T) - R.metabolism*2 - LAZYSET(chem_doses, T, dose) - if(LAZYACCESS(chem_doses, T) <= 0) - LAZYREMOVE(chem_doses, T) + var/dose = CHEM_DOSE(src, reagent) - reagent.metabolism*2 + LAZYSET(_chem_doses, reagent, dose) + if(CHEM_DOSE(src, reagent) <= 0) + LAZYREMOVE(_chem_doses, reagent) if(apply_chemical_effects()) update_health() @@ -318,7 +315,7 @@ // Push sound to client. Pipe dream TODO: crossfade between the new and old weather ambience. sound_to(src, sound(null, repeat = 0, wait = 0, volume = 0, channel = sound_channels.weather_channel)) if(send_sound) - sound_to(src, sound(send_sound, repeat = TRUE, wait = 0, volume = 30, channel = sound_channels.weather_channel)) + sound_to(src, sound(send_sound, repeat = TRUE, wait = 0, volume = 60, channel = sound_channels.weather_channel)) /mob/living/proc/handle_environment(var/datum/gas_mixture/environment) SHOULD_CALL_PARENT(TRUE) @@ -445,6 +442,7 @@ //this handles hud updates. Calls update_vision() and handle_hud_icons() /mob/living/proc/handle_regular_hud_updates() + SHOULD_CALL_PARENT(TRUE) if(!should_do_hud_updates()) return FALSE diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index a2bb5d26fa26..043a2bc69b54 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -233,8 +233,8 @@ default behaviour is: if(stat != DEAD && should_be_dead()) death() if(!QDELETED(src)) // death() may delete or remove us - set_status(STAT_BLIND, 1) - set_status(STAT_SILENCE, 0) + set_status_condition(STAT_BLIND, 1) + set_status_condition(STAT_SILENCE, 0) return TRUE //This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually @@ -330,17 +330,17 @@ default behaviour is: set_damage(OXY, 0) set_damage(CLONE, 0) set_damage(BRAIN, 0) - set_status(STAT_PARA, 0) - set_status(STAT_STUN, 0) - set_status(STAT_WEAK, 0) + set_status_condition(STAT_PARA, 0) + set_status_condition(STAT_STUN, 0) + set_status_condition(STAT_WEAK, 0) // shut down ongoing problems radiation = 0 bodytemperature = get_species()?.body_temperature || initial(bodytemperature) reset_genetic_conditions() - // fix all status conditions including blind/deaf - clear_status_effects() + // clear all status conditions including blind/deaf + clear_status_conditions() heal_overall_damage(get_damage(BRUTE), get_damage(BURN)) @@ -427,7 +427,7 @@ default behaviour is: continue var/icon/DI var/use_colour = (BP_IS_PROSTHETIC(O) ? SYNTH_BLOOD_COLOR : O.species.get_species_blood_color(src)) - var/cache_index = "[O.damage_state]/[O.bodytype.uid]/[O.icon_state]/[use_colour]/[O.species.name]" + var/cache_index = "[O.damage_state]/[O.bodytype.uid]/[O.icon_state]/[use_colour]/[O.species.uid]" if(!(cache_index in damage_icon_parts)) var/damage_overlay_icon = O.bodytype.get_damage_overlays(src) if(check_state_in_icon(O.damage_state, damage_overlay_icon)) @@ -708,9 +708,6 @@ default behaviour is: return TRUE return FALSE -/mob/living/human/canUnEquip(obj/item/I) - . = ..() && !(I in get_organs()) - /mob/proc/can_be_possessed_by(var/mob/observer/ghost/possessor) return istype(possessor) && possessor.client @@ -745,48 +742,14 @@ default behaviour is: to_chat(src, "Remember to stay in character for a mob of this type!") return 1 -/mob/proc/add_aura(var/obj/aura/aura, skip_icon_update = FALSE) - return FALSE - -/mob/living/add_aura(var/obj/aura/aura, skip_icon_update = FALSE) - if(ispath(aura)) - aura = new aura(src) - if(!istype(aura)) - return FALSE - LAZYDISTINCTADD(auras,aura) - if(!skip_icon_update) - update_icon() - return TRUE - -/mob/proc/has_aura(aura_type) - return FALSE - -/mob/living/has_aura(aura_type) - return length(auras) && (locate(aura_type) in auras) - -/mob/proc/remove_aura(var/obj/aura/aura, skip_icon_update = FALSE) - return FALSE - -/mob/living/remove_aura(var/obj/aura/aura, skip_icon_update = FALSE) - if(ispath(aura)) - aura = locate() in auras - if(!istype(aura)) - return FALSE - LAZYREMOVE(auras,aura) - if(!skip_icon_update) - update_icon() - return TRUE - /mob/living/Destroy() + clear_mob_modifiers() QDEL_NULL(aiming) QDEL_NULL_LIST(_hallucinations) QDEL_NULL_LIST(aimed_at_by) LAZYCLEARLIST(smell_cooldown) if(stressors) // Do not QDEL_NULL, keys are managed instances. stressors = null - if(auras) - for(var/a in auras) - remove_aura(a) // done in this order so that icon updates aren't triggered once all our organs are obliterated delete_inventory(TRUE) delete_organs() @@ -889,7 +852,7 @@ default behaviour is: if(!HAS_STATUS(src, STAT_PARA) && stat == CONSCIOUS) visible_message(SPAN_DANGER("\The [src] starts having a seizure!")) SET_STATUS_MAX(src, STAT_PARA, rand(8,16)) - set_status(STAT_JITTER, rand(150,200)) + set_status_condition(STAT_JITTER, rand(150,200)) take_damage(rand(50, 60), PAIN) /mob/living/proc/get_digestion_product() @@ -906,6 +869,14 @@ default behaviour is: return I.get_flash_mod() return get_bodytype()?.eye_flash_mod +/mob/living/proc/get_flash_burn() + var/vision_organ_tag = get_vision_organ_tag() + if(vision_organ_tag) + var/obj/item/organ/internal/eyes/I = get_organ(vision_organ_tag, /obj/item/organ/internal/eyes) + if(I) + return I.get_flash_burn() + return get_bodytype()?.eye_flash_burn + /mob/living/proc/eyecheck() var/total_protection = flash_protection if(should_have_organ(BP_EYES)) @@ -981,9 +952,9 @@ default behaviour is: if(user != src) to_chat(user, SPAN_NOTICE("\The [src] scans the writing...")) if(skill_check(SKILL_LITERACY, SKILL_BASIC)) - if(skip_delays || do_after(src, 1 SECOND, user)) + if(skip_delays || do_mob(user, src, 1 SECOND)) . = stars(text_content, 85) - else if(skip_delays || do_after(src, 3 SECONDS, user)) + else if(skip_delays || do_mob(user, src, 3 SECONDS)) . = ..() /mob/living/handle_writing_literacy(var/mob/user, var/text_content, var/skip_delays) @@ -1608,21 +1579,21 @@ default behaviour is: if(!use_move_trail) return - var/decl/material/contaminant_type = source.coating.reagent_volumes[1] // take [1] instead of primary reagent to match what remove_any will probably remove - if(!T.can_show_coating_footprints(contaminant_type)) + var/decl/material/contaminant = source.coating.reagent_volumes[1] // take [1] instead of primary reagent to match what remove_any will probably remove + if(!T.can_show_coating_footprints(contaminant)) return /// An associative list of DNA unique enzymes -> blood type. Used by forensics, mostly. var/list/bloodDNA = list() var/track_color - var/list/source_data = REAGENT_DATA(source.coating, contaminant_type) + var/list/source_data = REAGENT_DATA(source.coating, contaminant) if(source_data && source_data[DATA_BLOOD_DNA] && source_data[DATA_BLOOD_TYPE]) bloodDNA = list(source_data[DATA_BLOOD_DNA] = source_data[DATA_BLOOD_TYPE]) track_color = source.coating.get_color() - T.AddTracks(use_move_trail, bloodDNA, dir, 0, track_color, contaminant_type) // Coming + T.AddTracks(use_move_trail, bloodDNA, dir, 0, track_color, contaminant.type) // Coming if(isturf(old_loc)) var/turf/old_turf = old_loc - if(old_turf.can_show_coating_footprints(contaminant_type)) - old_turf.AddTracks(use_move_trail, bloodDNA, 0, dir, track_color, contaminant_type) // Going + if(old_turf.can_show_coating_footprints(contaminant)) + old_turf.AddTracks(use_move_trail, bloodDNA, 0, dir, track_color, contaminant.type) // Going source.remove_coating(1) update_equipment_overlay(slot_shoes_str) @@ -1726,20 +1697,28 @@ default behaviour is: return range * range - 0.333 return range -/mob/living/handle_flashed(var/flash_strength) +/mob/living/handle_flashed(var/flash_strength, do_stun = TRUE) var/safety = eyecheck() - if(safety >= FLASH_PROTECTION_MODERATE || flash_strength <= 0) // May be modified by human proc. + var/flash_burn = get_flash_burn() + var/flash_mod = get_flash_mod() + + if(safety >= FLASH_PROTECTION_MODERATE || flash_strength <= 0 || flash_mod <= 0) // May be modified by human proc. return FALSE flash_eyes(FLASH_PROTECTION_MODERATE - safety) - SET_STATUS_MAX(src, STAT_STUN, (flash_strength / 2)) + if(do_stun) + SET_STATUS_MAX(src, STAT_STUN, (flash_strength / 2)) SET_STATUS_MAX(src, STAT_BLURRY, flash_strength) SET_STATUS_MAX(src, STAT_CONFUSE, (flash_strength + 2)) + + if(flash_burn > 0) + apply_damage(flash_strength * flash_burn/5, BURN, BP_HEAD, used_weapon = "Photon burns") if(flash_strength > 3) drop_held_items() if(flash_strength > 5) SET_STATUS_MAX(src, STAT_WEAK, 2) + return TRUE /mob/living/verb/showoff() set name = "Show Held Item" @@ -2024,3 +2003,5 @@ default behaviour is: pulling_punches = !pulling_punches to_chat(src, SPAN_NOTICE("You are now [pulling_punches ? "pulling your punches" : "not pulling your punches"].")) +/mob/living/is_cloaked() + return has_mob_modifier(/decl/mob_modifier/cloaked) diff --git a/code/modules/mob/living/living_appearance.dm b/code/modules/mob/living/living_appearance.dm index ea2bb37147ee..0b34b88f1405 100644 --- a/code/modules/mob/living/living_appearance.dm +++ b/code/modules/mob/living/living_appearance.dm @@ -10,17 +10,6 @@ SHOULD_CALL_PARENT(TRUE) ..() cut_overlays() - if(auras) - var/decl/bodytype/my_bodytype = get_bodytype() - for(var/obj/aura/aura as anything in auras) - var/image/A = new() - A.appearance = aura - if(my_bodytype) - if(my_bodytype.pixel_offset_x) - A.pixel_x += -(my_bodytype.pixel_offset_x) - if(my_bodytype.pixel_offset_y) - A.pixel_y += -(my_bodytype.pixel_offset_y) - add_overlay(A) try_refresh_visible_overlays() /mob/living/proc/set_organ_sprite_accessory(var/accessory_type, var/accessory_category, var/accessory_metadata, var/organ_tag, var/skip_update = FALSE) @@ -77,3 +66,24 @@ /mob/living/get_current_mob_underlay(var/underlay_layer) return mob_underlays[underlay_layer] + +/mob/living/refresh_visible_overlays() + . = ..() + var/list/modifier_overlays = null + for(var/decl/mob_modifier/archetype in _mob_modifiers) + var/image/status_overlay = archetype.get_modifier_mob_overlay(src) + if(status_overlay) + LAZYADD(modifier_overlays, status_overlay) + set_current_mob_overlay(HO_EFFECT_LAYER, modifier_overlays, FALSE) + +/decl/mob_modifier/proc/get_modifier_mob_overlay(mob/living/_owner) + if(!mob_overlay_icon || !mob_overlay_state || !istype(_owner)) + return null + var/image/mob_overlay = overlay_image(mob_overlay_icon, mob_overlay_state, COLOR_WHITE, RESET_COLOR) + var/decl/bodytype/owner_bodytype = _owner.get_bodytype() + if(owner_bodytype) + if(owner_bodytype.pixel_offset_x) + mob_overlay.pixel_x += -(owner_bodytype.pixel_offset_x) + if(owner_bodytype.pixel_offset_y) + mob_overlay.pixel_y += -(owner_bodytype.pixel_offset_y) + return mob_overlay diff --git a/code/modules/mob/living/living_attackhand.dm b/code/modules/mob/living/living_attackhand.dm index 52a96d71282c..52cce7e49af7 100644 --- a/code/modules/mob/living/living_attackhand.dm +++ b/code/modules/mob/living/living_attackhand.dm @@ -103,8 +103,7 @@ uniform.add_fingerprint(user) // They're SSD, so permanently asleep. - var/show_ssd = get_species_name() - if(show_ssd && ssd_check()) + if(ssd_check() && get_species()?.get_ssd(src)) user.visible_message( SPAN_NOTICE("\The [user] shakes \the [src] trying to wake [pronouns.him] up!"), SPAN_NOTICE("You shake \the [src], but they do not respond...") diff --git a/code/modules/mob/living/living_blood.dm b/code/modules/mob/living/living_blood.dm index 7226b46c66c8..dffee4ed0dcc 100644 --- a/code/modules/mob/living/living_blood.dm +++ b/code/modules/mob/living/living_blood.dm @@ -18,10 +18,10 @@ data[DATA_BLOOD_SPECIES] = species_name var/list/temp_chem = list() - for(var/R in reagents?.reagent_volumes) - temp_chem[R] = REAGENT_VOLUME(reagents, R) + for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + temp_chem[reagent.type] = REAGENT_VOLUME(reagents, reagent) data[DATA_BLOOD_TRACE_CHEM] = temp_chem - data[DATA_BLOOD_DOSE_CHEM] = chem_doses?.Copy() || list() + data[DATA_BLOOD_DOSE_CHEM] = _chem_doses?.Copy() || list() if(isSynthetic()) data[DATA_BLOOD_HAS_OXY] = FALSE diff --git a/code/modules/mob/living/living_breath.dm b/code/modules/mob/living/living_breath.dm index 164a8503215e..69241dac54ae 100644 --- a/code/modules/mob/living/living_breath.dm +++ b/code/modules/mob/living/living_breath.dm @@ -15,39 +15,49 @@ /mob/living/proc/should_breathe() return ((life_tick % 2) == 0 || failed_last_breath || is_asystole()) -/mob/living/proc/try_breathe() +// These procs all have a lung organ as an argument to avoid having to do repeated get_bodytype and get_organ calls. +// It's a small optimization but it adds up if you have a lot of mobs breathing. + +/// This proc contains all of the logic for returning a gasmix datum to be used in other breath-related code. +/// Does not necessarily involve inhaling at all; that's obtain_new_breath()'s job. +/mob/living/proc/get_breath(obj/item/organ/internal/lungs/lungs) + // Handle optional pre-breath logic. If it returns TRUE, skip the breath entirely. + if(handle_pre_breath(lungs)) + return null + return obtain_new_breath(lungs) + +/// Return a gasmix representing newly-inhaled air. +/mob/living/proc/obtain_new_breath(obj/item/organ/internal/lungs/lungs) + var/static/datum/gas_mixture/vacuum = new //avoid having to create a new gas mixture for each breath in space + //Okay, we can breathe, now check if we can get air + var/volume_needed = get_breath_volume() + //First check for air from internals, then the local environment, then use vacuum + return get_breath_from_internal(volume_needed) || get_breath_from_environment(volume_needed) || vacuum + +/// Handles pre-breath checks. If this proc returns TRUE, breathing is skipped that tick. +/mob/living/proc/handle_pre_breath(obj/item/organ/internal/lungs/lungs) + //Check if we can breathe at all + if(handle_drowning() || (is_asystole() && !GET_CHEMICAL_EFFECT(src, CE_STABLE) && lungs.active_breathing)) //crit aka circulatory shock + . = TRUE + else if(suffocation_counter > 0) + // We aren't drowning or in asystole, but something else is suffocating us, so lower the counter and don't take a breath + suffocation_counter-- + . = TRUE + if(.) + // Gasp on average every 10 ticks + if (prob(10) && !is_asystole() && lungs.active_breathing) + INVOKE_ASYNC(src, PROC_REF(emote), /decl/emote/audible/gasp) + return TRUE + return FALSE // not handled, proceed with breathing +/mob/living/proc/try_breathe() var/decl/bodytype/root_bodytype = get_bodytype() if(!root_bodytype?.breathing_organ) return - - var/active_breathe = FALSE var/obj/item/organ/internal/lungs/lungs = get_organ(root_bodytype.breathing_organ, /obj/item/organ/internal/lungs) - if(lungs) - active_breathe = lungs.active_breathing - - var/datum/gas_mixture/breath = null - //First, check if we can breathe at all - if(handle_drowning() || (is_asystole() && !GET_CHEMICAL_EFFECT(src, CE_STABLE) && active_breathe)) //crit aka circulatory shock - ticks_since_last_successful_breath = max(2, ticks_since_last_successful_breath + 1) - - if(ticks_since_last_successful_breath>0) //Suffocating so do not take a breath - ticks_since_last_successful_breath-- - if (prob(10) && !is_asystole() && active_breathe) //Gasp per 10 ticks? Sounds about right. - INVOKE_ASYNC(src, PROC_REF(emote), "gasp") - else - //Okay, we can breathe, now check if we can get air - var/volume_needed = get_breath_volume() - breath = get_breath_from_internal(volume_needed) //First, check for air from internals - if(!breath) - breath = get_breath_from_environment(volume_needed) //No breath from internals so let's try to get air from our location - if(!breath) - var/static/datum/gas_mixture/vacuum //avoid having to create a new gas mixture for each breath in space - if(!vacuum) vacuum = new - breath = vacuum //still nothing? must be vacuum - + var/datum/gas_mixture/breath = get_breath(lungs) //if breath is null or vacuum, the lungs will handle it for us - failed_last_breath = (!lungs || nervous_system_failure()) ? 1 : lungs.handle_owner_breath(breath) + failed_last_breath = (!lungs || nervous_system_failure()) ? TRUE : lungs.handle_owner_breath(breath) handle_post_breath(breath) /mob/living/proc/get_breath_from_environment(var/volume_needed=STD_BREATH_VOLUME, var/atom/location = src.loc) @@ -135,7 +145,6 @@ . *= (!BP_IS_PROSTHETIC(heart)) ? get_pulse()/PULSE_NORM : 1.5 /mob/living/proc/handle_post_breath(datum/gas_mixture/breath) - if(!breath) return diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index f6b7d220a18d..a870b6c2c263 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -60,28 +60,6 @@ /mob/living/get_bullet_impact_effect_type(var/def_zone) return BULLET_IMPACT_MEAT -/mob/living/proc/aura_check(var/type) - if(!auras) - return TRUE - . = TRUE - var/list/newargs = args - args[1] - for(var/obj/aura/aura as anything in auras) - var/result = 0 - switch(type) - if(AURA_TYPE_WEAPON) - result = aura.attackby(arglist(newargs)) - if(AURA_TYPE_BULLET) - result = aura.bullet_act(arglist(newargs)) - if(AURA_TYPE_THROWN) - result = aura.hitby(arglist(newargs)) - if(AURA_TYPE_LIFE) - result = aura.life_tick() - if(result & AURA_FALSE) - . = FALSE - if(result & AURA_CANCEL) - break - - //Handles the effects of "stun" weapons /mob/living/proc/stun_effect_act(stun_amount, agony_amount, def_zone, used_weapon) flash_pain() @@ -93,7 +71,7 @@ apply_effect(stun_amount, EYE_BLUR) if (agony_amount) - apply_damage(agony_amount, PAIN, def_zone, used_weapon) + apply_damage(agony_amount, PAIN, def_zone = def_zone, used_weapon = used_weapon) apply_effect(agony_amount/10, STUTTER) apply_effect(agony_amount/10, EYE_BLUR) @@ -139,7 +117,7 @@ if(31 to INFINITY) SET_STATUS_MAX(src, STAT_WEAK, 10) //This should work for now, more is really silly and makes you lay there forever - set_status(STAT_JITTER, min(shock_damage*5, 200)) + set_status_condition(STAT_JITTER, min(shock_damage*5, 200)) spark_at(loc, amount=5, cardinal_only = TRUE) @@ -159,9 +137,9 @@ if(I.attack_message_name()) weapon_mention = " with [I.attack_message_name()]" if(effective_force) - visible_message(SPAN_DANGER("\The [src] has been [DEFAULTPICK(I.attack_verb, "attacked")][weapon_mention] by \the [user]!")) + visible_message(SPAN_DANGER("\The [src] has been [I.pick_attack_verb()][weapon_mention] by \the [user]!")) else - visible_message(SPAN_WARNING("\The [src] has been [DEFAULTPICK(I.attack_verb, "attacked")][weapon_mention] by \the [user]!")) + visible_message(SPAN_WARNING("\The [src] has been [I.pick_attack_verb()][weapon_mention] by \the [user]!")) . = standard_weapon_hit_effects(I, user, effective_force, hit_zone) if(I.atom_damage_type == BRUTE && prob(33)) blood_splatter(get_turf(loc), src) @@ -192,7 +170,7 @@ SET_STATUS_MAX(M, STAT_WEAK, rand(4,8)) M.visible_message(SPAN_DANGER("\The [M] collides with \the [src]!")) - if(!aura_check(AURA_TYPE_THROWN, AM, TT.speed)) + if(mob_modifiers_block_attack(MM_ATTACK_TYPE_THROWN, AM, TT.speed)) return FALSE if(istype(AM, /obj)) @@ -402,3 +380,13 @@ if(shield.handle_shield(src, damage, damage_source, attacker, def_zone, attack_text)) return TRUE return FALSE + +/mob/living/mob_modifiers_block_attack(attack_type, atom/movable/attacker, additional_data) + . = FALSE + if(length(_mob_modifiers)) + for(var/decl/mob_modifier/archetype in _mob_modifiers) + var/result = archetype.check_modifiers_block_attack(src, _mob_modifiers[archetype], attack_type, attacker, additional_data) + if(result & MM_ATTACK_RESULT_DEFLECTED) + . = TRUE + if(result & MM_ATTACK_RESULT_BLOCKED) + break diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index b7ae767787e1..7e4130763a12 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -7,6 +7,7 @@ //Health and life related vars max_health = 100 //Maximum health that should be possible. current_health = INFINITY // A mob's current health. Set by update_health(). Defaults to INFINITY so mobs don't die on init. + skillset = /datum/skillset // moved here from /mob to avoid giving dview a skillset var/hud_updateflag = 0 @@ -33,12 +34,14 @@ VAR_PRIVATE/_on_fire = FALSE VAR_PRIVATE/_fire_intensity - var/ticks_since_last_successful_breath = 0 //if we failed to breathe last tick - var/failed_last_breath = FALSE //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks. - var/possession_candidate = FALSE // Can be possessed by ghosts if unplayed. + /// A suffocation counter representing the number of ticks we should fail to breathe. + var/suffocation_counter = 0 + /// This is used to determine if the mob failed a breath. If they did fail a breath, they will attempt to breathe each tick, otherwise just once per 4 ticks. + var/failed_last_breath = FALSE + /// Can be possessed by ghosts if unplayed. + var/possession_candidate = FALSE var/job = null//Living - var/list/obj/aura/auras = null //Basically a catch-all aura/force-field thing. var/last_resist = 0 var/admin_paralyzed = FALSE @@ -47,7 +50,7 @@ var/jumping = FALSE var/list/chem_effects - var/list/chem_doses + var/list/_chem_doses var/last_pain_message var/next_pain_time = 0 @@ -56,8 +59,6 @@ var/list/stressors var/life_tick - var/list/stasis_sources - var/stasis_value var/nutrition = 400 var/hydration = 400 diff --git a/code/modules/mob/living/living_genetics.dm b/code/modules/mob/living/living_genetics.dm index c33da0160f90..1595be199f1f 100644 --- a/code/modules/mob/living/living_genetics.dm +++ b/code/modules/mob/living/living_genetics.dm @@ -30,7 +30,7 @@ LAZYDISTINCTADD(_genetic_conditions, condition) if(temporary_time) // TODO: some kind of world.time key or parameter so overlapping calls don't remove each other. - addtimer(CALLBACK(src, TYPE_PROC_REF(/mob/living, remove_genetic_condition)), temporary_time) + addtimer(CALLBACK(src, TYPE_PROC_REF(/mob/living, remove_genetic_condition), condition_type), temporary_time) queue_genetic_condition_update() return TRUE return FALSE diff --git a/code/modules/mob/living/living_give.dm b/code/modules/mob/living/living_give.dm index c4c6005de68c..724a5af6cf98 100644 --- a/code/modules/mob/living/living_give.dm +++ b/code/modules/mob/living/living_give.dm @@ -21,7 +21,7 @@ to_chat(usr, SPAN_WARNING("You can't give someone a grab.")) return usr.visible_message(SPAN_NOTICE("\The [usr] holds out \the [I] to \the [target]."), SPAN_NOTICE("You hold out \the [I] to \the [target], waiting for them to accept it.")) - if(alert(target,"[src] wants to give you \a [I]. Will you accept it?",,"No","Yes") == "No") + if(alert(target,"[src] wants to give you \a [I]. Will you accept it?",,"Yes","No") == "No") target.visible_message(SPAN_NOTICE("\The [src] tried to hand \the [I] to \the [target], \ but \the [target] didn't want it.")) return diff --git a/code/modules/mob/living/living_organs.dm b/code/modules/mob/living/living_organs.dm index dce22c9a9933..8617ed077091 100644 --- a/code/modules/mob/living/living_organs.dm +++ b/code/modules/mob/living/living_organs.dm @@ -11,10 +11,10 @@ /mob/living/proc/has_internal_organs() return LAZYLEN(get_internal_organs()) > 0 -/mob/living/get_contained_matter() +/mob/living/get_contained_matter(include_reagents = TRUE) . = ..() for(var/obj/item/organ in get_organs()) - . = MERGE_ASSOCS_WITH_NUM_VALUES(., organ.get_contained_matter()) + . = MERGE_ASSOCS_WITH_NUM_VALUES(., organ.get_contained_matter(include_reagents)) //Can be called when we want to add an organ in a detached state or an attached state. /mob/living/proc/add_organ(var/obj/item/organ/O, var/obj/item/organ/external/affected = null, var/in_place = FALSE, var/update_icon = TRUE, var/detached = FALSE, var/skip_health_update = FALSE) diff --git a/code/modules/mob/living/living_status.dm b/code/modules/mob/living/living_status.dm index 645b53234486..179412f6a7a7 100644 --- a/code/modules/mob/living/living_status.dm +++ b/code/modules/mob/living/living_status.dm @@ -1,9 +1,13 @@ -/mob // Defined on /mob to avoid having to pass args to every single attack_foo() proc. +// Defined on /mob to avoid having to pass args to every single attack_foo() proc. +/mob + // A STATUS CONDITION is a counter on an general incapacitating effect like sleep or blindness. + // STATUS CONDITION TRACKERS: var/list/status_counters var/list/pending_status_counters var/datum/status_marker_holder/status_markers -/mob/living/set_status(var/condition, var/amount) +// Status condition procs: +/mob/living/set_status_condition(var/condition, var/amount) if(QDELETED(src)) return FALSE if(!ispath(condition, /decl/status_condition)) @@ -57,7 +61,7 @@ var/decl/status_condition/status = GET_DECL(condition) status.handle_changed_amount(src, new_amount, last_amount) -/mob/living/handle_status_effects() +/mob/living/handle_status_conditions() . = ..() var/refresh_icon = FALSE for(var/condition in status_counters) @@ -66,13 +70,18 @@ if(GET_STATUS(src, condition) <= 0) status_counters -= condition refresh_icon = TRUE + if(status.associated_mob_modifier) + remove_mob_modifier(status.associated_mob_modifier, source = src) + else if(status.associated_mob_modifier) + add_mob_modifier(status.associated_mob_modifier, source = src) + if(refresh_icon) update_icon() -/mob/living/clear_status_effects() +/mob/living/clear_status_conditions() var/had_counters = !!LAZYLEN(status_counters) for(var/stype in status_counters) - set_status(stype, 0) + set_status_condition(stype, 0) status_counters = null pending_status_counters = null if(had_counters) diff --git a/code/modules/mob/living/living_tail.dm b/code/modules/mob/living/living_tail.dm index 209b671d5781..a18bd6148c4e 100644 --- a/code/modules/mob/living/living_tail.dm +++ b/code/modules/mob/living/living_tail.dm @@ -21,6 +21,7 @@ if(suit && (suit.flags_inv & HIDETAIL)) set_current_mob_overlay(HO_TAIL_LAYER, null, FALSE) set_current_mob_underlay(HU_TAIL_LAYER, null, update_icons) + return var/icon/tail_s = get_tail_icon_for_organ(tail_organ, tail_state) if(!tail_s) @@ -30,10 +31,10 @@ var/tail_image = image(tail_s, tail_state) if(dir == NORTH) set_current_mob_underlay(HU_TAIL_LAYER, null, FALSE) - set_current_mob_overlay(HO_TAIL_LAYER, tail_image, update_icons) + set_current_mob_overlay(HO_TAIL_LAYER, tail_image, FALSE) else set_current_mob_overlay(HO_TAIL_LAYER, null, FALSE) - set_current_mob_underlay(HU_TAIL_LAYER, tail_image, update_icons) + set_current_mob_underlay(HU_TAIL_LAYER, tail_image, FALSE) if(update_icons) update_icon() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 230f370eda24..b487dfc897c4 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -549,12 +549,12 @@ var/global/list/custom_ai_icons_by_ckey_and_name = list() camera_light_on = world.timeofday + 1 * 20 // Update the light every 2 seconds. -/mob/living/silicon/ai/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/aicard)) - var/obj/item/aicard/card = W +/mob/living/silicon/ai/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/aicard)) + var/obj/item/aicard/card = used_item card.grab_ai(src, user) - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) if(anchored) user.visible_message("\The [user] starts to unbolt \the [src] from the plating...") if(!do_after(user,40, src)) @@ -571,9 +571,9 @@ var/global/list/custom_ai_icons_by_ckey_and_name = list() user.visible_message("\The [user] finishes fastening down \the [src]!") anchored = TRUE return TRUE - if(try_stock_parts_install(W, user)) + if(try_stock_parts_install(used_item, user)) return TRUE - if(try_stock_parts_removal(W, user)) + if(try_stock_parts_removal(used_item, user)) return TRUE return ..() diff --git a/code/modules/mob/living/silicon/ai/laws.dm b/code/modules/mob/living/silicon/ai/laws.dm index c1dba7c7b1c4..2fb329fc4b80 100644 --- a/code/modules/mob/living/silicon/ai/laws.dm +++ b/code/modules/mob/living/silicon/ai/laws.dm @@ -18,9 +18,9 @@ /mob/living/silicon/ai/add_ion_law(var/law) ..() - for(var/mob/living/silicon/robot/R in global.silicon_mob_list) - if(R.lawupdate && (R.connected_ai == src)) - R.show_laws() + for(var/mob/living/silicon/robot/robot in global.silicon_mob_list) + if(robot.lawupdate && (robot.connected_ai == src)) + robot.show_laws() /mob/living/silicon/ai/proc/ai_checklaws() set category = "Silicon Commands" diff --git a/code/modules/mob/living/silicon/login.dm b/code/modules/mob/living/silicon/login.dm index 3ff4653c93df..9f5a88f6cd1f 100644 --- a/code/modules/mob/living/silicon/login.dm +++ b/code/modules/mob/living/silicon/login.dm @@ -1,3 +1,3 @@ /mob/living/silicon/Login() ..() - set_status(STAT_ASLEEP, 0) + set_status_condition(STAT_ASLEEP, 0) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 49224c032f54..db413c265061 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -275,24 +275,24 @@ var/global/list/possible_say_verbs = list( icon_state = "[icon_state]-rest" //Overriding this will stop a number of headaches down the track. -/mob/living/silicon/pai/attackby(obj/item/W, mob/user) - var/obj/item/card/id/card = W.GetIdCard() +/mob/living/silicon/pai/attackby(obj/item/used_item, mob/user) + var/obj/item/card/id/card = used_item.GetIdCard() if(card && user.check_intent(I_FLAG_HELP)) var/list/new_access = card.GetAccess() idcard.access = new_access - visible_message("[user] slides [W] across [src].") + visible_message("[user] slides [used_item] across [src].") to_chat(src, SPAN_NOTICE("Your access has been updated!")) return FALSE // don't continue processing click callstack. - if(try_stock_parts_install(W, user)) + if(try_stock_parts_install(used_item, user)) return TRUE - if(try_stock_parts_removal(W, user)) + if(try_stock_parts_removal(used_item, user)) return TRUE - var/force = W.expend_attack_force(user) + var/force = used_item.expend_attack_force(user) if(force) - visible_message(SPAN_DANGER("[user] attacks [src] with [W]!")) + visible_message(SPAN_DANGER("[user] attacks [src] with [used_item]!")) take_damage(force) else - visible_message(SPAN_WARNING("[user] bonks [src] harmlessly with [W].")) + visible_message(SPAN_WARNING("[user] bonks [src] harmlessly with [used_item].")) spawn(1) if(stat != DEAD) fold() diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index b53b8a9cfe2d..058e882d06b5 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -38,16 +38,15 @@ var/global/list/default_pai_software = list() /mob/living/silicon/pai/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1) if(user != src || !istype(card)) - if(ui) - ui.set_status(STATUS_CLOSE, 0) + ui?.set_nano_status(STATUS_CLOSE, 0) return if(ui_key != "main") var/datum/pai_software/S = software[ui_key] if(S && !S.toggle) S.on_ui_interact(src, ui, force_open) - else - if(ui) ui.set_status(STATUS_CLOSE, 0) + else if(ui) + ui.set_nano_status(STATUS_CLOSE, 0) return var/data[0] diff --git a/code/modules/mob/living/silicon/robot/component.dm b/code/modules/mob/living/silicon/robot/component.dm index 137c8c9fd44d..3d4a7b1000d8 100644 --- a/code/modules/mob/living/silicon/robot/component.dm +++ b/code/modules/mob/living/silicon/robot/component.dm @@ -19,8 +19,8 @@ /// The wrapped device(e.g. radio), only set if external_type isn't null var/obj/item/wrapped -/datum/robot_component/New(mob/living/silicon/robot/R) - src.owner = R +/datum/robot_component/New(mob/living/silicon/robot/robot) + src.owner = robot /datum/robot_component/proc/accepts_component(var/obj/item/thing) . = istype(thing, external_type) diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index c1b984b8a6d5..bae0e605b0aa 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -166,14 +166,14 @@ return //Drones cannot be upgraded with borg modules so we need to catch some items before they get used in ..(). -/mob/living/silicon/robot/drone/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/borg/upgrade)) - to_chat(user, "\The [src] is not compatible with \the [W].") +/mob/living/silicon/robot/drone/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/borg/upgrade)) + to_chat(user, "\The [src] is not compatible with \the [used_item].") return TRUE - else if(IS_CROWBAR(W) && !user.check_intent(I_FLAG_HARM)) + else if(IS_CROWBAR(used_item) && !user.check_intent(I_FLAG_HARM)) to_chat(user, "\The [src] is hermetically sealed. You can't open the case.") return TRUE - else if (istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer)) + else if (istype(used_item, /obj/item/card/id)||istype(used_item, /obj/item/modular_computer)) if(stat == DEAD) if(!get_config_value(/decl/config/toggle/on/allow_drone_spawn) || emagged || should_be_dead()) //It's dead, Dave. to_chat(user, "The interface is fried, and a distressing burned smell wafts from the robot's interior. You're not rebooting this one.") @@ -311,14 +311,10 @@ /mob/living/silicon/robot/drone/construction/welcome_drone() to_chat(src, "You are a construction drone, an autonomous engineering and fabrication system..") - to_chat(src, "You are assigned to a Sol Central construction project. The name is irrelevant. Your task is to complete construction and subsystem integration as soon as possible.") + to_chat(src, "You are assigned to a construction project. The name is irrelevant. Your task is to complete construction and subsystem integration as soon as possible.") to_chat(src, "Use :d to talk to other drones and say to speak silently to your nearby fellows.") to_chat(src, "You do not follow orders from anyone; not the AI, not humans, and not other synthetics..") -/mob/living/silicon/robot/drone/construction/init() - ..() - flavor_text = "It's a bulky construction drone stamped with a Sol Central glyph." - /proc/too_many_active_drones() var/drones = 0 for(var/mob/living/silicon/robot/drone/D in global.silicon_mob_list) 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 ff180bd1016f..b56da846f44a 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm @@ -342,18 +342,19 @@ else continue - for(var/obj/W in T) + // TODO: Jesus Christ, use matter or the procs the decompiler nades use. + for(var/obj/thing in T) //Different classes of items give different commodities. - if(istype(W,/obj/item/trash/cigbutt)) + if(istype(thing,/obj/item/trash/cigbutt)) if(plastic) plastic.add_charge(500) - else if(istype(W,/obj/effect/spider/spiderling)) + else if(istype(thing,/obj/effect/spider/spiderling)) if(wood) wood.add_charge(2000) if(plastic) plastic.add_charge(2000) - else if(istype(W,/obj/item/light)) - var/obj/item/light/L = W + else if(istype(thing,/obj/item/light)) + var/obj/item/light/L = thing if(L.status >= 2) if(metal) metal.add_charge(250) @@ -361,100 +362,45 @@ glass.add_charge(250) else continue - else if(istype(W,/obj/item/remains/robot)) + else if(istype(thing,/obj/item/remains/robot)) if(metal) metal.add_charge(2000) if(plastic) plastic.add_charge(2000) if(glass) glass.add_charge(1000) - else if(istype(W,/obj/item/trash)) + else if(istype(thing,/obj/item/trash)) if(metal) metal.add_charge(1000) if(plastic) plastic.add_charge(3000) - else if(istype(W,/obj/effect/decal/cleanable/blood/gibs/robot)) + else if(istype(thing,/obj/effect/decal/cleanable/blood/gibs/robot)) if(metal) metal.add_charge(2000) if(glass) glass.add_charge(2000) - else if(istype(W,/obj/item/ammo_casing)) + else if(istype(thing,/obj/item/ammo_casing)) if(metal) metal.add_charge(1000) - else if(istype(W,/obj/item/shard/shrapnel)) + else if(istype(thing,/obj/item/shard/shrapnel)) if(metal) metal.add_charge(1000) - else if(istype(W,/obj/item/shard)) + else if(istype(thing,/obj/item/shard)) if(glass) glass.add_charge(1000) - else if(istype(W,/obj/item/food/grown)) + else if(istype(thing,/obj/item/food/grown)) if(wood) wood.add_charge(4000) - else if(istype(W,/obj/item/pipe)) + else if(istype(thing,/obj/item/pipe)) // This allows drones and engiborgs to clear pipe assemblies from floors. pass() else continue - qdel(W) + qdel(thing) grabbed_something = 1 if(grabbed_something) to_chat(user, "You deploy your decompiler and clear out the contents of \the [T].") else to_chat(user, "Nothing on \the [T] is useful to you.") - return - -//PRETTIER TOOL LIST. -/mob/living/silicon/robot/drone/installed_modules() - - if(weapon_lock) - to_chat(src, "Weapon lock active, unable to use modules! Count:[weaponlock_time]") - return - - if(!module) - module = new /obj/item/robot_module/drone(src) - - var/dat = "Drone modules\n" - dat += {" - Activated Modules -
    - Module 1: [module_state_1 ? "[module_state_1]" : "No Module"]
    - Module 2: [module_state_2 ? "
    [module_state_2]" : "No Module"]
    - Module 3: [module_state_3 ? "
    [module_state_3]" : "No Module"]
    -
    - Installed Modules

    "} - - - var/tools = "Tools and devices
    " - var/resources = "
    Resources
    " - - for (var/O in module.equipment) - - var/module_string = "" - - if (!O) - module_string += text("Resource depleted
    ") - else if(activated(O)) - module_string += text("[O]: Activated
    ") - else - module_string += text("[O]:
    Activate
    ") - - if((istype(O,/obj/item) || istype(O,/obj/item)) && !(istype(O,/obj/item/stack/cable_coil))) - tools += module_string - else - resources += module_string - - dat += tools - - if (emagged) - if (!module.emag) - dat += text("Resource depleted
    ") - else if(activated(module.emag)) - dat += text("[module.emag]: Activated
    ") - else - dat += text("[module.emag]: Activate
    ") - - dat += resources - - show_browser(src, dat, "window=robotmod") diff --git a/code/modules/mob/living/silicon/robot/flying/module_flying.dm b/code/modules/mob/living/silicon/robot/flying/module_flying.dm index 5cc0ee8c6ca0..68e682d02e02 100644 --- a/code/modules/mob/living/silicon/robot/flying/module_flying.dm +++ b/code/modules/mob/living/silicon/robot/flying/module_flying.dm @@ -1,3 +1,6 @@ /obj/item/robot_module/flying module_category = ROBOT_MODULE_TYPE_FLYING can_be_pushed = TRUE + has_nonslip_feet = TRUE + has_magnetic_feet = TRUE + diff --git a/code/modules/mob/living/silicon/robot/flying/module_flying_emergency.dm b/code/modules/mob/living/silicon/robot/flying/module_flying_emergency.dm index eb762b5f8ad0..49a95a47aa63 100644 --- a/code/modules/mob/living/silicon/robot/flying/module_flying_emergency.dm +++ b/code/modules/mob/living/silicon/robot/flying/module_flying_emergency.dm @@ -68,7 +68,7 @@ var/obj/item/stack/medical/stack = locate(thing) in equipment stack.synths = list(medicine) -/obj/item/robot_module/flying/emergency/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/flying/emergency/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) var/obj/item/chems/spray/PS = emag if(PS && PS.reagents.total_volume < PS.volume) var/adding = min(PS.volume-PS.reagents.total_volume, 2*amount) diff --git a/code/modules/mob/living/silicon/robot/flying/module_flying_forensics.dm b/code/modules/mob/living/silicon/robot/flying/module_flying_forensics.dm index f90d4d68887a..2a942c74e968 100644 --- a/code/modules/mob/living/silicon/robot/flying/module_flying_forensics.dm +++ b/code/modules/mob/living/silicon/robot/flying/module_flying_forensics.dm @@ -36,7 +36,7 @@ SKILL_ANATOMY = SKILL_ADEPT ) -/obj/item/robot_module/flying/forensics/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/flying/forensics/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) var/obj/item/chems/spray/luminol/luminol = locate() in equipment if(!luminol) luminol = new(src) diff --git a/code/modules/mob/living/silicon/robot/flying/module_flying_repair.dm b/code/modules/mob/living/silicon/robot/flying/module_flying_repair.dm index 259ac5bf9a58..3c6f36ea20c2 100644 --- a/code/modules/mob/living/silicon/robot/flying/module_flying_repair.dm +++ b/code/modules/mob/living/silicon/robot/flying/module_flying_repair.dm @@ -2,7 +2,7 @@ name = "repair drone module" display_name = "Repair" channels = list ("Engineering" = TRUE) - camera_channels = list(CAMERA_CAMERA_CHANNEL_ENGINEERING) + camera_channels = list(CAMERA_CHANNEL_ENGINEERING) software = list( /datum/computer_file/program/power_monitor ) @@ -90,8 +90,8 @@ PL.synths = list(plasteel) . = ..() -/obj/item/robot_module/flying/repair/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/flying/repair/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) var/obj/item/lightreplacer/LR = locate() in equipment if(LR) - LR.Charge(R, amount) + LR.Charge(robot, amount) ..() diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index da4adc553fd5..a7e2e6ff9d65 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -1,260 +1,21 @@ -//These procs handle putting s tuff in your hand. It's probably best to use these rather than setting stuff manually -//as they handle all relevant stuff like adding it to the player's screen and such - -//Returns the thing in our active hand (whatever is in our active module-slot, in this case) or any active grab -/mob/living/silicon/robot/get_active_held_item() - return module_active || (locate(/obj/item/grab) in contents) - -/*-------TODOOOOOOOOOO--------*/ - -//Verbs used by hotkeys. -/mob/living/silicon/robot/verb/cmd_unequip_module() - set name = "unequip-module" - set hidden = 1 - uneq_active() - -/mob/living/silicon/robot/verb/cmd_toggle_module(module as num) - set name = "toggle-module" - set hidden = 1 - toggle_module(module) - -/mob/living/silicon/robot/proc/uneq_active() - if(isnull(module_active)) - return - var/obj/item/borg/sight/borg_sight - if(module_state_1 == module_active) - if(istype(module_state_1,/obj/item/borg/sight)) - borg_sight = module_state_1 - sight_mode &= ~borg_sight.sight_mode - if (client) - client.screen -= module_state_1 - module_state_1.forceMove(module) - module_active = null - module_state_1 = null - inv1.icon_state = "inv1" - else if(module_state_2 == module_active) - if(istype(module_state_2,/obj/item/borg/sight)) - borg_sight = module_state_2 - sight_mode &= ~borg_sight.sight_mode - if (client) - client.screen -= module_state_2 - module_state_2.forceMove(module) - module_active = null - module_state_2 = null - inv2.icon_state = "inv2" - else if(module_state_3 == module_active) - if(istype(module_state_3,/obj/item/borg/sight)) - borg_sight = module_state_3 - sight_mode &= ~borg_sight.sight_mode - if (client) - client.screen -= module_state_3 - module_state_3.forceMove(module) - module_active = null - module_state_3 = null - inv3.icon_state = "inv3" - update_icon() - if(istype(hud_used)) - hud_used.update_robot_modules_display() - -/mob/living/silicon/robot/proc/uneq_all() - module_active = null - - if(module_state_1) - if(istype(module_state_1,/obj/item/borg/sight)) - sight_mode &= ~module_state_1:sight_mode - if (client) - client.screen -= module_state_1 - module_state_1.forceMove(module) - module_state_1 = null - inv1.icon_state = "inv1" - if(module_state_2) - if(istype(module_state_2,/obj/item/borg/sight)) - sight_mode &= ~module_state_2:sight_mode - if (client) - client.screen -= module_state_2 - module_state_2.forceMove(module) - module_state_2 = null - inv2.icon_state = "inv2" - if(module_state_3) - if(istype(module_state_3,/obj/item/borg/sight)) - sight_mode &= ~module_state_3:sight_mode - if (client) - client.screen -= module_state_3 - module_state_3.forceMove(module) - module_state_3 = null - inv3.icon_state = "inv3" - update_icon() - if(istype(hud_used)) - hud_used.update_robot_modules_display() - -/mob/living/silicon/robot/proc/activated(obj/item/O) - if(module_state_1 == O) - return 1 - else if(module_state_2 == O) - return 1 - else if(module_state_3 == O) - return 1 - else - return 0 - -//Helper procs for cyborg modules on the UI. -//These are hackish but they help clean up code elsewhere. - -//module_selected(module) - Checks whether the module slot specified by "module" is currently selected. -/mob/living/silicon/robot/proc/module_selected(var/module) //Module is 1-3 - return module == get_selected_module() - -//module_active(module) - Checks whether there is a module active in the slot specified by "module". -/mob/living/silicon/robot/proc/module_active(var/module) //Module is 1-3 - if(module < 1 || module > 3) return 0 - - switch(module) - if(1) - if(module_state_1) - return 1 - if(2) - if(module_state_2) - return 1 - if(3) - if(module_state_3) - return 1 - return 0 - -//get_selected_module() - Returns the slot number of the currently selected module. Returns 0 if no modules are selected. -/mob/living/silicon/robot/proc/get_selected_module() - if(module_state_1 && module_active == module_state_1) - return 1 - else if(module_state_2 && module_active == module_state_2) - return 2 - else if(module_state_3 && module_active == module_state_3) - return 3 - - return 0 - -//select_module(module) - Selects the module slot specified by "module" -/mob/living/silicon/robot/proc/select_module(var/module) //Module is 1-3 - if(module < 1 || module > 3) return - - if(!module_active(module)) return - - switch(module) - if(1) - if(module_active != module_state_1) - inv1.icon_state = "inv1 +a" - inv2.icon_state = "inv2" - inv3.icon_state = "inv3" - module_active = module_state_1 - return - if(2) - if(module_active != module_state_2) - inv1.icon_state = "inv1" - inv2.icon_state = "inv2 +a" - inv3.icon_state = "inv3" - module_active = module_state_2 - return - if(3) - if(module_active != module_state_3) - inv1.icon_state = "inv1" - inv2.icon_state = "inv2" - inv3.icon_state = "inv3 +a" - module_active = module_state_3 - return - return - -//deselect_module(module) - Deselects the module slot specified by "module" -/mob/living/silicon/robot/proc/deselect_module(var/module) //Module is 1-3 - if(module < 1 || module > 3) return - - switch(module) - if(1) - if(module_active == module_state_1) - inv1.icon_state = "inv1" - module_active = null - return - if(2) - if(module_active == module_state_2) - inv2.icon_state = "inv2" - module_active = null - return - if(3) - if(module_active == module_state_3) - inv3.icon_state = "inv3" - module_active = null - return - return - -//toggle_module(module) - Toggles the selection of the module slot specified by "module". -/mob/living/silicon/robot/proc/toggle_module(var/module) //Module is 1-3 - if(module < 1 || module > 3) return - - if(module_selected(module)) - deselect_module(module) - else - if(module_active(module)) - select_module(module) - else - deselect_module(get_selected_module()) //If we can't do select anything, at least deselect the current module. - return - -//cycle_modules() - Cycles through the list of selected modules. -/mob/living/silicon/robot/proc/cycle_modules() - var/slot_start = get_selected_module() - if(slot_start) deselect_module(slot_start) //Only deselect if we have a selected slot. - - var/slot_num - if(slot_start == 0) - slot_num = 1 - slot_start = 2 - else - slot_num = slot_start + 1 - - while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up. - if(module_active(slot_num)) - select_module(slot_num) - return - slot_num++ - if(slot_num > 3) slot_num = 1 //Wrap around. - - return - -/mob/living/silicon/robot/proc/activate_module(var/obj/item/O) - if(!(locate(O) in module.equipment) && O != src.module.emag) - return - if(activated(O)) - to_chat(src, SPAN_NOTICE("\The [O] is already active.")) - return - if(!module_state_1) - module_state_1 = O - O.hud_layerise() - O.screen_loc = inv1.screen_loc - O.forceMove(src) - if(istype(module_state_1,/obj/item/borg/sight)) - sight_mode |= module_state_1:sight_mode - else if(!module_state_2) - module_state_2 = O - O.hud_layerise() - O.screen_loc = inv2.screen_loc - O.forceMove(src) - if(istype(module_state_2,/obj/item/borg/sight)) - sight_mode |= module_state_2:sight_mode - else if(!module_state_3) - module_state_3 = O - O.hud_layerise() - O.screen_loc = inv3.screen_loc - O.forceMove(src) - if(istype(module_state_3,/obj/item/borg/sight)) - sight_mode |= module_state_3:sight_mode - else - to_chat(src, SPAN_NOTICE("You need to disable a module first!")) - -/mob/living/silicon/robot/put_in_hands(var/obj/item/W) // No hands. - W.forceMove(get_turf(src)) - return 1 - -//Robots don't use inventory slots, so we need to override this. -/mob/living/silicon/robot/canUnEquip(obj/item/I) - if(!I) - return 1 - if((I in module) || (I in src)) //Includes all modules and installed components. - return I.canremove //Will be 0 for modules, but items held by grippers will also be checked here. - return 1 \ No newline at end of file +// Would be nice to use can_unequip_item() but it doesn't have a target param. +/mob/living/silicon/robot/try_unequip(obj/item/I, atom/target, play_dropsound) + if(!module || (target != module && (I in module.equipment))) + return FALSE + return ..() + +/mob/living/silicon/robot/drop_from_inventory(obj/item/dropping_item, atom/target, play_dropsound) + if(module && (dropping_item in module.equipment) && target != module) + return FALSE + . = ..() + if(!QDELETED(dropping_item) && module?.storage && (dropping_item in module.equipment)) + module.storage.handle_item_insertion(src, dropping_item) + +// Always try to redirect drops into our module. +/mob/living/silicon/robot/drop_item(var/atom/Target) + Target = module + return ..() + +// Overriding default drop arg. +/mob/living/silicon/robot/drop_held_items(drop_loc = module) + return ..() diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index ea41b012d303..6dac7f4072c6 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -15,12 +15,10 @@ C.update_power_state() if ( cell && is_component_functioning("power cell") && src.cell.charge > 0 ) - if(src.module_state_1) - cell_use_power(50) // 50W load for every enabled tool TODO: tool-specific loads - if(src.module_state_2) - cell_use_power(50) - if(src.module_state_3) - cell_use_power(50) + // 50W load for every enabled tool TODO: tool-specific loads + var/use_power = 50 * length(get_held_items()) + if(use_power) + cell_use_power(use_power) if(lights_on) if(intenselight) @@ -48,7 +46,7 @@ SHOULD_CALL_PARENT(FALSE) update_health() - set_status(STAT_PARA, min(GET_STATUS(src, STAT_PARA), 30)) + set_status_condition(STAT_PARA, min(GET_STATUS(src, STAT_PARA), 30)) if(HAS_STATUS(src, STAT_ASLEEP)) SET_STATUS_MAX(src, STAT_PARA, 3) @@ -68,11 +66,11 @@ SET_STATUS_MAX(src, STAT_BLIND, 2) if(has_genetic_condition(GENE_COND_DEAFENED)) - src.set_status(STAT_DEAF, 1) + src.set_status_condition(STAT_DEAF, 1) //update the state of modules and components here if (stat != CONSCIOUS) - uneq_all() + drop_held_items() if(silicon_radio) if(!is_component_functioning("radio")) @@ -91,7 +89,7 @@ if(!.) return var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src) - if(hud && hud.hud) + if(hud?.hud) hud.hud.process_hud(src) else switch(src.sensor_mode) @@ -109,9 +107,6 @@ set_fullscreen(GET_STATUS(src, STAT_BLURRY), "blurry", /obj/screen/fullscreen/blurry) set_fullscreen(GET_STATUS(src, STAT_DRUGGY), "high", /obj/screen/fullscreen/high) - update_items() - return 1 - /mob/living/silicon/robot/handle_vision() ..() @@ -140,21 +135,6 @@ set_see_invisible(SEE_INVISIBLE_LIVING) // This is normal vision (25), setting it lower for normal vision means you don't "see" things like darkness since darkness // has a "invisible" value of 15 - -/mob/living/silicon/robot/proc/update_items() - if (src.client) - src.client.screen -= src.contents - for(var/obj/I in src.contents) - if(I && !(istype(I,/obj/item/cell) || istype(I,/obj/item/radio) || istype(I,/obj/machinery/camera) || istype(I,/obj/item/organ/internal/brain_interface))) - src.client.screen += I - if(src.module_state_1) - src.module_state_1:screen_loc = ui_inv1 - if(src.module_state_2) - src.module_state_2:screen_loc = ui_inv2 - if(src.module_state_3) - src.module_state_3:screen_loc = ui_inv3 - update_icon() - /mob/living/silicon/robot/proc/process_killswitch() if(killswitch) killswitch_time -- @@ -163,10 +143,9 @@ killswitch = 0 spawn(5) gib() - /mob/living/silicon/robot/proc/process_locks() if(weapon_lock) - uneq_all() + drop_held_items() weaponlock_time -- if(weaponlock_time <= 0) to_chat(src, SPAN_DANGER("Weapon lock timed out!")) diff --git a/code/modules/mob/living/silicon/robot/modules/_module.dm b/code/modules/mob/living/silicon/robot/modules/_module.dm index 7bd571e00d42..5de1f45f8dec 100644 --- a/code/modules/mob/living/silicon/robot/modules/_module.dm +++ b/code/modules/mob/living/silicon/robot/modules/_module.dm @@ -1,9 +1,25 @@ +/datum/storage/robot_module + storage_slots = 24 + // No real limits since mobs generally won't be able to freely interact with this storage. + max_w_class = ITEM_SIZE_GARGANTUAN + +/datum/storage/robot_module/can_be_inserted(obj/item/W, mob/user, stop_messages, click_params) + var/mob/living/silicon/robot/robot = user + return istype(robot) && (W in robot.module?.equipment) + +/obj/item/robot_module/get_stored_inventory() + . = ..() + var/mob/living/silicon/robot/robot = loc + if(LAZYLEN(.) && emag && (!istype(robot) || !robot.emagged)) + LAZYREMOVE(., emag) + /obj/item/robot_module name = "robot module" icon = 'icons/obj/modules/module_standard.dmi' icon_state = ICON_STATE_WORLD obj_flags = OBJ_FLAG_CONDUCTIBLE | OBJ_FLAG_NO_STORAGE is_spawnable_type = FALSE + storage = /datum/storage/robot_module var/associated_department var/hide_on_manifest = 0 @@ -13,7 +29,7 @@ /decl/language/human/common = TRUE, /decl/language/legal = TRUE, /decl/language/sign = FALSE - ) + ) var/list/module_sprites = list() var/can_be_pushed = 1 // Equivalent to shoes with ITEM_FLAG_NOSLIP @@ -42,33 +58,47 @@ var/list/skills = list() // Skills that this module grants. Other skills will remain at minimum levels. var/list/software = list() // Apps to preinstall on robot's inbiult computer -/obj/item/robot_module/Initialize() +// Override because storage is created very early. +/obj/item/robot_module/New(loc, material_key, reference_only = FALSE) + if(reference_only) + storage = null + ..(loc, material_key) + +/obj/item/robot_module/Initialize(ml, material_key, reference_only = FALSE) . = ..() - var/mob/living/silicon/robot/R = loc - if(!istype(R)) + if(reference_only) + return + + var/mob/living/silicon/robot/robot = loc + if(!istype(robot)) + // Clear refs to avoid attempting to qdel a type in module Destroy(). + equipment = null + synths = null + emag = null + jetpack = null return INITIALIZE_HINT_QDEL - R.module = src + robot.module = src - grant_skills(R) - grant_software(R) - add_camera_channels(R) - add_languages(R) - add_subsystems(R) - apply_status_flags(R) + grant_skills(robot) + grant_software(robot) + add_camera_channels(robot) + add_languages(robot) + add_subsystems(robot) + apply_status_flags(robot) - build_equipment(R) - build_emag(R) - build_synths(R) + build_equipment(robot) + build_emag(robot) + build_synths(robot) - finalize_equipment(R) - finalize_emag(R) - finalize_synths(R) + finalize_equipment(robot) + finalize_emag(robot) + finalize_synths(robot) - if(R.client) - R.choose_icon(get_sprites_for(R)) + if(robot.client) + robot.choose_icon(get_sprites_for(robot)) /obj/item/robot_module/proc/build_equipment() var/list/created_equipment = list() @@ -84,8 +114,7 @@ equipment = created_equipment /obj/item/robot_module/proc/finalize_equipment() - for(var/obj/item/I in equipment) - I.canremove = FALSE + return /obj/item/robot_module/proc/build_synths() var/list/created_synths = list() @@ -115,31 +144,36 @@ log_debug("Invalid var type in [type] emag creation - [emag]") emag = null -/obj/item/robot_module/proc/Reset(var/mob/living/silicon/robot/R) - remove_camera_channels(R) - remove_languages(R) - remove_subsystems(R) - remove_status_flags(R) - reset_skills(R) - R.choose_icon(list("Basic" = initial(R.icon))) +/obj/item/robot_module/proc/Reset(var/mob/living/silicon/robot/robot) + remove_camera_channels(robot) + remove_languages(robot) + remove_subsystems(robot) + remove_status_flags(robot) + reset_skills(robot) + robot.choose_icon(list("Basic" = initial(robot.icon))) -/obj/item/robot_module/proc/get_sprites_for(var/mob/living/silicon/robot/R) +/obj/item/robot_module/proc/get_sprites_for(var/mob/living/silicon/robot/robot) . = module_sprites - if(R.ckey) - for(var/datum/custom_icon/cicon as anything in SScustomitems.custom_icons_by_ckey[R.ckey]) - if(cicon.category == display_name && lowertext(R.real_name) == cicon.character_name) + if(robot.ckey) + for(var/datum/custom_icon/cicon as anything in SScustomitems.custom_icons_by_ckey[robot.ckey]) + if(cicon.category == display_name && lowertext(robot.real_name) == cicon.character_name) for(var/state in cicon.ids_to_icons) .[state] = cicon.ids_to_icons[state] /obj/item/robot_module/Destroy() - QDEL_NULL_LIST(equipment) + for(var/datum/thing in (equipment|synths)) + qdel(thing) + equipment = null + synths = null QDEL_NULL_LIST(synths) - QDEL_NULL(emag) - QDEL_NULL(jetpack) - var/mob/living/silicon/robot/R = loc - if(istype(R) && R.module == src) - R.module = null + if(istype(emag)) + QDEL_NULL(emag) + if(istype(jetpack)) + QDEL_NULL(jetpack) . = ..() + var/mob/living/silicon/robot/robot = loc + if(istype(robot) && robot.module == src) + robot.module = null /obj/item/robot_module/emp_act(severity) if(equipment) @@ -152,7 +186,7 @@ S.emp_act(severity) ..() -/obj/item/robot_module/proc/respawn_consumable(var/mob/living/silicon/robot/R, var/rate) +/obj/item/robot_module/proc/respawn_consumable(var/mob/living/silicon/robot/robot, var/rate) var/obj/item/flash/F = locate() in equipment if(F) if(F.broken) @@ -166,27 +200,27 @@ for(var/datum/matter_synth/T in synths) T.add_charge(T.recharge_rate * rate) -/obj/item/robot_module/proc/add_languages(var/mob/living/silicon/robot/R) +/obj/item/robot_module/proc/add_languages(var/mob/living/silicon/robot/robot) // Stores the languages as they were before receiving the module, and whether they could be synthezized. - for(var/decl/language/language_datum in R.languages) - original_languages[language_datum] = (language_datum in R.speech_synthesizer_langs) + for(var/decl/language/language_datum in robot.languages) + original_languages[language_datum] = (language_datum in robot.speech_synthesizer_langs) for(var/language in languages) - R.add_language(language, languages[language]) + robot.add_language(language, languages[language]) -/obj/item/robot_module/proc/remove_languages(var/mob/living/silicon/robot/R) +/obj/item/robot_module/proc/remove_languages(var/mob/living/silicon/robot/robot) // Clear all added languages, whether or not we originally had them. for(var/language in languages) - R.remove_language(language) + robot.remove_language(language) // Then add back all the original languages, and the relevant synthezising ability for(var/original_language in original_languages) var/decl/language/language_datum = original_language - R.add_language(language_datum.type, original_languages[original_language]) + robot.add_language(language_datum.type, original_languages[original_language]) original_languages.Cut() -/obj/item/robot_module/proc/add_camera_channels(var/mob/living/silicon/robot/R) - var/datum/extension/network_device/camera/robot/D = get_extension(R, /datum/extension/network_device/camera) +/obj/item/robot_module/proc/add_camera_channels(var/mob/living/silicon/robot/robot) + var/datum/extension/network_device/camera/robot/D = get_extension(robot, /datum/extension/network_device/camera) if(D) var/list/robot_channels = D.channels if(CAMERA_CHANNEL_ROBOTS in robot_channels) @@ -195,43 +229,43 @@ D.add_channels(channel) added_channels |= channel -/obj/item/robot_module/proc/remove_camera_channels(var/mob/living/silicon/robot/R) - var/datum/extension/network_device/camera/robot/D = get_extension(R, /datum/extension/network_device/camera) +/obj/item/robot_module/proc/remove_camera_channels(var/mob/living/silicon/robot/robot) + var/datum/extension/network_device/camera/robot/D = get_extension(robot, /datum/extension/network_device/camera) D.remove_channels(added_channels) added_channels.Cut() -/obj/item/robot_module/proc/add_subsystems(var/mob/living/silicon/robot/R) +/obj/item/robot_module/proc/add_subsystems(var/mob/living/silicon/robot/robot) for(var/subsystem_type in subsystems) - R.init_subsystem(subsystem_type) + robot.init_subsystem(subsystem_type) -/obj/item/robot_module/proc/remove_subsystems(var/mob/living/silicon/robot/R) +/obj/item/robot_module/proc/remove_subsystems(var/mob/living/silicon/robot/robot) for(var/subsystem_type in subsystems) - R.remove_subsystem(subsystem_type) + robot.remove_subsystem(subsystem_type) -/obj/item/robot_module/proc/apply_status_flags(var/mob/living/silicon/robot/R) +/obj/item/robot_module/proc/apply_status_flags(var/mob/living/silicon/robot/robot) if(!can_be_pushed) - R.status_flags &= ~CANPUSH + robot.status_flags &= ~CANPUSH -/obj/item/robot_module/proc/remove_status_flags(var/mob/living/silicon/robot/R) +/obj/item/robot_module/proc/remove_status_flags(var/mob/living/silicon/robot/robot) if(!can_be_pushed) - R.status_flags |= CANPUSH + robot.status_flags |= CANPUSH /obj/item/robot_module/proc/handle_emagged() return -/obj/item/robot_module/proc/grant_skills(var/mob/living/silicon/robot/R) - reset_skills(R) // for safety +/obj/item/robot_module/proc/grant_skills(var/mob/living/silicon/robot/robot) + reset_skills(robot) // for safety var/list/skill_mod = list() for(var/skill_type in skills) skill_mod[skill_type] = skills[skill_type] - SKILL_MIN // the buff is additive, so normalize accordingly - R.buff_skill(skill_mod, buff_type = /datum/skill_buff/robot) + robot.buff_skill(skill_mod, buff_type = /datum/skill_buff/robot) -/obj/item/robot_module/proc/reset_skills(var/mob/living/silicon/robot/R) - for(var/datum/skill_buff/buff in R.fetch_buffs_of_type(/datum/skill_buff/robot)) +/obj/item/robot_module/proc/reset_skills(var/mob/living/silicon/robot/robot) + for(var/datum/skill_buff/buff in robot.fetch_buffs_of_type(/datum/skill_buff/robot)) buff.remove() -/obj/item/robot_module/proc/grant_software(var/mob/living/silicon/robot/R) - var/datum/extension/interactive/os/os = get_extension(R, /datum/extension/interactive/os) +/obj/item/robot_module/proc/grant_software(var/mob/living/silicon/robot/robot) + var/datum/extension/interactive/os/os = get_extension(robot, /datum/extension/interactive/os) if(os && os.has_component(PART_HDD)) var/obj/item/stock_parts/computer/hard_drive/disk = os.get_component(PART_HDD) for(var/T in software) diff --git a/code/modules/mob/living/silicon/robot/modules/module_clerical.dm b/code/modules/mob/living/silicon/robot/modules/module_clerical.dm index 94f73f0d6370..a43672e98d20 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_clerical.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_clerical.dm @@ -33,7 +33,7 @@ /obj/item/scanner/plant, /obj/item/plants, /obj/item/robot_harvester, - /obj/item/kitchen/rollingpin, + /obj/item/rollingpin, /obj/item/knife/kitchen, /obj/item/crowbar, /obj/item/rsf, @@ -62,14 +62,14 @@ /obj/item/robot_module/clerical/butler/finalize_emag() . = ..() if(emag) - var/datum/reagents/R = emag.create_reagents(50) - R.add_reagent(/decl/material/liquid/paralytics, 10) - R.add_reagent(/decl/material/liquid/sedatives, 15) - R.add_reagent(/decl/material/liquid/alcohol/beer, 20) - R.add_reagent(/decl/material/solid/ice, 5) + var/datum/reagents/reagent = emag.create_reagents(50) + reagent.add_reagent(/decl/material/liquid/paralytics, 10) + reagent.add_reagent(/decl/material/liquid/sedatives, 15) + reagent.add_reagent(/decl/material/liquid/alcohol/beer, 20) + reagent.add_reagent(/decl/material/solid/ice, 5) emag.SetName("Mickey Finn's Special Brew") -/obj/item/robot_module/general/butler/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/general/butler/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) ..() var/obj/item/chems/condiment/enzyme/E = locate() in equipment E.add_to_reagents(/decl/material/liquid/enzyme, 2 * amount) diff --git a/code/modules/mob/living/silicon/robot/modules/module_engineering.dm b/code/modules/mob/living/silicon/robot/modules/module_engineering.dm index fb3406b346d2..65bd61bbd014 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_engineering.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_engineering.dm @@ -5,7 +5,7 @@ "Engineering" = 1 ) camera_channels = list( - CAMERA_CAMERA_CHANNEL_ENGINEERING + CAMERA_CHANNEL_ENGINEERING ) software = list( /datum/computer_file/program/power_monitor @@ -107,7 +107,7 @@ var/obj/item/stack/material/cyborg/plasteel/PL = locate() in equipment PL.synths = list(plasteel) -/obj/item/robot_module/engineering/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/engineering/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) var/obj/item/lightreplacer/LR = locate() in equipment - LR.Charge(R, amount) + LR.Charge(robot, amount) ..() \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/modules/module_illegal.dm b/code/modules/mob/living/silicon/robot/modules/module_illegal.dm index e899ec1a2221..6b0ab320b8ea 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_illegal.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_illegal.dm @@ -21,13 +21,13 @@ skills[skill.type] = SKILL_EXPERT . = ..() -/obj/item/robot_module/syndicate/build_equipment(var/mob/living/silicon/robot/R) +/obj/item/robot_module/syndicate/build_equipment(var/mob/living/silicon/robot/robot) . = ..() - id = R.idcard + id = robot.idcard equipment += id -/obj/item/robot_module/syndicate/finalize_equipment(var/mob/living/silicon/robot/R) - R.set_internals(locate(/obj/item/tank/jetpack/carbondioxide) in equipment) +/obj/item/robot_module/syndicate/finalize_equipment(var/mob/living/silicon/robot/robot) + robot.set_internals(locate(/obj/item/tank/jetpack/carbondioxide) in equipment) . = ..() /obj/item/robot_module/syndicate/Destroy() diff --git a/code/modules/mob/living/silicon/robot/modules/module_janitor.dm b/code/modules/mob/living/silicon/robot/modules/module_janitor.dm index e88d8b131125..b3c558956824 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_janitor.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_janitor.dm @@ -22,6 +22,7 @@ /obj/item/weldingtool ) emag = /obj/item/chems/spray + has_nonslip_feet = TRUE /obj/item/robot_module/janitor/handle_turf(turf/target, mob/user) target.clean() @@ -31,10 +32,10 @@ emag.add_to_reagents(/decl/material/liquid/lube, 250) emag.SetName("lubricant spray") -/obj/item/robot_module/janitor/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/janitor/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) ..() var/obj/item/lightreplacer/LR = locate() in equipment - LR.Charge(R, amount) + LR.Charge(robot, amount) if(emag) var/obj/item/chems/spray/S = emag S.add_to_reagents(/decl/material/liquid/lube, 20 * amount) diff --git a/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm b/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm index 6d683809f001..1635721d1c87 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm @@ -4,7 +4,7 @@ has_nonslip_feet = TRUE has_magnetic_feet = TRUE camera_channels = list( - CAMERA_CAMERA_CHANNEL_ENGINEERING + CAMERA_CHANNEL_ENGINEERING ) languages = list( /decl/language/human/common = FALSE @@ -58,10 +58,10 @@ SKILL_ELECTRICAL = SKILL_EXPERT ) -/obj/item/robot_module/drone/finalize_equipment(var/mob/living/silicon/robot/R) +/obj/item/robot_module/drone/finalize_equipment(var/mob/living/silicon/robot/robot) . = ..() - if(istype(R)) - R.set_internals(locate(/obj/item/tank/jetpack/carbondioxide) in equipment) + if(istype(robot)) + robot.set_internals(locate(/obj/item/tank/jetpack/carbondioxide) in equipment) /obj/item/robot_module/drone/finalize_emag() . = ..() @@ -112,12 +112,12 @@ var/obj/item/stack/material/cyborg/plastic/P = locate() in equipment P.synths = list(plastic) -/obj/item/robot_module/drone/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/drone/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) ..() var/obj/item/chems/spray/cleaner/drone/SC = locate() in equipment SC.add_to_reagents(/decl/material/liquid/cleaner, 8 * amount) var/obj/item/lightreplacer/LR = locate() in equipment - LR.Charge(R, amount) + LR.Charge(robot, amount) /obj/item/robot_module/drone/construction name = "construction drone module" diff --git a/code/modules/mob/living/silicon/robot/modules/module_medical.dm b/code/modules/mob/living/silicon/robot/modules/module_medical.dm index 7ec7e413ce6f..e4d027c4daec 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_medical.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_medical.dm @@ -83,7 +83,7 @@ var/obj/item/stack/medical/stack = locate(thing) in equipment stack.synths = list(medicine) -/obj/item/robot_module/medical/surgeon/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/medical/surgeon/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) if(emag) var/obj/item/chems/spray/PS = emag PS.add_to_reagents(/decl/material/liquid/acid/polyacid, 2 * amount) @@ -157,7 +157,7 @@ var/obj/item/stack/medical/stack = locate(thing) in equipment stack.synths = list(medicine) -/obj/item/robot_module/medical/crisis/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/medical/crisis/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) var/obj/item/chems/syringe/S = locate() in equipment if(S.mode == 2) S.reagents.clear_reagents() diff --git a/code/modules/mob/living/silicon/robot/modules/module_miner.dm b/code/modules/mob/living/silicon/robot/modules/module_miner.dm index 9ce6b5d42e5d..d1e76232d72f 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_miner.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_miner.dm @@ -45,5 +45,4 @@ equipment -= D qdel(D) D = new /obj/item/tool/drill/diamond(src) - D.canremove = FALSE equipment += D diff --git a/code/modules/mob/living/silicon/robot/modules/module_security.dm b/code/modules/mob/living/silicon/robot/modules/module_security.dm index 9322a91f7441..96bec1265129 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_security.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_security.dm @@ -20,7 +20,7 @@ SKILL_FORENSICS = SKILL_EXPERT ) -/obj/item/robot_module/security/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/security/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) ..() for(var/obj/item/gun/energy/T in equipment) var/obj/item/cell/power_supply = T.get_cell() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 2a481872bb61..bcc2945bf461 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -34,20 +34,8 @@ var/dismantle_type = /obj/item/robot_parts/robot_suit /// If icon selection has been completed yet var/icon_selected = TRUE - /// Hud stuff - var/obj/screen/robot/module/one/inv1 - var/obj/screen/robot/module/two/inv2 - var/obj/screen/robot/module/three/inv3 - - /// Used to determine whether they have the module menu shown or not - var/shown_robot_modules = 0 - var/obj/screen/robot/modules_background/robot_modules_background - /// 3 Modules can be activated at any one time. + var/obj/item/robot_module/module = null - var/obj/item/module_active - var/obj/item/module_state_1 - var/obj/item/module_state_2 - var/obj/item/module_state_3 var/mob/living/silicon/ai/connected_ai = null var/obj/item/cell/cell = /obj/item/cell/high var/cell_emp_mult = 2.5 @@ -89,6 +77,10 @@ /mob/living/silicon/robot/Initialize() + add_held_item_slot(new /datum/inventory_slot/gripper/robot/one) + add_held_item_slot(new /datum/inventory_slot/gripper/robot/two) + add_held_item_slot(new /datum/inventory_slot/gripper/robot/three) + reset_hud_overlays() . = ..() @@ -99,7 +91,6 @@ wires = new(src) - robot_modules_background = new(null, src) ident = random_id(/mob/living/silicon/robot, 1, 999) updatename(modtype) @@ -195,9 +186,7 @@ /mob/living/silicon/robot/proc/reset_module(var/suppress_alert = null) // Clear hands and module icon. - uneq_all() - if(shown_robot_modules) - hud_used.toggle_show_robot_modules() + drop_held_items() modtype = initial(modtype) refresh_hud_element(HUD_ROBOT_MODULE) // If the robot had a module and this wasn't an uncertified change, let the AI know. @@ -205,6 +194,7 @@ if (!suppress_alert) notify_ai(ROBOT_NOTIFICATION_MODULE_RESET, module.name) // Delete the module. + module.storage?.close(src) module.Reset(src) QDEL_NULL(module) updatename("Default") @@ -425,41 +415,41 @@ spark_at(src, 5, holder=src) return 2 -/mob/living/silicon/robot/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/inducer) || istype(W, /obj/item/handcuffs)) +/mob/living/silicon/robot/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/inducer) || istype(used_item, /obj/item/handcuffs)) return TRUE if(opened) // Are they trying to insert something? for(var/V in components) var/datum/robot_component/C = components[V] - if(!C.installed && C.accepts_component(W)) - if(!user.try_unequip(W)) + if(!C.installed && C.accepts_component(used_item)) + if(!user.try_unequip(used_item)) return TRUE C.installed = 1 - C.wrapped = W + C.wrapped = used_item C.install() - W.forceMove(null) + used_item.forceMove(null) - var/obj/item/robot_parts/robot_component/WC = W + var/obj/item/robot_parts/robot_component/WC = used_item if(istype(WC)) C.brute_damage = WC.brute_damage C.burn_damage = WC.burn_damage - to_chat(user, "You install the [W.name].") + to_chat(user, "You install the [used_item.name].") return TRUE // If the robot is having something inserted which will remain inside it, self-inserting must be handled before exiting to avoid logic errors. Use the handle_selfinsert proc. - if(try_stock_parts_install(W, user)) + if(try_stock_parts_install(used_item, user)) return TRUE - if(IS_WELDER(W) && !user.check_intent(I_FLAG_HARM)) + if(IS_WELDER(used_item) && !user.check_intent(I_FLAG_HARM)) if (src == user) to_chat(user, "You lack the reach to be able to repair yourself.") return TRUE if (!get_damage(BRUTE)) to_chat(user, "Nothing to fix here!") return TRUE - var/obj/item/weldingtool/WT = W - if (WT.weld(0)) + var/obj/item/weldingtool/welder = used_item + if (welder.weld(0)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) heal_damage(BRUTE, 30) add_fingerprint(user) @@ -468,18 +458,18 @@ to_chat(user, "Need more welding fuel!") return TRUE - else if(istype(W, /obj/item/stack/cable_coil) && (wiresexposed || isdrone(src))) + else if(istype(used_item, /obj/item/stack/cable_coil) && (wiresexposed || isdrone(src))) if (!get_damage(BURN)) to_chat(user, "Nothing to fix here!") return TRUE - var/obj/item/stack/cable_coil/coil = W + var/obj/item/stack/cable_coil/coil = used_item if (coil.use(1)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) heal_damage(BURN, 30) user.visible_message(SPAN_NOTICE("\The [user] has fixed some of the burnt wires on \the [src]!")) return TRUE - else if(IS_CROWBAR(W) && !user.check_intent(I_FLAG_HARM)) // crowbar means open or close the cover - we all know what a crowbar is by now + else if(IS_CROWBAR(used_item) && !user.check_intent(I_FLAG_HARM)) // crowbar means open or close the cover - we all know what a crowbar is by now if(opened) if(cell) user.visible_message( @@ -543,50 +533,50 @@ opened = 1 update_icon() return TRUE - else if (istype(W, /obj/item/cell) && opened) // trying to put a cell inside + else if (istype(used_item, /obj/item/cell) && opened) // trying to put a cell inside var/datum/robot_component/C = components["power cell"] if(wiresexposed) to_chat(user, "Close the panel first.") else if(cell) to_chat(user, "There is a power cell already installed.") - else if(W.w_class != ITEM_SIZE_NORMAL) - to_chat(user, "\The [W] is too [W.w_class < ITEM_SIZE_NORMAL? "small" : "large"] to fit here.") - else if(user.try_unequip(W, src)) - cell = W - handle_selfinsert(W, user) //Just in case. + else if(used_item.w_class != ITEM_SIZE_NORMAL) + to_chat(user, "\The [used_item] is too [used_item.w_class < ITEM_SIZE_NORMAL? "small" : "large"] to fit here.") + else if(user.try_unequip(used_item, src)) + cell = used_item + handle_selfinsert(used_item, user) //Just in case. to_chat(user, "You insert the power cell.") C.installed = 1 - C.wrapped = W + C.wrapped = used_item C.install() // This means that removing and replacing a power cell will repair the mount. C.brute_damage = 0 C.burn_damage = 0 return TRUE - else if(IS_WIRECUTTER(W) || IS_MULTITOOL(W)) + else if(IS_WIRECUTTER(used_item) || IS_MULTITOOL(used_item)) if (wiresexposed) wires.Interact(user) else to_chat(user, "You can't reach the wiring.") return TRUE - else if(IS_SCREWDRIVER(W) && opened && !cell) // haxing + else if(IS_SCREWDRIVER(used_item) && opened && !cell) // haxing wiresexposed = !wiresexposed to_chat(user, "The wires have been [wiresexposed ? "exposed" : "unexposed"].") update_icon() return TRUE - else if(IS_SCREWDRIVER(W) && opened && cell) // radio + else if(IS_SCREWDRIVER(used_item) && opened && cell) // radio if(silicon_radio) - silicon_radio.attackby(W,user)//Push it to the radio to let it handle everything + silicon_radio.attackby(used_item,user)//Push it to the radio to let it handle everything else to_chat(user, "Unable to locate a radio.") update_icon() return TRUE - else if(istype(W, /obj/item/encryptionkey/) && opened) + else if(istype(used_item, /obj/item/encryptionkey/) && opened) if(silicon_radio)//sanityyyyyy - silicon_radio.attackby(W,user)//GTFO, you have your own procs + silicon_radio.attackby(used_item,user)//GTFO, you have your own procs else to_chat(user, "Unable to locate a radio.") return TRUE - else if (istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer)||istype(W, /obj/item/card/robot)) // trying to unlock the interface with an ID card + else if (istype(used_item, /obj/item/card/id)||istype(used_item, /obj/item/modular_computer)||istype(used_item, /obj/item/card/robot)) // trying to unlock the interface with an ID card if(emagged)//still allow them to open the cover to_chat(user, "The interface seems slightly damaged.") if(opened) @@ -599,8 +589,8 @@ else to_chat(user, "Access denied.") return TRUE - else if(istype(W, /obj/item/borg/upgrade)) - var/obj/item/borg/upgrade/U = W + else if(istype(used_item, /obj/item/borg/upgrade)) + var/obj/item/borg/upgrade/U = used_item if(!opened) to_chat(user, "You must access [src]'s internals!") else if(!src.module && U.require_module) @@ -612,20 +602,20 @@ if(!user.try_unequip(U, src)) return TRUE to_chat(user, "You apply the upgrade to [src]!") - handle_selfinsert(W, user) + handle_selfinsert(used_item, user) else to_chat(user, "Upgrade error!") return TRUE - if(!(istype(W, /obj/item/robotanalyzer) || istype(W, /obj/item/scanner/health)) && !user.check_intent(I_FLAG_HELP) && W.expend_attack_force(user)) + if(!(istype(used_item, /obj/item/robotanalyzer) || istype(used_item, /obj/item/scanner/health)) && !user.check_intent(I_FLAG_HELP) && used_item.expend_attack_force(user)) spark_at(src, 5, holder=src) return ..() -/mob/living/silicon/robot/proc/handle_selfinsert(obj/item/W, mob/user) +/mob/living/silicon/robot/proc/handle_selfinsert(obj/item/used_item, mob/user) if ((user == src) && istype(get_active_held_item(),/obj/item/gripper)) var/obj/item/gripper/H = get_active_held_item() - if (W.loc == H) //if this triggers something has gone very wrong, and it's safest to abort + if (used_item.loc == H) //if this triggers something has gone very wrong, and it's safest to abort return - else if (H.wrapped == W) + else if (H.wrapped == used_item) H.wrapped = null /mob/living/silicon/robot/try_awaken(mob/user) @@ -688,49 +678,9 @@ else add_overlay(image(panel_icon, "ov-openpanel -c")) - if(module_active && istype(module_active, /obj/item/borg/combat/shield)) + if(istype(get_active_held_item(), /obj/item/borg/combat/shield)) add_overlay("[icon_state]-shield") -/mob/living/silicon/robot/proc/installed_modules() - if(weapon_lock) - to_chat(src, "Weapon lock active, unable to use modules! Count:[weaponlock_time]") - return - - if(!module) - pick_module() - return - var/dat = "Modules\n" - dat += {" - Activated Modules -
    - Module 1: [module_state_1 ? "[module_state_1]" : "No Module"]
    - Module 2: [module_state_2 ? "
    [module_state_2]" : "No Module"]
    - Module 3: [module_state_3 ? "
    [module_state_3]" : "No Module"]
    -
    - Installed Modules

    "} - - - for (var/obj in module.equipment) - if (!obj) - dat += text("Resource depleted
    ") - else if(activated(obj)) - dat += text("[obj]: Activated
    ") - else - dat += text("[obj]:
    Activate
    ") - if (emagged && module.emag) - if(activated(module.emag)) - dat += text("[module.emag]: Activated
    ") - else - dat += text("[module.emag]: Activate
    ") -/* - if(activated(obj)) - dat += text("[obj]: \[Activated | Deactivate\]
    ") - else - dat += text("[obj]: \[Activate | Deactivated\]
    ") -*/ - show_browser(src, dat, "window=robotmod") - - /mob/living/silicon/robot/OnSelfTopic(href_list) if (href_list["showalerts"]) open_subsystem(/datum/nano_module/alarm_monitor/all) @@ -742,61 +692,6 @@ O.attack_self(src) return TOPIC_HANDLED - if (href_list["act"]) - var/obj/item/O = locate(href_list["act"]) - if (!istype(O)) - return TOPIC_HANDLED - - if(!((O in module.equipment) || (O == src.module.emag))) - return TOPIC_HANDLED - - if(activated(O)) - to_chat(src, "Already activated.") - return TOPIC_HANDLED - if(!module_state_1) - module_state_1 = O - O.hud_layerise() - O.forceMove(src) - O.equipped_robot() - if(istype(module_state_1,/obj/item/borg/sight)) - sight_mode |= module_state_1:sight_mode - else if(!module_state_2) - module_state_2 = O - O.hud_layerise() - O.forceMove(src) - O.equipped_robot() - if(istype(module_state_2,/obj/item/borg/sight)) - sight_mode |= module_state_2:sight_mode - else if(!module_state_3) - module_state_3 = O - O.hud_layerise() - O.forceMove(src) - O.equipped_robot() - if(istype(module_state_3,/obj/item/borg/sight)) - sight_mode |= module_state_3:sight_mode - else - to_chat(src, "You need to disable a module first!") - installed_modules() - return TOPIC_HANDLED - - if (href_list["deact"]) - var/obj/item/O = locate(href_list["deact"]) - if(activated(O)) - if(module_state_1 == O) - module_state_1 = null - O.forceMove(null) - else if(module_state_2 == O) - module_state_2 = null - O.forceMove(null) - else if(module_state_3 == O) - module_state_3 = null - O.forceMove(null) - else - to_chat(src, "Module isn't activated.") - else - to_chat(src, "Module isn't activated.") - installed_modules() - return TOPIC_HANDLED return ..() /mob/living/silicon/robot/proc/radio_menu() @@ -805,7 +700,7 @@ /mob/living/silicon/robot/Move(a, b, flag) . = ..() if(. && module && isturf(loc)) - var/obj/item/ore/orebag = locate() in list(module_state_1, module_state_2, module_state_3) + var/obj/item/ore/orebag = locate() in get_held_items() if(orebag) loc.attackby(orebag, src) module.handle_turf(loc, src) @@ -825,11 +720,10 @@ set name = "Reset Identity Codes" set desc = "Scrambles your security and identification codes and resets your current buffers. Unlocks you and but permanently severs you from your AI and the robotics console and will deactivate your camera system." - var/mob/living/silicon/robot/R = src - - if(R) - R.UnlinkSelf() - to_chat(R, "Buffers flushed and reset. Camera system shutdown. All systems operational.") + var/mob/living/silicon/robot/robot = src + if(robot) + robot.UnlinkSelf() + to_chat(robot, "Buffers flushed and reset. Camera system shutdown. All systems operational.") src.verbs -= /mob/living/silicon/robot/proc/ResetSecurityCodes /mob/living/silicon/robot/proc/SetLockdown(var/state = 1) @@ -1042,12 +936,12 @@ chassis.dismantled_from(src) qdel(src) -/mob/living/silicon/robot/try_stock_parts_install(obj/item/stock_parts/W, mob/user) +/mob/living/silicon/robot/try_stock_parts_install(obj/item/stock_parts/used_item, mob/user) if(!opened) return . = ..() if(.) - handle_selfinsert(W, user) + handle_selfinsert(used_item, user) recalculate_synth_capacities() /mob/living/silicon/robot/get_admin_job_string() diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm index 6723fd88775f..7e43ee35c774 100644 --- a/code/modules/mob/living/silicon/robot/robot_damage.dm +++ b/code/modules/mob/living/silicon/robot/robot_damage.dm @@ -61,8 +61,8 @@ return //Combat shielding absorbs a percentage of damage directly into the cell. - if(module_active && istype(module_active,/obj/item/borg/combat/shield)) - var/obj/item/borg/combat/shield/shield = module_active + var/obj/item/borg/combat/shield/shield = get_active_held_item() + if(istype(shield)) //Shields absorb a certain percentage of damage based on their power setting. var/absorb_brute = brute*shield.shield_level var/absorb_burn = burn*shield.shield_level @@ -107,8 +107,8 @@ var/list/datum/robot_component/parts = get_damageable_components() //Combat shielding absorbs a percentage of damage directly into the cell. - if(module_active && istype(module_active,/obj/item/borg/combat/shield)) - var/obj/item/borg/combat/shield/shield = module_active + var/obj/item/borg/combat/shield/shield = get_active_held_item() + if(istype(shield)) //Shields absorb a certain percentage of damage based on their power setting. var/absorb_brute = brute*shield.shield_level var/absorb_burn = burn*shield.shield_level @@ -138,5 +138,5 @@ update_health() /mob/living/silicon/robot/emp_act(severity) - uneq_all() + drop_held_items() ..() //Damage is handled at /silicon/ level. diff --git a/code/modules/mob/living/silicon/robot/robot_items.dm b/code/modules/mob/living/silicon/robot/robot_items.dm index c2fde015d1df..0f61b2f14bcd 100644 --- a/code/modules/mob/living/silicon/robot/robot_items.dm +++ b/code/modules/mob/living/silicon/robot/robot_items.dm @@ -80,7 +80,7 @@ //This is used to unlock other borg covers. /obj/item/card/robot //This is not a child of id cards, as to avoid dumb typechecks on computers. name = "access code transmission device" - icon_state = "robot_base" + icon_state = "emag" desc = "A circuit grafted onto the bottom of an ID card. It is used to transmit access codes into other robot chassis, \ allowing you to lock and unlock other robots' panels." @@ -192,7 +192,7 @@ /obj/item/borg/combat/shield name = "personal shielding" desc = "A powerful experimental module that turns aside or absorbs incoming attacks at the cost of charge." - icon = 'icons/obj/decals.dmi' + icon = 'icons/obj/signs/warnings.dmi' icon_state = "shock" var/shield_level = 0.5 //Percentage of damage absorbed by the shield. @@ -208,7 +208,7 @@ /obj/item/borg/combat/mobility name = "mobility module" desc = "By retracting limbs and tucking in its head, a combat android can roll at high speeds." - icon = 'icons/obj/decals.dmi' + icon = 'icons/obj/signs/warnings.dmi' icon_state = "shock" /obj/item/inflatable_dispenser @@ -339,12 +339,12 @@ if(!length(held)) to_chat(user, "The rack is empty.") return - var/obj/item/R = held[length(held)] - R.dropInto(loc) - held -= R - R.attack_self(user) // deploy it - to_chat(user, "You deploy [R].") - R.add_fingerprint(user) + var/obj/item/rack = held[length(held)] + rack.dropInto(loc) + held -= rack + rack.attack_self(user) // deploy it + to_chat(user, "You deploy [rack].") + rack.add_fingerprint(user) /obj/item/robot_rack/resolve_attackby(obj/O, mob/user, click_params) if(istype(O, object_type)) @@ -407,8 +407,8 @@ . = ..() /obj/item/bioreactor/Process() - var/mob/living/silicon/robot/R = loc - if(!istype(R) || !R.cell || R.cell.fully_charged() || !contents.len) + var/mob/living/silicon/robot/robot = loc + if(!istype(robot) || !robot.cell || robot.cell.fully_charged() || !contents.len) return var/generating_power @@ -435,4 +435,4 @@ qdel(using_item) if(generating_power) - R.cell.give(generating_power * CELLRATE) + robot.cell.give(generating_power * CELLRATE) diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index 55cfd8753368..e38f7b95deb8 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -13,7 +13,8 @@ tally += speed - if(module_active && istype(module_active,/obj/item/borg/combat/mobility)) + // Gross, todo slowdown for robots + if(istype(get_active_held_item(), /obj/item/borg/combat/mobility)) tally-=3 return tally+get_config_value(/decl/config/num/movement_robot) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index a402c51add3b..5e738a6f7c98 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -85,7 +85,8 @@ /mob/living/silicon/drop_item(var/Target) for(var/obj/item/grab/grab as anything in get_active_grabs()) qdel(grab) - . = TRUE + return TRUE + return ..() /mob/living/silicon/emp_act(severity) switch(severity) @@ -363,15 +364,15 @@ return os.get_network() -/mob/living/silicon/proc/try_stock_parts_install(obj/item/stock_parts/W, mob/user) - if(istype(W) && user.try_unequip(W)) - W.forceMove(src) - stock_parts += W - to_chat(user, "You install the [W.name].") +/mob/living/silicon/proc/try_stock_parts_install(obj/item/stock_parts/used_item, mob/user) + if(istype(used_item) && user.try_unequip(used_item)) + used_item.forceMove(src) + stock_parts += used_item + to_chat(user, "You install the [used_item.name].") return TRUE -/mob/living/silicon/proc/try_stock_parts_removal(obj/item/W, mob/user) - if(!IS_CROWBAR(W) || user.check_intent(I_FLAG_HARM)) +/mob/living/silicon/proc/try_stock_parts_removal(obj/item/used_item, mob/user) + if(!IS_CROWBAR(used_item) || user.check_intent(I_FLAG_HARM)) return if(!length(stock_parts)) to_chat(user, SPAN_WARNING("There are no parts in \the [src] left to remove.")) @@ -414,7 +415,7 @@ if(os) os.Process() -/mob/living/silicon/handle_flashed(var/flash_strength) +/mob/living/silicon/handle_flashed(var/flash_strength, do_stun = FALSE) SET_STATUS_MAX(src, STAT_PARA, flash_strength) SET_STATUS_MAX(src, STAT_WEAK, flash_strength) return TRUE diff --git a/code/modules/mob/living/simple_animal/_simple_animal.dm b/code/modules/mob/living/simple_animal/_simple_animal.dm index 0b7d78e11bf0..e569fc44d985 100644 --- a/code/modules/mob/living/simple_animal/_simple_animal.dm +++ b/code/modules/mob/living/simple_animal/_simple_animal.dm @@ -10,7 +10,7 @@ mob_push_flags = MONKEY|SLIME|SIMPLE_ANIMAL icon_state = ICON_STATE_WORLD - buckle_pixel_shift = @"{'x':0,'y':0,'z':8}" + buckle_pixel_shift = @'{"x":0,"y":0,"z":8}' hud_used = /datum/hud/animal @@ -348,11 +348,11 @@ var/global/list/simplemob_icon_bitflag_cache = list() user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) return TRUE -/mob/living/simple_animal/attackby(var/obj/item/O, var/mob/user) +/mob/living/simple_animal/attackby(var/obj/item/used_item, var/mob/user) - if(istype(O, /obj/item/stack/medical)) + if(istype(used_item, /obj/item/stack/medical)) if(stat != DEAD) - var/obj/item/stack/medical/MED = O + var/obj/item/stack/medical/MED = used_item if(!MED.animal_heal) to_chat(user, SPAN_WARNING("\The [MED] won't help \the [src] at all!")) else if(current_health < get_max_health() && MED.can_use(1)) @@ -508,6 +508,12 @@ var/global/list/simplemob_icon_bitflag_cache = list() name = "quadruped animal" bodytype_flag = 0 bodytype_category = "quadrupedal animal body" + // Simple animal bodies don't have limbs or organs, currently. If that changes, remove or modify these overrides. + // These overrides prevent unnecessary processing. + has_limbs = list() + has_organ = list() + // Simple animals go through a different breathing process (handle_environment) than mobs that use organs do. + breathing_organ = null /mob/living/simple_animal/get_base_telegraphed_melee_accuracy() return telegraphed_melee_accuracy diff --git a/code/modules/mob/living/simple_animal/crow/crow.dm b/code/modules/mob/living/simple_animal/crow/crow.dm index 1c780c3299aa..2ee46b3e0df2 100644 --- a/code/modules/mob/living/simple_animal/crow/crow.dm +++ b/code/modules/mob/living/simple_animal/crow/crow.dm @@ -37,7 +37,7 @@ /obj/item/natural_weapon/crow_claws name = "claws" gender = PLURAL - attack_verb = list("clawed") + attack_verb = "clawed" sharp = TRUE _base_attack_force = 7 @@ -63,11 +63,11 @@ return backpack.attack_hand(user) return ..() -/mob/living/simple_animal/crow/attackby(obj/item/I, mob/user) +/mob/living/simple_animal/crow/attackby(obj/item/used_item, mob/user) if(user.check_intent(I_FLAG_HELP)) var/obj/item/backpack = get_equipped_item(slot_back_str) if(backpack) - return backpack.attackby(I, user) + return backpack.attackby(used_item, user) return ..() /mob/living/simple_animal/crow/on_update_icon() diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 50c1c1aae4f0..c36ff3e143b3 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -59,9 +59,6 @@ butchery_data = /decl/butchery_data/animal/cat base_animal_type = /mob/living/simple_animal/passive/cat ai = /datum/mob_controller/passive/hunter/cat - var/turns_since_scan = 0 - var/mob/living/simple_animal/passive/mouse/movement_target - var/mob/flee_target /mob/living/simple_animal/passive/cat/get_bodytype() return GET_DECL(/decl/bodytype/quadruped/animal/cat) diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm index ab52e19b77ca..9264cd3be0f4 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm @@ -126,9 +126,9 @@ if(prob(1)) dance() -/mob/living/simple_animal/corgi/attackby(var/obj/item/O, var/mob/user) //Marker -Agouri - if(istype(O, /obj/item/newspaper) && !stat) - visible_message(SPAN_NOTICE("\The [user] baps \the [src] on the nose with the rolled-up [O.name]!")) +/mob/living/simple_animal/corgi/attackby(var/obj/item/used_item, var/mob/user) //Marker -Agouri + if(istype(used_item, /obj/item/newspaper) && !stat) + visible_message(SPAN_NOTICE("\The [user] baps \the [src] on the nose with the rolled-up [used_item.name]!")) var/datum/mob_controller/corgi/corgi_ai = ai if(istype(corgi_ai)) corgi_ai.dance() diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 7a00faca3d58..31c6b6c8a213 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -27,7 +27,7 @@ body.visible_message(SPAN_DANGER("\The [body] gets an evil-looking gleam in [pronouns.his] eye.")) /datum/mob_controller/aggressive/goat/proc/find_edible_atom(list/targets) - // TODO: add /obj/structure/flora here and in goat/UnarmedAttack() + // TODO: add /obj/structure/flora here and in goat/ResolveUnarmedAttack() var/atom/maybe_food = locate(/obj/effect/vine) in targets if(!istype(maybe_food)) for(var/obj/machinery/portable_atmospherics/hydroponics/tray in targets) @@ -74,25 +74,24 @@ . = ..() set_extension(src, /datum/extension/milkable/goat) -/mob/living/simple_animal/hostile/goat/UnarmedAttack(var/atom/A, var/proximity) +/mob/living/simple_animal/hostile/goat/ResolveUnarmedAttack(var/atom/A) var/was_food = FALSE - if(proximity) - if(prob(30)) - if(istype(A, /obj/effect/vine)) - var/obj/effect/vine/SV = A - SV.die_off(1) + if(prob(30)) + if(istype(A, /obj/effect/vine)) + var/obj/effect/vine/SV = A + SV.die_off(1) + was_food = TRUE + else if(istype(A, /obj/machinery/portable_atmospherics/hydroponics)) + var/obj/machinery/portable_atmospherics/hydroponics/tray = A + if(tray.seed) was_food = TRUE - else if(istype(A, /obj/machinery/portable_atmospherics/hydroponics)) - var/obj/machinery/portable_atmospherics/hydroponics/tray = A - if(tray.seed) - was_food = TRUE - tray.die() - if(!QDELETED(tray)) - tray.remove_dead(silent = TRUE) // this will qdel invisible trays - if(was_food) - visible_message(SPAN_NOTICE("\The [src] eats \the [A].")) - - return was_food ? TRUE :..() + tray.die() + if(!QDELETED(tray)) + tray.remove_dead(silent = TRUE) // this will qdel invisible trays + if(was_food) + visible_message(SPAN_NOTICE("\The [src] eats \the [A].")) + return TRUE + return ..() /mob/living/simple_animal/cow name = "cow" @@ -244,14 +243,14 @@ var/global/chicken_count = 0 if(.) global.chicken_count -= 1 -/mob/living/simple_animal/fowl/chicken/attackby(var/obj/item/O, var/mob/user) - if(!istype(O, /obj/item/food)) +/mob/living/simple_animal/fowl/chicken/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/food)) return ..() - var/obj/item/food/G = O //feedin' dem chickens + var/obj/item/food/G = used_item //feedin' dem chickens if(findtext(G.get_grown_tag(), "wheat")) // includes chopped, crushed, dried etc. if(!stat && eggsleft < 4) - user.visible_message(SPAN_NOTICE("[user] feeds \the [O] to \the [src]! It clucks happily."), SPAN_NOTICE("You feed \the [O] to \the [src]! It clucks happily."), SPAN_NOTICE("You hear clucking.")) - qdel(O) + user.visible_message(SPAN_NOTICE("[user] feeds \the [used_item] to \the [src]! It clucks happily."), SPAN_NOTICE("You feed \the [used_item] to \the [src]! It clucks happily."), SPAN_NOTICE("You hear clucking.")) + qdel(used_item) eggsleft += rand(1, 2) else to_chat(user, SPAN_NOTICE("\The [src] doesn't seem hungry!")) diff --git a/code/modules/mob/living/simple_animal/hostile/bear.dm b/code/modules/mob/living/simple_animal/hostile/bear.dm index 2f79162b6c92..95e133c9d35e 100644 --- a/code/modules/mob/living/simple_animal/hostile/bear.dm +++ b/code/modules/mob/living/simple_animal/hostile/bear.dm @@ -99,7 +99,7 @@ body.stop_automove() return -/mob/living/simple_animal/hostile/bear/attackby(var/obj/item/O, var/mob/user) +/mob/living/simple_animal/hostile/bear/attackby(var/obj/item/used_item, var/mob/user) if(istype(ai)) var/stance = ai.get_stance() if(stance != STANCE_ATTACK && stance != STANCE_ATTACKING) diff --git a/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm b/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm index 330f1afffc4d..bc1301f7569b 100644 --- a/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm +++ b/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm @@ -20,7 +20,7 @@ /obj/item/natural_weapon/nanomachine name = "decompilers" - attack_verb = list("swarmed") + attack_verb = "swarmed" _base_attack_force = 2 sharp = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spiders/ai_nurse.dm b/code/modules/mob/living/simple_animal/hostile/giant_spiders/ai_nurse.dm index b2e49edc2b09..5d2dd604740f 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spiders/ai_nurse.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spiders/ai_nurse.dm @@ -34,8 +34,8 @@ return //second, spin a sticky spiderweb on this tile - var/obj/effect/spider/stickyweb/W = locate() in get_turf(body) - if(!W) + var/obj/effect/spider/stickyweb/web = locate() in get_turf(body) + if(!web) set_activity(AI_ACTIVITY_BUILDING) body.visible_message(SPAN_NOTICE("\The [body] begins to secrete a sticky substance.")) pause() diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm index 17b7b6976f2d..d3b79844239c 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm @@ -178,7 +178,7 @@ /obj/item/natural_weapon/charbaby name = "scalding hide" atom_damage_type = BURN - attack_verb = list("singed") + attack_verb = "singed" /mob/living/simple_animal/hostile/beast/charbaby/default_hurt_interaction(mob/user) . = ..() diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm index 2ae451ec6364..34ed830fc4b1 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm @@ -32,12 +32,12 @@ /mob/living/simple_animal/hostile/parrot/space/Initialize() . = ..() - var/decl/parrot_subspecies/ps = get_parrot_species() - if(ps) - icon_set = ps.icon_set - butchery_data = ps.butchery_data + var/decl/parrot_subspecies/parrot_species = get_parrot_species() + if(parrot_species) + icon_set = parrot_species.icon_set + butchery_data = parrot_species.butchery_data if(get_subspecies_name) - SetName(ps.name) + SetName(parrot_species.name) set_scale(2) update_icon() @@ -52,7 +52,7 @@ else if(H.get_equipped_item(slot_head_str)) var/obj/item/clothing/head/HAT = H.get_equipped_item(slot_head_str) - if(H.canUnEquip(HAT)) + if(H.can_unequip_item(HAT)) visible_message(SPAN_MFAUNA("\The [src] rips \the [H]'s [HAT] off!")) set_special_ability_cooldown(ability_cooldown) H.try_unequip(HAT, get_turf(src)) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm index 63f5255223b1..57710f9594f0 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm @@ -80,7 +80,7 @@ /obj/item/natural_weapon/goatking name = "giant horns" - attack_verb = list("brutalized") + attack_verb = "brutalized" _base_attack_force = 40 sharp = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/parrot.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/parrot.dm index 3b185823bcb5..06b5079874ef 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/parrot.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/parrot.dm @@ -331,9 +331,9 @@ update_icon() //Mobs with objects -/mob/living/simple_animal/hostile/parrot/attackby(var/obj/item/O, var/mob/user) +/mob/living/simple_animal/hostile/parrot/attackby(var/obj/item/used_item, var/mob/user) . = ..() - if(!stat && !client && !istype(O, /obj/item/stack/medical) && O.expend_attack_force(user)) + if(!stat && !client && !istype(used_item, /obj/item/stack/medical) && used_item.expend_attack_force(user)) if(parrot_state == PARROT_PERCH) parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched parrot_interest = user @@ -371,10 +371,10 @@ return M /mob/living/simple_animal/hostile/parrot/proc/search_for_perch() - for(var/obj/O in view(src)) + for(var/obj/thing in view(src)) for(var/path in desired_perches) - if(istype(O, path)) - return O + if(istype(thing, path)) + return thing return null //This proc was made to save on doing two 'in view' loops seperatly diff --git a/code/modules/mob/living/simple_animal/hostile/revenant.dm b/code/modules/mob/living/simple_animal/hostile/revenant.dm index ec429d2a63c8..6e1c10aa91ce 100644 --- a/code/modules/mob/living/simple_animal/hostile/revenant.dm +++ b/code/modules/mob/living/simple_animal/hostile/revenant.dm @@ -27,7 +27,7 @@ /obj/item/natural_weapon/revenant name = "shadow tendril" - attack_verb = list("gripped") + attack_verb = "gripped" hitsound = 'sound/hallucinations/growl1.ogg' atom_damage_type = BURN _base_attack_force = 15 diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm index 325ca3f6f8a4..ae1de5c119f1 100644 --- a/code/modules/mob/living/simple_animal/hostile/tree.dm +++ b/code/modules/mob/living/simple_animal/hostile/tree.dm @@ -35,6 +35,6 @@ /mob/living/simple_animal/hostile/tree/death(gibbed) . = ..() if(. && !gibbed) - var/decl/material/mat = GET_DECL(/decl/material/solid/organic/wood) + var/decl/material/mat = GET_DECL(/decl/material/solid/organic/wood/oak) mat.place_shards(loc) qdel(src) diff --git a/code/modules/mob/living/simple_animal/natural_weapons.dm b/code/modules/mob/living/simple_animal/natural_weapons.dm index 88c5a6a93f9c..4ee419acec07 100644 --- a/code/modules/mob/living/simple_animal/natural_weapons.dm +++ b/code/modules/mob/living/simple_animal/natural_weapons.dm @@ -1,7 +1,7 @@ /obj/item/natural_weapon name = "natural weapons" gender = PLURAL - attack_verb = list("attacked") + attack_verb = "attacked" atom_damage_type = BRUTE canremove = FALSE obj_flags = OBJ_FLAG_CONDUCTIBLE //for intent of shocking checks, they're right inside the animal @@ -28,7 +28,7 @@ /obj/item/natural_weapon/bite name = "teeth" - attack_verb = list("bitten") + attack_verb = "bitten" hitsound = 'sound/weapons/bite.ogg' _base_attack_force = 10 sharp = TRUE @@ -39,7 +39,7 @@ /obj/item/natural_weapon/bite/mouse _base_attack_force = 1 - attack_verb = list("nibbled") + attack_verb = "nibbled" hitsound = null /obj/item/natural_weapon/bite/strong @@ -61,11 +61,11 @@ /obj/item/natural_weapon/hooves name = "hooves" - attack_verb = list("kicked") + attack_verb = "kicked" /obj/item/natural_weapon/punch name = "fists" - attack_verb = list("punched") + attack_verb = "punched" _base_attack_force = 10 /obj/item/natural_weapon/pincers @@ -75,7 +75,7 @@ /obj/item/natural_weapon/drone_slicer name = "sharpened leg" gender = NEUTER - attack_verb = list("sliced") + attack_verb = "sliced" atom_damage_type = BRUTE edge = TRUE show_in_message = TRUE diff --git a/code/modules/mob/living/simple_animal/passive/horse.dm b/code/modules/mob/living/simple_animal/passive/horse.dm index e7c235a6c29d..0e2c0d0c023e 100644 --- a/code/modules/mob/living/simple_animal/passive/horse.dm +++ b/code/modules/mob/living/simple_animal/passive/horse.dm @@ -10,13 +10,12 @@ default_pixel_x = -6 base_animal_type = /mob/living/simple_animal/passive/horse faction = null - buckle_pixel_shift = @"{'x':0,'y':0,'z':16}" + buckle_pixel_shift = @'{"x":0,"y":0,"z":16}' can_have_rider = TRUE max_rider_size = MOB_SIZE_MEDIUM ai = /datum/mob_controller/passive/horse - draw_visible_overlays = list( - "base" = "#ccc496" - ) + color = "#806146" // preview color + draw_visible_overlays = null // e.g. list("base" = "#806146") /datum/mob_controller/passive/horse emote_speech = list("Neigh!","NEIGH!","Neigh?") @@ -30,6 +29,7 @@ /mob/living/simple_animal/passive/horse/Initialize() . = ..() + color = null // clear preview color add_inventory_slot(new /datum/inventory_slot/back/horse) equip_to_slot_or_del(new /obj/item/saddle(src), slot_back_str) if(!LAZYACCESS(draw_visible_overlays, "base")) diff --git a/code/modules/mob/living/simple_animal/simple_animal_damage.dm b/code/modules/mob/living/simple_animal/simple_animal_damage.dm index 32cce9c5b442..479dc1004fbe 100644 --- a/code/modules/mob/living/simple_animal/simple_animal_damage.dm +++ b/code/modules/mob/living/simple_animal/simple_animal_damage.dm @@ -49,9 +49,9 @@ var/attack_name = O?.attack_message_name() if(attack_name) - visible_message(SPAN_DANGER("\The [src] has been [DEFAULTPICK(O.attack_verb, "attacked")] with [attack_name] by \the [user]!")) + visible_message(SPAN_DANGER("\The [src] has been [O.pick_attack_verb()] with [attack_name] by \the [user]!")) else - visible_message(SPAN_DANGER("\The [src] has been [DEFAULTPICK(O.attack_verb, "attacked")] by \the [user]!")) + visible_message(SPAN_DANGER("\The [src] has been [O.pick_attack_verb()] by \the [user]!")) if(istype(ai)) ai.retaliate(user) diff --git a/code/modules/mob/living/stasis.dm b/code/modules/mob/living/stasis.dm index 76fda177df5f..256e98026747 100644 --- a/code/modules/mob/living/stasis.dm +++ b/code/modules/mob/living/stasis.dm @@ -1,26 +1,3 @@ -/mob/living/proc/set_stasis(var/factor, var/source = "misc") - var/decl/bodytype/my_bodytype = get_bodytype() - if(my_bodytype?.body_flags & BODY_FLAG_NO_STASIS) - return - LAZYSET(stasis_sources, source, factor) - -/mob/living/proc/is_in_stasis() - return stasis_value ? !!(life_tick % stasis_value) : FALSE - -/mob/living/proc/handle_stasis() - stasis_value = 0 - if(stasis_sources) - var/decl/bodytype/my_bodytype = get_bodytype() - if(!(my_bodytype?.body_flags & BODY_FLAG_NO_STASIS)) - for(var/source in stasis_sources) - stasis_value += stasis_sources[source] - stasis_sources = null - - if(stasis_value > 1 && GET_STATUS(src, STAT_DROWSY) < stasis_value * 4) - ADJ_STATUS(src, STAT_DROWSY, min(stasis_value, 3)) - if(stat == CONSCIOUS && prob(1)) - to_chat(src, SPAN_NOTICE("You feel slow and sluggish...")) - /mob/living/proc/get_cryogenic_factor(var/bodytemperature) if(isSynthetic()) diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index a66a1b4f79a3..23e4895e065a 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -91,8 +91,6 @@ hud_reset(TRUE) - client.update_skybox(1) - if(istype(machine)) machine.on_user_login(src) @@ -104,9 +102,9 @@ client.screen = list() //remove hud items just in case client.set_right_click_menu_mode(shift_to_open_context_menu) initialize_hud() - else - refresh_lighting_master() + refresh_lighting_master() + client.update_skybox(full_reset) // readd to client.screen if we cleared it refresh_client_images() reload_fullscreen() // Reload any fullscreen overlays this mob has. add_click_catcher() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 982be328b221..5ccfdad3ebe1 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -309,7 +309,10 @@ client.eye = loc /mob/proc/get_descriptive_slot_name(var/slot) - return global.descriptive_slot_names[slot] || slot + if(global.abstract_slot_names[slot]) // this is an abstract slot like "in backpack" + return global.abstract_slot_names[slot] + var/datum/inventory_slot/slot_datum = get_inventory_slot_datum(slot) + return slot_datum?.slot_name || slot /mob/proc/show_stripping_window(mob/user) @@ -842,6 +845,7 @@ return ..(facing_dir) else return ..() + return FALSE /mob/proc/set_stat(var/new_stat) . = stat != new_stat @@ -1153,7 +1157,7 @@ return FALSE -/mob/proc/handle_flashed(var/flash_strength) +/mob/proc/handle_flashed(var/flash_strength, do_stun = FALSE) return FALSE /mob/proc/do_flash_animation() @@ -1318,7 +1322,7 @@ /mob/proc/set_skin_tone(value) return -/mob/proc/get_skin_tone(value) +/mob/proc/get_skin_tone() return /mob/proc/force_update_limbs() @@ -1393,8 +1397,11 @@ for(var/turf/neighbor in RANGE_TURFS(my_turf, 1)) if(neighbor == my_turf) continue - if(neighbor.contains_dense_objects(exceptions = src)) + if(neighbor.is_wall() || neighbor.is_floor()) return neighbor + var/dense_object = neighbor.get_first_dense_object(exceptions = src) + if(dense_object) + return dense_object platform = neighbor.get_supporting_platform() || (locate(/obj/structure/lattice) in neighbor) if(platform) return platform @@ -1436,10 +1443,10 @@ return FALSE // Check footwear. - if(!magboots_only && has_non_slip_footing()) - return FALSE + if(magboots_only) + return !((has_gravity() || has_magnetised_footing()) && get_solid_footing()) - if((has_gravity() || has_magnetised_footing()) && get_solid_footing()) + if(has_non_slip_footing()) return FALSE // Slip! @@ -1462,7 +1469,7 @@ if(get_equipped_item(slot_handcuffed_str) || buckled) return FALSE for(var/decl/natural_attack/attack as anything in get_mob_natural_attacks()) - if(attack.is_usable(src) && attack.shredding) + if(attack.attack_is_usable(src) && attack.shredding) return TRUE return FALSE @@ -1477,3 +1484,7 @@ /mob/proc/isSynthetic() return FALSE +// Returns true if the mob is cloaked, otherwise false +/mob/proc/is_cloaked() + return FALSE + diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index a383f3b30fca..395560654e05 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -92,7 +92,7 @@ //The last mob/living to push/drag/grab this mob (mostly used by slimes friend recognition) var/weakref/last_handled_by_mob - var/status_flags = CANSTUN|CANWEAKEN|CANPARALYSE|CANPUSH //bitflags defining which status effects can be inflicted (replaces canweaken, canstun, etc) + var/status_flags = CANSTUN|CANWEAKEN|CANPARALYSE|CANPUSH //bitflags defining which status conditions can be inflicted (replaces canweaken, canstun, etc) var/area/lastarea = null @@ -115,7 +115,7 @@ var/flavor_text = "" - var/datum/skillset/skillset = /datum/skillset + var/datum/skillset/skillset var/list/additional_vision_handlers // A lazylist of atoms from which additional vision data is retrieved diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 988521933f5b..3a0b89f448b1 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -201,14 +201,14 @@ var/global/list/global/organ_rel_size = list( /proc/Gibberish(t, p)//t is the inputted message, and any value higher than 70 for p will cause letters to be replaced instead of added /* Turn text into complete gibberish! */ var/returntext = "" - for(var/i = 1, i <= length_char(t), i++) + for(var/i in 1 to length_char(t)) var/letter = copytext_char(t, i, i+1) if(prob(50)) if(p >= 70) letter = "" - for(var/j = 1, j <= rand(0, 2), j++) + for(var/j in 1 to rand(0, 2)) letter += pick("#","@","*","&","%","$","/", "<", ">", ";","*","*","*","*","*","*","*") returntext += letter @@ -352,7 +352,7 @@ var/global/list/global/organ_rel_size = list( if(istype(belt, /obj/item/gun) || istype(belt, /obj/item/energy_blade) || istype(belt, /obj/item/baton)) threatcount += 2 - if(get_species_name() != global.using_map.default_species) + if(get_species()?.uid != global.using_map.default_species) threatcount += 2 if(check_records || check_arrest) diff --git a/code/modules/mob/mob_layering.dm b/code/modules/mob/mob_layering.dm index e4ecb2b50071..ad458692d2d3 100644 --- a/code/modules/mob/mob_layering.dm +++ b/code/modules/mob/mob_layering.dm @@ -124,6 +124,10 @@ new_pixel_x += pixel_shift["x"] || 0 new_pixel_y += pixel_shift["y"] || 0 new_pixel_z += pixel_shift["z"] || 0 + if(pixel_shift == TRUE) // TRUE -> use object's offset + new_pixel_x = buckled.pixel_x + new_pixel_y = buckled.pixel_y + new_pixel_z = buckled.pixel_z if(last_pixel_x != new_pixel_x || last_pixel_y != new_pixel_y || last_pixel_z != new_pixel_z) if(anim_time > 0) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 99f0b0fe161b..27ae2d426d93 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -64,16 +64,11 @@ if(ismob(mob)) var/mob/M = mob M.swap_hand() - if(isrobot(mob)) - var/mob/living/silicon/robot/R = mob - R.cycle_modules() - return /client/verb/attack_self() set hidden = 1 if(mob) mob.mode() - return /client/verb/toggle_throw_mode_verb() set hidden = TRUE @@ -82,31 +77,7 @@ //This proc should never be overridden elsewhere at /atom/movable to keep directions sane. /atom/movable/Move(newloc, direct) - if (direct & (direct - 1)) - if (direct & NORTH) - if (direct & EAST) - if (step(src, NORTH)) - step(src, EAST) - else if (step(src, EAST)) - step(src, NORTH) - else if (direct & WEST) - if (step(src, NORTH)) - step(src, WEST) - else if (step(src, WEST)) - step(src, NORTH) - else - if (direct & SOUTH) - if (direct & EAST) - if (step(src, SOUTH)) - step(src, EAST) - else if (step(src, EAST)) - step(src, SOUTH) - else if (direct & WEST) - if (step(src, SOUTH)) - step(src, WEST) - else if (step(src, WEST)) - step(src, SOUTH) - else + if (IS_POWER_OF_TWO(direct)) var/atom/A = src.loc var/olddir = dir //we can't override this without sacrificing the rest of movable/New() @@ -117,9 +88,21 @@ src.move_speed = world.time - src.l_move_time src.l_move_time = world.time - src.m_flag = 1 if ((A != src.loc && A && A.z == src.z)) src.last_move = get_dir(A, src.loc) + else // This doesn't handle 3D moves properly, but the old code didn't either. + moving_diagonally = /atom/movable::FIRST_DIAGONAL_STEP + var/first_dir = FIRST_DIR(direct) + var/second_dir = direct & ~first_dir + if(step(src, first_dir)) + if(moving_diagonally) // check if unset by falling + moving_diagonally = /atom/movable::SECOND_DIAGONAL_STEP + step(src, second_dir) + else if(step(src, second_dir)) + if(moving_diagonally) + moving_diagonally = /atom/movable::SECOND_DIAGONAL_STEP + step(src, first_dir) + moving_diagonally = FALSE if(!inertia_moving) inertia_next_move = world.time + inertia_move_delay diff --git a/code/modules/mob/mob_snapshot.dm b/code/modules/mob/mob_snapshot.dm index 4f5441a8933e..950dc9b2cce6 100644 --- a/code/modules/mob/mob_snapshot.dm +++ b/code/modules/mob/mob_snapshot.dm @@ -14,6 +14,8 @@ var/list/sprite_accessories var/list/genetic_conditions + /// Please find a better way to do this. This is done to add tails if we have the tail accessory selected... + var/list/extra_limbs /datum/mob_snapshot/New(mob/living/donor, genetic_info_only = FALSE) @@ -21,9 +23,11 @@ eye_color = donor?.get_eye_colour() || COLOR_BLACK blood_type = donor?.get_blood_type() unique_enzymes = donor?.get_unique_enzymes() + skin_color = donor?.get_skin_colour() + skin_tone = donor?.get_skin_tone() fingerprint = donor?.get_full_print(ignore_blockers = TRUE) - root_species = donor?.get_species() || get_species_by_key(global.using_map.default_species) + root_species = donor?.get_species() || decls_repository.get_decl_by_id(global.using_map.default_species) root_bodytype = donor?.get_bodytype() || root_species.default_bodytype for(var/obj/item/organ/external/limb in donor?.get_external_organs()) @@ -39,8 +43,8 @@ if(!condition.is_heritable) LAZYREMOVE(genetic_conditions, condition) -/datum/mob_snapshot/Clone() - var/datum/mob_snapshot/clone = ..() +/datum/mob_snapshot/PopulateClone(datum/mob_snapshot/clone) + clone = ..() if(clone) clone.real_name = real_name clone.eye_color = eye_color @@ -57,15 +61,14 @@ return clone // Replaces UpdateAppearance(). -/datum/mob_snapshot/proc/apply_appearance_to(mob/living/target) +/datum/mob_snapshot/proc/apply_appearance_to(mob/living/target, do_update = TRUE) - if(istype(root_species)) + if(istype(root_species) && root_species != target.get_species()) if(istype(root_bodytype)) - target.set_species(root_species.name, root_bodytype) + target.set_species(root_species.uid, root_bodytype) else - target.set_species(root_species.name) - - else if(istype(root_bodytype)) + target.set_species(root_species.uid) + else if(istype(root_bodytype) && target.get_bodytype() != root_bodytype) target.set_bodytype(root_bodytype) target.set_fingerprint(fingerprint) @@ -74,15 +77,22 @@ target.set_eye_colour(eye_color) target.set_skin_tone(skin_tone) + for(var/limb_data in extra_limbs) + var/limb_path = extra_limbs[limb_data]["path"] + var/obj/item/organ/external/new_limb = new limb_path(null, null, src) + target.add_organ(new_limb, null, TRUE, FALSE, FALSE, TRUE) + extra_limbs = null // can't reuse it! + for(var/obj/item/organ/organ in target.get_organs()) organ.copy_from_mob_snapshot(src) for(var/decl/genetic_condition/condition as anything in genetic_conditions) target.add_genetic_condition(condition.type) - target.force_update_limbs() - target.update_hair(update_icons = FALSE) - target.update_eyes() + if(do_update) + target.force_update_limbs() + target.update_hair(update_icons = FALSE) + target.update_eyes() return TRUE /mob/proc/get_mob_snapshot(check_dna = FALSE) diff --git a/code/modules/mob/mob_status.dm b/code/modules/mob/mob_status.dm index 0e2c45822b99..5e08a530c40b 100644 --- a/code/modules/mob/mob_status.dm +++ b/code/modules/mob/mob_status.dm @@ -1,9 +1,24 @@ // Stubs; see living_status.dm -/mob/proc/handle_status_effects() +/mob/proc/handle_status_conditions() SHOULD_CALL_PARENT(TRUE) -/mob/proc/clear_status_effects() +/mob/proc/clear_status_conditions() return -/mob/proc/set_status(var/condition, var/amount) +/mob/proc/set_status_condition(var/condition, var/amount) return + +/mob/proc/clear_mob_modifiers() + return FALSE + +/mob/proc/remove_mob_modifier(decl/mob_modifier/archetype, datum/source, skip_update = FALSE) + return FALSE + +/mob/proc/has_mob_modifier(decl/mob_modifier/archetype, datum/source) + return FALSE + +/mob/proc/add_mob_modifier(decl/mob_modifier/archetype, duration = MOB_MODIFIER_INDEFINITE, datum/source, skip_update = FALSE) + return FALSE + +/mob/proc/mob_modifiers_block_attack(...) + return FALSE // see living_defense.dm diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm index 6c3a0d04adaf..57c2e4070177 100644 --- a/code/modules/mob/new_player/login.dm +++ b/code/modules/mob/new_player/login.dm @@ -37,10 +37,10 @@ var/decl/security_state/security_state = GET_DECL(global.using_map.security_state) if(security_state?.show_on_login) - var/decl/security_level/SL = security_state.current_security_level - // todo: allow maps to oevrride this string for things like the fantasy map being on high alert? + var/decl/security_level/sec_level = security_state.current_security_level + // todo: allow maps to override this string for things like the fantasy map being on high alert? // eg "The alert level *in* Karzerfeste Keep is currently high alert." or "Karzerfeste Keep is currently on high alert." - to_chat(src, SPAN_NOTICE("The alert level on the [station_name()] is currently: [SL.name]. [SL?.up_description]")) + to_chat(src, SPAN_NOTICE("The alert level on the [station_name()] is currently: [sec_level.name]. [sec_level?.up_description]")) // bolds the changelog button on the interface so we know there are updates. if(client.prefs?.lastchangelog != global.changelog_hash) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 76e3dc995a59..2a460c53a435 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -164,7 +164,7 @@ INITIALIZE_IMMEDIATE(/mob/new_player) if(!SSjobs.check_general_join_blockers(src, job)) return FALSE - var/decl/species/S = get_species_by_key(client.prefs.species) + var/decl/species/S = client.prefs.get_species_decl() if(!check_species_allowed(S)) return 0 @@ -361,7 +361,7 @@ INITIALIZE_IMMEDIATE(/mob/new_player) var/decl/species/chosen_species if(client.prefs.species) - chosen_species = get_species_by_key(client.prefs.species) + chosen_species = client.prefs.get_species_decl() if(!spawn_turf) var/datum/job/job = SSjobs.get_by_title(mind.assigned_role) @@ -374,20 +374,16 @@ INITIALIZE_IMMEDIATE(/mob/new_player) if(!check_species_allowed(chosen_species)) spawning = 0 //abort return null - new_character = new(spawn_turf, chosen_species.name) - - if(!new_character) - new_character = new(spawn_turf) - - new_character.lastarea = get_area(spawn_turf) - - if(global.random_players) + if(global.random_players) // apply randomness prior to creating the character var/decl/species/current_species = client.prefs.get_species_decl() var/decl/pronouns/pronouns = pick(current_species.available_pronouns) client.prefs.gender = pronouns.name client.prefs.real_name = client.prefs.get_random_name() client.prefs.randomize_appearance_and_body_for(new_character) - client.prefs.copy_to(new_character) + new_character = client.prefs.create_character_from_snapshot(spawn_turf) + new_character.lastarea = get_area(spawn_turf) + + // client.prefs.copy_to(new_character) // not anymore lol sound_to(src, sound(null, repeat = 0, wait = 0, volume = 85, channel = sound_channels.lobby_channel))// MAD JAMS cant last forever yo @@ -427,11 +423,11 @@ INITIALIZE_IMMEDIATE(/mob/new_player) /mob/new_player/proc/check_species_allowed(var/decl/species/S, var/show_alert=1) if(!S.is_available_for_join() && !has_admin_rights()) if(show_alert) - to_chat(src, alert("Your current species, [client.prefs.species], is not available for play.")) + to_chat(src, alert("Your current species, [S.name], is not available for play.")) return 0 if(!is_alien_whitelisted(src, S)) if(show_alert) - to_chat(src, alert("You are currently not whitelisted to play [client.prefs.species].")) + to_chat(src, alert("You are currently not whitelisted to play [S.name_plural].")) return 0 return 1 @@ -439,7 +435,7 @@ INITIALIZE_IMMEDIATE(/mob/new_player) SHOULD_CALL_PARENT(FALSE) var/decl/species/chosen_species if(client.prefs.species) - chosen_species = get_species_by_key(client.prefs.species) + chosen_species = client.prefs.get_species_decl() if(!chosen_species || !check_species_allowed(chosen_species, 0)) return global.using_map.default_species return chosen_species.name diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 388f9e21797b..02545d440181 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -85,24 +85,24 @@ if((equip_preview_mob & EQUIP_PREVIEW_LOADOUT) && !(previewJob && (equip_preview_mob & EQUIP_PREVIEW_JOB) && previewJob.skip_loadout_preview)) // Equip custom gear loadout, replacing any job items for(var/thing in Gear()) - var/decl/loadout_option/G = decls_repository.get_decl_by_id_or_var(thing, /decl/loadout_option) - if(G) + var/decl/loadout_option/gear = decls_repository.get_decl_by_id_or_var(thing, /decl/loadout_option) + if(gear) var/permitted = FALSE - if(G.allowed_roles && G.allowed_roles.len) + if(LAZYLEN(gear.allowed_roles)) if(previewJob) - for(var/job_type in G.allowed_roles) + for(var/job_type in gear.allowed_roles) if(previewJob.type == job_type) permitted = TRUE else permitted = TRUE - if(G.whitelisted && !(mannequin.species.name in G.whitelisted)) + if(gear.whitelisted && !(mannequin.species.uid in gear.whitelisted)) permitted = FALSE if(!permitted) continue - if(G.slot && G.spawn_on_mob(mannequin, gear_list[gear_slot][G.uid])) + if(gear.slot && gear.spawn_on_mob(mannequin, gear_list[gear_slot][gear.uid])) update_icon = TRUE if(update_icon) diff --git a/code/modules/mob/observer/eye/freelook/ai/cameranet.dm b/code/modules/mob/observer/eye/freelook/ai/cameranet.dm index d6653c5dfd85..90e270c35ddf 100644 --- a/code/modules/mob/observer/eye/freelook/ai/cameranet.dm +++ b/code/modules/mob/observer/eye/freelook/ai/cameranet.dm @@ -1,7 +1,7 @@ // CAMERA NET // // The datum containing all the chunks. - +var/global/datum/visualnet/camera/cameranet = new() /datum/visualnet/camera // The security cameras on the map, no matter if they work or not. This list only contains cameras of type /obj/machinery/camera. var/list/cameras diff --git a/code/modules/mob/observer/eye/freelook/update_triggers.dm b/code/modules/mob/observer/eye/freelook/update_triggers.dm index 674973f5e4a7..197fb081c4b3 100644 --- a/code/modules/mob/observer/eye/freelook/update_triggers.dm +++ b/code/modules/mob/observer/eye/freelook/update_triggers.dm @@ -4,7 +4,7 @@ /proc/updateVisibility(atom/A, var/opacity_check = 1) if(GAME_STATE >= RUNLEVEL_GAME) - for(var/datum/visualnet/VN in visual_nets) + for(var/datum/visualnet/VN in all_visual_nets) VN.update_visibility(A, opacity_check) /turf/drain_power() diff --git a/code/modules/mob/observer/eye/freelook/visualnet.dm b/code/modules/mob/observer/eye/freelook/visualnet.dm index 59d409d2224e..c71be4a09622 100644 --- a/code/modules/mob/observer/eye/freelook/visualnet.dm +++ b/code/modules/mob/observer/eye/freelook/visualnet.dm @@ -1,7 +1,7 @@ // VISUAL NET // // The datum containing all the chunks. - +var/global/list/datum/visualnet/all_visual_nets = list() /datum/visualnet // The chunks of the map, mapping the areas that an object can see. var/list/chunks = list() @@ -11,12 +11,12 @@ /datum/visualnet/New() ..() - visual_nets += src + all_visual_nets += src if(!valid_source_types) valid_source_types = list() /datum/visualnet/Destroy() - visual_nets -= src + all_visual_nets -= src for(var/source in sources) remove_source(source, FALSE) sources.Cut() diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 6ec207ea1b87..43b674835701 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -1,11 +1,11 @@ /mob/living/human/proc/monkeyize() if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) return - for(var/obj/item/W in get_contained_external_atoms()) - drop_from_inventory(W) + for(var/obj/item/thing in get_contained_external_atoms()) + drop_from_inventory(thing) try_refresh_visible_overlays() ADD_TRANSFORMATION_MOVEMENT_HANDLER(src) - set_status(STAT_STUN, 1) + set_status_condition(STAT_STUN, 1) icon = null set_invisibility(INVISIBILITY_ABSTRACT) for(var/t in get_external_organs()) @@ -18,7 +18,7 @@ //animation = null DEL_TRANSFORMATION_MOVEMENT_HANDLER(src) - set_status(STAT_STUN, 0) + set_status_condition(STAT_STUN, 0) update_posture() set_invisibility(initial(invisibility)) @@ -26,8 +26,8 @@ gib() return - for(var/obj/item/W in src) - drop_from_inventory(W) + for(var/obj/item/thing in src) + drop_from_inventory(thing) change_species(species.primitive_form) to_chat(src, "You are now [species.name]. ") @@ -53,8 +53,8 @@ return for(var/t in get_external_organs()) qdel(t) - for(var/obj/item/W in src) - drop_from_inventory(W) + for(var/obj/item/thing in src) + drop_from_inventory(thing) ADD_TRANSFORMATION_MOVEMENT_HANDLER(src) icon = null set_invisibility(INVISIBILITY_ABSTRACT) @@ -75,21 +75,21 @@ if(move) var/obj/loc_landmark - for(var/obj/abstract/landmark/start/sloc in global.landmarks_list) + for(var/obj/abstract/landmark/start/sloc in global.all_landmarks) if (sloc.name != "AI") continue if (locate(/mob/living) in sloc.loc) continue loc_landmark = sloc if (!loc_landmark) - for(var/obj/abstract/landmark/tripai in global.landmarks_list) + for(var/obj/abstract/landmark/tripai in global.all_landmarks) if (tripai.name == "tripai") if((locate(/mob/living) in tripai.loc) || (locate(/obj/structure/aicore) in tripai.loc)) continue loc_landmark = tripai if (!loc_landmark) to_chat(O, "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone.") - for(var/obj/abstract/landmark/start/sloc in global.landmarks_list) + for(var/obj/abstract/landmark/start/sloc in global.all_landmarks) if (sloc.name == "AI") loc_landmark = sloc O.forceMove(loc_landmark ? loc_landmark.loc : get_turf(src)) @@ -106,8 +106,8 @@ if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) return QDEL_NULL_LIST(worn_underwear) - for(var/obj/item/W in src) - drop_from_inventory(W) + for(var/obj/item/thing in src) + drop_from_inventory(thing) try_refresh_visible_overlays() ADD_TRANSFORMATION_MOVEMENT_HANDLER(src) icon = null @@ -141,8 +141,8 @@ /mob/living/human/proc/corgize() if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) return - for(var/obj/item/W in src) - drop_from_inventory(W) + for(var/obj/item/thing in src) + drop_from_inventory(thing) try_refresh_visible_overlays() ADD_TRANSFORMATION_MOVEMENT_HANDLER(src) icon = null @@ -169,8 +169,8 @@ if(HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) return - for(var/obj/item/W in src) - drop_from_inventory(W) + for(var/obj/item/thing in src) + drop_from_inventory(thing) try_refresh_visible_overlays() ADD_TRANSFORMATION_MOVEMENT_HANDLER(src) diff --git a/code/modules/mob_holder/_holder.dm b/code/modules/mob_holder/_holder.dm index 18a1f358dd90..150f526f489b 100644 --- a/code/modules/mob_holder/_holder.dm +++ b/code/modules/mob_holder/_holder.dm @@ -151,9 +151,9 @@ update_icon() update_held_icon() -/obj/item/holder/attackby(obj/item/W, mob/user) +/obj/item/holder/attackby(obj/item/used_item, mob/user) for(var/mob/M in src.contents) - . = M.attackby(W,user) + . = M.attackby(used_item,user) if(.) return return FALSE \ No newline at end of file diff --git a/code/modules/mob_modifiers/_modifiers.dm b/code/modules/mob_modifiers/_modifiers.dm new file mode 100644 index 000000000000..677608454afb --- /dev/null +++ b/code/modules/mob_modifiers/_modifiers.dm @@ -0,0 +1,89 @@ +// Notes on mob modifiers: +// - added/removed from mob with add_mob_modifier(/decl/mob_modifier/foo, DURATION IN DS, source = SOME ATOM) +// - decl will generate a decl/mob_modifier based on the source of the modifier +// - decl heartbeat logic (actual modifier) will run once per life tick regardless of number of sources, if you want +// stacking modifiers it has to be implemented within the decl. + +/// Instanced 'modifiers' that sit on top of a mob and can expire over time or linger until dispelled. +/// Some are purely visual, others have associated modifiers. +/decl/mob_modifier + abstract_type = /decl/mob_modifier + /// Tooltip name of this modifier. + var/name + /// Tooltip description of this modifier. + var/desc + /// Icon to use for the HUD element. + var/hud_icon = 'icons/screen/mob_modifiers.dmi' + /// State to use for the HUD element. + var/hud_icon_state + /// Icon to draw from for the mob overlay modifier is present. + var/mob_overlay_icon + /// State to draw over the mob when modifier is present. + var/mob_overlay_state + /// Metadata type to create for this status modifier. + var/modifier_type = /datum/mob_modifier + /// Message shown to the target when modifier begins. + var/on_add_message_1p + /// Message shown to the audience when modifier begins. + var/on_add_message_3p + /// Message shown to the target when modifier ends. + var/on_end_message_1p + /// Message shown to the audience when modifier ends. + var/on_end_message_3p + /// Whether or not this modifier can be granted by admin (source-ambivalent) + var/can_be_admin_granted = FALSE + /// Whether or not this modifier shows a lemniscate when set to indefinite duration. + var/show_indefinite_duration = TRUE + /// Whether or not this modifier shows remaining time before expiry. + var/hide_expiry= FALSE + +/decl/mob_modifier/validate() + . = ..() + if(!hud_icon) + . += "no hud_icon set" + if(!istext(hud_icon_state)) + . += "null or invalid hud_icon_state" + if(hud_icon && hud_icon_state && !check_state_in_icon(hud_icon_state, hud_icon)) + . += "hud_icon '[hud_icon]' missing hud_icon_state '[hud_icon_state]'" + + if(mob_overlay_icon) + if(istext(mob_overlay_state)) + if(!check_state_in_icon(mob_overlay_state, mob_overlay_icon)) + . += "mob_overlay_icon '[mob_overlay_icon]' missing mob_overlay_state '[mob_overlay_state]'" + else + . += "null or invalid mob_overlay_state" + else if(mob_overlay_state) + . += "mob_overlay_state set but mob_overlay_icon not set" + +/decl/mob_modifier/proc/replace_tokens(message, mob/user) + return capitalize(emote_replace_user_tokens(message, user)) + +/decl/mob_modifier/proc/on_modifier_datum_added(mob/living/_owner, datum/mob_modifier/modifier) + if(on_add_message_3p) + _owner.visible_message(replace_tokens(on_add_message_3p, _owner), replace_tokens((on_add_message_3p || on_add_message_1p), _owner)) + else if(on_add_message_1p) + to_chat(_owner, replace_tokens(on_add_message_1p, _owner)) + return TRUE + +/decl/mob_modifier/proc/on_modifier_datum_removed(mob/living/_owner, datum/mob_modifier/modifier) + if(on_end_message_3p) + _owner.visible_message(replace_tokens(on_end_message_3p, _owner), replace_tokens((on_end_message_3p || on_end_message_1p), _owner)) + else if(on_end_message_1p) + to_chat(_owner, replace_tokens(on_end_message_1p, _owner)) + return TRUE + +/decl/mob_modifier/proc/on_modifier_datum_expiry(mob/living/_owner, datum/mob_modifier/modifier) + return TRUE + +/decl/mob_modifier/proc/on_modifier_datum_mob_life(mob/living/_owner, list/modifiers) + SHOULD_CALL_PARENT(TRUE) + . = FALSE + for(var/datum/mob_modifier/modifier in modifiers) + if(modifier.on_modifier_mob_life()) + . = TRUE + +/decl/mob_modifier/proc/on_modifier_datum_click(mob/living/_owner, datum/mob_modifier/modifier, params) + return FALSE + +/decl/mob_modifier/proc/check_modifiers_block_attack(mob/living/_owner, list/modifiers, attack_type, atom/movable/attacker, additional_data) + return FALSE diff --git a/code/modules/mob_modifiers/definitions/modifiers_cloaked.dm b/code/modules/mob_modifiers/definitions/modifiers_cloaked.dm new file mode 100644 index 000000000000..5ac1889ce59e --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_cloaked.dm @@ -0,0 +1,17 @@ +/decl/mob_modifier/cloaked + name = "Cloaked" + desc = "You are hidden from casual sight." + hud_icon_state = "cloaked" + on_add_message_1p = SPAN_NOTICE("You feel completely invisible.") + on_add_message_3p = SPAN_WARNING("$USER$ seems to disappear before your eyes!") + on_end_message_1p = SPAN_NOTICE("You have re-appeared.") + on_end_message_3p = SPAN_WARNING("$USER$ appears from thin air!") + can_be_admin_granted = TRUE + +// Not ideal, but existing cloaking code is iffy about removing cloaking sources appropriately (specifically rig modules) +/decl/mob_modifier/cloaked/on_modifier_datum_mob_life(mob/living/_owner, list/modifiers) + . = ..() + for(var/datum/mob_modifier/modifier in modifiers) + var/atom/source = modifier.source?.resolve() + if(istype(source) && source.get_recursive_loc_of_type(/mob/living) != _owner) + _owner.remove_mob_modifier(src, source = source) diff --git a/code/modules/mob_modifiers/definitions/modifiers_light.dm b/code/modules/mob_modifiers/definitions/modifiers_light.dm new file mode 100644 index 000000000000..9b352184cb7f --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_light.dm @@ -0,0 +1,39 @@ +/datum/mob_modifier/object/light + var/light_range = 6 + var/light_power = 6 + var/light_color = COLOR_BEIGE + +/decl/mob_modifier/light + name = "Light Aura" + desc = "You are emitting a gentle radiance." + hud_icon_state = "light" + on_add_message_1p = SPAN_NOTICE("A gentle radiance emanates from your body.") + on_end_message_1p = SPAN_NOTICE("The light spilling from your body fades.") + modifier_type = /datum/mob_modifier/object/light + can_be_admin_granted = TRUE + +/datum/mob_modifier/object/light/on_modifier_added(skip_update) + . = ..() + if(istype(object) && (light_range || light_power || light_color)) + object.set_light(light_range, light_power, light_color) + +/decl/mob_modifier/light/radiant + name = "Radiant Aura" + desc = "You are guarded from laser weapons by a radiant aura." + mob_overlay_icon = 'icons/effects/effects.dmi' + mob_overlay_state = "fire_goon" + on_add_message_1p = SPAN_NOTICE("A bubble of light appears around you, exuding protection and warmth.") + on_end_message_1p = SPAN_DANGER("Your protective aura dissipates, leaving you feeling cold and unsafe.") + modifier_type = /datum/mob_modifier/object/light + +/datum/mob_modifier/object/light/radiant + light_color = "#e09d37" + +/decl/mob_modifier/light/radiant/check_modifiers_block_attack(mob/living/_owner, list/modifiers, attack_type, atom/movable/attacker, additional_data) + if(attack_type != MM_ATTACK_TYPE_PROJECTILE) + return ..() + var/obj/item/projectile/projectile = attacker + if(istype(projectile) && (projectile.damage_flags() & DAM_LASER)) + _owner.visible_message(SPAN_WARNING("\The [projectile] refracts, bending into \the [_owner]'s radiance.")) + return (MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED) + return MM_ATTACK_RESULT_NONE diff --git a/code/modules/mob_modifiers/definitions/modifiers_mech_shields.dm b/code/modules/mob_modifiers/definitions/modifiers_mech_shields.dm new file mode 100644 index 000000000000..0c8d4112507f --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_mech_shields.dm @@ -0,0 +1,166 @@ +/decl/mob_modifier/mechshield + name = "Mech Energy Shield" + hud_icon_state = "shield" + modifier_type = /datum/mob_modifier/object/mechshield + +/decl/mob_modifier/mechshield/on_modifier_datum_added(mob/living/_owner, datum/mob_modifier/modifier) + . = ..() + if(istype(modifier, /datum/mob_modifier/object)) + var/datum/mob_modifier/object/obj_modifier = modifier + if(istype(obj_modifier.object)) + flick("shield_raise", obj_modifier.object) + +/decl/mob_modifier/mechshield/on_modifier_datum_removed(mob/living/_owner, datum/mob_modifier/modifier) + if(istype(modifier, /datum/mob_modifier/object)) + var/datum/mob_modifier/object/obj_modifier = modifier + if(istype(obj_modifier.object)) + var/obj/effect/temporary/drop_shield = new(get_turf(_owner)) + drop_shield.appearance = obj_modifier.object + flick("shield_drop", drop_shield) + QDEL_IN(drop_shield, 1 SECOND) + return ..() + +/datum/mob_modifier/object/mechshield + object = /obj/abstract/follower/mechshield + +/obj/abstract/follower/mechshield + name = "mechshield" + layer = ABOVE_HUMAN_LAYER + plane = DEFAULT_PLANE + icon = 'icons/mecha/shield.dmi' + icon_state = "shield" + pixel_x = 8 + pixel_y = 4 + mouse_opacity = MOUSE_OPACITY_UNCLICKABLE + invisibility = INVISIBILITY_NONE + alpha = 255 + hide_on_init = FALSE + +/obj/abstract/follower/mechshield/follow_owner(atom/movable/owner) + . = ..() + layer = (dir == NORTH) ? MECH_UNDER_LAYER : initial(layer) + +/decl/mob_modifier/mechshield/check_modifiers_block_attack(mob/living/_owner, list/modifiers, attack_type, atom/movable/attacker, additional_data) + + if(attack_type == MM_ATTACK_TYPE_WEAPON) + return ..() + + . = MM_ATTACK_RESULT_NONE + var/shield_hit = FALSE + if(attack_type == MM_ATTACK_TYPE_PROJECTILE) + + var/obj/item/projectile/projectile = attacker + if(!istype(projectile)) + return + + for(var/datum/mob_modifier/modifier in modifiers) + var/obj/item/mech_equipment/shields/shield = modifier.source?.resolve() + if(!istype(shield) || !shield.charge) + continue + if(!shield_hit) + _owner.visible_message(SPAN_WARNING("\The [shield.owner]'s shields flash and crackle.")) + shield_hit = TRUE + new /obj/effect/effect/smoke/illumination(_owner.loc, 5, 4, 1, "#ffffff") + spark_at(_owner, amount=5) + projectile.damage = shield.stop_damage(projectile.damage) + if(projectile.damage <= 0) + . = (MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED) + + else if(attack_type == MM_ATTACK_TYPE_THROWN) + + var/datum/thrownthing/thrown = additional_data + if(!istype(thrown) || thrown.speed > 5) + return + + for(var/datum/mob_modifier/modifier in modifiers) + var/obj/item/mech_equipment/shields/shield = modifier.source?.resolve() + if(istype(shield) && shield.charge) + _owner.visible_message(SPAN_WARNING("\The [shield.owner]'s shields flash briefly as they deflect \the [thrown.thrownthing].")) + shield_hit = TRUE + . = (MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED) + break + + //light up the night. + if(shield_hit) + playsound(_owner,'sound/effects/basscannon.ogg', 20, 1) + for(var/datum/mob_modifier/object/mechshield/obj_modifier in modifiers) + if(obj_modifier.object) + flick("shield_impact", obj_modifier.object) + +/decl/mob_modifier/mech_ballistic + name = "Mech Ballistic Shield" + hud_icon_state = "nanomachines" + modifier_type = /datum/mob_modifier/object/mechshield_ballistic + +/datum/mob_modifier/object/mechshield_ballistic + object = /obj/abstract/follower/mechshield_ballistic + +/datum/mob_modifier/object/mechshield_ballistic/on_modifier_added(skip_update = FALSE) + . = ..() + var/obj/item/mech_equipment/source_atom = source?.resolve() + if(!istype(source_atom) || !istype(object) || !istype(owner, /mob/living/exosuit)) + return + var/mob/living/exosuit/mech = owner + for(var/hardpoint in mech.hardpoints) + var/obj/item/mech_equipment/hardpoint_object = mech.hardpoints[hardpoint] + if(source_atom != hardpoint_object) + continue + object.icon_state = "mech_shield_[hardpoint]" + var/image/mech_overlay = image(object.icon, "[object.icon_state]_over") + mech_overlay.layer = ABOVE_HUMAN_LAYER + object.add_overlay(mech_overlay, priority = TRUE) + +/obj/abstract/follower/mechshield_ballistic + icon = 'icons/mecha/ballistic_shield.dmi' + layer = MECH_UNDER_LAYER + plane = DEFAULT_PLANE + mouse_opacity = MOUSE_OPACITY_UNCLICKABLE + invisibility = INVISIBILITY_NONE + alpha = 255 + hide_on_init = FALSE + +/decl/mob_modifier/mech_ballistic/check_modifiers_block_attack(mob/living/_owner, list/modifiers, attack_type, atom/movable/attacker, additional_data) + + if(attack_type == MM_ATTACK_TYPE_PROJECTILE) + + var/obj/item/projectile/projectile = attacker + if(istype(projectile)) + + var/target_zone = BP_CHEST + if(isliving(attacker)) + var/mob/living/attacker_mob = attacker + target_zone = attacker_mob.get_target_zone() + + for(var/datum/mob_modifier/modifier in modifiers) + var/obj/item/mech_equipment/ballistic_shield/shield = modifier.source?.resolve() + if(istype(shield) && prob(shield.block_chance(projectile.damage, projectile.armor_penetration, source = projectile))) + _owner.visible_message(SPAN_WARNING("\The [projectile] is blocked by \the [_owner]'s [shield.name].")) + _owner.bullet_impact_visuals(projectile, target_zone, 0) + shield.on_block_attack() + return (MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED) + + else if(attack_type == MM_ATTACK_TYPE_THROWN) + + var/datum/thrownthing/thrown = additional_data + if(istype(thrown)) + var/throw_damage = thrown.thrownthing.get_thrown_attack_force() * (thrown.speed/THROWFORCE_SPEED_DIVISOR) + for(var/datum/mob_modifier/modifier in modifiers) + var/obj/item/mech_equipment/ballistic_shield/shield = modifier.source?.resolve() + if(istype(shield) && prob(shield.block_chance(throw_damage, 0, source = thrown.thrownthing, attacker = thrown.thrower))) + _owner.visible_message(SPAN_WARNING("\The [thrown.thrownthing] bounces off \the [_owner]'s [shield].")) + playsound(_owner.loc, 'sound/weapons/Genhit.ogg', 50, 1) + shield.on_block_attack() + return (MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED) + + else if(attack_type == MM_ATTACK_TYPE_WEAPON) + + var/obj/item/weapon = additional_data + if(istype(weapon)) + for(var/datum/mob_modifier/modifier in modifiers) + var/obj/item/mech_equipment/ballistic_shield/shield = modifier.source?.resolve() + if(shield && prob(shield.block_chance(weapon.get_attack_force(), weapon.armor_penetration, source = weapon, attacker = _owner))) + _owner.visible_message(SPAN_WARNING("\The [weapon] is blocked by \the [_owner]'s [shield.name].")) + playsound(_owner.loc, 'sound/weapons/Genhit.ogg', 50, 1) + return (MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED) + + return ..() diff --git a/code/modules/mob_modifiers/definitions/modifiers_nanoswarm.dm b/code/modules/mob_modifiers/definitions/modifiers_nanoswarm.dm new file mode 100644 index 000000000000..ddb6d6023eae --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_nanoswarm.dm @@ -0,0 +1,34 @@ +//This handy augment protects you to a degree, keeping it online after critical damage however is bad +/decl/mob_modifier/nanoswarm + name = "Defensive Nanoswarm" + desc = "You are surrounded by nanomachines that harden in response to projectiles." + hud_icon_state = "nanomachines" + on_add_message_1p = SPAN_NOTICE("Your skin tingles as the nanites spread over your body.") + on_end_message_1p = SPAN_WARNING("The nanites dissolve!") + +/decl/mob_modifier/nanoswarm/on_modifier_datum_added(mob/living/_owner, decl/mob_modifier/modifier) + . = ..() + playsound(_owner.loc,'sound/weapons/flash.ogg',35,1) + +/decl/mob_modifier/nanoswarm/check_modifiers_block_attack(mob/living/_owner, list/modifiers, attack_type, atom/movable/attacker, additional_data) + if(attack_type != MM_ATTACK_TYPE_PROJECTILE) + return ..() + + var/obj/item/organ/internal/augment/active/nanounit/unit + for(var/datum/mob_modifier/modifier in modifiers) + var/obj/item/organ/internal/augment/active/nanounit/implant = modifier.source?.resolve() + if(istype(implant) && implant.active && implant.charges >= 0) // active with 0 charges means it's about to critically fail. + unit = implant + break + + if(!istype(unit)) + return ..() + + _owner.visible_message(SPAN_WARNING("The nanomachines harden as a response to physical trauma!")) + playsound(_owner, 'sound/effects/basscannon.ogg',35,1) + unit.charges-- + if(unit.charges <= 0) + to_chat(_owner, SPAN_DANGER("Warning: Critical damage threshold passed. Shut down unit to avoid further damage.")) + else + unit.catastrophic_failure() + return MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED diff --git a/code/modules/mob_modifiers/definitions/modifiers_object.dm b/code/modules/mob_modifiers/definitions/modifiers_object.dm new file mode 100644 index 000000000000..2904208d8c5e --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_object.dm @@ -0,0 +1,19 @@ +/datum/mob_modifier/object + var/obj/object = /obj/abstract/follower + +/datum/mob_modifier/object/Destroy(force) + if(istype(object)) + if(owner) + events_repository.unregister(/decl/observ/moved, owner, object) + events_repository.unregister(/decl/observ/dir_set, owner, object) + QDEL_NULL(object) + return ..() + +/datum/mob_modifier/object/on_modifier_added(skip_update = FALSE) + . = ..() + if(istype(owner)) + if(ispath(object)) + object = new object(get_turf(owner)) + if(istype(object)) + events_repository.register(/decl/observ/moved, owner, object, TYPE_PROC_REF(/obj/abstract/follower, follow_owner)) + events_repository.register(/decl/observ/dir_set, owner, object, TYPE_PROC_REF(/obj/abstract/follower, follow_owner)) diff --git a/code/modules/mob_modifiers/definitions/modifiers_prone.dm b/code/modules/mob_modifiers/definitions/modifiers_prone.dm new file mode 100644 index 000000000000..caf5b30c53b6 --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_prone.dm @@ -0,0 +1,10 @@ +/decl/mob_modifier/prone + name = "Prone" + desc = "You are lying prone and may need to stand up before taking action." + hud_icon_state = "prone" + show_indefinite_duration = FALSE + +/decl/mob_modifier/prone/on_modifier_datum_click(mob/living/_owner, decl/mob_modifier/modifier, params) + if(_owner.current_posture?.prone) + _owner.lay_down() + return TRUE diff --git a/code/modules/mob_modifiers/definitions/modifiers_regeneration.dm b/code/modules/mob_modifiers/definitions/modifiers_regeneration.dm new file mode 100644 index 000000000000..da18d3f80594 --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_regeneration.dm @@ -0,0 +1,123 @@ +/decl/mob_modifier/regeneration + name = "Regeneration" + desc = "You are rapidly recovering from physical trauma and poisons." + hud_icon_state = "regeneration" + can_be_admin_granted = TRUE + + var/brute_mult = 1 + var/fire_mult = 1 + var/tox_mult = 1 + +/decl/mob_modifier/regeneration/on_modifier_datum_mob_life(mob/living/_owner, list/modifiers) + . = ..() + _owner.heal_damage(BRUTE, brute_mult, do_update_health = FALSE) + _owner.heal_damage(BURN, fire_mult, do_update_health = FALSE) + _owner.heal_damage(TOX, tox_mult) + +/decl/mob_modifier/regeneration/organ + name = "Organ Regeneration" + desc = "Your body is rapidly recovering from physical trauma and poisons, so long as you can feed it." + var/nutrition_damage_mult = 1 //How much nutrition it takes to heal regular damage + var/external_nutrition_mult = 50 // How much nutrition it takes to regrow a limb + var/organ_mult = 2 + var/regen_message = SPAN_WARNING("Your body throbs as you feel your ORGAN regenerate.") + var/grow_chance = 15 + var/grow_threshold = 200 + var/ignore_tag = BP_BRAIN //organ tag to ignore + var/last_nutrition_warning = 0 + var/innate_heal = TRUE // Whether the aura is on, basically. + +/decl/mob_modifier/regeneration/organ/proc/external_regeneration_effect(mob/living/_owner, obj/item/organ/external/limb) + return + +/decl/mob_modifier/regeneration/organ/on_modifier_datum_mob_life(mob/living/_owner, list/modifiers) + . = ..() + if(!length(_owner.get_external_organs())) + return + if(!innate_heal || _owner.has_mob_modifier(/decl/mob_modifier/stasis) || _owner.stat == DEAD) + return + if(_owner.get_nutrition() < nutrition_damage_mult) + low_nut_warning(_owner) + return + + var/update_health = FALSE + var/organ_regen = get_config_value(/decl/config/num/health_organ_regeneration_multiplier) + if(brute_mult && _owner.get_damage(BRUTE)) + update_health = TRUE + _owner.heal_damage(BRUTE, brute_mult * organ_regen, do_update_health = FALSE) + _owner.adjust_nutrition(-nutrition_damage_mult) + if(fire_mult && _owner.get_damage(BURN)) + update_health = TRUE + _owner.heal_damage(BURN, fire_mult * organ_regen, do_update_health = FALSE) + _owner.adjust_nutrition(-nutrition_damage_mult) + if(tox_mult && _owner.get_damage(TOX)) + update_health = TRUE + _owner.heal_damage(TOX, tox_mult * organ_regen, do_update_health = FALSE) + _owner.adjust_nutrition(-nutrition_damage_mult) + if(update_health) + _owner.update_health() + if(!can_regenerate_organs()) + return + if(organ_mult) + if(prob(10) && _owner.nutrition >= 150 && !_owner.get_damage(BRUTE) && !_owner.get_damage(BURN)) + var/obj/item/organ/external/D = GET_EXTERNAL_ORGAN(_owner, BP_HEAD) + if (D.status & ORGAN_DISFIGURED) + if (_owner.nutrition >= 20) + D.status &= ~ORGAN_DISFIGURED + _owner.adjust_nutrition(-20) + else + low_nut_warning(_owner, BP_HEAD) + + var/list/organs = _owner.get_internal_organs() + for(var/obj/item/organ/internal/regen_organ in shuffle(organs.Copy())) + if(BP_IS_PROSTHETIC(regen_organ) || regen_organ.organ_tag == ignore_tag) + continue + if(istype(regen_organ)) + if(regen_organ.get_organ_damage() > 0 && !(regen_organ.status & ORGAN_DEAD)) + if (_owner.nutrition >= organ_mult) + regen_organ.adjust_organ_damage(-(organ_mult)) + _owner.adjust_nutrition(-(organ_mult)) + if(prob(5)) + to_chat(_owner, replacetext(regen_message,"ORGAN", regen_organ.name)) + else + low_nut_warning(_owner, regen_organ.name) + + if(prob(grow_chance)) + var/decl/bodytype/root_bodytype = _owner.get_bodytype() + for(var/limb_type in root_bodytype.has_limbs) + var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(_owner, limb_type) + if(limb && limb.organ_tag != BP_HEAD && !limb.is_vital_to_owner() && !limb.is_usable()) //Skips heads and vital bits... + if (_owner.nutrition > grow_threshold) + _owner.remove_organ(limb) //...because no one wants their head to explode to make way for a new one. + qdel(limb) + limb = null + else + low_nut_warning(_owner, limb.name) + if(!limb) + var/list/organ_data = root_bodytype.has_limbs[limb_type] + var/limb_path = organ_data["path"] + limb = new limb_path(_owner) + _owner.add_organ(limb, GET_EXTERNAL_ORGAN(_owner, limb.parent_organ), FALSE, FALSE) + _owner.adjust_nutrition(-external_nutrition_mult) + external_regeneration_effect(_owner, limb) + return + else if (_owner.nutrition > grow_threshold) //We don't subtract any nut here, but let's still only heal wounds when we have nut. + for(var/datum/wound/wound in limb.wounds) + if(wound.wound_damage() == 0 && prob(50)) + qdel(wound) + +/decl/mob_modifier/regeneration/organ/proc/low_nut_warning(mob/living/_owner, var/wound_type) + if (last_nutrition_warning + 1 MINUTE < world.time) + to_chat(_owner, SPAN_WARNING("You need more energy to regenerate your [wound_type || "wounds"].")) + last_nutrition_warning = world.time + return TRUE + return FALSE + +/decl/mob_modifier/regeneration/organ/proc/can_regenerate_organs() + return TRUE + +// Distinct type to avoid removing the wrong type on unwield. +/decl/mob_modifier/regeneration/item + name = "Regenerative Aura" + desc = "An item is helping your body heal physical damage and toxins." + can_be_admin_granted = FALSE \ No newline at end of file diff --git a/code/modules/mob_modifiers/definitions/modifiers_restrained.dm b/code/modules/mob_modifiers/definitions/modifiers_restrained.dm new file mode 100644 index 000000000000..6e281db036be --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_restrained.dm @@ -0,0 +1,9 @@ +/decl/mob_modifier/restrained + name = "Restrained" + desc = "You are restrained and need to resist to get out of your bindings." + hud_icon_state = "restrained" + show_indefinite_duration = FALSE + +/decl/mob_modifier/restrained/on_modifier_datum_click(mob/living/_owner, decl/mob_modifier/modifier, params) + _owner.resist() + return TRUE diff --git a/code/modules/mob_modifiers/definitions/modifiers_shield.dm b/code/modules/mob_modifiers/definitions/modifiers_shield.dm new file mode 100644 index 000000000000..1dcda7a53e11 --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_shield.dm @@ -0,0 +1,45 @@ +/decl/mob_modifier/shield + name = "Energy Shield" + desc = "You are protected from incoming projectiles." + hud_icon_state = "shield" + on_add_message_1p = SPAN_NOTICE("You feel your body prickle as your shield comes online.") + on_end_message_1p = SPAN_WARNING("Your shield goes offline!") + can_be_admin_granted = TRUE + +/decl/mob_modifier/shield/on_modifier_datum_added(mob/living/_owner, decl/mob_modifier/modifier) + . = ..() + if(. && _owner) + playsound(get_turf(_owner), 'sound/weapons/flash.ogg', 35, 1) + +/decl/mob_modifier/shield/on_modifier_datum_removed(mob/living/_owner, decl/mob_modifier/modifier) + . = ..() + if(. && _owner) + playsound(get_turf(_owner), 'sound/mecha/internaldmgalarm.ogg', 25,1) + +/decl/mob_modifier/shield/check_modifiers_block_attack(mob/living/_owner, list/modifiers, attack_type, atom/movable/attacker, additional_data) + if(attack_type != MM_ATTACK_TYPE_PROJECTILE) + return ..() + var/obj/item/projectile/projectile = attacker + if(istype(projectile)) + _owner.visible_message(SPAN_WARNING("\The [_owner]'s [src] flashes before \the [projectile] can hit them!")) + new /obj/effect/temporary(get_turf(_owner), 2 SECONDS, 'icons/obj/machines/shielding.dmi', "shield_impact") + playsound(_owner,'sound/effects/basscannon.ogg', 35, 1) + return (MM_ATTACK_RESULT_BLOCKED|MM_ATTACK_RESULT_DEFLECTED) + return MM_ATTACK_RESULT_NONE + +/decl/mob_modifier/shield/device + name = "Personal Shield" + desc = "You are protected from incoming projectiles by a personal shielding device - at least until it runs out of charges." + can_be_admin_granted = FALSE // Needs an item. + +/decl/mob_modifier/shield/device/check_modifiers_block_attack(mob/living/_owner, list/modifiers, attack_type, atom/movable/attacker, additional_data) + var/obj/item/projectile/projectile = attacker + if(!istype(projectile) || attack_type != MM_ATTACK_TYPE_PROJECTILE) + return ..() + var/found_shield = FALSE + for(var/datum/mob_modifier/modifier in modifiers) + var/obj/item/personal_shield/shield = modifier.source?.resolve() + if(istype(shield) && shield.expend_charge()) + found_shield = TRUE + break + return found_shield ? ..() : MM_ATTACK_RESULT_NONE diff --git a/code/modules/mob_modifiers/definitions/modifiers_stasis.dm b/code/modules/mob_modifiers/definitions/modifiers_stasis.dm new file mode 100644 index 000000000000..e855920a734c --- /dev/null +++ b/code/modules/mob_modifiers/definitions/modifiers_stasis.dm @@ -0,0 +1,26 @@ +/decl/mob_modifier/stasis + name = "Stasis" + desc = "Your life processes have been reduced or halted by stasis." + hud_icon_state = "stasis" + hide_expiry = TRUE + +/decl/mob_modifier/stasis/on_modifier_datum_mob_life(mob/living/_owner, list/modifiers) + . = ..() + + var/decl/bodytype/my_bodytype = _owner.get_bodytype() + if(my_bodytype?.body_flags & BODY_FLAG_NO_STASIS) + return + + var/stasis_power = 0 + for(var/datum/mob_modifier/modifier in modifiers) + var/atom/movable/source_atom = modifier.source?.resolve() + if(istype(source_atom)) + var/add_stasis = source_atom.get_cryogenic_power() + if(add_stasis) + stasis_power += add_stasis + to_chat(_owner, "[source_atom] gave [add_stasis]") + + if(stasis_power > 1 && GET_STATUS(_owner, STAT_DROWSY) < stasis_power * 4) + ADJ_STATUS(_owner, STAT_DROWSY, min(stasis_power, 3)) + if(_owner.stat == CONSCIOUS)// && prob(1)) + to_chat(_owner, SPAN_NOTICE("You feel slow and sluggish...")) diff --git a/code/modules/mob_modifiers/modifiers_datum.dm b/code/modules/mob_modifiers/modifiers_datum.dm new file mode 100644 index 000000000000..d7bc334dc528 --- /dev/null +++ b/code/modules/mob_modifiers/modifiers_datum.dm @@ -0,0 +1,75 @@ +// Subtype for tracking timer etc. No actual behavior associated with these. +/datum/mob_modifier + var/mob/living/owner + var/decl/mob_modifier/archetype + var/expire_time = MOB_MODIFIER_INDEFINITE + var/weakref/source + +/datum/mob_modifier/New(decl/mob_modifier/_archetype, mob/living/_owner, datum/_source) + archetype = istype(_archetype) ? _archetype : GET_DECL(_archetype) + owner = _owner + source = weakref(_source) + +/datum/mob_modifier/Destroy(force) + owner = null + return ..() + +// returns TRUE if the owner needs to run an update on mob modifiers following this run. +/datum/mob_modifier/proc/on_modifier_mob_life() + SHOULD_CALL_PARENT(TRUE) + . = FALSE + // We should not exist without an owner. + if(!istype(owner)) + qdel(src) + return TRUE + // Count down our timer, if necessary. + if(expire_time != MOB_MODIFIER_INDEFINITE) + . = TRUE + if(world.time >= expire_time) + on_modifier_expiry() + +/datum/mob_modifier/proc/on_modifier_removed(skip_update = FALSE) + SHOULD_CALL_PARENT(TRUE) + if(!istype(owner)) + return FALSE + var/list/modifiers = LAZYACCESS(owner._mob_modifiers, archetype) + if(!length(modifiers)) + return FALSE + modifiers -= src + // If this was our last modifier, clear the list. + if(!length(modifiers)) + LAZYREMOVE(owner._mob_modifiers, archetype) + archetype.on_modifier_datum_removed(owner, src) + if(!skip_update) + owner.refresh_hud_element(HUD_MODIFIERS) + if(archetype.mob_overlay_icon || archetype.mob_overlay_state) + owner.queue_icon_update() + qdel(src) + return TRUE + +/datum/mob_modifier/proc/on_modifier_added(skip_update = FALSE) + SHOULD_CALL_PARENT(TRUE) + if(!istype(owner)) + return FALSE + var/list/modifiers = LAZYACCESS(owner._mob_modifiers, archetype) + if(!modifiers) + modifiers = list() + LAZYSET(owner._mob_modifiers, archetype, modifiers) + if(src in modifiers) + return FALSE + modifiers += src + archetype.on_modifier_datum_added(owner, src) + if(!skip_update) + owner.refresh_hud_element(HUD_MODIFIERS) + if(archetype.mob_overlay_icon || archetype.mob_overlay_state) + owner.queue_icon_update() + return TRUE + +/datum/mob_modifier/proc/on_modifier_expiry() + SHOULD_CALL_PARENT(TRUE) + archetype.on_modifier_datum_expiry(owner, src) + return on_modifier_removed() + +/datum/mob_modifier/proc/on_modifier_click(params) + SHOULD_CALL_PARENT(TRUE) + archetype.on_modifier_datum_click(owner, src, params) diff --git a/code/modules/mob_modifiers/modifiers_helpers.dm b/code/modules/mob_modifiers/modifiers_helpers.dm new file mode 100644 index 000000000000..339ee093a855 --- /dev/null +++ b/code/modules/mob_modifiers/modifiers_helpers.dm @@ -0,0 +1,78 @@ + +/mob/living + // A modifier is a generalised effect on the mob, positive or negative, like buckling, healing or a curse. + var/list/_mob_modifiers + +/mob/living/proc/handle_mob_modifiers() + SHOULD_CALL_PARENT(TRUE) + for(var/decl/mob_modifier/archetype as anything in _mob_modifiers) + if(archetype.on_modifier_datum_mob_life(src, _mob_modifiers[archetype])) + . = TRUE + if(.) + refresh_hud_element(HUD_MODIFIERS) + +/mob/living/clear_mob_modifiers() + for(var/archetype as anything in _mob_modifiers) + for(var/datum/mob_modifier/modifier in _mob_modifiers[archetype]) + modifier.on_modifier_removed() + +/mob/living/remove_mob_modifier(decl/mob_modifier/archetype, datum/source, skip_update = FALSE) + + if(ispath(archetype)) + archetype = GET_DECL(archetype) + if(!istype(archetype)) + return FALSE + + // If we have no data, we can't clear it. + var/list/modifiers = LAZYACCESS(_mob_modifiers, archetype) + if(!length(modifiers)) + return FALSE + + // Source datum means we only remove an modifier that matches the source. + for(var/datum/mob_modifier/modifier as anything in modifiers) + if(!source || modifier.source?.resolve() == source) + modifier.on_modifier_removed() + . = TRUE + if(source) + return + + // We didn't find one to remove. Tragic. + return FALSE + +// If source is not provided, we only care that we have SOMETHING providing this modifier. +/mob/living/has_mob_modifier(decl/mob_modifier/archetype, datum/source) + if(ispath(archetype)) + archetype = GET_DECL(archetype) + if(!istype(archetype)) + return FALSE + var/list/modifiers = LAZYACCESS(_mob_modifiers, archetype) + if(!length(modifiers)) + return FALSE + if(!source) // We don't care about specifics. + return TRUE + for(var/datum/mob_modifier/modifier in modifiers) + if(modifier.source?.resolve() == source) + return TRUE + return FALSE + +/mob/living/add_mob_modifier(decl/mob_modifier/archetype, duration = MOB_MODIFIER_INDEFINITE, datum/source, skip_update = FALSE) + if(ispath(archetype)) + archetype = GET_DECL(archetype) + if(!istype(archetype) || !istype(source)) + return FALSE + + var/list/modifiers = LAZYACCESS(_mob_modifiers, archetype) + var/datum/mob_modifier/modifier + for(var/datum/mob_modifier/existing_modifier in modifiers) + if(existing_modifier.source?.resolve() == source) + modifier = existing_modifier + break + + if(!istype(modifier)) + modifier = new archetype.modifier_type(archetype, src, source) + if(duration != MOB_MODIFIER_INDEFINITE) + modifier.expire_time = world.time + duration + else + modifier.expire_time = MOB_MODIFIER_INDEFINITE + modifier.on_modifier_added(skip_update) + return TRUE diff --git a/code/modules/modular_computers/computers/modular_computer/core.dm b/code/modules/modular_computers/computers/modular_computer/core.dm index 521a4a6b01a4..0869c4431739 100644 --- a/code/modules/modular_computers/computers/modular_computer/core.dm +++ b/code/modules/modular_computers/computers/modular_computer/core.dm @@ -4,11 +4,11 @@ if(assembly) LAZYREMOVE(., assembly.parts) -/obj/item/modular_computer/get_contained_matter() +/obj/item/modular_computer/get_contained_matter(include_reagents = TRUE) . = ..() var/datum/extension/assembly/assembly = get_extension(src, /datum/extension/assembly) for(var/obj/part in assembly?.parts) - . = MERGE_ASSOCS_WITH_NUM_VALUES(., part.get_contained_matter()) + . = MERGE_ASSOCS_WITH_NUM_VALUES(., part.get_contained_matter(include_reagents)) /obj/item/modular_computer/Process() var/datum/extension/assembly/assembly = get_extension(src, /datum/extension/assembly) diff --git a/code/modules/modular_computers/file_system/programs/engineering/network_monitoring.dm b/code/modules/modular_computers/file_system/programs/engineering/network_monitoring.dm index 0b111c2306ae..779fc79ec5af 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/network_monitoring.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/network_monitoring.dm @@ -57,9 +57,10 @@ mainframes.Add(list(rdata)) data["mainframes"] = mainframes - if(length(network.get_mainframes_by_role(MF_ROLE_LOG_SERVER, user.GetAccess()))) + var/list/eligible_log_servers = network.get_mainframes_by_role(MF_ROLE_LOG_SERVER, user.GetAccess()) + if(length(eligible_log_servers)) var/list/logs[0] - for(var/datum/extension/network_device/mainframe/M in network.get_mainframes_by_role(MF_ROLE_LOG_SERVER, user)) + for(var/datum/extension/network_device/mainframe/M in eligible_log_servers) var/list/logdata[0] var/datum/computer_file/data/logfile/F = M.get_file("network_log", OS_LOGS_DIR, TRUE) if(F) @@ -143,9 +144,9 @@ if(href_list["toggle_function"]) var/feature = text2num(href_list["toggle_function"]) if(network.network_features_enabled & feature) - network.network_features_enabled &= ~feature + network.disable_network_feature(feature) else - network.network_features_enabled |= feature + network.enable_network_feature(feature) return TOPIC_REFRESH if(href_list["ban_nid"]) diff --git a/code/modules/modular_computers/file_system/programs/generic/camera.dm b/code/modules/modular_computers/file_system/programs/generic/camera.dm index 290bf6c7124d..6f167e4682b3 100644 --- a/code/modules/modular_computers/file_system/programs/generic/camera.dm +++ b/code/modules/modular_computers/file_system/programs/generic/camera.dm @@ -19,6 +19,30 @@ var/list/viewers = list() var/bypass_access = FALSE +/datum/nano_module/program/camera_monitor/proc/get_forbidden_channels() + var/static/list/forbidden_channels = list( + (CAMERA_CHANNEL_ERT), + (CAMERA_CHANNEL_MERCENARY) + ) + return forbidden_channels + +/datum/nano_module/program/camera_monitor/ert + name = "ERT Camera Monitoring program" + +/datum/nano_module/program/camera_monitor/ert/get_forbidden_channels() + var/static/list/forbidden_channels = list( + (CAMERA_CHANNEL_MERCENARY) + ) + +/datum/nano_module/program/camera_monitor/mercenary + name = "Mercenary Camera Monitoring program" + +/datum/nano_module/program/camera_monitor/mercenary/get_forbidden_channels() + var/static/list/forbidden_channels = list( + (CAMERA_CHANNEL_ERT) + ) + return forbidden_channels + /datum/nano_module/program/camera_monitor/Destroy() unlook_all() . = ..() @@ -34,6 +58,7 @@ var/list/cameras_by_channel = get_cameras_by_channel() for(var/channel in cameras_by_channel) all_channels += channel + all_channels -= get_forbidden_channels() data["channels"] = all_channels diff --git a/code/modules/modular_computers/file_system/programs/generic/email_client.dm b/code/modules/modular_computers/file_system/programs/generic/email_client.dm index 61536217f86a..9bfa457e8487 100644 --- a/code/modules/modular_computers/file_system/programs/generic/email_client.dm +++ b/code/modules/modular_computers/file_system/programs/generic/email_client.dm @@ -80,7 +80,7 @@ var/list/msg = list() msg += "*--*\n" msg += "New mail received from [received_message.source]:\n" - msg += "Subject: [received_message.title]\nMessage:\n[digitalPencode2html(received_message.stored_data)]\n" + msg += "Subject: [received_message.title]\nMessage:\n[received_message.generate_file_data()]\n" if(received_message.attachment) msg += "Attachment: [received_message.attachment.filename].[received_message.attachment.filetype] ([received_message.attachment.size]GQ)\n" msg += "Reply\n" @@ -158,7 +158,7 @@ data["msg_attachment_size"] = msg_attachment.size else if (current_message) data["cur_title"] = current_message.title - data["cur_body"] = digitalPencode2html(current_message.stored_data) + data["cur_body"] = current_message.generate_file_data() data["cur_timestamp"] = current_message.timestamp data["cur_source"] = current_message.source data["cur_uid"] = current_message.uid @@ -187,7 +187,7 @@ for(var/datum/computer_file/data/email_message/message in message_source) all_messages.Add(list(list( "title" = message.title, - "body" = digitalPencode2html(message.stored_data), + "body" = message.generate_file_data(), "source" = message.source, "timestamp" = message.timestamp, "uid" = message.uid diff --git a/code/modules/modular_computers/file_system/programs/generic/file_manager.dm b/code/modules/modular_computers/file_system/programs/generic/file_manager.dm index be3f39c066ca..546aa102bf43 100644 --- a/code/modules/modular_computers/file_system/programs/generic/file_manager.dm +++ b/code/modules/modular_computers/file_system/programs/generic/file_manager.dm @@ -375,7 +375,7 @@ if(!(F.get_file_perms(accesses, user) & OS_READ_ACCESS)) file_error = "You do not have read access to this file." return - if(!computer.print_paper(digitalPencode2html(F.stored_data), F.filename)) + if(!computer.print_paper(F.generate_file_data(), F.filename, F.papertype, F.metadata)) file_error = "Hardware error: Unable to print the file." return TOPIC_REFRESH diff --git a/code/modules/modular_computers/file_system/programs/generic/scanner.dm b/code/modules/modular_computers/file_system/programs/generic/scanner.dm index ff721374a1cc..d91dd8e617c2 100644 --- a/code/modules/modular_computers/file_system/programs/generic/scanner.dm +++ b/code/modules/modular_computers/file_system/programs/generic/scanner.dm @@ -10,7 +10,7 @@ category = PROG_UTIL nanomodule_path = /datum/nano_module/program/scanner - var/using_scanner = 0 //Whether or not the program is synched with the scanner module. + var/using_scanner = 0 //Whether or not the program is synced with the scanner module. var/data_buffer = "" //Buffers scan output for saving/viewing. var/scan_file_type = /datum/computer_file/data/text //The type of file the data will be saved to. var/list/metadata_buffer = list() @@ -78,6 +78,7 @@ var/datum/computer_file/data/scan_file = new scan_file_type() scan_file.stored_data = data_buffer + scan_file.metadata = metadata_buffer // This saves the file, so no additional handling on the program's end is required. view_file_browser(usr, "saving_file", scan_file_type, OS_WRITE_ACCESS, "Save scan file", scan_file) diff --git a/code/modules/modular_computers/file_system/programs/generic/supply.dm b/code/modules/modular_computers/file_system/programs/generic/supply.dm index b0f425734159..bae0aa67c9dd 100644 --- a/code/modules/modular_computers/file_system/programs/generic/supply.dm +++ b/code/modules/modular_computers/file_system/programs/generic/supply.dm @@ -166,11 +166,11 @@ if(href_list["order"]) clear_order_contents() - var/decl/hierarchy/supply_pack/P = locate(href_list["order"]) in SSsupply.master_supply_list - if(!istype(P)) + var/decl/hierarchy/supply_pack/pack = locate(href_list["order"]) in SSsupply.master_supply_list + if(!istype(pack)) return 1 - if(P.hidden && !emagged) + if(pack.hidden && !emagged) return 1 var/reason = sanitize(input(user,"Reason:","Why do you require this item?","") as null|text,,0) @@ -190,7 +190,7 @@ var/datum/supply_order/O = new /datum/supply_order() O.ordernum = SSsupply.ordernum - O.object = P + O.object = pack O.orderedby = idname O.reason = reason O.orderedrank = idrank @@ -315,31 +315,32 @@ category_contents.Cut() var/decl/hierarchy/supply_pack/root = GET_DECL(/decl/hierarchy/supply_pack) var/decl/currency/cur = GET_DECL(global.using_map.default_currency) - for(var/decl/hierarchy/supply_pack/sp in root.children) - if(!sp.is_category()) + // FIXME: This probably doesn't even work properly? It assumes there aren't any nested categories... + for(var/decl/hierarchy/supply_pack/pack in root.children) + if(!pack.is_category()) continue // No children - category_names.Add(sp.name) + category_names.Add(pack.name) var/list/category[0] - for(var/decl/hierarchy/supply_pack/spc in sp.get_descendants()) - if((spc.hidden || spc.contraband || !spc.sec_available()) && !emagged) + for(var/decl/hierarchy/supply_pack/child_pack in pack.get_descendants()) + if((child_pack.hidden || child_pack.contraband || !child_pack.sec_available()) && !emagged) continue category.Add(list(list( - "name" = spc.name, - "cost" = cur.format_value(spc.cost), - "ref" = "\ref[spc]" + "name" = child_pack.name, + "cost" = cur.format_value(child_pack.cost), + "ref" = "\ref[child_pack]" ))) - category_contents[sp.name] = category + category_contents[pack.name] = category /datum/nano_module/supply/proc/generate_order_contents(var/order_ref) - var/decl/hierarchy/supply_pack/sp = locate(order_ref) in SSsupply.master_supply_list - if(!istype(sp)) + var/decl/hierarchy/supply_pack/pack = locate(order_ref) in SSsupply.master_supply_list + if(!istype(pack)) return FALSE contents_of_order.Cut() showing_contents_of_ref = order_ref - for(var/item_path in sp.contains) // Thanks to Lohikar for helping me with type paths - CarlenWhite + for(var/item_path in pack.contains) // Thanks to Lohikar for helping me with type paths - CarlenWhite var/obj/item/stack/OB = item_path // Not always a stack, but will always have a name we can fetch. var/name = initial(OB.name) - var/amount = sp.contains[item_path] || 1 // If it's just one item (has no number associated), fallback to 1. + var/amount = pack.contains[item_path] || 1 // If it's just one item (has no number associated), fallback to 1. if(ispath(item_path, /obj/item/stack)) // And if it is a stack, consider the amount amount *= initial(OB.amount) @@ -349,9 +350,9 @@ "amount" = amount ))) - if(sp.contains.len == 0) // Handles the case where sp.contains is empty, e.g. for livecargo + if(!length(pack.contains)) // Handles the case where pack.contains is empty, e.g. for livecargo contents_of_order.Add(list(list( - "name" = sp.containername, + "name" = pack.containername, "amount" = 1 ))) diff --git a/code/modules/modular_computers/file_system/programs/research/email_administration.dm b/code/modules/modular_computers/file_system/programs/research/email_administration.dm index 95d2a9410005..ea3ebbe44109 100644 --- a/code/modules/modular_computers/file_system/programs/research/email_administration.dm +++ b/code/modules/modular_computers/file_system/programs/research/email_administration.dm @@ -39,7 +39,7 @@ data["error"] = error else if(istype(current_message)) data["msg_title"] = current_message.title - data["msg_body"] = digitalPencode2html(current_message.stored_data) + data["msg_body"] = current_message.generate_file_data() data["msg_timestamp"] = current_message.timestamp data["msg_source"] = current_message.source else if(istype(current_account)) diff --git a/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm b/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm index 28c21f6b4217..f96c61e63609 100644 --- a/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm +++ b/code/modules/modular_computers/file_system/programs/security/digitalwarrant.dm @@ -24,15 +24,15 @@ var/global/list/all_warrants if(network) return network.get_all_files_of_type(/datum/computer_file/report/warrant, accesses = accesses) -/datum/nano_module/program/proc/remove_warrant(datum/computer_file/report/warrant/W, list/accesses, mob/user) +/datum/nano_module/program/proc/remove_warrant(datum/computer_file/report/warrant/warrant, list/accesses, mob/user) var/datum/computer_network/network = program?.computer?.get_network() if(network) - return network.remove_file(W, accesses, user) + return network.remove_file(warrant, accesses, user) -/datum/nano_module/program/proc/save_warrant(datum/computer_file/report/warrant/W, list/accesses, mob/user) +/datum/nano_module/program/proc/save_warrant(datum/computer_file/report/warrant/warrant, list/accesses, mob/user) var/datum/computer_network/network = program?.computer?.get_network() if(network) - return network.store_file(W, OS_DOCUMENTS_DIR, TRUE, accesses = accesses, user = user) + return network.store_file(warrant, OS_DOCUMENTS_DIR, TRUE, accesses = accesses, user = user) /datum/nano_module/program/digitalwarrant/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = global.default_topic_state) var/list/data = host.initial_data() @@ -43,8 +43,8 @@ var/global/list/all_warrants data["details"] = active.generate_nano_data(accesses, user) else var/list/avail_warrants = get_warrants(accesses, user) - for(var/datum/computer_file/report/warrant/W in avail_warrants) - LAZYADD(data[W.get_category()], W.get_nano_summary()) + for(var/datum/computer_file/report/warrant/warrant in avail_warrants) + LAZYADD(data[warrant.get_category()], warrant.get_nano_summary()) ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) @@ -61,33 +61,33 @@ var/global/list/all_warrants if(href_list["editwarrant"]) . = 1 - for(var/datum/computer_file/report/warrant/W in avail_warrants) - if(W.uid == text2num(href_list["editwarrant"])) - active = W + for(var/datum/computer_file/report/warrant/warrant in avail_warrants) + if(warrant.uid == text2num(href_list["editwarrant"])) + active = warrant break if(href_list["sendtoarchive"]) . = 1 - for(var/datum/computer_file/report/warrant/W in avail_warrants) - if(W.uid == text2num(href_list["sendtoarchive"])) - W.archived = TRUE + for(var/datum/computer_file/report/warrant/warrant in avail_warrants) + if(warrant.uid == text2num(href_list["sendtoarchive"])) + warrant.archived = TRUE break if(href_list["restore"]) . = 1 - for(var/datum/computer_file/report/warrant/W in avail_warrants) - if(W.uid == text2num(href_list["restore"])) - W.archived = FALSE + for(var/datum/computer_file/report/warrant/warrant in avail_warrants) + if(warrant.uid == text2num(href_list["restore"])) + warrant.archived = FALSE break if(href_list["addwarrant"]) . = 1 - var/datum/computer_file/report/warrant/W + var/datum/computer_file/report/warrant/warrant if(href_list["addwarrant"] == "arrest") - W = new /datum/computer_file/report/warrant/arrest + warrant = new /datum/computer_file/report/warrant/arrest else - W = new /datum/computer_file/report/warrant/search - active = W + warrant = new /datum/computer_file/report/warrant/search + active = warrant if(href_list["savewarrant"]) . = 1 @@ -104,9 +104,9 @@ var/global/list/all_warrants if(href_list["deletewarrant"]) . = 1 if(!active) - for(var/datum/computer_file/report/warrant/W in avail_warrants) - if(W.uid == text2num(href_list["deletewarrant"])) - active = W + for(var/datum/computer_file/report/warrant/warrant in avail_warrants) + if(warrant.uid == text2num(href_list["deletewarrant"])) + active = warrant break var/success = remove_warrant(active, accesses, usr) if(success != OS_FILE_SUCCESS) diff --git a/code/modules/modular_computers/file_system/reports/crew_record.dm b/code/modules/modular_computers/file_system/reports/crew_record.dm index 420acdb719e7..fb6a7c6a233a 100644 --- a/code/modules/modular_computers/file_system/reports/crew_record.dm +++ b/code/modules/modular_computers/file_system/reports/crew_record.dm @@ -61,7 +61,8 @@ var/global/arrest_security_status = "Arrest" set_gender(gender_term) set_age(crewmember?.get_age() || 30) set_status(global.default_physical_status) - set_species_name(crewmember ? crewmember.get_species_name() : global.using_map.default_species) + var/decl/species/default_species = decls_repository.get_decl_by_id(global.using_map.default_species) + set_species_name(crewmember ? crewmember.get_species_name() : default_species.name) set_branch(crewmember ? (crewmember.char_branch && crewmember.char_branch.name) : "None") set_rank(crewmember ? (crewmember.char_rank && crewmember.char_rank.name) : "None") diff --git a/code/modules/modular_computers/hardware/_hardware.dm b/code/modules/modular_computers/hardware/_hardware.dm index 64fc7f971be5..2d87a04d59ad 100644 --- a/code/modules/modular_computers/hardware/_hardware.dm +++ b/code/modules/modular_computers/hardware/_hardware.dm @@ -10,9 +10,9 @@ var/usage_flags = PROGRAM_ALL var/external_slot // Whether attackby will be passed on it even with a closed panel -/obj/item/stock_parts/computer/attackby(var/obj/item/W, var/mob/user) +/obj/item/stock_parts/computer/attackby(var/obj/item/used_item, var/mob/user) // Multitool. Runs diagnostics - if(IS_MULTITOOL(W)) + if(IS_MULTITOOL(used_item)) to_chat(user, "***** DIAGNOSTICS REPORT *****") to_chat(user, jointext(diagnostics(), "\n")) to_chat(user, "******************************") diff --git a/code/modules/modular_computers/hardware/ai_slot.dm b/code/modules/modular_computers/hardware/ai_slot.dm index 72345bf49394..02594ca9006a 100644 --- a/code/modules/modular_computers/hardware/ai_slot.dm +++ b/code/modules/modular_computers/hardware/ai_slot.dm @@ -21,16 +21,16 @@ power_usage = power_usage_occupied ..() -/obj/item/stock_parts/computer/ai_slot/attackby(var/obj/item/W, var/mob/user) - if(istype(W, /obj/item/aicard)) +/obj/item/stock_parts/computer/ai_slot/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/aicard)) if(stored_card) to_chat(user, "\The [src] is already occupied.") return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - do_insert_ai(user, W) + do_insert_ai(user, used_item) return TRUE - if(IS_SCREWDRIVER(W)) + if(stored_card && IS_SCREWDRIVER(used_item)) to_chat(user, "You manually remove \the [stored_card] from \the [src].") do_eject_ai(user) return TRUE @@ -64,8 +64,9 @@ device.do_eject_ai(user) /obj/item/stock_parts/computer/ai_slot/proc/do_eject_ai(mob/user) - stored_card.dropInto(loc) - stored_card = null + if(stored_card) + stored_card.dropInto(loc) + stored_card = null loc.verbs -= /obj/item/stock_parts/computer/ai_slot/verb/eject_ai diff --git a/code/modules/modular_computers/hardware/card_slot.dm b/code/modules/modular_computers/hardware/card_slot.dm index cb62d1049e90..62ad6a78a842 100644 --- a/code/modules/modular_computers/hardware/card_slot.dm +++ b/code/modules/modular_computers/hardware/card_slot.dm @@ -1,7 +1,7 @@ /obj/item/stock_parts/computer/card_slot name = "RFID card slot" desc = "Slot that allows this computer to write data on RFID cards. Necessary for some programs to run properly." - power_usage = 10 //W + power_usage = 10 // W critical = 0 icon_state = "cardreader" hardware_size = 1 @@ -102,10 +102,10 @@ loc.verbs |= /obj/item/stock_parts/computer/card_slot/proc/verb_eject_id return TRUE -/obj/item/stock_parts/computer/card_slot/attackby(obj/item/card/id/I, mob/user) - if(!istype(I)) +/obj/item/stock_parts/computer/card_slot/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/card/id)) return ..() - insert_id(I, user) + insert_id(used_item, user) return TRUE /obj/item/stock_parts/computer/card_slot/broadcaster // read only diff --git a/code/modules/modular_computers/hardware/charge_stick_slot.dm b/code/modules/modular_computers/hardware/charge_stick_slot.dm index 451696ff85d7..4e3087c7db54 100644 --- a/code/modules/modular_computers/hardware/charge_stick_slot.dm +++ b/code/modules/modular_computers/hardware/charge_stick_slot.dm @@ -1,7 +1,7 @@ /obj/item/stock_parts/computer/charge_stick_slot name = "charge-stick slot" desc = "Slot that allows this computer to pay for transactions using an inserted charge-stick." - power_usage = 10 //W + power_usage = 10 // W critical = 0 icon_state = "cardreader" hardware_size = 1 @@ -82,10 +82,10 @@ loc.verbs |= /obj/item/stock_parts/computer/charge_stick_slot/proc/verb_eject_stick return TRUE -/obj/item/stock_parts/computer/charge_stick_slot/attackby(obj/item/charge_stick/I, mob/user) - if(!istype(I)) +/obj/item/stock_parts/computer/charge_stick_slot/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/charge_stick)) return ..() - insert_stick(I, user) + insert_stick(used_item, user) return TRUE /obj/item/stock_parts/computer/charge_stick_slot/broadcaster // read only diff --git a/code/modules/modular_computers/hardware/disk_slot.dm b/code/modules/modular_computers/hardware/disk_slot.dm index cae1cb5fccf1..47831abe7613 100644 --- a/code/modules/modular_computers/hardware/disk_slot.dm +++ b/code/modules/modular_computers/hardware/disk_slot.dm @@ -1,7 +1,7 @@ /obj/item/stock_parts/computer/data_disk_drive name = "data disk slot" desc = "Slot that allows this computer to accept data disks." - power_usage = 10 //W + power_usage = 10 // W critical = 0 icon_state = "cardreader" hardware_size = 1 @@ -97,10 +97,10 @@ os.unmount_storage(mount_name) -/obj/item/stock_parts/computer/data_disk_drive/attackby(obj/item/disk/new_disk, mob/user) - if(!istype(new_disk)) +/obj/item/stock_parts/computer/data_disk_drive/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/disk)) return ..() - insert_disk(new_disk, user) + insert_disk(used_item, user) return TRUE /obj/item/stock_parts/computer/data_disk_drive/Destroy() diff --git a/code/modules/modular_computers/hardware/drive_slot.dm b/code/modules/modular_computers/hardware/drive_slot.dm index 8da6019f7744..c584eb9c284a 100644 --- a/code/modules/modular_computers/hardware/drive_slot.dm +++ b/code/modules/modular_computers/hardware/drive_slot.dm @@ -1,7 +1,7 @@ /obj/item/stock_parts/computer/drive_slot name = "removable drive slot" desc = "Slot that allows this computer to accept removable drives." - power_usage = 10 //W + power_usage = 10 // W critical = 0 icon_state = "cardreader" hardware_size = 1 @@ -94,10 +94,10 @@ os.unmount_storage(mount_name) -/obj/item/stock_parts/computer/drive_slot/attackby(obj/item/stock_parts/computer/hard_drive/portable/I, mob/user) - if(!istype(I)) +/obj/item/stock_parts/computer/drive_slot/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/stock_parts/computer/hard_drive/portable)) return ..() - insert_drive(I, user) + insert_drive(used_item, user) return TRUE /obj/item/stock_parts/computer/drive_slot/Destroy() diff --git a/code/modules/modular_computers/hardware/lan_port.dm b/code/modules/modular_computers/hardware/lan_port.dm index 8ffecb3d26a6..3074458d21e9 100644 --- a/code/modules/modular_computers/hardware/lan_port.dm +++ b/code/modules/modular_computers/hardware/lan_port.dm @@ -31,7 +31,7 @@ terminal = new(get_turf(parent)) set_extension(src, /datum/extension/event_registration/shuttle_stationary, GET_DECL(/decl/observ/moved), parent, PROC_REF(check_terminal_prox), get_area(src)) events_repository.register(/decl/observ/destroyed, terminal, src, PROC_REF(unset_terminal)) - set_status(parent, PART_STAT_CONNECTED) + set_component_status(parent, PART_STAT_CONNECTED) /obj/item/stock_parts/computer/lan_port/proc/unset_terminal() remove_extension(src, /datum/extension/event_registration/shuttle_stationary) @@ -57,13 +57,13 @@ /obj/item/stock_parts/computer/lan_port/proc/check_terminal_block(var/turf/T) return locate(/obj/structure/network_cable) in T -/obj/item/stock_parts/computer/lan_port/attackby(obj/item/I, mob/user) +/obj/item/stock_parts/computer/lan_port/attackby(obj/item/used_item, mob/user) var/obj/machinery/parent = loc if(!istype(parent)) return ..() // Interactions inside machine only - if (istype(I, /obj/item/stack/net_cable_coil) && !terminal) + if (istype(used_item, /obj/item/stack/net_cable_coil) && !terminal) var/turf/T = get_turf(parent) if(check_terminal_block(T)) to_chat(user, SPAN_WARNING("There's already a network cable there!")) @@ -72,7 +72,7 @@ to_chat(user, SPAN_WARNING("You must remove the floor plating beneath \the [parent] first.")) return TRUE - var/obj/item/stack/net_cable_coil/C = I + var/obj/item/stack/net_cable_coil/C = used_item if(!C.can_use(5)) to_chat(user, SPAN_WARNING("You need five lengths of network cable for \the [parent].")) return TRUE @@ -83,7 +83,7 @@ user.visible_message(SPAN_NOTICE("\The [user] has added cables to \the [parent]!"), "You add cables to \the [parent].") set_terminal() return TRUE - if(IS_WIRECUTTER(I) && terminal) + if(IS_WIRECUTTER(used_item) && terminal) var/turf/T = get_turf(parent) if(istype(T) && !T.is_plating()) to_chat(user, SPAN_WARNING("You must remove the floor plating beneath \the [parent] first.")) diff --git a/code/modules/modular_computers/hardware/nano_printer.dm b/code/modules/modular_computers/hardware/nano_printer.dm index 6495b77d0ed2..4932c7264d83 100644 --- a/code/modules/modular_computers/hardware/nano_printer.dm +++ b/code/modules/modular_computers/hardware/nano_printer.dm @@ -38,20 +38,20 @@ return 1 // TODO: unify with /obj/item/stock_parts/printer somehow? -/obj/item/stock_parts/computer/nano_printer/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/paper)) +/obj/item/stock_parts/computer/nano_printer/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/paper)) if(stored_paper >= max_paper) - to_chat(user, "You try to add \the [W] into \the [src], but its paper bin is full.") + to_chat(user, "You try to add \the [used_item] into \the [src], but its paper bin is full.") return TRUE - to_chat(user, "You insert \the [W] into [src].") - qdel(W) + to_chat(user, "You insert \the [used_item] into [src].") + qdel(used_item) stored_paper++ - else if(istype(W, /obj/item/paper_bundle)) - var/obj/item/paper_bundle/B = W + else if(istype(used_item, /obj/item/paper_bundle)) + var/obj/item/paper_bundle/B = used_item var/num_of_pages_added = 0 if(stored_paper >= max_paper) - to_chat(user, "You try to add \the [W] into \the [src], but its paper bin is full.") + to_chat(user, "You try to add \the [used_item] into \the [src], but its paper bin is full.") return TRUE if(!B.is_blank()) if(user) @@ -74,6 +74,6 @@ qdel(B) else //if at least two items remain, just update the bundle icon B.update_icon() - to_chat(user, "You add [num_of_pages_added] papers from \the [W] into \the [src].") + to_chat(user, "You add [num_of_pages_added] papers from \the [used_item] into \the [src].") return TRUE return ..() diff --git a/code/modules/modular_computers/hardware/scanners/scanner.dm b/code/modules/modular_computers/hardware/scanners/scanner.dm index ea42566d7a0a..81a6a3b194c7 100644 --- a/code/modules/modular_computers/hardware/scanners/scanner.dm +++ b/code/modules/modular_computers/hardware/scanners/scanner.dm @@ -54,12 +54,12 @@ /obj/item/stock_parts/computer/scanner/proc/do_on_afterattack(mob/user, atom/target, proximity) -// TODO: Revisit to see if we can make do_on_attackby return a bool so that normal afterattack can run. -/obj/item/stock_parts/computer/scanner/attackby(obj/W, mob/user) - do_on_attackby(user, W) - return TRUE +/obj/item/stock_parts/computer/scanner/attackby(obj/used_item, mob/user) + return do_on_attackby(user, used_item) +/// Returns TRUE if the attackby chain should be stopped. /obj/item/stock_parts/computer/scanner/proc/do_on_attackby(mob/user, atom/target) + return FALSE /obj/item/stock_parts/computer/scanner/proc/can_use_scanner(mob/user, atom/target, proximity = TRUE) if(!check_functionality()) diff --git a/code/modules/modular_computers/hardware/scanners/scanner_paper.dm b/code/modules/modular_computers/hardware/scanners/scanner_paper.dm index 04bfb3ae3694..e5843c442212 100644 --- a/code/modules/modular_computers/hardware/scanners/scanner_paper.dm +++ b/code/modules/modular_computers/hardware/scanners/scanner_paper.dm @@ -27,7 +27,7 @@ driver.scan_file_type = target.scan_file_type if(target.type == /obj/item/paper/bodyscan) - driver.data_buffer = display_medical_data(target.metadata.Copy(),user.get_skill_value(SKILL_MEDICAL), TRUE) + driver.data_buffer = display_medical_data(driver.metadata_buffer,user.get_skill_value(SKILL_MEDICAL), TRUE) else driver.data_buffer = data @@ -35,4 +35,5 @@ SSnano.update_uis(driver.NM) /obj/item/stock_parts/computer/scanner/paper/do_on_attackby(mob/user, atom/target) - do_on_afterattack(user, target, TRUE) \ No newline at end of file + do_on_afterattack(user, target, TRUE) + return can_use_scanner(user, target, TRUE) \ No newline at end of file diff --git a/code/modules/modular_computers/laptop_vendor.dm b/code/modules/modular_computers/laptop_vendor.dm index 00f823ff9fba..1a939ceb8f3a 100644 --- a/code/modules/modular_computers/laptop_vendor.dm +++ b/code/modules/modular_computers/laptop_vendor.dm @@ -291,9 +291,8 @@ ui.open() ui.set_auto_update(1) - -/obj/machinery/lapvend/attackby(obj/item/held_item as obj, mob/user as mob) - if(state == STATE_PAYMENT && process_payment(held_item)) +/obj/machinery/lapvend/attackby(obj/item/used_item, mob/user) + if(state == STATE_PAYMENT && process_payment(used_item)) fabricate_and_recalc_price(TRUE) flick("world-vend", src) if((devtype == DEVICE_TYPE_LAPTOP) && fabricated_laptop) diff --git a/code/modules/modular_computers/networking/_network.dm b/code/modules/modular_computers/networking/_network.dm index 73adef3ab7d6..7ba3db6b0112 100644 --- a/code/modules/modular_computers/networking/_network.dm +++ b/code/modules/modular_computers/networking/_network.dm @@ -137,11 +137,6 @@ add_device(D) add_log("New main router set.", router.network_tag) -/datum/computer_network/proc/set_access_controller(datum/extension/network_device/D) - access_controller = D - devices |= D - add_log("New main access controller set.", D.network_tag) - // Returns list(signal type, signal strength) on success, null on failure. /datum/computer_network/proc/check_connection(datum/extension/network_device/D, specific_action) if(!router) diff --git a/code/modules/modular_computers/networking/device_types/_network_device.dm b/code/modules/modular_computers/networking/device_types/_network_device.dm index 7401c1ac7669..71a3eb7c1e78 100644 --- a/code/modules/modular_computers/networking/device_types/_network_device.dm +++ b/code/modules/modular_computers/networking/device_types/_network_device.dm @@ -447,16 +447,16 @@ var/list/pub_vars = get_public_variables() for(var/path in pub_methods) - var/decl/public_access/pub = pub_methods[path] - var/alias = pub.name + var/decl/public_access/pub_method = pub_methods[path] + var/alias = pub_method.name alias = replacetext(alias, " ", "_") - LAZYSET(command_and_call, alias, pub) + LAZYSET(command_and_call, alias, pub_method) for(var/path in pub_vars) - var/decl/public_access/pub = pub_vars[path] - var/alias = pub.name + var/decl/public_access/pub_var = pub_vars[path] + var/alias = pub_var.name alias = replacetext(alias, " ", "_") - LAZYSET(command_and_write, alias, pub) + LAZYSET(command_and_write, alias, pub_var) /**Returns the outward facing URI for this network device.*/ /datum/extension/network_device/proc/get_network_URI() diff --git a/code/modules/modular_computers/networking/emails/_email.dm b/code/modules/modular_computers/networking/emails/_email.dm index e522a1dcbd76..7b36c9fb7b9a 100644 --- a/code/modules/modular_computers/networking/emails/_email.dm +++ b/code/modules/modular_computers/networking/emails/_email.dm @@ -28,6 +28,7 @@ var/datum/computer_file/data/email_message/received_copy = received.Clone() received_copy.set_timestamp() recipient.inbox.Add(received_copy) + recipient.receive_mail(received_copy, src) for(var/weakref/os_ref in recipient.logged_in_os) var/datum/extension/interactive/os/os = os_ref.resolve() diff --git a/code/modules/modular_computers/networking/machinery/telecomms.dm b/code/modules/modular_computers/networking/machinery/telecomms.dm index 93f7f7cd4914..00d213dd49de 100644 --- a/code/modules/modular_computers/networking/machinery/telecomms.dm +++ b/code/modules/modular_computers/networking/machinery/telecomms.dm @@ -101,8 +101,8 @@ var/global/list/telecomms_hubs = list() var/datum/extension/network_device/network_device = get_extension(src, /datum/extension/network_device) var/datum/computer_network/network = network_device?.get_network() - for(var/weakref/R in network?.connected_radios) - var/obj/item/radio/radio = R.resolve() + for(var/weakref/radio_ref in network?.connected_radios) + var/obj/item/radio/radio = radio_ref.resolve() if(istype(radio) && !QDELETED(radio)) radio.sync_channels_with_network() @@ -163,17 +163,17 @@ var/global/list/telecomms_hubs = list() var/send_name = istype(speaker) ? speaker.GetVoice() : ("[speaker]" || "unknown") var/list/listeners = list() // Dictionary of listener -> boolean (include overmap origin) // Broadcast to all radio devices in our network. - for(var/weakref/W as anything in network.connected_radios) - var/obj/item/radio/R = W.resolve() - if(!istype(R) || QDELETED(R) || !R.can_receive_message(network)) + for(var/weakref/radio_ref as anything in network.connected_radios) + var/obj/item/radio/radio = radio_ref.resolve() + if(!istype(radio) || QDELETED(radio) || !radio.can_receive_message(network)) continue - var/turf/speaking_from = get_turf(R) + var/turf/speaking_from = get_turf(radio) if(!speaking_from) continue - if(!R.can_decrypt(encryption)) + if(!radio.can_decrypt(encryption)) continue // TODO: This check seems extraneous, given how headsets find their available channels. - var/list/check_channels = R.get_available_channels() + var/list/check_channels = radio.get_available_channels() if(!LAZYACCESS(check_channels, channel)) continue @@ -181,7 +181,7 @@ var/global/list/telecomms_hubs = list() // then append the overmap object name to it, so they know where we're from var/listener_overmap_object = istype(speaking_from) && global.overmap_sectors[num2text(speaking_from.z)] var/send_overmap = send_overmap_object && send_overmap_object.ident_transmitter && send_overmap_object != listener_overmap_object - for(var/mob/listener as anything in R.get_radio_listeners()) + for(var/mob/listener as anything in radio.get_radio_listeners()) listeners[listener] = send_overmap // Ghostship is magic: Ghosts can hear radio chatter from anywhere diff --git a/code/modules/modular_computers/networking/network_files.dm b/code/modules/modular_computers/networking/network_files.dm index 34229d711e23..ece73f53cbaa 100644 --- a/code/modules/modular_computers/networking/network_files.dm +++ b/code/modules/modular_computers/networking/network_files.dm @@ -90,6 +90,7 @@ continue // We only check if user is provided. If no user is provided, it's assumed to be an admin check. . |= M.network_tag +/// Returns the first (order is arbitrarily decided) fileserver with a given mainframe role. /datum/computer_network/proc/get_file_server_by_role(role, list/accesses) if(length(get_mainframes_by_role(role, accesses)) > 0) return get_mainframes_by_role(role, accesses)[1] diff --git a/code/modules/modular_computers/os/components.dm b/code/modules/modular_computers/os/components.dm index 5a50bd135e16..c3ea4c0134d7 100644 --- a/code/modules/modular_computers/os/components.dm +++ b/code/modules/modular_computers/os/components.dm @@ -14,10 +14,10 @@ /datum/extension/interactive/os/proc/has_component(var/part_type) return !!get_component(part_type) -/datum/extension/interactive/os/proc/print_paper(content, title) +/datum/extension/interactive/os/proc/print_paper(content, title, paper_type, list/metadata) var/obj/item/stock_parts/computer/nano_printer/printer = get_component(PART_PRINTER) if(printer) - return printer.print_text(content, title) + return printer.print_text(content, title, paper_type, metadata) /datum/extension/interactive/os/proc/get_network_tag() var/obj/item/stock_parts/computer/network_card/network_card = get_component(PART_NETWORK) diff --git a/code/modules/modular_computers/os/subtypes/silicon.dm b/code/modules/modular_computers/os/subtypes/silicon.dm index 0d96b436353b..06a7f0d58143 100644 --- a/code/modules/modular_computers/os/subtypes/silicon.dm +++ b/code/modules/modular_computers/os/subtypes/silicon.dm @@ -16,9 +16,9 @@ return M.stock_parts.Copy() /datum/extension/interactive/os/silicon/emagged() - var/mob/living/silicon/robot/R = holder - if(istype(R)) - return R.emagged + var/mob/living/silicon/robot/robot = holder + if(istype(robot)) + return robot.emagged return FALSE /datum/extension/interactive/os/silicon/host_status() @@ -37,7 +37,7 @@ var/datum/extension/interactive/os/os = get_extension(src, /datum/extension/interactive/os) if(os) return os.check_eye() - else + else return ..() /datum/extension/interactive/os/silicon/small/get_hardware_flag() diff --git a/code/modules/multiz/ladder.dm b/code/modules/multiz/ladder.dm index b86299bcf5f4..1cb9c5892dc4 100644 --- a/code/modules/multiz/ladder.dm +++ b/code/modules/multiz/ladder.dm @@ -120,12 +120,12 @@ /obj/structure/ladder/grab_attack(obj/item/grab/grab, mob/user) return FALSE -/obj/structure/ladder/attackby(obj/item/I, mob/user) - . = !istype(I, /obj/item/grab) && ..() +/obj/structure/ladder/attackby(obj/item/used_item, mob/user) + . = !istype(used_item, /obj/item/grab) && ..() if(!.) - climb(user, I) + climb(user, used_item) -/obj/structure/ladder/hitby(obj/item/I) +/obj/structure/ladder/hitby(obj/item/thing) . = ..() if(!target_down) return @@ -136,13 +136,13 @@ if(!istype(landing)) return for(var/atom/A in landing) - if(!A.CanPass(I, I.loc, 1.5, 0)) + if(!A.CanPass(thing, thing.loc, 1.5, 0)) blocker = A break if(!blocker) - visible_message(SPAN_DANGER("\The [I] goes down \the [src]!")) - I.forceMove(landing) - landing.visible_message(SPAN_DANGER("\The [I] falls from the top of \the [target_down]!")) + visible_message(SPAN_DANGER("\The [thing] goes down \the [src]!")) + thing.forceMove(landing) + landing.visible_message(SPAN_DANGER("\The [thing] falls from the top of \the [target_down]!")) /obj/structure/ladder/attack_hand(var/mob/user) if(user.check_intent(I_FLAG_HARM) || !user.check_dexterity(DEXTERITY_SIMPLE_MACHINES)) @@ -168,7 +168,7 @@ if(target_ladder) M.dropInto(target_ladder.loc) -/obj/structure/ladder/proc/climb(mob/M, obj/item/I) +/obj/structure/ladder/proc/climb(mob/M, obj/item/thing) if(!M.may_climb_ladders(src)) return @@ -186,7 +186,7 @@ M.visible_message(SPAN_NOTICE("\The [M] begins climbing [direction] \the [src].")) target_ladder.audible_message(SPAN_NOTICE("You hear something coming [direction] \the [src].")) if(do_after(M, climb_time, src)) - climbLadder(M, target_ladder, I) + climbLadder(M, target_ladder, thing) /obj/structure/ladder/attack_ghost(var/mob/M) instant_climb(M) @@ -250,7 +250,7 @@ /mob/observer/ghost/may_climb_ladders(var/ladder) return TRUE -/obj/structure/ladder/proc/climbLadder(mob/user, target_ladder, obj/item/I = null) +/obj/structure/ladder/proc/climbLadder(mob/user, target_ladder, obj/item/thing = null) var/turf/T = get_turf(target_ladder) for(var/atom/A in T) if(!A.CanPass(user, user.loc, 1.5, 0)) @@ -258,10 +258,10 @@ //We cannot use the ladder, but we probably can remove the obstruction var/atom/movable/M = A if(istype(M) && M.movable_flags & MOVABLE_FLAG_Z_INTERACT) - if(isnull(I) || istype(I, /obj/item/grab)) + if(isnull(thing) || istype(thing, /obj/item/grab)) M.attack_hand_with_interaction_checks(user) else - M.attackby(I, user) + M.attackby(thing, user) return FALSE playsound(src, pick(climbsounds), 50) playsound(target_ladder, pick(climbsounds), 50) @@ -277,8 +277,8 @@ else icon_state = "[base_icon][!!target_up][!!target_down]" if(target_down && draw_shadow) - var/image/I = image(icon, "downward_shadow") - I.appearance_flags |= RESET_COLOR - underlays = list(I) + var/image/overlay_image = image(icon, "downward_shadow") + overlay_image.appearance_flags |= RESET_COLOR + underlays = list(overlay_image) else underlays.Cut() diff --git a/code/modules/multiz/level_data.dm b/code/modules/multiz/level_data.dm index 00b82e3b5ac3..ea5984672f15 100644 --- a/code/modules/multiz/level_data.dm +++ b/code/modules/multiz/level_data.dm @@ -223,6 +223,7 @@ if(!change_turf && !change_area) return var/area/A = change_area ? get_base_area_instance() : null + // We don't have to worry about the edge turfs because those are handled in build_border(). for(var/turf/T as anything in Z_ALL_TURFS(level_z)) if(change_turf) T = T.ChangeTurf(picked_turf) diff --git a/code/modules/multiz/map_data.dm b/code/modules/multiz/map_data.dm index ea7f09545111..83d4f972daa2 100644 --- a/code/modules/multiz/map_data.dm +++ b/code/modules/multiz/map_data.dm @@ -4,7 +4,6 @@ icon_state = "map_data" var/height = 1 ///< The number of Z-Levels in the map. - var/turf/edge_type ///< What the map edge should be formed with. (null = world.turf) // If the height is more than 1, we mark all contained levels as connected. // This initializes immediately because it is an auxiliary effect specifically needed pre-SSatoms init. diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index 802d6782d279..4240ed507b22 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -98,6 +98,7 @@ // Entered() which is part of Move(), by spawn()ing we let that complete. But we want to preserve if we were in client movement // or normal movement so other move behavior can continue. /atom/movable/proc/begin_falling(var/lastloc, var/below) + moving_diagonally = FALSE // cancel diagonal movement immediately addtimer(CALLBACK(src, TYPE_PROC_REF(/atom/movable, fall_callback), below), 0) /atom/movable/proc/fall_callback(var/turf/below) diff --git a/code/modules/multiz/stairs.dm b/code/modules/multiz/stairs.dm index e78d6e90ffa6..c93c6f50229b 100644 --- a/code/modules/multiz/stairs.dm +++ b/code/modules/multiz/stairs.dm @@ -63,6 +63,7 @@ /obj/structure/stairs/long icon = 'icons/obj/stairs_64.dmi' bound_height = 64 + appearance_flags = /obj/structure/stairs::appearance_flags & ~TILE_BOUND /obj/structure/stairs/long/north dir = NORTH diff --git a/code/modules/multiz/zmimic/mimic_movable.dm b/code/modules/multiz/zmimic/mimic_movable.dm index 7fa5849e54f8..2af50724b884 100644 --- a/code/modules/multiz/zmimic/mimic_movable.dm +++ b/code/modules/multiz/zmimic/mimic_movable.dm @@ -4,17 +4,6 @@ /// Movable-level Z-Mimic flags. This uses ZMM_* flags, not ZM_* flags. var/z_flags = 0 -/atom/movable/forceMove(atom/dest) - . = ..(dest) - if (. && bound_overlay) - // The overlay will handle cleaning itself up on non-openspace turfs. - if (isturf(dest)) - bound_overlay.forceMove(get_step(src, UP)) - if (dir != bound_overlay.dir) - bound_overlay.set_dir(dir) - else // Not a turf, so we need to destroy immediately instead of waiting for the destruction timer to proc. - qdel(bound_overlay) - /atom/movable/set_dir(ndir) . = ..() if (. && bound_overlay) @@ -24,9 +13,7 @@ if (!bound_overlay || !isturf(loc)) return - var/turf/T = loc - - if (TURF_IS_MIMICKING(T.above)) + if (MOVABLE_IS_BELOW_ZTURF(src)) SSzcopy.queued_overlays += bound_overlay bound_overlay.queued += 1 else @@ -146,7 +133,7 @@ return ..() -/atom/movable/openspace/mimic/attackby(obj/item/W, mob/user) +/atom/movable/openspace/mimic/attackby(obj/item/used_item, mob/user) to_chat(user, SPAN_NOTICE("\The [src] is too far away.")) return TRUE @@ -159,10 +146,14 @@ SHOULD_CALL_PARENT(FALSE) return associated_atom.examined_by(user, distance, infix, suffix) +// Trying to grab a mimic tries to grab the copied atom instead. +/atom/movable/openspace/mimic/try_make_grab(mob/living/user, defer_hand) + return associated_atom.try_make_grab(user, defer_hand) + /atom/movable/openspace/mimic/forceMove(turf/dest) var/atom/old_loc = loc . = ..() - if (TURF_IS_MIMICKING(dest)) + if (MOVABLE_IS_ON_ZTURF(src)) if (destruction_timer) deltimer(destruction_timer) destruction_timer = null @@ -195,8 +186,8 @@ mouse_opacity = MOUSE_OPACITY_UNCLICKABLE z_flags = ZMM_IGNORE // Only one of these should ever be visible at a time, the mimic logic will handle that. -/atom/movable/openspace/turf_proxy/attackby(obj/item/W, mob/user) - return loc.attackby(W, user) +/atom/movable/openspace/turf_proxy/attackby(obj/item/used_item, mob/user) + return loc.attackby(used_item, user) /atom/movable/openspace/turf_proxy/attack_hand(mob/user as mob) SHOULD_CALL_PARENT(FALSE) @@ -223,8 +214,8 @@ ASSERT(isturf(loc)) delegate = loc:below -/atom/movable/openspace/turf_mimic/attackby(obj/item/W, mob/user) - return loc.attackby(W, user) +/atom/movable/openspace/turf_mimic/attackby(obj/item/used_item, mob/user) + return loc.attackby(used_item, user) /atom/movable/openspace/turf_mimic/attack_hand(mob/user as mob) SHOULD_CALL_PARENT(FALSE) diff --git a/code/modules/nano/interaction/hands.dm b/code/modules/nano/interaction/hands.dm index 3122925e2cc0..819adeb820c4 100644 --- a/code/modules/nano/interaction/hands.dm +++ b/code/modules/nano/interaction/hands.dm @@ -18,7 +18,7 @@ var/global/datum/topic_state/hands/hands_topic_state = new return STATUS_CLOSE /mob/living/silicon/robot/hands_can_use_topic(src_object) - for(var/obj/item/gripper/active_gripper in list(module_state_1, module_state_2, module_state_3)) + for(var/obj/item/gripper/active_gripper in get_held_items()) if(active_gripper.contains(src_object)) return STATUS_INTERACTIVE return STATUS_CLOSE diff --git a/code/modules/nano/modules/human_appearance.dm b/code/modules/nano/modules/human_appearance.dm index 6e22447ab9ca..9ba722beb8c3 100644 --- a/code/modules/nano/modules/human_appearance.dm +++ b/code/modules/nano/modules/human_appearance.dm @@ -14,6 +14,7 @@ src.whitelist = species_whitelist src.blacklist = species_blacklist +// FIXME: This doesn't currently handle arbitrary sprite accessory categories, so you can't select ears/tail/etc. /datum/nano_module/appearance_changer/Topic(ref, href_list, var/datum/topic_state/state = global.default_topic_state) if(..()) return 1 @@ -80,13 +81,14 @@ return var/list/data = host.initial_data() - data["specimen"] = owner.species.name + data["current_species_uid"] = owner.species.uid data["gender"] = owner.gender data["change_race"] = can_change(APPEARANCE_RACE) if(data["change_race"]) var/species[0] - for(var/specimen in owner.generate_valid_species(check_whitelist, whitelist, blacklist)) - species[++species.len] = list("specimen" = specimen) + for(var/species_uid in owner.generate_valid_species(check_whitelist, whitelist, blacklist)) + var/decl/species/candidate_species = decls_repository.get_decl_by_id(species_uid) + species[++species.len] = list("uid" = species_uid, "name" = candidate_species.name) data["species"] = species data["change_gender"] = can_change(APPEARANCE_GENDER) diff --git a/code/modules/nano/modules/law_manager.dm b/code/modules/nano/modules/law_manager.dm index fe0a427807ab..b2c53c8388f5 100644 --- a/code/modules/nano/modules/law_manager.dm +++ b/code/modules/nano/modules/law_manager.dm @@ -138,9 +138,9 @@ owner.laws.show_laws(owner) if(isAI(owner)) var/mob/living/silicon/ai/AI = owner - for(var/mob/living/silicon/robot/R in AI.connected_robots) - to_chat(R, "Law Notice") - R.laws.show_laws(R) + for(var/mob/living/silicon/robot/robot in AI.connected_robots) + to_chat(robot, "Law Notice") + robot.laws.show_laws(robot) if(usr != owner) to_chat(usr, "Laws displayed.") return 1 @@ -214,6 +214,6 @@ /datum/nano_module/law_manager/proc/sync_laws(var/mob/living/silicon/ai/AI) if(!AI) return - for(var/mob/living/silicon/robot/R in AI.connected_robots) - R.sync() - log_and_message_admins("has syncronized [AI]'s laws with its borgs.") + for(var/mob/living/silicon/robot/robot in AI.connected_robots) + robot.sync() + log_and_message_admins("has synchronized [AI]'s laws with its borgs.") diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm index f2125ae38e31..e5310e15826d 100644 --- a/code/modules/nano/nanoui.dm +++ b/code/modules/nano/nanoui.dm @@ -134,7 +134,7 @@ nanoui is used to open and update nano browser uis * * @return nothing */ -/datum/nanoui/proc/set_status(state, push_update) +/datum/nanoui/proc/set_nano_status(state, push_update) if (state != status) // Only update if it is different if (status == STATUS_DISABLED) status = state @@ -164,7 +164,7 @@ nanoui is used to open and update nano browser uis if(new_status == STATUS_CLOSE) close() return 1 - set_status(new_status, push_update) + set_nano_status(new_status, push_update) /** * Set the ui to auto update (every master_controller tick) @@ -514,13 +514,14 @@ nanoui is used to open and update nano browser uis set_show_map(text2num(href_list["showMap"])) map_update = 1 - if(href_list["mapZLevel"]) - var/map_z = text2num(href_list["mapZLevel"]) + if(href_list["switchMapZLevel"]) + var/map_z = text2num(href_list["switchMapZLevel"]) if(isMapLevel(map_z)) set_map_z_level(map_z) map_update = 1 - if ((src_object && src_object.Topic(href, href_list, state)) || map_update) + // src_object.Topic() might null out src_object by deleting us. + if (src_object && (src_object.Topic(href, href_list, state) || (!QDELETED(src) && src_object && map_update))) SSnano.update_uis(src_object) // update all UIs attached to src_object /** diff --git a/code/modules/organs/external/_external.dm b/code/modules/organs/external/_external.dm index d017fc61971f..044151498f50 100644 --- a/code/modules/organs/external/_external.dm +++ b/code/modules/organs/external/_external.dm @@ -49,7 +49,6 @@ var/list/children // Sub-limbs. var/list/internal_organs // Internal organs of this body part var/list/implants // Currently implanted objects. - var/base_miss_chance = 20 // Chance of missing. var/genetic_degradation = 0 // Amount of current genetic damage. //Forensics stuff @@ -112,7 +111,7 @@ fingerprint.completeness = rand(10,90) forensics.add_data(/datum/forensics/fingerprints, fingerprint) -/obj/item/organ/external/Initialize(mapload, material_key, datum/mob_snapshot/supplied_appearance, decl/bodytype/new_bodytype) +/obj/item/organ/external/Initialize(mapload, material_key, datum/mob_snapshot/supplied_appearance) . = ..() if(. != INITIALIZE_HINT_QDEL && isnull(pain_disability_threshold)) pain_disability_threshold = (max_damage * 0.75) @@ -135,7 +134,7 @@ if(owner) LAZYREMOVE(owner.bad_external_organs, src) -/obj/item/organ/external/set_species(specie_name) +/obj/item/organ/external/set_species(species_uid) _icon_cache_key = null . = ..() skin_blend = bodytype.limb_blend @@ -1087,9 +1086,19 @@ Note that amputating the affected organ does in fact remove the infection from t if(!clean) owner.shock_stage += min_broken_damage - var/obj/item/organ/external/original_parent = parent var/mob/living/human/victim = owner //Keep a reference for post-removed(). + var/obj/item/organ/external/original_parent = parent owner.remove_organ(src, TRUE, FALSE, ignore_children, update_icon = FALSE) + if(original_parent) + // Traumatic amputation is messy. + if(!clean && disintegrate != DISMEMBER_METHOD_BURN) + original_parent.sever_artery() + // Leave a big ol hole. + var/datum/wound/lost_limb/stump = new(src, disintegrate, clean) + stump.parent_organ = original_parent + LAZYADD(original_parent.wounds, stump) + original_parent.update_damages() + var/remaining_organs = victim.get_external_organs() if(istype(victim) && !QDELETED(victim)) // If they are down to their last organ, just spawn the organ and delete them. @@ -1101,21 +1110,10 @@ Note that amputating the affected organ does in fact remove the infection from t victim.dump_contents() qdel(victim) else // We deliberately skip queuing this via remove_organ() above due to potentially immediately deleting the mob. + victim.update_damage_overlays(FALSE) victim.regenerate_body_icon = TRUE victim.queue_icon_update() - if(original_parent) - - // Traumatic amputation is messy. - if(!clean && disintegrate != DISMEMBER_METHOD_BURN) - original_parent.sever_artery() - - // Leave a big ol hole. - var/datum/wound/lost_limb/stump = new(src, disintegrate, clean) - stump.parent_organ = original_parent - LAZYADD(original_parent.wounds, stump) - original_parent.update_damages() - if(QDELETED(src)) return diff --git a/code/modules/organs/external/_external_damage.dm b/code/modules/organs/external/_external_damage.dm index ee09b245d2fe..6ca145d43361 100644 --- a/code/modules/organs/external/_external_damage.dm +++ b/code/modules/organs/external/_external_damage.dm @@ -96,11 +96,11 @@ //Disturb treated burns if(brute > 5) var/disturbed = 0 - for(var/datum/wound/burn/W in wounds) - if((W.disinfected || W.salved) && prob(brute + W.damage)) - W.disinfected = 0 - W.salved = 0 - disturbed += W.damage + for(var/datum/wound/burn/wound in wounds) + if((wound.disinfected || wound.salved) && prob(brute + wound.damage)) + wound.disinfected = 0 + wound.salved = 0 + disturbed += wound.damage if(disturbed) to_chat(owner,"Ow! Your burns were disturbed.") add_pain(0.5*disturbed) @@ -177,15 +177,15 @@ return //Heal damage on the individual wounds - for(var/datum/wound/W in wounds) + for(var/datum/wound/wound in wounds) if(brute == 0 && burn == 0) break // heal brute damage - if(W.damage_type == BURN) - burn = W.heal_damage(burn) + if(wound.damage_type == BURN) + burn = wound.heal_damage(burn) else - brute = W.heal_damage(brute) + brute = wound.heal_damage(brute) if(internal) status &= ~ORGAN_BROKEN diff --git a/code/modules/organs/external/_external_icons.dm b/code/modules/organs/external/_external_icons.dm index 61ed76c361c8..0e447204cec7 100644 --- a/code/modules/organs/external/_external_icons.dm +++ b/code/modules/organs/external/_external_icons.dm @@ -109,7 +109,7 @@ var/global/list/organ_icon_cache = list() global.organ_icon_cache[_icon_cache_key] = ret return ret -/obj/item/organ/external/proc/get_mob_overlays() +/obj/item/organ/external/proc/get_limb_mob_overlays() for(var/accessory_category in _sprite_accessories) var/list/draw_accessories = _sprite_accessories[accessory_category] for(var/accessory in draw_accessories) @@ -127,7 +127,7 @@ var/global/list/organ_icon_cache = list() /obj/item/organ/external/proc/get_icon_cache_key_components() - . = list("[icon_state]_[species.name]_[get_organ_appearance_bodytype()?.uid || "BAD_BODYTYPE"]_[render_alpha]_[icon]") + . = list("[icon_state]_[species.uid]_[get_organ_appearance_bodytype()?.uid || "BAD_BODYTYPE"]_[render_alpha]_[icon]") // Skeletons don't care about most icon appearance stuff. if(limb_flags & ORGAN_FLAG_SKELETAL) @@ -305,7 +305,7 @@ var/global/list/organ_icon_cache = list() icon = mob_icon // We may have some overlays of our own (hair, glowing eyes, layered markings) - var/list/additional_overlays = get_mob_overlays() + var/list/additional_overlays = get_limb_mob_overlays() if(length(additional_overlays)) for(var/new_overlay in additional_overlays) add_overlay(new_overlay) diff --git a/code/modules/organs/external/diagnostics.dm b/code/modules/organs/external/diagnostics.dm index 973c506b9fcd..b78c313b71c7 100644 --- a/code/modules/organs/external/diagnostics.dm +++ b/code/modules/organs/external/diagnostics.dm @@ -27,28 +27,28 @@ flavor_text += "a tear at the [amputation_point] so severe that it hangs by a scrap of flesh" var/list/wound_descriptors = list() - for(var/datum/wound/W in wounds) - var/this_wound_desc = W.desc - if(W.damage_type == BURN && W.salved) + for(var/datum/wound/wound in wounds) + var/this_wound_desc = wound.desc + if(wound.damage_type == BURN && wound.salved) this_wound_desc = "salved [this_wound_desc]" - if(W.bleeding()) - if(W.wound_damage() > W.bleed_threshold) + if(wound.bleeding()) + if(wound.wound_damage() > wound.bleed_threshold) this_wound_desc = "bleeding [this_wound_desc]" else this_wound_desc = "bleeding [this_wound_desc]" - else if(W.bandaged) + else if(wound.bandaged) this_wound_desc = "bandaged [this_wound_desc]" - if(W.germ_level > 600) + if(wound.germ_level > 600) this_wound_desc = "badly infected [this_wound_desc]" - else if(W.germ_level > 330) + else if(wound.germ_level > 330) this_wound_desc = "lightly infected [this_wound_desc]" if(wound_descriptors[this_wound_desc]) - wound_descriptors[this_wound_desc] += W.amount + wound_descriptors[this_wound_desc] += wound.amount else - wound_descriptors[this_wound_desc] = W.amount + wound_descriptors[this_wound_desc] = wound.amount if(how_open() >= SURGERY_RETRACTED) var/bone = encased ? encased : "bone" diff --git a/code/modules/organs/external/head.dm b/code/modules/organs/external/head.dm index e2d32062fb37..4b1886424b9f 100644 --- a/code/modules/organs/external/head.dm +++ b/code/modules/organs/external/head.dm @@ -125,7 +125,7 @@ ret.Blend(eyes_icon, ICON_OVERLAY) return ret -/obj/item/organ/external/head/get_mob_overlays() +/obj/item/organ/external/head/get_limb_mob_overlays() . = ..() var/image/eye_glow = get_organ_eyes_overlay() if(eye_glow) diff --git a/code/modules/organs/external/standard.dm b/code/modules/organs/external/standard.dm index 84cb21e75a31..85c880a0a84c 100644 --- a/code/modules/organs/external/standard.dm +++ b/code/modules/organs/external/standard.dm @@ -20,9 +20,6 @@ cavity_name = "thoracic cavity" limb_flags = ORGAN_FLAG_HEALS_OVERKILL | ORGAN_FLAG_CAN_BREAK -/obj/item/organ/external/chest/proc/get_current_skin() - return - /obj/item/organ/external/chest/die() //Special handling for synthetics if(BP_IS_PROSTHETIC(src) || BP_IS_CRYSTAL(src)) diff --git a/code/modules/organs/internal/_internal.dm b/code/modules/organs/internal/_internal.dm index 8c7939f7ed43..a200ebacfc41 100644 --- a/code/modules/organs/internal/_internal.dm +++ b/code/modules/organs/internal/_internal.dm @@ -36,7 +36,7 @@ . = ..() set_max_damage(absolute_max_damage) -/obj/item/organ/internal/set_species(species_name) +/obj/item/organ/internal/set_species(species_uid) . = ..() if(species.organs_icon) icon = species.organs_icon diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm index 0a83423de539..b3afab56119a 100644 --- a/code/modules/organs/internal/brain.dm +++ b/code/modules/organs/internal/brain.dm @@ -45,7 +45,7 @@ /obj/item/organ/internal/brain/getToxLoss() return 0 -/obj/item/organ/internal/brain/set_species(species_name) +/obj/item/organ/internal/brain/set_species(species_uid) . = ..() icon_state = "brain-prosthetic" if(species) @@ -213,7 +213,7 @@ owner.custom_pain("Your head feels numb and painful.",10) if(is_bruised() && prob(1) && !HAS_STATUS(owner, STAT_BLURRY)) to_chat(owner, "It becomes hard to see for some reason.") - owner.set_status(STAT_BLURRY, 10) + owner.set_status_condition(STAT_BLURRY, 10) var/held = owner.get_active_held_item() if(_organ_damage >= 0.5*max_damage && prob(1) && held) to_chat(owner, "Your hand won't respond properly, and you drop what you are holding!") diff --git a/code/modules/organs/internal/brain_computer.dm b/code/modules/organs/internal/brain_computer.dm index 3a3d946954fd..e67b6be22c8f 100644 --- a/code/modules/organs/internal/brain_computer.dm +++ b/code/modules/organs/internal/brain_computer.dm @@ -35,6 +35,7 @@ _brainmob.add_language(/decl/language/machine) /obj/item/organ/internal/brain/robotic/on_update_icon() + . = ..() var/mob/living/brainmob = get_brainmob() icon_state = get_world_inventory_state() if(!searching) diff --git a/code/modules/organs/internal/cell.dm b/code/modules/organs/internal/cell.dm index 4087194c2a6b..e778d84defe7 100644 --- a/code/modules/organs/internal/cell.dm +++ b/code/modules/organs/internal/cell.dm @@ -62,8 +62,8 @@ // TODO: Make this use the cell extension instead? // Or have it grant a subtype of cell extension to the mob, maybe? -/obj/item/organ/internal/cell/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/organ/internal/cell/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) if(open) open = FALSE to_chat(user, SPAN_NOTICE("You screw the battery panel in place.")) @@ -72,17 +72,17 @@ to_chat(user, SPAN_NOTICE("You unscrew the battery panel.")) return TRUE else if(open) - if(IS_CROWBAR(W)) + if(IS_CROWBAR(used_item)) if(cell) user.put_in_hands(cell) to_chat(user, SPAN_NOTICE("You remove \the [cell] from \the [src].")) cell = null return TRUE - else if (istype(W, /obj/item/cell)) + else if (istype(used_item, /obj/item/cell)) if(cell) to_chat(user, SPAN_WARNING("There is a power cell already installed.")) - else if(user.try_unequip(W, src)) - cell = W + else if(user.try_unequip(used_item, src)) + cell = used_item to_chat(user, SPAN_NOTICE("You insert \the [cell].")) return TRUE return ..() diff --git a/code/modules/organs/internal/eyes.dm b/code/modules/organs/internal/eyes.dm index 94e7e27418e3..27d1be46f409 100644 --- a/code/modules/organs/internal/eyes.dm +++ b/code/modules/organs/internal/eyes.dm @@ -22,6 +22,9 @@ /obj/item/organ/internal/eyes/proc/get_flash_mod() return bodytype.eye_flash_mod +/obj/item/organ/internal/eyes/proc/get_flash_burn() + return bodytype.eye_flash_burn + /obj/item/organ/internal/eyes/proc/get_darksight_range() return bodytype.eye_darksight_range diff --git a/code/modules/organs/internal/heart.dm b/code/modules/organs/internal/heart.dm index 8930a70e6b96..371c957ffc26 100644 --- a/code/modules/organs/internal/heart.dm +++ b/code/modules/organs/internal/heart.dm @@ -114,7 +114,7 @@ return //Dead or cryosleep people do not pump the blood. - if(!owner || owner.is_in_stasis() || owner.stat == DEAD || owner.bodytemperature < 170) + if(!owner || owner.has_mob_modifier(/decl/mob_modifier/stasis) || owner.stat == DEAD || owner.bodytemperature < 170) return if(pulse != PULSE_NONE || BP_IS_PROSTHETIC(src)) @@ -129,22 +129,22 @@ var/open_wound if(temp.status & ORGAN_BLEEDING) - for(var/datum/wound/W in temp.wounds) + for(var/datum/wound/wound in temp.wounds) - if(!open_wound && (W.damage_type == CUT || W.damage_type == PIERCE) && W.damage && !W.is_treated()) + if(!open_wound && (wound.damage_type == CUT || wound.damage_type == PIERCE) && wound.damage && !wound.is_treated()) open_wound = TRUE - if(W.bleeding()) + if(wound.bleeding()) if(temp.applied_pressure) if(ishuman(temp.applied_pressure)) var/mob/living/human/H = temp.applied_pressure H.bloody_hands(src, 0) //somehow you can apply pressure to every wound on the organ at the same time //you're basically forced to do nothing at all, so let's make it pretty effective - var/min_eff_damage = max(0, W.damage - 10) / 6 //still want a little bit to drip out, for effect - blood_max += max(min_eff_damage, W.damage - 30) / 40 + var/min_eff_damage = max(0, wound.damage - 10) / 6 //still want a little bit to drip out, for effect + blood_max += max(min_eff_damage, wound.damage - 30) / 40 else - blood_max += W.damage / 40 + blood_max += wound.damage / 40 if(temp.status & ORGAN_ARTERY_CUT) var/bleed_amount = floor((owner.vessel.total_volume / (temp.applied_pressure || !open_wound ? 400 : 250))*temp.arterial_bleed_severity) @@ -173,7 +173,7 @@ FONT_HUGE(SPAN_DANGER("Blood sprays out from your [spray_organ]!")) ) SET_STATUS_MAX(owner, STAT_STUN, 1) - owner.set_status(STAT_BLURRY, 2) + owner.set_status_condition(STAT_BLURRY, 2) //AB occurs every heartbeat, this only throttles the visible effect next_blood_squirt = world.time + 80 diff --git a/code/modules/organs/internal/lungs.dm b/code/modules/organs/internal/lungs.dm index dc919a92490c..003f7b851d15 100644 --- a/code/modules/organs/internal/lungs.dm +++ b/code/modules/organs/internal/lungs.dm @@ -11,7 +11,7 @@ max_damage = 70 relative_size = 60 - var/active_breathing = 1 + var/active_breathing = TRUE var/has_gills = FALSE var/breath_type var/exhale_type @@ -59,16 +59,10 @@ /obj/item/organ/internal/lungs/proc/adjust_oxygen_deprivation(var/amount) oxygen_deprivation = clamp(oxygen_deprivation + amount, 0, species.total_health) -/obj/item/organ/internal/lungs/set_species(species_name) +/obj/item/organ/internal/lungs/set_species(species_uid) . = ..() sync_breath_types() -// This call needs to be split out to make sure that all the ingested things are metabolised -// before the process call is made on any of the other organs -/obj/item/organ/internal/lungs/proc/metabolize() - if(is_usable()) - inhaled.metabolize() - /** * Set these lungs' breath types based on the lungs' species */ @@ -86,14 +80,13 @@ poison_types = list(/decl/material/gas/chlorine = TRUE) exhale_type = /decl/material/gas/carbon_dioxide - /obj/item/organ/internal/lungs/Process() ..() if(!owner) return if(owner.vital_organ_missing_time) - owner.ticks_since_last_successful_breath = max(10, owner.ticks_since_last_successful_breath) + owner.suffocation_counter = max(10, owner.suffocation_counter) return if (germ_level > INFECTION_LEVEL_ONE && active_breathing) @@ -125,7 +118,7 @@ else to_chat(owner, "You're having trouble getting enough [breath_type]!") - owner.ticks_since_last_successful_breath = max(3, owner.ticks_since_last_successful_breath) + owner.suffocation_counter = max(3, owner.suffocation_counter) /obj/item/organ/internal/lungs/proc/rupture() var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(owner, parent_organ) diff --git a/code/modules/organs/internal/stomach.dm b/code/modules/organs/internal/stomach.dm index d8abe4894167..4cbde4e21255 100644 --- a/code/modules/organs/internal/stomach.dm +++ b/code/modules/organs/internal/stomach.dm @@ -12,7 +12,7 @@ QDEL_NULL(ingested) . = ..() -/obj/item/organ/internal/stomach/set_species(species_name) +/obj/item/organ/internal/stomach/set_species(species_uid) if(species?.gluttonous) verbs -= /obj/item/organ/internal/stomach/proc/throw_up . = ..() diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index d60a8aa9cae3..547f14ea6704 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -1,38 +1,59 @@ /obj/item/organ - name = "organ" - icon = 'icons/obj/surgery.dmi' - germ_level = 0 - w_class = ITEM_SIZE_SMALL + name = "organ" + icon = 'icons/obj/surgery.dmi' + germ_level = 0 + w_class = ITEM_SIZE_SMALL default_action_type = /datum/action/item_action/organ - origin_tech = @'{"materials":1,"biotech":1}' - abstract_type = /obj/item/organ + origin_tech = @'{"materials":1,"biotech":1}' + abstract_type = /obj/item/organ + pickup_sound = 'sound/foley/meat1.ogg' + drop_sound = 'sound/foley/meat2.ogg' + hitsound = 'sound/effects/squelch1.ogg' // Strings. - var/organ_tag = "organ" // Unique identifier. - var/organ_category // Identifier for use in organ collections, unused if unset. Would be nice to make this a list, but bodytypes rely on initial() with it. - var/parent_organ = BP_CHEST // Organ holding this object. + /// Unique identifier. + var/organ_tag = "organ" + /// Identifier for use in organ collections, unused if unset. Would be nice to make this a list, but bodytypes rely on initial() with it. + var/organ_category + /// Organ holding this object. + var/parent_organ = BP_CHEST // Status tracking. - var/status = 0 // Various status flags (such as robotic) - var/organ_properties = 0 // A flag for telling what capabilities this organ has. ORGAN_PROP_PROSTHETIC, ORGAN_PROP_CRYSTAL, etc.. - var/vital_to_owner // Cache var for vitality to current owner. + /// Various status flags (such as robotic) + var/status = 0 + /// A flag for telling what capabilities this organ has. ORGAN_PROP_PROSTHETIC, ORGAN_PROP_CRYSTAL, etc.. + var/organ_properties = 0 + /// Cache var for vitality to current owner. + var/vital_to_owner // Reference data. var/datum/mob_snapshot/organ_appearance - var/mob/living/human/owner // Current mob owning the organ. - var/decl/species/species // Original species. - var/decl/bodytype/bodytype // Original bodytype. - var/decl/bodytype/appearance_bodytype // A bodytype used only for icons, marking validation and equipment offsets. - var/list/ailments // Current active ailments if any. - var/meat_name // Taken from first owner. + /// Current mob owning the organ. + var/mob/living/human/owner + /// Original species. + var/decl/species/species + /// Original bodytype. + var/decl/bodytype/bodytype + /// A bodytype used only for icons, marking validation and equipment offsets. + var/decl/bodytype/appearance_bodytype + /// Current active ailments if any. + var/list/ailments + /// Taken from first owner. + var/meat_name // Damage vars. - var/min_broken_damage = 30 // Damage before becoming broken - var/max_damage = 30 // Damage cap, including scarring - var/absolute_max_damage = 0 // Lifetime damage cap, ignoring scarring. - var/rejecting // Is this organ already being rejected? - var/death_time // REALTIMEOFDAY at moment of death. - var/scale_max_damage_to_species_health // Whether or not we should scale the damage values of this organ to the owner species. + /// Damage before becoming broken + var/min_broken_damage = 30 + /// Damage cap, including scarring + var/max_damage = 30 + /// Lifetime damage cap, ignoring scarring. + var/absolute_max_damage = 0 + /// Is this organ already being rejected? + var/rejecting + /// REALTIMEOFDAY at moment of death. + var/death_time + /// Whether or not we should scale the damage values of this organ to the owner species. + var/scale_max_damage_to_species_health /// Set to true if this organ should return info to Stat(). See get_stat_info(). var/has_stat_info @@ -123,8 +144,11 @@ QDEL_NULL(organ_appearance) organ_appearance = supplied_appearance.Clone() blood_DNA = list(organ_appearance.unique_enzymes = organ_appearance.blood_type) - set_species(organ_appearance.root_species?.name || global.using_map.default_species) - if(organ_appearance.root_bodytype) + if(species != organ_appearance.root_species) + if(organ_appearance.root_bodytype && organ_appearance.root_bodytype != bodytype) + bodytype = organ_appearance.root_bodytype // this lets us take advantage of set_bodytype being called in set_species + set_species(organ_appearance.root_species?.uid || global.using_map.default_species) + else if(organ_appearance.root_bodytype && organ_appearance.root_bodytype != bodytype) set_bodytype(organ_appearance.root_bodytype) /obj/item/organ/proc/set_bodytype(decl/bodytype/new_bodytype, override_material = null, apply_to_internal_organs = TRUE) @@ -167,15 +191,15 @@ absolute_max_damage = floor(ndamage) max_damage = absolute_max_damage -/obj/item/organ/proc/set_species(specie_name) +/obj/item/organ/proc/set_species(species_uid) vital_to_owner = null // This generally indicates the owner mob is having species set, and this value may be invalidated. - if(istext(specie_name)) - species = get_species_by_key(specie_name) + if(istext(species_uid)) + species = decls_repository.get_decl_by_id(species_uid) else - species = specie_name + species = species_uid if(!species) - species = get_species_by_key(global.using_map.default_species) - PRINT_STACK_TRACE("Invalid species. Expected a valid species name as string, was: [log_info_line(specie_name)]") + species = decls_repository.get_decl_by_id(global.using_map.default_species) + PRINT_STACK_TRACE("Invalid species. Expected a valid species UID as string, was: [log_info_line(species_uid)]") set_bodytype(bodytype || species.default_bodytype, override_material = material?.type) @@ -245,9 +269,9 @@ /obj/item/organ/proc/handle_ailment(var/datum/ailment/ailment) if(ailment.treated_by_reagent_type) for(var/datum/reagents/source as anything in owner.get_metabolizing_reagent_holders()) - for(var/reagent_type in source.reagent_volumes) - if(ailment.treated_by_medication(reagent_type, source.reagent_volumes[reagent_type])) - ailment.was_treated_by_medication(source, reagent_type) + for(var/decl/material/reagent as anything in source.reagent_volumes) + if(ailment.treated_by_medication(reagent.type, source.reagent_volumes[reagent])) + ailment.was_treated_by_medication(source, reagent.type) return if(ailment.treated_by_chem_effect && owner.has_chemical_effect(ailment.treated_by_chem_effect, ailment.treated_by_chem_effect_strength)) ailment.was_treated_by_chem_effect() diff --git a/code/modules/organs/pain.dm b/code/modules/organs/pain.dm index 4c84995b0860..96a83f894ce1 100644 --- a/code/modules/organs/pain.dm +++ b/code/modules/organs/pain.dm @@ -1,15 +1,15 @@ -/mob +/mob/living var/obj/screen/fullscreen/pain/pain -/mob/Initialize() +/mob/living/Initialize() pain = new(null, src) . = ..() -/mob/Destroy() +/mob/living/Destroy() QDEL_NULL(pain) . = ..() -/mob/proc/flash_pain(var/target) +/mob/living/proc/flash_pain(var/target) if(pain) var/matrix/M if(client && max(client.last_view_x_dim, client.last_view_y_dim) > 7) diff --git a/code/modules/overmap/_overmap.dm b/code/modules/overmap/_overmap.dm index dcdd3e965fdb..6f63a9edf783 100644 --- a/code/modules/overmap/_overmap.dm +++ b/code/modules/overmap/_overmap.dm @@ -30,10 +30,9 @@ generate_overmap() testing("Overmap build for [name] complete.") - for(var/event_type in subtypesof(/datum/overmap_event)) - var/datum/overmap_event/event = event_type - if(initial(event.overmap_id) == name) - LAZYADD(valid_event_types, event_type) + for(var/decl/overmap_event/event in decls_repository.get_decls_of_subtype_unassociated(/decl/overmap_event)) + if(event.overmap_id == name) + LAZYADD(valid_event_types, event.type) ..() diff --git a/code/modules/overmap/contacts/_contacts.dm b/code/modules/overmap/contacts/_contacts.dm index bde9a41d1717..069f914a4d9c 100644 --- a/code/modules/overmap/contacts/_contacts.dm +++ b/code/modules/overmap/contacts/_contacts.dm @@ -68,8 +68,8 @@ return var/list/showing = owner.linked?.navigation_viewers || owner.viewers if(length(showing)) - for(var/weakref/W in showing) - var/mob/M = W.resolve() + for(var/weakref/viewer_ref in showing) + var/mob/M = viewer_ref.resolve() if(istype(M) && M.client) M.client.images |= images @@ -78,8 +78,8 @@ return var/list/showing = owner.linked?.navigation_viewers || owner.viewers if(length(showing)) - for(var/weakref/W in showing) - var/mob/M = W.resolve() + for(var/weakref/viewer_ref in showing) + var/mob/M = viewer_ref.resolve() if(istype(M) && M.client) M.client.images -= images diff --git a/code/modules/overmap/contacts/contact_sensors.dm b/code/modules/overmap/contacts/contact_sensors.dm index fcdd349fb077..7ebe9b07788e 100644 --- a/code/modules/overmap/contacts/contact_sensors.dm +++ b/code/modules/overmap/contacts/contact_sensors.dm @@ -150,9 +150,9 @@ if(!record.pinged) addtimer(CALLBACK(record, PROC_REF(ping)), time_delay) -/obj/machinery/computer/ship/sensors/attackby(var/obj/item/I, var/mob/user) +/obj/machinery/computer/ship/sensors/attackby(var/obj/item/used_item, var/mob/user) . = ..() - var/obj/item/multitool/P = I + var/obj/item/multitool/P = used_item if(!istype(P)) return var/obj/item/ship_tracker/tracker = P.get_buffer() diff --git a/code/modules/overmap/disperser/disperser.dm b/code/modules/overmap/disperser/disperser.dm index 4b8660f0c0ee..5059a21e44a9 100644 --- a/code/modules/overmap/disperser/disperser.dm +++ b/code/modules/overmap/disperser/disperser.dm @@ -12,10 +12,10 @@ if(panel_open) . += "The maintenance panel is open." -/obj/machinery/disperser/attackby(obj/item/I, mob/user) - if(IS_WRENCH(I)) +/obj/machinery/disperser/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item)) if(panel_open) - user.visible_message("\The [user] rotates \the [src] with \the [I].", "You rotate \the [src] with \the [I].") + user.visible_message("\The [user] rotates \the [src] with \the [used_item].", "You rotate \the [src] with \the [used_item].") set_dir(turn(dir, 90)) playsound(src, 'sound/items/jaws_pry.ogg', 50, 1) else diff --git a/code/modules/overmap/events/event.dm b/code/modules/overmap/events/event.dm index b7d898a94f04..d2d63a62c262 100644 --- a/code/modules/overmap/events/event.dm +++ b/code/modules/overmap/events/event.dm @@ -19,17 +19,14 @@ for(var/i = 1 to overmap.event_areas) if(!candidate_turfs.len) break - var/overmap_event_type = pick(overmap.valid_event_types) - var/datum/overmap_event/datum_spawn = new overmap_event_type + var/decl/overmap_event/datum_spawn = GET_DECL(pick(overmap.valid_event_types)) var/list/event_turfs = acquire_event_turfs(datum_spawn.count, datum_spawn.radius, candidate_turfs, datum_spawn.continuous) candidate_turfs -= event_turfs for(var/event_turf in event_turfs) - var/type = pick(datum_spawn.hazards) - new type(event_turf) - - qdel(datum_spawn)//idk help how do I do this better? + var/hazard_type = pick(datum_spawn.hazards) + new hazard_type(event_turf) /decl/overmap_event_handler/proc/acquire_event_turfs(var/number_of_turfs, var/distance_from_origin, var/list/candidate_turfs, var/continuous = TRUE) number_of_turfs = min(number_of_turfs, candidate_turfs.len) @@ -168,7 +165,6 @@ name = "event" icon = 'icons/obj/overmap.dmi' icon_state = "blank" - opacity = TRUE color = "#880000" // Events must be detected by sensors, but are otherwise instantly visible. @@ -179,7 +175,6 @@ var/list/event_icon_states var/difficulty = EVENT_LEVEL_MODERATE var/weaknesses //if the BSA can destroy them and with what - var/list/victims //basically cached events on which Z level var/list/colors = list() //Pick a color from this list on init /obj/effect/overmap/event/Initialize() @@ -257,51 +252,47 @@ colors = list("#a709db", "#c228c7", "#c444e4") //These now are basically only used to spawn hazards. Will be useful when we need to spawn group of moving hazards -/datum/overmap_event +/decl/overmap_event var/name = "map event" var/radius = 2 var/count = 6 var/hazards - var/opacity = TRUE var/continuous = TRUE //if it should form continous blob, or can have gaps var/overmap_id = OVERMAP_ID_SPACE -/datum/overmap_event/meteor +/decl/overmap_event/meteor name = "asteroid field" count = 15 radius = 4 continuous = FALSE hazards = /obj/effect/overmap/event/meteor -/datum/overmap_event/electric +/decl/overmap_event/electric name = "electrical storm" count = 11 radius = 3 - opacity = FALSE hazards = /obj/effect/overmap/event/electric -/datum/overmap_event/dust +/decl/overmap_event/dust name = "dust cloud" count = 16 radius = 4 hazards = /obj/effect/overmap/event/dust -/datum/overmap_event/ion +/decl/overmap_event/ion name = "ion cloud" count = 8 radius = 3 - opacity = FALSE hazards = /obj/effect/overmap/event/ion -/datum/overmap_event/carp +/decl/overmap_event/carp name = "carp shoal" count = 8 radius = 3 - opacity = FALSE continuous = FALSE hazards = /obj/effect/overmap/event/carp -/datum/overmap_event/carp/major +/decl/overmap_event/carp/major name = "carp school" count = 5 radius = 4 diff --git a/code/modules/overmap/ftl_shunt/core.dm b/code/modules/overmap/ftl_shunt/core.dm index a6e6e567046e..ca95cf968b9b 100644 --- a/code/modules/overmap/ftl_shunt/core.dm +++ b/code/modules/overmap/ftl_shunt/core.dm @@ -17,7 +17,6 @@ var/shunt_x = 1 var/shunt_y = 1 var/chargepercent = 0 - var/last_percent_tick = 0 var/obj/machinery/computer/ship/ftl/ftl_computer var/required_fuel_joules var/required_charge //This is a function of the required fuel joules. @@ -112,9 +111,9 @@ else . += SPAN_WARNING("It looks like it's been tampered with, but you're not sure to what extent.") -/obj/machinery/ftl_shunt/core/attackby(var/obj/item/O, var/mob/user) - if(istype(O, /obj/item/stack/telecrystal)) - var/obj/item/stack/telecrystal/TC = O +/obj/machinery/ftl_shunt/core/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/stack/telecrystal)) + var/obj/item/stack/telecrystal/TC = used_item if(TC.amount < 10) to_chat(user, SPAN_WARNING("You don't have enough telecrystals to sabotage [src].")) @@ -238,11 +237,11 @@ return FTL_START_CONFIRMED /obj/machinery/ftl_shunt/core/proc/calculate_jump_requirements() - var/obj/effect/overmap/visitable/O = global.overmap_sectors[num2text(z)] - if(O) + var/obj/effect/overmap/visitable/site = global.overmap_sectors[num2text(z)] + if(site) var/shunt_distance var/vessel_mass = ftl_computer.linked.get_vessel_mass() - var/shunt_turf = locate(shunt_x, shunt_y, O.z) + var/shunt_turf = locate(shunt_x, shunt_y, site.z) shunt_distance = get_dist(get_turf(ftl_computer.linked), shunt_turf) required_fuel_joules = (vessel_mass * JOULES_PER_TON) * shunt_distance required_charge = required_fuel_joules * REQUIRED_CHARGE_MULTIPLIER @@ -275,12 +274,12 @@ cancel_shunt() return //If for some reason we don't have fuel now, just return. - var/obj/effect/overmap/visitable/O = global.overmap_sectors[num2text(z)] - if(O) - var/destination = locate(shunt_x, shunt_y, O.z) + var/obj/effect/overmap/visitable/site = global.overmap_sectors[num2text(z)] + if(site) + var/destination = locate(shunt_x, shunt_y, site.z) var/jumpdist = get_dist(get_turf(ftl_computer.linked), destination) - var/obj/effect/portal/wormhole/W = new(destination) //Generate a wormhole effect on overmap to give some indication that something is about to happen. - QDEL_IN(W, 6 SECONDS) + var/obj/effect/portal/wormhole/wormhole = new(destination) //Generate a wormhole effect on overmap to give some indication that something is about to happen. + QDEL_IN(wormhole, 6 SECONDS) addtimer(CALLBACK(src, PROC_REF(do_shunt), shunt_x, shunt_y, jumpdist, destination), 6 SECONDS) jumping = TRUE update_icon() @@ -584,13 +583,13 @@ master = null QDEL_NULL(fuel) -/obj/machinery/ftl_shunt/fuel_port/attackby(var/obj/item/O, var/mob/user) - if(istype(O, /obj/item/fuel_assembly) && !fuel) +/obj/machinery/ftl_shunt/fuel_port/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/fuel_assembly) && !fuel) if(!do_after(user, 2 SECONDS, src) || fuel) return TRUE - if(!user || !user.try_unequip(O, src)) + if(!user || !user.try_unequip(used_item, src)) return TRUE - fuel = O + fuel = used_item max_fuel = get_fuel_joules(TRUE) update_icon() return TRUE diff --git a/code/modules/overmap/internet/internet_uplink.dm b/code/modules/overmap/internet/internet_uplink.dm index cd38e4509feb..8c32bc016983 100644 --- a/code/modules/overmap/internet/internet_uplink.dm +++ b/code/modules/overmap/internet/internet_uplink.dm @@ -39,10 +39,10 @@ var/global/list/internet_uplinks = list() global.internet_uplinks -= src . = ..() -/obj/machinery/internet_uplink/attackby(var/obj/item/W, var/mob/user) - if(IS_MULTITOOL(W)) - var/datum/extension/local_network_member/uplink = get_extension(src, /datum/extension/local_network_member) - uplink.get_new_tag(user) +/obj/machinery/internet_uplink/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) + var/datum/extension/local_network_member/uplink_comp = get_extension(src, /datum/extension/local_network_member) + uplink_comp.get_new_tag(user) return TRUE return ..() @@ -164,7 +164,6 @@ var/global/list/internet_uplinks = list() idle_power_usage = 250 active_power_usage = 500 var/initial_id_tag = "plexus" - var/current_uplink = 1 /obj/machinery/computer/internet_uplink/Initialize() . = ..() @@ -173,8 +172,8 @@ var/global/list/internet_uplinks = list() var/datum/extension/local_network_member/uplink_comp = get_extension(src, /datum/extension/local_network_member) uplink_comp.set_tag(null, initial_id_tag) -/obj/machinery/computer/internet_uplink/attackby(var/obj/item/W, var/mob/user) - if(IS_MULTITOOL(W)) +/obj/machinery/computer/internet_uplink/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/uplink_comp = get_extension(src, /datum/extension/local_network_member) uplink_comp.get_new_tag(user) return TRUE diff --git a/code/modules/overmap/internet/sector_internet.dm b/code/modules/overmap/internet/sector_internet.dm index ec63ebf3b848..62472321dfe4 100644 --- a/code/modules/overmap/internet/sector_internet.dm +++ b/code/modules/overmap/internet/sector_internet.dm @@ -11,30 +11,30 @@ if(!found_repeater) return - // Must have an operable internet uplink in range on the overmap. - for(var/obj/machinery/internet_uplink/uplink in global.internet_uplinks) - if(uplink.use_power != POWER_USE_ACTIVE || !uplink.operable()) + // Must have an operable internet uplink in range on the overmap. + for(var/obj/machinery/internet_uplink/inet_uplink in global.internet_uplinks) + if(inet_uplink.use_power != POWER_USE_ACTIVE || !inet_uplink.operable()) continue - if(uplink.restrict_networks && !(connecting_network in uplink.permitted_networks)) + if(inet_uplink.restrict_networks && !(connecting_network in inet_uplink.permitted_networks)) continue // Ensure the sectors are within range. - var/obj/effect/overmap/sector = uplink.get_owning_overmap_object() - if(sector == src || (get_dist(get_turf(sector), get_turf(src)) <= uplink.overmap_range)) + var/obj/effect/overmap/sector = inet_uplink.get_owning_overmap_object() + if(sector == src || (get_dist(get_turf(sector), get_turf(src)) <= inet_uplink.overmap_range)) return TRUE // Helper to get nearby connections. Returns list(list(x, y) = allowed networks). /obj/effect/overmap/visitable/proc/get_internet_connections() var/found = list() - for(var/obj/machinery/internet_uplink/uplink in global.internet_uplinks) - if(uplink.use_power != POWER_USE_ACTIVE || !uplink.operable()) + for(var/obj/machinery/internet_uplink/inet_uplink in global.internet_uplinks) + if(inet_uplink.use_power != POWER_USE_ACTIVE || !inet_uplink.operable()) continue // Range check. - var/obj/effect/overmap/sector = uplink.get_owning_overmap_object() - if(sector == src || (get_dist(get_turf(sector), get_turf(src)) <= uplink.overmap_range)) + var/obj/effect/overmap/sector = inet_uplink.get_owning_overmap_object() + if(sector == src || (get_dist(get_turf(sector), get_turf(src)) <= inet_uplink.overmap_range)) var/list/location = list(sector.x, sector.y) - var/allowed = uplink.restrict_networks ? english_list(uplink.permitted_networks, nothing_text = "NO NETWORKS") : "ALL NETWORKS" + var/allowed = inet_uplink.restrict_networks ? english_list(inet_uplink.permitted_networks, nothing_text = "NO NETWORKS") : "ALL NETWORKS" found[location] = allowed - + return found \ No newline at end of file diff --git a/code/modules/overmap/planetoids/_planetoids.dm b/code/modules/overmap/planetoids/_planetoids.dm index 492d842b9953..16ea48dfe92b 100644 --- a/code/modules/overmap/planetoids/_planetoids.dm +++ b/code/modules/overmap/planetoids/_planetoids.dm @@ -64,7 +64,7 @@ var/inaccuracy = rand(8,12)/10 . += "Atmosphere pressure [atmosphere.return_pressure()*inaccuracy] kPa, temperature [atmosphere.temperature*inaccuracy] K
    " else if(user.skill_check(SKILL_SCIENCE, SKILL_BASIC) || user.skill_check(SKILL_ATMOS, SKILL_BASIC)) - . += "Atmosphere present
    " + . += "Atmosphere present. Sensor suite calibration required for detailed scan. Contact a qualified technician for calibration assistance.
    " . += "
    " var/datum/planetoid_data/E = get_planetoid_data() diff --git a/code/modules/overmap/sectors.dm b/code/modules/overmap/sectors.dm index 9ffc9a1bf3c4..891382ad00ac 100644 --- a/code/modules/overmap/sectors.dm +++ b/code/modules/overmap/sectors.dm @@ -244,8 +244,8 @@ var/global/list/known_overmap_sectors for(var/thing in get_linked_machines_of_type(/obj/machinery/computer/ship)) var/obj/machinery/computer/ship/machine = thing if(machine.z in map_z) - for(var/weakref/W in machine.viewers) - var/mob/M = W.resolve() + for(var/weakref/viewer_ref in machine.viewers) + var/mob/M = viewer_ref.resolve() if(istype(M) && M.client) M.client.default_pixel_x = pixel_x M.client.default_pixel_y = pixel_y diff --git a/code/modules/overmap/ships/computers/comms.dm b/code/modules/overmap/ships/computers/comms.dm index 6789f5bc68d0..3978b1a4c58f 100644 --- a/code/modules/overmap/ships/computers/comms.dm +++ b/code/modules/overmap/ships/computers/comms.dm @@ -109,7 +109,6 @@ req_access = list(access_tcomsat) icon = 'icons/obj/machines/tcomms/comms.dmi' var/effective_range = 1 // TODO: upgrade with components. - var/enabled = TRUE /obj/machinery/shipcomms/proc/toggle() if((stat & BROKEN) || use_power != POWER_USE_OFF) diff --git a/code/modules/overmap/ships/computers/engine_control.dm b/code/modules/overmap/ships/computers/engine_control.dm index f7f37fcb3467..c2085997ee93 100644 --- a/code/modules/overmap/ships/computers/engine_control.dm +++ b/code/modules/overmap/ships/computers/engine_control.dm @@ -81,7 +81,8 @@ return TOPIC_REFRESH if(href_list["global_limit"]) - linked.set_thrust_limit(text2num(href_list["global_limit"])) + var/current_thrust_limit = linked.get_thrust_limit() + linked.set_thrust_limit(current_thrust_limit + text2num(href_list["global_limit"])) return TOPIC_REFRESH if(href_list["engine"]) diff --git a/code/modules/overmap/ships/computers/ship.dm b/code/modules/overmap/ships/computers/ship.dm index b5ce7950effc..33aff495d218 100644 --- a/code/modules/overmap/ships/computers/ship.dm +++ b/code/modules/overmap/ships/computers/ship.dm @@ -113,10 +113,10 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov /obj/machinery/computer/ship/sensors/Destroy() sensor_ref = null if(LAZYLEN(viewers)) - for(var/weakref/W in viewers) - var/M = W.resolve() + for(var/weakref/viewer_ref in viewers) + var/M = viewer_ref.resolve() if(M) INVOKE_ASYNC(PROC_REF(unlook), M) if(linked) - LAZYREMOVE(linked.navigation_viewers, W) + LAZYREMOVE(linked.navigation_viewers, viewer_ref) . = ..() diff --git a/code/modules/overmap/ships/computers/shuttle.dm b/code/modules/overmap/ships/computers/shuttle.dm index 6543aebddfc0..4f2e43fbe4cf 100644 --- a/code/modules/overmap/ships/computers/shuttle.dm +++ b/code/modules/overmap/ships/computers/shuttle.dm @@ -130,11 +130,6 @@ qdel(lz) to_chat(user, SPAN_WARNING("Invalid landing zone!")) -/obj/machinery/computer/shuttle_control/proc/end_landing() - var/datum/extension/eye/landing_eye = get_extension(src, /datum/extension/eye/) - if(landing_eye) - landing_eye.unlook() - /obj/machinery/computer/shuttle_control/explore/power_change() . = ..() if(. && (stat & (NOPOWER|BROKEN))) diff --git a/code/modules/overmap/ships/machines/fusion_thruster.dm b/code/modules/overmap/ships/machines/fusion_thruster.dm index 0f4b673554c1..3e4ac6748728 100644 --- a/code/modules/overmap/ships/machines/fusion_thruster.dm +++ b/code/modules/overmap/ships/machines/fusion_thruster.dm @@ -35,8 +35,8 @@ harvest_from = fusion_cores[1] return harvest_from -/obj/machinery/atmospherics/unary/engine/fusion/attackby(var/obj/item/thing, var/mob/user) - if(IS_MULTITOOL(thing)) +/obj/machinery/atmospherics/unary/engine/fusion/attackby(var/obj/item/used_item, var/mob/user) + if(IS_MULTITOOL(used_item)) var/datum/extension/local_network_member/lanm = get_extension(src, /datum/extension/local_network_member) if(lanm.get_new_tag(user)) find_core() diff --git a/code/modules/overmap/ships/machines/gas_thruster.dm b/code/modules/overmap/ships/machines/gas_thruster.dm index 4d744491d3a2..67ea291ac16e 100644 --- a/code/modules/overmap/ships/machines/gas_thruster.dm +++ b/code/modules/overmap/ships/machines/gas_thruster.dm @@ -32,8 +32,8 @@ else z_flags &= ~ZMM_MANGLE_PLANES -/obj/machinery/atmospherics/unary/engine/attackby(obj/item/I, mob/user) - if(IS_MULTITOOL(I) && !panel_open) +/obj/machinery/atmospherics/unary/engine/attackby(obj/item/used_item, mob/user) + if(IS_MULTITOOL(used_item) && !panel_open) var/datum/extension/ship_engine/engine = get_extension(src, /datum/extension/ship_engine) if(engine.sync_to_ship()) to_chat(user, SPAN_NOTICE("\The [src] emits a ping as it syncs its controls to a nearby ship.")) diff --git a/code/modules/overmap/ships/machines/ion_thruster.dm b/code/modules/overmap/ships/machines/ion_thruster.dm index 63d983050364..e06e58e11d72 100644 --- a/code/modules/overmap/ships/machines/ion_thruster.dm +++ b/code/modules/overmap/ships/machines/ion_thruster.dm @@ -46,8 +46,8 @@ var/thrust_cost = 750 var/thrust_effectiveness = 1 -/obj/machinery/ion_thruster/attackby(obj/item/I, mob/user) - if(IS_MULTITOOL(I) && !panel_open) +/obj/machinery/ion_thruster/attackby(obj/item/used_item, mob/user) + if(IS_MULTITOOL(used_item) && !panel_open) var/datum/extension/ship_engine/engine = get_extension(src, /datum/extension/ship_engine) if(engine.sync_to_ship()) to_chat(user, SPAN_NOTICE("\The [src] emits a ping as it syncs its controls to a nearby ship.")) @@ -58,9 +58,10 @@ . = ..() /obj/machinery/ion_thruster/proc/get_thrust() - if(!use_power || (stat & NOPOWER)) - return 0 - return thrust_limit + if(use_power && !(stat & NOPOWER)) + use_power_oneoff(thrust_cost) + return thrust_limit + return 0 /obj/machinery/ion_thruster/on_update_icon() cut_overlays() diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index 4b0f3ee39662..c3f87b29d4d9 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -66,21 +66,21 @@ add_overlay(overlay_image(icon, "clipboard_pen", stored_pen.color, RESET_COLOR)) add_overlay(overlay_image(icon, "clipboard_over", flags=RESET_COLOR)) -/obj/item/clipboard/attackby(obj/item/W, mob/user) +/obj/item/clipboard/attackby(obj/item/used_item, mob/user) var/obj/item/top_paper = top_paper() - if(istype(W, /obj/item/paper) || istype(W, /obj/item/photo)) - if(!user.try_unequip(W, src)) + if(istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/photo)) + if(!user.try_unequip(used_item, src)) return TRUE - push_paper(W) - to_chat(user, SPAN_NOTICE("You clip the [W] onto \the [src].")) + push_paper(used_item) + to_chat(user, SPAN_NOTICE("You clip the [used_item] onto \the [src].")) return TRUE - else if(top_paper?.attackby(W, user)) + else if(top_paper?.attackby(used_item, user)) updateUsrDialog() update_icon() return TRUE - else if(IS_PEN(W) && add_pen(W, user)) //If we don't have any paper, and hit it with a pen, try slotting it in + else if(IS_PEN(used_item) && add_pen(used_item, user)) //If we don't have any paper, and hit it with a pen, try slotting it in return TRUE return ..() diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index 7aad7aace238..fd66d7857a94 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -37,18 +37,6 @@ var/global/list/adminfaxes = list() //cache for faxes that have been sent to has_commands = TRUE long_range = TRUE -//////////////////////////////////////////////////////////////////////////////////////// -// Fax Machine Quick-Dial file -//////////////////////////////////////////////////////////////////////////////////////// -/datum/computer_file/data/fax_quick_dial - filetype = "FQD" - -/datum/computer_file/data/fax_quick_dial/proc/save_quick_dial(var/list/quick_dial_list) - stored_data = json_encode(quick_dial_list) - -/datum/computer_file/data/fax_quick_dial/proc/load_quick_dial() - return json_decode(stored_data) - //////////////////////////////////////////////////////////////////////////////////////// // Fax Machine //////////////////////////////////////////////////////////////////////////////////////// @@ -135,10 +123,10 @@ var/global/list/adminfaxes = list() //cache for faxes that have been sent to ui_interact(user) return TRUE -/obj/machinery/faxmachine/attackby(obj/item/I, mob/user) +/obj/machinery/faxmachine/attackby(obj/item/used_item, mob/user) if(istype(construct_state, /decl/machine_construction/default/panel_closed)) - if(istype(I, /obj/item/paper) || istype(I, /obj/item/photo) || istype(I, /obj/item/paper_bundle)) - insert_scanner_item(I, user) + if(istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/photo) || istype(used_item, /obj/item/paper_bundle)) + insert_scanner_item(used_item, user) return TRUE . = ..() @@ -184,8 +172,6 @@ var/global/list/adminfaxes = list() //cache for faxes that have been sent to LAZYSET(., "has_disk_drive", !isnull(disk_reader)) LAZYSET(., "disk", D) LAZYSET(., "disk_name", D?.name) - LAZYSET(., "disk_has_qd", D?.contains_file_type("FQD")) //If the disk has a quick dial file - LAZYSET(., "disk_has_file", (D?.free_blocks < D?.block_capacity)) /obj/machinery/faxmachine/ui_interact(mob/user, ui_key, datum/nanoui/ui, force_open, datum/nanoui/master_ui, datum/topic_state/state) var/list/data = ui_data(user, ui_key) @@ -263,9 +249,9 @@ var/global/list/adminfaxes = list() //cache for faxes that have been sent to to_chat(user, SPAN_WARNING("There's already a [scanner_item] in \the [src]!")) return TOPIC_NOACTION else - var/obj/item/I = user.get_active_held_item() - if(I) - insert_scanner_item(I, user) + var/obj/item/thing = user.get_active_held_item() + if(thing) + insert_scanner_item(thing, user) else to_chat(user, SPAN_WARNING("You're not holding anything!")) return TOPIC_NOACTION @@ -349,19 +335,19 @@ var/global/list/adminfaxes = list() //cache for faxes that have been sent to return return D -/obj/machinery/faxmachine/proc/insert_scanner_item(var/obj/item/I, var/mob/user) +/obj/machinery/faxmachine/proc/insert_scanner_item(var/obj/item/thing, var/mob/user) if(!QDELETED(scanner_item)) if(user) to_chat(user, SPAN_WARNING("\The [src] already has something being scanned!")) return FALSE if(user) - to_chat(user, SPAN_NOTICE("You place \the [I] into \the [src]'s scanner.")) - if(!user.try_unequip(I, src)) + to_chat(user, SPAN_NOTICE("You place \the [thing] into \the [src]'s scanner.")) + if(!user.try_unequip(thing, src)) return FALSE else - I.dropInto(src) - scanner_item = I + thing.dropInto(src) + scanner_item = thing update_ui() return TRUE @@ -556,30 +542,6 @@ var/global/list/adminfaxes = list() //cache for faxes that have been sent to SSnano.update_uis(src) update_icon() -/**Check if the card we inserted has enough credentials to print on the target fax machine on the network. */ -/obj/machinery/faxmachine/proc/can_send_fax_to(var/network_tag, var/network_id, var/list/provided_access) - var/datum/extension/network_device/fax/sender = get_extension(src, /datum/extension/network_device) - var/datum/computer_network/sender_net = sender?.get_network() - if(!sender_net) - return FALSE - if((network_id != sender_net.network_id) && !sender.has_internet_connection(network_id)) - return FALSE - - //Handle fake admin network addresses - var/target_uri = uppertext("[network_tag].[network_id]") - if(target_uri in global.using_map.map_admin_faxes) - var/list/admin_faxes = LAZYACCESS(global.using_map.map_admin_faxes, target_uri) - var/list/required_access = LAZYACCESS(admin_faxes, "access") - return has_access(required_access, provided_access) //With access we can send faxes to the selected admin address - - var/datum/computer_network/target_net - if(network_id != sender_net.network_id) - target_net = sender_net?.get_internet_connection(network_id) - else - target_net = sender_net - var/datum/extension/network_device/fax/target = target_net?.get_device_by_tag(network_tag) - return istype(target) && target.has_access(provided_access) - /**Plays print animation async. */ /obj/machinery/faxmachine/proc/on_printed_page() flick("faxreceive", src) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 077717829360..185771010d86 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -27,13 +27,13 @@ I.forceMove(src) . = ..() -/obj/structure/filing_cabinet/attackby(obj/item/P, mob/user) - if(!is_type_in_list(P, can_hold)) +/obj/structure/filing_cabinet/attackby(obj/item/used_item, mob/user) + if(!is_type_in_list(used_item, can_hold)) return ..() - if(!user.try_unequip(P, src)) + if(!user.try_unequip(used_item, src)) return TRUE add_fingerprint(user) - to_chat(user, SPAN_NOTICE("You put [P] in [src].")) + to_chat(user, SPAN_NOTICE("You put [used_item] in [src].")) flick("[initial(icon_state)]-open",src) updateUsrDialog() return TRUE @@ -41,8 +41,8 @@ /obj/structure/filing_cabinet/interact(mob/user) user.set_machine(src) var/dat = "
    " - for(var/obj/item/P in src) - dat += "" + for(var/obj/item/paper in src) + dat += "" dat += "
    [P.name]
    [paper.name]
    " show_browser(user, "[name][dat]", "window=filingcabinet;size=350x300") @@ -53,9 +53,9 @@ /obj/structure/filing_cabinet/OnTopic(mob/user, href_list, datum/topic_state/state) if(href_list["retrieve"]) close_browser(user, "window=filingcabinet") - var/obj/item/P = locate(href_list["retrieve"]) - if(istype(P) && CanPhysicallyInteractWith(user, src)) - user.put_in_hands(P) + var/obj/item/paper = locate(href_list["retrieve"]) + if(istype(paper) && CanPhysicallyInteractWith(user, src)) + user.put_in_hands(paper) flick("[initial(icon_state)]-open", src) updateUsrDialog() . = TOPIC_REFRESH diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index ccc5e1d77c8c..f8f0e65df56b 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -35,16 +35,16 @@ if(has_paper_overlay && length(contents)) add_overlay("folder_paper") -/obj/item/folder/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/paper) || istype(W, /obj/item/photo) || istype(W, /obj/item/paper_bundle)) - if(!user.try_unequip(W, src)) +/obj/item/folder/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/photo) || istype(used_item, /obj/item/paper_bundle)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, SPAN_NOTICE("You put the [W] into \the [src].")) + to_chat(user, SPAN_NOTICE("You put the [used_item] into \the [src].")) updateUsrDialog() update_icon() return TRUE - else if(IS_PEN(W)) + else if(IS_PEN(used_item)) updateUsrDialog() var/n_name = sanitize_safe(input(user, "What would you like to label the folder?", "Folder Labelling", null) as text, MAX_NAME_LEN) if(!CanPhysicallyInteractWith(user, src)) @@ -119,7 +119,7 @@ else ..() -/obj/item/folder/envelope/attackby(obj/item/W, mob/user) +/obj/item/folder/envelope/attackby(obj/item/used_item, mob/user) if(sealed) sealcheck(user) return TRUE diff --git a/code/modules/paperwork/handlabeler.dm b/code/modules/paperwork/handlabeler.dm index 225646088bf6..9121d00b60e3 100644 --- a/code/modules/paperwork/handlabeler.dm +++ b/code/modules/paperwork/handlabeler.dm @@ -147,11 +147,11 @@ update_icon() return TRUE -/obj/item/hand_labeler/attackby(obj/item/W, mob/user) +/obj/item/hand_labeler/attackby(obj/item/used_item, mob/user) //Allow refilling with paper sheets too - if(istype(W, /obj/item/paper)) - var/obj/item/paper/P = W + if(istype(used_item, /obj/item/paper)) + var/obj/item/paper/P = used_item if(!P.is_blank()) to_chat(user, SPAN_WARNING("\The [P] is not blank. You can't use that for refilling \the [src].")) return TRUE @@ -166,18 +166,18 @@ if(((incoming_amt + current_amt) / LABEL_MATERIAL_COST) > max_labels) to_chat(user, SPAN_WARNING("There's not enough room in \the [src] for the [label_added] label(s) \the [P] is worth.")) return TRUE - if(!user.do_skilled(2 SECONDS, SKILL_LITERACY, src) || (QDELETED(W) || QDELETED(src))) + if(!user.do_skilled(2 SECONDS, SKILL_LITERACY, src) || (QDELETED(used_item) || QDELETED(src))) return TRUE to_chat(user, SPAN_NOTICE("You slice \the [P] into [label_added] small strips and insert them into \the [src]'s paper feed.")) add_paper_labels(label_added) - qdel(W) + qdel(used_item) update_icon() return TRUE //Allow reloading from stacks much faster - else if(istype(W, /obj/item/stack/material)) - var/obj/item/stack/material/ST = W + else if(istype(used_item, /obj/item/stack/material)) + var/obj/item/stack/material/ST = used_item var/decl/material/M = ST.material var/max_accepted_labels = max_labels - get_labels_left() var/max_accepted_units = max_accepted_labels * LABEL_MATERIAL_COST diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index c0dd0d858629..034c88c3ae93 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -16,7 +16,7 @@ throw_range = 1 throw_speed = 1 w_class = ITEM_SIZE_TINY - attack_verb = list("bapped") + attack_verb = "bapped" material = /decl/material/solid/organic/paper drop_sound = 'sound/foley/paperpickup1.ogg' pickup_sound = 'sound/foley/paperpickup2.ogg' @@ -238,18 +238,18 @@ updateinfolinks() update_icon() -/obj/item/paper/proc/get_signature(var/obj/item/pen/P, mob/user) - if(P && IS_PEN(P)) +/obj/item/paper/proc/get_signature(var/obj/item/pen/pen, mob/user) + if(pen && IS_PEN(pen)) var/decl/tool_archetype/pen/parch = GET_DECL(TOOL_PEN) - return parch.get_signature(user, P) + return parch.get_signature(user, pen) return (user && user.real_name) ? user.real_name : "Anonymous" -/obj/item/paper/proc/parsepencode(t, obj/item/pen/P, mob/user, iscrayon, isfancy) +/obj/item/paper/proc/parsepencode(t, obj/item/pen/pen, mob/user, iscrayon, isfancy) if(length(t) == 0) return "" if(findtext(t, "\[sign\]")) - t = replacetext(t, "\[sign\]", "[get_signature(P, user)]") + t = replacetext(t, "\[sign\]", "[get_signature(pen, user)]") if(iscrayon) // If it is a crayon, and he still tries to use these, make them empty! t = replacetext(t, "\[*\]", "") @@ -264,7 +264,7 @@ t = replacetext(t, "\[cell\]", "") t = replacetext(t, "\[logo\]", "") - var/pen_color = P? P.get_tool_property(TOOL_PEN, TOOL_PROP_COLOR) : "black" + var/pen_color = pen ? pen.get_tool_property(TOOL_PEN, TOOL_PROP_COLOR) : "black" if(iscrayon) t = "[t]" else if(isfancy) @@ -285,19 +285,19 @@ return t -/obj/item/paper/proc/burnpaper(obj/item/P, mob/user) +/obj/item/paper/proc/burnpaper(obj/item/paper, mob/user) var/class = "warning" - if(P.isflamesource() && !user.restrained()) - if(istype(P, /obj/item/flame/fuelled/lighter/zippo)) + if(paper.isflamesource() && !user.restrained()) + if(istype(paper, /obj/item/flame/fuelled/lighter/zippo)) class = "rose" var/decl/pronouns/pronouns = user.get_pronouns() - user.visible_message("[user] holds \the [P] up to \the [src], it looks like [pronouns.he] [pronouns.is] trying to burn it!", \ - "You hold \the [P] up to \the [src], burning it slowly.") + user.visible_message("[user] holds \the [paper] up to \the [src], it looks like [pronouns.he] [pronouns.is] trying to burn it!", \ + "You hold \the [paper] up to \the [src], burning it slowly.") spawn(20) - if(get_dist(src, user) < 2 && user.get_active_held_item() == P && P.isflamesource()) + if(get_dist(src, user) < 2 && user.get_active_held_item() == paper && paper.isflamesource()) user.visible_message("[user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.", \ "You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.") @@ -305,7 +305,7 @@ qdel(src) else - to_chat(user, SPAN_WARNING("You must hold \the [P] steady to burn \the [src].")) + to_chat(user, SPAN_WARNING("You must hold \the [paper] steady to burn \the [src].")) /obj/item/paper/CouldNotUseTopic(mob/user) to_chat(user, SPAN_WARNING("You can't reach!")) @@ -378,43 +378,43 @@ return ..() -/obj/item/paper/attackby(obj/item/P, mob/user) - if(istype(P, /obj/item/stack/tape_roll/duct_tape)) - var/obj/item/stack/tape_roll/duct_tape/tape = P +/obj/item/paper/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/stack/tape_roll/duct_tape)) + var/obj/item/stack/tape_roll/duct_tape/tape = used_item return tape.stick(src, user) - else if(istype(P, /obj/item/paper) || istype(P, /obj/item/photo)) - var/obj/item/paper_bundle/B = try_bundle_with(P, user) + else if(istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/photo)) + var/obj/item/paper_bundle/B = try_bundle_with(used_item, user) if(!B) return TRUE user.put_in_hands(B) - to_chat(user, SPAN_NOTICE("You clip \the [P] and \the [name] together.")) + to_chat(user, SPAN_NOTICE("You clip \the [used_item] and \the [name] together.")) return TRUE - else if(IS_PEN(P)) + else if(IS_PEN(used_item)) if(is_crumpled) to_chat(user, SPAN_WARNING("\The [src] is too crumpled to write on.")) return TRUE - var/obj/item/pen/robopen/RP = P + var/obj/item/pen/robopen/RP = used_item if ( istype(RP) && RP.mode == 2 ) RP.RenamePaper(user,src) else interact(user, readonly = FALSE) return TRUE - else if(P.get_tool_quality(TOOL_STAMP)) - apply_custom_stamp(P.icon, "with \the [P]") + else if(used_item.get_tool_quality(TOOL_STAMP)) + apply_custom_stamp(used_item.icon, "with \the [used_item]") playsound(src, 'sound/effects/stamp.ogg', 50, TRUE) - to_chat(user, SPAN_NOTICE("You stamp the paper with your [P.name].")) + to_chat(user, SPAN_NOTICE("You stamp the paper with your [used_item.name].")) return TRUE - else if(P.isflamesource()) - burnpaper(P, user) + else if(used_item.isflamesource()) + burnpaper(used_item, user) return TRUE - else if(istype(P, /obj/item/paper_bundle)) - var/obj/item/paper_bundle/B = P + else if(istype(used_item, /obj/item/paper_bundle)) + var/obj/item/paper_bundle/B = used_item B.merge(src, user) return TRUE return ..() @@ -427,10 +427,10 @@ var/obj/item/paper_bundle/B = new(loc) if(user) - if(!user.canUnEquip(src)) + if(!user.can_unequip_item(src)) to_chat(user, SPAN_WARNING("You can't unequip \the [src]!")) return - if(!user.canUnEquip(other)) + if(!user.can_unequip_item(other)) to_chat(user, SPAN_WARNING("You can't unequip \the [other]!")) return user.try_unequip(src, B) @@ -450,8 +450,8 @@ /obj/item/paper/proc/can_bundle_with(var/obj/item/other) if(istype(other, /obj/item/paper)) - var/obj/item/paper/P = other - return can_bundle() && P.can_bundle() + var/obj/item/paper/paper = other + return can_bundle() && paper.can_bundle() else if(istype(other, /obj/item/photo)) return can_bundle() else if(istype(other, /obj/item/paper_bundle)) diff --git a/code/modules/paperwork/paper_bundle.dm b/code/modules/paperwork/paper_bundle.dm index 27d047e94b87..ccb16e145bcf 100644 --- a/code/modules/paperwork/paper_bundle.dm +++ b/code/modules/paperwork/paper_bundle.dm @@ -14,7 +14,7 @@ throw_range = 2 throw_speed = 1 w_class = ITEM_SIZE_SMALL - attack_verb = list("bapped") + attack_verb = "bapped" drop_sound = 'sound/foley/paperpickup1.ogg' pickup_sound = 'sound/foley/paperpickup2.ogg' item_flags = ITEM_FLAG_CAN_TAPE @@ -28,40 +28,40 @@ LAZYCLEARLIST(pages) //Get rid of refs return ..() -/obj/item/paper_bundle/attackby(obj/item/W, mob/user) +/obj/item/paper_bundle/attackby(obj/item/used_item, mob/user) // adding sheets - if(istype(W, /obj/item/paper) || istype(W, /obj/item/photo)) - var/obj/item/paper/paper = W + if(istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/photo)) + var/obj/item/paper/paper = used_item if(istype(paper) && !paper.can_bundle()) return TRUE //non-paper or bundlable paper only - merge(W, user, cur_page) + merge(used_item, user, cur_page) return TRUE // merging bundles - else if(istype(W, /obj/item/paper_bundle) && merge(W, user, cur_page)) - to_chat(user, SPAN_NOTICE("You add \the [W] to \the [name].")) + else if(istype(used_item, /obj/item/paper_bundle) && merge(used_item, user, cur_page)) + to_chat(user, SPAN_NOTICE("You add \the [used_item] to \the [name].")) return TRUE // burning - else if(W.isflamesource()) - burnpaper(W, user) + else if(used_item.isflamesource()) + burnpaper(used_item, user) return TRUE - else if(istype(W, /obj/item/stack/tape_roll/duct_tape)) + else if(istype(used_item, /obj/item/stack/tape_roll/duct_tape)) var/obj/P = LAZYACCESS(pages, cur_page) if(P) - . = P.attackby(W, user) + . = P.attackby(used_item, user) update_icon() updateUsrDialog() return // How did we not have a page? Dunno, fall through to parent call anyway, I guess - else if(IS_PEN(W) || istype(W, /obj/item/stamp)) + else if(IS_PEN(used_item) || istype(used_item, /obj/item/stamp)) close_browser(user, "window=[name]") var/obj/P = LAZYACCESS(pages, cur_page) if(P) - . = P.attackby(W, user) + . = P.attackby(used_item, user) update_icon() updateUsrDialog() return diff --git a/code/modules/paperwork/paper_sticky.dm b/code/modules/paperwork/paper_sticky.dm index aaa0ad746036..d8acfabf7598 100644 --- a/code/modules/paperwork/paper_sticky.dm +++ b/code/modules/paperwork/paper_sticky.dm @@ -2,18 +2,18 @@ // Sticky Note Pad //////////////////////////////////////////////// /obj/item/sticky_pad - name = "sticky note pad" - desc = "A pad of densely packed sticky notes." - color = COLOR_YELLOW - icon = 'icons/obj/stickynotes.dmi' - icon_state = "pad_full" - item_state = "paper" - w_class = ITEM_SIZE_SMALL - material = /decl/material/solid/organic/paper - var/papers = 50 - var/tmp/max_papers = 50 - var/paper_type = /obj/item/paper/sticky - var/obj/item/paper/top //The instantiated paper on the top of the pad, if there's one + name = "sticky note pad" + desc = "A pad of densely packed sticky notes." + color = COLOR_YELLOW + icon = 'icons/obj/stickynotes.dmi' + icon_state = "pad_full" + item_state = "paper" + w_class = ITEM_SIZE_SMALL + material = /decl/material/solid/organic/paper + var/const/max_papers = 50 + var/papers = max_papers + var/paper_type = /obj/item/paper/sticky + var/obj/item/paper/top //The instantiated paper on the top of the pad, if there's one /obj/item/sticky_pad/Initialize(ml, material_key) . = ..() @@ -35,7 +35,7 @@ . = ..() if(papers <= 15) icon_state = "pad_empty" - else if(papers <= 50) + else if(papers <= max_papers) icon_state = "pad_used" else icon_state = "pad_full" @@ -43,9 +43,9 @@ if(top?.info) icon_state = "[icon_state]_writing" -/obj/item/sticky_pad/attackby(var/obj/item/thing, var/mob/user) - if(IS_PEN(thing) || istype(thing, /obj/item/stamp)) - . = top?.attackby(thing, user) +/obj/item/sticky_pad/attackby(var/obj/item/used_item, var/mob/user) + if(IS_PEN(used_item) || istype(used_item, /obj/item/stamp)) + . = top?.attackby(used_item, user) update_icon() return . return ..() diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index 0dfa1d4f831b..4bc17502521d 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -72,23 +72,23 @@ add_fingerprint(user) return TRUE -/obj/item/paper_bin/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/paper)) +/obj/item/paper_bin/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/paper)) if(amount >= max_amount) to_chat(user, SPAN_WARNING("\The [src] is full!")) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - add_paper(I) - to_chat(user, SPAN_NOTICE("You put [I] in [src].")) + add_paper(used_item) + to_chat(user, SPAN_NOTICE("You put [used_item] in [src].")) return TRUE - else if(istype(I, /obj/item/paper_bundle)) + else if(istype(used_item, /obj/item/paper_bundle)) if(amount >= max_amount) to_chat(user, SPAN_WARNING("\The [src] is full!")) return TRUE - var/obj/item/paper_bundle/B = I + var/obj/item/paper_bundle/B = used_item var/was_there_a_photo = FALSE - for(var/obj/item/bundleitem in I) //loop through items in bundle + for(var/obj/item/bundleitem in used_item) //loop through items in bundle if(istype(bundleitem, /obj/item/paper)) //if item is paper, add into the bin LAZYREMOVE(B.pages, bundleitem) add_paper(bundleitem) @@ -96,7 +96,7 @@ was_there_a_photo = TRUE bundleitem.dropInto(user.loc) bundleitem.reset_plane_and_layer() - to_chat(user, SPAN_NOTICE("You loosen \the [I] and add its papers into \the [src].")) + to_chat(user, SPAN_NOTICE("You loosen \the [used_item] and add its papers into \the [src].")) B.reevaluate_existence() if(was_there_a_photo) to_chat(user, SPAN_NOTICE("The photo cannot go into \the [src].")) diff --git a/code/modules/paperwork/papershredder.dm b/code/modules/paperwork/papershredder.dm index 7f79ad78b273..6a48a772660d 100644 --- a/code/modules/paperwork/papershredder.dm +++ b/code/modules/paperwork/papershredder.dm @@ -227,9 +227,9 @@ if(material) SetName("[initial(name)] [material.solid_name]") -/obj/item/shreddedp/attackby(var/obj/item/W, var/mob/user) - if(W.isflamesource()) - burnpaper(W, user) +/obj/item/shreddedp/attackby(var/obj/item/used_item, var/mob/user) + if(used_item.isflamesource()) + burnpaper(used_item, user) return TRUE return ..() diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index 5d816b92448e..369418bb480e 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -40,8 +40,6 @@ var/obj/item/scanner_item //what's in the scanner var/obj/item/stock_parts/printer/printer //What handles the printing queue var/tmp/max_copies = 10 //how many copies can be copied at once- idea shamelessly stolen from bs12's copier! - var/tmp/busy = FALSE //Whether we should allow people to mess with the settings and contents - var/accept_refill = FALSE //Whether we should handle attackby paper to be sent to the paper bin, or to the scanner slot var/total_printing = 0 //The total number of pages we are printing in the current run /obj/machinery/photocopier/Initialize(mapload, d=0, populate_parts = TRUE) @@ -79,7 +77,7 @@ //Warning lights if(scanner_item) add_overlay("photocopier_ready") - if(!printer?.has_enough_to_print()) + if(!has_enough_to_print()) add_overlay("photocopier_bad") /obj/machinery/photocopier/proc/update_ui() @@ -107,7 +105,7 @@ else required_toner = TONER_USAGE_PAPER - if(!printer?.has_enough_to_print(required_toner, required_paper * copy_amount)) + if(!has_enough_to_print(required_toner, required_paper * copy_amount)) buzz("Warning: Not enough paper or toner!") return FALSE @@ -197,10 +195,14 @@ queue_copies(sanitize_integer(text2num(href_list["copy_amount"]), 1, max_copies, 1)) return TOPIC_REFRESH + if(href_list["cancel_queue"]) + stop_processing_queue() + return TOPIC_REFRESH + if(href_list["aipic"]) if(!issilicon(user)) return TOPIC_NOACTION - if(printer?.has_enough_to_print(TONER_USAGE_PHOTO)) + if(has_enough_to_print(TONER_USAGE_PHOTO)) var/mob/living/silicon/tempAI = user var/obj/item/camera/siliconcam/camera = tempAI.silicon_camera if(!camera) @@ -243,11 +245,14 @@ update_icon() return TRUE -/obj/machinery/photocopier/attackby(obj/item/O, mob/user) - if(istype(construct_state, /decl/machine_construction/default/panel_closed) && (istype(O, /obj/item/paper) || istype(O, /obj/item/photo) || istype(O, /obj/item/paper_bundle))) - insert_item(O, user) +/obj/machinery/photocopier/attackby(obj/item/used_item, mob/user) + if(printer.is_printing()) + to_chat(user, SPAN_WARNING("\The [src] is busy!")) + return TRUE + if(istype(construct_state, /decl/machine_construction/default/panel_closed) && (istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/photo) || istype(used_item, /obj/item/paper_bundle))) + insert_item(used_item, user) return TRUE - return..() //Components attackby will handle refilling with paper and toner + return ..() //Components attackby will handle refilling with paper and toner /**Creates a clone of the specified item. Returns a list of cloned items. */ /obj/machinery/photocopier/proc/scan_item(var/obj/item/I) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index b6b39467524d..db79cb62b396 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -10,16 +10,16 @@ * film * *******/ /obj/item/camera_film - name = "film cartridge" - icon = 'icons/obj/photography.dmi' - desc = "A camera film cartridge. Insert it into a camera to reload it." - icon_state = "film" - item_state = "electropack" - w_class = ITEM_SIZE_SMALL - throw_range = 10 - material = /decl/material/solid/organic/plastic - var/tmp/max_uses = 10 - var/uses_left = 10 + name = "film cartridge" + icon = 'icons/obj/photography.dmi' + desc = "A camera film cartridge. Insert it into a camera to reload it." + icon_state = "film" + item_state = "electropack" + w_class = ITEM_SIZE_SMALL + throw_range = 10 + material = /decl/material/solid/organic/plastic + var/const/max_uses = 10 + var/uses_left = max_uses /obj/item/camera_film/Initialize(ml, material_key) set_extension(src, /datum/extension/base_icon_state, icon_state) @@ -27,6 +27,7 @@ update_icon() /obj/item/camera_film/on_update_icon() + . = ..() var/datum/extension/base_icon_state/bis = get_extension(src, /datum/extension/base_icon_state) if(uses_left > 1) icon_state = "[bis.base_icon_state]" @@ -108,8 +109,8 @@ tiny.pixel_x = -WORLD_ICON_SIZE * (photo_size-1)/2 - 3 tiny.pixel_y = -WORLD_ICON_SIZE * (photo_size-1)/2 + 3 -/obj/item/photo/attackby(obj/item/P, mob/user) - if(IS_PEN(P)) +/obj/item/photo/attackby(obj/item/used_item, mob/user) + if(IS_PEN(used_item)) if(!CanPhysicallyInteractWith(user, src)) to_chat(user, SPAN_WARNING("You can't interact with this!")) return TRUE @@ -260,18 +261,18 @@ to_chat(user, SPAN_WARNING("There is no cartridge in \the [src] to eject!")) -/obj/item/camera/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/camera_film)) +/obj/item/camera/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/camera_film)) if(film) //Skilled people don't have to remove the film first! if(user.get_skill_value(SKILL_DEVICES) >= SKILL_EXPERT) if(user.do_skilled(1 SECONDS, SKILL_DEVICES, src)) user.visible_message( - SPAN_NOTICE("In a swift flick of the finger, [user] ejects \the [film], and slides in \the [I]!"), - SPAN_NOTICE("From habit you instinctively pop the old [film] from \the [src] and insert a new [I] deftly!")) - user.try_unequip(I, src) + SPAN_NOTICE("In a swift flick of the finger, [user] ejects \the [film], and slides in \the [used_item]!"), + SPAN_NOTICE("From habit you instinctively pop the old [film] from \the [src] and insert a new [used_item] deftly!")) + user.try_unequip(used_item, src) user.put_in_active_hand(film) - film = I + film = used_item return TRUE return TRUE //Unskilled losers have to remove it first @@ -281,14 +282,14 @@ if(user.do_skilled(1 SECONDS, SKILL_DEVICES, src)) if(user.get_skill_value(SKILL_DEVICES) >= SKILL_EXPERT) user.visible_message( - SPAN_NOTICE("[user] swiftly slides \the [I] into \the [src]!"), - SPAN_NOTICE("You insert \a [I] swiftly into \the [src]!")) + SPAN_NOTICE("[user] swiftly slides \the [used_item] into \the [src]!"), + SPAN_NOTICE("You insert \a [used_item] swiftly into \the [src]!")) else user.visible_message( - SPAN_NOTICE("[user] inserts \a [I] into his [src]."), - SPAN_NOTICE("You insert \the [I] into \the [src].")) - user.try_unequip(I, src) - film = I + SPAN_NOTICE("[user] inserts \a [used_item] into his [src]."), + SPAN_NOTICE("You insert \the [used_item] into \the [src].")) + user.try_unequip(used_item, src) + film = used_item return TRUE return TRUE return ..() diff --git a/code/modules/paperwork/printer.dm b/code/modules/paperwork/printer.dm index cfb02e78a147..802624d7d04b 100644 --- a/code/modules/paperwork/printer.dm +++ b/code/modules/paperwork/printer.dm @@ -58,18 +58,18 @@ unregister_on_status_changed() return ..() -/obj/item/stock_parts/printer/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/chems/toner_cartridge)) +/obj/item/stock_parts/printer/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/chems/toner_cartridge)) if(toner) - to_chat(user, SPAN_WARNING("There is already \a [W] in \the [src]!")) + to_chat(user, SPAN_WARNING("There is already \a [used_item] in \the [src]!")) return TRUE - return insert_toner(W, user) + return insert_toner(used_item, user) - else if(istype(W, /obj/item/paper) || istype(W, /obj/item/paper_bundle)) + else if(istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/paper_bundle)) if(paper_left >= paper_max) to_chat(user, SPAN_WARNING("There is no more room for paper in \the [src]!")) return TRUE - return insert_paper(W, user) + return insert_paper(used_item, user) . = ..() /obj/item/stock_parts/printer/attack_hand(mob/user) diff --git a/code/modules/paperwork/stamps.dm b/code/modules/paperwork/stamps.dm index 8562c81d3072..9e5dbd514a42 100644 --- a/code/modules/paperwork/stamps.dm +++ b/code/modules/paperwork/stamps.dm @@ -10,7 +10,7 @@ matter = list( /decl/material/solid/organic/plastic = MATTER_AMOUNT_REINFORCEMENT, ) - attack_verb = list("stamped") + attack_verb = "stamped" /obj/item/stamp/Initialize() . = ..() diff --git a/code/modules/persistence/graffiti.dm b/code/modules/persistence/graffiti.dm index ea6e391a7909..cb65ce6ca0c3 100644 --- a/code/modules/persistence/graffiti.dm +++ b/code/modules/persistence/graffiti.dm @@ -15,8 +15,8 @@ /obj/effect/decal/writing/Initialize(mapload, var/_age, var/_message, var/_author) var/list/random_icon_states = get_states_in_icon(icon) - for(var/obj/effect/decal/writing/W in loc) - random_icon_states -= W.icon_state + for(var/obj/effect/decal/writing/writing in loc) + random_icon_states -= writing.icon_state if(length(random_icon_states)) icon_state = pick(random_icon_states) SSpersistence.track_value(src, /decl/persistence_handler/graffiti) @@ -37,18 +37,18 @@ if(processed_message) . += "It reads \"[processed_message]\"." -/obj/effect/decal/writing/attackby(var/obj/item/thing, var/mob/user) - if(IS_WELDER(thing) && thing.do_tool_interaction(TOOL_WELDER, user, src, 3 SECONDS)) +/obj/effect/decal/writing/attackby(var/obj/item/used_item, var/mob/user) + if(IS_WELDER(used_item) && used_item.do_tool_interaction(TOOL_WELDER, user, src, 3 SECONDS)) playsound(src, 'sound/items/Welder2.ogg', 50, TRUE) user.visible_message(SPAN_NOTICE("\The [user] clears away some graffiti.")) qdel(src) return TRUE - else if(thing.is_sharp() && !user.check_intent(I_FLAG_HELP)) //Check intent so you don't go insane trying to unscrew a light fixture over a graffiti + else if(used_item.is_sharp() && !user.check_intent(I_FLAG_HELP)) //Check intent so you don't go insane trying to unscrew a light fixture over a graffiti if(jobban_isbanned(user, "Graffiti")) to_chat(user, SPAN_WARNING("You are banned from leaving persistent information across rounds.")) return TRUE var/turf/T = get_turf(src) if(T) - T.try_graffiti(user, thing) + T.try_graffiti(user, used_item) return TRUE return ..() diff --git a/code/modules/persistence/noticeboards.dm b/code/modules/persistence/noticeboards.dm index 28a2f6479136..9ec2db2954f9 100644 --- a/code/modules/persistence/noticeboards.dm +++ b/code/modules/persistence/noticeboards.dm @@ -64,16 +64,16 @@ var/nb_notices = LAZYLEN(notices) icon_state = "[bis.base_icon_state][nb_notices > 0? "0[nb_notices]" : ""]" -/obj/structure/noticeboard/attackby(var/obj/item/thing, var/mob/user) - if(!istype(thing, /obj/item/paper/sticky) && (istype(thing, /obj/item/paper) || istype(thing, /obj/item/photo))) +/obj/structure/noticeboard/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/paper/sticky) && (istype(used_item, /obj/item/paper) || istype(used_item, /obj/item/photo))) if(jobban_isbanned(user, "Graffiti")) to_chat(user, SPAN_WARNING("You are banned from leaving persistent information across rounds.")) - else if(LAZYLEN(notices) < max_notices && user.try_unequip(thing, src)) + else if(LAZYLEN(notices) < max_notices && user.try_unequip(used_item, src)) add_fingerprint(user) - add_paper(thing) - to_chat(user, SPAN_NOTICE("You pin \the [thing] to \the [src].")) + add_paper(used_item) + to_chat(user, SPAN_NOTICE("You pin \the [used_item] to \the [src].")) else - to_chat(user, SPAN_WARNING("You hesitate, certain \the [thing] will not be seen among the many others already attached to \the [src].")) + to_chat(user, SPAN_WARNING("You hesitate, certain \the [used_item] will not be seen among the many others already attached to \the [src].")) return TRUE return ..() diff --git a/code/modules/persistence/persistence_datum.dm b/code/modules/persistence/persistence_datum.dm index 027081f79492..08acd039c57a 100644 --- a/code/modules/persistence/persistence_datum.dm +++ b/code/modules/persistence/persistence_datum.dm @@ -144,7 +144,7 @@ /decl/persistence_handler/proc/GetAdminDataStringFor(var/thing, var/can_modify, var/mob/user) if(can_modify) - . = "
    [thing]Destroy[thing]Destroy[thing][book.dat][book.title][book.last_modified_ckey]Destroy[book.dat][book.title][book.last_modified_ckey]Destroy[book.dat][book.title][book.last_modified_ckey][save_graffiti.message][save_graffiti.author]Destroy[save_graffiti.message][save_graffiti.author]Destroy[save_graffiti.message][save_graffiti.author][paper.info][paper.name][paper.last_modified_ckey]Destroy[paper.info][paper.name][paper.last_modified_ckey]Destroy[paper.info][paper.name][paper.last_modified_ckey]
    NameEQUIPLIGHTENVIRONCELLLOAD" - - // These lists are used as replacement for number based APC settings - var/list/S = list("M-OFF","A-OFF","M-ON", "A-ON") - var/list/chg = list("N","C","F") - - // Split to multiple lines to make it more readable - for(var/obj/machinery/power/apc/A in L) - out += "
    \The [A.area]" // Add area name - out += "[S[A.equipment+1]][S[A.lighting+1]][S[A.environ+1]]" // Show status of channels - var/obj/item/cell/cell = A.get_cell() - if(cell) - out += "[round(cell.percent())]% - [chg[A.charging+1]]" - else - out += "NO CELL" - var/load = A.lastused_total // Load. - total_apc_load += load - load = reading_to_text(load) - out += "[load]" - - out += "
    TOTAL AVAILABLE: [reading_to_text(powernet.avail)]" - out += "
    APC LOAD: [reading_to_text(total_apc_load)]" - out += "
    OTHER LOAD: [reading_to_text(max(powernet.load - total_apc_load, 0))]" - out += "
    TOTAL GRID LOAD: [reading_to_text(powernet.viewload)] ([round((powernet.load / powernet.avail) * 100)]%)" - - if(powernet.problem) - out += "
    WARNING: Abnormal grid activity detected!" - return out - // Proc: return_reading_data() // Parameters: None // Description: Generates list containing all powernet data. Optimised for usage with NanoUI diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index d915bac98433..f85c32b16eb0 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -89,24 +89,24 @@ var/global/list/rad_collectors = list() else to_chat(user, "The controls are locked!") -/obj/machinery/rad_collector/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/tank/hydrogen)) +/obj/machinery/rad_collector/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/tank/hydrogen)) if(!src.anchored) to_chat(user, "\The [src] needs to be secured to the floor first.") return TRUE if(src.loaded_tank) to_chat(user, "There's already a tank loaded.") return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - src.loaded_tank = W + src.loaded_tank = used_item update_icon() return TRUE - else if(IS_CROWBAR(W)) + else if(IS_CROWBAR(used_item)) if(loaded_tank && !src.locked) eject() return TRUE - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) if(loaded_tank) to_chat(user, "Remove the tank first.") return TRUE @@ -120,7 +120,7 @@ var/global/list/rad_collectors = list() "You [anchored? "secure":"undo"] the external bolts.", \ "You hear a ratchet.") return TRUE - else if(istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer)) + else if(istype(used_item, /obj/item/card/id)||istype(used_item, /obj/item/modular_computer)) if (src.allowed(user)) if(active) src.locked = !src.locked diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index c2b62b6059ff..192376cc994f 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -133,9 +133,9 @@ powered = TRUE update_icon() -/obj/machinery/emitter/attackby(obj/item/W, mob/user) +/obj/machinery/emitter/attackby(obj/item/used_item, mob/user) - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) if(active) to_chat(user, "Turn off [src] first.") return TRUE @@ -158,8 +158,8 @@ to_chat(user, "\The [src] needs to be unwelded from the floor.") return TRUE - if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item if(active) to_chat(user, "Turn off [src] first.") return TRUE @@ -167,7 +167,7 @@ if(0) to_chat(user, "\The [src] needs to be wrenched to the floor.") if(1) - if (!WT.weld(0,user)) + if (!welder.weld(0,user)) to_chat(user, "You need more welding fuel to complete this task.") return TRUE playsound(loc, 'sound/items/Welder2.ogg', 50, 1) @@ -176,25 +176,25 @@ "You hear welding.") if (!do_after(user, 2 SECONDS, src)) return TRUE - if(!src || !WT.isOn()) return TRUE + if(!src || !welder.isOn()) return TRUE state = 2 to_chat(user, "You weld [src] to the floor.") if(2) - if (WT.weld(0,user)) + if (welder.weld(0,user)) playsound(loc, 'sound/items/Welder2.ogg', 50, 1) user.visible_message("[user.name] starts to cut [src] free from the floor.", \ "You start to cut [src] free from the floor.", \ "You hear welding.") if (!do_after(user, 2 SECONDS, src)) return TRUE - if(!src || !WT.isOn()) return TRUE + if(!src || !welder.isOn()) return TRUE state = 1 to_chat(user, "You cut [src] free from the floor.") else to_chat(user, "You need more welding fuel to complete this task.") return TRUE - if(istype(W, /obj/item/card/id) || istype(W, /obj/item/modular_computer)) + if(istype(used_item, /obj/item/card/id) || istype(used_item, /obj/item/modular_computer)) if(emagged) to_chat(user, "The lock seems to be broken.") return TRUE diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index bf7de4d3974f..ae6c9ec7eda3 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -97,11 +97,11 @@ field_generator power level display to_chat(user, "\The [src] needs to be firmly secured to the floor first.") return TRUE -/obj/machinery/field_generator/attackby(obj/item/W, mob/user) +/obj/machinery/field_generator/attackby(obj/item/used_item, mob/user) if(active) to_chat(user, "\The [src] needs to be off.") return TRUE - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) switch(state) if(0) state = 1 @@ -122,14 +122,14 @@ field_generator power level display if(2) to_chat(user, " \The [src] needs to be unwelded from the floor.") return TRUE - else if(IS_WELDER(W)) - var/obj/item/weldingtool/WT = W + else if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item switch(state) if(0) to_chat(user, "\The [src] needs to be wrenched to the floor.") return TRUE if(1) - if (!WT.weld(0,user)) + if (!welder.weld(0,user)) return TRUE playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) user.visible_message("[user.name] starts to weld \the [src] to the floor.", \ @@ -137,12 +137,12 @@ field_generator power level display "You hear welding.") if (!do_after(user, 2 SECONDS, src)) return TRUE - if(!src || !WT.isOn()) return TRUE + if(!src || !welder.isOn()) return TRUE state = 2 to_chat(user, "You weld the field generator to the floor.") return TRUE if(2) - if (!WT.weld(0,user)) + if (!welder.weld(0,user)) return TRUE playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) user.visible_message("[user.name] starts to cut \the [src] free from the floor.", \ @@ -150,7 +150,7 @@ field_generator power level display "You hear welding.") if (!do_after(user, 2 SECONDS, src)) return TRUE - if(!src || !WT.isOn()) return TRUE + if(!src || !welder.isOn()) return TRUE state = 1 to_chat(user, "You cut \the [src] free from the floor.") return TRUE diff --git a/code/modules/power/singularity/generator.dm b/code/modules/power/singularity/generator.dm index 00976a216f0c..82a33b48a77e 100644 --- a/code/modules/power/singularity/generator.dm +++ b/code/modules/power/singularity/generator.dm @@ -39,8 +39,8 @@ if(!QDELETED(src)) qdel(src) -/obj/machinery/singularity_generator/attackby(obj/item/W, mob/user) - if(!IS_WRENCH(W)) +/obj/machinery/singularity_generator/attackby(obj/item/used_item, mob/user) + if(!IS_WRENCH(used_item)) return ..() anchored = !anchored playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 7e5c523ea0f5..aab6c0dc67a3 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -101,9 +101,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin else . += "\The [src] is assembled." -/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user) - if(has_extension(W, /datum/extension/tool)) - if(process_tool_hit(W,user)) +/obj/structure/particle_accelerator/attackby(obj/item/used_item, mob/user) + if(has_extension(used_item, /datum/extension/tool)) + if(process_tool_hit(used_item,user)) return TRUE return ..() @@ -241,9 +241,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin else . += "\The [src] is assembled." -/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user) - if(has_extension(W, /datum/extension/tool)) - if(process_tool_hit(W,user)) +/obj/machinery/particle_accelerator/attackby(obj/item/used_item, mob/user) + if(has_extension(used_item, /datum/extension/tool)) + if(process_tool_hit(used_item,user)) return TRUE return ..() diff --git a/code/modules/power/singularity/particle_accelerator/particle_emitter.dm b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm index eba322bb19fb..7cfffcf5a8f1 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_emitter.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm @@ -20,13 +20,6 @@ icon_state = "emitter_right" reference = "emitter_right" -/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay) - if(delay && delay >= 0) - src.fire_delay = delay - return 1 - return 0 - - /obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0) if((src.last_shot + src.fire_delay) <= world.time) src.last_shot = world.time diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 99f418ed6272..f075340d7aa0 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -220,10 +220,10 @@ ui_interact(user) return TRUE -/obj/machinery/power/smes/attackby(var/obj/item/W, var/mob/user) - if((. = component_attackby(W, user))) +/obj/machinery/power/smes/attackby(var/obj/item/used_item, var/mob/user) + if((. = component_attackby(used_item, user))) return - return bash(W, user) + return bash(used_item, user) /obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) // this is the data which will be sent to the ui diff --git a/code/modules/power/smes_construction.dm b/code/modules/power/smes_construction.dm index cccc10631e3f..4d8d462e7a95 100644 --- a/code/modules/power/smes_construction.dm +++ b/code/modules/power/smes_construction.dm @@ -328,9 +328,9 @@ ..() // Proc: attackby() -// Parameters: 2 (W - object that was used on this machine, user - person which used the object) +// Parameters: 2 (used_item - object that was used on this machine, user - person which used the object) // Description: Handles tool interaction. Allows deconstruction/upgrading/fixing. -/obj/machinery/power/smes/buildable/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/power/smes/buildable/attackby(var/obj/item/used_item, var/mob/user) // No more disassembling of overloaded SMESs. You broke it, now enjoy the consequences. if (failing) to_chat(user, "\The [src]'s screen is flashing with alerts. It seems to be overloaded! Touching it now is probably not a good idea.") @@ -339,7 +339,7 @@ if(.) return // Multitool - change RCON tag - if(IS_MULTITOOL(W)) + if(IS_MULTITOOL(used_item)) var/newtag = input(user, "Enter new RCON tag. Use \"NO_TAG\" to disable RCON or leave empty to cancel.", "SMES RCON system") as text if(newtag) RCon_tag = newtag diff --git a/code/modules/power/smes_presets.dm b/code/modules/power/smes_presets.dm index 0775d5ca164c..39d638616c0c 100644 --- a/code/modules/power/smes_presets.dm +++ b/code/modules/power/smes_presets.dm @@ -14,4 +14,12 @@ input_attempt = _input_on output_attempt = _output_on if(_fully_charged) - charge = capacity \ No newline at end of file + charge = capacity + +// Pre-installed and pre-charged SMES hidden from the station, for use in submaps. +/obj/machinery/power/smes/buildable/preset/hidden + _fully_charged = TRUE + _input_on = TRUE + _input_maxed = TRUE + _output_maxed = TRUE + RCon = FALSE \ No newline at end of file diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 23e5f846473c..e76803494d6a 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -73,8 +73,8 @@ var/global/list/solars_list = list() -/obj/machinery/power/solar/attackby(obj/item/W, mob/user) - if(IS_CROWBAR(W)) +/obj/machinery/power/solar/attackby(obj/item/used_item, mob/user) + if(IS_CROWBAR(used_item)) playsound(loc, 'sound/machines/click.ogg', 50, 1) user.visible_message("[user] begins to take the glass off the solar panel.") if(do_after(user, 50,src)) @@ -86,9 +86,9 @@ var/global/list/solars_list = list() user.visible_message("[user] takes the glass off the solar panel.") qdel(src) return TRUE - else if (W) + else if (used_item) add_fingerprint(user) - current_health -= W.expend_attack_force(user) + current_health -= used_item.expend_attack_force(user) healthcheck() return ..() @@ -240,8 +240,8 @@ var/global/list/solars_list = list() glass_type = null glass_reinforced = null -/obj/item/solar_assembly/attackby(var/obj/item/W, var/mob/user) - if(IS_WRENCH(W)) +/obj/item/solar_assembly/attackby(var/obj/item/used_item, var/mob/user) + if(IS_WRENCH(used_item)) if(!anchored && isturf(loc)) anchored = TRUE default_pixel_x = 0 @@ -256,8 +256,8 @@ var/global/list/solars_list = list() user.visible_message("[user] unwrenches the solar assembly from its place.") playsound(loc, 'sound/items/Ratchet.ogg', 75, 1) return TRUE - else if(istype(W, /obj/item/stack/material) && W.get_material_type() == /decl/material/solid/glass) - var/obj/item/stack/material/S = W + else if(istype(used_item, /obj/item/stack/material) && used_item.get_material_type() == /decl/material/solid/glass) + var/obj/item/stack/material/S = used_item if(!S.use(2)) to_chat(user, "You need two sheets of glass to put them into a solar panel.") return TRUE @@ -270,12 +270,12 @@ var/global/list/solars_list = list() else new /obj/machinery/power/solar(get_turf(src), src) return TRUE - if(!tracker && istype(W, /obj/item/tracker_electronics)) + if(!tracker && istype(used_item, /obj/item/tracker_electronics)) tracker = TRUE - qdel(W) + qdel(used_item) user.visible_message("[user] inserts the electronics into the solar assembly.") return TRUE - else if(IS_CROWBAR(W)) + else if(IS_CROWBAR(used_item)) new /obj/item/tracker_electronics(loc) tracker = 0 user.visible_message("[user] takes out the electronics from the solar assembly.") diff --git a/code/modules/power/stirling.dm b/code/modules/power/stirling.dm index fb1adc9ef8c7..ea7b725c4cb1 100644 --- a/code/modules/power/stirling.dm +++ b/code/modules/power/stirling.dm @@ -141,26 +141,26 @@ if(!inserted_cylinder) . += "There is no piston cylinder inserted into \the [src]." -/obj/machinery/atmospherics/binary/stirling/attackby(var/obj/item/W, var/mob/user) - if((istype(W, /obj/item/tank/stirling))) +/obj/machinery/atmospherics/binary/stirling/attackby(var/obj/item/used_item, var/mob/user) + if((istype(used_item, /obj/item/tank/stirling))) if(inserted_cylinder) return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, SPAN_NOTICE("You insert \the [W] into \the [src].")) - inserted_cylinder = W + to_chat(user, SPAN_NOTICE("You insert \the [used_item] into \the [src].")) + inserted_cylinder = used_item update_icon() return TRUE if(!panel_open) - if(IS_CROWBAR(W) && inserted_cylinder) + if(IS_CROWBAR(used_item) && inserted_cylinder) inserted_cylinder.dropInto(get_turf(src)) to_chat(user, SPAN_NOTICE("You remove \the [inserted_cylinder] from \the [src].")) inserted_cylinder = null stop_engine() return TRUE - if(IS_WRENCH(W)) + if(IS_WRENCH(used_item)) var/target_frequency = input(user, "Enter the cycle frequency you would like \the [src] to operate at ([MAX_FREQUENCY/4] - [MAX_FREQUENCY] Hz)", "Stirling Frequency", cycle_frequency) as num | null if(!CanPhysicallyInteract(user) || !target_frequency) return TRUE diff --git a/code/modules/power/terminal.dm b/code/modules/power/terminal.dm index ac6c076a7029..7e6227927a0c 100644 --- a/code/modules/power/terminal.dm +++ b/code/modules/power/terminal.dm @@ -27,8 +27,8 @@ master = null . = ..() -/obj/machinery/power/terminal/attackby(obj/item/W, mob/user) - if(IS_WIRECUTTER(W)) +/obj/machinery/power/terminal/attackby(obj/item/used_item, mob/user) + if(IS_WIRECUTTER(used_item)) var/turf/T = get_turf(src) var/obj/machinery/machine = master_machine() diff --git a/code/modules/power/tracker.dm b/code/modules/power/tracker.dm index 2c99034e7f3b..b6f3bfb0274d 100644 --- a/code/modules/power/tracker.dm +++ b/code/modules/power/tracker.dm @@ -55,9 +55,9 @@ if(powernet && (powernet == control.powernet)) //update if we're still in the same powernet control.cdir = angle -/obj/machinery/power/tracker/attackby(var/obj/item/W, var/mob/user) +/obj/machinery/power/tracker/attackby(var/obj/item/used_item, var/mob/user) - if(IS_CROWBAR(W)) + if(IS_CROWBAR(used_item)) playsound(src.loc, 'sound/machines/click.ogg', 50, 1) user.visible_message("[user] begins to take the glass off the solar tracker.") if(!do_after(user, 5 SECONDS, src)) diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index 8fceb8e096d6..83c79b11ce9a 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -1,12 +1,13 @@ /obj/item/ammo_casing name = "bullet casing" desc = "A bullet casing." - icon = 'icons/obj/ammo.dmi' - icon_state = "pistolcasing" + icon = 'icons/obj/ammo/casings/pistol.dmi' + icon_state = ICON_STATE_WORLD + "-preview" randpixel = 10 obj_flags = OBJ_FLAG_CONDUCTIBLE | OBJ_FLAG_HOLLOW slot_flags = SLOT_LOWER_BODY | SLOT_EARS w_class = ITEM_SIZE_TINY + color = /decl/material/solid/metal/brass::color // mapping preview color material = /decl/material/solid/metal/brass material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME drop_sound = list( @@ -15,11 +16,10 @@ 'sound/weapons/guns/casingfall3.ogg' ) - var/leaves_residue = 1 + var/leaves_residue = TRUE var/caliber = "" //Which kind of guns it can be loaded into var/projectile_type //The bullet type to create when New() is called var/obj/item/projectile/BB = null //The loaded bullet - make it so that the projectiles are created only when needed? - var/spent_icon = "pistolcasing-spent" var/bullet_color = COLOR_COPPER var/marking_color @@ -34,9 +34,6 @@ if(caliber && istype(BB, /obj/item/projectile/bullet)) var/obj/item/projectile/bullet/B = BB B.caliber = caliber - if(randpixel) - pixel_x = rand(-randpixel, randpixel) - pixel_y = rand(-randpixel, randpixel) . = ..() /obj/item/ammo_casing/Destroy() @@ -89,8 +86,8 @@ var/datum/extension/forensic_evidence/forensics = get_or_create_extension(A, /datum/extension/forensic_evidence) forensics.add_from_atom(/datum/forensics/gunshot_residue, src) -/obj/item/ammo_casing/attackby(obj/item/W, mob/user) - if(!IS_SCREWDRIVER(W)) +/obj/item/ammo_casing/attackby(obj/item/used_item, mob/user) + if(!IS_SCREWDRIVER(used_item)) return ..() if(!BB) to_chat(user, "There is no bullet in the casing to inscribe anything into.") @@ -108,19 +105,21 @@ BB.SetName("[initial(BB.name)] (\"[label_text]\")") return TRUE +// This is separate because on_update_icon() needs to call parent, +// and shells need to override this. +/obj/item/ammo_casing/proc/update_casing_icon() + if(BB) + var/image/I = overlay_image(icon, "[icon_state]-bullet", bullet_color, flags=RESET_COLOR) + I.dir = dir // don't overlays inherit dir already? is this needed? + add_overlay(I) + if(marking_color) + var/image/I = overlay_image(icon, "[icon_state]-marking", marking_color, flags=RESET_COLOR) + I.dir = dir + add_overlay(I) + /obj/item/ammo_casing/on_update_icon() . = ..() - if(use_single_icon) - if(BB) - var/image/I = overlay_image(icon, "[icon_state]-bullet", bullet_color, flags=RESET_COLOR) - I.dir = dir - add_overlay(I) - if(marking_color) - var/image/I = overlay_image(icon, "[icon_state]-marking", marking_color, flags=RESET_COLOR) - I.dir = dir - add_overlay(I) - else if(spent_icon && !BB) - icon_state = spent_icon + update_casing_icon() /obj/item/ammo_casing/update_name() . = ..() @@ -177,6 +176,16 @@ stored_ammo += new ammo_type(src) contents_initialized = TRUE +/obj/item/ammo_magazine/get_contained_matter(include_reagents = TRUE) + . = ..() + if(!lazyload_contents || contents_initialized || !ammo_type || !initial_ammo) + return + // Add our expected matter from lazyloaded stuff. + var/list/ammo_matter = atom_info_repository.get_matter_for(ammo_type).Copy() + for(var/matter_entry in ammo_matter) + ammo_matter[matter_entry] *= initial_ammo + . = MERGE_ASSOCS_WITH_NUM_VALUES(., ammo_matter) + /obj/item/ammo_magazine/proc/get_stored_ammo_count() . = length(stored_ammo) if(!contents_initialized) @@ -198,10 +207,10 @@ SetName("[name] ([english_list(labels, and_text = ", ")])") update_icon() -/obj/item/ammo_magazine/attackby(obj/item/W, mob/user) - if(!istype(W, /obj/item/ammo_casing)) +/obj/item/ammo_magazine/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/ammo_casing)) return ..() - var/obj/item/ammo_casing/C = W + var/obj/item/ammo_casing/C = used_item if(C.caliber != caliber) to_chat(user, "[C] does not fit into [src].") return TRUE @@ -216,11 +225,11 @@ return TRUE /obj/item/ammo_magazine/attack_self(mob/user) - create_initial_contents() - if(!stored_ammo.len) - to_chat(user, "[src] is already empty!") + if(!get_stored_ammo_count()) + to_chat(user, SPAN_NOTICE("[src] is already empty!")) return - to_chat(user, "You empty [src].") + to_chat(user, SPAN_NOTICE("You empty [src].")) + create_initial_contents() for(var/obj/item/ammo_casing/C in stored_ammo) C.forceMove(user.loc) C.set_dir(pick(global.alldirs)) @@ -231,12 +240,12 @@ /obj/item/ammo_magazine/attack_hand(mob/user) if(!user.is_holding_offhand(src) || !user.check_dexterity(DEXTERITY_HOLD_ITEM, TRUE)) return ..() - create_initial_contents() - if(!stored_ammo.len) + if(!get_stored_ammo_count()) to_chat(user, SPAN_NOTICE("\The [src] is already empty!")) return TRUE + create_initial_contents() var/obj/item/ammo_casing/C = stored_ammo[stored_ammo.len] - stored_ammo-=C + stored_ammo -= C user.put_in_hands(C) user.visible_message( "\The [user] removes \a [C] from [src].", diff --git a/code/modules/projectiles/ammunition/boxes.dm b/code/modules/projectiles/ammunition/boxes.dm index 29125e7db811..56f1456a0630 100644 --- a/code/modules/projectiles/ammunition/boxes.dm +++ b/code/modules/projectiles/ammunition/boxes.dm @@ -23,7 +23,7 @@ return create_initial_contents() // Not ideal, but we need instances for the icon gen. switch(icon_state) - if("world") + if(ICON_STATE_WORLD) var/ammo_state = "world-some" if(ammo_count == 1) ammo_state = "world-one" @@ -34,7 +34,7 @@ add_overlay(overlay_image(icon, "[ammo_state]-bullets", A.bullet_color, flags = RESET_COLOR)) if(A.marking_color) add_overlay(overlay_image(icon, "[ammo_state]-markings", A.marking_color, RESET_COLOR)) - if("inventory") + if(ICON_STATE_INV) for(var/i = 1 to length(stored_ammo)) var/obj/item/ammo_casing/A = stored_ammo[i] var/image/I = overlay_image(icon, "casing", A.color, RESET_COLOR) @@ -59,14 +59,11 @@ /obj/item/ammo_magazine/shotholder/on_update_icon() ..() - overlays.Cut() if(marking_color) - var/image/I = image(icon, "shotholder-marking") - I.color = marking_color - overlays += I + add_overlay(overlay_image(icon, "shotholder-marking", marking_color, RESET_COLOR)) /obj/item/ammo_magazine/shotholder/attack_hand(mob/user) - if(loc != user || !user.check_intent(I_FLAG_HARM) || !length(stored_ammo) || !user.check_dexterity(DEXTERITY_HOLD_ITEM, TRUE)) + if(loc != user || !user.check_intent(I_FLAG_HARM) || !get_stored_ammo_count() || !user.check_dexterity(DEXTERITY_HOLD_ITEM, TRUE)) return ..() create_initial_contents() var/obj/item/ammo_casing/C = stored_ammo[stored_ammo.len] diff --git a/code/modules/projectiles/ammunition/bullets.dm b/code/modules/projectiles/ammunition/bullets.dm index 26090dff1d98..f02b0bde75a4 100644 --- a/code/modules/projectiles/ammunition/bullets.dm +++ b/code/modules/projectiles/ammunition/bullets.dm @@ -26,6 +26,7 @@ desc = "A pistol bullet casing fitted with a single-use ion pulse generator." projectile_type = /obj/item/projectile/ion/small material = /decl/material/solid/metal/steel + color = /decl/material/solid/metal/steel::color matter = list(/decl/material/solid/metal/uranium = MATTER_AMOUNT_REINFORCEMENT) bullet_color = COLOR_ACID_CYAN marking_color = COLOR_LUMINOL @@ -76,56 +77,71 @@ bullet_color = COLOR_OFF_WHITE marking_color = COLOR_SUN +// This uses a shotgun shell icon despite not being a shotgun shell... +// TODO: Unify the casing icon system somehow to avoid code duplication. /obj/item/ammo_casing/pistol/magnum/stun name = "stun round" desc = "An energy stun cartridge." - icon_state = "stunshell" - spent_icon = "stunshell-spent" + icon = 'icons/obj/ammo/shells/stun.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/energy/electrode/stunshot - leaves_residue = 0 + leaves_residue = FALSE material = /decl/material/solid/metal/steel + material_alteration = MAT_FLAG_ALTERATION_NONE matter = list(/decl/material/solid/glass = MATTER_AMOUNT_REINFORCEMENT) origin_tech = @'{"combat":3,"materials":3}' +/obj/item/ammo_casing/pistol/magnum/stun/update_casing_icon() + icon_state = get_world_inventory_state() + if(!BB) // use spent icon + icon_state = "[icon_state]-spent" + /obj/item/ammo_casing/shotgun name = "shotgun slug" desc = "A shotgun slug." - icon_state = "slshell" - spent_icon = "slshell-spent" + icon = 'icons/obj/ammo/shells/slugs.dmi' + icon_state = ICON_STATE_WORLD caliber = CALIBER_SHOTGUN projectile_type = /obj/item/projectile/bullet/shotgun - material = /decl/material/solid/metal/steel + material = /decl/material/solid/metal/steel // at some point this should use matter, brass + plastic + color = null + material_alteration = MAT_FLAG_ALTERATION_NONE drop_sound = 'sound/weapons/guns/shotgun_fall.ogg' +/obj/item/ammo_casing/shotgun/update_casing_icon() + icon_state = get_world_inventory_state() + if(!BB) // use spent icon + icon_state = "[icon_state]-spent" + /obj/item/ammo_casing/shotgun/pellet name = "shotgun shell" desc = "A shotgun shell." - icon_state = "gshell" - spent_icon = "gshell-spent" + icon = 'icons/obj/ammo/shells/buckshot.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/bullet/pellet/shotgun material = /decl/material/solid/metal/steel /obj/item/ammo_casing/shotgun/blank name = "shotgun shell" desc = "A blank shell." - icon_state = "blshell" - spent_icon = "blshell-spent" + icon = 'icons/obj/ammo/shells/blanks.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/bullet/blank material = /decl/material/solid/metal/steel /obj/item/ammo_casing/shotgun/practice name = "shotgun shell" desc = "A practice shell." - icon_state = "pshell" - spent_icon = "pshell-spent" + icon = 'icons/obj/ammo/shells/practice.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/bullet/shotgun/practice material = /decl/material/solid/metal/steel /obj/item/ammo_casing/shotgun/beanbag name = "beanbag shell" desc = "A beanbag shell." - icon_state = "bshell" - spent_icon = "bshell-spent" + icon = 'icons/obj/ammo/shells/beanbag.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/bullet/shotgun/beanbag material = /decl/material/solid/metal/steel @@ -134,10 +150,10 @@ /obj/item/ammo_casing/shotgun/stunshell name = "stun shell" desc = "An energy stun cartridge." - icon_state = "stunshell" - spent_icon = "stunshell-spent" + icon = 'icons/obj/ammo/shells/stun.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/energy/electrode/stunshot - leaves_residue = 0 + leaves_residue = FALSE material = /decl/material/solid/metal/steel matter = list(/decl/material/solid/glass = MATTER_AMOUNT_REINFORCEMENT) origin_tech = @'{"combat":3,"materials":3}' @@ -150,8 +166,8 @@ /obj/item/ammo_casing/shotgun/flash name = "flash shell" desc = "A chemical shell used to signal distress or provide illumination." - icon_state = "fshell" - spent_icon = "fshell-spent" + icon = 'icons/obj/ammo/shells/flash.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/energy/flash/flare material = /decl/material/solid/metal/steel matter = list(/decl/material/solid/glass = MATTER_AMOUNT_REINFORCEMENT) @@ -159,8 +175,8 @@ /obj/item/ammo_casing/shotgun/emp name = "haywire slug" desc = "A 12-gauge shotgun slug fitted with a single-use ion pulse generator." - icon_state = "empshell" - spent_icon = "empshell-spent" + icon = 'icons/obj/ammo/shells/haywire.dmi' + icon_state = ICON_STATE_WORLD projectile_type = /obj/item/projectile/ion material = /decl/material/solid/metal/steel matter = list(/decl/material/solid/metal/uranium = MATTER_AMOUNT_REINFORCEMENT) diff --git a/code/modules/projectiles/ammunition/chemdart.dm b/code/modules/projectiles/ammunition/chemdart.dm index fa7647a4dcf1..e153ddb9c559 100644 --- a/code/modules/projectiles/ammunition/chemdart.dm +++ b/code/modules/projectiles/ammunition/chemdart.dm @@ -29,7 +29,10 @@ icon_state = "dart" caliber = CALIBER_DART projectile_type = /obj/item/projectile/bullet/chemdart - leaves_residue = 0 + leaves_residue = FALSE + material = /decl/material/solid/organic/plastic + color = null + material_alteration = MAT_FLAG_ALTERATION_NONE /obj/item/ammo_casing/chemdart/expend() qdel(src) diff --git a/code/modules/projectiles/guns/energy/capacitor.dm b/code/modules/projectiles/guns/energy/capacitor.dm index c9e7239f2100..ac72d5d1e52b 100644 --- a/code/modules/projectiles/guns/energy/capacitor.dm +++ b/code/modules/projectiles/guns/energy/capacitor.dm @@ -103,12 +103,12 @@ var/global/list/laser_wavelengths /obj/item/gun/energy/capacitor/afterattack(atom/A, mob/living/user, adjacent, params) . = !charging && ..() -/obj/item/gun/energy/capacitor/attackby(obj/item/W, mob/user) +/obj/item/gun/energy/capacitor/attackby(obj/item/used_item, mob/user) if(charging) return ..() - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) // Unload the cell before the caps. if(get_cell()) return ..() @@ -121,12 +121,12 @@ var/global/list/laser_wavelengths update_icon() return TRUE - if(istype(W, /obj/item/stock_parts/capacitor)) + if(istype(used_item, /obj/item/stock_parts/capacitor)) if(length(capacitors) >= max_capacitors) to_chat(user, SPAN_WARNING("\The [src] cannot fit any additional capacitors.")) - else if(user.try_unequip(W, src)) - LAZYADD(capacitors, W) - to_chat(user, SPAN_NOTICE("You fit \the [W] into \the [src].")) + else if(user.try_unequip(used_item, src)) + LAZYADD(capacitors, used_item) + to_chat(user, SPAN_NOTICE("You fit \the [used_item] into \the [src].")) update_icon() return TRUE @@ -279,8 +279,8 @@ var/global/list/laser_wavelengths /obj/item/gun/energy/capacitor/rifle/linear_fusion/setup_power_supply(loaded_cell_type, accepted_cell_type, power_supply_extension_type, charge_value) return ..(/obj/item/cell/infinite, accepted_cell_type, /datum/extension/loaded_cell/unremovable, charge_value) -/obj/item/gun/energy/capacitor/rifle/linear_fusion/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/item/gun/energy/capacitor/rifle/linear_fusion/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) to_chat(user, SPAN_WARNING("\The [src] is hermetically sealed; you can't get the components out.")) return TRUE . = ..() diff --git a/code/modules/projectiles/guns/launcher/bows/bow_interaction.dm b/code/modules/projectiles/guns/launcher/bows/bow_interaction.dm index f2b8a389b4a5..14eaf8359812 100644 --- a/code/modules/projectiles/guns/launcher/bows/bow_interaction.dm +++ b/code/modules/projectiles/guns/launcher/bows/bow_interaction.dm @@ -93,6 +93,15 @@ if(string) to_chat(user, SPAN_WARNING("\The [src] is already strung.")) return TRUE + // check to make sure it fits + var/datum/storage/loc_storage = loc.storage + if(loc_storage) + if(strung_w_class > loc_storage.max_w_class) + to_chat(user, SPAN_WARNING("\The [src] can't fit in \the [loc] when strung, take it out first!")) + return TRUE + if((loc_storage.storage_space_used() - w_class + strung_w_class) > loc_storage.max_storage_space) + to_chat(user, SPAN_WARNING("\The [loc] is too full to fit \the [src] when strung, make some room!")) + return TRUE if(user.try_unequip(new_string, src)) set_string(new_string) if(user) @@ -101,13 +110,13 @@ return TRUE return FALSE -/obj/item/gun/launcher/bow/attackby(obj/item/W, mob/user) - if(can_load_arrow(W)) +/obj/item/gun/launcher/bow/attackby(obj/item/used_item, mob/user) + if(can_load_arrow(used_item)) if(_loaded) to_chat(user, SPAN_WARNING("\The [src] already has \the [_loaded] ready.")) else - load_arrow(user, W) + load_arrow(user, used_item) return TRUE - if(istype(W, /obj/item/bowstring) && try_string(user, W)) + if(istype(used_item, /obj/item/bowstring) && try_string(user, used_item)) return TRUE return ..() diff --git a/code/modules/projectiles/guns/launcher/bows/crossbow_powered.dm b/code/modules/projectiles/guns/launcher/bows/crossbow_powered.dm index c048a4141f93..290878f861b3 100644 --- a/code/modules/projectiles/guns/launcher/bows/crossbow_powered.dm +++ b/code/modules/projectiles/guns/launcher/bows/crossbow_powered.dm @@ -24,10 +24,10 @@ QDEL_NULL(cell) return ..() -/obj/item/gun/launcher/bow/crossbow/powered/attackby(obj/item/W, mob/user) +/obj/item/gun/launcher/bow/crossbow/powered/attackby(obj/item/used_item, mob/user) - if(istype(W, /obj/item/rcd)) - var/obj/item/rcd/rcd = W + if(istype(used_item, /obj/item/rcd)) + var/obj/item/rcd/rcd = used_item if(rcd.crafting && user.try_unequip(rcd) && user.try_unequip(src)) new /obj/item/gun/launcher/bow/crossbow/powered/rapidcrossbowdevice(get_turf(src)) qdel(rcd) @@ -36,21 +36,21 @@ to_chat(user, SPAN_WARNING("\The [rcd] is not prepared for installation in \the [src].")) return TRUE - if(istype(W, /obj/item/cell)) + if(istype(used_item, /obj/item/cell)) if(!cell) - if(user.try_unequip(W, src)) - cell = W + if(user.try_unequip(used_item, src)) + cell = used_item to_chat(user, SPAN_NOTICE("You jam [cell] into [src] and wire it to the firing coil.")) superheat_rod(user) else to_chat(user, SPAN_NOTICE("[src] already has a cell installed.")) return TRUE - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) if(cell) var/obj/item/C = cell C.dropInto(user.loc) - to_chat(user, SPAN_NOTICE("You jimmy [cell] out of [src] with [W].")) + to_chat(user, SPAN_NOTICE("You jimmy [cell] out of [src] with [used_item].")) cell = null else to_chat(user, SPAN_WARNING("[src] doesn't have a cell installed.")) @@ -116,20 +116,20 @@ generate_bolt(user) return ..() -/obj/item/gun/launcher/bow/crossbow/powered/rapidcrossbowdevice/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/rcd_ammo)) - var/obj/item/rcd_ammo/cartridge = W +/obj/item/gun/launcher/bow/crossbow/powered/rapidcrossbowdevice/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/rcd_ammo)) + var/obj/item/rcd_ammo/cartridge = used_item if((stored_matter + cartridge.remaining) > max_stored_matter) to_chat(user, SPAN_NOTICE("The RCD can't hold that many additional matter-units.")) return TRUE stored_matter += cartridge.remaining - qdel(W) + qdel(used_item) playsound(src.loc, 'sound/machines/click.ogg', 50, 1) to_chat(user, SPAN_NOTICE("The RCD now holds [stored_matter]/[max_stored_matter] matter-units.")) update_icon() return TRUE - if(istype(W, /obj/item/stack/material/bow_ammo/bolt/rcd)) - var/obj/item/stack/material/bow_ammo/bolt/rcd/A = W + if(istype(used_item, /obj/item/stack/material/bow_ammo/bolt/rcd)) + var/obj/item/stack/material/bow_ammo/bolt/rcd/A = used_item if((stored_matter + 10) > max_stored_matter) to_chat(user, SPAN_NOTICE("Unable to reclaim flashforged bolt. The RCD can't hold that many additional matter-units.")) return TRUE diff --git a/code/modules/projectiles/guns/launcher/foam_gun.dm b/code/modules/projectiles/guns/launcher/foam_gun.dm index d0933d5b31de..6a351feeda82 100644 --- a/code/modules/projectiles/guns/launcher/foam_gun.dm +++ b/code/modules/projectiles/guns/launcher/foam_gun.dm @@ -18,14 +18,14 @@ var/max_darts = 1 var/list/darts = new/list() -/obj/item/gun/launcher/foam/attackby(obj/item/I, mob/user) - if(!istype(I, /obj/item/foam_dart)) +/obj/item/gun/launcher/foam/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/foam_dart)) return ..() if(darts.len < max_darts) - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - darts += I - to_chat(user, SPAN_NOTICE("You slot \the [I] into \the [src].")) + darts += used_item + to_chat(user, SPAN_NOTICE("You slot \the [used_item] into \the [src].")) return TRUE else to_chat(user, SPAN_WARNING("\The [src] can hold no more darts.")) @@ -33,9 +33,9 @@ /obj/item/gun/launcher/foam/consume_next_projectile() if(darts.len) - var/obj/item/I = darts[1] - darts -= I - return I + var/obj/item/thing = darts[1] + darts -= thing + return thing return null /obj/item/gun/launcher/foam/CtrlAltClick(mob/user) diff --git a/code/modules/projectiles/guns/launcher/grenade_launcher.dm b/code/modules/projectiles/guns/launcher/grenade_launcher.dm index f2d830571f6d..1e1e7f0cda25 100644 --- a/code/modules/projectiles/guns/launcher/grenade_launcher.dm +++ b/code/modules/projectiles/guns/launcher/grenade_launcher.dm @@ -78,12 +78,11 @@ /obj/item/gun/launcher/grenade/attack_self(mob/user) pump(user) -/obj/item/gun/launcher/grenade/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/grenade)) - load(I, user) +/obj/item/gun/launcher/grenade/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/grenade)) + load(used_item, user) return TRUE - else - return ..() + return ..() /obj/item/gun/launcher/grenade/attack_hand(mob/user) if(!user.is_holding_offhand(src) || !user.check_dexterity(DEXTERITY_HOLD_ITEM, TRUE)) diff --git a/code/modules/projectiles/guns/launcher/money_cannon.dm b/code/modules/projectiles/guns/launcher/money_cannon.dm index 64755e6f24ca..57b3ffbb62c9 100644 --- a/code/modules/projectiles/guns/launcher/money_cannon.dm +++ b/code/modules/projectiles/guns/launcher/money_cannon.dm @@ -30,7 +30,7 @@ var/obj/item/cash/bling = new(T) bling.adjust_worth(nv) if(projectile_vomit) - for(var/j = 1, j <= rand(2, 4), j++) + for(var/j in 1 to rand(2, 4)) step(bling, pick(global.cardinal)) if(projectile_vomit) @@ -111,9 +111,9 @@ unload_receptacle(user) return TRUE -/obj/item/gun/launcher/money/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/cash)) - var/obj/item/cash/bling = W +/obj/item/gun/launcher/money/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/cash)) + var/obj/item/cash/bling = used_item if(bling.absolute_worth < 1) to_chat(user, "You can't seem to get \the [bling] to slide into the receptacle.") return TRUE diff --git a/code/modules/projectiles/guns/launcher/pneumatic.dm b/code/modules/projectiles/guns/launcher/pneumatic.dm index 3c0b6e2885c9..5e1dcb93e82d 100644 --- a/code/modules/projectiles/guns/launcher/pneumatic.dm +++ b/code/modules/projectiles/guns/launcher/pneumatic.dm @@ -61,12 +61,12 @@ unload_hopper(user) return TRUE -/obj/item/gun/launcher/pneumatic/attackby(obj/item/W, mob/user) - if(!tank && istype(W, /obj/item/tank) && user.try_unequip(W, src)) - tank = W +/obj/item/gun/launcher/pneumatic/attackby(obj/item/used_item, mob/user) + if(!tank && istype(used_item, /obj/item/tank) && user.try_unequip(used_item, src)) + tank = used_item user.visible_message( - "\The [user] jams \the [W] into [src]'s valve and twists it closed.", - "You jam \the [W] into \the [src]'s valve and twist it closed." + "\The [user] jams \the [used_item] into [src]'s valve and twists it closed.", + "You jam \the [used_item] into \the [src]'s valve and twist it closed." ) update_icon() return TRUE diff --git a/code/modules/projectiles/guns/launcher/rocket.dm b/code/modules/projectiles/guns/launcher/rocket.dm index 57b101eface7..5300df1294a4 100644 --- a/code/modules/projectiles/guns/launcher/rocket.dm +++ b/code/modules/projectiles/guns/launcher/rocket.dm @@ -22,12 +22,12 @@ if(distance <= 2) . += SPAN_NOTICE("[rockets.len]/[max_rockets] rocket\s.") -/obj/item/gun/launcher/rocket/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/ammo_casing/rocket)) +/obj/item/gun/launcher/rocket/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/ammo_casing/rocket)) if(rockets.len < max_rockets) - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - rockets += I + rockets += used_item to_chat(user, "You put the rocket in [src].") to_chat(user, "[rockets.len] / [max_rockets] rockets.") return TRUE @@ -38,10 +38,10 @@ /obj/item/gun/launcher/rocket/consume_next_projectile() if(rockets.len) - var/obj/item/ammo_casing/rocket/I = rockets[1] + var/obj/item/ammo_casing/rocket/rocket = rockets[1] var/obj/item/missile/M = new (src) M.primed = 1 - rockets -= I + rockets -= rocket return M return null diff --git a/code/modules/projectiles/guns/launcher/syringe_gun.dm b/code/modules/projectiles/guns/launcher/syringe_gun.dm index 02693dc1c5ff..3d1d65ad2847 100644 --- a/code/modules/projectiles/guns/launcher/syringe_gun.dm +++ b/code/modules/projectiles/guns/launcher/syringe_gun.dm @@ -24,11 +24,11 @@ MA.plane = FLOAT_PLANE underlays += MA -/obj/item/syringe_cartridge/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/chems/syringe)) - if(!user.try_unequip(I, src)) +/obj/item/syringe_cartridge/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/chems/syringe)) + if(!user.try_unequip(used_item, src)) return TRUE - syringe = I + syringe = used_item to_chat(user, "You carefully insert [syringe] into [src].") set_sharp(TRUE) name = "syringe dart" @@ -128,9 +128,9 @@ ) return TRUE -/obj/item/gun/launcher/syringe/attackby(var/obj/item/A, mob/user) - if(istype(A, /obj/item/syringe_cartridge)) - var/obj/item/syringe_cartridge/C = A +/obj/item/gun/launcher/syringe/attackby(var/obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/syringe_cartridge)) + var/obj/item/syringe_cartridge/C = used_item if(darts.len >= max_darts) to_chat(user, "[src] is full!") return TRUE diff --git a/code/modules/projectiles/guns/magnetic/magnetic.dm b/code/modules/projectiles/guns/magnetic/magnetic.dm index 7ebf59d143bd..43478d115947 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic.dm @@ -98,10 +98,10 @@ else . += SPAN_NOTICE("The capacitor charge indicator is [SPAN_GREEN("green")].") -/obj/item/gun/magnetic/attackby(var/obj/item/thing, var/mob/user) +/obj/item/gun/magnetic/attackby(var/obj/item/used_item, var/mob/user) if(removable_components) - if(IS_SCREWDRIVER(thing)) + if(IS_SCREWDRIVER(used_item)) if(!capacitor) to_chat(user, "\The [src] has no capacitor installed.") return TRUE @@ -111,39 +111,39 @@ capacitor = null update_icon() return TRUE - if(istype(thing, /obj/item/stock_parts/capacitor)) + if(istype(used_item, /obj/item/stock_parts/capacitor)) if(capacitor) to_chat(user, "\The [src] already has \a [capacitor] installed.") return TRUE - if(!user.try_unequip(thing, src)) + if(!user.try_unequip(used_item, src)) return TRUE - capacitor = thing + capacitor = used_item playsound(loc, 'sound/machines/click.ogg', 10, 1) power_per_tick = (power_cost*0.15) * capacitor.rating user.visible_message("\The [user] slots \the [capacitor] into \the [src].") update_icon() return TRUE - if(!istype(thing, load_type)) + if(!istype(used_item, load_type)) return ..() // This is not strictly necessary for the magnetic gun but something using // specific ammo types may exist down the track. - var/obj/item/stack/ammo = thing + var/obj/item/stack/ammo = used_item if(!istype(ammo)) if(loaded) to_chat(user, "\The [src] already has \a [loaded] loaded.") return TRUE - var/obj/item/magnetic_ammo/mag = thing + var/obj/item/magnetic_ammo/mag = used_item if(istype(mag)) if(!(load_type == mag.basetype)) to_chat(user, "\The [src] doesn't seem to accept \a [mag].") return TRUE projectile_type = mag.projectile_type - if(!user.try_unequip(thing, src)) + if(!user.try_unequip(used_item, src)) return TRUE - loaded = thing + loaded = used_item else if(load_sheet_max > 1) var ammo_count = 0 var/obj/item/stack/loaded_ammo = loaded diff --git a/code/modules/projectiles/guns/projectile.dm b/code/modules/projectiles/guns/projectile.dm index 358e3a8a4ca6..e3f38df807fc 100644 --- a/code/modules/projectiles/guns/projectile.dm +++ b/code/modules/projectiles/guns/projectile.dm @@ -144,6 +144,7 @@ var/obj/item/ammo_magazine/AM = A if(!(load_method & AM.mag_type) || caliber != AM.caliber) return //incompatible + AM.create_initial_contents() switch(AM.mag_type) if(MAGAZINE) diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 86e54de2533c..1614d25961e8 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -96,10 +96,10 @@ . = ..() launcher = new(src) -/obj/item/gun/projectile/automatic/assault_rifle/grenade/attackby(obj/item/I, mob/user) - if(!istype(I, /obj/item/grenade)) +/obj/item/gun/projectile/automatic/assault_rifle/grenade/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/grenade)) return ..() - launcher.load(I, user) + launcher.load(used_item, user) return TRUE /obj/item/gun/projectile/automatic/assault_rifle/grenade/attack_hand(mob/user) diff --git a/code/modules/projectiles/guns/projectile/dartgun.dm b/code/modules/projectiles/guns/projectile/dartgun.dm index 56ba8fb6d614..b5a33cfa8745 100644 --- a/code/modules/projectiles/guns/projectile/dartgun.dm +++ b/code/modules/projectiles/guns/projectile/dartgun.dm @@ -58,16 +58,14 @@ . += SPAN_NOTICE("\The [src] contains:") for(var/obj/item/chems/glass/beaker/B in beakers) if(B.reagents && LAZYLEN(B.reagents?.reagent_volumes)) - for(var/ltype in B.reagents.liquid_volumes) - var/decl/material/R = GET_DECL(ltype) - . += SPAN_NOTICE("[LIQUID_VOLUME(B.reagents, ltype)] units of [R.get_reagent_name(B.reagents, MAT_PHASE_LIQUID)]") - for(var/stype in B.reagents.solid_volumes) - var/decl/material/R = GET_DECL(stype) - . += SPAN_NOTICE("[SOLID_VOLUME(B.reagents, stype)] units of [R.get_reagent_name(B.reagents, MAT_PHASE_SOLID)]") - -/obj/item/gun/projectile/dartgun/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/chems/glass)) - add_beaker(I, user) + for(var/decl/material/reagent as anything in B.reagents.liquid_volumes) + . += SPAN_NOTICE("[LIQUID_VOLUME(B.reagents, reagent)] units of [reagent.get_reagent_name(B.reagents, MAT_PHASE_LIQUID)]") + for(var/decl/material/reagent as anything in B.reagents.solid_volumes) + . += SPAN_NOTICE("[SOLID_VOLUME(B.reagents, reagent)] units of [reagent.get_reagent_name(B.reagents, MAT_PHASE_SOLID)]") + +/obj/item/gun/projectile/dartgun/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/chems/glass)) + add_beaker(used_item, user) return TRUE return ..() @@ -112,9 +110,8 @@ dat += "Beaker [i] contains: " if(B.reagents && LAZYLEN(B.reagents.reagent_volumes)) - for(var/rtype in B.reagents.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - dat += "
    [REAGENT_VOLUME(B.reagents, rtype)] units of [R.get_reagent_name(B.reagents)], " + for(var/decl/material/reagent as anything in B.reagents.reagent_volumes) + dat += "
    [REAGENT_VOLUME(B.reagents, reagent)] unit\s of [reagent.get_reagent_name(B.reagents)], " if(B in mixing) dat += "Mixing " else diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index 464ce437f7c3..44b580822317 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -57,8 +57,8 @@ if(cap) add_overlay("[icon_state]-toy") -/obj/item/gun/projectile/revolver/capgun/attackby(obj/item/wirecutters/W, mob/user) - if(!istype(W) || !cap) +/obj/item/gun/projectile/revolver/capgun/attackby(obj/item/used_item, mob/user) + if(!IS_WIRECUTTER(used_item) || !cap) return ..() to_chat(user, "You snip off the toy markings off \the [src].") name = "revolver" diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 217d232ba35b..f0960ad6f4fc 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -80,10 +80,10 @@ return ..(user, allow_dump=1) //this is largely hacky and bad :( -Pete -/obj/item/gun/projectile/shotgun/doublebarrel/attackby(var/obj/item/A, mob/user) - if(w_class > ITEM_SIZE_NORMAL && A.get_tool_quality(TOOL_SAW) > 0) - if(istype(A, /obj/item/gun/energy/plasmacutter)) - var/obj/item/gun/energy/plasmacutter/cutter = A +/obj/item/gun/projectile/shotgun/doublebarrel/attackby(var/obj/item/used_item, mob/user) + if(w_class > ITEM_SIZE_NORMAL && used_item.get_tool_quality(TOOL_SAW) > 0) + if(istype(used_item, /obj/item/gun/energy/plasmacutter)) + var/obj/item/gun/energy/plasmacutter/cutter = used_item if(!cutter.slice(user)) return ..() to_chat(user, "You begin to shorten the barrel of \the [src].") diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 365338cf6cac..4feed2fd06c9 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -227,7 +227,7 @@ var/result = PROJECTILE_FORCE_MISS if(hit_zone) def_zone = hit_zone //set def_zone, so if the projectile ends up hitting someone else later (to be implemented), it is more likely to hit the same part - if(!target_mob.aura_check(AURA_TYPE_BULLET, src,def_zone)) + if(target_mob.mob_modifiers_block_attack(MM_ATTACK_TYPE_PROJECTILE, src, def_zone)) return TRUE result = target_mob.bullet_act(src, def_zone) diff --git a/code/modules/projectiles/projectile/change.dm b/code/modules/projectiles/projectile/change.dm index ff77df0fa33d..7e498de80efc 100644 --- a/code/modules/projectiles/projectile/change.dm +++ b/code/modules/projectiles/projectile/change.dm @@ -13,23 +13,23 @@ . = list() if(!isrobot(M)) . += "robot" - for(var/t in get_all_species()) - . += t + for(var/decl/species/species as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) + . += species.uid if(ishuman(M)) var/mob/living/human/H = M - . -= H.species.name + . -= H.species.uid /obj/item/projectile/change/proc/apply_transformation(var/mob/M, var/choice) if(choice == "robot") - var/mob/living/silicon/robot/R = new(get_turf(M)) - R.set_gender(M.get_gender()) - R.job = ASSIGNMENT_ROBOT - R.central_processor = new /obj/item/organ/internal/brain_interface(R) - transfer_key_from_mob_to_mob(M, R) - return R + var/mob/living/silicon/robot/robot = new(get_turf(M)) + robot.set_gender(M.get_gender()) + robot.job = ASSIGNMENT_ROBOT + robot.central_processor = new /obj/item/organ/internal/brain_interface(robot) + transfer_key_from_mob_to_mob(M, robot) + return robot - if(get_species_by_key(choice)) + if(decls_repository.get_decl_by_id(choice)) var/mob/living/human/H = M if(!istype(H)) H = new(get_turf(M)) diff --git a/code/modules/projectiles/secure.dm b/code/modules/projectiles/secure.dm index a9196955008e..88fd79c91ef1 100644 --- a/code/modules/projectiles/secure.dm +++ b/code/modules/projectiles/secure.dm @@ -26,11 +26,11 @@ if(distance <= 0 && is_secure_gun()) . += "The registration screen shows, \"" + (registered_owner ? "[registered_owner]" : "unregistered") + "\"." -/obj/item/gun/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/card/id) && is_secure_gun()) +/obj/item/gun/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/card/id) && is_secure_gun()) user.visible_message("[user] swipes an ID through \the [src].", range = 3) if(!registered_owner) - var/obj/item/card/id/id = W + var/obj/item/card/id/id = used_item global.registered_weapons += src verbs += /obj/item/gun/proc/reset_registration registered_owner = id.registered_name diff --git a/code/modules/prometheus_metrics/metrics.dm b/code/modules/prometheus_metrics/metrics.dm index ad98b6c178f9..7a5bca9be93a 100644 --- a/code/modules/prometheus_metrics/metrics.dm +++ b/code/modules/prometheus_metrics/metrics.dm @@ -1,8 +1,5 @@ // prometheus_metrics holds a list of metric_family datums and uses them to // create a json protobuf. -/decl/prometheus_metrics - var/list/metric_families - /decl/prometheus_metrics/proc/collect() var/list/out = list() diff --git a/code/modules/pronouns/pronouns_second_person.dm b/code/modules/pronouns/pronouns_second_person.dm new file mode 100644 index 000000000000..4860a1afaaa5 --- /dev/null +++ b/code/modules/pronouns/pronouns_second_person.dm @@ -0,0 +1,13 @@ +/decl/pronouns/self + name = SECOND_PERSON_SINGULAR + He = "You" + he = "you" + His = "Your" + his = "your" + him = "you" // yourself? you? + has = "have" + is = "are" + does = "do" + self = "yourself" + s = "" + es = "" \ No newline at end of file diff --git a/code/modules/random_map/dungeon/room_theme.dm b/code/modules/random_map/dungeon/room_theme.dm index 60f11640b55f..9033a10375f3 100644 --- a/code/modules/random_map/dungeon/room_theme.dm +++ b/code/modules/random_map/dungeon/room_theme.dm @@ -48,9 +48,8 @@ var/turf/check = locate(T.x + i, T.y + j, T.z) if(!check) continue - for(var/atom/movable/M in check.contents) - if(!istype(M, /atom/movable/lighting_overlay) && M.density) - return 0 + if(check.contains_dense_objects()) + return FALSE if(!T) return 0 if(ispath(door_type,/obj/structure/door)) diff --git a/code/modules/random_map/dungeon/winding_dungeon.dm b/code/modules/random_map/dungeon/winding_dungeon.dm index 1369aca46e92..1ecf9649028e 100644 --- a/code/modules/random_map/dungeon/winding_dungeon.dm +++ b/code/modules/random_map/dungeon/winding_dungeon.dm @@ -313,10 +313,6 @@ rooms += R return 1 -/datum/random_map/winding_dungeon/proc/add_loot(var/xorigin,var/yorigin,var/zorigin,var/type) - var/datum/room/room = pick(rooms) - return room.add_loot(type) - /datum/random_map/winding_dungeon/get_appropriate_path(var/value) switch(value) if(WALL_CHAR) diff --git a/code/modules/random_map/dungeon/winding_dungeon_verb.dm b/code/modules/random_map/dungeon/winding_dungeon_verb.dm index 9bf9129a0bd4..4e8bae557fee 100644 --- a/code/modules/random_map/dungeon/winding_dungeon_verb.dm +++ b/code/modules/random_map/dungeon/winding_dungeon_verb.dm @@ -95,7 +95,7 @@ if(alert("Are you sure you want to create this? It will appear at your position.",,"No","Yes") != "Yes") return - var/datum/random_map/winding_dungeon/W = /datum/random_map/winding_dungeon + var/datum/random_map/winding_dungeon/dungeon = /datum/random_map/winding_dungeon for(var/x in 1 to vars["limit_x"]) for(var/y in 1 to vars["limit_y"]) @@ -104,5 +104,5 @@ if(!T) to_chat(src, "Error, turf could not be located. Probably out of bounds.") return - T.ChangeTurf(initial(W.target_turf_type)) + T.ChangeTurf(initial(dungeon.target_turf_type)) new /datum/random_map/winding_dungeon(usr.x, usr.y, usr.z, variable_list = vars) diff --git a/code/modules/random_map/noise/forage.dm b/code/modules/random_map/noise/forage.dm index aec8125c689f..13977e05684e 100644 --- a/code/modules/random_map/noise/forage.dm +++ b/code/modules/random_map/noise/forage.dm @@ -129,7 +129,7 @@ if(floor.is_outside()) if(istype(flooring, /decl/flooring/rock)) - if(prob(15)) // Static as current map has limited amount of rock turfs + if(prob(15) && !floor.contains_dense_objects()) // Static as current map has limited amount of rock turfs var/rock_type = SAFEPICK(forage["rocks"]) new rock_type(floor) return diff --git a/code/modules/random_map/noise/noise.dm b/code/modules/random_map/noise/noise.dm index 4cb74b70fe55..15f6277f693a 100644 --- a/code/modules/random_map/noise/noise.dm +++ b/code/modules/random_map/noise/noise.dm @@ -61,48 +61,35 @@ var/hsize = round(input_size/2) /* - (x,y+isize)----(x+hsize,y+isize)----(x+size,y+isize) + (x,y+isize)----(x+hsize,y+isize)----(x+isize,y+isize) | | | | | | | | | - (x,y+hsize)----(x+hsize,y+hsize)----(x+isize,y) + (x,y+hsize)----(x+hsize,y+hsize)----(x+isize,y+hsize) | | | | | | | | | (x,y)----------(x+hsize,y)----------(x+isize,y) */ + // Pre-halve them to prevent extra divisions. + var/topleft = map[TRANSLATE_COORD(x,y+isize)]/2 + var/topright = map[TRANSLATE_COORD(x+isize,y+isize)]/2 + var/bottomleft = map[TRANSLATE_COORD(x, y)]/2 + var/bottomright = map[TRANSLATE_COORD(x+isize,y)]/2 + // Central edge values become average of corners. - map[TRANSLATE_COORD(x+hsize,y+isize)] = round((\ - map[TRANSLATE_COORD(x,y+isize)] + \ - map[TRANSLATE_COORD(x+isize,y+isize)] \ - )/2) - - map[TRANSLATE_COORD(x+hsize,y)] = round(( \ - map[TRANSLATE_COORD(x,y)] + \ - map[TRANSLATE_COORD(x+isize,y)] \ - )/2) - - map[TRANSLATE_COORD(x,y+hsize)] = round(( \ - map[TRANSLATE_COORD(x,y+isize)] + \ - map[TRANSLATE_COORD(x,y)] \ - )/2) - - map[TRANSLATE_COORD(x+isize,y+hsize)] = round(( \ - map[TRANSLATE_COORD(x+isize,y+isize)] + \ - map[TRANSLATE_COORD(x+isize,y)] \ - )/2) + map[TRANSLATE_COORD(x+hsize,y+isize)] = round(topleft + topright) // top = topleft + topright + map[TRANSLATE_COORD(x+hsize,y)] = round(bottomleft + bottomright) // bottom = bottomleft + bottomright + map[TRANSLATE_COORD(x,y+hsize)] = round(topleft + bottomleft) // left = topleft + bottomleft + map[TRANSLATE_COORD(x+isize,y+hsize)] = round(topright + bottomright) // right = topright + bottomright // Centre value becomes the average of all other values + possible random variance. var/current_cell = TRANSLATE_COORD(x+hsize,y+hsize) - map[current_cell] = round(( \ - map[TRANSLATE_COORD(x+hsize,y+isize)] + \ - map[TRANSLATE_COORD(x+hsize,y)] + \ - map[TRANSLATE_COORD(x,y+hsize)] + \ - map[TRANSLATE_COORD(x+isize,y)] \ - )/4) + // yes, this is equivalent to the prior averaging. it just avoids more list indexing + map[current_cell] = round(round(topleft+topright)/4 + round(bottomleft + bottomright)/4 + round(topleft + bottomleft)/4 + round(topright + bottomright)/4) if(prob(random_variance_chance)) - map[current_cell] *= (rand(1,2)==1 ? (1.0-random_element) : (1.0+random_element)) + map[current_cell] *= (prob(50) ? (1.0-random_element) : (1.0+random_element)) map[current_cell] = max(0,min(cell_range,map[current_cell])) // Recurse until size is too small to subdivide. @@ -116,42 +103,47 @@ /datum/random_map/noise/cleanup() for(var/i = 1 to smoothing_iterations) - var/list/next_map[limit_x*limit_y] + // var/list/next_map[limit_x*limit_y] // simple box blur from http://amritamaz.net/blog/understanding-box-blur // basically: we do two very fast one-dimensional blurs var/total for(var/y = 1 to limit_y) // for each row // init window for x=1 // for a blur with a radius >1 use a for loop instead and replace 2 with the real count - var/cellone = map[TRANSLATE_COORD(1, y)] - var/celltwo = map[TRANSLATE_COORD(2, y)] + var/first_coord = TRANSLATE_COORD(1, y) + var/second_coord = TRANSLATE_COORD(2, y) + var/cellone = map[first_coord] + var/celltwo = map[second_coord] total = cellone + celltwo - next_map[TRANSLATE_COORD(1, y)] = round(total / 2) + map[first_coord] = round(total / 2) // hardcoding x=2 also, to lower checks in the loop // larger radius would need to also cover all x < 1 + blur_radius total += map[TRANSLATE_COORD(3, y)] - next_map[TRANSLATE_COORD(2, y)] = round(total / 3) + map[second_coord] = round(total / 3) for(var/x = 3 to limit_x-1) // should technically be 2 + blur_radius to limit_x - blur_radius total -= map[TRANSLATE_COORD(x-2, y)] // x - blur_radius - 1 total += map[TRANSLATE_COORD(x+1, y)] // x + blur_radius - next_map[TRANSLATE_COORD(x, y)] = round(total / 3) // should technically be 2*blur_radius+1 + map[TRANSLATE_COORD(x, y)] = round(total / 3) // should technically be 2*blur_radius+1 // now do the same in the x axis - map = next_map.Copy() + // map = next_map.Copy() for(var/x = 1 to limit_x) // see comments above - var/cellone = map[TRANSLATE_COORD(x, 1)] - var/celltwo = map[TRANSLATE_COORD(x, 2)] + var/first_coord = TRANSLATE_COORD(x, 1) + var/second_coord = TRANSLATE_COORD(x, 2) + var/cellone = map[first_coord] + var/celltwo = map[second_coord] total = cellone + celltwo - next_map[TRANSLATE_COORD(x, 1)] = round(total / 2) + map[first_coord] = round(total / 2) // hardcoding x=2 also, to lower checks in the loop // larger radius would need to also cover all x < 1 + blur_radius total += map[TRANSLATE_COORD(x, 3)] - next_map[TRANSLATE_COORD(x, 2)] = round(total / 3) + map[second_coord] = round(total / 3) for(var/y = 3 to limit_y-1) total -= map[TRANSLATE_COORD(x, y-2)] total += map[TRANSLATE_COORD(x, y+1)] - next_map[TRANSLATE_COORD(x, y)] = round(total / 3) - map = next_map + map[TRANSLATE_COORD(x, y)] = round(total / 3) + // map = next_map + CHECK_TICK if(smooth_single_tiles) for(var/x in 1 to limit_x - 1) diff --git a/code/modules/random_map/noise/ore.dm b/code/modules/random_map/noise/ore.dm index f23e1c2cd01c..474ccc3687ab 100644 --- a/code/modules/random_map/noise/ore.dm +++ b/code/modules/random_map/noise/ore.dm @@ -153,7 +153,7 @@ /decl/material/solid/metal/silver = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX), /decl/material/solid/metal/uranium = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX), /decl/material/solid/metal/osmium = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX), - /decl/material/solid/rutile = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX) + /decl/material/solid/rutile = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX) ) deep_metals = list( /decl/material/solid/ice/aspium = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX), @@ -165,5 +165,5 @@ /decl/material/solid/gemstone/diamond = list(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX), /decl/material/solid/metal/osmium = list(RESOURCE_HIGH_MIN, RESOURCE_HIGH_MAX), /decl/material/solid/metallic_hydrogen = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX), - /decl/material/solid/rutile = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX) + /decl/material/solid/rutile = list(RESOURCE_MID_MIN, RESOURCE_MID_MAX) ) \ No newline at end of file diff --git a/code/modules/random_map/random_map.dm b/code/modules/random_map/random_map.dm index 37b952fd2839..ad1d3c26c0ec 100644 --- a/code/modules/random_map/random_map.dm +++ b/code/modules/random_map/random_map.dm @@ -104,14 +104,15 @@ var/global/list/map_count = list() if(!user) user = world - var/dat = "+------+
    " + var/dat = list("+------+
    ") for(var/x = 1, x <= limit_x, x++) for(var/y = 1, y <= limit_y, y++) var/current_cell = TRANSLATE_COORD(x,y) if(current_cell) dat += get_map_char(map[current_cell]) dat += "
    " - to_chat(user, "[dat]+------+
    ") + dat += "+------+
    " + to_chat(user, JOINTEXT(dat)) /datum/random_map/proc/set_map_size() map = list() @@ -189,8 +190,7 @@ var/global/list/map_count = list() return wall_type /datum/random_map/proc/get_additional_spawns(var/value, var/turf/T) - if(value == DOOR_CHAR) - new /obj/machinery/door/airlock(T) + // e.g. if(value == DOOR_CHAR) new /obj/machinery/door/airlock(T) /datum/random_map/proc/cleanup() return diff --git a/code/modules/reagents/Chemistry-Colours.dm b/code/modules/reagents/Chemistry-Colours.dm index 8a8da512b0a4..16d5d8ad9d62 100644 --- a/code/modules/reagents/Chemistry-Colours.dm +++ b/code/modules/reagents/Chemistry-Colours.dm @@ -3,17 +3,16 @@ if(!LAZYLEN(reagent_volumes)) cached_color = "#ffffffff" else if(LAZYLEN(reagent_volumes) == 1) // It's pretty common and saves a lot of work - var/decl/material/R = GET_DECL(reagent_volumes[1]) - cached_color = R.get_reagent_color(src) + num2hex(R.opacity * 255) + var/decl/material/reagent = reagent_volumes[1] + cached_color = reagent.get_reagent_color(src) + num2hex(reagent.opacity * 255) else var/list/colors = list(0, 0, 0, 0) var/tot_w = 0 - for(var/rtype in reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - if(R.color_weight <= 0) + for(var/decl/material/reagent as anything in reagent_volumes) + if(reagent.color_weight <= 0) continue - var/hex = uppertext(R.get_reagent_color(src)) + num2hex(R.opacity * 255) - var/mod = REAGENT_VOLUME(src, rtype) * R.color_weight + var/hex = uppertext(reagent.get_reagent_color(src)) + num2hex(reagent.opacity * 255) + var/mod = REAGENT_VOLUME(src, reagent) * reagent.color_weight colors[1] += HEX_RED(hex) * mod colors[2] += HEX_GREEN(hex) * mod colors[3] += HEX_BLUE(hex) * mod diff --git a/code/modules/reagents/Chemistry-Grinder.dm b/code/modules/reagents/Chemistry-Grinder.dm index b798bf9e4e6d..c5ff5f530bab 100644 --- a/code/modules/reagents/Chemistry-Grinder.dm +++ b/code/modules/reagents/Chemistry-Grinder.dm @@ -41,23 +41,23 @@ else icon_state = "[initial(icon_state)]" -/obj/machinery/reagentgrinder/attackby(var/obj/item/O, var/mob/user) +/obj/machinery/reagentgrinder/attackby(var/obj/item/used_item, var/mob/user) if((. = ..())) return - if(!istype(O)) + if(!istype(used_item)) return FALSE - if (istype(O,/obj/item/chems/glass) || \ - istype(O,/obj/item/chems/drinks/glass2) || \ - istype(O,/obj/item/chems/drinks/shaker)) + if (istype(used_item,/obj/item/chems/glass) || \ + istype(used_item,/obj/item/chems/drinks/glass2) || \ + istype(used_item,/obj/item/chems/drinks/shaker)) if(beaker) return TRUE else - if(!user.try_unequip(O, src)) + if(!user.try_unequip(used_item, src)) return FALSE - beaker = O + beaker = used_item update_icon() SSnano.update_uis(src) return FALSE @@ -66,52 +66,52 @@ to_chat(user, SPAN_NOTICE("\The [src] cannot hold any additional items.")) return TRUE - if(is_type_in_list(O, blacklisted_types)) - to_chat(user, SPAN_NOTICE("\The [src] cannot grind \the [O].")) + if(is_type_in_list(used_item, blacklisted_types)) + to_chat(user, SPAN_NOTICE("\The [src] cannot grind \the [used_item].")) return FALSE - if(is_type_in_list(O, bag_whitelist)) - if(O.storage) + if(is_type_in_list(used_item, bag_whitelist)) + if(used_item.storage) var/failed = TRUE - for(var/obj/item/G in O) + for(var/obj/item/G in used_item) if(!G.reagents || !G.reagents.total_volume) continue failed = FALSE - O.storage.remove_from_storage(user, G, src) + used_item.storage.remove_from_storage(user, G, src) holdingitems += G if(LAZYLEN(holdingitems) >= limit) break if(failed) - to_chat(user, SPAN_NOTICE("Nothing in \the [O] is usable.")) + to_chat(user, SPAN_NOTICE("Nothing in \the [used_item] is usable.")) return TRUE - O.storage.finish_bulk_removal() + used_item.storage.finish_bulk_removal() - if(!length(O.contents)) - to_chat(user, "You empty \the [O] into \the [src].") + if(!length(used_item.contents)) + to_chat(user, "You empty \the [used_item] into \the [src].") else - to_chat(user, "You fill \the [src] from \the [O].") + to_chat(user, "You fill \the [src] from \the [used_item].") SSnano.update_uis(src) return FALSE - if(O.w_class > item_size_limit) - to_chat(user, SPAN_NOTICE("\The [src] cannot fit \the [O].")) + if(used_item.w_class > item_size_limit) + to_chat(user, SPAN_NOTICE("\The [src] cannot fit \the [used_item].")) return - if(istype(O,/obj/item/stack/material)) - var/decl/material/material = O.get_material() + if(istype(used_item,/obj/item/stack/material)) + var/decl/material/material = used_item.get_material() if(!material) to_chat(user, SPAN_NOTICE("\The [material.solid_name] cannot be ground down to any usable reagents.")) return TRUE - else if(!O.reagents?.total_volume) - to_chat(user, SPAN_NOTICE("\The [O] is not suitable for grinding.")) + else if(!used_item.reagents?.total_volume) + to_chat(user, SPAN_NOTICE("\The [used_item] is not suitable for grinding.")) return TRUE - if(!user.try_unequip(O, src)) + if(!user.try_unequip(used_item, src)) return FALSE - holdingitems += O + holdingitems += used_item SSnano.update_uis(src) return FALSE @@ -128,14 +128,13 @@ data["beaker"] = !!beaker data["contents"] = list() - for(var/obj/item/O in holdingitems) - data["contents"] += "[capitalize(O.name)]" + for(var/obj/item/thing in holdingitems) + data["contents"] += "[capitalize(thing.name)]" data["beakercontents"] = list() if(beaker?.reagents) - for(var/rtype in beaker.reagents.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - data["beakercontents"] += "[capitalize(R.name)] ([REAGENT_VOLUME(beaker.reagents, rtype)]u)" + for(var/decl/material/reagent as anything in beaker.reagents.reagent_volumes) + data["beakercontents"] += "[capitalize(reagent.get_reagent_name(beaker.reagents))] ([REAGENT_VOLUME(beaker.reagents, reagent)]u)" ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) if(!ui) @@ -171,9 +170,9 @@ if (!LAZYLEN(holdingitems)) return FALSE - for(var/obj/item/O in holdingitems) - O.dropInto(loc) - holdingitems -= O + for(var/obj/item/thing in holdingitems) + thing.dropInto(loc) + holdingitems -= thing holdingitems.Cut() /obj/machinery/reagentgrinder/proc/grind(mob/user) @@ -196,13 +195,13 @@ var/skill_factor = CLAMP01(1 + 0.3*(user.get_skill_value(skill_to_check) - SKILL_EXPERT)/(SKILL_EXPERT - SKILL_MIN)) // Process. - for (var/obj/item/O in holdingitems) + for (var/obj/item/thing in holdingitems) var/remaining_volume = beaker.reagents.maximum_volume - beaker.reagents.total_volume if(remaining_volume <= 0) break - var/obj/item/stack/material/stack = O + var/obj/item/stack/material/stack = thing if(istype(stack)) var/decl/material/material = stack.get_material() if(!material) @@ -216,10 +215,10 @@ beaker.add_to_reagents(material.type, (amount_to_take * REAGENT_UNITS_PER_MATERIAL_SHEET * skill_factor)) continue - else if(O.reagents) - O.reagents.trans_to(beaker, O.reagents.total_volume, skill_factor) - holdingitems -= O - qdel(O) + else if(thing.reagents) + thing.reagents.trans_to(beaker, thing.reagents.total_volume, skill_factor) + holdingitems -= thing + qdel(thing) /obj/machinery/reagentgrinder/proc/end_grind(mob/user) inuse = FALSE diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 9c2063ed6cb3..20945f4c36da 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -1,11 +1,11 @@ var/global/obj/temp_reagents_holder = new var/global/datum/reagents/sink/infinite_reagent_sink = new -/atom/proc/add_to_reagents(reagent_type, amount, data, safety = FALSE, defer_update = FALSE, phase = null) - return reagents?.add_reagent(reagent_type, amount, data, safety, defer_update, phase) +/atom/proc/add_to_reagents(decl/material/reagent, amount, data, safety = FALSE, defer_update = FALSE, phase = null) + return reagents?.add_reagent(reagent, amount, data, safety, defer_update, phase) -/atom/proc/remove_from_reagents(reagent_type, amount, safety = FALSE, defer_update = FALSE) - return reagents?.remove_reagent(reagent_type, amount, safety, defer_update) +/atom/proc/remove_from_reagents(decl/material/reagent, amount, safety = FALSE, defer_update = FALSE) + return reagents?.remove_reagent(reagent, amount, safety, defer_update) /atom/proc/remove_any_reagents(amount = 1, defer_update = FALSE, removed_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID), skip_reagents = null) return reagents?.remove_any(amount, defer_update, removed_phases, skip_reagents) @@ -131,7 +131,7 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new return primary_reagent /datum/reagents/proc/get_primary_reagent_decl() - return GET_DECL(primary_reagent) + return RESOLVE_TO_DECL(primary_reagent) /datum/reagents/proc/update_total() // Updates volume. total_volume = 0 @@ -140,32 +140,32 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new reagent_volumes = list() primary_liquid = null - for(var/R in liquid_volumes) - var/vol = CHEMS_QUANTIZE(liquid_volumes[R]) + for(var/decl/material/reagent as anything in liquid_volumes) + var/vol = CHEMS_QUANTIZE(liquid_volumes[reagent]) if(vol < MINIMUM_CHEMICAL_VOLUME) - clear_reagent(R, defer_update = TRUE, force = TRUE) // defer_update is important to avoid infinite recursion + clear_reagent(reagent, defer_update = TRUE, force = TRUE) // defer_update is important to avoid infinite recursion else - LAZYSET(liquid_volumes, R, vol) - LAZYSET(reagent_volumes, R, vol) + LAZYSET(liquid_volumes, reagent, vol) + LAZYSET(reagent_volumes, reagent, vol) total_volume += vol total_liquid_volume += vol if(!primary_liquid || liquid_volumes[primary_liquid] < vol) - primary_liquid = R + primary_liquid = reagent primary_solid = null - for(var/R in solid_volumes) - var/vol = CHEMS_QUANTIZE(solid_volumes[R]) + for(var/decl/material/reagent as anything in solid_volumes) + var/vol = CHEMS_QUANTIZE(solid_volumes[reagent]) if(vol < MINIMUM_CHEMICAL_VOLUME) - clear_reagent(R, defer_update = TRUE, force = TRUE) + clear_reagent(reagent, defer_update = TRUE, force = TRUE) else - LAZYSET(solid_volumes, R, vol) - if(!reagent_volumes?[R]) - LAZYSET(reagent_volumes, R, vol) + LAZYSET(solid_volumes, reagent, vol) + if(!reagent_volumes?[reagent]) + LAZYSET(reagent_volumes, reagent, vol) else - reagent_volumes[R] += vol + reagent_volumes[reagent] += vol total_volume += vol if(!primary_solid || (solid_volumes[primary_solid] < vol)) - primary_solid = R + primary_solid = reagent if(solid_volumes?[primary_solid] > liquid_volumes?[primary_liquid]) primary_reagent = primary_solid @@ -190,8 +190,7 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new var/list/eligible_reactions = list() var/temperature = location?.temperature || T20C - for(var/thing in reagent_volumes) - var/decl/material/R = GET_DECL(thing) + for(var/decl/material/reagent as anything in reagent_volumes) // Check if the reagent is decaying or not. var/list/replace_self_with @@ -199,33 +198,32 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new var/replace_sound if(!(check_flags & ATOM_FLAG_NO_PHASE_CHANGE)) - if(!isnull(R.chilling_point) && LAZYLEN(R.chilling_products) && temperature <= R.chilling_point) - replace_self_with = R.chilling_products - if(R.chilling_message) - replace_message = "\The [R.get_reagent_name(src)] [R.chilling_message]" - replace_sound = R.chilling_sound - else if(!isnull(R.heating_point) && LAZYLEN(R.heating_products) && temperature >= R.heating_point) - replace_self_with = R.heating_products - if(R.heating_message) - replace_message = "\The [R.get_reagent_name(src)] [R.heating_message]" - replace_sound = R.heating_sound - - if(isnull(replace_self_with) && !isnull(R.dissolves_in) && !(check_flags & ATOM_FLAG_NO_DISSOLVE) && LAZYLEN(R.dissolves_into)) - for(var/other in reagent_volumes) - if(other == thing) + if(!isnull(reagent.chilling_point) && LAZYLEN(reagent.chilling_products) && temperature <= reagent.chilling_point) + replace_self_with = reagent.chilling_products + if(reagent.chilling_message) + replace_message = "\The [reagent.get_reagent_name(src)] [reagent.chilling_message]" + replace_sound = reagent.chilling_sound + else if(!isnull(reagent.heating_point) && LAZYLEN(reagent.heating_products) && temperature >= reagent.heating_point) + replace_self_with = reagent.heating_products + if(reagent.heating_message) + replace_message = "\The [reagent.get_reagent_name(src)] [reagent.heating_message]" + replace_sound = reagent.heating_sound + + if(isnull(replace_self_with) && !isnull(reagent.dissolves_in) && !(check_flags & ATOM_FLAG_NO_DISSOLVE) && LAZYLEN(reagent.dissolves_into)) + for(var/decl/material/solvent as anything in reagent_volumes) + if(solvent == reagent) continue - var/decl/material/solvent = GET_DECL(other) - if(solvent.solvent_power >= R.dissolves_in) - replace_self_with = R.dissolves_into - if(R.dissolve_message) - replace_message = "\The [R.get_reagent_name(src)] [R.dissolve_message] \the [solvent.get_reagent_name(src)]." - replace_sound = R.dissolve_sound + if(solvent.solvent_power >= reagent.dissolves_in) + replace_self_with = reagent.dissolves_into + if(reagent.dissolve_message) + replace_message = "\The [reagent.get_reagent_name(src)] [reagent.dissolve_message] \the [solvent.get_reagent_name(src)]." + replace_sound = reagent.dissolve_sound break // If it is, handle replacing it with the decay product. if(replace_self_with) - var/replace_amount = REAGENT_VOLUME(src, R.type) - clear_reagent(R.type) + var/replace_amount = REAGENT_VOLUME(src, reagent) + clear_reagent(reagent) for(var/product in replace_self_with) add_reagent(product, replace_self_with[product] * replace_amount) reaction_occurred = TRUE @@ -237,7 +235,7 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new playsound(location, replace_sound, 80, 1) else if(!(check_flags & ATOM_FLAG_NO_REACT)) // Otherwise, collect all possible reactions. - eligible_reactions |= SSmaterials.chemical_reactions_by_id[R.type] + eligible_reactions |= SSmaterials.chemical_reactions_by_id[reagent.type] if(!(check_flags & ATOM_FLAG_NO_REACT)) var/list/active_reactions = list() @@ -251,14 +249,14 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new // if two reactions share a reagent, each is allocated half of it, so we compute this here for(var/decl/chemical_reaction/reaction in active_reactions) var/list/adding = reaction.get_used_reagents() - for(var/R in adding) - LAZYADD(used_reagents[R], reaction) + for(var/reagent in adding) + LAZYADD(used_reagents[reagent], reaction) - for(var/R in used_reagents) - var/counter = length(used_reagents[R]) + for(var/reagent in used_reagents) + var/counter = length(used_reagents[reagent]) if(counter <= 1) continue // Only used by one reaction, so nothing we need to do. - for(var/decl/chemical_reaction/reaction in used_reagents[R]) + for(var/decl/chemical_reaction/reaction in used_reagents[reagent]) active_reactions[reaction] = max(counter, active_reactions[reaction]) counter-- //so the next reaction we execute uses more of the remaining reagents // Note: this is not guaranteed to maximize the size of the reactions we do (if one reaction is limited by reagent A, we may be over-allocating reagent B to it) @@ -296,19 +294,19 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new my_atom?.try_on_reagent_change() handle_update() -/datum/reagents/proc/add_reagent(var/reagent_type, var/amount, var/data = null, var/safety = 0, var/defer_update = FALSE, var/phase) +/datum/reagents/proc/add_reagent(var/decl/material/reagent, var/amount, var/data = null, var/safety = 0, var/defer_update = FALSE, var/phase) amount = CHEMS_QUANTIZE(min(amount, REAGENTS_FREE_SPACE(src))) if(amount <= 0) return FALSE - var/decl/material/newreagent = GET_DECL(reagent_type) - if(!istype(newreagent)) + reagent = RESOLVE_TO_DECL(reagent) + if(!istype(reagent)) return FALSE if(!phase) // By default, assume the reagent phase at STP. - phase = newreagent.phase_at_temperature() + phase = reagent.phase_at_temperature() // Assume it's in solution, somehow. if(phase == MAT_PHASE_GAS) phase = MAT_PHASE_LIQUID @@ -321,23 +319,23 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new LAZYINITLIST(solid_volumes) phase_volumes = solid_volumes - if(!phase_volumes[reagent_type]) - phase_volumes[reagent_type] = amount + if(!phase_volumes[reagent]) + phase_volumes[reagent] = amount else - phase_volumes[reagent_type] += amount + phase_volumes[reagent] += amount LAZYINITLIST(reagent_volumes) - if(!reagent_volumes[reagent_type]) - reagent_volumes[reagent_type] = amount - var/tmp_data = newreagent.initialize_data(data) + if(!reagent_volumes[reagent]) + reagent_volumes[reagent] = amount + var/tmp_data = reagent.initialize_data(data) if(tmp_data) - LAZYSET(reagent_data, reagent_type, tmp_data) + LAZYSET(reagent_data, reagent, tmp_data) if(reagent_volumes.len == 1) // if this is the first reagent, uncache color cached_color = null else - reagent_volumes[reagent_type] += amount + reagent_volumes[reagent] += amount if(!isnull(data)) - LAZYSET(reagent_data, reagent_type, newreagent.mix_data(src, data, amount)) + LAZYSET(reagent_data, reagent, reagent.mix_data(src, data, amount)) if(reagent_volumes.len > 1) // otherwise if we have a mix of reagents, uncache as well cached_color = null @@ -350,22 +348,26 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new handle_update(safety) return TRUE -/datum/reagents/proc/remove_reagent(var/reagent_type, var/amount, var/safety = 0, var/defer_update = FALSE, var/removed_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) +/datum/reagents/proc/remove_reagent(var/decl/material/reagent, var/amount, var/safety = 0, var/defer_update = FALSE, var/removed_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) amount = CHEMS_QUANTIZE(amount) - if(!isnum(amount) || amount <= 0 || REAGENT_VOLUME(src, reagent_type) <= 0) + if(!isnum(amount) || amount <= 0 || REAGENT_VOLUME(src, reagent) <= 0) + return FALSE + + reagent = RESOLVE_TO_DECL(reagent) + if(!istype(reagent)) return FALSE var/removed = 0 - if((removed_phases & MAT_PHASE_LIQUID) && LIQUID_VOLUME(src, reagent_type) > 0) + if((removed_phases & MAT_PHASE_LIQUID) && LIQUID_VOLUME(src, reagent) > 0) - removed += min(liquid_volumes[reagent_type], amount) - liquid_volumes[reagent_type] -= removed + removed += min(liquid_volumes[reagent], amount) + liquid_volumes[reagent] -= removed // If both liquid and solid reagents are being removed, we prioritize the liquid reagents. - if((removed < amount) && (removed_phases & MAT_PHASE_SOLID) && SOLID_VOLUME(src, reagent_type) > 0) + if((removed < amount) && (removed_phases & MAT_PHASE_SOLID) && SOLID_VOLUME(src, reagent) > 0) - var/solid_removed = min(solid_volumes[reagent_type], amount - removed) - solid_volumes[reagent_type] -= solid_removed + var/solid_removed = min(solid_volumes[reagent], amount - removed) + solid_volumes[reagent] -= solid_removed removed += solid_removed @@ -381,21 +383,26 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new handle_update(safety) return TRUE -/datum/reagents/proc/clear_reagent(var/reagent_type, var/defer_update = FALSE, var/force = FALSE) - . = force || !!REAGENT_DATA(src, reagent_type) || !!REAGENT_VOLUME(src, reagent_type) +/datum/reagents/proc/clear_reagent(var/decl/material/reagent, var/defer_update = FALSE, var/force = FALSE) + + reagent = RESOLVE_TO_DECL(reagent) + if(!istype(reagent)) + return FALSE + + . = force || !!REAGENT_DATA(src, reagent) || !!REAGENT_VOLUME(src, reagent) if(.) - var/amount = LAZYACCESS(reagent_volumes, reagent_type) - LAZYREMOVE(liquid_volumes, reagent_type) - LAZYREMOVE(solid_volumes, reagent_type) + var/amount = LAZYACCESS(reagent_volumes, reagent) + LAZYREMOVE(liquid_volumes, reagent) + LAZYREMOVE(solid_volumes, reagent) - LAZYREMOVE(reagent_volumes, reagent_type) - LAZYREMOVE(reagent_data, reagent_type) - if(primary_reagent == reagent_type) + LAZYREMOVE(reagent_volumes, reagent) + LAZYREMOVE(reagent_data, reagent) + if(primary_reagent == reagent) primary_reagent = null - if(primary_liquid == reagent_type) + if(primary_liquid == reagent) primary_liquid = null - if(primary_solid == reagent_type) + if(primary_solid == reagent) primary_solid = null cached_color = null @@ -404,15 +411,18 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new else handle_update() -/datum/reagents/proc/has_reagent(var/reagent_type, var/amount, var/phases) +/datum/reagents/proc/has_reagent(var/decl/material/reagent, var/amount, var/phases) . = 0 + reagent = RESOLVE_TO_DECL(reagent) + if(!istype(reagent)) + return if(phases) if(phases & MAT_PHASE_SOLID) - . += SOLID_VOLUME(src, reagent_type) + . += SOLID_VOLUME(src, reagent) if(phases & MAT_PHASE_LIQUID) - . += LIQUID_VOLUME(src, reagent_type) + . += LIQUID_VOLUME(src, reagent) else - . = REAGENT_VOLUME(src, reagent_type) + . = REAGENT_VOLUME(src, reagent) if(. && amount) . = (. >= amount) @@ -425,12 +435,12 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new /datum/reagents/proc/has_all_reagents(var/list/check_reagents, var/phases) . = TRUE for(var/check in check_reagents) - . = min(., has_reagent(check, check_reagents[check], phases)) + . = min(., has_reagent(RESOLVE_TO_DECL(check), check_reagents[check], phases)) if(!.) return /datum/reagents/proc/clear_reagents() - for(var/reagent in reagent_volumes) + for(var/decl/material/reagent as anything in reagent_volumes) clear_reagent(reagent, defer_update = TRUE) LAZYCLEARLIST(liquid_volumes) @@ -440,43 +450,39 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new total_volume = 0 my_atom?.try_on_reagent_change() -/datum/reagents/proc/get_overdose(var/decl/material/current) - if(current) - return initial(current.overdose) +/datum/reagents/proc/get_overdose(var/decl/material/reagent) + if(reagent) + return initial(reagent.overdose) return 0 /datum/reagents/proc/get_reagents(scannable_only = 0, precision) . = list() - for(var/rtype in liquid_volumes) - var/decl/material/current= GET_DECL(rtype) - if(scannable_only && !current.scannable) + for(var/decl/material/reagent as anything in liquid_volumes) + if(scannable_only && !reagent.scannable) continue - var/volume = REAGENT_VOLUME(src, rtype) + var/volume = REAGENT_VOLUME(src, reagent) if(precision) volume = round(volume, precision) if(volume) - . += "[current.get_reagent_name(src, MAT_PHASE_LIQUID)] ([volume])" - for(var/rtype in solid_volumes) - var/decl/material/current= GET_DECL(rtype) - if(scannable_only && !current.scannable) + . += "[reagent.get_reagent_name(src, MAT_PHASE_LIQUID)] ([volume])" + for(var/decl/material/reagent as anything in solid_volumes) + if(scannable_only && !reagent.scannable) continue - var/volume = REAGENT_VOLUME(src, rtype) + var/volume = REAGENT_VOLUME(src, reagent) if(precision) volume = round(volume, precision) if(volume) - . += "[current.get_reagent_name(src, MAT_PHASE_SOLID)] ([volume])" + . += "[reagent.get_reagent_name(src, MAT_PHASE_SOLID)] ([volume])" return english_list(., "EMPTY", "", ", ", ", ") /datum/reagents/proc/get_dirtiness() - for(var/rtype in reagent_volumes) - var/decl/material/current = GET_DECL(rtype) - . += current.dirtiness + for(var/decl/material/reagent as anything in reagent_volumes) + . += reagent.dirtiness return . / length(reagent_volumes) /datum/reagents/proc/get_accelerant_value() - for(var/rtype in reagent_volumes) - var/decl/material/current = GET_DECL(rtype) - . += current.accelerant_value + for(var/decl/material/reagent as anything in reagent_volumes) + . += reagent.accelerant_value return . / length(reagent_volumes) /* Holder-to-holder and similar procs */ @@ -530,14 +536,14 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new var/failed_remove = FALSE while(removing >= MINIMUM_CHEMICAL_VOLUME && total_volume >= MINIMUM_CHEMICAL_VOLUME && !failed_remove) failed_remove = TRUE - for(var/current in removing_volumes) - var/removing_amt = min(CHEMS_QUANTIZE(removing_volumes[current] * part), removing) + for(var/decl/material/reagent as anything in removing_volumes) + var/removing_amt = min(CHEMS_QUANTIZE(removing_volumes[reagent] * part), removing) if(removing_amt <= 0) continue failed_remove = FALSE removing -= removing_amt . += removing_amt - remove_reagent(current, removing_amt, TRUE, TRUE, removed_phases = removed_phases) + remove_reagent(reagent, removing_amt, TRUE, TRUE, removed_phases = removed_phases) if(!defer_update) handle_update() @@ -558,8 +564,8 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new var/part = amount if(skip_reagents) var/using_volume = total_volume - for(var/rtype in skip_reagents) - using_volume -= LAZYACCESS(reagent_volumes, rtype) + for(var/reagent in skip_reagents) + using_volume -= LAZYACCESS(reagent_volumes, reagent) if(using_volume <= 0) return 0 part /= using_volume @@ -572,28 +578,28 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new part /= using_volume . = 0 - for(var/rtype in reagent_volumes - skip_reagents) - var/amount_to_transfer = CHEMS_QUANTIZE(REAGENT_VOLUME(src, rtype) * part) + for(var/decl/material/reagent as anything in reagent_volumes - skip_reagents) + var/amount_to_transfer = CHEMS_QUANTIZE(REAGENT_VOLUME(src, reagent) * part) // Prioritize liquid transfers if(transferred_phases & MAT_PHASE_LIQUID) - var/liquid_transferred = min(amount_to_transfer, CHEMS_QUANTIZE(LIQUID_VOLUME(src, rtype))) - target.add_reagent(rtype, liquid_transferred * multiplier, REAGENT_DATA(src, rtype), TRUE, TRUE, MAT_PHASE_LIQUID) // We don't react until everything is in place + var/liquid_transferred = min(amount_to_transfer, CHEMS_QUANTIZE(LIQUID_VOLUME(src, reagent))) + target.add_reagent(reagent, liquid_transferred * multiplier, REAGENT_DATA(src, reagent), TRUE, TRUE, MAT_PHASE_LIQUID) // We don't react until everything is in place . += liquid_transferred amount_to_transfer -= liquid_transferred if(!copy) - remove_reagent(rtype, liquid_transferred, TRUE, TRUE, MAT_PHASE_LIQUID) + remove_reagent(reagent, liquid_transferred, TRUE, TRUE, MAT_PHASE_LIQUID) if(transferred_phases & MAT_PHASE_SOLID) - var/solid_transferred = (min(amount_to_transfer, CHEMS_QUANTIZE(SOLID_VOLUME(src, rtype)))) - target.add_reagent(rtype, solid_transferred * multiplier, REAGENT_DATA(src, rtype), TRUE, TRUE, MAT_PHASE_SOLID) // Ditto + var/solid_transferred = (min(amount_to_transfer, CHEMS_QUANTIZE(SOLID_VOLUME(src, reagent)))) + target.add_reagent(reagent, solid_transferred * multiplier, REAGENT_DATA(src, reagent), TRUE, TRUE, MAT_PHASE_SOLID) // Ditto . += solid_transferred amount_to_transfer -= solid_transferred if(!copy) - remove_reagent(rtype, solid_transferred, TRUE, TRUE, MAT_PHASE_SOLID) + remove_reagent(reagent, solid_transferred, TRUE, TRUE, MAT_PHASE_SOLID) // Due to rounding, we may have taken less than we wanted. @@ -681,14 +687,14 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new return//Nowhere to splash to, somehow //Create a temporary holder to hold all the amount that will be spread - var/datum/reagents/R = new /datum/reagents(total_volume * portion * multiplier, global.temp_reagents_holder) - trans_to_holder(R, total_volume * portion, multiplier, copy) + var/datum/reagents/reagent = new /datum/reagents(total_volume * portion * multiplier, global.temp_reagents_holder) + trans_to_holder(reagent, total_volume * portion, multiplier, copy) //The exact amount that will be given to each turf - var/turfportion = R.total_volume / turfs.len + var/turfportion = reagent.total_volume / turfs.len for (var/turf/T in turfs) - R.splash_turf(T, amount = turfportion, multiplier = 1, copy = FALSE) - qdel(R) + reagent.splash_turf(T, amount = turfportion, multiplier = 1, copy = FALSE) + qdel(reagent) //Spreads the contents of this reagent holder all over the target turf, dividing among things in it. //50% is divided between mobs, 20% between objects, and whatever's left on the turf itself @@ -810,18 +816,16 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new /datum/reagents/proc/touch_mob(mob/target) if(!target || !istype(target) || !target.simulated) return - for(var/rtype in reagent_volumes) - var/decl/material/current = GET_DECL(rtype) - current.touch_mob(target, REAGENT_VOLUME(src, rtype), src) + for(var/decl/material/reagent as anything in reagent_volumes) + reagent.touch_mob(target, REAGENT_VOLUME(src, reagent), src) /datum/reagents/proc/touch_turf(turf/touching_turf, touch_atoms = TRUE) if(!istype(touching_turf) || !touching_turf.simulated) return - for(var/rtype in reagent_volumes) - var/decl/material/current = GET_DECL(rtype) - current.touch_turf(touching_turf, REAGENT_VOLUME(src, rtype), src) + for(var/decl/material/reagent as anything in reagent_volumes) + reagent.touch_turf(touching_turf, REAGENT_VOLUME(src, reagent), src) var/dirtiness = get_dirtiness() if(dirtiness <= DIRTINESS_CLEAN) @@ -848,9 +852,8 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new /datum/reagents/proc/touch_obj(obj/target) if(!target || !istype(target) || !target.simulated) return - for(var/rtype in reagent_volumes) - var/decl/material/current = GET_DECL(rtype) - current.touch_obj(target, REAGENT_VOLUME(src, rtype), src) + for(var/decl/material/reagent as anything in reagent_volumes) + reagent.touch_obj(target, REAGENT_VOLUME(src, reagent), src) // Attempts to place a reagent on the mob's skin. // Reagents are not guaranteed to transfer to the target. @@ -868,25 +871,25 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new if(isliving(target)) var/mob/living/L = target if(type == CHEM_INJECT) - var/datum/reagents/R = L.get_injected_reagents() - if(R) - return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) + var/datum/reagents/reagent = L.get_injected_reagents() + if(reagent) + return trans_to_holder(reagent, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) if(type == CHEM_INGEST) - var/datum/reagents/R = L.get_ingested_reagents() - if(R) - return L.ingest(src, R, amount, multiplier, copy) //perhaps this is a bit of a hack, but currently there's no common proc for eating reagents + var/datum/reagents/reagent = L.get_ingested_reagents() + if(reagent) + return L.ingest(src, reagent, amount, multiplier, copy) //perhaps this is a bit of a hack, but currently there's no common proc for eating reagents if(type == CHEM_TOUCH) - var/datum/reagents/R = L.get_contact_reagents() - if(R) - return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) + var/datum/reagents/reagent = L.get_contact_reagents() + if(reagent) + return trans_to_holder(reagent, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) if(type == CHEM_INHALE) - var/datum/reagents/R = L.get_inhaled_reagents() - if(R) - return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) - var/datum/reagents/R = new /datum/reagents(amount, global.temp_reagents_holder) - . = trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = transferred_phases) - R.touch_mob(target) - qdel(R) + var/datum/reagents/reagent = L.get_inhaled_reagents() + if(reagent) + return trans_to_holder(reagent, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) + var/datum/reagents/reagent = new /datum/reagents(amount, global.temp_reagents_holder) + . = trans_to_holder(reagent, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = transferred_phases) + reagent.touch_mob(target) + qdel(reagent) /datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) if(!target?.simulated) @@ -895,11 +898,11 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new // If we're only dumping solids, and there's not enough liquid present on the turf to make a slurry, we dump the solids directly. // This avoids creating an unnecessary reagent holder that won't be immediately deleted. if((!(transferred_phases & MAT_PHASE_LIQUID) || !total_liquid_volume) && (target.reagents?.total_liquid_volume < FLUID_SLURRY)) - var/datum/reagents/R = new /datum/reagents(amount, global.temp_reagents_holder) - . = trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = MAT_PHASE_SOLID) - R.touch_turf(target) - target.dump_solid_reagents(R) - qdel(R) + var/datum/reagents/reagent = new /datum/reagents(amount, global.temp_reagents_holder) + . = trans_to_holder(reagent, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = MAT_PHASE_SOLID) + reagent.touch_turf(target) + target.dump_solid_reagents(reagent) + qdel(reagent) return if(!target.reagents) @@ -917,19 +920,18 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new return 0 if(!target.reagents) - var/datum/reagents/R = new /datum/reagents(amount * multiplier, global.temp_reagents_holder) - . = trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = transferred_phases) - R.touch_obj(target) - qdel(R) + var/datum/reagents/reagent = new /datum/reagents(amount * multiplier, global.temp_reagents_holder) + . = trans_to_holder(reagent, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = transferred_phases) + reagent.touch_obj(target) + qdel(reagent) return return trans_to_holder(target.reagents, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) /datum/reagents/proc/get_skimmable_reagents() - for(var/mat in reagent_volumes) - var/decl/material/reagent = GET_DECL(mat) + for(var/decl/material/reagent as anything in reagent_volumes) if(reagent.skimmable) - LAZYADD(., mat) + LAZYADD(., reagent) /// Used to return strings like "dilute blood" for use in phrases like "It's covered in dilute oily slimy bloody mud!" /// This is explicitly inspired by Caves of Qud, by the way. @@ -942,10 +944,9 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new var/list/volumes_temp = sortTim(reagent_volumes.Copy(), /proc/cmp_numeric_asc, associative = TRUE) var/list/accumulator = list() var/decl/material/primary_reagent_decl = get_primary_reagent_decl() // this also sets src.primary_reagent to the typepath - for(var/reagent_type in volumes_temp) - if(reagent_type == primary_reagent) + for(var/decl/material/reagent as anything in volumes_temp) + if(reagent == primary_reagent) continue // added later - var/decl/material/reagent = GET_DECL(reagent_type) reagent.build_coated_name(src, accumulator) if(length(accumulator) >= MAX_COATING_NAMES) break @@ -968,8 +969,7 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new // todo: maybe at some point we could make staining have some kind of priority to sort by? var/list/volumes_temp = sortTim(reagent_volumes.Copy(), /proc/cmp_numeric_asc, associative = TRUE) var/list/accumulator = list() - for(var/reagent_type in volumes_temp) - var/decl/material/reagent = GET_DECL(reagent_type) + for(var/decl/material/reagent in volumes_temp) var/coated_name = reagent.get_coated_adjective(src) accumulator |= coated_name if(length(accumulator) >= MAX_COATING_ADJECTIVES) @@ -990,12 +990,11 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new /// Infinite reagent sink: nothing is ever actually added to it, useful for complex, filtered deletion of reagents without holder churn. /datum/reagents/sink -/datum/reagents/sink/add_reagent(reagent_type, amount, data, safety, defer_update, phase) +/datum/reagents/sink/add_reagent(var/decl/material/reagent, amount, data, safety, defer_update, phase) amount = CHEMS_QUANTIZE(min(amount, REAGENTS_FREE_SPACE(src))) if(amount <= 0) return FALSE - - var/decl/material/newreagent = GET_DECL(reagent_type) - if(!istype(newreagent)) + reagent = RESOLVE_TO_DECL(reagent) + if(!istype(reagent)) return FALSE return TRUE diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index d7c1f8cc4081..e2cf9e4abe10 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -38,33 +38,33 @@ /obj/machinery/chem_master/proc/get_remaining_volume() return clamp(reagent_limit - reagents.total_volume, 0, reagent_limit) -/obj/machinery/chem_master/attackby(var/obj/item/B, var/mob/user) +/obj/machinery/chem_master/attackby(var/obj/item/used_item, var/mob/user) - if(istype(B, /obj/item/chems/glass)) + if(istype(used_item, /obj/item/chems/glass)) if(beaker) to_chat(user, SPAN_WARNING("A beaker is already loaded into the machine.")) return TRUE - if(!user.try_unequip(B, src)) + if(!user.try_unequip(used_item, src)) return TRUE - beaker = B + beaker = used_item to_chat(user, SPAN_NOTICE("You add the beaker to the machine!")) updateUsrDialog() icon_state = "mixer1" return TRUE - if(istype(B, /obj/item/chems)) + if(istype(used_item, /obj/item/chems)) to_chat(user, SPAN_WARNING("\The [src] will only accept beakers.")) return TRUE - if(istype(B, /obj/item/pill_bottle)) + if(istype(used_item, /obj/item/pill_bottle)) if(loaded_pill_bottle) to_chat(user, SPAN_WARNING("A pill bottle is already loaded into the machine.")) return TRUE - if(!user.try_unequip(B, src)) + if(!user.try_unequip(used_item, src)) return TRUE - loaded_pill_bottle = B + loaded_pill_bottle = used_item to_chat(user, SPAN_NOTICE("You add the pill bottle into the dispenser slot!")) updateUsrDialog() return TRUE @@ -223,8 +223,7 @@ /obj/machinery/chem_master/proc/fetch_contaminants(mob/user, datum/reagents/reagents, decl/material/main_reagent) . = list() - for(var/rtype in reagents.reagent_volumes) - var/decl/material/reagent = GET_DECL(rtype) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) if(reagent != main_reagent && prob(user.skill_fail_chance(core_skill, 100))) . += reagent @@ -291,27 +290,25 @@ dat += "Beaker is empty." else dat += "Add to buffer:
    " - for(var/rtype in R.reagent_volumes) - var/decl/material/G = GET_DECL(rtype) - dat += "[G.use_name], [REAGENT_VOLUME(R, rtype)] Units - " - dat += "(Analyze) " - dat += "(1) " - dat += "(5) " - dat += "(10) " - dat += "(All) " - dat += "(Custom)
    " + for(var/decl/material/reagent as anything in R.reagent_volumes) + dat += "[reagent.use_name], [REAGENT_VOLUME(R, reagent)] Units - " + dat += "(Analyze) " + dat += "(1) " + dat += "(5) " + dat += "(10) " + dat += "(All) " + dat += "(Custom)
    " dat += "
    Transfer to [(!mode ? "disposal" : "beaker")]:
    " if(reagents.total_volume) - for(var/rtype in reagents.reagent_volumes) - var/decl/material/N = GET_DECL(rtype) - dat += "[N.use_name], [REAGENT_VOLUME(reagents, rtype)] Units - " - dat += "(Analyze) " - dat += "(1) " - dat += "(5) " - dat += "(10) " - dat += "(All) " - dat += "(Custom)
    " + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + dat += "[reagent.use_name], [REAGENT_VOLUME(reagents, reagent)] Units - " + dat += "(Analyze) " + dat += "(1) " + dat += "(5) " + dat += "(10) " + dat += "(All) " + dat += "(Custom)
    " else dat += "Empty
    " dat += extra_options() diff --git a/code/modules/reagents/Chemistry-Metabolism.dm b/code/modules/reagents/Chemistry-Metabolism.dm index 9c78f190ca2f..f15b50662785 100644 --- a/code/modules/reagents/Chemistry-Metabolism.dm +++ b/code/modules/reagents/Chemistry-Metabolism.dm @@ -2,11 +2,11 @@ var/metabolism_class //CHEM_TOUCH, CHEM_INGEST, or CHEM_INJECT var/mob/living/parent -/datum/reagents/metabolism/clear_reagent(var/reagent_type, var/defer_update = FALSE, var/force = FALSE) +/datum/reagents/metabolism/clear_reagent(var/decl/material/reagent, var/defer_update = FALSE, var/force = FALSE) // Duplicated check so that reagent data is accessible in on_leaving_metabolism. - if(force || !!(REAGENT_VOLUME(src, reagent_type) || REAGENT_DATA(src, reagent_type))) - var/decl/material/current = GET_DECL(reagent_type) - current.on_leaving_metabolism(src) + reagent = RESOLVE_TO_DECL(reagent) + if(force || !!(REAGENT_VOLUME(src, reagent) || REAGENT_DATA(src, reagent))) + reagent.on_leaving_metabolism(src) . = ..() /datum/reagents/metabolism/New(var/max = 100, mob/living/parent_mob, var/met_class) @@ -23,7 +23,6 @@ /datum/reagents/metabolism/proc/metabolize(list/dosage_tracker) if(!parent || total_volume < MINIMUM_CHEMICAL_VOLUME || !length(reagent_volumes)) return - for(var/rtype in reagent_volumes) - var/decl/material/current = GET_DECL(rtype) - current.on_mob_life(parent, metabolism_class, src, dosage_tracker) + for(var/decl/material/reagent as anything in reagent_volumes) + reagent.on_mob_life(parent, metabolism_class, src, dosage_tracker) update_total() diff --git a/code/modules/reagents/Chemistry-Taste.dm b/code/modules/reagents/Chemistry-Taste.dm index 73b25e51cd5c..959f790b398c 100644 --- a/code/modules/reagents/Chemistry-Taste.dm +++ b/code/modules/reagents/Chemistry-Taste.dm @@ -48,9 +48,8 @@ calculate text size per text. /datum/reagents/proc/get_taste_list(datum/reagents/source_holder) var/list/tastes = list() //descriptor = strength - for(var/reagent_type in reagent_volumes) - var/decl/material/reagent = GET_DECL(reagent_type) - var/list/nutriment_data = LAZYACCESS(reagent_data, reagent_type) + for(var/decl/material/reagent as anything in reagent_volumes) + var/list/nutriment_data = LAZYACCESS(reagent_data, reagent) var/list/taste_data = LAZYACCESS(nutriment_data, DATA_TASTE) if(length(taste_data)) for(var/taste in taste_data) diff --git a/code/modules/reagents/chems/chems_alcohol.dm b/code/modules/reagents/chems/chems_alcohol.dm index b218183a818c..8580983b784a 100644 --- a/code/modules/reagents/chems/chems_alcohol.dm +++ b/code/modules/reagents/chems/chems_alcohol.dm @@ -51,9 +51,9 @@ ..() M.add_chemical_effect(CE_ALCOHOL, 1) - var/strength_mod = (M.GetTraitLevel(/decl/trait/malus/ethanol) * 2.5) || 1 + var/strength_mod = (M.get_trait_level(/decl/trait/malus/ethanol) * 2.5) || 1 - var/effective_dose = LAZYACCESS(M.chem_doses, type) * strength_mod * (1 + REAGENT_VOLUME(holder, type)/60) //drinking a LOT will make you go down faster + var/effective_dose = CHEM_DOSE(M, src) * strength_mod * (1 + REAGENT_VOLUME(holder, src)/60) //drinking a LOT will make you go down faster if(effective_dose >= strength) // Early warning ADJ_STATUS(M, STAT_DIZZY, 6) // It is decreased at the speed of 3 per tick if(effective_dose >= strength * 2) // Slurring @@ -325,7 +325,7 @@ /decl/material/liquid/alcohol/vodka name = "vodka" codex_name = "plain vodka" - lore_text = "Number one drink AND fueling choice for Independents around the galaxy." + lore_text = "High-proof grain alcohol, useful for cocktails... and as bootleg rocket fuel, for those prone to amateur rocketry or trade sanctions." taste_description = "grain alcohol" color = "#0064c8" // rgb: 0, 100, 200 strength = 15 @@ -339,7 +339,7 @@ /decl/material/liquid/alcohol/vodka/premium name = "premium vodka" codex_name = null - lore_text = "Premium distilled vodka imported directly from the Gilgamesh Colonial Confederation." + lore_text = "Premium distilled vodka made from real, planet-grown potatoes." taste_description = "clear kvass" color = "#aaddff" // rgb: 170, 221, 255 - very light blue. strength = 10 @@ -471,7 +471,7 @@ if(M.has_trait(/decl/trait/metabolically_inert)) return - var/dose = LAZYACCESS(M.chem_doses, type) + var/dose = CHEM_DOSE(M, src) if(dose > 30) M.take_damage(2 * removed, TOX) if(dose > 60 && ishuman(M) && prob(5)) diff --git a/code/modules/reagents/chems/chems_blood.dm b/code/modules/reagents/chems/chems_blood.dm index 3af88ab10719..4642d9af3883 100644 --- a/code/modules/reagents/chems/chems_blood.dm +++ b/code/modules/reagents/chems/chems_blood.dm @@ -48,8 +48,8 @@ my_chems[chem] = my_chems[chem] + other_chems[chem] /decl/material/liquid/blood/touch_turf(var/turf/touching_turf, var/amount, var/datum/reagents/holder) - var/data = REAGENT_DATA(holder, type) - if(!istype(touching_turf) || REAGENT_VOLUME(holder, type) < 3) + var/data = REAGENT_DATA(holder, src) + if(!istype(touching_turf) || REAGENT_VOLUME(holder, src) < 3) return var/weakref/donor = LAZYACCESS(data, DATA_BLOOD_DONOR) blood_splatter(touching_turf, donor?.resolve() || holder.my_atom, 1) @@ -58,21 +58,21 @@ . = ..() if(M.has_trait(/decl/trait/metabolically_inert)) return - if(LAZYACCESS(M.chem_doses, type) > 5) + if(CHEM_DOSE(M, src) > 5) M.take_damage(removed, TOX) - if(LAZYACCESS(M.chem_doses, type) > 15) + if(CHEM_DOSE(M, src) > 15) M.take_damage(removed, TOX) /decl/material/liquid/blood/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) if(ishuman(M)) - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) var/mob/living/human/H = M H.inject_blood(volume, holder) holder.remove_reagent(type, volume) . = ..() /decl/material/liquid/blood/get_reagent_color(datum/reagents/holder) - var/list/blood_data = REAGENT_DATA(holder, type) + var/list/blood_data = REAGENT_DATA(holder, src) return blood_data?[DATA_BLOOD_COLOR] || ..() /decl/material/liquid/coagulated_blood diff --git a/code/modules/reagents/chems/chems_compounds.dm b/code/modules/reagents/chems/chems_compounds.dm index 154c6eb59ca4..bb54882996bf 100644 --- a/code/modules/reagents/chems/chems_compounds.dm +++ b/code/modules/reagents/chems/chems_compounds.dm @@ -140,7 +140,7 @@ if(M.has_trait(/decl/trait/metabolically_inert) || !M.can_feel_pain()) return - var/dose = LAZYACCESS(M.chem_doses, type) + var/dose = CHEM_DOSE(M, src) if(dose < agony_dose) if(prob(5) || dose == metabolism) //dose == metabolism is a very hacky way of forcing the message the first time this procs to_chat(M, discomfort_message) @@ -226,7 +226,7 @@ holder.remove_reagent(/decl/material/liquid/frostoil, 5) if(M.has_trait(/decl/trait/metabolically_inert) || !M.can_feel_pain()) return - if(LAZYACCESS(M.chem_doses, type) == metabolism) + if(CHEM_DOSE(M, src) == metabolism) to_chat(M, "You feel like your insides are burning!") else M.apply_effect(6, PAIN, 0) @@ -283,12 +283,12 @@ /decl/material/liquid/lactate/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) M.add_chemical_effect(CE_PULSE, 1) if(volume >= 10) M.add_chemical_effect(CE_PULSE, 1) M.add_chemical_effect(CE_SLOWDOWN, (volume/15) ** 2) - else if(LAZYACCESS(M.chem_doses, type) > 30) //after prolonged exertion + else if(CHEM_DOSE(M, src) > 30) //after prolonged exertion ADJ_STATUS(M, STAT_JITTER, 5) M.add_chemical_effect(CE_BREATHLOSS, 0.02 * volume) @@ -313,7 +313,7 @@ return if(H.regenerate_blood(4 * removed)) H.adjust_immunity(-0.1) - if(LAZYACCESS(H.chem_doses, type) > H.species.blood_volume/8) //half of blood was replaced with us, rip white bodies + if(CHEM_DOSE(H, src) > H.species.blood_volume/8) //half of blood was replaced with us, rip white bodies H.adjust_immunity(-0.5) /decl/material/solid/tobacco @@ -379,8 +379,10 @@ /decl/material/liquid/menthol/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() - if(world.time > REAGENT_DATA(holder, type) + 3 MINUTES) - LAZYSET(holder.reagent_data, type, world.time) + var/list/data = REAGENT_DATA(holder, src) + if(world.time > LAZYACCESS(data, DATA_COOLDOWN_TIME) + 3 MINUTES) + LAZYSET(data, DATA_COOLDOWN_TIME, world.time) + LAZYSET(holder.reagent_data, type, data) to_chat(M, SPAN_NOTICE("You feel faintly sore in the throat.")) /decl/material/liquid/nanitefluid diff --git a/code/modules/reagents/chems/chems_drinks.dm b/code/modules/reagents/chems/chems_drinks.dm index b9ea85a8a9c7..b02703e26e11 100644 --- a/code/modules/reagents/chems/chems_drinks.dm +++ b/code/modules/reagents/chems/chems_drinks.dm @@ -369,7 +369,7 @@ if(M.has_trait(/decl/trait/metabolically_inert)) return - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) if(volume > 15) M.add_chemical_effect(CE_PULSE, 1) if(volume > 45) @@ -549,7 +549,7 @@ SET_STATUS_MAX(M, STAT_DIZZY, 20) ADJ_STATUS(M, STAT_DIZZY, 2) ADJ_STATUS(M, STAT_JITTER, 2) - M.set_status(STAT_DROWSY, 0) + M.set_status_condition(STAT_DROWSY, 0) /decl/material/liquid/drink/grenadine name = "grenadine syrup" diff --git a/code/modules/reagents/chems/chems_drugs.dm b/code/modules/reagents/chems/chems_drugs.dm index e93452002971..c00540af2334 100644 --- a/code/modules/reagents/chems/chems_drugs.dm +++ b/code/modules/reagents/chems/chems_drugs.dm @@ -50,17 +50,24 @@ uid = "chem_nicotine" /decl/material/liquid/nicotine/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) - var/volume = REAGENT_VOLUME(holder, type) + var/volume = REAGENT_VOLUME(holder, src) . = ..() if(prob(volume*20)) M.add_chemical_effect(CE_PULSE, 1) - if(volume <= 0.02 && LAZYACCESS(M.chem_doses, type) >= 0.05 && world.time > REAGENT_DATA(holder, type) + 3 MINUTES) - LAZYSET(holder.reagent_data, type, world.time) + + var/update_data = FALSE + var/list/data = REAGENT_DATA(holder, src) + if(volume <= 0.02 && CHEM_DOSE(M, src) >= 0.05 && world.time > LAZYACCESS(data, DATA_COOLDOWN_TIME) + 3 MINUTES) + update_data = TRUE to_chat(M, "You feel antsy, your concentration wavers...") - else if(world.time > REAGENT_DATA(holder, type) + 3 MINUTES) - LAZYSET(holder.reagent_data, type, world.time) + else if(world.time > LAZYACCESS(data, DATA_COOLDOWN_TIME) + 3 MINUTES) + update_data = TRUE to_chat(M, "You feel invigorated and calm.") + if(update_data) + LAZYSET(data, DATA_COOLDOWN_TIME, world.time) + LAZYSET(holder.reagent_data, type, data) + /decl/material/liquid/nicotine/affect_overdose(mob/living/victim, total_dose) ..() victim.add_chemical_effect(CE_PULSE, 2) @@ -86,7 +93,7 @@ ADJ_STATUS(M, STAT_JITTER, -50) var/threshold = 1 - var/dose = LAZYACCESS(M.chem_doses, type) * sedative_strength + var/dose = CHEM_DOSE(M, src) * sedative_strength if(dose < 0.5 * threshold) if(dose == metabolism * 2 || prob(5)) M.emote(/decl/emote/audible/yawn) @@ -166,7 +173,7 @@ if(M.has_trait(/decl/trait/metabolically_inert)) return var/threshold = 1 - var/dose = LAZYACCESS(M.chem_doses, type) + var/dose = CHEM_DOSE(M, src) if(dose < 1 * threshold) M.apply_effect(3, STUTTER) ADJ_STATUS(M, STAT_DIZZY, 1) diff --git a/code/modules/reagents/chems/chems_explosives.dm b/code/modules/reagents/chems/chems_explosives.dm index 614671fb3060..58573abdbb42 100644 --- a/code/modules/reagents/chems/chems_explosives.dm +++ b/code/modules/reagents/chems/chems_explosives.dm @@ -27,7 +27,9 @@ var/adj_power = round(boompower * activated_volume/60) var/datum/gas_mixture/products = new(_temperature = 5 * FLAMMABLE_GAS_FLASHPOINT) var/gas_moles = 3 * volume - products.adjust_multi(/decl/material/gas/carbon_dioxide, 0.5 * gas_moles, /decl/material/gas/nitrogen, 0.3 * gas_moles, /decl/material/liquid/water, 0.2 * gas_moles) + products.adjust_gas(/decl/material/gas/carbon_dioxide, 0.5 * gas_moles, FALSE) + products.adjust_gas(/decl/material/gas/nitrogen, 0.3 * gas_moles, FALSE) + products.adjust_gas(/decl/material/liquid/water, 0.2 * gas_moles, TRUE) T.assume_air(products) holder?.reagents?.remove_reagent(type, activated_volume) explosion(T, adj_power, adj_power + 1, adj_power*2 + 2) diff --git a/code/modules/reagents/chems/chems_fuel.dm b/code/modules/reagents/chems/chems_fuel.dm index 7853f2f5579a..539d0e1b2e8d 100644 --- a/code/modules/reagents/chems/chems_fuel.dm +++ b/code/modules/reagents/chems/chems_fuel.dm @@ -26,7 +26,10 @@ var/turf/T = get_turf(holder) var/datum/gas_mixture/products = new(_temperature = 5 * FLAMMABLE_GAS_FLASHPOINT) var/gas_moles = 3 * volume - products.adjust_multi(/decl/material/gas/nitricoxide, 0.1 * gas_moles, /decl/material/gas/nitrodioxide, 0.1 * gas_moles, /decl/material/gas/nitrogen, 0.6 * gas_moles, /decl/material/gas/hydrogen, 0.02 * gas_moles) + products.adjust_gas(/decl/material/gas/nitricoxide, 0.1 * gas_moles, FALSE) + products.adjust_gas(/decl/material/gas/nitrodioxide, 0.1 * gas_moles, FALSE) + products.adjust_gas(/decl/material/gas/nitrogen, 0.6 * gas_moles, FALSE) + products.adjust_gas(/decl/material/gas/hydrogen, 0.02 * gas_moles, TRUE) T.assume_air(products) if(volume > 500) explosion(T,1,2,4) diff --git a/code/modules/reagents/chems/chems_medicines.dm b/code/modules/reagents/chems/chems_medicines.dm index 12e16eef954d..9c22dfc135ef 100644 --- a/code/modules/reagents/chems/chems_medicines.dm +++ b/code/modules/reagents/chems/chems_medicines.dm @@ -133,16 +133,14 @@ var/removing = (4 * removed * antitoxin_strength) var/datum/reagents/ingested = M.get_ingested_reagents() - for(var/R in ingested?.reagent_volumes) - var/decl/material/chem = GET_DECL(R) - if((remove_generic && chem.toxicity) || (R in remove_toxins)) - ingested.remove_reagent(R, removing) + for(var/decl/material/reagent as anything in ingested?.reagent_volumes) + if((remove_generic && reagent.toxicity) || (reagent.type in remove_toxins)) + ingested.remove_reagent(reagent, removing) return - for(var/R in M.reagents?.reagent_volumes) - var/decl/material/chem = GET_DECL(R) - if((remove_generic && chem.toxicity) || (R in remove_toxins)) - M.remove_from_reagents(R, removing) + for(var/decl/material/reagent as anything in M.reagents?.reagent_volumes) + if((remove_generic && reagent.toxicity) || (reagent.type in remove_toxins)) + M.remove_from_reagents(reagent, removing) return /decl/material/liquid/immunobooster @@ -159,7 +157,7 @@ /decl/material/liquid/immunobooster/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() - if(REAGENT_VOLUME(holder, type) >= REAGENTS_OVERDOSE) + if(REAGENT_VOLUME(holder, src) >= REAGENTS_OVERDOSE) return var/immunity_to_add = clamp((M.immunity_norm / 2) - M.get_immunity(), 0, removed) if(immunity_to_add > 0) @@ -170,57 +168,6 @@ victim.add_chemical_effect(CE_TOXIN, 1) victim.adjust_immunity(-0.5) -/decl/material/liquid/stimulants - name = "stimulants" - lore_text = "Improves the ability to concentrate." - taste_description = "sourness" - color = "#bf80bf" - scannable = 1 - metabolism = 0.01 - value = 1.5 - exoplanet_rarity_gas = MAT_RARITY_EXOTIC - uid = "chem_stimulants" - allergen_flags = ALLERGEN_STIMULANT - -/decl/material/liquid/stimulants/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) - var/volume = REAGENT_VOLUME(holder, type) - . = ..() - if(volume <= 0.1 && LAZYACCESS(M.chem_doses, type) >= 0.5 && world.time > REAGENT_DATA(holder, type) + 5 MINUTES) - LAZYSET(holder.reagent_data, type, world.time) - to_chat(M, "You lose focus...") - else - ADJ_STATUS(M, STAT_DROWSY, -5) - ADJ_STATUS(M, STAT_PARA, -1) - ADJ_STATUS(M, STAT_STUN, -1) - ADJ_STATUS(M, STAT_WEAK, -1) - if(world.time > REAGENT_DATA(holder, type) + 5 MINUTES) - LAZYSET(holder.reagent_data, type, world.time) - to_chat(M, "Your mind feels focused and undivided.") - -/decl/material/liquid/antidepressants - name = "antidepressants" - lore_text = "Stabilizes the mind a little." - taste_description = "bitterness" - color = "#ff80ff" - scannable = 1 - metabolism = 0.01 - value = 1.5 - exoplanet_rarity_gas = MAT_RARITY_EXOTIC - uid = "chem_antidepressants" - -/decl/material/liquid/antidepressants/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) - var/volume = REAGENT_VOLUME(holder, type) - . = ..() - if(volume <= 0.1 && LAZYACCESS(M.chem_doses, type) >= 0.5 && world.time > REAGENT_DATA(holder, type) + 5 MINUTES) - LAZYSET(holder.reagent_data, type, world.time) - to_chat(M, "Your mind feels a little less stable...") - else - M.add_chemical_effect(CE_MIND, 1) - M.adjust_hallucination(-10) - if(world.time > REAGENT_DATA(holder, type) + 5 MINUTES) - LAZYSET(holder.reagent_data, type, world.time) - to_chat(M, "Your mind feels stable... a little stable.") - /decl/material/liquid/antibiotics name = "antibiotics" lore_text = "An all-purpose antibiotic agent." @@ -262,7 +209,7 @@ /decl/material/liquid/retrovirals/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() M.heal_damage(CLONE, 20 * removed) - if(LAZYACCESS(M.chem_doses, type) > 10) + if(CHEM_DOSE(M, src) > 10) ADJ_STATUS(M, STAT_DIZZY, 5) ADJ_STATUS(M, STAT_JITTER, 5) M.reset_genetic_conditions() @@ -279,8 +226,8 @@ uid = "chem_adrenaline" /decl/material/liquid/adrenaline/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) - var/volume = REAGENT_VOLUME(holder, type) - var/dose = LAZYACCESS(M.chem_doses, type) + var/volume = REAGENT_VOLUME(holder, src) + var/dose = CHEM_DOSE(M, src) . = ..() if(dose < 0.2) //not that effective after initial rush M.add_chemical_effect(CE_PAINKILLER, min(30*volume, 80)) @@ -378,18 +325,18 @@ /decl/material/liquid/clotting_agent/affect_blood(mob/living/M, removed, datum/reagents/holder) SET_STATUS_MAX(M, STAT_BLURRY, 30) - M.add_chemical_effect(CE_BLOCKAGE, (15 + REAGENT_VOLUME(holder, type))/100) + M.add_chemical_effect(CE_BLOCKAGE, (15 + REAGENT_VOLUME(holder, src))/100) for(var/obj/item/organ/external/limb in M.get_external_organs()) - if(!(limb.status & (ORGAN_ARTERY_CUT|ORGAN_BLEEDING)) || !prob(2 + REAGENT_VOLUME(holder, type))) + if(!(limb.status & (ORGAN_ARTERY_CUT|ORGAN_BLEEDING)) || !prob(2 + REAGENT_VOLUME(holder, src))) continue if(limb.status & ORGAN_ARTERY_CUT) limb.status &= ~ORGAN_ARTERY_CUT break if(limb.status & ORGAN_BLEEDING) var/closed_wound = FALSE - for(var/datum/wound/W in limb.wounds) - if(W.bleeding() && !W.clamped) - W.clamped = TRUE + for(var/datum/wound/wound in limb.wounds) + if(wound.bleeding() && !wound.clamped) + wound.clamped = TRUE closed_wound = TRUE break if(closed_wound) @@ -419,22 +366,22 @@ /decl/material/liquid/detoxifier/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() var/charges = removed * DETOXIFIER_EFFECTIVENESS - var/dosecharges = LAZYACCESS(M.chem_doses, type) * DETOXIFIER_DOSE_EFFECTIVENESS + var/dosecharges = CHEM_DOSE(M, src) * DETOXIFIER_DOSE_EFFECTIVENESS for(var/datum/reagents/container as anything in M.get_metabolizing_reagent_holders()) - for(var/reagent_type in container.reagent_volumes) - var/decl/material/liquid/painkillers/painkiller = GET_DECL(reagent_type) + for(var/decl/material/reagent as anything in container.reagent_volumes) + var/decl/material/liquid/painkillers/painkiller = reagent if(!istype(painkiller) || !painkiller.narcotic) continue - var/amount = min(charges, REAGENT_VOLUME(container, reagent_type)) + var/amount = min(charges, REAGENT_VOLUME(container, reagent)) if(amount) charges -= amount - container.remove_reagent(reagent_type, amount) - var/dose_amount = min(dosecharges, LAZYACCESS(M.chem_doses, reagent_type)) + container.remove_reagent(reagent, amount) + var/dose_amount = min(dosecharges, CHEM_DOSE(M, reagent)) if(dose_amount) - var/dose = LAZYACCESS(M.chem_doses, reagent_type) - dose_amount - LAZYSET(M.chem_doses, reagent_type, dose) - if(M.chem_doses[reagent_type] <= 0) - LAZYREMOVE(M.chem_doses, reagent_type) + var/dose = CHEM_DOSE(M, reagent) - dose_amount + LAZYSET(M._chem_doses, reagent, dose) + if(CHEM_DOSE(M, reagent) <= 0) + LAZYREMOVE(M._chem_doses, reagent) dosecharges -= dose_amount if(charges <= 0 && dosecharges <= 0) break diff --git a/code/modules/reagents/chems/chems_painkillers.dm b/code/modules/reagents/chems/chems_painkillers.dm index 8ab62f4048fa..9a976f06e2de 100644 --- a/code/modules/reagents/chems/chems_painkillers.dm +++ b/code/modules/reagents/chems/chems_painkillers.dm @@ -43,8 +43,8 @@ narcotic = TRUE /decl/material/liquid/painkillers/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) - var/volume = REAGENT_VOLUME(holder, type) - var/dose = LAZYACCESS(M.chem_doses, type) + var/volume = REAGENT_VOLUME(holder, src) + var/dose = CHEM_DOSE(M, src) . = ..() var/effectiveness = 1 if(dose < effective_dose) //some ease-in ease-out for the effect @@ -131,9 +131,9 @@ var/datum/reagents/ingested = M.get_ingested_reagents() if(ingested) var/list/pool = M.reagents.reagent_volumes | ingested.reagent_volumes - for(var/rtype in pool) - var/decl/material/liquid/alcohol/booze = GET_DECL(rtype) - if(!istype(booze) ||LAZYACCESS(M.chem_doses, rtype) < 2) //let them experience false security at first + for(var/reagent in pool) + var/decl/material/liquid/alcohol/booze = reagent + if(!istype(booze) ||CHEM_DOSE(M, reagent) < 2) //let them experience false security at first continue . = 1 if(booze.strength < 40) //liquor stuff hits harder diff --git a/code/modules/reagents/chems/chems_pigments.dm b/code/modules/reagents/chems/chems_pigments.dm index 55c6be4c47cb..5d23dc4e5230 100644 --- a/code/modules/reagents/chems/chems_pigments.dm +++ b/code/modules/reagents/chems/chems_pigments.dm @@ -108,7 +108,7 @@ exoplanet_rarity_gas = MAT_RARITY_NOWHERE /decl/material/liquid/paint/proc/apply_paint(var/atom/painting, var/datum/reagents/holder, var/threshold = 1) - if(istype(painting) && istype(holder) && REAGENT_VOLUME(holder, type) >= threshold) + if(istype(painting) && istype(holder) && REAGENT_VOLUME(holder, src) >= threshold) var/keep_alpha = painting.alpha painting.set_color(holder.get_color()) painting.set_alpha(keep_alpha) diff --git a/code/modules/reagents/chems/chems_poisons.dm b/code/modules/reagents/chems/chems_poisons.dm index b08e4b4197bb..09bf18e6d357 100644 --- a/code/modules/reagents/chems/chems_poisons.dm +++ b/code/modules/reagents/chems/chems_poisons.dm @@ -11,7 +11,7 @@ /decl/material/liquid/paralytics/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) var/threshold = 2 - var/dose = LAZYACCESS(M.chem_doses, type) + var/dose = CHEM_DOSE(M, src) . = ..() if(dose >= metabolism * threshold * 0.5) SET_STATUS_MAX(M, STAT_CONFUSE, 2) diff --git a/code/modules/reagents/chems/chems_psychiatric.dm b/code/modules/reagents/chems/chems_psychiatric.dm new file mode 100644 index 000000000000..2bc88925516f --- /dev/null +++ b/code/modules/reagents/chems/chems_psychiatric.dm @@ -0,0 +1,91 @@ +/// This material type has mob effects based on accumulated dose. +/// If the drug has been in your system enough to accumulate a dose, +/// and the level of it in your bloodstream drops below a certain volume, +/// you will get discontinuation effects. +/// If it is above that volume or hasn't been in your system long enough to accumulate, +/// you will get the positive effects. +/decl/material/liquid/accumulated + abstract_type = /decl/material/liquid/accumulated + /// (FLOAT) The dose under which you will receive effects from discontinuation. + var/required_dose = 0.5 + /// (FLOAT) The minimum volume to get the positive effect of this reagent. + var/required_volume = 0.1 + /// (FLOAT) The cooldown between effect triggers. + var/effect_cooldown = 5 MINUTES + +/decl/material/liquid/accumulated/affect_blood(mob/living/victim, removed, datum/reagents/holder) + var/volume = REAGENT_VOLUME(holder, src) + . = ..() + + var/update_data = FALSE + var/list/data = REAGENT_DATA(holder, src) + var/is_off_cooldown = world.time > LAZYACCESS(data, DATA_COOLDOWN_TIME) + effect_cooldown + if(volume <= required_volume && CHEM_DOSE(victim, src) >= required_dose) + update_data = discontinuation_effect(victim, removed, holder, is_off_cooldown) + else + update_data = positive_effect(victim, removed, holder, is_off_cooldown) + + if(update_data) + LAZYSET(data, DATA_COOLDOWN_TIME, world.time) + LAZYSET(holder.reagent_data, type, data) + +/// Returns TRUE to signal that the effect should go on cooldown. +/decl/material/liquid/accumulated/proc/positive_effect(mob/living/victim, removed, datum/reagents/holder, is_off_cooldown) + return FALSE + +/// Returns TRUE to signal that the effect should go on cooldown. +/decl/material/liquid/accumulated/proc/discontinuation_effect(mob/living/victim, removed, datum/reagents/holder, is_off_cooldown) + return FALSE + +/decl/material/liquid/accumulated/stimulants + name = "stimulants" + lore_text = "Improves the ability to concentrate." + taste_description = "sourness" + color = "#bf80bf" + scannable = 1 + metabolism = 0.01 + value = 1.5 + exoplanet_rarity_gas = MAT_RARITY_EXOTIC + uid = "chem_stimulants" + allergen_flags = ALLERGEN_STIMULANT + +/decl/material/liquid/accumulated/stimulants/positive_effect(mob/living/victim, removed, datum/reagents/holder, is_off_cooldown) + ADJ_STATUS(victim, STAT_DROWSY, -5) + ADJ_STATUS(victim, STAT_PARA, -1) + ADJ_STATUS(victim, STAT_STUN, -1) + ADJ_STATUS(victim, STAT_WEAK, -1) + if(is_off_cooldown) + to_chat(victim, SPAN_NOTICE("Your mind feels focused and undivided.")) + return TRUE + return FALSE + +/decl/material/liquid/accumulated/stimulants/discontinuation_effect(mob/living/victim, removed, datum/reagents/holder, is_off_cooldown) + if(is_off_cooldown) + to_chat(victim, SPAN_WARNING("You lose focus...")) + return TRUE + return FALSE + +/decl/material/liquid/accumulated/antidepressants + name = "antidepressants" + lore_text = "Stabilizes the mind a little." + taste_description = "bitterness" + color = "#ff80ff" + scannable = 1 + metabolism = 0.01 + value = 1.5 + exoplanet_rarity_gas = MAT_RARITY_EXOTIC + uid = "chem_antidepressants" + +/decl/material/liquid/accumulated/antidepressants/positive_effect(mob/living/victim, removed, datum/reagents/holder, is_off_cooldown) + victim.add_chemical_effect(CE_MIND, 1) + victim.adjust_hallucination(-10) + if(is_off_cooldown) + to_chat(victim, SPAN_NOTICE("Your mind feels stable... a little stable.")) + return TRUE + return FALSE + +/decl/material/liquid/accumulated/antidepressants/discontinuation_effect(mob/living/victim, removed, datum/reagents/holder, is_off_cooldown) + if(is_off_cooldown) + to_chat(victim, SPAN_WARNING("Your mind feels a little less stable...")) + return TRUE + return FALSE diff --git a/code/modules/reagents/chems/random/chems_random.dm b/code/modules/reagents/chems/random/chems_random.dm index 2f67984c0097..a7418e164642 100644 --- a/code/modules/reagents/chems/random/chems_random.dm +++ b/code/modules/reagents/chems/random/chems_random.dm @@ -62,19 +62,12 @@ var/global/list/random_chem_interaction_blacklist = list( data_initialized = TRUE -/decl/material/liquid/random/proc/stable_at_temperature(temperature) - if(temperature > chilling_point && temperature < heating_point) - return TRUE - /decl/material/liquid/random/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() FOR_ALL_EFFECTS - var/data = REAGENT_DATA(holder, type) + var/data = REAGENT_DATA(holder, src) effect.affect_blood(M, removed, LAZYACCESS(data, effect.type)) -/decl/material/liquid/random/proc/on_chemicals_analyze(mob/user) - to_chat(user, get_scan_data(user)) - /decl/material/liquid/random/proc/get_scan_data(mob/user) var/list/dat = list() var/chem_skill = user.get_skill_value(SKILL_CHEMISTRY) diff --git a/code/modules/reagents/chems/random/random_effects.dm b/code/modules/reagents/chems/random/random_effects.dm index 0ef001eb16ad..9136a9577f31 100644 --- a/code/modules/reagents/chems/random/random_effects.dm +++ b/code/modules/reagents/chems/random/random_effects.dm @@ -45,7 +45,7 @@ mode = RANDOM_CHEM_EFFECT_INT /decl/random_chem_effect/general_properties/name/on_property_recompute(var/decl/material/liquid/random/reagent, var/value) - reagent.name = "[initial(reagent.name)]-[value]" + reagent.name = "[initial(reagent.name)]-[value]" // this is a valid use of initial(reagent.name) since we're resetting it to the base value /decl/random_chem_effect/general_properties/color/get_random_value() return color_matrix_rotate_hue(round(rand(0,360),20)) diff --git a/code/modules/reagents/dispenser/cartridge_spawn.dm b/code/modules/reagents/dispenser/cartridge_spawn.dm index e88e3515f5cf..2d81ee8be767 100644 --- a/code/modules/reagents/dispenser/cartridge_spawn.dm +++ b/code/modules/reagents/dispenser/cartridge_spawn.dm @@ -1,13 +1,14 @@ -/client/proc/spawn_chemdisp_cartridge(size in list("small", "medium", "large"), reagent in decls_repository.get_decl_paths_of_subtype(/decl/material)) +/client/proc/spawn_chemdisp_cartridge(size in list("small", "medium", "large"), reagent_type in decls_repository.get_decl_paths_of_subtype(/decl/material)) set name = "Spawn Chemical Dispenser Cartridge" set category = "Admin" - var/obj/item/chems/chem_disp_cartridge/C + var/cartridge_type switch(size) - if("small") C = new /obj/item/chems/chem_disp_cartridge/small(usr.loc) - if("medium") C = new /obj/item/chems/chem_disp_cartridge/medium(usr.loc) - if("large") C = new /obj/item/chems/chem_disp_cartridge(usr.loc) - C.add_to_reagents(reagent, C.volume) - var/decl/material/R = reagent - C.setLabel(initial(R.name)) - log_and_message_admins("spawned a [size] reagent container containing [reagent]") + if("small") cartridge_type = /obj/item/chems/chem_disp_cartridge/small + if("medium") cartridge_type = /obj/item/chems/chem_disp_cartridge/medium + if("large") cartridge_type = /obj/item/chems/chem_disp_cartridge + var/obj/item/chems/chem_disp_cartridge/cartridge = new cartridge_type(usr.loc) + cartridge.add_to_reagents(reagent_type, cartridge.volume) + var/reagent_name = cartridge.reagents.get_primary_reagent_name() + cartridge.setLabel(reagent_name) + log_and_message_admins("spawned a [size] reagent container containing [reagent_name] ([reagent_type])") diff --git a/code/modules/reagents/dispenser/dispenser2.dm b/code/modules/reagents/dispenser/dispenser2.dm index 696dab904873..2c6882d9e60f 100644 --- a/code/modules/reagents/dispenser/dispenser2.dm +++ b/code/modules/reagents/dispenser/dispenser2.dm @@ -86,12 +86,12 @@ cartridges -= label SSnano.update_uis(src) -/obj/machinery/chemical_dispenser/attackby(obj/item/hit_with, mob/user) - if(istype(hit_with, /obj/item/chems/chem_disp_cartridge)) - add_cartridge(hit_with, user) +/obj/machinery/chemical_dispenser/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/chems/chem_disp_cartridge)) + add_cartridge(used_item, user) return TRUE - if(IS_CROWBAR(hit_with) && !panel_open && length(cartridges)) + if(IS_CROWBAR(used_item) && !panel_open && length(cartridges)) var/label = input(user, "Which cartridge would you like to remove?", "Chemical Dispenser") as null|anything in cartridges if(!label) return TRUE var/obj/item/chems/chem_disp_cartridge/C = remove_cartridge(label) @@ -100,12 +100,12 @@ C.dropInto(loc) return TRUE - if(is_type_in_list(hit_with, acceptable_containers)) + if(is_type_in_list(used_item, acceptable_containers)) if(container) to_chat(user, SPAN_WARNING("There is already \a [container] on \the [src]!")) return TRUE - var/obj/item/chems/new_container = hit_with + var/obj/item/chems/new_container = used_item if(!accept_drinking && (istype(new_container,/obj/item/chems/condiment) || istype(new_container,/obj/item/chems/drinks))) to_chat(user, SPAN_WARNING("This machine only accepts beakers!")) @@ -147,9 +147,8 @@ data["glass"] = accept_drinking var beakerD[0] if(LAZYLEN(container?.reagents?.reagent_volumes)) - for(var/rtype in container.reagents.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - beakerD[++beakerD.len] = list("name" = R.use_name, "volume" = REAGENT_VOLUME(container.reagents, rtype)) + for(var/decl/material/reagent as anything in container.reagents.reagent_volumes) + beakerD[++beakerD.len] = list("name" = reagent.use_name, "volume" = REAGENT_VOLUME(container.reagents, reagent)) data["beakerContents"] = beakerD if(container) // Container has had null reagents in the past; may be due to qdel without clearing reference. diff --git a/code/modules/reagents/dispenser/dispenser_presets.dm b/code/modules/reagents/dispenser/dispenser_presets.dm index 0336edaecb5a..e6d1634b8447 100644 --- a/code/modules/reagents/dispenser/dispenser_presets.dm +++ b/code/modules/reagents/dispenser/dispenser_presets.dm @@ -1,3 +1,6 @@ +/obj/machinery/chemical_dispenser/unanchored + anchored = FALSE + /obj/machinery/chemical_dispenser/full spawn_cartridges = list( /obj/item/chems/chem_disp_cartridge/hydrazine, @@ -60,6 +63,9 @@ beaker_offset = -2 beaker_positions = list(-1,3,7,11,15) +/obj/machinery/chemical_dispenser/bar_soft/unanchored + anchored = FALSE + /obj/machinery/chemical_dispenser/bar_soft/full spawn_cartridges = list( /obj/item/chems/chem_disp_cartridge/water, @@ -98,6 +104,8 @@ beaker_offset = -2 beaker_positions = list(-3,2,7,12,17) +/obj/machinery/chemical_dispenser/bar_alc/unanchored + anchored = FALSE /obj/machinery/chemical_dispenser/bar_alc/full spawn_cartridges = list( diff --git a/code/modules/reagents/heat_sources/_heat_source.dm b/code/modules/reagents/heat_sources/_heat_source.dm index eb5b3cebf445..199a9a79aab8 100644 --- a/code/modules/reagents/heat_sources/_heat_source.dm +++ b/code/modules/reagents/heat_sources/_heat_source.dm @@ -83,23 +83,22 @@ // Hackery to heat pots placed onto a hotplate without also grilling/baking stuff. if(isturf(loc)) - var/datum/gas_mixture/environment = loc.return_air() for(var/obj/item/chems/cooking_vessel/pot in loc.get_contained_external_atoms()) - pot.fire_act(environment, temperature, 500) + pot.handle_external_heating(temperature, src) return TRUE // Don't kill this processing loop unless we're not powered. . = ..() -/obj/machinery/reagent_temperature/attackby(var/obj/item/thing, var/mob/user) +/obj/machinery/reagent_temperature/attackby(var/obj/item/used_item, var/mob/user) - if(istype(thing, /obj/item/chems/cooking_vessel)) - if(!user.try_unequip(thing, get_turf(src))) + if(istype(used_item, /obj/item/chems/cooking_vessel)) + if(!user.try_unequip(used_item, get_turf(src))) return TRUE - thing.reset_offsets(anim_time = 0) - user.visible_message(SPAN_NOTICE("\The [user] places \the [thing] onto \the [src].")) + used_item.reset_offsets(anim_time = 0) + user.visible_message(SPAN_NOTICE("\The [user] places \the [used_item] onto \the [src].")) return TRUE - if(IS_WRENCH(thing)) + if(IS_WRENCH(used_item)) if(use_power == POWER_USE_ACTIVE) to_chat(user, SPAN_WARNING("Turn \the [src] off first!")) else @@ -108,18 +107,18 @@ playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) return TRUE - if(thing.reagents) + if(used_item.reagents) for(var/checktype in permitted_types) - if(istype(thing, checktype)) + if(istype(used_item, checktype)) if(container) to_chat(user, SPAN_WARNING("\The [src] is already holding \the [container].")) - else if(user.try_unequip(thing)) - thing.forceMove(src) - container = thing + else if(user.try_unequip(used_item)) + used_item.forceMove(src) + container = used_item visible_message(SPAN_NOTICE("\The [user] places \the [container] on \the [src].")) update_icon() return TRUE - to_chat(user, SPAN_WARNING("\The [src] cannot accept \the [thing].")) + to_chat(user, SPAN_WARNING("\The [src] cannot accept \the [used_item].")) return FALSE . = ..() diff --git a/code/modules/reagents/reactions/_reaction.dm b/code/modules/reagents/reactions/_reaction.dm index fbc2eaa85d68..3a4b41044b5c 100644 --- a/code/modules/reagents/reactions/_reaction.dm +++ b/code/modules/reagents/reactions/_reaction.dm @@ -49,9 +49,6 @@ for(var/reagent in required_reagents) . += reagent -/decl/chemical_reaction/proc/get_alternate_reaction_indicator(var/datum/reagents/holder) - return 0 - /decl/chemical_reaction/proc/process(var/datum/reagents/holder, var/limit) var/data = send_data(holder) diff --git a/code/modules/reagents/reactions/reaction_drugs.dm b/code/modules/reagents/reactions/reaction_drugs.dm index a4f85cb3fa73..8f0c839b3b0f 100644 --- a/code/modules/reagents/reactions/reaction_drugs.dm +++ b/code/modules/reagents/reactions/reaction_drugs.dm @@ -159,13 +159,13 @@ /decl/chemical_reaction/drug/stimulants name = "Stimulants" - result = /decl/material/liquid/stimulants + result = /decl/material/liquid/accumulated/stimulants required_reagents = list(/decl/material/liquid/hallucinogenics = 1, /decl/material/solid/lithium = 1) result_amount = 3 /decl/chemical_reaction/drug/antidepressants name = "Antidepressants" - result = /decl/material/liquid/antidepressants + result = /decl/material/liquid/accumulated/antidepressants required_reagents = list(/decl/material/liquid/hallucinogenics = 1, /decl/material/solid/carbon = 1) result_amount = 3 diff --git a/code/modules/reagents/reactions/reaction_synthesis.dm b/code/modules/reagents/reactions/reaction_synthesis.dm index 79695861328a..fcbe27b4dfb5 100644 --- a/code/modules/reagents/reactions/reaction_synthesis.dm +++ b/code/modules/reagents/reactions/reaction_synthesis.dm @@ -40,22 +40,22 @@ . = ..() && length(holder.reagent_volumes) > 1 if(.) . = FALSE - for(var/rtype in holder.reagent_volumes) - if(rtype != /decl/material/liquid/crystal_agent && REAGENT_VOLUME(holder, rtype) >= REAGENT_UNITS_PER_MATERIAL_SHEET) + for(var/decl/material/reagent as anything in holder.reagent_volumes) + if(reagent.type != /decl/material/liquid/crystal_agent && REAGENT_VOLUME(holder, reagent) >= REAGENT_UNITS_PER_MATERIAL_SHEET) return TRUE /decl/chemical_reaction/synthesis/crystalization/on_reaction(datum/reagents/holder, created_volume, list/reaction_data) var/location = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) if(location) var/list/removing_reagents = list() - for(var/rtype in holder.reagent_volumes) - if(rtype != /decl/material/liquid/crystal_agent) - var/solidifying = floor(REAGENT_VOLUME(holder, rtype) / REAGENT_UNITS_PER_MATERIAL_SHEET) + for(var/decl/material/reagent as anything in holder.reagent_volumes) + if(reagent.type != /decl/material/liquid/crystal_agent) + var/solidifying = floor(REAGENT_VOLUME(holder, reagent) / REAGENT_UNITS_PER_MATERIAL_SHEET) if(solidifying) - SSmaterials.create_object(rtype, location, solidifying, /obj/item/stack/material/cubes) - removing_reagents[rtype] = solidifying * REAGENT_UNITS_PER_MATERIAL_SHEET - for(var/rtype in removing_reagents) - holder.remove_reagent(rtype, removing_reagents[rtype]) + SSmaterials.create_object(reagent.type, location, solidifying, /obj/item/stack/material/cubes) + removing_reagents[reagent] = solidifying * REAGENT_UNITS_PER_MATERIAL_SHEET + for(var/reagent in removing_reagents) + holder.remove_reagent(reagent, removing_reagents[reagent]) // Turns gas into a "solid" form for use in PACMAN etc. /decl/chemical_reaction/synthesis/aerogel @@ -70,11 +70,10 @@ . = ..() && length(holder.reagent_volumes) > 1 if(.) . = FALSE - for(var/rtype in holder.reagent_volumes) - if(REAGENT_VOLUME(holder, rtype) < REAGENT_UNITS_PER_MATERIAL_SHEET) + for(var/decl/material/reagent as anything in holder.reagent_volumes) + if(REAGENT_VOLUME(holder, reagent) < REAGENT_UNITS_PER_MATERIAL_SHEET) continue - var/decl/material/mat = GET_DECL(rtype) - if(!mat || mat.default_solid_form != /obj/item/stack/material/aerogel) + if(reagent.default_solid_form != /obj/item/stack/material/aerogel) continue return TRUE @@ -82,15 +81,14 @@ var/location = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) if(location) var/list/removing_reagents = list() - for(var/rtype in holder.reagent_volumes) - var/decl/material/mat = GET_DECL(rtype) - if(mat.default_solid_form == /obj/item/stack/material/aerogel) - var/solidifying = floor(REAGENT_VOLUME(holder, rtype) / REAGENT_UNITS_PER_MATERIAL_SHEET) + for(var/decl/material/reagent as anything in holder.reagent_volumes) + if(reagent.default_solid_form == /obj/item/stack/material/aerogel) + var/solidifying = floor(REAGENT_VOLUME(holder, reagent) / REAGENT_UNITS_PER_MATERIAL_SHEET) if(solidifying) - SSmaterials.create_object(rtype, location, solidifying) - removing_reagents[rtype] = solidifying * REAGENT_UNITS_PER_MATERIAL_SHEET - for(var/rtype in removing_reagents) - holder.remove_reagent(rtype, removing_reagents[rtype]) + SSmaterials.create_object(reagent.type, location, solidifying) + removing_reagents[reagent] = solidifying * REAGENT_UNITS_PER_MATERIAL_SHEET + for(var/reagent in removing_reagents) + holder.remove_reagent(reagent, removing_reagents[reagent]) /decl/chemical_reaction/synthesis/plastication name = "Plastic" diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 7b669a97daea..2bf3103378e2 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -9,7 +9,6 @@ abstract_type = /obj/item/chems watertight = TRUE - var/base_desc var/amount_per_transfer_from_this = 5 var/possible_transfer_amounts = @"[5,10,15,25,30]" var/volume = 30 @@ -176,11 +175,10 @@ // Vaporize anything over its boiling point. var/update_reagents = FALSE - for(var/reagent in reagents.reagent_volumes) - var/decl/material/mat = GET_DECL(reagent) - if(mat.can_boil_to_gas && !isnull(mat.boiling_point) && temperature >= mat.boiling_point) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(reagent.can_boil_to_gas && !isnull(reagent.boiling_point) && temperature >= reagent.boiling_point) // TODO: reduce atom temperature? - var/removing = min(mat.boil_evaporation_per_run, reagents.reagent_volumes[reagent]) + var/removing = min(reagent.boil_evaporation_per_run, reagents.reagent_volumes[reagent]) reagents.remove_reagent(reagent, removing, defer_update = TRUE, removed_phases = MAT_PHASE_LIQUID) update_reagents = TRUE loc.take_vaporized_reagent(reagent, removing) diff --git a/code/modules/reagents/reagent_containers/_glass.dm b/code/modules/reagents/reagent_containers/_glass.dm index 7881f84ead3a..a1816287111e 100644 --- a/code/modules/reagents/reagent_containers/_glass.dm +++ b/code/modules/reagents/reagent_containers/_glass.dm @@ -160,7 +160,7 @@ var/global/list/lid_check_glass_types = list() if(!reagents?.total_volume) to_chat(user, SPAN_WARNING("\The [src] is empty.")) return TRUE - seperate_food_chunk(utensil, user) + separate_food_chunk(utensil, user) if(utensil.loaded_food?.reagents?.total_volume) to_chat(user, SPAN_NOTICE("You scoop up some of \the [utensil.loaded_food.reagents.get_primary_reagent_name()] with \the [utensil].")) return TRUE diff --git a/code/modules/reagents/reagent_containers/beaker.dm b/code/modules/reagents/reagent_containers/beaker.dm index 0a00f0f60664..cc2557974423 100644 --- a/code/modules/reagents/reagent_containers/beaker.dm +++ b/code/modules/reagents/reagent_containers/beaker.dm @@ -17,7 +17,7 @@ . = ..() . += "It can hold up to [volume] units." -/obj/item/chems/glass/beaker/on_picked_up(mob/user) +/obj/item/chems/glass/beaker/on_picked_up(mob/user, atom/old_loc) . = ..() update_icon() diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index bf1306f42ce1..35110bc10b99 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -32,11 +32,9 @@ /obj/item/chems/borghypo/Initialize() . = ..() - - for(var/T in reagent_ids) - reagent_volumes[T] = volume - var/decl/material/R = T - reagent_names += initial(R.name) + for(var/decl/material/reagent in decls_repository.get_decls_unassociated(reagent_ids)) + reagent_volumes[reagent.type] = volume + reagent_names += reagent.use_name // TODO: should we even bother precaching this? all of this code sucks anyway START_PROCESSING(SSobj, src) /obj/item/chems/borghypo/Destroy() @@ -49,12 +47,12 @@ charge_tick = 0 if(isrobot(loc)) - var/mob/living/silicon/robot/R = loc - if(R && R.cell) - for(var/T in reagent_ids) - if(reagent_volumes[T] < volume) - R.cell.use(charge_cost) - reagent_volumes[T] = min(reagent_volumes[T] + 5, volume) + var/mob/living/silicon/robot/robot = loc + if(robot && robot.cell) + for(var/reagent in reagent_ids) + if(reagent_volumes[reagent] < volume) + robot.cell.use(charge_cost) + reagent_volumes[reagent] = min(reagent_volumes[reagent] + 5, volume) return 1 /obj/item/chems/borghypo/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) @@ -103,16 +101,16 @@ if(index > 0 && index <= reagent_ids.len) playsound(loc, 'sound/effects/pop.ogg', 50, 0) mode = index - var/decl/material/R = reagent_ids[mode] - to_chat(user, "Synthesizer is now producing '[initial(R.name)]'.") + var/decl/material/reagent = GET_DECL(reagent_ids[mode]) + to_chat(user, SPAN_NOTICE("Synthesizer is now producing '[reagent.use_name]'.")) return TOPIC_REFRESH /obj/item/chems/borghypo/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(distance > 2) return - var/decl/material/R = reagent_ids[mode] - . += SPAN_NOTICE("It is currently producing [initial(R.name)] and has [reagent_volumes[reagent_ids[mode]]] out of [volume] units left.") + var/decl/material/reagent = GET_DECL(reagent_ids[mode]) + . += SPAN_NOTICE("It is currently producing [reagent.use_name] and has [reagent_volumes[reagent_ids[mode]]] out of [volume] units left.") /obj/item/chems/borghypo/service name = "cyborg drink synthesizer" diff --git a/code/modules/reagents/reagent_containers/bucket.dm b/code/modules/reagents/reagent_containers/bucket.dm index 8ff3971d56fc..2a3dd2a016eb 100644 --- a/code/modules/reagents/reagent_containers/bucket.dm +++ b/code/modules/reagents/reagent_containers/bucket.dm @@ -28,16 +28,16 @@ /obj/item/chems/glass/bucket/get_utensil_food_type() return null -/obj/item/chems/glass/bucket/attackby(var/obj/D, mob/user) - if(istype(D, /obj/item/mop)) +/obj/item/chems/glass/bucket/attackby(var/obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/mop)) if(reagents.total_volume < 1) to_chat(user, SPAN_WARNING("\The [src] is empty!")) - else if(REAGENTS_FREE_SPACE(D.reagents) >= 5) - reagents.trans_to_obj(D, 5) - to_chat(user, SPAN_NOTICE("You wet \the [D] in \the [src].")) + else if(REAGENTS_FREE_SPACE(used_item.reagents) >= 5) + reagents.trans_to_obj(used_item, 5) + to_chat(user, SPAN_NOTICE("You wet \the [used_item] in \the [src].")) playsound(loc, 'sound/effects/slosh.ogg', 25, 1) else - to_chat(user, SPAN_WARNING("\The [D] is saturated.")) + to_chat(user, SPAN_WARNING("\The [used_item] is saturated.")) return TRUE return ..() diff --git a/code/modules/reagents/reagent_containers/condiments/__condiment.dm b/code/modules/reagents/reagent_containers/condiments/__condiment.dm index b450ee555497..9b5af2524d70 100644 --- a/code/modules/reagents/reagent_containers/condiments/__condiment.dm +++ b/code/modules/reagents/reagent_containers/condiments/__condiment.dm @@ -19,8 +19,8 @@ if(condiment?.condiment_type) add_to_reagents(condiment.condiment_type, reagents.maximum_volume) -/obj/item/chems/condiment/attackby(var/obj/item/W, var/mob/user) - if(IS_PEN(W)) +/obj/item/chems/condiment/attackby(var/obj/item/used_item, var/mob/user) + if(IS_PEN(used_item)) var/tmp_label = sanitize_safe(input(user, "Enter a label for [name]", "Label", label_text), MAX_NAME_LEN) if(tmp_label == label_text) return TRUE diff --git a/code/modules/reagents/reagent_containers/condiments/_condiment_large.dm b/code/modules/reagents/reagent_containers/condiments/_condiment_large.dm index 453aebbcc9a1..877b64b928bd 100644 --- a/code/modules/reagents/reagent_containers/condiments/_condiment_large.dm +++ b/code/modules/reagents/reagent_containers/condiments/_condiment_large.dm @@ -4,9 +4,3 @@ volume = 500 w_class = ITEM_SIZE_LARGE use_condiment_name = FALSE - -/obj/item/chems/condiment/large/salt/update_container_desc() - return - -/obj/item/chems/condiment/large/salt/on_update_icon() - return diff --git a/code/modules/reagents/reagent_containers/condiments/_condiment_small.dm b/code/modules/reagents/reagent_containers/condiments/_condiment_small.dm index 0ad0fd5fc498..9c92a450df16 100644 --- a/code/modules/reagents/reagent_containers/condiments/_condiment_small.dm +++ b/code/modules/reagents/reagent_containers/condiments/_condiment_small.dm @@ -5,12 +5,3 @@ amount_per_transfer_from_this = 1 volume = 20 use_condiment_name = FALSE - -/obj/item/chems/condiment/small/update_center_of_mass() - return - -/obj/item/chems/condiment/small/update_container_desc() - return - -/obj/item/chems/condiment/small/on_update_icon() - return diff --git a/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm b/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm index 6bc197a3de5f..4937cbe44298 100644 --- a/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm +++ b/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm @@ -56,14 +56,13 @@ var/global/const/DRINK_ICON_NOISY = "noise" /obj/item/chems/drinks/glass2/proc/has_fizz() if(LAZYLEN(reagents.reagent_volumes)) - var/decl/material/R = reagents.get_primary_reagent_decl() - if(("fizz" in R.glass_special)) + var/decl/material/primary_reagent = reagents.get_primary_reagent_decl() + if(("fizz" in primary_reagent.glass_special)) return 1 var/totalfizzy = 0 - for(var/rtype in reagents.reagent_volumes) - var/decl/material/re = GET_DECL(rtype) - if("fizz" in re.glass_special) - totalfizzy += REAGENT_VOLUME(reagents, rtype) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if("fizz" in reagent.glass_special) + totalfizzy += REAGENT_VOLUME(reagents, reagent) if(totalfizzy >= reagents.total_volume / 5) // 20% fizzy by volume return 1 return 0 @@ -72,13 +71,12 @@ var/global/const/DRINK_ICON_NOISY = "noise" if(LAZYLEN(reagents.reagent_volumes) > 0) if(temperature > T0C + 40) return 1 - var/decl/material/R = reagents.get_primary_reagent_decl() - if(!("vapor" in R.glass_special)) + var/decl/material/primary_reagent = reagents.get_primary_reagent_decl() + if(!("vapor" in primary_reagent.glass_special)) var/totalvape = 0 - for(var/rtype in reagents.reagent_volumes) - var/decl/material/re = GET_DECL(rtype) - if("vapor" in re.glass_special) - totalvape += REAGENT_VOLUME(reagents, type) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if("vapor" in reagent.glass_special) + totalvape += REAGENT_VOLUME(reagents, reagent) if(totalvape >= volume * 0.6) // 60% vapor by container volume return 1 return 0 @@ -199,8 +197,8 @@ var/global/const/DRINK_ICON_NOISY = "noise" else continue side = "right" -/obj/item/chems/drinks/glass2/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/utensil/spoon)) +/obj/item/chems/drinks/glass2/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/utensil/spoon)) if(user.check_intent(I_FLAG_HARM)) user.visible_message("[user] bashes \the [src] with a spoon, shattering it to pieces! What a rube.") playsound(src, "shatter", 30, 1) diff --git a/code/modules/reagents/reagent_containers/drinkingglass/extras.dm b/code/modules/reagents/reagent_containers/drinkingglass/extras.dm index 0372bc390fba..bcf3d0d9d9c5 100644 --- a/code/modules/reagents/reagent_containers/drinkingglass/extras.dm +++ b/code/modules/reagents/reagent_containers/drinkingglass/extras.dm @@ -1,8 +1,8 @@ -/obj/item/chems/drinks/glass2/attackby(obj/item/I, mob/user) +/obj/item/chems/drinks/glass2/attackby(obj/item/used_item, mob/user) if(extras.len >= 2) return ..() // max 2 extras, one on each side of the drink - if(istype(I, /obj/item/glass_extra)) - var/obj/item/glass_extra/GE = I + if(istype(used_item, /obj/item/glass_extra)) + var/obj/item/glass_extra/GE = used_item if(!can_add_extra(GE)) to_chat(user, "There's no space to put \the [GE] on \the [src]!") return TRUE @@ -12,11 +12,11 @@ to_chat(user, "You add \the [GE] to \the [src].") update_icon() return TRUE - else if(istype(I, /obj/item/food/processed_grown/slice)) + else if(istype(used_item, /obj/item/food/processed_grown/slice)) if(!rim_pos) - to_chat(user, "There's no space to put \the [I] on \the [src]!") + to_chat(user, "There's no space to put \the [used_item] on \the [src]!") return TRUE - var/obj/item/food/processed_grown/slice/FS = I + var/obj/item/food/processed_grown/slice/FS = used_item extras += FS if(!user.try_unequip(FS, src)) return TRUE @@ -46,6 +46,7 @@ return TRUE /obj/item/glass_extra + abstract_type = /obj/item/glass_extra name = "generic glass addition" desc = "This goes on a glass." var/glass_addition diff --git a/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm b/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm index d7e62d41dae3..6f7bafbe93a6 100644 --- a/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm +++ b/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm @@ -175,13 +175,6 @@ icon_state = "coffeecup_metal" material = /decl/material/solid/metal/stainlesssteel -/obj/item/chems/drinks/glass2/coffeecup/STC - name = "\improper ICCG coffee cup" - desc = "A coffee cup adorned with the flag of the Gilgamesh Colonial Confederation, for when you need some espionage charges to go with your morning coffee." - base_icon = "coffeecup_STC" - icon_state = "coffeecup_STC" - base_name = "\improper ICCG cup" - /obj/item/chems/drinks/glass2/coffeecup/pawn name = "pawn coffee cup" desc = "A black coffee cup adorned with the image of a red chess pawn." @@ -189,13 +182,6 @@ icon_state = "coffeecup_pawn" base_name = "pawn cup" -/obj/item/chems/drinks/glass2/coffeecup/britcup - name = "british coffee cup" - desc = "A coffee cup with the British flag emblazoned on it." - base_icon = "coffeecup_brit" - icon_state = "coffeecup_brit" - base_name = "british cup" - /obj/item/chems/drinks/glass2/coffeecup/tall name = "tall coffee cup" desc = "An unreasonably tall coffee cup, for when you really need to wake up in the morning." diff --git a/code/modules/reagents/reagent_containers/drinks/bottle.dm b/code/modules/reagents/reagent_containers/drinks/bottle.dm index 7797e94b0e32..3de103abcbb2 100644 --- a/code/modules/reagents/reagent_containers/drinks/bottle.dm +++ b/code/modules/reagents/reagent_containers/drinks/bottle.dm @@ -93,13 +93,13 @@ qdel(src) return B -/obj/item/chems/drinks/bottle/attackby(obj/item/W, mob/user) +/obj/item/chems/drinks/bottle/attackby(obj/item/used_item, mob/user) if(!rag) - if(istype(W, /obj/item/chems/rag)) - insert_rag(W, user) + if(istype(used_item, /obj/item/chems/rag)) + insert_rag(used_item, user) return TRUE - else if(W.isflamesource()) - return rag.attackby(W, user) + else if(used_item.isflamesource()) + return rag.attackby(used_item, user) return ..() /obj/item/chems/drinks/bottle/attack_self(mob/user) @@ -215,7 +215,7 @@ sleep(sleep_not_stacking) //Not stacking stop_spin_bottle = FALSE -/obj/item/chems/drinks/bottle/on_picked_up(mob/living/user) +/obj/item/chems/drinks/bottle/on_picked_up(mob/living/user, atom/old_loc) animate(src, transform = null, time = 0) //Restore bottle to its original position - animate() is needed to interrupt SpinAnimation() //Keeping this here for now, I'll ask if I should keep it here. @@ -272,7 +272,7 @@ /obj/item/chems/drinks/bottle/vodka name = "Tunguska Triple Distilled" - desc = "Aah, vodka. Prime choice of drink AND fuel by Indies around the galaxy." + desc = "Aah, vodka. Useful for cocktails... and as bootleg rocket fuel, for those prone to amateur rocketry or trade sanctions." icon_state = "vodkabottle" center_of_mass = @'{"x":17,"y":3}' @@ -314,7 +314,7 @@ center_of_mass = @'{"x":17,"y":10}' /obj/item/chems/drinks/bottle/holywater/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume, list("holy" = TRUE)) + add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume, list(DATA_WATER_HOLINESS = TRUE)) /obj/item/chems/drinks/bottle/vermouth name = "Goldeneye Vermouth" @@ -501,15 +501,17 @@ //////////////////////////PREMIUM ALCOHOL /////////////////////// /obj/item/chems/drinks/bottle/premiumvodka - name = "Four Stripes Quadruple Distilled" - desc = "Premium distilled vodka imported directly from the Gilgamesh Colonial Confederation." + name = "Quadruple Distilled Vodka" + desc = "Premium distilled vodka made from real, planet-grown potatoes." icon_state = "premiumvodka" center_of_mass = @'{"x":17,"y":3}' +/obj/item/chems/drinks/bottle/premiumvodka/proc/make_random_name() + var/typepick = pick("Absolut","Gold","Quadruple Distilled","Platinum","Premium") + name = "[typepick] Vodka" + /obj/item/chems/drinks/bottle/premiumvodka/populate_reagents() - var/namepick = pick("Four Stripes","Gilgamesh","Novaya Zemlya","Indie","STS-35") - var/typepick = pick("Absolut","Gold","Quadruple Distilled","Platinum","Standard") - name = "[namepick] [typepick]" + make_random_name() add_to_reagents(/decl/material/liquid/alcohol/vodka/premium, reagents.maximum_volume) /obj/item/chems/drinks/bottle/premiumwine diff --git a/code/modules/reagents/reagent_containers/drinks/juicebox.dm b/code/modules/reagents/reagent_containers/drinks/juicebox.dm index fc558edf2991..1ffae8ceb750 100644 --- a/code/modules/reagents/reagent_containers/drinks/juicebox.dm +++ b/code/modules/reagents/reagent_containers/drinks/juicebox.dm @@ -118,8 +118,8 @@ /obj/item/chems/drinks/juicebox/sensible_random/populate_reagents() var/list/chosen_reagents = juice_it() - var/decl/material/J = GET_DECL(chosen_reagents[1]) - var/decl/material/K = GET_DECL(chosen_reagents[2]) + var/decl/material/J = chosen_reagents[1] + var/decl/material/K = chosen_reagents[2] var/splash = pick("teasing", "splash", "hint", "measure", "nip", "slug", "depth", "dash", "sensation", "surge", "squirt", "spritz", "efflux", "gush", "swell") desc = "[J.liquid_name]; [J.lore_text] This one comes with \an [splash] of [K.liquid_name] in a neat box." name = "\improper [J.liquid_name] and [K.liquid_name] juicebox" diff --git a/code/modules/reagents/reagent_containers/food.dm b/code/modules/reagents/reagent_containers/food.dm index 0d8435d02954..3de925eb5c54 100644 --- a/code/modules/reagents/reagent_containers/food.dm +++ b/code/modules/reagents/reagent_containers/food.dm @@ -179,8 +179,8 @@ //Since we automatically create some reagents types for the nutriments, make sure we call this proc when overriding it /obj/item/food/populate_reagents() - . = ..() SHOULD_CALL_PARENT(TRUE) + . = ..() if(!nutriment_amt || !nutriment_type) return // Ensure our taste data is in the expected format. @@ -213,11 +213,9 @@ /obj/item/food/handle_chunk_separated() bitecount++ - /obj/item/food/proc/add_allergen_flags(new_flags) - for(var/reagent in reagents.reagent_volumes) - var/decl/material/mat = GET_DECL(reagent) - var/list/newdata = mat.mix_data(reagents, list(DATA_INGREDIENT_FLAGS = new_flags)) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + var/list/newdata = reagent.mix_data(reagents, list(DATA_INGREDIENT_FLAGS = new_flags)) if(newdata) LAZYSET(reagents.reagent_data, reagent, newdata) diff --git a/code/modules/reagents/reagent_containers/food/baking/leavened_dough.dm b/code/modules/reagents/reagent_containers/food/baking/leavened_dough.dm index f9e86d7cd552..52918c1d95fd 100644 --- a/code/modules/reagents/reagent_containers/food/baking/leavened_dough.dm +++ b/code/modules/reagents/reagent_containers/food/baking/leavened_dough.dm @@ -12,8 +12,8 @@ backyard_grilling_announcement = "is baked into a simple bun." // Dough + rolling pin = flat dough -/obj/item/food/dough/attackby(obj/item/W, mob/user) - if(!istype(W,/obj/item/kitchen/rollingpin)) +/obj/item/food/dough/attackby(obj/item/used_item, mob/user) + if(!istype(used_item,/obj/item/rollingpin)) return ..() var/obj/item/food/sliceable/flatdough/result = new() result.dropInto(loc) diff --git a/code/modules/reagents/reagent_containers/food/canned/_canned.dm b/code/modules/reagents/reagent_containers/food/canned/_canned.dm index 0959b584dbcd..28c53e81f5cd 100644 --- a/code/modules/reagents/reagent_containers/food/canned/_canned.dm +++ b/code/modules/reagents/reagent_containers/food/canned/_canned.dm @@ -34,21 +34,21 @@ to_chat(user, SPAN_NOTICE("You unseal \the [src] with a crack of metal.")) unseal() -/obj/item/food/can/attackby(obj/item/W, mob/user) +/obj/item/food/can/attackby(obj/item/used_item, mob/user) if(!ATOM_IS_OPEN_CONTAINER(src)) - if(istype(W, /obj/item/knife)) + if(istype(used_item, /obj/item/knife)) user.visible_message( - SPAN_NOTICE("\The [user] starts trying to open \the [src] with \the [W]."), + SPAN_NOTICE("\The [user] starts trying to open \the [src] with \the [used_item]."), SPAN_NOTICE("You start to open \the [src].") ) - var/open_timer = istype(W, /obj/item/knife/opener) ? 5 SECONDS : 15 SECONDS + var/open_timer = istype(used_item, /obj/item/knife/opener) ? 5 SECONDS : 15 SECONDS if(!do_after(user, open_timer, src)) to_chat(user, SPAN_WARNING("You must remain uninterrupted to open \the [src].")) return TRUE to_chat(user, SPAN_NOTICE("You unseal \the [src] with a crack of metal.")) unseal() return TRUE - else if(istype(W,/obj/item/utensil)) + else if(istype(used_item,/obj/item/utensil)) to_chat(user, SPAN_WARNING("You need a can opener to open this!")) return TRUE return ..() diff --git a/code/modules/reagents/reagent_containers/food/donkpocket.dm b/code/modules/reagents/reagent_containers/food/donkpocket.dm index b261f8781a84..55e9e809efee 100644 --- a/code/modules/reagents/reagent_containers/food/donkpocket.dm +++ b/code/modules/reagents/reagent_containers/food/donkpocket.dm @@ -57,7 +57,7 @@ heated_reagents = list( /decl/material/liquid/regenerator = 5, /decl/material/liquid/amphetamines = 0.75, - /decl/material/liquid/stimulants = 0.25 + /decl/material/liquid/accumulated/stimulants = 0.25 ) var/has_been_heated = 0 // Unlike the warm var, this checks if the one-time self-heating operation has been used. diff --git a/code/modules/reagents/reagent_containers/food/eggs.dm b/code/modules/reagents/reagent_containers/food/eggs.dm index 955ea9d8d10b..8c4b82aa292e 100644 --- a/code/modules/reagents/reagent_containers/food/eggs.dm +++ b/code/modules/reagents/reagent_containers/food/eggs.dm @@ -34,9 +34,9 @@ visible_message("\The [src] has been squashed!","You hear a smack.") qdel(src) -/obj/item/food/egg/attackby(obj/item/W, mob/user) - if(IS_PEN(W)) - var/clr = W.get_tool_property(TOOL_PEN, TOOL_PROP_COLOR_NAME) +/obj/item/food/egg/attackby(obj/item/used_item, mob/user) + if(IS_PEN(used_item)) + var/clr = used_item.get_tool_property(TOOL_PEN, TOOL_PROP_COLOR_NAME) if(!(clr in list("blue","green","mime","orange","purple","rainbow","red","yellow"))) to_chat(user, SPAN_WARNING("The egg refuses to take on this color!")) diff --git a/code/modules/reagents/reagent_containers/food/fish.dm b/code/modules/reagents/reagent_containers/food/fish.dm index fd8ec91188e0..5b6534e4e54c 100644 --- a/code/modules/reagents/reagent_containers/food/fish.dm +++ b/code/modules/reagents/reagent_containers/food/fish.dm @@ -69,9 +69,9 @@ user.put_in_hands(shell) qdel(src) -/obj/item/mollusc/attackby(var/obj/item/thing, var/mob/user) - if(thing.is_sharp() || thing.has_edge()) - user.visible_message(SPAN_NOTICE("\The [user] cracks open \the [src] with \the [thing].")) +/obj/item/mollusc/attackby(var/obj/item/used_item, var/mob/user) + if(used_item.is_sharp() || used_item.has_edge()) + user.visible_message(SPAN_NOTICE("\The [user] cracks open \the [src] with \the [used_item].")) crack_shell(user) return TRUE . = ..() diff --git a/code/modules/reagents/reagent_containers/food/lunch.dm b/code/modules/reagents/reagent_containers/food/lunch.dm index fc4f92672c18..0a1b7aa8daaa 100644 --- a/code/modules/reagents/reagent_containers/food/lunch.dm +++ b/code/modules/reagents/reagent_containers/food/lunch.dm @@ -103,8 +103,8 @@ var/global/list/lunchables_ethanol_reagents_ = list( /proc/init_lunchable_list(var/list/lunches) . = list() for(var/lunch in lunches) - var/obj/O = lunch - .[initial(O.name)] = lunch + var/object_name = atom_info_repository.get_name_for(lunch) + .[object_name] = lunch return sortTim(., /proc/cmp_text_asc) /proc/init_lunchable_reagent_list(var/list/banned_reagents, var/reagent_type) @@ -112,6 +112,6 @@ var/global/list/lunchables_ethanol_reagents_ = list( for(var/reagent_subtype in decls_repository.get_decls_of_type(reagent_type)) if(reagent_subtype in banned_reagents) continue - var/decl/material/reagent = reagent_subtype - .[initial(reagent.name)] = reagent_subtype + var/decl/material/reagent = GET_DECL(reagent_subtype) + .[reagent.liquid_name] = reagent_subtype return sortTim(., /proc/cmp_text_asc) diff --git a/code/modules/reagents/reagent_containers/food/sandwich.dm b/code/modules/reagents/reagent_containers/food/sandwich.dm index a3451736dbde..0b68fb355dad 100644 --- a/code/modules/reagents/reagent_containers/food/sandwich.dm +++ b/code/modules/reagents/reagent_containers/food/sandwich.dm @@ -1,9 +1,9 @@ -/obj/item/food/slice/bread/attackby(obj/item/W, mob/user) +/obj/item/food/slice/bread/attackby(obj/item/used_item, mob/user) - if(istype(W,/obj/item/shard) || istype(W,/obj/item/food)) + if(istype(used_item,/obj/item/shard) || istype(used_item,/obj/item/food)) var/obj/item/food/csandwich/S = new() S.dropInto(loc) - S.attackby(W,user) + S.attackby(used_item,user) qdel(src) return TRUE return ..() @@ -17,8 +17,8 @@ var/list/ingredients = list() -/obj/item/food/csandwich/attackby(obj/item/W, mob/user) - if(!istype(W, /obj/item/food) && !istype(W, /obj/item/shard)) +/obj/item/food/csandwich/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/food) && !istype(used_item, /obj/item/shard)) return ..() var/sandwich_limit = 4 @@ -29,19 +29,19 @@ if(src.contents.len > sandwich_limit) to_chat(user, "If you put anything else on \the [src] it's going to collapse.") return TRUE - if(istype(W,/obj/item/shard)) - if(!user.try_unequip(W, src)) + if(istype(used_item,/obj/item/shard)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, "You hide [W] in \the [src].") + to_chat(user, "You hide [used_item] in \the [src].") update_icon() return TRUE - else if(istype(W,/obj/item/food)) - if(!user.try_unequip(W, src)) + else if(istype(used_item,/obj/item/food)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, "You layer [W] over \the [src].") - var/obj/item/chems/F = W + to_chat(user, "You layer [used_item] over \the [src].") + var/obj/item/chems/F = used_item F.reagents.trans_to_obj(src, F.reagents.total_volume) - ingredients += W + ingredients += used_item update_icon() return TRUE return FALSE // This shouldn't ever happen but okay. diff --git a/code/modules/reagents/reagent_containers/food/sliceable/pizza/pizza_box.dm b/code/modules/reagents/reagent_containers/food/sliceable/pizza/pizza_box.dm index 6c6cf548fe68..759e2fd3b7c6 100644 --- a/code/modules/reagents/reagent_containers/food/sliceable/pizza/pizza_box.dm +++ b/code/modules/reagents/reagent_containers/food/sliceable/pizza/pizza_box.dm @@ -35,11 +35,11 @@ if(overlay && length(stacked_boxes)) var/i = 1 for(var/obj/item/pizzabox/box in stacked_boxes) - var/image/I = box.get_mob_overlay(user_mob, slot, bodypart, use_fallback_if_icon_missing, TRUE) - if(I) - I.pixel_y = i * 3 - I.pixel_x = pick(-1,0,1) - overlay.overlays += I + var/image/overlay_image = box.get_mob_overlay(user_mob, slot, bodypart, use_fallback_if_icon_missing, TRUE) + if(overlay_image) + overlay_image.pixel_y = i * 3 + overlay_image.pixel_x = pick(-1,0,1) + overlay.overlays += overlay_image i++ . = ..() @@ -220,11 +220,11 @@ return TRUE return ..() -/obj/item/pizzabox/attackby(obj/item/I, mob/user) +/obj/item/pizzabox/attackby(obj/item/used_item, mob/user) // Stacking pizza boxes. - if(istype(I, /obj/item/pizzabox)) - var/obj/item/pizzabox/box = I + if(istype(used_item, /obj/item/pizzabox)) + var/obj/item/pizzabox/box = used_item if(box.open) to_chat(user, SPAN_WARNING("You need to close \the [box] first!")) return TRUE @@ -257,7 +257,7 @@ return TRUE // Putting a pizza back in the box. - if(istype(I, /obj/item/food/sliceable/pizza)) + if(istype(used_item, /obj/item/food/sliceable/pizza)) if(!open) to_chat(user, SPAN_WARNING("Open \the [src] first!")) @@ -267,17 +267,17 @@ to_chat(user, SPAN_WARNING("\The [src] already has \the [pizza] inside!")) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - pizza = I + pizza = used_item update_strings() update_icon() - user.visible_message(SPAN_NOTICE("\The [user] slides \the [I] into \the [src].")) + user.visible_message(SPAN_NOTICE("\The [user] slides \the [used_item] into \the [src].")) return TRUE // Appending to the tag. - if(IS_PEN(I)) + if(IS_PEN(used_item)) if(open) to_chat(user, SPAN_WARNING("Close \the [src] first!")) @@ -290,7 +290,7 @@ var/box_count = LAZYLEN(stacked_boxes) var/obj/item/pizzabox/tagging_box = (box_count > 0) ? stacked_boxes[box_count] : src tagging_box.box_tag = copytext("[tagging_box.box_tag][tag_string]", 1, 30) - tagging_box.box_tag_color = I.get_tool_property(TOOL_PEN, TOOL_PROP_COLOR) || COLOR_BLACK + tagging_box.box_tag_color = used_item.get_tool_property(TOOL_PEN, TOOL_PROP_COLOR) || COLOR_BLACK user.visible_message(SPAN_NOTICE("\The [user] writes something on \the [src].")) update_strings() update_icon() diff --git a/code/modules/reagents/reagent_containers/food/sushi.dm b/code/modules/reagents/reagent_containers/food/sushi.dm index 4941b2aabedc..afb648168a04 100644 --- a/code/modules/reagents/reagent_containers/food/sushi.dm +++ b/code/modules/reagents/reagent_containers/food/sushi.dm @@ -82,34 +82,34 @@ adding += image(icon = icon, icon_state = "sashimi", pixel_x = offset, pixel_y = offset) add_overlay(adding) -/obj/item/food/sashimi/attackby(var/obj/item/I, var/mob/user) +/obj/item/food/sashimi/attackby(var/obj/item/used_item, var/mob/user) if(!(locate(/obj/structure/table) in loc)) return ..() // Add more slices. - if(istype(I, /obj/item/food/sashimi)) - var/obj/item/food/sashimi/other_sashimi = I + if(istype(used_item, /obj/item/food/sashimi)) + var/obj/item/food/sashimi/other_sashimi = used_item if(slices + other_sashimi.slices > 5) to_chat(user, "Show some restraint, would you?") return TRUE - if(!user.try_unequip(I)) + if(!user.try_unequip(used_item)) return TRUE slices += other_sashimi.slices bitesize = slices update_icon() - if(I.reagents) - I.reagents.trans_to(src, I.reagents.total_volume) - qdel(I) + if(used_item.reagents) + used_item.reagents.trans_to(src, used_item.reagents.total_volume) + qdel(used_item) return TRUE // Make sushi. - if(istype(I, /obj/item/food/boiledrice)) + if(istype(used_item, /obj/item/food/boiledrice)) if(slices > 1) to_chat(user, "Putting more than one slice of fish on your sushi is just greedy.") else - if(!user.try_unequip(I)) + if(!user.try_unequip(used_item)) return TRUE - new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) + new /obj/item/food/sushi(get_turf(src), null, TRUE, used_item, src) return TRUE . = ..() @@ -125,14 +125,14 @@ meat.set_meat_name(fish_type) // Used for turning rice into sushi. -/obj/item/food/boiledrice/attackby(var/obj/item/I, var/mob/user) +/obj/item/food/boiledrice/attackby(var/obj/item/used_item, var/mob/user) if((locate(/obj/structure/table) in loc)) - if(istype(I, /obj/item/food/sashimi)) - var/obj/item/food/sashimi/sashimi = I + if(istype(used_item, /obj/item/food/sashimi)) + var/obj/item/food/sashimi/sashimi = used_item if(sashimi.slices > 1) to_chat(user, "Putting more than one slice of fish on your sushi is just greedy.") else - new /obj/item/food/sushi(get_turf(src), null, TRUE, src, I) + new /obj/item/food/sushi(get_turf(src), null, TRUE, src, used_item) return TRUE var/static/list/sushi_types = list( /obj/item/food/friedegg, @@ -142,30 +142,30 @@ /obj/item/food/spider, /obj/item/food/butchery/meat/chicken ) - if(is_type_in_list(I, sushi_types)) - new /obj/item/food/sushi(get_turf(src), null, TRUE, src, I) + if(is_type_in_list(used_item, sushi_types)) + new /obj/item/food/sushi(get_turf(src), null, TRUE, src, used_item) return TRUE . = ..() // Used for turning other food into sushi. // TODO: maybe make these resolve_attackby overrides on boiledrice instead? -/obj/item/food/friedegg/attackby(var/obj/item/I, var/mob/user) - if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) +/obj/item/food/friedegg/attackby(var/obj/item/used_item, var/mob/user) + if((locate(/obj/structure/table) in loc) && istype(used_item, /obj/item/food/boiledrice)) + new /obj/item/food/sushi(get_turf(src), null, TRUE, used_item, src) return TRUE . = ..() -/obj/item/food/tofu/attackby(var/obj/item/I, var/mob/user) - if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) +/obj/item/food/tofu/attackby(var/obj/item/used_item, var/mob/user) + if((locate(/obj/structure/table) in loc) && istype(used_item, /obj/item/food/boiledrice)) + new /obj/item/food/sushi(get_turf(src), null, TRUE, used_item, src) return TRUE . = ..() -/obj/item/food/butchery/cutlet/raw/attackby(var/obj/item/I, var/mob/user) - if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) +/obj/item/food/butchery/cutlet/raw/attackby(var/obj/item/used_item, var/mob/user) + if((locate(/obj/structure/table) in loc) && istype(used_item, /obj/item/food/boiledrice)) + new /obj/item/food/sushi(get_turf(src), null, TRUE, used_item, src) return TRUE . = ..() -/obj/item/food/butchery/cutlet/attackby(var/obj/item/I, var/mob/user) - if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) +/obj/item/food/butchery/cutlet/attackby(var/obj/item/used_item, var/mob/user) + if((locate(/obj/structure/table) in loc) && istype(used_item, /obj/item/food/boiledrice)) + new /obj/item/food/sushi(get_turf(src), null, TRUE, used_item, src) return TRUE . = ..() // End non-fish sushi. diff --git a/code/modules/reagents/reagent_containers/food_edibility.dm b/code/modules/reagents/reagent_containers/food_edibility.dm index dfce4a7268f0..6b9a4db8d4e7 100644 --- a/code/modules/reagents/reagent_containers/food_edibility.dm +++ b/code/modules/reagents/reagent_containers/food_edibility.dm @@ -35,6 +35,7 @@ if(trash_ref) if(ispath(trash_ref, /obj/item)) var/obj/item/trash_item = new trash_ref(loc_ref) + trash_item.dropInto(loc_ref) if(feeder) feeder.put_in_hands(trash_item) else if(istype(trash_ref, /obj/item)) diff --git a/code/modules/reagents/reagent_containers/glass/bottle.dm b/code/modules/reagents/reagent_containers/glass/bottle.dm index 094887c87ac4..54559692503d 100644 --- a/code/modules/reagents/reagent_containers/glass/bottle.dm +++ b/code/modules/reagents/reagent_containers/glass/bottle.dm @@ -25,7 +25,7 @@ /obj/item/chems/glass/bottle/get_lid_color() return lid_color -/obj/item/chems/glass/bottle/on_picked_up(mob/user) +/obj/item/chems/glass/bottle/on_picked_up(mob/user, atom/old_loc) . = ..() update_icon() @@ -44,7 +44,7 @@ var/image/overglass = mutable_appearance(icon, "[icon_state]_over", color) overglass.alpha = alpha * ((alpha/255) ** 3) add_overlay(overglass) - if(material.reflectiveness >= MAT_VALUE_SHINY) + if(istype(material) && material.reflectiveness >= MAT_VALUE_SHINY) var/mutable_appearance/shine = mutable_appearance(icon, "[icon_state]_shine", adjust_brightness(color, 20 + material.reflectiveness)) shine.alpha = material.reflectiveness * 3 add_overlay(shine) diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index 98b6ee139ba9..908e70a81d5d 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -151,12 +151,12 @@ remove_vial(user) return TRUE -/obj/item/chems/hypospray/vial/attackby(obj/item/W, mob/user) - if(!istype(W, /obj/item/chems/glass/beaker/vial)) +/obj/item/chems/hypospray/vial/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/chems/glass/beaker/vial)) return ..() if(!do_after(user, 1 SECOND, src)) return TRUE - insert_vial(W, user) + insert_vial(used_item, user) return TRUE /obj/item/chems/hypospray/vial/afterattack(obj/target, mob/user, proximity) // hyposprays can be dumped into, why not out? uses standard_pour_into helper checks. diff --git a/code/modules/reagents/reagent_containers/inhaler.dm b/code/modules/reagents/reagent_containers/inhaler.dm index 69bd0710eaec..7408e7545d33 100644 --- a/code/modules/reagents/reagent_containers/inhaler.dm +++ b/code/modules/reagents/reagent_containers/inhaler.dm @@ -101,9 +101,9 @@ to_chat(user, SPAN_NOTICE("The reagents inside \the [src] are already secured.")) return TRUE -/obj/item/chems/inhaler/attackby(obj/item/tool, mob/user) - if(IS_SCREWDRIVER(tool) && !ATOM_IS_OPEN_CONTAINER(src)) - to_chat(user, SPAN_NOTICE("Using \the [tool], you unsecure the inhaler's lid.")) // it locks shut after being secured +/obj/item/chems/inhaler/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item) && !ATOM_IS_OPEN_CONTAINER(src)) + to_chat(user, SPAN_NOTICE("Using \the [used_item], you unsecure the inhaler's lid.")) // it locks shut after being secured atom_flags |= ATOM_FLAG_OPEN_CONTAINER update_icon() return TRUE diff --git a/code/modules/reagents/reagent_containers/mortar.dm b/code/modules/reagents/reagent_containers/mortar.dm index edff209c0810..76cb59c9a98e 100644 --- a/code/modules/reagents/reagent_containers/mortar.dm +++ b/code/modules/reagents/reagent_containers/mortar.dm @@ -5,21 +5,22 @@ icon_state = ICON_STATE_WORLD volume = 40 material = /decl/material/solid/stone/basalt + color = /decl/material/solid/stone/basalt::color material_alteration = MAT_FLAG_ALTERATION_ALL storage = /datum/storage/hopper/mortar var/grinding = FALSE // todo: generalize to use TOOL_PESTLE -/obj/item/chems/glass/mortar/attackby(obj/item/using_item, mob/living/user) +/obj/item/chems/glass/mortar/attackby(obj/item/used_item, mob/living/user) if((. = ..())) return - return try_grind(using_item, user) + return try_grind(used_item, user) /obj/item/chems/glass/mortar/can_lid() return FALSE -/obj/item/chems/glass/mortar/proc/try_grind(obj/item/using_item, mob/living/user) - if(!istype(using_item)) +/obj/item/chems/glass/mortar/proc/try_grind(obj/item/used_item, mob/living/user) + if(!istype(used_item)) return FALSE if(!CanPhysicallyInteract(user) || !user.check_dexterity(DEXTERITY_HOLD_ITEM)) return TRUE @@ -28,13 +29,13 @@ return TRUE var/list/contained_atoms = get_stored_inventory() var/obj/item/crushing_item = LAZYACCESS(contained_atoms, 1) - var/decl/material/attacking_material = using_item.get_material() + var/decl/material/attacking_material = used_item.get_material() var/decl/material/crushing_material = crushing_item?.get_material() var/skill_factor = CLAMP01(1 + 0.3*(user.get_skill_value(SKILL_CHEMISTRY) - SKILL_EXPERT)/(SKILL_EXPERT - SKILL_MIN)) - if(using_item.expend_attack_force(user) <= 0 || !attacking_material || !crushing_material) + if(used_item.expend_attack_force(user) <= 0 || !attacking_material || !crushing_material) return TRUE if(attacking_material.hardness <= crushing_material.hardness) - to_chat(user, SPAN_NOTICE("\The [using_item] is not hard enough to crush \the [crushing_item].")) + to_chat(user, SPAN_NOTICE("\The [used_item] is not hard enough to crush \the [crushing_item].")) return TRUE if(REAGENTS_FREE_SPACE(reagents) < crushing_item.reagents.total_volume) to_chat(user, SPAN_WARNING("\The [src] is too full to grind \the [crushing_item], it'd spill everywhere!")) @@ -47,7 +48,7 @@ if(user.get_stamina() < stamina_to_consume) to_chat(user, SPAN_WARNING("You are too tired to crush \the [crushing_item], take a break!")) return TRUE - to_chat(user, SPAN_NOTICE("You start grinding \the [crushing_item] with \the [using_item].")) + to_chat(user, SPAN_NOTICE("You start grinding \the [crushing_item] with \the [used_item].")) grinding = TRUE if(!do_after(user, stamina_to_consume SECONDS)) to_chat(user, SPAN_NOTICE("You stop grinding \the [crushing_item].")) @@ -58,9 +59,9 @@ return TRUE // already been ground! user.adjust_stamina(-stamina_to_consume) crushing_item.reagents.trans_to(src, crushing_item.reagents.total_volume, skill_factor) - to_chat(user, SPAN_NOTICE("You finish grinding \the [crushing_item] with \the [using_item].")) + to_chat(user, SPAN_NOTICE("You finish grinding \the [crushing_item] with \the [used_item].")) QDEL_NULL(crushing_item) // If there's more to crush, try looping if(length(get_stored_inventory()) > 0) - try_grind(using_item, user) + try_grind(used_item, user) return TRUE \ No newline at end of file diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 14286f7debe5..e58ada9128be 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -184,10 +184,10 @@ autolabel = FALSE /obj/item/chems/pill/zoom/populate_reagents() - add_to_reagents(/decl/material/liquid/narcotics, 5) - add_to_reagents(/decl/material/liquid/antidepressants, 5) - add_to_reagents(/decl/material/liquid/stimulants, 5) - add_to_reagents(/decl/material/liquid/amphetamines, 5) + add_to_reagents(/decl/material/liquid/narcotics, 5) + add_to_reagents(/decl/material/liquid/accumulated/antidepressants, 5) + add_to_reagents(/decl/material/liquid/accumulated/stimulants, 5) + add_to_reagents(/decl/material/liquid/amphetamines, 5) . = ..() /obj/item/chems/pill/gleam @@ -210,19 +210,19 @@ //Psychiatry pills. /obj/item/chems/pill/stimulants - desc = "Improves the ability to concentrate." + desc = "Improves the ability to concentrate. Abrupt discontinuation may result in side-effects." icon_state = "pill2" /obj/item/chems/pill/stimulants/populate_reagents() - add_to_reagents(/decl/material/liquid/stimulants, 15) + add_to_reagents(/decl/material/liquid/accumulated/stimulants, 15) . = ..() /obj/item/chems/pill/antidepressants - desc = "Mild anti-depressant." + desc = "Mild anti-depressant. Abrupt discontinuation may result in side-effects." icon_state = "pill4" /obj/item/chems/pill/antidepressants/populate_reagents() - add_to_reagents(/decl/material/liquid/antidepressants, 15) + add_to_reagents(/decl/material/liquid/accumulated/antidepressants, 15) . = ..() /obj/item/chems/pill/antirads diff --git a/code/modules/reagents/reagent_containers/retort.dm b/code/modules/reagents/reagent_containers/retort.dm index a8d69a6ce6a5..5292cd7ee9a7 100644 --- a/code/modules/reagents/reagent_containers/retort.dm +++ b/code/modules/reagents/reagent_containers/retort.dm @@ -19,9 +19,8 @@ /obj/item/chems/glass/retort/update_overlays() if(reagents?.total_volume && (!material || material.opacity < 1)) - for(var/reagent in reagents.reagent_volumes) - var/decl/material/mat = GET_DECL(reagent) - if(!isnull(mat.boiling_point) && temperature >= mat.boiling_point) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(!isnull(reagent.boiling_point) && temperature >= reagent.boiling_point) add_overlay(overlay_image(icon, "[icon_state]-fill-boil", reagents.get_color(), (RESET_ALPHA|RESET_COLOR))) return add_overlay(overlay_image(icon, "[icon_state]-fill", reagents.get_color(), (RESET_ALPHA|RESET_COLOR))) diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 400f96445fd3..9b53bcaedb9a 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -86,9 +86,9 @@ return TRUE else //If no safety, we just toggle the nozzle - var/decl/interaction_handler/IH = GET_DECL(/decl/interaction_handler/next_spray_amount) - if(IH.is_possible(src, user)) - IH.invoked(src, user, user.get_active_held_item()) + var/decl/interaction_handler/handler = GET_DECL(/decl/interaction_handler/next_spray_amount) + if(handler.is_possible(src, user)) + handler.invoked(src, user, user.get_active_held_item()) return TRUE ///Whether the spray has a safety toggle @@ -221,14 +221,6 @@ /obj/item/chems/spray/plantbgone/populate_reagents() add_to_reagents(/decl/material/liquid/weedkiller, reagents.maximum_volume) -/obj/item/chems/spray/plantbgone/afterattack(atom/A, mob/user, proximity) - if(!proximity) return - - if(istype(A, /obj/effect/blob)) // blob damage in blob code - return - - ..() - /obj/item/chems/spray/cleaner/deodorant name = "deodorant" desc = "A can of Gold Standard spray deodorant - for when you're too lazy to shower." diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 6af31c901452..f6128d0f6cd4 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -42,7 +42,7 @@ if((. = ..())) update_icon() -/obj/item/chems/syringe/on_picked_up(mob/user) +/obj/item/chems/syringe/on_picked_up(mob/user, atom/old_loc) . = ..() update_icon() @@ -64,7 +64,7 @@ . = ..() update_icon() -/obj/item/chems/syringe/attackby(obj/item/I, mob/user) +/obj/item/chems/syringe/attackby(obj/item/used_item, mob/user) return FALSE // allow afterattack to proceed /obj/item/chems/syringe/afterattack(obj/target, mob/user, proximity) diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 3e6f4ac50d7f..ecb39c854f4a 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -71,28 +71,26 @@ . += "Its refilling cap is closed." . += SPAN_NOTICE("It contains:") if(LAZYLEN(reagents?.reagent_volumes)) - for(var/rtype in reagents.liquid_volumes) - var/decl/material/R = GET_DECL(rtype) - . += SPAN_NOTICE("[LIQUID_VOLUME(reagents, rtype)] unit\s of [R.get_reagent_name(reagents, MAT_PHASE_LIQUID)].") - for(var/rtype in reagents.solid_volumes) - var/decl/material/R = GET_DECL(rtype) - . += SPAN_NOTICE("[SOLID_VOLUME(reagents, rtype)] unit\s of [R.get_reagent_name(reagents, MAT_PHASE_SOLID)].") + for(var/decl/material/reagent as anything in reagents.liquid_volumes) + . += SPAN_NOTICE("[LIQUID_VOLUME(reagents, reagent)] unit\s of [reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID)].") + for(var/decl/material/reagent as anything in reagents.solid_volumes) + . += SPAN_NOTICE("[SOLID_VOLUME(reagents, reagent)] unit\s of [reagent.get_reagent_name(reagents, MAT_PHASE_SOLID)].") else . += SPAN_NOTICE("Nothing.") if(reagents?.maximum_volume) . += "It may contain up to [reagents.maximum_volume] unit\s of fluid." -/obj/structure/reagent_dispensers/attackby(obj/item/W, mob/user) +/obj/structure/reagent_dispensers/attackby(obj/item/used_item, mob/user) // We do this here to avoid putting the vessel straight into storage. // This is usually handled by afterattack on /chems. - if(storage && ATOM_IS_OPEN_CONTAINER(W) && user.check_intent(I_FLAG_HELP)) - if(W.standard_dispenser_refill(user, src)) + if(storage && ATOM_IS_OPEN_CONTAINER(used_item) && user.check_intent(I_FLAG_HELP)) + if(used_item.standard_dispenser_refill(user, src)) return TRUE - if(W.standard_pour_into(user, src)) + if(used_item.standard_pour_into(user, src)) return TRUE - if(wrenchable && IS_WRENCH(W)) + if(wrenchable && IS_WRENCH(used_item)) unwrenched = !unwrenched visible_message(SPAN_NOTICE("\The [user] wrenches \the [src]'s tap [unwrenched ? "open" : "shut"].")) if(unwrenched) @@ -145,11 +143,11 @@ name = "firefighting water reserve" volume = 50000 -/obj/structure/reagent_dispensers/watertank/attackby(obj/item/W, mob/user) +/obj/structure/reagent_dispensers/watertank/attackby(obj/item/used_item, mob/user) //FIXME: Maybe this should be handled differently? Since it can essentially make the tank unusable. - if((istype(W, /obj/item/robot_parts/l_arm) || istype(W, /obj/item/robot_parts/r_arm)) && user.try_unequip(W)) - to_chat(user, "You add \the [W] arm to \the [src].") - qdel(W) + if((istype(used_item, /obj/item/robot_parts/l_arm) || istype(used_item, /obj/item/robot_parts/r_arm)) && user.try_unequip(used_item)) + to_chat(user, "You add \the [used_item] arm to \the [src].") + qdel(used_item) new /obj/item/farmbot_arm_assembly(loc, src) return TRUE . = ..() @@ -283,14 +281,14 @@ to_chat(user, "\The [src]'s cup dispenser is empty.") return TRUE -/obj/structure/reagent_dispensers/water_cooler/attackby(obj/item/W, mob/user) +/obj/structure/reagent_dispensers/water_cooler/attackby(obj/item/used_item, mob/user) //Allow refilling with a box - if(cups < max_cups && W?.storage) - for(var/obj/item/chems/drinks/C in W.storage.get_contents()) + if(cups < max_cups && used_item?.storage) + for(var/obj/item/chems/drinks/C in used_item.storage.get_contents()) if(cups >= max_cups) break if(istype(C, cup_type)) - W.storage.remove_from_storage(user, C, src) + used_item.storage.remove_from_storage(user, C, src) qdel(C) cups++ return TRUE diff --git a/code/modules/reagents/storage/pill_bottle.dm b/code/modules/reagents/storage/pill_bottle.dm index b526d767e02c..28482973709c 100644 --- a/code/modules/reagents/storage/pill_bottle.dm +++ b/code/modules/reagents/storage/pill_bottle.dm @@ -64,4 +64,28 @@ /obj/item/pill_bottle/on_update_icon() . = ..() if(wrapper_color) - add_overlay(overlay_image(icon, "pillbottle_wrap", wrapper_color, RESET_COLOR)) \ No newline at end of file + add_overlay(overlay_image(icon, "pillbottle_wrap", wrapper_color, RESET_COLOR)) + +/obj/item/pill_bottle/attackby(obj/item/used_item, mob/user) + if(IS_PEN(used_item)) + var/tmp_label = sanitize_safe(input(user, "Enter a label for [name]", "Label", labeled_name), MAX_NAME_LEN) + tmp_label = user.handle_writing_literacy(user, tmp_label) + + var/label_length = length(tmp_label) + if(label_length > 50) + to_chat(user, "The label can be at most 50 characters long.") + else + if(label_length > 10) + to_chat(user, "You set the label.") + else + to_chat(user, "You set the label to \"[tmp_label]\".") + + var/decl/tool_archetype/pen/parch = GET_DECL(TOOL_PEN) + if(parch.decrement_uses(user, used_item, max(round(label_length / 25, 1), 1)) <= 0) + parch.warn_out_of_ink(user, used_item) + + var/datum/extension/labels/lext = get_or_create_extension(src, /datum/extension/labels) + lext.RemoveAllLabels() + attach_label(null, null, tmp_label) + return TRUE + return ..() \ No newline at end of file diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index da96a75e031b..ccfd214b9623 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -86,8 +86,8 @@ var/global/list/all_conveyor_switches = list() return TRUE // attack with item, place item on conveyor -/obj/machinery/conveyor/attackby(var/obj/item/I, mob/user) - if(IS_CROWBAR(I)) +/obj/machinery/conveyor/attackby(var/obj/item/used_item, mob/user) + if(IS_CROWBAR(used_item)) if(!(stat & BROKEN)) var/obj/item/conveyor_construct/C = new/obj/item/conveyor_construct(src.loc) C.id_tag = id_tag @@ -95,7 +95,7 @@ var/global/list/all_conveyor_switches = list() to_chat(user, "You remove the conveyor belt.") qdel(src) else - user.try_unequip(I, get_turf(src)) + user.try_unequip(used_item, get_turf(src)) return TRUE // make the conveyor broken @@ -207,8 +207,8 @@ var/global/list/all_conveyor_switches = list() last_pos = position position = 0 -/obj/machinery/conveyor_switch/attackby(obj/item/I, mob/user, params) - if(!IS_CROWBAR(I)) +/obj/machinery/conveyor_switch/attackby(obj/item/used_item, mob/user, params) + if(!IS_CROWBAR(used_item)) return ..() var/obj/item/conveyor_switch_construct/C = new/obj/item/conveyor_switch_construct(src.loc) C.id_tag = id_tag @@ -241,11 +241,11 @@ var/global/list/all_conveyor_switches = list() matter = list(/decl/material/solid/organic/plastic = MATTER_AMOUNT_REINFORCEMENT) var/id_tag -/obj/item/conveyor_construct/attackby(obj/item/I, mob/user, params) - if(!istype(I, /obj/item/conveyor_switch_construct)) +/obj/item/conveyor_construct/attackby(obj/item/used_item, mob/user, params) + if(!istype(used_item, /obj/item/conveyor_switch_construct)) return ..() to_chat(user, "You link the switch to the conveyor belt assembly.") - var/obj/item/conveyor_switch_construct/C = I + var/obj/item/conveyor_switch_construct/C = used_item id_tag = C.id_tag return TRUE diff --git a/code/modules/recycling/disposal-construction.dm b/code/modules/recycling/disposal-construction.dm index 132771035d47..7724f726e4a1 100644 --- a/code/modules/recycling/disposal-construction.dm +++ b/code/modules/recycling/disposal-construction.dm @@ -120,7 +120,7 @@ // attackby item // wrench: (un)anchor // weldingtool: convert to real pipe -/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user) +/obj/structure/disposalconstruct/attackby(var/obj/item/used_item, var/mob/user) var/turf/T = loc if(!istype(T)) return TRUE @@ -130,7 +130,7 @@ var/obj/structure/disposalpipe/CP = locate() in T - if(IS_WRENCH(I)) + if(IS_WRENCH(used_item)) if(anchored) anchored = FALSE wrench_down(FALSE) @@ -144,14 +144,14 @@ update() update_verbs() return TRUE - else if(istype(I, /obj/item/weldingtool)) + else if(istype(used_item, /obj/item/weldingtool)) if(anchored) - var/obj/item/weldingtool/W = I - if(W.weld(0,user)) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0,user)) playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) to_chat(user, "Welding \the [src] in place.") if(do_after(user, 2 SECONDS, src)) - if(!src || !W.isOn()) return TRUE + if(!src || !welder.isOn()) return TRUE to_chat(user, "\The [src] has been welded in place!") build(CP) qdel(src) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index a50fa92e738f..efcccf407aac 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -68,8 +68,6 @@ var/global/list/diversion_junctions = list() return FALSE /obj/machinery/disposal/cannot_transition_to(state_path, mob/user) - if(mode > 0) - return SPAN_NOTICE("Turn off the pump first.") if(contents.len > LAZYLEN(component_parts)) return SPAN_NOTICE("Eject the items first!") return ..() @@ -90,25 +88,25 @@ var/global/list/diversion_junctions = list() return ..() // attack by item places it in to disposal -/obj/machinery/disposal/attackby(var/obj/item/I, var/mob/user) +/obj/machinery/disposal/attackby(var/obj/item/used_item, var/mob/user) if((. = ..())) return - if(stat & BROKEN || !I || !user) + if(stat & BROKEN || !used_item || !user) return - if(istype(I, /obj/item/bag/trash)) - if(I.storage) + if(istype(used_item, /obj/item/bag/trash)) + if(used_item.storage) to_chat(user, "You empty the bag.") - for(var/obj/item/O in I.storage.get_contents()) - I.storage.remove_from_storage(user, O, src, TRUE) - I.storage.finish_bulk_removal() + for(var/obj/item/O in used_item.storage.get_contents()) + used_item.storage.remove_from_storage(user, O, src, TRUE) + used_item.storage.finish_bulk_removal() update_icon() return - if(!user.try_unequip(I, src) || QDELETED(I)) + if(!user.try_unequip(used_item, src) || QDELETED(used_item)) return - user.visible_message("\The [user] places \the [I] into \the [src].", "You place \the [I] into \the [src].") + user.visible_message("\The [user] places \the [used_item] into \the [src].", "You place \the [used_item] into \the [src].") update_icon() @@ -263,7 +261,7 @@ var/global/list/diversion_junctions = list() if(isAI(user) && (href_list["handle"] || href_list["eject"])) return min(STATUS_UPDATE, ..()) if(mode==-1 && !href_list["eject"]) // only allow ejecting if mode is -1 - to_chat(user, "The disposal units power is disabled.") + to_chat(user, "The disposal unit's power is disabled.") return min(STATUS_UPDATE, ..()) if(flushing) return min(STATUS_UPDATE, ..()) @@ -438,14 +436,14 @@ var/global/list/diversion_junctions = list() /obj/machinery/disposal/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if (istype(mover,/obj/item) && mover.throwing) - var/obj/item/I = mover - if(istype(I, /obj/item/projectile)) + var/obj/item/thing = mover + if(istype(thing, /obj/item/projectile)) return if(prob(75)) - I.forceMove(src) - visible_message("\The [I] lands in \the [src].") + thing.forceMove(src) + visible_message("\The [thing] lands in \the [src].") else - visible_message("\The [I] bounces off of \the [src]'s rim!") + visible_message("\The [thing] bounces off of \the [src]'s rim!") return 0 else return ..(mover, target, height, air_group) @@ -472,8 +470,8 @@ var/global/list/diversion_junctions = list() junctions.Cut() return ..() -/obj/machinery/disposal_switch/attackby(obj/item/I, mob/user, params) - if(IS_CROWBAR(I)) +/obj/machinery/disposal_switch/attackby(obj/item/used_item, mob/user, params) + if(IS_CROWBAR(used_item)) var/obj/item/disposal_switch_construct/C = new/obj/item/disposal_switch_construct(src.loc, id_tag) transfer_fingerprints_to(C) user.visible_message("\The [user] deattaches \the [src]") @@ -571,9 +569,9 @@ var/global/list/diversion_junctions = list() sleep(20) //wait until correct animation frame playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0) -/obj/structure/disposaloutlet/attackby(var/obj/item/I, var/mob/user) - src.add_fingerprint(user, 0, I) - if(IS_SCREWDRIVER(I)) +/obj/structure/disposaloutlet/attackby(var/obj/item/used_item, var/mob/user) + src.add_fingerprint(user, 0, used_item) + if(IS_SCREWDRIVER(used_item)) switch(mode) if(0) mode=1 @@ -587,15 +585,15 @@ var/global/list/diversion_junctions = list() return TRUE else // This should be invalid? return FALSE - else if(istype(I,/obj/item/weldingtool) && mode==1) - var/obj/item/weldingtool/W = I - if(W.weld(0,user)) + else if(istype(used_item,/obj/item/weldingtool) && mode==1) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0,user)) playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) to_chat(user, "You start slicing the floorweld off the disposal outlet.") if(!do_after(user, 2 SECONDS, src)) to_chat(user, "You must remain still to deconstruct \the [src].") return TRUE - if(QDELETED(src) || !W.isOn()) + if(QDELETED(src) || !welder.isOn()) return TRUE to_chat(user, "You sliced the floorweld off the disposal outlet.") var/obj/structure/disposalconstruct/machine/outlet/C = new (loc, src) diff --git a/code/modules/recycling/disposalpipe.dm b/code/modules/recycling/disposalpipe.dm index 6727ee5fbfa8..0ed921518169 100644 --- a/code/modules/recycling/disposalpipe.dm +++ b/code/modules/recycling/disposalpipe.dm @@ -201,20 +201,20 @@ //attack by item //weldingtool: unfasten and convert to obj/disposalconstruct -/obj/structure/disposalpipe/attackby(var/obj/item/I, var/mob/user) - if(!istype(I, /obj/item/weldingtool)) +/obj/structure/disposalpipe/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/weldingtool)) return ..() if(!can_deconstruct()) return TRUE - src.add_fingerprint(user, 0, I) - var/obj/item/weldingtool/W = I - if(W.weld(0,user)) + src.add_fingerprint(user, 0, used_item) + var/obj/item/weldingtool/welder = used_item + if(welder.weld(0,user)) playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1) to_chat(user, "You begin slicing \the [src].") if(!do_after(user, 3 SECONDS, src)) to_chat(user, "You must stay still while welding the pipe.") return TRUE - if(!W.isOn()) + if(!welder.isOn()) return TRUE welded() return TRUE @@ -440,10 +440,10 @@ updatedesc() update() -/obj/structure/disposalpipe/tagger/attackby(var/obj/item/item, var/mob/user) - if(!istype(item, /obj/item/destTagger)) +/obj/structure/disposalpipe/tagger/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/destTagger)) return ..() - var/obj/item/destTagger/tagger = item + var/obj/item/destTagger/tagger = used_item if(tagger.current_tag)// Tag set sort_tag = tagger.current_tag playsound(src.loc, 'sound/machines/twobeep.ogg', 100, 1) @@ -515,10 +515,10 @@ linked = null return ..() -/obj/structure/disposalpipe/diversion_junction/attackby(var/obj/item/item, var/mob/user) - if(!istype(item, /obj/item/disposal_switch_construct)) +/obj/structure/disposalpipe/diversion_junction/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/disposal_switch_construct)) return ..() - var/obj/item/disposal_switch_construct/switchcon = item + var/obj/item/disposal_switch_construct/switchcon = used_item if(switchcon.id_tag) id_tag = switchcon.id_tag playsound(src.loc, 'sound/machines/twobeep.ogg', 100, TRUE) @@ -607,10 +607,10 @@ updatedesc() updatename() -/obj/structure/disposalpipe/sortjunction/attackby(var/obj/item/item, var/mob/user) - if(!istype(item, /obj/item/destTagger)) +/obj/structure/disposalpipe/sortjunction/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/destTagger)) return ..() - var/obj/item/destTagger/tagger = item + var/obj/item/destTagger/tagger = used_item if(tagger.current_tag)// Tag set sort_type = tagger.current_tag playsound(src.loc, 'sound/machines/twobeep.ogg', 100, TRUE) diff --git a/code/modules/recycling/package_wrapper.dm b/code/modules/recycling/package_wrapper.dm index 631ebef3e863..ba8b75246be9 100644 --- a/code/modules/recycling/package_wrapper.dm +++ b/code/modules/recycling/package_wrapper.dm @@ -108,7 +108,7 @@ to_chat(user, SPAN_WARNING("\The [target] moving around too much. Restrain or incapacitate them first.")) /obj/item/stack/package_wrap/afterattack(var/obj/target, mob/user, proximity_flag, click_parameters) - if(!proximity_flag || !can_wrap(target) || (user.isEquipped(target) && !user.canUnEquip(target))) + if(!proximity_flag || !can_wrap(target) || (user.isEquipped(target) && !user.can_unequip_item(target))) return user.setClickCooldown(attack_cooldown) return wrap(target, user) || ..() diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index afae8f24b694..23146a957fc4 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -6,6 +6,8 @@ icon_state = "chute" base_type = /obj/machinery/disposal/deliveryChute/buildable frame_type = /obj/structure/disposalconstruct/machine/chute + // TODO: Convert attackby() override and c_mode vars to use construct states + construct_state = null var/c_mode = 0 @@ -79,8 +81,8 @@ update_icon() return -/obj/machinery/disposal/deliveryChute/attackby(var/obj/item/I, var/mob/user) - if(IS_SCREWDRIVER(I)) +/obj/machinery/disposal/deliveryChute/attackby(var/obj/item/used_item, var/mob/user) + if(IS_SCREWDRIVER(used_item)) if(c_mode==0) c_mode=1 playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, TRUE) @@ -91,16 +93,16 @@ playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, TRUE) to_chat(user, "You attach the screws around the power connection.") return TRUE - else if(IS_WELDER(I) && c_mode==1) - var/obj/item/weldingtool/W = I - if(!W.weld(1,user)) // 'you need more welding fuel' messages are already handled + else if(IS_WELDER(used_item) && c_mode==1) + var/obj/item/weldingtool/welder = used_item + if(!welder.weld(1,user)) // 'you need more welding fuel' messages are already handled return TRUE to_chat(user, "You start slicing the floorweld off the delivery chute.") if(!do_after(user, 2 SECONDS, src)) to_chat(user, "You stop slicing the floorweld off the delivery chute.") return TRUE playsound(src.loc, 'sound/items/Welder2.ogg', 100, TRUE) - if(!src || !W.isOn()) return TRUE + if(!src || !welder.isOn()) return TRUE to_chat(user, "You slice the floorweld off the delivery chute.") var/obj/structure/disposalconstruct/C = new (loc, src) C.update() diff --git a/code/modules/recycling/wrapped_package.dm b/code/modules/recycling/wrapped_package.dm index a18575b5f536..65d8fcd62610 100644 --- a/code/modules/recycling/wrapped_package.dm +++ b/code/modules/recycling/wrapped_package.dm @@ -176,10 +176,10 @@ return TRUE return ..() -/obj/item/parcel/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/destTagger)) +/obj/item/parcel/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/destTagger)) user.setClickCooldown(attack_cooldown) - var/obj/item/destTagger/O = W + var/obj/item/destTagger/O = used_item if(length(O.current_tag)) to_chat(user, SPAN_NOTICE("You have labeled the destination as '[O.current_tag]'.")) attach_destination_tag(O, user) @@ -187,15 +187,15 @@ to_chat(user, SPAN_WARNING("You need to set a destination tag first!")) return TRUE - else if(IS_PEN(W)) + else if(IS_PEN(used_item)) var/old_note = attached_note var/new_note = sanitize(input(user, "What note would you like to add to \the [src]?", "Add Note", attached_note)) - if((new_note != old_note) && user.Adjacent(src) && W.do_tool_interaction(TOOL_PEN, user, src, 2 SECONDS) && user.Adjacent(src)) + if((new_note != old_note) && user.Adjacent(src) && used_item.do_tool_interaction(TOOL_PEN, user, src, 2 SECONDS) && user.Adjacent(src)) attached_note = new_note update_icon() return TRUE - else if(W.is_sharp() && user.check_intent(I_FLAG_HELP)) + else if(used_item.is_sharp() && user.check_intent(I_FLAG_HELP)) //You can alternative cut the wrapper off with a sharp item unwrap(user) return TRUE diff --git a/code/modules/research/design_database_analyzer.dm b/code/modules/research/design_database_analyzer.dm index 6750ea55a043..e4d6d06669d5 100644 --- a/code/modules/research/design_database_analyzer.dm +++ b/code/modules/research/design_database_analyzer.dm @@ -79,9 +79,9 @@ D.ui_interact(user) return TRUE -/obj/machinery/destructive_analyzer/attackby(var/obj/item/O, var/mob/user) +/obj/machinery/destructive_analyzer/attackby(var/obj/item/used_item, var/mob/user) - if(IS_MULTITOOL(O) && !user.check_intent(I_FLAG_HARM)) + if(IS_MULTITOOL(used_item) && !user.check_intent(I_FLAG_HARM)) var/datum/extension/local_network_member/fabnet = get_extension(src, /datum/extension/local_network_member) fabnet.get_new_tag(user) return TRUE @@ -89,7 +89,7 @@ if(busy) to_chat(user, SPAN_WARNING("\The [src] is busy right now.")) return TRUE - if((. = component_attackby(O, user))) + if((. = component_attackby(used_item, user))) return if(isrobot(user)) return TRUE @@ -99,21 +99,21 @@ if(panel_open) to_chat(user, SPAN_WARNING("You can't load \the [src] while it's opened.")) return TRUE - var/tech = O.get_origin_tech() + var/tech = used_item.get_origin_tech() if(!tech) - to_chat(user, SPAN_WARNING("Nothing can be learned from \the [O].")) + to_chat(user, SPAN_WARNING("Nothing can be learned from \the [used_item].")) return TRUE var/list/techlvls = cached_json_decode(tech) - if(!length(techlvls) || O.holographic) + if(!length(techlvls) || used_item.holographic) to_chat(user, SPAN_WARNING("You cannot deconstruct this item.")) return TRUE - if(!user.try_unequip(O, src)) + if(!user.try_unequip(used_item, src)) return TRUE busy = TRUE - loaded_item = O - to_chat(user, SPAN_NOTICE("You add \the [O] to \the [src].")) + loaded_item = used_item + to_chat(user, SPAN_NOTICE("You add \the [used_item] to \the [src].")) flick("d_analyzer_la", src) addtimer(CALLBACK(src, PROC_REF(refresh_busy)), 1 SECOND) return TRUE diff --git a/code/modules/scanners/breath.dm b/code/modules/scanners/breath.dm index bc80d7c7b9f0..24d83b582c71 100644 --- a/code/modules/scanners/breath.dm +++ b/code/modules/scanners/breath.dm @@ -55,10 +55,11 @@ else if(lungs.breath_fail_ratio < 1) breathing = "shallow" + var/has_breath = TRUE switch(breathing) if("none") . += "Alert: No breathing detected." - return + has_breath = FALSE if("shallow") . += "Subject's breathing is abnormally shallow." if("normal") @@ -89,30 +90,32 @@ // Reagent data. . += "[b]Reagent scan:[endb]" - var/print_reagent_default_message = TRUE - if (target.has_chemical_effect(CE_ALCOHOL, 1)) - . += "Alcohol detected in subject's breath." - print_reagent_default_message = FALSE - if (target.has_chemical_effect(CE_ALCOHOL_TOXIC, 1)) - . += "Subject is suffering from alcohol poisoning." - print_reagent_default_message = FALSE - - var/datum/reagents/inhaled = target.get_inhaled_reagents() - if(inhaled && inhaled.total_volume) - var/unknown = 0 - for(var/rtype in inhaled.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - if(R.scannable) - print_reagent_default_message = FALSE - . += "[capitalize(R.gas_name)] found in subject's breath." - else - ++unknown - if(unknown) + if(has_breath) + var/print_reagent_default_message = TRUE + if (target.has_chemical_effect(CE_ALCOHOL, 1)) + . += "Alcohol detected in subject's breath." + print_reagent_default_message = FALSE + if (target.has_chemical_effect(CE_ALCOHOL_TOXIC, 1)) + . += "Subject is suffering from alcohol poisoning." print_reagent_default_message = FALSE - . += "Non-medical reagent[(unknown > 1)?"s":""] found in subject's breath." - if(print_reagent_default_message) - . += "No results." + var/datum/reagents/inhaled = target.get_inhaled_reagents() + if(inhaled && inhaled.total_volume) + var/unknown = 0 + for(var/decl/material/reagent as anything in inhaled.reagent_volumes) + if(reagent.scannable) + print_reagent_default_message = FALSE + . += "[capitalize(reagent.gas_name)] found in subject's breath." + else + ++unknown + if(unknown) + print_reagent_default_message = FALSE + . += "Non-medical reagent[(unknown > 1)?"s":""] found in subject's breath." + + if(print_reagent_default_message) + . += "No results." + else + . += "Unable to obtain breath sample!" header = jointext(header, null) . = jointext(.,"
    ") diff --git a/code/modules/scanners/health.dm b/code/modules/scanners/health.dm index 20db2e1f9cda..487327777b42 100644 --- a/code/modules/scanners/health.dm +++ b/code/modules/scanners/health.dm @@ -244,11 +244,10 @@ if(H.reagents.total_volume) var/unknown = 0 var/reagentdata[0] - for(var/A in H.reagents.reagent_volumes) - var/decl/material/R = GET_DECL(A) - if(R.scannable) + for(var/decl/material/reagent as anything in H.reagents.reagent_volumes) + if(reagent.scannable) print_reagent_default_message = FALSE - reagentdata[A] = "[round(REAGENT_VOLUME(H.reagents, A), 1)]u [R.use_name]" + reagentdata[reagent.type] = "[round(REAGENT_VOLUME(H.reagents, reagent), 1)]u [reagent.use_name]" else unknown++ if(reagentdata.len) @@ -264,11 +263,10 @@ if(touching_reagents && touching_reagents.total_volume) var/unknown = 0 var/reagentdata[0] - for(var/A in touching_reagents.reagent_volumes) - var/decl/material/R = GET_DECL(A) - if(R.scannable) + for(var/decl/material/reagent as anything in touching_reagents.reagent_volumes) + if(reagent.scannable) print_reagent_default_message = FALSE - reagentdata[R.type] = "[round(REAGENT_VOLUME(H.reagents, R.type), 1)]u [R.name]" + reagentdata[reagent.type] = "[round(REAGENT_VOLUME(H.reagents, reagent), 1)]u [reagent.name]" else unknown++ if(reagentdata.len) @@ -283,11 +281,10 @@ var/datum/reagents/ingested = H.get_ingested_reagents() if(ingested && ingested.total_volume) var/unknown = 0 - for(var/rtype in ingested.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - if(R.scannable) + for(var/decl/material/reagent as anything in ingested.reagent_volumes) + if(reagent.scannable) print_reagent_default_message = FALSE - . += "[capitalize(R.use_name)] found in subject's stomach." + . += "[capitalize(reagent.use_name)] found in subject's stomach." else ++unknown if(unknown) @@ -297,23 +294,21 @@ var/datum/reagents/inhaled = H.get_inhaled_reagents() if(inhaled && inhaled.total_volume) var/unknown = 0 - for(var/rtype in inhaled.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - if(R.scannable) + for(var/decl/material/reagent as anything in inhaled.reagent_volumes) + if(reagent.scannable) print_reagent_default_message = FALSE - . += "[capitalize(R.use_name)] found in subject's lungs." + . += "[capitalize(reagent.use_name)] found in subject's lungs." else ++unknown if(unknown) print_reagent_default_message = FALSE . += "Non-medical reagent[(unknown > 1)?"s":""] found in subject's lungs." - if(length(H.chem_doses)) + if(length(H._chem_doses)) var/list/chemtraces = list() - for(var/T in H.chem_doses) - var/decl/material/R = T - if(initial(R.scannable)) - chemtraces += "[initial(R.name)] ([LAZYACCESS(H.chem_doses, T)])" + for(var/decl/material/reagent in H._chem_doses) + if(reagent.scannable) + chemtraces += "[reagent.use_name] ([CHEM_DOSE(H, reagent)])" if(chemtraces.len) . += "Metabolism products of [english_list(chemtraces)] found in subject's system." diff --git a/code/modules/scanners/mass_spectrometer.dm b/code/modules/scanners/mass_spectrometer.dm index e04924c6d7ec..7e186c85abfe 100644 --- a/code/modules/scanners/mass_spectrometer.dm +++ b/code/modules/scanners/mass_spectrometer.dm @@ -47,37 +47,36 @@ ..() /proc/mass_spectrometer_scan(var/datum/reagents/reagents, mob/user, var/details) - if(!reagents || !reagents.total_volume) - return "No sample to scan." + if(!reagents?.total_volume) + return SPAN_WARNING("No sample to scan.") var/list/blood_traces = list() var/list/blood_doses = list() - if(length(reagents.reagent_volumes) == 1) - var/decl/material/liquid/random/random = GET_DECL(reagents.reagent_volumes[1]) - if(istype(random)) - return random.get_scan_data(user) + if(length(reagents.reagent_volumes) == 1 && istype(reagents.primary_reagent, /decl/material/liquid/random)) + var/decl/material/liquid/random/random = reagents.primary_reagent + return random.get_scan_data(user) - for(var/R in reagents.reagent_volumes) - if(!ispath(R, /decl/material/liquid/blood)) - return "The sample was contaminated! Please insert another sample" - var/data = REAGENT_DATA(reagents, R) + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(!istype(reagent, /decl/material/liquid/blood)) + return SPAN_WARNING("The sample was contaminated! Please insert another sample.") + var/data = REAGENT_DATA(reagents, reagent) if(islist(data)) blood_traces = data[DATA_BLOOD_TRACE_CHEM] blood_doses = data[DATA_BLOOD_DOSE_CHEM] break var/list/dat = list("Trace Chemicals Found: ") - for(var/T in blood_traces) - var/decl/material/R = T + for(var/trace_type in blood_traces) + var/decl/material/trace_material = GET_DECL(trace_type) if(details) - dat += "[initial(R.name)] ([blood_traces[T]] units) " + dat += "[trace_material.use_name] ([blood_traces[trace_type]] units) " else - dat += "[initial(R.name)] " + dat += "[trace_material.use_name] " if(details) dat += "Metabolism Products of Chemicals Found:" - for(var/T in blood_doses) - var/decl/material/R = T - dat += "[initial(R.name)] ([blood_doses[T]] units) " + for(var/dose_type in blood_doses) + var/decl/material/dose_material = GET_DECL(dose_type) + dat += "[dose_material.use_name] ([blood_doses[dose_type]] units) " return jointext(dat, "
    ") diff --git a/code/modules/scanners/plant.dm b/code/modules/scanners/plant.dm index dea3d5bd12dc..e2768e691db6 100644 --- a/code/modules/scanners/plant.dm +++ b/code/modules/scanners/plant.dm @@ -81,12 +81,10 @@ if(LAZYLEN(grown_reagents?.reagent_volumes)) dat += "

    Reagent Data

    " dat += "
    This sample contains: " - for(var/ltype in grown_reagents.liquid_volumes) - var/decl/material/R = GET_DECL(ltype) - dat += "
    - [R.get_reagent_name(grown_reagents, MAT_PHASE_LIQUID)], [LIQUID_VOLUME(grown_reagents, ltype)] unit(s)" - for(var/stype in grown_reagents.solid_volumes) - var/decl/material/R = GET_DECL(stype) - dat += "
    - [R.get_reagent_name(grown_reagents, MAT_PHASE_SOLID)], [SOLID_VOLUME(grown_reagents, stype)] unit(s)" + for(var/decl/material/reagent as anything in grown_reagents.liquid_volumes) + dat += "
    - [reagent.get_reagent_name(grown_reagents, MAT_PHASE_LIQUID)], [LIQUID_VOLUME(grown_reagents, reagent)] unit(s)" + for(var/decl/material/reagent as anything in grown_reagents.solid_volumes) + dat += "
    - [reagent.get_reagent_name(grown_reagents, MAT_PHASE_SOLID)], [SOLID_VOLUME(grown_reagents, reagent)] unit(s)" dat += "

    Other Data

    " if(length(extended_trait_data)) diff --git a/code/modules/scanners/reagents.dm b/code/modules/scanners/reagents.dm index 2087c8027ba6..079117f25885 100644 --- a/code/modules/scanners/reagents.dm +++ b/code/modules/scanners/reagents.dm @@ -21,9 +21,8 @@ return list("No active chemical agents found in [O].") . = list("Chemicals found in [O]:") var/one_percent = O.reagents.total_volume / 100 - for (var/rtype in O.reagents.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - . += "[R.name][details ? ": [REAGENT_VOLUME(O.reagents, rtype) / one_percent]%" : ""]" + for (var/decl/material/reagent as anything in O.reagents.reagent_volumes) + . += "[reagent.name][details ? ": [REAGENT_VOLUME(O.reagents, reagent) / one_percent]%" : ""]" /obj/item/scanner/reagent/adv name = "advanced reagent scanner" diff --git a/code/modules/scent/_scent.dm b/code/modules/scent/_scent.dm index 2298b57494d2..68a96e3aa0b8 100644 --- a/code/modules/scent/_scent.dm +++ b/code/modules/scent/_scent.dm @@ -1,7 +1,3 @@ -var/global/const/SCENT_DESC_ODOR = "odour" -var/global/const/SCENT_DESC_SMELL = "smell" -var/global/const/SCENT_DESC_FRAGRANCE = "fragrance" - /***** Scent intensity *****/ @@ -117,7 +113,7 @@ Reagents have the following vars, which coorelate to the vars on the standard sc scent_intensity, scent_descriptor, scent_range -To add a scent extension to an atom using a reagent's info, where R. is the reagent, use set_scent_by_reagents(). +To add a scent extension to an atom using a reagent's info, where reagent. is the reagent, use set_scent_by_reagents(). *****/ /proc/set_scent_by_reagents(var/atom/smelly_atom) @@ -131,14 +127,13 @@ To add a scent extension to an atom using a reagent's info, where R. is the reag var/scent_intensity if(!holder || !holder.total_volume) return - for(var/reagent_type in holder.reagent_volumes) - var/decl/material/R = GET_DECL(reagent_type) - if(!R.scent) + for(var/decl/material/reagent as anything in holder.reagent_volumes) + if(!reagent.scent) continue - var/decl/scent_intensity/SI = GET_DECL(R.scent_intensity) - var/r_scent_intensity = REAGENT_VOLUME(holder, reagent_type) * SI.intensity + var/decl/scent_intensity/scent = GET_DECL(reagent.scent_intensity) + var/r_scent_intensity = REAGENT_VOLUME(holder, reagent) * scent.intensity if(r_scent_intensity > scent_intensity) - smelliest = R + smelliest = reagent scent_intensity = r_scent_intensity return smelliest \ No newline at end of file diff --git a/code/modules/sealant_gun/sealant_gun.dm b/code/modules/sealant_gun/sealant_gun.dm index 37d42c36a6e8..23be0cf3efcd 100644 --- a/code/modules/sealant_gun/sealant_gun.dm +++ b/code/modules/sealant_gun/sealant_gun.dm @@ -62,9 +62,9 @@ else . += SPAN_WARNING("\The [src] has no sealant loaded.") -/obj/item/gun/launcher/sealant/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/sealant_tank) && user.try_unequip(W, src)) - loaded_tank = W +/obj/item/gun/launcher/sealant/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/sealant_tank) && user.try_unequip(used_item, src)) + loaded_tank = used_item to_chat(user, SPAN_NOTICE("You slot \the [loaded_tank] into \the [src].")) update_icon() return TRUE diff --git a/code/modules/sealant_gun/sealant_injector.dm b/code/modules/sealant_gun/sealant_injector.dm index 99f8553586d8..9bd7735bbd74 100644 --- a/code/modules/sealant_gun/sealant_injector.dm +++ b/code/modules/sealant_gun/sealant_injector.dm @@ -35,23 +35,23 @@ new /obj/item/chems/chem_disp_cartridge/polyacid(src) = 1 ) -/obj/structure/sealant_injector/attackby(obj/item/O, mob/user) +/obj/structure/sealant_injector/attackby(obj/item/used_item, mob/user) - if(istype(O, /obj/item/sealant_tank)) + if(istype(used_item, /obj/item/sealant_tank)) if(loaded_tank) to_chat(user, SPAN_WARNING("\The [src] already has a sealant tank inserted.")) return TRUE - if(user.try_unequip(O, src)) - loaded_tank = O + if(user.try_unequip(used_item, src)) + loaded_tank = used_item update_icon() return TRUE - if(istype(O, /obj/item/chems/chem_disp_cartridge)) + if(istype(used_item, /obj/item/chems/chem_disp_cartridge)) if(length(cartridges) >= max_cartridges) to_chat(user, SPAN_WARNING("\The [src] is loaded to capacity with cartridges.")) return TRUE - if(user.try_unequip(O, src)) - LAZYSET(cartridges, O, 1) + if(user.try_unequip(used_item, src)) + LAZYSET(cartridges, used_item, 1) update_icon() return TRUE diff --git a/code/modules/sealant_gun/sealant_rack.dm b/code/modules/sealant_gun/sealant_rack.dm index d952957c995d..4f053d436bd0 100644 --- a/code/modules/sealant_gun/sealant_rack.dm +++ b/code/modules/sealant_gun/sealant_rack.dm @@ -44,23 +44,23 @@ return TRUE return ..() -/obj/structure/sealant_rack/attackby(obj/item/O, mob/user) +/obj/structure/sealant_rack/attackby(obj/item/used_item, mob/user) - if(istype(O, /obj/item/gun/launcher/sealant)) + if(istype(used_item, /obj/item/gun/launcher/sealant)) if(loaded_gun) to_chat(user, SPAN_WARNING("There is already a sealant gun hung up on \the [src].")) return TRUE - if(user.try_unequip(O, src)) - loaded_gun = O + if(user.try_unequip(used_item, src)) + loaded_gun = used_item update_icon() return TRUE - if(istype(O, /obj/item/sealant_tank)) + if(istype(used_item, /obj/item/sealant_tank)) if(length(tanks) >= max_tanks) to_chat(user, SPAN_WARNING("\The [src] is filled to capacity with sealant tanks.")) return TRUE - if(user.try_unequip(O, src)) - LAZYADD(tanks, O) + if(user.try_unequip(used_item, src)) + LAZYADD(tanks, used_item) update_icon() return TRUE diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 41df847379cf..eca9534b53ce 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -28,14 +28,14 @@ to_chat(user, "A firewall prevents you from interfacing with this device!") return TRUE -/obj/machinery/keycard_auth/attackby(obj/item/W, mob/user) - if(!istype(W,/obj/item/card/id)) +/obj/machinery/keycard_auth/attackby(obj/item/used_item, mob/user) + if(!istype(used_item,/obj/item/card/id)) return ..() if(stat & (NOPOWER|BROKEN)) to_chat(user, "This device is not powered.") return TRUE - visible_message(SPAN_NOTICE("[user] swipes \the [W] through \the [src].")) - var/obj/item/card/id/ID = W + visible_message(SPAN_NOTICE("[user] swipes \the [used_item] through \the [src].")) + var/obj/item/card/id/ID = used_item if(!(access_keycard_auth in ID.access)) // you get nothing! return TRUE if(active) diff --git a/code/modules/security_levels/security_state.dm b/code/modules/security_levels/security_state.dm index 2e997845d411..73945c3c1358 100644 --- a/code/modules/security_levels/security_state.dm +++ b/code/modules/security_levels/security_state.dm @@ -127,10 +127,3 @@ log_and_message_admins("has changed the security level from [previous_security_level.name] to [new_security_level.name].") return TRUE - -// This proc decreases the current security level, if possible -/decl/security_state/proc/decrease_security_level(var/force_change = FALSE) - var/current_index = all_security_levels.Find(current_security_level) - if(current_index == 1) - return FALSE - return set_security_level(all_security_levels[current_index - 1], force_change) diff --git a/code/modules/shield_generators/shield.dm b/code/modules/shield_generators/shield.dm index 4a48e64409d5..5ad2f51439df 100644 --- a/code/modules/shield_generators/shield.dm +++ b/code/modules/shield_generators/shield.dm @@ -215,8 +215,8 @@ take_damage(proj.get_structure_damage(), SHIELD_DAMTYPE_EM) // Attacks with hand tools. Blocked by Hyperkinetic flag. -/obj/effect/shield/attackby(var/obj/item/I, var/mob/user) - return bash(I, user) +/obj/effect/shield/attackby(var/obj/item/used_item, var/mob/user) + return bash(used_item, user) /obj/effect/shield/bash(obj/item/weapon, mob/user) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) @@ -226,7 +226,7 @@ user.visible_message("\The [user] tries to attack \the [src] with \the [weapon], but it passes through!") return TRUE var/force = weapon.expend_attack_force(user) - user.visible_message("\The [user] [pick(weapon.attack_verb)] \the [src] with \the [weapon]!") + user.visible_message("\The [user] [weapon.pick_attack_verb()] \the [src] with \the [weapon]!") switch(weapon.atom_damage_type) if(BURN) take_damage(force, SHIELD_DAMTYPE_HEAT) diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm index 0cb3ee417b94..149e2d54001f 100644 --- a/code/modules/shieldgen/emergency_shield.dm +++ b/code/modules/shieldgen/emergency_shield.dm @@ -7,9 +7,29 @@ opacity = FALSE anchored = TRUE max_health = 200 + frame_type = null + construct_state = /decl/machine_construction/noninteractive var/shield_generate_power = 7500 //how much power we use when regenerating var/shield_idle_power = 1500 //how much power we use when just being sustained. +/obj/machinery/shield/take_damage(amount, damtype, silent) + if(amount <= 0) + return + if(damtype != BRUTE && damtype != BURN && damtype != ELECTROCUTE) + return + if(!silent) + playsound(src.loc, 'sound/effects/EMPulse.ogg', 75, TRUE) + current_health -= amount + set_opacity(TRUE) + check_failure() + if(!QDELETED(src)) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_opacity), FALSE), 2 SECONDS, TIMER_UNIQUE|TIMER_OVERRIDE) + +// This should never be damaged via anything but the shield's health dropping. +/obj/machinery/shield/dismantle() + check_failure() + return QDELING(src) // return true if deleted, false otherwise + /obj/machinery/shield/malfai name = "emergency forcefield" desc = "A weak forcefield which seems to be projected by the emergency atmosphere containment field." @@ -21,7 +41,7 @@ /obj/machinery/shield/proc/check_failure() if (current_health <= 0) - visible_message("\The [src] dissipates!") + visible_message(SPAN_NOTICE("\The [src] dissipates!")) qdel(src) return @@ -31,50 +51,16 @@ update_nearby_tiles(need_rebuild=1) /obj/machinery/shield/Destroy() - set_opacity(0) - set_density(0) + set_opacity(FALSE) + set_density(FALSE) update_nearby_tiles() . = ..() /obj/machinery/shield/CanPass(atom/movable/mover, turf/target, height, air_group) + // blocks air, normal behavior for everything else if(!height || air_group) return 0 else return ..() -// Circumvent base machinery attackby -// TODO: MAKE SHIELDS NOT MACHINERY??? -/obj/machinery/shield/attackby(obj/item/I, mob/user) - return bash(I, user) - -/obj/machinery/shield/bash(obj/item/W, mob/user) - if(isliving(user) && user.check_intent(I_FLAG_HELP)) - return FALSE - if(!W.user_can_attack_with(user)) - return FALSE - if(W.item_flags & ITEM_FLAG_NO_BLUDGEON) - return FALSE - //Calculate damage - switch(W.atom_damage_type) - if(BRUTE, BURN) - current_health -= W.expend_attack_force(user) - else - return FALSE - - //Play a fitting sound - playsound(src.loc, 'sound/effects/EMPulse.ogg', 75, 1) - - check_failure() - set_opacity(TRUE) - addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_opacity), FALSE), 2 SECONDS) - user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - return TRUE - -/obj/machinery/shield/bullet_act(var/obj/item/projectile/Proj) - current_health -= Proj.get_structure_damage() - ..() - check_failure() - set_opacity(1) - spawn(20) if(!QDELETED(src)) set_opacity(0) - /obj/machinery/shield/explosion_act(severity) . = ..() if(. && ((severity == 1 && prob(75)) || (severity == 2 && prob(50)) || (severity == 3 && prob(25)))) @@ -88,22 +74,21 @@ if(prob(50)) qdel(src) -/obj/machinery/shield/hitby(atom/movable/AM, var/datum/thrownthing/TT) +/obj/machinery/shield/hitby(atom/movable/hitter, var/datum/thrownthing/thrownthing) . = ..() if(.) //Let everyone know we've been hit! - visible_message(SPAN_DANGER("\The [src] was hit by \the [AM].")) + visible_message(SPAN_DANGER("\The [src] was hit by \the [hitter].")) //Super realistic, resource-intensive, real-time damage calculations. - var/tforce = AM.get_thrown_attack_force() * (TT.speed/THROWFORCE_SPEED_DIVISOR) - current_health -= tforce - //This seemed to be the best sound for hitting a force field. - playsound(src.loc, 'sound/effects/EMPulse.ogg', 100, 1) - check_failure() - //The shield becomes dense to absorb the blow. Purely asthetic. - set_opacity(1) - spawn(20) - if(!QDELETED(src)) - set_opacity(0) + var/tforce = 0 + if(ismob(hitter)) // All mobs have a multiplier and a size according to mob_defines.dm + var/mob/mob_hitter = hitter + tforce = mob_hitter.mob_size * (thrownthing.speed/THROWFORCE_SPEED_DIVISOR) + else + var/obj/obj_hitter = hitter + tforce = obj_hitter.get_thrown_attack_force() * (thrownthing.speed/THROWFORCE_SPEED_DIVISOR) + if(tforce > 0) + take_damage(tforce, BRUTE) /obj/machinery/shieldgen name = "Emergency shield projector" @@ -200,12 +185,12 @@ else check_delay-- +// todo: roll this into normal machinery damage stuff? maybe it only blows up if active when it's destroyed? /obj/machinery/shieldgen/proc/checkhp() if(current_health <= 30) src.malfunction = 1 if(current_health <= 0) - spawn(0) - explosion(get_turf(src.loc), 0, 0, 1, 0, 0, 0) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(explosion), get_turf(src), 0, 0, 1, 0, 0, 0), 0) qdel(src) update_icon() return @@ -266,8 +251,8 @@ update_icon() return 1 -/obj/machinery/shieldgen/attackby(obj/item/W, mob/user) - if(IS_SCREWDRIVER(W)) +/obj/machinery/shieldgen/attackby(obj/item/used_item, mob/user) + if(IS_SCREWDRIVER(used_item)) playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1) if(is_open) to_chat(user, "You close the panel.") @@ -276,8 +261,8 @@ to_chat(user, "You open the panel and expose the wiring.") is_open = 1 return TRUE - else if(IS_COIL(W) && malfunction && is_open) - var/obj/item/stack/cable_coil/coil = W + else if(IS_COIL(used_item) && malfunction && is_open) + var/obj/item/stack/cable_coil/coil = used_item to_chat(user, "You begin to replace the wires.") if(!do_after(user, 3 SECONDS, src)) to_chat(user, SPAN_NOTICE("You stop repairing \the [src].")) @@ -288,7 +273,7 @@ to_chat(user, "You repair \the [src]!") update_icon() return TRUE - else if(IS_WRENCH(W)) + else if(IS_WRENCH(used_item)) if(locked) to_chat(user, "The bolts are covered, unlocking this would retract the covers.") return TRUE @@ -304,7 +289,7 @@ to_chat(user, "You secure \the [src] to the floor!") anchored = TRUE return TRUE - else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/modular_computer/pda)) + else if(istype(used_item, /obj/item/card/id) || istype(used_item, /obj/item/modular_computer/pda)) if(src.allowed(user)) src.locked = !src.locked to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]") diff --git a/code/modules/shieldgen/shieldwallgen.dm b/code/modules/shieldgen/shieldwallgen.dm index 0ca75384784e..8b1b0afd92c8 100644 --- a/code/modules/shieldgen/shieldwallgen.dm +++ b/code/modules/shieldgen/shieldwallgen.dm @@ -203,8 +203,8 @@ CF.set_dir(field_dir) -/obj/machinery/shieldwallgen/attackby(obj/item/W, mob/user) - if(IS_WRENCH(W)) +/obj/machinery/shieldwallgen/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item)) if(active) to_chat(user, "Turn off the field generator first.") return TRUE @@ -218,7 +218,7 @@ src.anchored = FALSE return TRUE - if(istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer)) + if(istype(used_item, /obj/item/card/id)||istype(used_item, /obj/item/modular_computer)) if (src.allowed(user)) src.locked = !src.locked to_chat(user, "Controls are now [src.locked ? "locked." : "unlocked."]") @@ -263,83 +263,78 @@ anchored = TRUE density = TRUE light_range = 3 - var/needs_power = 0 + frame_type = null + construct_state = /decl/machine_construction/noninteractive + var/needs_power = FALSE var/obj/machinery/shieldwallgen/gen_primary var/obj/machinery/shieldwallgen/gen_secondary var/power_usage = 800 //how much power it takes to sustain the shield var/generate_power_usage = 5000 //how much power it takes to start up the shield +/obj/machinery/shieldwall/proc/use_generator_power(amount) + if(!needs_power) + return + var/obj/machinery/shieldwallgen/G = pick(gen_primary, gen_secondary) // if we use power and still exist, we assume we have both generators + G.storedpower -= amount + +/obj/machinery/shieldwall/take_damage(amount, damtype, silent) + if(amount <= 0) + return + if(damtype != BRUTE && damtype != BURN && damtype != ELECTROCUTE) + return + . = ..() // mostly just plays sound effects on damage + use_generator_power(500 * amount) + +// This should never be deleted via anything but the generator running out of power. +/obj/machinery/shieldwall/dismantle() + return FALSE // nope! + /obj/machinery/shieldwall/Initialize(mapload, obj/machinery/shieldwallgen/A, obj/machinery/shieldwallgen/B) . = ..(mapload) update_nearby_tiles() gen_primary = A gen_secondary = B - if(A && B && A.active && B.active) - needs_power = 1 - if(prob(50)) - A.storedpower -= generate_power_usage - else - B.storedpower -= generate_power_usage + if(gen_primary?.active && gen_secondary?.active) + needs_power = TRUE + use_generator_power(generate_power_usage) else return INITIALIZE_HINT_QDEL /obj/machinery/shieldwall/Destroy() + gen_primary = null + gen_secondary = null update_nearby_tiles() . = ..() -/obj/machinery/shieldwall/attackby(var/obj/item/I, var/mob/user) - var/obj/machinery/shieldwallgen/G = prob(50) ? gen_primary : gen_secondary - G.storedpower -= I.expend_attack_force(user)*2500 - user.visible_message("\The [user] hits \the [src] with \the [I]!") - user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - user.do_attack_animation(src) - playsound(loc, 'sound/weapons/smash.ogg', 75, 1) - return TRUE - /obj/machinery/shieldwall/Process() - if(needs_power) - if(!gen_primary?.active || !gen_secondary?.active) - qdel(src) - return - - var/obj/machinery/shieldwallgen/G = prob(50) ? gen_primary : gen_secondary - G.storedpower -= power_usage - - -/obj/machinery/shieldwall/bullet_act(var/obj/item/projectile/Proj) - if(needs_power) - var/obj/machinery/shieldwallgen/G = prob(50) ? gen_primary : gen_secondary - G.storedpower -= 400 * Proj.get_structure_damage() - ..() - return + if(!needs_power) + return + if(QDELETED(gen_primary) || QDELETED(gen_secondary)) + qdel(src) + return + if(!gen_primary.active || !gen_secondary.active) + qdel(src) + return + use_generator_power(power_usage) /obj/machinery/shieldwall/explosion_act(severity) SHOULD_CALL_PARENT(FALSE) if(!needs_power) return - var/obj/machinery/shieldwallgen/G = prob(50) ? gen_primary : gen_secondary - switch(severity) - if(1) - G.storedpower -= rand(30000, min(G.storedpower, 60000)) - if(2) - G.storedpower -= rand(15000, min(G.storedpower, 30000)) - if(3) - G.storedpower -= rand(5000, min(G.storedpower, 15000)) + take_damage(100/severity, BRUTE, TRUE) // will drain power according to damage /obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) return 1 - + if(!height || air_group || !density) + return TRUE if(istype(mover) && mover.checkpass(PASS_FLAG_GLASS)) return prob(20) - else - if (istype(mover, /obj/item/projectile)) - return prob(10) - else - return !src.density + if (istype(mover, /obj/item/projectile)) + return prob(10) + return FALSE /obj/machinery/shieldwallgen/online anchored = TRUE - active = 1 + active = TRUE /obj/machinery/shieldwallgen/online/Initialize() storedpower = max_stored_power diff --git a/code/modules/shuttles/docking_beacon.dm b/code/modules/shuttles/docking_beacon.dm index bac4e5fe16a1..1df49863710e 100644 --- a/code/modules/shuttles/docking_beacon.dm +++ b/code/modules/shuttles/docking_beacon.dm @@ -45,8 +45,8 @@ SSshuttle.docking_beacons -= src permitted_shuttles.Cut() -/obj/machinery/docking_beacon/attackby(obj/item/I, mob/user) - if(IS_WRENCH(I)) +/obj/machinery/docking_beacon/attackby(obj/item/used_item, mob/user) + if(IS_WRENCH(used_item)) if(!allowed(user)) to_chat(user, SPAN_WARNING("The bolts on \the [src] are locked!")) return TRUE diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index d11e0cb97a83..bd5e77eba2cd 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -184,7 +184,7 @@ var/obj/effect/shuttle_landmark/old_location = current_location RAISE_EVENT(/decl/observ/shuttle_pre_move, src, old_location, destination) shuttle_moved(destination, translation, angle_offset) - RAISE_EVENT_REPEAT(/decl/observ/shuttle_moved, src, old_location, destination) + RAISE_EVENT(/decl/observ/shuttle_moved, src, old_location, destination) if(istype(old_location)) old_location.shuttle_departed(src) destination.shuttle_arrived(src) @@ -208,7 +208,7 @@ var/obj/effect/shuttle_landmark/old_location = current_location RAISE_EVENT(/decl/observ/shuttle_pre_move, src, old_location, destination) shuttle_moved(destination, translation, angle_offset) - RAISE_EVENT_REPEAT(/decl/observ/shuttle_moved, src, old_location, destination) + RAISE_EVENT(/decl/observ/shuttle_moved, src, old_location, destination) if(istype(old_location)) old_location.shuttle_departed(src) destination.shuttle_arrived(src) diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index f78010c50559..bea008962935 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -174,8 +174,8 @@ emagged = 1 return 1 -/obj/machinery/computer/shuttle_control/emergency/attackby(obj/item/W, mob/user) - if(read_authorization(W)) +/obj/machinery/computer/shuttle_control/emergency/attackby(obj/item/used_item, mob/user) + if(read_authorization(used_item)) return TRUE return ..() diff --git a/code/modules/shuttles/shuttle_specops.dm b/code/modules/shuttles/shuttle_specops.dm index 90a54b1eab08..5ffe256bd8d1 100644 --- a/code/modules/shuttles/shuttle_specops.dm +++ b/code/modules/shuttles/shuttle_specops.dm @@ -146,10 +146,10 @@ sleep(10) var/spawn_marauder[] = new() - for(var/obj/abstract/landmark/L in global.landmarks_list) + for(var/obj/abstract/landmark/L in global.all_landmarks) if(L.name == "Marauder Entry") spawn_marauder.Add(L) - for(var/obj/abstract/landmark/L in global.landmarks_list) + for(var/obj/abstract/landmark/L in global.all_landmarks) if(L.name == "Marauder Exit") var/obj/effect/portal/P = new(L.loc) P.set_invisibility(INVISIBILITY_ABSTRACT)//So it is not seen by anyone. diff --git a/code/modules/species/species.dm b/code/modules/species/species.dm index 82e201d287f5..799a656f84dc 100644 --- a/code/modules/species/species.dm +++ b/code/modules/species/species.dm @@ -5,6 +5,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 /decl/species abstract_type = /decl/species + decl_flags = DECL_FLAG_MANDATORY_UID // Descriptors and strings. var/name @@ -174,8 +175,6 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 var/pass_flags = 0 var/breathing_sound = 'sound/voice/monkey.ogg' - var/list/base_auras - var/job_skill_buffs = list() // A list containing jobs (/datum/job), with values the extra points that job receives. var/standing_jump_range = 2 @@ -304,7 +303,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 var/decl/sprite_accessory/accessory = GET_DECL(accessory_type) // If this accessory is species restricted, add us to the list. if(accessory.species_allowed) - accessory.species_allowed |= name + accessory.species_allowed |= uid if(!isnull(accessory.body_flags_allowed)) for(var/decl/bodytype/bodytype in available_bodytypes) accessory.body_flags_allowed |= bodytype.body_flags @@ -321,7 +320,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 for(var/accessory_type in disallow_specific_sprite_accessories) var/decl/sprite_accessory/accessory = GET_DECL(accessory_type) if(accessory.species_allowed) - accessory.species_allowed -= name + accessory.species_allowed -= uid if(!isnull(accessory.body_flags_allowed)) for(var/decl/bodytype/bodytype in available_bodytypes) accessory.body_flags_allowed &= ~bodytype.body_flags @@ -349,7 +348,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 else if(length(available_pronouns) && !default_pronouns) default_pronouns = available_pronouns[1] - for(var/cat_type in global.using_map.get_background_categories()) + for(var/cat_type in decls_repository.get_decls_of_subtype(/decl/background_category)) var/force_val = force_background_info[cat_type] if(force_val) @@ -363,7 +362,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 else if(!LAZYLEN(available_background_info[cat_type])) var/list/map_systems = global.using_map.available_background_info[cat_type] - available_background_info[cat_type] = map_systems.Copy() + available_background_info[cat_type] = islist(map_systems) ? map_systems.Copy() : list() if(LAZYLEN(available_background_info[cat_type]) && !default_background_info[cat_type]) var/list/avail_systems = available_background_info[cat_type] @@ -387,9 +386,9 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 var/decl/trait/trait = GET_DECL(trait_type) if(!trait.validate_level(trait_level)) . += "invalid levels for species trait [trait_type]" - if(name in trait.blocked_species) + if(uid in trait.blocked_species) . += "trait [trait.name] prevents this species from taking it" - if(trait.permitted_species && !(name in trait.permitted_species)) + if(trait.permitted_species && !(uid in trait.permitted_species)) . += "trait [trait.name] does not permit this species to take it" if(!length(blood_types)) @@ -412,21 +411,6 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 /decl/species/proc/get_manual_dexterity(var/mob/living/human/H) . = manual_dexterity -/decl/species/proc/add_base_auras(var/mob/living/human/H) - if(base_auras) - for(var/type in base_auras) - H.add_aura(new type(H), skip_icon_update = TRUE) - -/decl/species/proc/remove_base_auras(var/mob/living/human/H) - if(base_auras) - var/list/bcopy = base_auras.Copy() - for(var/a in H.auras) - var/obj/aura/A = a - if(is_type_in_list(a, bcopy)) - bcopy -= A.type - H.remove_aura(A) - qdel(A) - /decl/species/proc/remove_inherent_verbs(var/mob/living/human/H) if(inherent_verbs) for(var/verb_path in inherent_verbs) @@ -441,7 +425,6 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 /decl/species/proc/handle_post_spawn(var/mob/living/human/H) //Handles anything not already covered by basic species assignment. add_inherent_verbs(H) - add_base_auras(H) handle_movement_flags_setup(H) /decl/species/proc/handle_pre_spawn(var/mob/living/human/H) @@ -724,10 +707,10 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 // TODO: generate an icon based on all available bodytypes. - var/mob/living/human/dummy/mannequin/mannequin = get_mannequin("#species_[ckey(name)]") + var/mob/living/human/dummy/mannequin/mannequin = get_mannequin("#species_[ckey(uid)]") if(mannequin) - mannequin.change_species(name) // handles species/bodytype init + mannequin.change_species(uid) // handles species/bodytype init default_bodytype.customize_preview_mannequin(mannequin) // handles body colors/styles setup customize_preview_mannequin(mannequin) // handles 'cultural' things like default outfit @@ -741,7 +724,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) preview_icon_width = preview_icon.Width() preview_icon_height = preview_icon.Height() - preview_icon_path = "species_preview_[ckey(name)].png" + preview_icon_path = "species_preview_[ckey(uid)].png" return preview_icon @@ -759,3 +742,6 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 var/decl/background_category/background_cat = GET_DECL(cat_type) if(background_cat.background_flags & background_flag) return GET_DECL(default_background_info[cat_type]) + +/decl/species/proc/get_safe_pressure() + return (warning_high_pressure + warning_low_pressure)/2 \ No newline at end of file diff --git a/code/modules/species/species_attack.dm b/code/modules/species/species_attack.dm index 0fffa9846431..a391a8994bf7 100644 --- a/code/modules/species/species_attack.dm +++ b/code/modules/species/species_attack.dm @@ -20,7 +20,7 @@ usable_with_limbs = list(BP_L_HAND, BP_R_HAND) var/blocked_by_gloves = TRUE -/decl/natural_attack/claws/is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) +/decl/natural_attack/claws/attack_is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) return (!user.get_equipped_item(slot_gloves_str) || !blocked_by_gloves) /decl/natural_attack/claws/show_attack(var/mob/living/human/user, var/mob/living/human/target, var/zone, var/attack_damage) @@ -124,7 +124,7 @@ BP_GROIN ) -/decl/natural_attack/tail/is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) //ensures that you can't tail someone in the skull +/decl/natural_attack/tail/attack_is_usable(var/mob/living/human/user, var/mob/living/human/target, var/zone) //ensures that you can't tail someone in the skull if(!(zone in can_hit_zones)) return FALSE for(var/foot_tag in list(BP_L_FOOT, BP_R_FOOT)) diff --git a/code/modules/species/species_getters.dm b/code/modules/species/species_getters.dm index 4bf80fd91e74..cf8f78ca0e91 100644 --- a/code/modules/species/species_getters.dm +++ b/code/modules/species/species_getters.dm @@ -28,9 +28,6 @@ /decl/species/proc/get_radiation_mod(var/mob/living/human/H) . = (H && H.isSynthetic() ? 0.5 : radiation_mod) -/decl/species/proc/get_root_species_name(var/mob/living/human/H) - return name - /decl/species/proc/get_bodytype_by_name(var/bodytype_name) bodytype_name = trim(lowertext(bodytype_name)) if(!bodytype_name) diff --git a/code/modules/species/station/human.dm b/code/modules/species/station/human.dm index 2ee92427f41f..d1f3e5323c30 100644 --- a/code/modules/species/station/human.dm +++ b/code/modules/species/station/human.dm @@ -1,7 +1,8 @@ /decl/species/human - name = SPECIES_HUMAN + uid = "species_human" + name = "Human" name_plural = "Humans" - primitive_form = SPECIES_MONKEY + primitive_form = /decl/species/monkey::uid description = "A medium-sized creature prone to great ambition. If you are reading this, you are probably a human." hidden_from_codex = FALSE spawn_flags = SPECIES_CAN_JOIN @@ -29,9 +30,6 @@ /decl/emote/exertion/synthetic/creak ) -/decl/species/human/get_root_species_name(var/mob/living/human/H) - return SPECIES_HUMAN - /decl/species/human/get_ssd(var/mob/living/human/H) if(H.stat == CONSCIOUS) return "staring blankly, not reacting to your presence" diff --git a/code/modules/species/station/human_bodytypes.dm b/code/modules/species/station/human_bodytypes.dm index b6c753b55143..20f450c46dfb 100644 --- a/code/modules/species/station/human_bodytypes.dm +++ b/code/modules/species/station/human_bodytypes.dm @@ -6,7 +6,6 @@ icon_deformed = 'icons/mob/human_races/species/human/deformed_body_female.dmi' blood_overlays = 'icons/mob/human_races/species/human/blood_overlays.dmi' bandages_icon = 'icons/mob/bandage.dmi' - limb_icon_intensity = 0.7 associated_gender = FEMALE onmob_state_modifiers = list((slot_w_uniform_str) = "f") appearance_flags = HAS_SKIN_TONE_NORMAL | HAS_UNDERWEAR | HAS_EYE_COLOR diff --git a/code/modules/species/station/monkey.dm b/code/modules/species/station/monkey.dm index 1871219744e5..60c0c3d97c74 100644 --- a/code/modules/species/station/monkey.dm +++ b/code/modules/species/station/monkey.dm @@ -1,5 +1,6 @@ /decl/species/monkey - name = SPECIES_MONKEY + uid = "species_monkey" + name = "Monkey" name_plural = "Monkeys" description = "Ook." codex_description = "Monkeys and other similar creatures tend to be found on science stations and vessels as \ @@ -32,9 +33,10 @@ holder_type = /obj/item/holder force_background_info = list( - /decl/background_category/heritage = /decl/background_detail/heritage/hidden/monkey, - /decl/background_category/homeworld = /decl/background_detail/location/stateless, - /decl/background_category/faction = /decl/background_detail/faction/other + /decl/background_category/heritage = /decl/background_detail/heritage/hidden/monkey, + /decl/background_category/homeworld = /decl/background_detail/location/stateless, + /decl/background_category/citizenship = /decl/background_detail/citizenship/stateless, + /decl/background_category/faction = /decl/background_detail/faction/other ) ai = /datum/mob_controller/monkey diff --git a/code/modules/sprite_accessories/_accessory.dm b/code/modules/sprite_accessories/_accessory.dm index 2f659cfc98e8..592a94274176 100644 --- a/code/modules/sprite_accessories/_accessory.dm +++ b/code/modules/sprite_accessories/_accessory.dm @@ -29,10 +29,8 @@ var/list/decl/bodytype/bodytypes_allowed /// Restricted from specific bodytypes. null matches none var/list/decl/bodytype/bodytypes_denied - /// Restrict some styles to specific root species names - var/list/species_allowed = list(SPECIES_HUMAN) - /// Restrict some styles to specific species names, irrespective of root species name - var/list/subspecies_allowed + /// Restrict some styles to specific species UIDs. + var/list/species_allowed = list(/decl/species/human::uid) /// Restrict some styles to specific bodytype flags. var/body_flags_allowed /// Restrict some styles to specific bodytype flags. @@ -90,9 +88,7 @@ if(species) var/species_is_permitted = TRUE if(species_allowed) - species_is_permitted = (species.get_root_species_name(owner) in species_allowed) - if(subspecies_allowed) - species_is_permitted = (species.name in subspecies_allowed) + species_is_permitted = (species.uid in species_allowed) if(!species_is_permitted) return FALSE if(bodytype) @@ -267,3 +263,6 @@ /decl/sprite_accessory_category/proc/prepare_character(mob/living/character, list/accessories) return +/decl/sprite_accessory_category/proc/prepare_mob_snapshot(datum/mob_snapshot/snapshot, list/accessories) + return + diff --git a/code/modules/sprite_accessories/cosmetics/_accessory_cosmetics.dm b/code/modules/sprite_accessories/cosmetics/_accessory_cosmetics.dm index aa47401eb2b6..91df82be7f3d 100644 --- a/code/modules/sprite_accessories/cosmetics/_accessory_cosmetics.dm +++ b/code/modules/sprite_accessories/cosmetics/_accessory_cosmetics.dm @@ -12,7 +12,6 @@ bodytypes_allowed = null bodytypes_denied = null species_allowed = null - subspecies_allowed = null bodytype_categories_allowed = null bodytype_categories_denied = null body_flags_allowed = null diff --git a/code/modules/sprite_accessories/ears/_accessory_ears.dm b/code/modules/sprite_accessories/ears/_accessory_ears.dm index ac8757346f89..bc64873f19a0 100644 --- a/code/modules/sprite_accessories/ears/_accessory_ears.dm +++ b/code/modules/sprite_accessories/ears/_accessory_ears.dm @@ -22,7 +22,6 @@ bodytypes_allowed = null bodytypes_denied = null species_allowed = null - subspecies_allowed = null bodytype_categories_allowed = null bodytype_categories_denied = null body_flags_allowed = null diff --git a/code/modules/sprite_accessories/facial/_accessory_facial.dm b/code/modules/sprite_accessories/facial/_accessory_facial.dm index 9fe557fb225a..106c91852d53 100644 --- a/code/modules/sprite_accessories/facial/_accessory_facial.dm +++ b/code/modules/sprite_accessories/facial/_accessory_facial.dm @@ -39,7 +39,6 @@ bodytypes_allowed = null bodytypes_denied = null species_allowed = null - subspecies_allowed = null bodytype_categories_allowed = null bodytype_categories_denied = null body_flags_allowed = null diff --git a/code/modules/sprite_accessories/frills/_accessory_frills.dm b/code/modules/sprite_accessories/frills/_accessory_frills.dm index b03ec96eeafd..9d6e187d93a7 100644 --- a/code/modules/sprite_accessories/frills/_accessory_frills.dm +++ b/code/modules/sprite_accessories/frills/_accessory_frills.dm @@ -21,7 +21,6 @@ bodytypes_allowed = null bodytypes_denied = null species_allowed = null - subspecies_allowed = null bodytype_categories_allowed = null bodytype_categories_denied = null body_flags_allowed = null diff --git a/code/modules/sprite_accessories/hair/_accessory_hair.dm b/code/modules/sprite_accessories/hair/_accessory_hair.dm index cd06c2f0e4fb..328397907dac 100644 --- a/code/modules/sprite_accessories/hair/_accessory_hair.dm +++ b/code/modules/sprite_accessories/hair/_accessory_hair.dm @@ -43,7 +43,6 @@ bodytypes_allowed = null bodytypes_denied = null species_allowed = null - subspecies_allowed = null bodytype_categories_allowed = null bodytype_categories_denied = null body_flags_allowed = null diff --git a/code/modules/sprite_accessories/horns/_accessory_horns.dm b/code/modules/sprite_accessories/horns/_accessory_horns.dm index 59e7b0ff6a27..4526113a70f8 100644 --- a/code/modules/sprite_accessories/horns/_accessory_horns.dm +++ b/code/modules/sprite_accessories/horns/_accessory_horns.dm @@ -25,7 +25,6 @@ bodytypes_allowed = null bodytypes_denied = null species_allowed = null - subspecies_allowed = null bodytype_categories_allowed = null bodytype_categories_denied = null body_flags_allowed = null diff --git a/code/modules/sprite_accessories/tails/_accessory_tail.dm b/code/modules/sprite_accessories/tails/_accessory_tail.dm index 0c6d8a543464..311e416366e6 100644 --- a/code/modules/sprite_accessories/tails/_accessory_tail.dm +++ b/code/modules/sprite_accessories/tails/_accessory_tail.dm @@ -13,6 +13,14 @@ var/obj/item/organ/external/tail/new_tail = new(null, null, character.get_mob_snapshot()) character.add_organ(new_tail, null, TRUE, FALSE, FALSE, TRUE) +/decl/sprite_accessory_category/tail/prepare_mob_snapshot(datum/mob_snapshot/snapshot, list/accessories) + if(!length(accessories)) + return + // Give us a tail if we need one. + var/decl/sprite_accessory/tail_data = GET_DECL(accessories[1]) + if(tail_data?.draw_accessory && !snapshot.root_bodytype.has_limbs[BP_TAIL]) + LAZYSET(snapshot.extra_limbs, BP_TAIL, list("path" = /obj/item/organ/external/tail)) + /decl/sprite_accessory/tail abstract_type = /decl/sprite_accessory/tail hidden_by_gear_slot = list(slot_w_uniform_str, slot_wear_suit_str) @@ -37,7 +45,6 @@ bodytypes_allowed = null bodytypes_denied = null species_allowed = null - subspecies_allowed = null bodytype_categories_allowed = null bodytype_categories_denied = null body_flags_allowed = null diff --git a/code/modules/status_conditions/_status.dm b/code/modules/status_conditions/_status_condition.dm similarity index 68% rename from code/modules/status_conditions/_status.dm rename to code/modules/status_conditions/_status_condition.dm index 49750b10a033..a377bed14b3d 100644 --- a/code/modules/status_conditions/_status.dm +++ b/code/modules/status_conditions/_status_condition.dm @@ -1,15 +1,28 @@ var/global/list/status_marker_holders = list() -// Check code/modules/mob/mob_status.dm code/modules/mob/living/living_status.dm -// for the procs that check/set/process these status conditions. +// Check code/modules/mob/mob_status.dm code/modules/mob/living/living_status.dm +// for the procs that check/set/process these status conditions. /decl/status_condition var/name var/check_flags = 0 var/list/victim_data + + var/decl/mob_modifier/associated_mob_modifier + var/status_marker_icon = 'icons/effects/status.dmi' var/status_marker_state var/status_marker_private = FALSE +/decl/status_condition/Initialize() + . = ..() + if(ispath(associated_mob_modifier)) + associated_mob_modifier = GET_DECL(associated_mob_modifier) + +/decl/status_condition/validate() + . = ..() + if(associated_mob_modifier && !istype(associated_mob_modifier)) + . += "invalid associated_mob_modifier '[associated_mob_modifier]'" + /decl/status_condition/proc/handle_changed_amount(var/mob/living/victim, var/new_amount, var/last_amount) set waitfor = FALSE diff --git a/code/modules/status_conditions/_status_markers.dm b/code/modules/status_conditions/_status_markers.dm index 9731e1881e67..c6e0f8ec8e58 100644 --- a/code/modules/status_conditions/_status_markers.dm +++ b/code/modules/status_conditions/_status_markers.dm @@ -1,3 +1,12 @@ +var/global/list/_status_marker_decls +/proc/get_status_marker_decls() + if(!global._status_marker_decls) + global._status_marker_decls = list() + for(var/decl/status_condition/cond as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/status_condition)) + if(cond.status_marker_icon && cond.status_marker_state) + global._status_marker_decls += cond + return global._status_marker_decls + /obj/status_marker name = "" mouse_opacity = MOUSE_OPACITY_UNCLICKABLE @@ -58,18 +67,14 @@ mob_image_personal.layer = POINTER_LAYER animate(mob_image_personal, pixel_z = 1, time = 3, easing = (SINE_EASING | EASE_OUT), loop = -1) - animate( pixel_z = -1, time = 6, easing = SINE_EASING, loop = -1) - animate( pixel_z = 0, time = 3, easing = (SINE_EASING | EASE_IN), loop = -1) + animate( pixel_z = -1, time = 6, easing = SINE_EASING, loop = -1) + animate( pixel_z = 0, time = 3, easing = (SINE_EASING | EASE_IN), loop = -1) - var/list/all_status = decls_repository.get_decls_of_subtype(/decl/status_condition) - for(var/status_type in all_status) - var/decl/status_condition/status = all_status[status_type] + for(var/decl/status_condition/status in get_status_marker_decls()) if(status.status_marker_icon && status.status_marker_state) - var/obj/status_marker/marker = new(null, status) mob_image.add_vis_contents(marker) LAZYSET(markers, status, marker) - marker = new(null, status) mob_image_personal.add_vis_contents(marker) LAZYSET(markers_personal, status, marker) diff --git a/code/modules/status_conditions/status_dizzy.dm b/code/modules/status_conditions/definitions/status_dizzy.dm similarity index 100% rename from code/modules/status_conditions/status_dizzy.dm rename to code/modules/status_conditions/definitions/status_dizzy.dm diff --git a/code/modules/status_conditions/status_jittery.dm b/code/modules/status_conditions/definitions/status_jittery.dm similarity index 100% rename from code/modules/status_conditions/status_jittery.dm rename to code/modules/status_conditions/definitions/status_jittery.dm diff --git a/code/modules/status_conditions/status_paralyzed.dm b/code/modules/status_conditions/definitions/status_paralyzed.dm similarity index 100% rename from code/modules/status_conditions/status_paralyzed.dm rename to code/modules/status_conditions/definitions/status_paralyzed.dm diff --git a/code/modules/status_conditions/status_sleeping.dm b/code/modules/status_conditions/definitions/status_sleeping.dm similarity index 100% rename from code/modules/status_conditions/status_sleeping.dm rename to code/modules/status_conditions/definitions/status_sleeping.dm diff --git a/code/modules/status_conditions/status_stunned.dm b/code/modules/status_conditions/definitions/status_stunned.dm similarity index 100% rename from code/modules/status_conditions/status_stunned.dm rename to code/modules/status_conditions/definitions/status_stunned.dm diff --git a/code/modules/status_conditions/status_weakened.dm b/code/modules/status_conditions/definitions/status_weakened.dm similarity index 100% rename from code/modules/status_conditions/status_weakened.dm rename to code/modules/status_conditions/definitions/status_weakened.dm diff --git a/code/modules/submaps/submap_job.dm b/code/modules/submaps/submap_job.dm index 89d8b2f38718..f7d72268f72a 100644 --- a/code/modules/submaps/submap_job.dm +++ b/code/modules/submaps/submap_job.dm @@ -79,9 +79,9 @@ return TRUE /datum/job/submap/is_restricted(var/datum/preferences/prefs, var/feedback) - var/decl/species/S = get_species_by_key(prefs.species) - if(LAZYACCESS(minimum_character_age, S.get_root_species_name()) && (prefs.get_character_age() < minimum_character_age[S.get_root_species_name()])) - to_chat(feedback, "Not old enough. Minimum character age is [minimum_character_age[S.get_root_species_name()]].") + var/decl/species/S = prefs.get_species_decl() + if(LAZYACCESS(minimum_character_age, S.uid) && (prefs.get_character_age() < minimum_character_age[S.uid])) + to_chat(feedback, "Not old enough. Minimum character age is [minimum_character_age[S.uid]].") return TRUE if(LAZYLEN(whitelisted_species) && !(prefs.species in whitelisted_species)) to_chat(feedback, "Your current species, [prefs.species], is not permitted as [title] on \a [owner.archetype.name].") diff --git a/code/modules/submaps/submap_join.dm b/code/modules/submaps/submap_join.dm index 216dbaeb1e06..e4af7814f2fb 100644 --- a/code/modules/submaps/submap_join.dm +++ b/code/modules/submaps/submap_join.dm @@ -78,8 +78,8 @@ job.apply_fingerprints(character) var/list/spawn_in_storage = SSjobs.equip_custom_loadout(character, job) if(spawn_in_storage) - for(var/decl/loadout_option/G in spawn_in_storage) - G.spawn_in_storage_or_drop(user_human, user_human.client.prefs.Gear()[G.uid]) + for(var/decl/loadout_option/gear in spawn_in_storage) + gear.spawn_in_storage_or_drop(user_human, user_human.client.prefs.Gear()[gear.uid]) SScustomitems.equip_custom_items(user_human) character.job = job.title @@ -97,12 +97,12 @@ if(istype(ojob) && ojob.info) to_chat(character, ojob.info) - if(user_human && user_human.has_genetic_condition(GENE_COND_NEARSIGHTED)) + if(user_human && user_human.has_genetic_condition(GENE_COND_NEARSIGHTED)) // is this even necessary with the new aspects system? var/equipped = user_human.equip_to_slot_or_del(new /obj/item/clothing/glasses/prescription(user_human), slot_glasses_str) if(equipped) - var/obj/item/clothing/glasses/G = user_human.get_equipped_item(slot_glasses_str) - if(istype(G)) - G.prescription = 7 + var/obj/item/clothing/glasses/glasses = user_human.get_equipped_item(slot_glasses_str) + if(istype(glasses)) + glasses.prescription = 7 BITSET(character.hud_updateflag, ID_HUD) BITSET(character.hud_updateflag, IMPLOYAL_HUD) diff --git a/code/modules/surgery/_surgery.dm b/code/modules/surgery/_surgery.dm index fe4eb699d91c..97ac4fe1e6c1 100644 --- a/code/modules/surgery/_surgery.dm +++ b/code/modules/surgery/_surgery.dm @@ -103,12 +103,12 @@ var/global/list/surgery_tool_exception_cache = list() if(allowed_species) . = FALSE if(species) - for(var/species_name in allowed_species) - if(species.get_root_species_name(target) == species_name) + for(var/species_uid in allowed_species) + if(species.uid == species_uid) return TRUE if(species && disallowed_species) - for(var/species_name in disallowed_species) - if(species.get_root_species_name(target) == species_name) + for(var/species_uid in disallowed_species) + if(species.uid == species_uid) return FALSE /decl/surgery_step/proc/get_skill_reqs(mob/living/user, mob/living/target, obj/item/tool, target_zone) @@ -148,9 +148,9 @@ var/global/list/surgery_tool_exception_cache = list() affected.how_open() < open_threshold)) return FALSE // Check if clothing is blocking access - var/obj/item/I = user.get_covering_equipped_item_by_zone(target_zone) + var/obj/item/I = target.get_covering_equipped_item_by_zone(target_zone) if(I && (I.item_flags & ITEM_FLAG_THICKMATERIAL)) - to_chat(user,SPAN_NOTICE("The material covering this area is too thick for you to do surgery through!")) + to_chat(user,SPAN_NOTICE("\The [I] covering that area is too thick for you to do surgery through!")) return FALSE return affected return FALSE diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm index 5b5843eb77af..f0a7f693e1d9 100644 --- a/code/modules/surgery/generic.dm +++ b/code/modules/surgery/generic.dm @@ -191,19 +191,19 @@ /decl/surgery_step/generic/cauterize/begin_step(mob/user, mob/living/target, target_zone, obj/item/tool) var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone) - var/datum/wound/W = affected.get_incision() - user.visible_message("[user] is beginning to [cauterize_term][W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool]." , \ - "You are beginning to [cauterize_term][W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].") + var/datum/wound/wound = affected.get_incision() + user.visible_message("[user] is beginning to [cauterize_term][wound ? " \a [wound.desc] on" : ""] \the [target]'s [affected.name] with \the [tool]." , \ + "You are beginning to [cauterize_term][wound ? " \a [wound.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].") target.custom_pain("Your [affected.name] is being burned!",40,affecting = affected) ..() /decl/surgery_step/generic/cauterize/end_step(mob/living/user, mob/living/target, target_zone, obj/item/tool) var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone) - var/datum/wound/W = affected.get_incision() - user.visible_message("[user] [post_cauterize_term][W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].", \ - "You [cauterize_term][W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].") - if(istype(W)) - W.close() + var/datum/wound/wound = affected.get_incision() + user.visible_message("[user] [post_cauterize_term][wound ? " \a [wound.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].", \ + "You [cauterize_term][wound ? " \a [wound.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].") + if(istype(wound)) + wound.close() affected.update_wounds() if(affected.clamped()) affected.remove_clamps() diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm index 5b9c16d99cf3..684694d1406d 100644 --- a/code/modules/surgery/other.dm +++ b/code/modules/surgery/other.dm @@ -248,7 +248,7 @@ return FALSE // Check if we have sterilizing reagents and -only- sterilizing reagents. - for(var/reagent in container.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in container.reagents.reagent_volumes) if(!(reagent in sterilizing_reagents)) return FALSE . = TRUE diff --git a/code/modules/surgery/suture_wounds.dm b/code/modules/surgery/suture_wounds.dm index 987107568309..a329518f6ffa 100644 --- a/code/modules/surgery/suture_wounds.dm +++ b/code/modules/surgery/suture_wounds.dm @@ -12,8 +12,8 @@ /decl/surgery_step/suture_wounds/pre_surgery_step(mob/living/user, mob/living/target, target_zone, obj/item/tool) var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone) if(affected) - for(var/datum/wound/W in affected.wounds) - if(W.damage_type == CUT && W.damage >= W.autoheal_cutoff) + for(var/datum/wound/wound in affected.wounds) + if(wound.damage_type == CUT && wound.damage >= wound.autoheal_cutoff) return TRUE to_chat(user, SPAN_WARNING("\The [target]'s [affected.name] has no wounds that are large enough to need suturing.")) return FALSE @@ -27,21 +27,21 @@ /decl/surgery_step/suture_wounds/end_step(mob/living/user, mob/living/target, target_zone, obj/item/tool) var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone) - for(var/datum/wound/W in affected.wounds) - if(W.damage_type == CUT && W.damage >= W.autoheal_cutoff) + for(var/datum/wound/wound in affected.wounds) + if(wound.damage_type == CUT && wound.damage >= wound.autoheal_cutoff) // Close it up to a point that it can be bandaged and heal naturally! - W.heal_damage(rand(10,20)+10) - if(W.damage >= W.autoheal_cutoff) + wound.heal_damage(rand(10,20)+10) + if(wound.damage >= wound.autoheal_cutoff) user.visible_message(SPAN_NOTICE("\The [user] partially closes a wound on [target]'s [affected.name] with \the [tool]."), \ SPAN_NOTICE("You partially close a wound on [target]'s [affected.name] with \the [tool].")) else user.visible_message(SPAN_NOTICE("\The [user] closes a wound on [target]'s [affected.name] with \the [tool]."), \ SPAN_NOTICE("You close a wound on [target]'s [affected.name] with \the [tool].")) - if(!W.damage) - affected.wounds -= W - qdel(W) - else if(W.damage <= 10) - W.clamped = 1 + if(!wound.damage) + affected.wounds -= wound + qdel(wound) + else if(wound.damage <= 10) + wound.clamped = 1 break affected.update_damages() ..() diff --git a/code/modules/synthesized_instruments/real_instruments/Synthesizer/synthesizer.dm b/code/modules/synthesized_instruments/real_instruments/Synthesizer/synthesizer.dm index b9537a30da81..4706caad9d8e 100644 --- a/code/modules/synthesized_instruments/real_instruments/Synthesizer/synthesizer.dm +++ b/code/modules/synthesized_instruments/real_instruments/Synthesizer/synthesizer.dm @@ -12,8 +12,8 @@ path = /datum/instrument sound_player = /datum/sound_player/synthesizer -/obj/structure/synthesized_instrument/synthesizer/attackby(obj/item/O, mob/user, params) - if (IS_WRENCH(O)) +/obj/structure/synthesized_instrument/synthesizer/attackby(obj/item/used_item, mob/user, params) + if (IS_WRENCH(used_item)) if (!anchored && !isspaceturf(get_turf(src))) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) to_chat(user, "You begin to tighten \the [src] to the floor...") diff --git a/code/modules/synthesized_instruments/sound_player.dm b/code/modules/synthesized_instruments/sound_player.dm index 20df81d5456c..dcedc7096001 100644 --- a/code/modules/synthesized_instruments/sound_player.dm +++ b/code/modules/synthesized_instruments/sound_player.dm @@ -21,7 +21,7 @@ var/list/datum/sound_token/instrument/tokens = list() var/list/seen_turfs -/datum/sound_player/New(datum/real_instrument/where, datum/instrument/what) +/datum/sound_player/New(obj/where, datum/instrument/what) src.song = new (src, what) src.actual_instrument = where src.echo = global.musical_config.echo_default.Copy() diff --git a/code/modules/tools/components/recipes.dm b/code/modules/tools/components/recipes.dm index 9ab5516ceb8e..38b76cff8959 100644 --- a/code/modules/tools/components/recipes.dm +++ b/code/modules/tools/components/recipes.dm @@ -7,6 +7,7 @@ /obj/item/stack/material/lump, /obj/item/stack/material/plank ) + validation_material = /decl/material/solid/stone/basalt /decl/stack_recipe/tool/handle abstract_type = /decl/stack_recipe/tool/handle @@ -16,6 +17,7 @@ /obj/item/stack/material/rods, /obj/item/stack/material/bone ) + validation_material = /decl/material/solid/organic/bone /decl/stack_recipe/tool/handle/long result_type = /obj/item/tool_component/handle/long diff --git a/code/modules/tools/subtypes/hammers.dm b/code/modules/tools/subtypes/hammers.dm index acd258ef5c08..cd6871ce2546 100644 --- a/code/modules/tools/subtypes/hammers.dm +++ b/code/modules/tools/subtypes/hammers.dm @@ -86,6 +86,7 @@ /obj/item/tool/hammer/forge/iron material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color handle_material = /decl/material/solid/organic/wood/mahogany // Forging hammers are not great at general hammer tasks (too heavy I guess), diff --git a/code/modules/vehicles/bike.dm b/code/modules/vehicles/bike.dm index 038fc40bbf4f..2dd01cbc386c 100644 --- a/code/modules/vehicles/bike.dm +++ b/code/modules/vehicles/bike.dm @@ -92,8 +92,8 @@ qdel(trail) trail = null -/obj/vehicle/bike/load(var/atom/movable/C) - var/mob/living/M = C +/obj/vehicle/bike/load(var/atom/movable/loading) + var/mob/living/M = loading if(!istype(M)) return 0 if(M.buckled || M.anchored || M.restrained() || !Adjacent(M) || !M.Adjacent(src)) return 0 @@ -104,21 +104,21 @@ engine.emp_act(severity) ..() -/obj/vehicle/bike/insert_cell(var/obj/item/cell/C, var/mob/living/human/H) +/obj/vehicle/bike/insert_cell(var/obj/item/cell/cell, var/mob/living/human/H) return -/obj/vehicle/bike/attackby(obj/item/W, mob/user) +/obj/vehicle/bike/attackby(obj/item/used_item, mob/user) if(open) - if(istype(W, /obj/item/engine)) + if(istype(used_item, /obj/item/engine)) if(engine) to_chat(user, "There is already an engine block in \the [src].") return TRUE - user.visible_message("\The [user] installs \the [W] into \the [src].") - load_engine(W) + user.visible_message("\The [user] installs \the [used_item] into \the [src].") + load_engine(used_item) return TRUE - else if(engine && engine.attackby(W,user)) + else if(engine && engine.attackby(used_item,user)) return TRUE - else if(IS_CROWBAR(W) && engine) + else if(IS_CROWBAR(used_item) && engine) to_chat(user, "You pop out \the [engine] from \the [src].") unload_engine() return TRUE diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm index 740bef47107c..f828d2f4e1c5 100644 --- a/code/modules/vehicles/cargo_train.dm +++ b/code/modules/vehicles/cargo_train.dm @@ -67,17 +67,17 @@ return ..() -/obj/vehicle/train/cargo/trolley/attackby(obj/item/W, mob/user) - if(open && IS_WIRECUTTER(W)) +/obj/vehicle/train/cargo/trolley/attackby(obj/item/used_item, mob/user) + if(open && IS_WIRECUTTER(used_item)) passenger_allowed = !passenger_allowed user.visible_message("[user] [passenger_allowed ? "cuts" : "mends"] a cable in [src].","You [passenger_allowed ? "cut" : "mend"] the load limiter cable.") return TRUE return ..() -/obj/vehicle/train/cargo/engine/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/key/cargo_train)) - if(!key && user.try_unequip(W, src)) - key = W +/obj/vehicle/train/cargo/engine/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/key/cargo_train)) + if(!key && user.try_unequip(used_item, src)) + key = used_item verbs += /obj/vehicle/train/cargo/engine/verb/remove_key return TRUE return ..() @@ -95,10 +95,10 @@ else icon_state = initial(icon_state) -/obj/vehicle/train/cargo/trolley/insert_cell(var/obj/item/cell/C, var/mob/living/human/H) +/obj/vehicle/train/cargo/trolley/insert_cell(var/obj/item/cell/cell, var/mob/living/human/H) return -/obj/vehicle/train/cargo/engine/insert_cell(var/obj/item/cell/C, var/mob/living/human/H) +/obj/vehicle/train/cargo/engine/insert_cell(var/obj/item/cell/cell, var/mob/living/human/H) ..() update_stats() @@ -252,24 +252,24 @@ //------------------------------------------- // Loading/unloading procs //------------------------------------------- -/obj/vehicle/train/cargo/trolley/load(var/atom/movable/C) - if(ismob(C) && !passenger_allowed) +/obj/vehicle/train/cargo/trolley/load(var/atom/movable/loading) + if(ismob(loading) && !passenger_allowed) return 0 - if(!istype(C,/obj/machinery) && !istype(C,/obj/structure/closet) && !istype(C,/obj/structure/largecrate) && !istype(C,/obj/structure/reagent_dispensers) && !istype(C,/obj/structure/ore_box) && !ishuman(C)) + if(!istype(loading,/obj/machinery) && !istype(loading,/obj/structure/closet) && !istype(loading,/obj/structure/largecrate) && !istype(loading,/obj/structure/reagent_dispensers) && !istype(loading,/obj/structure/ore_box) && !ishuman(loading)) return 0 //if there are any items you don't want to be able to interact with, add them to this check // ~no more shielded, emitter armed death trains - if(istype(C, /obj/machinery)) - load_object(C) + if(istype(loading, /obj/machinery)) + load_object(loading) else ..() if(load) return 1 -/obj/vehicle/train/cargo/engine/load(var/atom/movable/C) - if(!ishuman(C)) +/obj/vehicle/train/cargo/engine/load(var/atom/movable/loading) + if(!ishuman(loading)) return 0 return ..() @@ -278,10 +278,10 @@ //This prevents the object from being interacted with until it has // been unloaded. A dummy object is loaded instead so the loading // code knows to handle it correctly. -/obj/vehicle/train/cargo/trolley/proc/load_object(var/atom/movable/C) - if(!isturf(C.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly. +/obj/vehicle/train/cargo/trolley/proc/load_object(var/atom/movable/loading) + if(!isturf(loading.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly. return 0 - if(load || C.anchored) + if(load || loading.anchored) return 0 var/datum/vehicle_dummy_load/dummy_load = new() @@ -289,21 +289,21 @@ if(!load) return - dummy_load.actual_load = C - C.forceMove(src) + dummy_load.actual_load = loading + loading.forceMove(src) if(load_item_visible) - C.pixel_x += load_offset_x - C.pixel_y += load_offset_y - C.plane = plane - C.layer = VEHICLE_LOAD_LAYER + loading.pixel_x += load_offset_x + loading.pixel_y += load_offset_y + loading.plane = plane + loading.layer = VEHICLE_LOAD_LAYER - overlays += C + overlays += loading //we can set these back now since we have already cloned the icon into the overlay - C.pixel_x = initial(C.pixel_x) - C.pixel_y = initial(C.pixel_y) - C.reset_plane_and_layer() + loading.pixel_x = initial(loading.pixel_x) + loading.pixel_y = initial(loading.pixel_y) + loading.reset_plane_and_layer() /obj/vehicle/train/cargo/trolley/unload(var/mob/user, var/direction) if(istype(load, /datum/vehicle_dummy_load)) diff --git a/code/modules/vehicles/engine.dm b/code/modules/vehicles/engine.dm index cffe87ade48a..db7e0dfb8e42 100644 --- a/code/modules/vehicles/engine.dm +++ b/code/modules/vehicles/engine.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/objects.dmi' w_class = ITEM_SIZE_HUGE material = /decl/material/solid/metal/steel - var/stat = 0 + var/broken = FALSE var/trail_type var/cost_per_move = 5 @@ -19,10 +19,10 @@ /obj/item/engine/proc/use_power() return 0 -/obj/item/engine/proc/rev_engine(var/atom/movable/M) +/obj/item/engine/proc/rev_engine(var/obj/vehicle/vehicle) return -/obj/item/engine/proc/putter(var/atom/movable/M) +/obj/item/engine/proc/putter(var/obj/vehicle/vehicle) return /obj/item/engine/electric @@ -33,23 +33,24 @@ cost_per_move = 200 // W var/obj/item/cell/cell -/obj/item/engine/electric/attackby(var/obj/item/I, var/mob/user) - if(istype(I,/obj/item/cell)) +/obj/item/engine/electric/attackby(var/obj/item/used_item, var/mob/user) + // TODO: use cell extension for this? + if(istype(used_item, /obj/item/cell)) if(cell) - to_chat(user, "There is already a cell in \the [src].") + to_chat(user, SPAN_WARNING("There is already a cell in \the [src].")) else - cell = I - user.drop_from_inventory(I) - I.forceMove(src) + cell = used_item + user.drop_from_inventory(used_item) + used_item.forceMove(src) return TRUE - else if(IS_CROWBAR(I)) + else if(IS_CROWBAR(used_item)) if(cell) - to_chat(user, "You pry out \the [cell] with \the [I].") + to_chat(user, SPAN_NOTICE("You pry out \the [cell] with \the [used_item].")) cell.dropInto(loc) cell = null return TRUE if(!user.check_intent(I_FLAG_HARM)) - to_chat(user, SPAN_WARNING("There is no cell in \the [src] to remove with \the [I]!")) + to_chat(user, SPAN_WARNING("There is no cell in \the [src] to remove with \the [used_item]!")) return TRUE return ..() @@ -58,14 +59,14 @@ /obj/item/engine/electric/use_power() if(!cell) - return 0 + return FALSE return cell.use(cost_per_move * CELLRATE) -/obj/item/engine/electric/rev_engine(var/atom/movable/M) - M.audible_message("\The [M] beeps, spinning up.") +/obj/item/engine/electric/rev_engine(var/obj/vehicle/vehicle) + vehicle.audible_message("\The [vehicle] beeps, spinning up.") -/obj/item/engine/electric/putter(var/atom/movable/M) - M.audible_message("\The [M] makes one depressed beep before winding down.") +/obj/item/engine/electric/putter(var/obj/vehicle/vehicle) + vehicle.audible_message("\The [vehicle] makes one depressed beep before winding down.") /obj/item/engine/electric/emp_act(var/severity) if(cell) @@ -78,7 +79,7 @@ icon_state = "engine_fuel" trail_type = /datum/effect/effect/system/trail/thermal atom_flags = ATOM_FLAG_OPEN_CONTAINER - var/obj/temp_reagents_holder + var/datum/reagents/combustion_chamber var/fuel_points = 0 //fuel points are determined by differing reagents @@ -88,54 +89,49 @@ /obj/item/engine/thermal/Initialize() . = ..() create_reagents(500) - temp_reagents_holder = new() - temp_reagents_holder.create_reagents(15) - temp_reagents_holder.atom_flags |= ATOM_FLAG_OPEN_CONTAINER + combustion_chamber = new(15, global.temp_reagents_holder) -/obj/item/engine/thermal/attackby(var/obj/item/I, var/mob/user) - if(I.standard_pour_into(user, src)) +/obj/item/engine/thermal/attackby(var/obj/item/used_item, var/mob/user) + if(used_item.standard_pour_into(user, src)) return TRUE return ..() -/obj/item/engine/thermal/use_power() - if(fuel_points >= cost_per_move) - fuel_points -= cost_per_move - return 1 - if(!reagents || reagents.total_volume <= 0 || stat) - return 0 - - reagents.trans_to(temp_reagents_holder,min(reagents.total_volume,15)) - var/multiplier = 1 - var/actually_flameable = 0 - for(var/rtype in temp_reagents_holder.reagents.reagent_volumes) +/// Attempts to burn a sample of the fuel in our reagent holder. Returns TRUE if enough fuel points are produced to move, otherwise returns FALSE. +/obj/item/engine/thermal/proc/burn_fuel() + if(!reagents || reagents.total_volume <= 0 || broken) + return FALSE + reagents.trans_to_holder(combustion_chamber, min(reagents.total_volume, 15)) + var/multiplier = 0 + var/actually_flammable = FALSE + for(var/decl/material/reagent as anything in temp_reagents_holder.reagents.reagent_volumes) var/new_multiplier = 1 - var/decl/material/R = GET_DECL(rtype) - if(istype(R, /decl/material/liquid/alcohol)) - var/decl/material/liquid/alcohol/E = R - new_multiplier = (10/E.strength) - actually_flameable = 1 - else if(istype(R,/decl/material/liquid/fuel/hydrazine)) - new_multiplier = 1.25 - actually_flameable = 1 - else if(istype(R,/decl/material/liquid/fuel)) - actually_flameable = 1 - else if(istype(R,/decl/material/liquid/frostoil)) - new_multiplier = 0.1 - else if(istype(R,/decl/material/liquid/water)) - new_multiplier = 0.4 - else if(istype(R,/decl/material/liquid/nutriment/sugar) && REAGENT_VOLUME(reagents, rtype) > 1) - stat = DEAD + var/reagent_volume = combustion_chamber.reagent_volumes[reagent] + if(reagent.accelerant_value < FUEL_VALUE_NONE) // suppresses fires rather than starts them + // this means that FUEL_VALUE_SUPPRESSANT is on par with water in the old code + new_multiplier = -(FUEL_VALUE_SUPPRESSANT + reagent.accelerant_value) / 2 * 0.4 + if(reagent.accelerant_value > FUEL_VALUE_NONE) + // averaging these means that FUEL_VALUE_ACCELERANT is 1x, hydrazine is 1.25x, and exotic matter is 1.5x + new_multiplier = (FUEL_VALUE_ACCELERANT + reagent.accelerant_value) / 2 + actually_flammable = TRUE + if(ispath(reagent, /decl/material/liquid/nutriment/sugar) && REAGENT_VOLUME(reagents, reagent) > 1) + broken = TRUE explosion(get_turf(src),-1,0,2,3,0) return 0 - multiplier = (multiplier + new_multiplier)/2 - if(!actually_flameable) - return 0 - fuel_points += 20 * multiplier * temp_reagents_holder.reagents.total_volume - temp_reagents_holder.reagents.clear_reagents() - return use_power() - -/obj/item/engine/thermal/rev_engine(var/atom/movable/M) - M.audible_message("\The [M] rumbles to life.") - -/obj/item/engine/thermal/putter(var/atom/movable/M) - M.audible_message("\The [M] putters before turning off.") \ No newline at end of file + multiplier += new_multiplier * reagent_volume + if(!actually_flammable) + return FALSE + fuel_points += 20 * multiplier + combustion_chamber.clear_reagents() + return fuel_points >= cost_per_move + +/obj/item/engine/thermal/use_power() + if(fuel_points >= cost_per_move || burn_fuel()) + fuel_points -= cost_per_move + return TRUE + return FALSE + +/obj/item/engine/thermal/rev_engine(var/obj/vehicle/vehicle) + vehicle.audible_message("\The [vehicle] rumbles to life.") + +/obj/item/engine/thermal/putter(var/obj/vehicle/vehicle) + vehicle.audible_message("\The [vehicle] putters before turning off.") \ No newline at end of file diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 1098bd2bf01b..111eb94818e2 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -29,7 +29,7 @@ var/move_delay = 1 //set this to limit the speed of the vehicle var/obj/item/cell/cell - var/charge_use = 200 //W + var/charge_use = 200 // W var/atom/movable/load //all vehicles can take a load, since they should all be a least drivable var/load_item_visible = 1 //set if the loaded item should be overlayed on the vehicle sprite @@ -68,10 +68,10 @@ else return 0 -/obj/vehicle/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/hand_labeler)) +/obj/vehicle/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/hand_labeler)) return FALSE // allow afterattack to run - if(IS_SCREWDRIVER(W)) + if(IS_SCREWDRIVER(used_item)) if(!locked) open = !open update_icon() @@ -79,13 +79,13 @@ return TRUE to_chat(user, SPAN_WARNING("You can't [open ? "close" : "open"] the maintenance panel while \the [src] is locked!")) return TRUE - else if(IS_CROWBAR(W) && cell && open) + else if(IS_CROWBAR(used_item) && cell && open) remove_cell(user) return TRUE - else if(istype(W, /obj/item/cell) && !cell && open) - insert_cell(W, user) + else if(istype(used_item, /obj/item/cell) && !cell && open) + insert_cell(used_item, user) return TRUE - else if(IS_WELDER(W)) + else if(IS_WELDER(used_item)) var/current_max_health = get_max_health() if(current_health >= current_max_health) to_chat(user, "[src] does not need repairs.") @@ -93,9 +93,9 @@ if(!open) to_chat(user, "Unable to repair with the maintenance panel closed.") return TRUE - var/obj/item/weldingtool/welder = W + var/obj/item/weldingtool/welder = used_item if(!welder.welding) - to_chat(user, "Unable to repair while [W] is off.") + to_chat(user, "Unable to repair while [used_item] is off.") return TRUE if(welder.weld(5, user)) current_health = min(current_max_health, current_health+10) @@ -234,16 +234,16 @@ turn_on() return -/obj/vehicle/proc/insert_cell(var/obj/item/cell/C, var/mob/living/user) +/obj/vehicle/proc/insert_cell(var/obj/item/cell/cell, var/mob/living/user) if(cell) return - if(!istype(C)) + if(!istype(cell)) return - if(!user.try_unequip(C, src)) + if(!user.try_unequip(cell, src)) return - cell = C + cell = cell powercheck() - to_chat(user, "You install [C] in [src].") + to_chat(user, "You install [cell] in [src].") /obj/vehicle/proc/remove_cell(var/mob/living/user) if(!cell) @@ -261,34 +261,34 @@ // the vehicle load() definition before // calling this parent proc. //------------------------------------------- -/obj/vehicle/proc/load(var/atom/movable/C) +/obj/vehicle/proc/load(var/atom/movable/loading) //This loads objects onto the vehicle so they can still be interacted with. //Define allowed items for loading in specific vehicle definitions. - if(!isturf(C.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly. + if(!isturf(loading.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly. return 0 - if(load || C.anchored) + if(load || loading.anchored) return 0 // if a create/closet, close before loading - var/obj/structure/closet/crate = C + var/obj/structure/closet/crate = loading if(istype(crate) && crate.opened && !crate.close()) return 0 - C.forceMove(loc) - C.set_dir(dir) - C.anchored = TRUE + loading.forceMove(loc) + loading.set_dir(dir) + loading.anchored = TRUE - load = C + load = loading if(load_item_visible) - C.plane = plane - C.layer = VEHICLE_LOAD_LAYER //so it sits above the vehicle + loading.plane = plane + loading.layer = VEHICLE_LOAD_LAYER //so it sits above the vehicle - if(ismob(C)) - buckle_mob(C) + if(ismob(loading)) + buckle_mob(loading) else if(load_item_visible) - C.pixel_x += load_offset_x - C.pixel_y += load_offset_y + loading.pixel_x += load_offset_x + loading.pixel_y += load_offset_y return 1 diff --git a/code/modules/weather/_weather.dm b/code/modules/weather/_weather.dm index 00e996e256d8..9a8fb5341015 100644 --- a/code/modules/weather/_weather.dm +++ b/code/modules/weather/_weather.dm @@ -144,4 +144,4 @@ // 0 is south, but if our velocity is pure south we get -90, so add 90 // and then invert it, because byond uses counter-clockwise and we want clockwise weather_particles.rotation = generator("num", 90 - arctan(x_wind_vel * 0.50, weather_particles.base_velocity[1][2]), 90 - arctan(x_wind_vel, weather_particles.base_velocity[2][2]), NORMAL_RAND) - weather_particles.velocity += generator("vector", list(0, 0, 0), list(x_wind_vel, 0, z_wind_vel), NORMAL_RAND) \ No newline at end of file + weather_particles.velocity += generator("vector", list(0, 0, 0), list(x_wind_vel * weather_particles.wind_intensity, 0, z_wind_vel), NORMAL_RAND) \ No newline at end of file diff --git a/code/modules/xenoarcheaology/_xenoarch.dm b/code/modules/xenoarcheaology/_xenoarch.dm new file mode 100644 index 000000000000..b0ccad3e1f21 --- /dev/null +++ b/code/modules/xenoarcheaology/_xenoarch.dm @@ -0,0 +1,12 @@ +#define XA_EFFECT_TOUCH 0 +#define XA_EFFECT_AURA 1 +#define XA_EFFECT_PULSE 2 +#define XA_MAX_EFFECT 2 + +#define XA_EFFECT_UNKNOWN 0 +#define XA_EFFECT_ENERGY 1 +#define XA_EFFECT_PSIONIC 2 +#define XA_EFFECT_ELECTRO 3 +#define XA_EFFECT_PARTICLE 4 +#define XA_EFFECT_ORGANIC 5 +#define XA_EFFECT_SYNTH 6 \ No newline at end of file diff --git a/code/modules/xenoarcheaology/artifacts/artifact.dm b/code/modules/xenoarcheaology/artifacts/artifact.dm index a39efb764ce0..96f468938b7b 100644 --- a/code/modules/xenoarcheaology/artifacts/artifact.dm +++ b/code/modules/xenoarcheaology/artifacts/artifact.dm @@ -88,10 +88,10 @@ check_triggers(/datum/artifact_trigger/proc/on_touch, user) touched(user) -/obj/structure/artifact/attackby(obj/item/W, mob/user) +/obj/structure/artifact/attackby(obj/item/used_item, mob/user) . = ..() - visible_message(SPAN_WARNING("[user] hits \the [src] with \the [W].")) - check_triggers(/datum/artifact_trigger/proc/on_hit, W, user) + visible_message(SPAN_WARNING("[user] hits \the [src] with \the [used_item].")) + check_triggers(/datum/artifact_trigger/proc/on_hit, used_item, user) /obj/structure/artifact/Bumped(M) ..() diff --git a/code/modules/xenoarcheaology/artifacts/effects/_effect.dm b/code/modules/xenoarcheaology/artifacts/effects/_effect.dm index 6d441a98c4ca..f831aa2dd23d 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/_effect.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/_effect.dm @@ -1,6 +1,6 @@ /datum/artifact_effect var/name = "unknown" - var/operation_type = EFFECT_TOUCH + var/operation_type = XA_EFFECT_TOUCH var/effect_range = 4 var/atom/holder var/activated = 0 @@ -14,7 +14,7 @@ /datum/artifact_effect/New(var/atom/location) ..() holder = location - operation_type = rand(0, MAX_EFFECT) + operation_type = rand(0, XA_MAX_EFFECT) var/triggertype = pick(subtypesof(/datum/artifact_trigger)) trigger = new triggertype @@ -39,7 +39,7 @@ /datum/artifact_effect/Destroy() QDEL_NULL(trigger) . = ..() - + /datum/artifact_effect/proc/ToggleActivate(var/reveal_toggle = 1) if(activated) activated = 0 @@ -64,9 +64,9 @@ /datum/artifact_effect/proc/process() if(activated) - if(operation_type == EFFECT_AURA) + if(operation_type == XA_EFFECT_AURA) DoEffectAura() - if(operation_type == EFFECT_PULSE) + if(operation_type == XA_EFFECT_PULSE) pulse_tick++ if(pulse_tick >= pulse_period) pulse_tick = 0 @@ -75,17 +75,17 @@ /datum/artifact_effect/proc/getDescription() . = "" switch(origin_type) - if(EFFECT_ENERGY) + if(XA_EFFECT_ENERGY) . += "Concentrated energy emissions" - if(EFFECT_PSIONIC) + if(XA_EFFECT_PSIONIC) . += "Intermittent psionic wavefront" - if(EFFECT_ELECTRO) + if(XA_EFFECT_ELECTRO) . += "Electromagnetic energy" - if(EFFECT_PARTICLE) + if(XA_EFFECT_PARTICLE) . += "High frequency particles" - if(EFFECT_ORGANIC) + if(XA_EFFECT_ORGANIC) . += "Organically reactive exotic particles" - if(EFFECT_SYNTH) + if(XA_EFFECT_SYNTH) . += "Atomic synthesis" else . += "Low level energy emissions" @@ -93,11 +93,11 @@ . += " have been detected " switch(operation_type) - if(EFFECT_TOUCH) + if(XA_EFFECT_TOUCH) . += "interspersed throughout substructure and shell." - if(EFFECT_AURA) + if(XA_EFFECT_AURA) . += "emitting in an ambient energy field." - if(EFFECT_PULSE) + if(XA_EFFECT_PULSE) . += "emitting in periodic bursts." else . += "emitting in an unknown way." diff --git a/code/modules/xenoarcheaology/artifacts/effects/badfeeling.dm b/code/modules/xenoarcheaology/artifacts/effects/badfeeling.dm index 02f4612a86d2..8c9f2d98694e 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/badfeeling.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/badfeeling.dm @@ -1,6 +1,6 @@ /datum/artifact_effect/badfeeling name = "badfeeling" - origin_type = EFFECT_PSIONIC + origin_type = XA_EFFECT_PSIONIC var/static/list/messages = list("You feel worried.", "Something doesn't feel right.", "You get a strange feeling in your gut.", diff --git a/code/modules/xenoarcheaology/artifacts/effects/cellcharge.dm b/code/modules/xenoarcheaology/artifacts/effects/cellcharge.dm index d441c9dd2dde..1ccf80abd710 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/cellcharge.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/cellcharge.dm @@ -1,17 +1,17 @@ //todo /datum/artifact_effect/cellcharge name = "cell charge" - origin_type = EFFECT_ELECTRO + origin_type = XA_EFFECT_ELECTRO var/last_message /datum/artifact_effect/cellcharge/DoEffectTouch(var/mob/user) if(user) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - var/obj/item/cell/C = R.get_cell() - if(C) - C.give(100) - to_chat(R, SPAN_NOTICE("SYSTEM ALERT: Energy boost detected!")) + var/mob/living/silicon/robot/robot = user + var/obj/item/cell/cell = robot.get_cell() + if(cell) + cell.give(100) + to_chat(robot, SPAN_NOTICE("SYSTEM ALERT: Energy boost detected!")) return 1 /datum/artifact_effect/cellcharge/DoEffectAura() @@ -27,15 +27,15 @@ /datum/artifact_effect/cellcharge/proc/charge_cells_in_range(amount) var/turf/T = get_turf(holder) for (var/obj/machinery/power/apc/A in range(effect_range, T)) - var/obj/item/cell/C = A.get_cell() - if(C) - C.give(amount) + var/obj/item/cell/cell = A.get_cell() + if(cell) + cell.give(amount) for (var/obj/machinery/power/smes/S in range(effect_range, T)) S.add_charge(amount / CELLRATE) for (var/mob/living/silicon/robot/M in range(effect_range, T)) - var/obj/item/cell/C = M.get_cell() - if(C) - C.give(amount) + var/obj/item/cell/cell = M.get_cell() + if(cell) + cell.give(amount) if(world.time - last_message > 200) to_chat(M, SPAN_NOTICE("SYSTEM ALERT: Energy boost detected!")) last_message = world.time diff --git a/code/modules/xenoarcheaology/artifacts/effects/celldrain.dm b/code/modules/xenoarcheaology/artifacts/effects/celldrain.dm index 13cc32c5161c..9d5a6b626ac0 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/celldrain.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/celldrain.dm @@ -1,17 +1,17 @@ //todo /datum/artifact_effect/celldrain name = "cell drain" - origin_type = EFFECT_ELECTRO + origin_type = XA_EFFECT_ELECTRO var/last_message /datum/artifact_effect/celldrain/DoEffectTouch(var/mob/user) if(user) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - var/obj/item/cell/C = R.get_cell() - if(C) - C.use(100) - to_chat(R, SPAN_WARNING("SYSTEM ALERT: Energy drain detected!")) + var/mob/living/silicon/robot/robot = user + var/obj/item/cell/cell = robot.get_cell() + if(cell) + cell.use(100) + to_chat(robot, SPAN_WARNING("SYSTEM ALERT: Energy drain detected!")) return 1 /datum/artifact_effect/celldrain/DoEffectAura() @@ -27,15 +27,15 @@ /datum/artifact_effect/celldrain/proc/drain_cells_in_range(amount) var/turf/T = get_turf(holder) for (var/obj/machinery/power/apc/A in range(effect_range, T)) - var/obj/item/cell/C = A.get_cell() - if(C) - C.use(amount) + var/obj/item/cell/cell = A.get_cell() + if(cell) + cell.use(amount) for (var/obj/machinery/power/smes/S in range(effect_range, T)) S.remove_charge(amount / CELLRATE) for (var/mob/living/silicon/robot/M in range(effect_range, T)) - var/obj/item/cell/C = M.get_cell() - if(C) - C.use(amount) + var/obj/item/cell/cell = M.get_cell() + if(cell) + cell.use(amount) if(world.time - last_message > 200) to_chat(M, SPAN_WARNING("SYSTEM ALERT: Energy drain detected!")) last_message = world.time diff --git a/code/modules/xenoarcheaology/artifacts/effects/dnaswitch.dm b/code/modules/xenoarcheaology/artifacts/effects/dnaswitch.dm index 4f4fa21b0872..b599c8ab178c 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/dnaswitch.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/dnaswitch.dm @@ -1,6 +1,6 @@ /datum/artifact_effect/dnaswitch name = "dnaswitch" - origin_type = EFFECT_ORGANIC + origin_type = XA_EFFECT_ORGANIC var/severity var/static/list/feels = list( "You feel a little different.", @@ -14,7 +14,7 @@ /datum/artifact_effect/dnaswitch/New() ..() - if(operation_type == EFFECT_AURA) + if(operation_type == XA_EFFECT_AURA) severity = rand(5,30) else severity = rand(25,95) diff --git a/code/modules/xenoarcheaology/artifacts/effects/emp.dm b/code/modules/xenoarcheaology/artifacts/effects/emp.dm index e22dd21e5b2a..3fb29851f6e5 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/emp.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/emp.dm @@ -1,10 +1,10 @@ /datum/artifact_effect/emp name = "emp" - origin_type = EFFECT_ELECTRO + origin_type = XA_EFFECT_ELECTRO /datum/artifact_effect/emp/New() ..() - operation_type = EFFECT_PULSE + operation_type = XA_EFFECT_PULSE /datum/artifact_effect/emp/DoEffectPulse() if(holder) diff --git a/code/modules/xenoarcheaology/artifacts/effects/forcefield.dm b/code/modules/xenoarcheaology/artifacts/effects/forcefield.dm index 08df28860c2b..63dce1535476 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/forcefield.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/forcefield.dm @@ -1,6 +1,6 @@ /datum/artifact_effect/forcefield name = "force field" - origin_type = EFFECT_PARTICLE + origin_type = XA_EFFECT_PARTICLE var/list/created_field var/field_color diff --git a/code/modules/xenoarcheaology/artifacts/effects/gas_generation.dm b/code/modules/xenoarcheaology/artifacts/effects/gas_generation.dm index dd66a9c58655..0d636d1a9bb5 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/gas_generation.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/gas_generation.dm @@ -6,8 +6,8 @@ ..() if(!spawned_gas) spawned_gas = pick(decls_repository.get_decl_paths_of_subtype(/decl/material/gas)) - operation_type = pick(EFFECT_TOUCH, EFFECT_AURA) - origin_type = EFFECT_SYNTH + operation_type = pick((XA_EFFECT_TOUCH), (XA_EFFECT_AURA)) + origin_type = XA_EFFECT_SYNTH /datum/artifact_effect/gas/DoEffectTouch(var/mob/user) if(holder) diff --git a/code/modules/xenoarcheaology/artifacts/effects/goodfeeling.dm b/code/modules/xenoarcheaology/artifacts/effects/goodfeeling.dm index e5d88d10a300..ab6db622cf1f 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/goodfeeling.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/goodfeeling.dm @@ -1,6 +1,6 @@ /datum/artifact_effect/goodfeeling name = "good feeling" - origin_type = EFFECT_PSIONIC + origin_type = XA_EFFECT_PSIONIC var/static/list/messages = list("You feel good.", "Everything seems to be going alright.", "You've got a good feeling about this.", diff --git a/code/modules/xenoarcheaology/artifacts/effects/heal.dm b/code/modules/xenoarcheaology/artifacts/effects/heal.dm index 73bf53bc022a..8add3c135107 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/heal.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/heal.dm @@ -1,6 +1,6 @@ /datum/artifact_effect/heal name = "heal" - origin_type = EFFECT_ORGANIC + origin_type = XA_EFFECT_ORGANIC /datum/artifact_effect/heal/DoEffectTouch(var/mob/toucher) if(isliving(toucher)) diff --git a/code/modules/xenoarcheaology/artifacts/effects/hurt.dm b/code/modules/xenoarcheaology/artifacts/effects/hurt.dm index 238e8b998656..71d2cbd211a9 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/hurt.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/hurt.dm @@ -1,6 +1,6 @@ /datum/artifact_effect/hurt name = "hurt" - origin_type = EFFECT_ORGANIC + origin_type = XA_EFFECT_ORGANIC /datum/artifact_effect/hurt/DoEffectTouch(var/mob/toucher) if(isliving(toucher)) diff --git a/code/modules/xenoarcheaology/artifacts/effects/radiate.dm b/code/modules/xenoarcheaology/artifacts/effects/radiate.dm index 591dd8c3a81a..e4f24857c52b 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/radiate.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/radiate.dm @@ -5,7 +5,7 @@ /datum/artifact_effect/radiate/New() ..() radiation_strength = rand(10, 50) - origin_type = pick(EFFECT_PARTICLE, EFFECT_ORGANIC) + origin_type = pick((XA_EFFECT_PARTICLE), (XA_EFFECT_ORGANIC)) /datum/artifact_effect/radiate/DoEffectTouch(var/mob/living/user) if(istype(user)) diff --git a/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm b/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm index 3b9b2668484f..ead27ed391b6 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm @@ -4,13 +4,13 @@ /datum/artifact_effect/roboheal/New() ..() - origin_type = pick(EFFECT_ELECTRO, EFFECT_PARTICLE) + origin_type = pick((XA_EFFECT_ELECTRO), (XA_EFFECT_PARTICLE)) /datum/artifact_effect/roboheal/DoEffectTouch(var/mob/user) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - to_chat(R, "Your systems report damaged components mending by themselves!") - R.heal_overall_damage(rand(10,30), rand(10,30)) + var/mob/living/silicon/robot/robot = user + to_chat(robot, "Your systems report damaged components mending by themselves!") + robot.heal_overall_damage(rand(10,30), rand(10,30)) return 1 /datum/artifact_effect/roboheal/DoEffectAura() diff --git a/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm b/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm index 0a83ddf57de3..ff66d2659af8 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm @@ -4,13 +4,13 @@ /datum/artifact_effect/robohurt/New() ..() - origin_type = pick(EFFECT_ELECTRO, EFFECT_PARTICLE) + origin_type = pick((XA_EFFECT_ELECTRO), (XA_EFFECT_PARTICLE)) /datum/artifact_effect/robohurt/DoEffectTouch(var/mob/user) if(isrobot(user)) - var/mob/living/silicon/robot/R = user - to_chat(R, "Your systems report severe damage has been inflicted!") - R.take_overall_damage(rand(10,50), rand(10,50)) + var/mob/living/silicon/robot/robot = user + to_chat(robot, "Your systems report severe damage has been inflicted!") + robot.take_overall_damage(rand(10,50), rand(10,50)) return 1 /datum/artifact_effect/robohurt/DoEffectAura() diff --git a/code/modules/xenoarcheaology/artifacts/effects/sleepy.dm b/code/modules/xenoarcheaology/artifacts/effects/sleepy.dm index 6bb1478a0ba7..f872eeccf491 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/sleepy.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/sleepy.dm @@ -9,7 +9,7 @@ /datum/artifact_effect/sleepy/New() ..() - origin_type = pick(EFFECT_PSIONIC, EFFECT_ORGANIC) + origin_type = pick((XA_EFFECT_PSIONIC), (XA_EFFECT_ORGANIC)) /datum/artifact_effect/sleepy/DoEffectTouch(var/mob/living/toucher) if(istype(toucher)) @@ -40,5 +40,5 @@ return if(prob(message_prob)) to_chat(H, SPAN_NOTICE(pick(sleepy_messages))) - H.set_status(STAT_DROWSY, min(GET_STATUS(H, STAT_DROWSY) + speed * weakness, limit * weakness)) - H.set_status(STAT_BLURRY, min(GET_STATUS(H, STAT_BLURRY) + speed * weakness, limit * weakness)) \ No newline at end of file + H.set_status_condition(STAT_DROWSY, min(GET_STATUS(H, STAT_DROWSY) + speed * weakness, limit * weakness)) + H.set_status_condition(STAT_BLURRY, min(GET_STATUS(H, STAT_BLURRY) + speed * weakness, limit * weakness)) \ No newline at end of file diff --git a/code/modules/xenoarcheaology/artifacts/effects/stun.dm b/code/modules/xenoarcheaology/artifacts/effects/stun.dm index 257a9976bf46..ac0c9598f888 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/stun.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/stun.dm @@ -3,7 +3,7 @@ /datum/artifact_effect/stun/New() ..() - origin_type = pick(EFFECT_PSIONIC, EFFECT_ORGANIC) + origin_type = pick((XA_EFFECT_PSIONIC), (XA_EFFECT_ORGANIC)) /datum/artifact_effect/stun/DoEffectTouch(var/mob/toucher) if(isliving(toucher)) diff --git a/code/modules/xenoarcheaology/artifacts/effects/teleport.dm b/code/modules/xenoarcheaology/artifacts/effects/teleport.dm index ac710fc71a36..255bdd62d2e4 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/teleport.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/teleport.dm @@ -1,6 +1,6 @@ /datum/artifact_effect/teleport name = "teleport" - origin_type = EFFECT_PSIONIC + origin_type = XA_EFFECT_PSIONIC /datum/artifact_effect/teleport/DoEffectTouch(var/mob/user) teleport_away(user) diff --git a/code/modules/xenoarcheaology/artifacts/effects/temperature.dm b/code/modules/xenoarcheaology/artifacts/effects/temperature.dm index a50047249fbe..4ca5b5e72bc8 100644 --- a/code/modules/xenoarcheaology/artifacts/effects/temperature.dm +++ b/code/modules/xenoarcheaology/artifacts/effects/temperature.dm @@ -7,10 +7,10 @@ /datum/artifact_effect/temperature/New() ..() - operation_type = pick(EFFECT_TOUCH, EFFECT_AURA) - origin_type = pick(EFFECT_ORGANIC, EFFECT_SYNTH) + operation_type = pick((XA_EFFECT_TOUCH), (XA_EFFECT_AURA)) + origin_type = pick((XA_EFFECT_ORGANIC), (XA_EFFECT_SYNTH)) if(!direction) - direction = pick(ANOM_EFFECT_COOLING, ANOM_EFFECT_HEATING) + direction = pick((ANOM_EFFECT_COOLING), (ANOM_EFFECT_HEATING)) switch(direction) if(ANOM_EFFECT_COOLING) target_temp = rand(TCMB, T0C - 30) @@ -38,7 +38,7 @@ return air.temperature > target_temp if(ANOM_EFFECT_HEATING) return air.temperature < target_temp - + /datum/artifact_effect/temperature/proc/change_air_temp(datum/gas_mixture/air, degrees) var/new_temp = air.temperature + degrees if(direction == ANOM_EFFECT_COOLING) diff --git a/code/modules/xenoarcheaology/artifacts/standalone/crystal.dm b/code/modules/xenoarcheaology/artifacts/standalone/crystal.dm index dd1fa65634f1..1fe1e576b2a7 100644 --- a/code/modules/xenoarcheaology/artifacts/standalone/crystal.dm +++ b/code/modules/xenoarcheaology/artifacts/standalone/crystal.dm @@ -3,11 +3,13 @@ icon = 'icons/obj/xenoarchaeology.dmi' icon_state = "ano70" density = TRUE + var/base_state = null + var/energized = FALSE /obj/structure/crystal/Initialize() . = ..() - icon_state = pick("ano70","ano80") + base_state = pick("ano7","ano8") desc = pick( "It shines faintly as it catches the light.", @@ -16,6 +18,10 @@ "Something twinkles faintly as you look at it.", "It's mesmerizing to behold.") +/obj/structure/crystal/on_update_icon() + . = ..() + icon_state = "[base_state][energized ? 0 : 1]" + /obj/structure/crystal/Destroy() src.visible_message("[src] shatters!") if(prob(75)) @@ -33,6 +39,15 @@ return ..() /obj/structure/crystal/get_artifact_scan_data() - return "Crystal formation - pseudo-organic crystalline matrix, unlikely to have formed naturally. No known technology exists to synthesize this exact composition." + . = "Crystal formation - pseudo-organic crystalline matrix, unlikely to have formed naturally. No known technology exists to synthesize this exact composition." + if(energized) + . += " Stimulation of the inner crystal lattice has caused it to enter a metastable energy level, indicating potential uses in power storage and energy manipulation." -//todo: laser_act +// Placeholder functionality so that these do something +/obj/structure/crystal/bullet_act(obj/item/projectile/the_bullet) + var/proj_damage = the_bullet.get_structure_damage() + if(!(the_bullet.damage_flags & DAM_LASER) || (proj_damage < 10) || energized) + return ..() + visible_message(SPAN_WARNING("\The [src] begins glowing...")) + energized = TRUE + update_icon() \ No newline at end of file diff --git a/code/modules/xenoarcheaology/artifacts/standalone/gigadrill.dm b/code/modules/xenoarcheaology/artifacts/standalone/gigadrill.dm index 22e68e9011e4..c56e354022c8 100644 --- a/code/modules/xenoarcheaology/artifacts/standalone/gigadrill.dm +++ b/code/modules/xenoarcheaology/artifacts/standalone/gigadrill.dm @@ -3,11 +3,15 @@ desc = "A giant, alien drill mounted on long treads." icon = 'icons/obj/machines/gigadrill.dmi' icon_state = "gigadrill" + density = TRUE + layer = ABOVE_OBJ_LAYER //to go over ores + matter = list( + /decl/material/solid/metal/plasteel/ocp = MATTER_AMOUNT_PRIMARY, + /decl/material/solid/gemstone/diamond = MATTER_AMOUNT_REINFORCEMENT + ) var/active = 0 var/drill_time = 10 var/turf/drilling_turf - density = TRUE - layer = ABOVE_OBJ_LAYER //to go over ores /obj/machinery/giga_drill/physical_attack_hand(mob/user) if(active) @@ -35,4 +39,4 @@ anchored = FALSE /obj/machinery/giga_drill/get_artifact_scan_data() - return "Automated mining drill - structure composed of titanium-carbide alloy, with tip and drill lines edged in a complex lattice of diamond." + return "Automated mining drill - structure composed of osmium-carbide alloy, with tip and drill lines edged in a complex lattice of diamond." diff --git a/code/modules/xenoarcheaology/artifacts/standalone/replicator.dm b/code/modules/xenoarcheaology/artifacts/standalone/replicator.dm index 736ce1295ea1..c5c32c5fa43f 100644 --- a/code/modules/xenoarcheaology/artifacts/standalone/replicator.dm +++ b/code/modules/xenoarcheaology/artifacts/standalone/replicator.dm @@ -125,11 +125,11 @@ show_browser(user, dat, "window=alien_replicator") -/obj/machinery/replicator/attackby(obj/item/W, mob/user) - if(!user.try_unequip(W, src)) +/obj/machinery/replicator/attackby(obj/item/used_item, mob/user) + if(!user.try_unequip(used_item, src)) return FALSE - stored_materials.Add(W) - user.visible_message(SPAN_NOTICE("\The [user] inserts \the [W] into \the [src]."), SPAN_NOTICE("You insert \the [W] into \the [src].")) + stored_materials.Add(used_item) + user.visible_message(SPAN_NOTICE("\The [user] inserts \the [used_item] into \the [src]."), SPAN_NOTICE("You insert \the [used_item] into \the [src].")) return TRUE /obj/machinery/replicator/OnTopic(user, href_list) diff --git a/code/modules/xenoarcheaology/boulder.dm b/code/modules/xenoarcheaology/boulder.dm index ba7a38c2f3d2..ed0737bc8a3d 100644 --- a/code/modules/xenoarcheaology/boulder.dm +++ b/code/modules/xenoarcheaology/boulder.dm @@ -39,15 +39,15 @@ QDEL_NULL(artifact_find) return ..() -/obj/structure/boulder/attackby(var/obj/item/I, var/mob/user) +/obj/structure/boulder/attackby(var/obj/item/used_item, var/mob/user) - if(istype(I, /obj/item/depth_scanner)) - var/obj/item/depth_scanner/C = I + if(istype(used_item, /obj/item/depth_scanner)) + var/obj/item/depth_scanner/C = used_item C.scan_atom(user, src) return TRUE - if(istype(I, /obj/item/measuring_tape)) - var/obj/item/measuring_tape/P = I + if(istype(used_item, /obj/item/measuring_tape)) + var/obj/item/measuring_tape/P = used_item user.visible_message( SPAN_NOTICE("\The [user] extends \the [P] towards \the [src]."), SPAN_NOTICE("You extend \the [P] towards \the [src].") @@ -56,8 +56,8 @@ to_chat(user, SPAN_NOTICE("\The [src] has been excavated to a depth of [src.excavation_level]cm.")) return TRUE - if(I.do_tool_interaction(TOOL_PICK, user, src, 3 SECONDS, set_cooldown = TRUE)) - excavation_level += I.get_tool_property(TOOL_PICK, TOOL_PROP_EXCAVATION_DEPTH) + if(used_item.do_tool_interaction(TOOL_PICK, user, src, 3 SECONDS, set_cooldown = TRUE)) + excavation_level += used_item.get_tool_property(TOOL_PICK, TOOL_PROP_EXCAVATION_DEPTH) if(excavation_level > 200) user.visible_message( SPAN_DANGER("\The [src] suddenly crumbles away."), @@ -88,13 +88,8 @@ /obj/structure/boulder/Bumped(AM) . = ..() - if(ishuman(AM)) - var/mob/living/human/H = AM - for(var/obj/item/P in H.get_inactive_held_items()) - if(IS_PICK(P)) - attackby(P, H) - return - else if(isrobot(AM)) - var/mob/living/silicon/robot/R = AM - if(IS_PICK(R.module_active)) - attackby(R.module_active,R) + if(isliving(AM)) + var/mob/living/user = AM + var/obj/item/equipped_item = user.get_active_held_item() + if(istype(equipped_item) && IS_PICK(equipped_item)) + attackby(equipped_item, user) diff --git a/code/modules/xenoarcheaology/finds/find_types/fossils.dm b/code/modules/xenoarcheaology/finds/find_types/fossils.dm index f06c6c37784b..bb4fc8f8892d 100644 --- a/code/modules/xenoarcheaology/finds/find_types/fossils.dm +++ b/code/modules/xenoarcheaology/finds/find_types/fossils.dm @@ -52,13 +52,13 @@ /obj/item/fossil/animal/skull/horned icon_state = "hskull" -/obj/item/fossil/skull/attackby(obj/item/W, mob/user) - if(!istype(W, /obj/item/fossil/animal)) +/obj/item/fossil/skull/attackby(obj/item/used_item, mob/user) + if(!istype(used_item, /obj/item/fossil/animal)) return ..() if(!user.try_unequip(src)) return FALSE var/obj/structure/skeleton/skellybones = new (get_turf(src)) - user.try_unequip(W, skellybones) + user.try_unequip(used_item, skellybones) forceMove(skellybones) return TRUE @@ -82,19 +82,19 @@ if(distance <= 1) . += "The plaque reads \'[plaque_contents]\'." -/obj/structure/skeleton/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/fossil/animal)) +/obj/structure/skeleton/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/fossil/animal)) if(bone_count >= required_bones) to_chat(user, SPAN_NOTICE("\The [src] is already complete.")) return TRUE - if(!user.try_unequip(W, src)) + if(!user.try_unequip(used_item, src)) return TRUE bone_count++ if(bone_count == required_bones) icon_state = "skel" set_density(1) return TRUE - else if(IS_PEN(W)) + else if(IS_PEN(used_item)) plaque_contents = sanitize(input("What would you like to write on the plaque:","Skeleton plaque","")) user.visible_message("[user] writes something on the base of [src].","You relabel the plaque on the base of [src].") return TRUE diff --git a/code/modules/xenoarcheaology/finds/find_types/material.dm b/code/modules/xenoarcheaology/finds/find_types/material.dm index f4bfc53c61f0..d870cb60ef4e 100644 --- a/code/modules/xenoarcheaology/finds/find_types/material.dm +++ b/code/modules/xenoarcheaology/finds/find_types/material.dm @@ -2,14 +2,23 @@ /decl/archaeological_find/material item_type = "material lump" modification_flags = XENOFIND_APPLY_PREFIX - var/list/possible_materials = list(/decl/material/solid/metal/steel, /decl/material/solid/metal/plasteel, /decl/material/solid/metal/titanium, /decl/material/solid/glass) + var/list/possible_materials = list( + /decl/material/solid/metal/steel, + /decl/material/solid/metal/plasteel, + /decl/material/solid/metal/titanium, + /decl/material/solid/glass + ) /decl/archaeological_find/material/spawn_item(atom/loc) return SSmaterials.create_object(pick(possible_materials), loc, rand(5,45))?[1] /decl/archaeological_find/material/exotic item_type = "rare material lump" - possible_materials = list(/decl/material/solid/metal/aliumium, /decl/material/solid/metallic_hydrogen, /decl/material/solid/glass/borosilicate) + possible_materials = list( + /decl/material/solid/metal/aliumium, + /decl/material/solid/metallic_hydrogen, + /decl/material/solid/glass/borosilicate + ) //Machinery parts /decl/archaeological_find/parts diff --git a/code/modules/xenoarcheaology/finds/find_types/statuette.dm b/code/modules/xenoarcheaology/finds/find_types/statuette.dm index 7ef0251d27de..e5d985de8dc9 100644 --- a/code/modules/xenoarcheaology/finds/find_types/statuette.dm +++ b/code/modules/xenoarcheaology/finds/find_types/statuette.dm @@ -86,12 +86,12 @@ if(wight_check_index > shadow_wights.len) wight_check_index = 1 - var/obj/effect/shadow_wight/W = shadow_wights[wight_check_index] - if(isnull(W)) + var/obj/effect/shadow_wight/wight = shadow_wights[wight_check_index] + if(isnull(wight)) shadow_wights.Remove(wight_check_index) - else if(isnull(W.loc)) + else if(isnull(wight.loc)) shadow_wights.Remove(wight_check_index) - else if(get_dist(W, src) > 10) + else if(get_dist(wight, src) > 10) shadow_wights.Remove(wight_check_index) /obj/item/vampiric/hear_talk(mob/M, text) diff --git a/code/modules/xenoarcheaology/finds/strange_rock.dm b/code/modules/xenoarcheaology/finds/strange_rock.dm index 5e2c8770e9c6..4ceacb3a7204 100644 --- a/code/modules/xenoarcheaology/finds/strange_rock.dm +++ b/code/modules/xenoarcheaology/finds/strange_rock.dm @@ -18,8 +18,8 @@ QDEL_NULL(inside) . = ..() -/obj/item/strangerock/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/tool/xeno/brush)) +/obj/item/strangerock/attackby(var/obj/item/used_item, var/mob/user) + if(istype(used_item, /obj/item/tool/xeno/brush)) if(inside) inside.dropInto(loc) visible_message(SPAN_NOTICE("\The [src] is brushed away, revealing \the [inside].")) @@ -29,10 +29,10 @@ physically_destroyed() return TRUE - if(IS_WELDER(I)) - var/obj/item/weldingtool/W = I - if(W.isOn()) - if(W.weld(2)) + if(IS_WELDER(used_item)) + var/obj/item/weldingtool/welder = used_item + if(welder.isOn()) + if(welder.weld(2)) if(inside) inside.dropInto(loc) visible_message(SPAN_NOTICE("\The [src] burns away revealing \the [inside].")) @@ -44,8 +44,8 @@ visible_message(SPAN_NOTICE("A few sparks fly off \the [src], but nothing else happens.")) return TRUE - else if(istype(I, /obj/item/core_sampler)) - var/obj/item/core_sampler/S = I + else if(istype(used_item, /obj/item/core_sampler)) + var/obj/item/core_sampler/S = used_item S.sample_item(src, user) return TRUE diff --git a/code/modules/xenoarcheaology/machinery/artifact_harvester.dm b/code/modules/xenoarcheaology/machinery/artifact_harvester.dm index 848a0033f32a..c2c3043a700d 100644 --- a/code/modules/xenoarcheaology/machinery/artifact_harvester.dm +++ b/code/modules/xenoarcheaology/machinery/artifact_harvester.dm @@ -56,16 +56,16 @@ events_repository.register(/decl/observ/destroyed, new_artifact, src, TYPE_PROC_REF(/obj/machinery/artifact_harvester, clear_artifact)) cur_artifact = new_artifact -/obj/machinery/artifact_harvester/attackby(var/obj/I, var/mob/user) - if(!istype(I, /obj/item/anobattery)) +/obj/machinery/artifact_harvester/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/anobattery)) return ..() if(inserted_battery) to_chat(user, SPAN_WARNING("There is already a battery in [src].")) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, SPAN_NOTICE("You insert [I] into [src].")) - inserted_battery = I + to_chat(user, SPAN_NOTICE("You insert [used_item] into [src].")) + inserted_battery = used_item updateDialog() return TRUE @@ -130,7 +130,7 @@ inserted_battery.battery_effect.process() //if the effect works by touch, activate it on anyone near the console - if(inserted_battery.battery_effect.operation_type == EFFECT_TOUCH) + if(inserted_battery.battery_effect.operation_type == (XA_EFFECT_TOUCH)) for(var/mob/M in hearers(1, src)) inserted_battery.battery_effect.DoEffectTouch(M) diff --git a/code/modules/xenoarcheaology/machinery/geosample_scanner.dm b/code/modules/xenoarcheaology/machinery/geosample_scanner.dm index eba847f98f2c..486a5eb5ea83 100644 --- a/code/modules/xenoarcheaology/machinery/geosample_scanner.dm +++ b/code/modules/xenoarcheaology/machinery/geosample_scanner.dm @@ -60,34 +60,34 @@ ui_interact(user) return TRUE -/obj/machinery/radiocarbon_spectrometer/attackby(var/obj/I, var/mob/user) - if(istype(I, /obj/item/stack/nanopaste)) +/obj/machinery/radiocarbon_spectrometer/attackby(var/obj/used_item, var/mob/user) + if(istype(used_item, /obj/item/stack/nanopaste)) if(scanning) to_chat(user, SPAN_WARNING("You can't do that while [src] is scanning!")) return TRUE var/choice = alert("What do you want to do with the nanopaste?","Radiometric Scanner","Scan nanopaste","Fix seal integrity") - if(CanPhysicallyInteract(user) && !QDELETED(I) && I.loc == user && choice == "Fix seal integrity") - var/obj/item/stack/nanopaste/N = I + if(CanPhysicallyInteract(user) && !QDELETED(used_item) && used_item.loc == user && choice == "Fix seal integrity") + var/obj/item/stack/nanopaste/N = used_item var/amount_used = min(N.get_amount(), 10 - scanner_seal_integrity / 10) N.use(amount_used) scanner_seal_integrity = round(scanner_seal_integrity + amount_used * 10) return TRUE - if(istype(I, /obj/item/chems/glass)) + if(istype(used_item, /obj/item/chems/glass)) if(scanning) to_chat(user, SPAN_WARNING("You can't do that while [src] is scanning!")) return TRUE var/choice = alert("What do you want to do with the container?","Radiometric Scanner","Add coolant","Empty coolant","Scan container") - if(CanPhysicallyInteract(user) && !QDELETED(I) && I.loc == user) + if(CanPhysicallyInteract(user) && !QDELETED(used_item) && used_item.loc == user) //#TODO: The add coolant stuff could probably be handled by the default reagent handling code. And the emptying could be done with an alt interaction. if(choice == "Add coolant") - var/obj/item/chems/glass/G = I + var/obj/item/chems/glass/G = used_item var/amount_transferred = min(src.reagents.maximum_volume - src.reagents.total_volume, G.reagents.total_volume) G.reagents.trans_to(src, amount_transferred) to_chat(user, SPAN_INFO("You empty [amount_transferred]u of coolant into [src].")) update_coolant() return TRUE else if(choice == "Empty coolant") - var/obj/item/chems/glass/G = I + var/obj/item/chems/glass/G = used_item var/amount_transferred = min(G.reagents.maximum_volume - G.reagents.total_volume, src.reagents.total_volume) src.reagents.trans_to(G, amount_transferred) to_chat(user, SPAN_INFO("You remove [amount_transferred]u of coolant from [src].")) @@ -99,14 +99,14 @@ return TRUE //Now let people insert whatever into the scanner - if(istype(I)) + if(istype(used_item)) if(scanned_item) to_chat(user, SPAN_WARNING("\The [src] already has \a [scanned_item] inside!")) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - scanned_item = I - to_chat(user, SPAN_NOTICE("You put \the [I] into \the [src].")) + scanned_item = used_item + to_chat(user, SPAN_NOTICE("You put \the [used_item] into \the [src].")) return TRUE return FALSE @@ -115,14 +115,14 @@ fresh_coolant = 0 coolant_purity = 0 var/num_reagent_types = 0 - for(var/rtype in reagents.reagent_volumes) - var/cur_purity = coolant_reagents_purity[rtype] + for(var/decl/material/reagent as anything in reagents.reagent_volumes) + var/cur_purity = coolant_reagents_purity[reagent.type] if(!cur_purity) cur_purity = 0.1 else if(cur_purity > 1) cur_purity = 1 - total_purity += cur_purity * REAGENT_VOLUME(reagents, rtype) - fresh_coolant += REAGENT_VOLUME(reagents, rtype) + total_purity += cur_purity * REAGENT_VOLUME(reagents, reagent) + fresh_coolant += REAGENT_VOLUME(reagents, reagent) num_reagent_types += 1 if(total_purity && fresh_coolant) coolant_purity = total_purity / fresh_coolant diff --git a/code/modules/xenoarcheaology/tools/ano_device_battery.dm b/code/modules/xenoarcheaology/tools/ano_device_battery.dm index 86f037fd0f88..d9ed40ae0473 100644 --- a/code/modules/xenoarcheaology/tools/ano_device_battery.dm +++ b/code/modules/xenoarcheaology/tools/ano_device_battery.dm @@ -60,15 +60,15 @@ STOP_PROCESSING(SSobj, src) . = ..() -/obj/item/anodevice/attackby(var/obj/I, var/mob/user) - if(!istype(I, /obj/item/anobattery)) +/obj/item/anodevice/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/anobattery)) return ..() if(inserted_battery) return TRUE - if(!user.try_unequip(I, src)) + if(!user.try_unequip(used_item, src)) return TRUE - to_chat(user, SPAN_NOTICE("You insert \the [I] into \the [src].")) - inserted_battery = I + to_chat(user, SPAN_NOTICE("You insert \the [used_item] into \the [src].")) + inserted_battery = used_item update_icon() return TRUE @@ -110,12 +110,12 @@ if(!inserted_battery.battery_effect.activated) inserted_battery.battery_effect.ToggleActivate(1) switch(inserted_battery.battery_effect.operation_type) - if(EFFECT_TOUCH) + if(XA_EFFECT_TOUCH) visible_message("\The [src] shudders.") if(ismob(loc)) inserted_battery.battery_effect.DoEffectTouch(loc) inserted_battery.use_power(energy_consumed_on_touch) - if(EFFECT_PULSE) + if(XA_EFFECT_PULSE) inserted_battery.battery_effect.pulse_tick = inserted_battery.battery_effect.pulse_period //consume power relative to the time the artifact takes to charge and the effect range inserted_battery.use_power(inserted_battery.battery_effect.effect_range * inserted_battery.battery_effect.effect_range * inserted_battery.battery_effect.pulse_period) @@ -192,7 +192,7 @@ /obj/item/anodevice/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) if (!istype(target)) return ..() - if(activated && inserted_battery?.battery_effect?.operation_type == EFFECT_TOUCH) + if(activated && inserted_battery?.battery_effect?.operation_type == XA_EFFECT_TOUCH) inserted_battery.battery_effect.DoEffectTouch(target) inserted_battery.use_power(energy_consumed_on_touch) user.visible_message(SPAN_NOTICE("\The [user] taps [target] with \the [src], and it shudders on contact.")) diff --git a/code/modules/xgm/xgm_gas_mixture.dm b/code/modules/xgm/xgm_gas_mixture.dm index e567de48405c..823c729e3b1f 100644 --- a/code/modules/xgm/xgm_gas_mixture.dm +++ b/code/modules/xgm/xgm_gas_mixture.dm @@ -72,17 +72,6 @@ if(update) update_values() - -//Variadic version of adjust_gas(). Takes any number of gas and mole pairs and applies them. -/datum/gas_mixture/proc/adjust_multi() - ASSERT(!(args.len % 2)) - - for(var/i = 1; i < args.len; i += 2) - adjust_gas(args[i], args[i+1], update = 0) - - update_values() - - /// Merges all the gas from another mixture into this one. Respects group_multipliers and adjusts temperature correctly. /// Does not modify giver in any way. /datum/gas_mixture/proc/merge(const/datum/gas_mixture/giver) diff --git a/code/unit_tests/alt_appearances_test.dm b/code/unit_tests/alt_appearances_test.dm index d1c4b22a8e80..afb67f655d49 100644 --- a/code/unit_tests/alt_appearances_test.dm +++ b/code/unit_tests/alt_appearances_test.dm @@ -2,9 +2,8 @@ name = "ALT APPEARANCE: Cardborg shall have base backpack variant" /datum/unit_test/alt_appearance_cardborg_shall_have_base_backpack_variant/start_test() - for(var/ca_type in decls_repository.get_decl_paths_of_subtype(/decl/cardborg_appearance)) - var/decl/cardborg_appearance/ca = ca_type - var/obj/item/backpack/backpack_type = initial(ca.backpack_type) + for(var/decl/cardborg_appearance/disguise in decls_repository.get_decls_of_subtype_unassociated(/decl/cardborg_appearance)) + var/obj/item/backpack/backpack_type = disguise.backpack_type if(backpack_type == /obj/item/backpack) pass("Found a cardborg appearance using the base /obj/item/backpack backpack.") return 1 @@ -18,10 +17,9 @@ /datum/unit_test/alt_appearance_cardborg_all_icon_states_shall_exist/start_test() var/failed = FALSE - for(var/ca_type in decls_repository.get_decl_paths_of_subtype(/decl/cardborg_appearance)) - var/decl/cardborg_appearance/ca = ca_type - var/icon_state = initial(ca.icon_state) - if(!check_state_in_icon(icon_state, initial(ca.icon))) + for(var/decl/cardborg_appearance/disguise in decls_repository.get_decls_of_subtype_unassociated(/decl/cardborg_appearance)) + var/icon_state = disguise.icon_state + if(!check_state_in_icon(icon_state, disguise.icon)) log_unit_test("Icon state [icon_state] is missing.") failed = TRUE if(failed) @@ -36,8 +34,8 @@ /datum/unit_test/alt_appearance_cardborg_shall_have_unique_backpack_types/start_test() var/list/backpack_types = list() for(var/ca_type in decls_repository.get_decl_paths_of_subtype(/decl/cardborg_appearance)) - var/decl/cardborg_appearance/ca = ca_type - group_by(backpack_types, initial(ca.backpack_type), ca) + var/decl/cardborg_appearance/disguise = ca_type + group_by(backpack_types, initial(disguise.backpack_type), disguise) var/number_of_issues = number_of_issues(backpack_types, "Backpack Types") if(number_of_issues) diff --git a/code/unit_tests/atmospherics_tests.dm b/code/unit_tests/atmospherics_tests.dm index 46837d818bf5..0fa4febe7d55 100644 --- a/code/unit_tests/atmospherics_tests.dm +++ b/code/unit_tests/atmospherics_tests.dm @@ -14,11 +14,9 @@ var/list/initial_gas = mix_data["initial_gas"] if(initial_gas.len) - var/list/gas_args = list() for(var/gasid in initial_gas) - gas_args += gasid - gas_args += initial_gas[gasid] - gas_mix.adjust_multi(arglist(gas_args)) + gas_mix.adjust_gas(gasid, initial_gas[gasid], FALSE) + gas_mix.update_values() gas_mixes[mix_name] = gas_mix return gas_mixes diff --git a/code/unit_tests/backgrounds.dm b/code/unit_tests/backgrounds.dm index e08b1ec37512..7ae0d11df6e6 100644 --- a/code/unit_tests/backgrounds.dm +++ b/code/unit_tests/backgrounds.dm @@ -3,93 +3,103 @@ /datum/unit_test/background/start_test() - var/list/all_background_tokens = global.using_map.get_background_categories() - + var/list/all_background_categories = decls_repository.get_decls_of_subtype(/decl/background_category) var/fails = 0 - for(var/species_name in get_all_species()) - var/decl/species/species = get_species_by_key(species_name) +#ifdef UNIT_TEST + var/list/check_flags = global.all_background_flags.Copy() + for(var/cat_type in all_background_categories) + var/decl/background_category/background_cat = all_background_categories[cat_type] + for(var/background_flag in check_flags) + if(background_cat.background_flags & check_flags[background_flag]) + check_flags -= background_flag + if(length(check_flags)) + fails++ + log_bad("Set of map background categories missing background flags: [english_list(check_flags)]") +#endif + + for(var/decl/species/species as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) if(!islist(species.default_background_info)) fails++ - log_bad("Default background info for [species_name] is not a list.") + log_bad("Default background info for [species.type] is not a list.") else for(var/cat_type in species.default_background_info) - if(!(cat_type in all_background_tokens)) + if(!(cat_type in all_background_categories)) fails++ - log_bad("Default background info for [species_name] contains invalid tag '[cat_type]'.") + log_bad("Default background info for [species.type] contains invalid tag '[cat_type]'.") else var/val = species.default_background_info[cat_type] if(!val) fails++ - log_bad("Default background value '[val]' for [species_name] tag '[cat_type]' is null, must be a type.") + log_bad("Default background value '[val]' for [species.type] tag '[cat_type]' is null, must be a type.") else if(istext(val)) fails++ - log_bad("Default background value '[val]' for [species_name] tag '[cat_type]' is text, must be a type.") + log_bad("Default background value '[val]' for [species.type] tag '[cat_type]' is text, must be a type.") else var/decl/background_detail/background = GET_DECL(val) if(!istype(background)) fails++ - log_bad("Default background value '[val]' for [species_name] tag '[cat_type]' is not a valid background label.") + log_bad("Default background value '[val]' for [species.type] tag '[cat_type]' is not a valid background label.") else if(background.category != cat_type) fails++ - log_bad("Default background value '[val]' for [species_name] tag '[cat_type]' does not match background datum category ([background.category] must equal [cat_type]).") + log_bad("Default background value '[val]' for [species.type] tag '[cat_type]' does not match background datum category ([background.category] must equal [cat_type]).") else if(!background.description) fails++ - log_bad("Default background value '[val]' for [species_name] tag '[cat_type]' does not have a description set.") + log_bad("Default background value '[val]' for [species.type] tag '[cat_type]' does not have a description set.") if(!islist(species.force_background_info)) fails++ - log_bad("Forced background info for [species_name] is not a list.") + log_bad("Forced background info for [species.type] is not a list.") else for(var/cat_type in species.force_background_info) - if(!(cat_type in all_background_tokens)) + if(!(cat_type in all_background_categories)) fails++ - log_bad("Forced background info for [species_name] contains invalid tag '[cat_type]'.") + log_bad("Forced background info for [species.type] contains invalid tag '[cat_type]'.") else var/val = species.force_background_info[cat_type] if(!val) fails++ - log_bad("Forced background value for [species_name] tag '[cat_type]' is null, must be a type.") + log_bad("Forced background value for [species.type] tag '[cat_type]' is null, must be a type.") else if(istext(val)) fails++ - log_bad("Forced background value for [species_name] tag '[cat_type]' is text, must be a type.") + log_bad("Forced background value for [species.type] tag '[cat_type]' is text, must be a type.") else var/decl/background_detail/background = GET_DECL(val) if(!istype(background)) fails++ - log_bad("Forced background value '[val]' for [species_name] tag '[cat_type]' is not a valid background label.") + log_bad("Forced background value '[val]' for [species.type] tag '[cat_type]' is not a valid background label.") else if(background.category != cat_type) fails++ - log_bad("Forced background value '[val]' for [species_name] tag '[cat_type]' does not match background datum category ([background.category] must equal [cat_type]).") + log_bad("Forced background value '[val]' for [species.type] tag '[cat_type]' does not match background datum category ([background.category] must equal [cat_type]).") else if(!background.description) fails++ - log_bad("Forced background value '[val]' for [species_name] tag '[cat_type]' does not have a description set.") + log_bad("Forced background value '[val]' for [species.type] tag '[cat_type]' does not have a description set.") if(!islist(species.available_background_info)) fails++ - log_bad("Available background info for [species_name] is not a list.") + log_bad("Available background info for [species.type] is not a list.") else - for(var/cat_type in all_background_tokens) + for(var/cat_type in all_background_categories) if(!islist(species.available_background_info[cat_type])) fails++ - log_bad("Available background info for [species_name] tag '[cat_type]' is invalid type, must be a list.") + log_bad("Available background info for [species.type] tag '[cat_type]' is invalid type, must be a list.") else if(!LAZYLEN(species.available_background_info[cat_type])) fails++ - log_bad("Available background info for [species_name] tag '[cat_type]' is empty, must have at least one entry.") + log_bad("Available background info for [species.type] tag '[cat_type]' is empty, must have at least one entry.") else for(var/val in species.available_background_info[cat_type]) if(istext(val)) - log_bad("Available background value '[val]' for [species_name] tag '[cat_type]' is text, must be a type.") + log_bad("Available background value '[val]' for [species.type] tag '[cat_type]' is text, must be a type.") else var/decl/background_detail/background = GET_DECL(val) if(!istype(background)) fails++ - log_bad("Available background value '[val]' for [species_name] tag '[cat_type]' is not a valid background label.") + log_bad("Available background value '[val]' for [species.type] tag '[cat_type]' is not a valid background label.") else if(background.category != cat_type) fails++ - log_bad("Available background value '[val]' for [species_name] tag '[cat_type]' does not match background datum category ([background.category] must equal [cat_type]).") + log_bad("Available background value '[val]' for [species.type] tag '[cat_type]' does not match background datum category ([background.category] must equal [cat_type]).") else if(!background.description) fails++ - log_bad("Available background value '[val]' for [species_name] tag '[cat_type]' does not have a description set.") + log_bad("Available background value '[val]' for [species.type] tag '[cat_type]' does not have a description set.") if(fails > 0) fail("[fails] invalid background value(s)") diff --git a/code/unit_tests/clothing.dm b/code/unit_tests/clothing.dm index 8219e6d04188..a688f653ad24 100644 --- a/code/unit_tests/clothing.dm +++ b/code/unit_tests/clothing.dm @@ -8,7 +8,8 @@ var/list/icon_states_checked = list() var/list/reported_failures = list() - var/decl/species/default_species = get_species_by_key(SPECIES_HUMAN) + // TODO: Make this not hardcoded to humans, and test more than just the default bodytype. + var/decl/species/default_species = decls_repository.get_decl_by_id(/decl/species/human::uid) var/decl/bodytype/default_bodytype = default_species.default_bodytype var/state_base = default_bodytype.bodytype_category @@ -35,6 +36,11 @@ if(!(initial_state in reported_failures[initial_icon])) LAZYADD(reported_failures[initial_icon], initial_state) clothing_fails += "missing initial state '[initial_state]' in initial icon '[initial_icon]'" + // World but no inventory is fine; inventory but no world is disallowed. + else if(initial_icon == ICON_STATE_INV && !check_state_in_icon(ICON_STATE_WORLD, initial_icon)) + if(!(initial_state in reported_failures[ICON_STATE_WORLD])) + LAZYADD(reported_failures[ICON_STATE_WORLD], initial_state) + clothing_fails += "has 'inventory' initial state but no 'world' state in initial icon '[initial_icon]'" if(initial_item_state) clothing_fails += "legacy item state set '[initial_item_state]'" @@ -94,40 +100,43 @@ generated_tokens += "[gen_token][token]" // God help unit test time if people start putting markings on flannel shirts. - if(clothes.markings_state_modifier && clothes.markings_color) + if(clothes.markings_state_modifier) + // Check even if markings_color is null, because subtypes may use the icon and we don't want to mark it as extraneous. for(var/token in generated_tokens) generated_tokens += "[token][clothes.markings_state_modifier]" + generated_tokens += clothes.markings_state_modifier // Keep track of which states we've looked for or otherwise evaluated for later state checking. var/list/check_states = get_states_in_icon(clothes.icon) // Validate against the list of generated tokens. for(var/gen_token in generated_tokens) - - // This logic is currently not working (false negatives). Uncomment when fixed. - /* if(ICON_STATE_WORLD in check_states) var/check_state = "[ICON_STATE_WORLD][gen_token]" if(!(check_state in reported_failures[clothes.icon]) && !(check_state in check_states)) LAZYADD(reported_failures[clothes.icon], check_state) clothing_fails += "missing token world state '[check_state]' in '[clothes.icon]'" + else + // Prune expected states from the file. + check_states -= check_state if(ICON_STATE_INV in check_states) var/check_state = "[ICON_STATE_INV][gen_token]" if(!(check_state in reported_failures[clothes.icon]) && !(check_state in check_states)) LAZYADD(reported_failures[clothes.icon], check_state) clothing_fails += "missing token inventory state '[check_state]' in '[clothes.icon]'" + else + // Prune expected states from the file. + check_states -= check_state if(fallback_slot) var/check_state = "[state_base]-[fallback_slot][gen_token]" if(!(check_state in reported_failures[clothes.icon]) && !(check_state in check_states)) LAZYADD(reported_failures[clothes.icon], check_state) clothing_fails += "missing token onmob state '[check_state]' in '[clothes.icon]'" - */ - // Prune expected states from the file. - for(var/related_state in check_states) - if(findtext(related_state, gen_token)) - check_states -= related_state + else + // Prune expected states from the file. + check_states -= check_state // Now we check for unrelated or invalid modifier states remaining. var/list/extraneous_states = list() @@ -135,8 +144,13 @@ for(var/modifier_type in all_modifiers) var/decl/clothing_state_modifier/modifier = all_modifiers[modifier_type] if(modifier.applies_icon_state_modifier) + // This is working on the assumption that bodytypes all end in " body". + // If that changes this will need a better method. + var/regex/is_alt_bodytype_state = regex("^\[A-Za-z \]+ body-") for(var/check_state in check_states) if(findtext(check_state, modifier.icon_state_modifier)) + if(is_alt_bodytype_state.Find(check_state)) + continue extraneous_states |= check_state for(var/extraneous_state in extraneous_states) diff --git a/code/unit_tests/equipment_tests.dm b/code/unit_tests/equipment_tests.dm index dac446856e8b..3a1390139822 100644 --- a/code/unit_tests/equipment_tests.dm +++ b/code/unit_tests/equipment_tests.dm @@ -7,7 +7,7 @@ async = 1 /datum/unit_test/vision_glasses/start_test() - subject = new(get_safe_turf(), SPECIES_HUMAN) // force human so default map species doesn't mess with anything + subject = new(get_safe_turf(), /decl/species/human::uid) // force human so default map species doesn't mess with anything subject.equip_to_slot(new glasses_type(subject), slot_glasses_str) return 1 @@ -55,10 +55,10 @@ for(var/storage_type in typesof(/obj)) var/obj/thing = storage_type - if(TYPE_IS_ABSTRACT(thing) || !ispath(initial(thing.storage), /datum/storage)) + if(!TYPE_IS_SPAWNABLE(thing) || !ispath(initial(thing.storage), /datum/storage)) continue thing = new thing //should be fine to put it in nullspace... - var/bad_msg = "[ascii_red]--------------- [thing.name] \[[thing.type] | [thing.storage]\]" + var/bad_msg = "[ascii_red]--------------- [thing.name] \[[thing.type] | [thing.storage || "NULL"]\]" bad_tests += test_storage_capacity(thing.storage, bad_msg) if(bad_tests) @@ -150,7 +150,7 @@ failure_list += "[item] was equipped to [equipped_location] despite failing isEquipped (should not be equipped)." /datum/unit_test/equipment_slot_test/start_test() - var/mob/living/human/subject = new(get_safe_turf(), SPECIES_HUMAN) // force human so default map species doesn't mess with anything + var/mob/living/human/subject = new(get_safe_turf(), /decl/species/human::uid) // force human so default map species doesn't mess with anything created_atoms |= subject var/list/failures = list() diff --git a/code/unit_tests/food_tests.dm b/code/unit_tests/food_tests.dm index c1a682a5e0d3..d9192ca4a272 100644 --- a/code/unit_tests/food_tests.dm +++ b/code/unit_tests/food_tests.dm @@ -65,92 +65,96 @@ var/failures = list() var/obj/container = new // dummy container for holding ingredients container.create_reagents(1000) + var/static/list/all_recipe_categories = list( + RECIPE_CATEGORY_MICROWAVE, + RECIPE_CATEGORY_POT, + RECIPE_CATEGORY_SKILLET, + RECIPE_CATEGORY_BAKING_DISH, + ) for (var/decl/recipe/recipe in decls_repository.get_decls_of_subtype_unassociated(/decl/recipe)) - // assume all recipes are valid because /decl/recipe/validate() handles other things - for(var/item_path in recipe.items) - var/count = recipe.items[item_path] || 1 - if(ispath(item_path, /obj/item/stack)) - if(ispath(item_path, /obj/item/stack/material)) - new item_path(container, count, /decl/material/solid/organic/bone) // placeholder - else - new item_path(container, count) - else - for(var/i in 1 to count) - if(ispath(item_path, /obj/item/food/grown)) - new item_path(container, null, null, "carrot") // placeholder - else if(ispath(item_path, /obj/item/food/processed_grown)) - new item_path(container, null, null, "carrot") // placeholder - else if(ispath(item_path, /obj/item/paper)) - new item_path(container, null, "This is so that fortune cookies work properly. TODO: Make this generic somehow?") - else - new item_path(container) var/recipe_is_valid = TRUE - for(var/fruit_key in recipe.fruit) - var/list/key_components = splittext(fruit_key, " ") - var/fruit_index = 1 - var/dry = FALSE - if(key_components[1] == "dried") - fruit_index = 2 - dry = TRUE - var/seed = seeds_by_tag[key_components[fruit_index]] - if(!seed) - failures += "Unable to find seed with grown_tag [key_components[fruit_index]] from recipe [recipe.type]" - recipe_is_valid = FALSE - continue - if(length(key_components) > fruit_index) // processed grown! - var/processed_type = processed_growns_by_tag[key_components[fruit_index + 1]] - if(!processed_type) - failures += "Unable to find processed grown type with tag [key_components[fruit_index + 1]] from recipe [recipe.type]" + // check each category, not just the first one + // null -> all categories are valid + var/list/container_categories = recipe.container_categories || all_recipe_categories + for(var/container_category in container_categories) + if(!recipe_is_valid) + break // something is fundamentally wrong with the recipe, don't check the other categories + // assume all recipes are valid because /decl/recipe/validate() handles other things + for(var/item_path in recipe.items) + var/count = recipe.items[item_path] || 1 + if(ispath(item_path, /obj/item/stack)) + if(ispath(item_path, /obj/item/stack/material)) + new item_path(container, count, /decl/material/solid/organic/bone) // placeholder + else + new item_path(container, count) + else + for(var/i in 1 to count) + if(ispath(item_path, /obj/item/food/grown)) + new item_path(container, null, null, "carrot") // placeholder + else if(ispath(item_path, /obj/item/food/processed_grown)) + new item_path(container, null, null, "carrot") // placeholder + else if(ispath(item_path, /obj/item/paper)) + new item_path(container, null, "This is so that fortune cookies work properly. TODO: Make this generic somehow?") + else + new item_path(container) + for(var/fruit_key in recipe.fruit) + var/list/key_components = splittext(fruit_key, " ") + var/fruit_index = 1 + var/dry = FALSE + if(key_components[1] == "dried") + fruit_index = 2 + dry = TRUE + var/seed = seeds_by_tag[key_components[fruit_index]] + if(!seed) + failures += "Unable to find seed with grown_tag [key_components[fruit_index]] from recipe [recipe.type]" recipe_is_valid = FALSE continue - for(var/i in 1 to recipe.fruit[fruit_key]) - var/obj/item/food/processed_grown/processed = new processed_type(container, null, null, seed) - if(dry) - processed = processed.dry_out(null, processed.get_max_drying_wetness() + 1) - processed.forceMove(container) - else - for(var/i in 1 to recipe.fruit[fruit_key]) - var/obj/item/food/grown/grown = new /obj/item/food/grown(container, null, null, seed) - if(dry) - grown = grown.dry_out(null, grown.get_max_drying_wetness() + 1) - grown.forceMove(container) - - for(var/material_key in recipe.reagents) - container.add_to_reagents(material_key, recipe.reagents[material_key]) + if(length(key_components) > fruit_index) // processed grown! + var/processed_type = processed_growns_by_tag[key_components[fruit_index + 1]] + if(!processed_type) + failures += "Unable to find processed grown type with tag [key_components[fruit_index + 1]] from recipe [recipe.type]" + recipe_is_valid = FALSE + continue + for(var/i in 1 to recipe.fruit[fruit_key]) + var/obj/item/food/processed_grown/processed = new processed_type(container, null, null, seed) + if(dry) + processed = processed.dry_out(null, processed.get_max_drying_wetness() + 1) + processed.forceMove(container) + else + for(var/i in 1 to recipe.fruit[fruit_key]) + var/obj/item/food/grown/grown = new /obj/item/food/grown(container, null, null, seed) + if(dry) + grown = grown.dry_out(null, grown.get_max_drying_wetness() + 1) + grown.forceMove(container) - if(!recipe_is_valid) - QDEL_LIST(container.contents) // clean up prematurely - container.reagents.clear_reagents() - continue + for(var/material_key in recipe.reagents) + container.add_to_reagents(material_key, recipe.reagents[material_key]) - // continue with validation - var/container_category = RECIPE_CATEGORY_MICROWAVE - if(recipe.container_categories) - container_category = recipe.container_categories[recipe.container_categories.len] - if(!container_category) - failures += "Invalid container categories [json_encode(recipe.container_categories)] on [recipe.type]" + if(!recipe_is_valid) QDEL_LIST(container.contents) // clean up prematurely container.reagents.clear_reagents() continue - var/cooking_temperature = T20C - if(recipe.minimum_temperature > 0) - cooking_temperature = max(cooking_temperature, recipe.minimum_temperature) - if(recipe.maximum_temperature < INFINITY) - cooking_temperature = min(cooking_temperature, recipe.maximum_temperature) - var/decl/recipe/new_recipe = select_recipe(container_category, container, cooking_temperature) - if(new_recipe && new_recipe != recipe) - failures += "Recipe [recipe.type]'s ingredients selected [new_recipe.type] instead!" - else if(!new_recipe) - failures += "Recipe [recipe.type]'s ingredients selected NULL instead!" - else - recipe.produce_result(container) - if(ispath(recipe.result, /decl/material) && !container.reagents.has_reagent(recipe.result)) - failures += "Recipe [recipe.type] did not produce the expected output [recipe.result]" - if(ispath(recipe.result, /atom/movable) && !locate(recipe.result) in container) - failures += "Recipe [recipe.type] did not produce the expected output [recipe.result]" - - QDEL_LIST(container.contents) // clean up - container.reagents.clear_reagents() + + // continue with validation + var/cooking_temperature = T20C + if(recipe.minimum_temperature > 0) + cooking_temperature = max(cooking_temperature, recipe.minimum_temperature) + if(recipe.maximum_temperature < INFINITY) + cooking_temperature = min(cooking_temperature, recipe.maximum_temperature) + var/decl/recipe/new_recipe = select_recipe(container_category, container, cooking_temperature) + if(new_recipe && new_recipe != recipe) + failures += "Recipe [recipe.type]'s ingredients selected [new_recipe.type] instead!" + else if(!new_recipe) + failures += "Recipe [recipe.type]'s ingredients selected NULL instead!" + else + recipe.produce_result(container) + if(ispath(recipe.result, /decl/material) && !container.reagents.has_reagent(recipe.result)) + failures += "Recipe [recipe.type] did not produce the expected output [recipe.result]" + if(ispath(recipe.result, /atom/movable) && !locate(recipe.result) in container) + failures += "Recipe [recipe.type] did not produce the expected output [recipe.result]" + + QDEL_LIST(container.contents) // clean up + container.reagents.clear_reagents() if(length(failures)) fail("Some recipes failed to produce the right result:\n\t-[jointext(failures, "\n\t-")]") diff --git a/code/unit_tests/json.dm b/code/unit_tests/json.dm index a5be63f35bb9..1ac8aa5cb571 100644 --- a/code/unit_tests/json.dm +++ b/code/unit_tests/json.dm @@ -37,6 +37,12 @@ var/list/failures var/list/json_to_check + for(var/atom/movable/subtype as anything in typesof(/obj)) + if(TYPE_IS_ABSTRACT(subtype)) + continue + var/check_json = subtype::buckle_pixel_shift + if(istext(check_json)) + LAZYSET(json_to_check, "[subtype].buckle_pixel_shift", check_json) for(var/subtype in typesof(/obj)) var/obj/test = subtype var/check_json = initial(test.directional_offset) @@ -67,6 +73,15 @@ var/check_json = initial(test.possible_transfer_amounts) if(!isnull(check_json)) LAZYSET(json_to_check, "[subtype].possible_transfer_amounts", check_json) + for(var/mob/subtype as anything in typesof(/mob)) + if(TYPE_IS_ABSTRACT(subtype)) + continue + var/list/quadruped_bodytypes = decls_repository.get_decls_of_subtype(/decl/bodytype/quadruped) + for(var/quad_bodytype_path in quadruped_bodytypes) + var/decl/bodytype/quadruped/quad_bodytype = quadruped_bodytypes[quad_bodytype_path] + var/check_json = quad_bodytype.riding_offset + if(istext(check_json)) + LAZYSET(json_to_check, "[quad_bodytype_path].riding_offset", check_json) var/list/prefabs = decls_repository.get_decls_of_subtype(/decl/prefab/ic_assembly) for(var/assembly_path in prefabs) var/decl/prefab/ic_assembly/assembly = prefabs[assembly_path] diff --git a/code/unit_tests/loadout_tests.dm b/code/unit_tests/loadout_tests.dm index 563a1863a204..53699f1c1c0c 100644 --- a/code/unit_tests/loadout_tests.dm +++ b/code/unit_tests/loadout_tests.dm @@ -4,9 +4,9 @@ /datum/unit_test/loadout_test_shall_have_valid_icon_states/start_test() var/list/failed = list() - for(var/decl/loadout_option/G in decls_repository.get_decls_unassociated(/decl/loadout_option)) + for(var/decl/loadout_option/gear in decls_repository.get_decls_unassociated(/decl/loadout_option)) var/list/path_tweaks = list() - for(var/datum/gear_tweak/path/p in G.gear_tweaks) + for(var/datum/gear_tweak/path/p in gear.gear_tweaks) path_tweaks += p if(path_tweaks.len) @@ -15,17 +15,17 @@ var/path_type = p.valid_paths[path_name] if(!type_has_valid_icon_state(path_type)) var/atom/A = path_type - failed += "[G] - [path_type] ('[path_name]'): Did not find a gear_tweak's icon_state '[initial(A.icon_state)]' in the icon '[initial(A.icon)]'." + failed += "[gear] - [path_type] ('[path_name]'): Did not find a gear_tweak's icon_state '[initial(A.icon_state)]' in the icon '[initial(A.icon)]'." else - if(!type_has_valid_icon_state(G.path)) - var/obj/O = G.path - if(ispath(G.path, /obj)) - O = new G.path() + if(!type_has_valid_icon_state(gear.path)) + var/obj/O = gear.path + if(ispath(gear.path, /obj)) + O = new gear.path() if(!is_string_in_list(O.icon_state, icon_states(O.icon))) - failed += "[G] - [G.path]: Did not find the icon state '[O.icon_state]' in the icon '[O.icon]'." + failed += "[gear] - [gear.path]: Did not find the icon state '[O.icon_state]' in the icon '[O.icon]'." qdel(O) else - failed += "[G] - [G.path]: Did not find the icon state '[initial(O.icon_state)]' in the icon '[initial(O.icon)]'." + failed += "[gear] - [gear.path]: Did not find the icon state '[initial(O.icon_state)]' in the icon '[initial(O.icon)]'." if(length(failed)) fail("[length(failed)] /decl/loadout definition\s had paths with invalid icon states:\n[jointext(failed, "\n")]") @@ -38,12 +38,12 @@ /datum/unit_test/loadout_test_gear_path_tweaks_shall_be_of_gear_path/start_test() var/list/failed = list() - for(var/decl/loadout_option/G in decls_repository.get_decls_unassociated(/decl/loadout_option)) - for(var/datum/gear_tweak/path/p in G.gear_tweaks) + for(var/decl/loadout_option/gear in decls_repository.get_decls_unassociated(/decl/loadout_option)) + for(var/datum/gear_tweak/path/p in gear.gear_tweaks) for(var/path_name in p.valid_paths) var/path_type = p.valid_paths[path_name] - if(!ispath(path_type, G.path)) - failed += "[G] - [path_type] ('[path_name]'): Was not a path of [G.path]." + if(!ispath(path_type, gear.path)) + failed += "[gear] - [path_type] ('[path_name]'): Was not a path of [gear.path]." if(length(failed)) fail("[length(failed)] /datum/gear_tweak/path definition\s had invalid paths:\n[jointext(failed, "\n")]") @@ -56,10 +56,10 @@ /datum/unit_test/loadout_test_gear_path_tweaks_shall_have_unique_keys/start_test() var/path_entries_by_gear_path_and_name = list() - for(var/decl/loadout_option/G in decls_repository.get_decls_unassociated(/decl/loadout_option)) - for(var/datum/gear_tweak/path/p in G.gear_tweaks) + for(var/decl/loadout_option/gear in decls_repository.get_decls_unassociated(/decl/loadout_option)) + for(var/datum/gear_tweak/path/p in gear.gear_tweaks) for(var/path_name in p.valid_paths) - group_by(path_entries_by_gear_path_and_name, "[G] - [p] - [path_name]", path_name) + group_by(path_entries_by_gear_path_and_name, "[gear] - [p] - [path_name]", path_name) var/number_of_issues = number_of_issues(path_entries_by_gear_path_and_name, "Path Tweak Names") if(number_of_issues) @@ -79,15 +79,15 @@ /datum/unit_test/loadout_custom_setup_tweaks_shall_have_valid_procs/start_test() var/list/failures = list() - for(var/decl/loadout_option/G in decls_repository.get_decls_unassociated(/decl/loadout_option)) + for(var/decl/loadout_option/gear in decls_repository.get_decls_unassociated(/decl/loadout_option)) var/datum/instance var/mob/user - for(var/datum/gear_tweak/custom_setup/cs in G.gear_tweaks) - instance = instance || new G.path() + for(var/datum/gear_tweak/custom_setup/custom_tweak in gear.gear_tweaks) + instance = instance || new gear.path() user = user || new() - var/res = cs.tweak_item(user, instance) - if(res != GEAR_TWEAK_SUCCESS && res != GEAR_TWEAK_SKIPPED) - failures += "[G.type] - [cs.type]" + var/result = custom_tweak.tweak_item(user, instance) + if(result != GEAR_TWEAK_SUCCESS && result != GEAR_TWEAK_SKIPPED) + failures += "[gear.type] - [custom_tweak.type]" QDEL_NULL(instance) QDEL_NULL(user) @@ -102,13 +102,13 @@ name = "LOADOUT: Custom setup tweak shall be applied as expected" /datum/unit_test/loadout_custom_setup_tweak_shall_be_applied_as_expected/start_test() - var/decl/loadout_option/G = GET_DECL(/decl/loadout_option/loadout_test) - var/obj/unit_test/loadout/instance = new G.path() + var/decl/loadout_option/gear = GET_DECL(/decl/loadout_option/loadout_test) + var/obj/unit_test/loadout/instance = new gear.path() var/mob/user = new() - for(var/datum/gear_tweak/custom_setup/cs in G.gear_tweaks) - cs.tweak_item(user, instance) + for(var/datum/gear_tweak/custom_setup/custom_tweak in gear.gear_tweaks) + custom_tweak.tweak_item(user, instance) - if(instance.loadout_mob == user && instance.loadout_var == G.custom_setup_proc_arguments[1]) + if(instance.loadout_mob == user && instance.loadout_var == gear.custom_setup_proc_arguments[1]) pass("Succesfully applied custom tweak") else fail("Failed to apply custom tweak") diff --git a/code/unit_tests/machine_tests.dm b/code/unit_tests/machine_tests.dm index bcb10b27b2fe..7b14762cb32d 100644 --- a/code/unit_tests/machine_tests.dm +++ b/code/unit_tests/machine_tests.dm @@ -48,15 +48,20 @@ /datum/unit_test/machine_construct_states_shall_be_valid name = "MACHINE: All mapped machines with construct states shall meet state requirements." +/// Returns a failure string if the unit test should fail, FALSE if it should succeed. +/// Mostly just a wrapper to handle things like unlocking prior to testing, or skipping the testing entirely. +/obj/machinery/proc/fail_construct_state_unit_test() + if(!construct_state) + return FALSE + return construct_state.fail_unit_test(src) + /datum/unit_test/machine_construct_states_shall_be_valid/start_test() var/failed = list() for(var/thing in SSmachines.machinery) var/obj/machinery/machine = thing if(failed[machine.type]) continue - if(!machine.construct_state) - continue - var/fail = machine.construct_state.fail_unit_test(machine) + var/fail = machine.fail_construct_state_unit_test() if(fail) failed[machine.type] = TRUE log_bad(fail) @@ -86,3 +91,36 @@ else pass("All machines had valid basetypes.") return 1 + +/datum/unit_test/machines_shall_have_sane_stat_immune + name = "MACHINE: All machines that do not require screens/keyboards must have NOSCREEN/NOINPUT stat immunity." + +/datum/unit_test/machines_shall_have_sane_stat_immune/start_test() + var/failed = list() + var/passed = list() + for(var/obj/machinery/machine as anything in SSmachines.machinery) + var/candidate_type = machine.base_type || machine.type + if(isnull(machine.construct_state)) + continue + if(passed[candidate_type] || failed[candidate_type]) + continue + var/obj/item/stock_parts/circuitboard/board = machine.get_component_of_type(/obj/item/stock_parts/circuitboard) + var/has_screen = machine.get_component_of_type(/obj/item/stock_parts/console_screen) + var/has_keyboard = machine.get_component_of_type(/obj/item/stock_parts/keyboard) + if(board) + has_screen ||= (/obj/item/stock_parts/console_screen in board.req_components) || (/obj/item/stock_parts/console_screen in board.additional_spawn_components) + has_keyboard ||= (/obj/item/stock_parts/keyboard in board.req_components) || (/obj/item/stock_parts/keyboard in board.additional_spawn_components) + if(!has_screen && !(machine.stat_immune & NOSCREEN)) + failed[candidate_type] = TRUE + log_bad("[log_info_line(machine)] doesn't start with or require a screen, but did not have NOSCREEN in stat_immune.") + if(!has_keyboard && !(machine.stat_immune & NOINPUT)) + failed[candidate_type] = TRUE + log_bad("[log_info_line(machine)] doesn't start with or require a keyboard, but did not have NOINPUT in stat_immune.") + if(!failed[candidate_type]) + passed[candidate_type] = TRUE + + if(length(failed)) + fail("One or more machines had incorrect stat_immune settings.") + else + pass("All machines had correct stat_immune settings.") + return TRUE \ No newline at end of file diff --git a/code/unit_tests/map_tests.dm b/code/unit_tests/map_tests.dm index 89238fa88d21..20ba36dac7da 100644 --- a/code/unit_tests/map_tests.dm +++ b/code/unit_tests/map_tests.dm @@ -184,7 +184,7 @@ /datum/unit_test/wire_dir_and_icon_stat/start_test() var/list/bad_cables = list() - for(var/obj/structure/cable/C in global.cable_list) + for(var/obj/structure/cable/C in global.all_cables) var/expected_icon_state = "[C.d1]-[C.d2]" if(C.icon_state != expected_icon_state) bad_cables |= C @@ -411,7 +411,7 @@ var/safe_landmarks = 0 var/space_landmarks = 0 - for(var/lm in global.landmarks_list) + for(var/lm in global.all_landmarks) var/obj/abstract/landmark/landmark = lm if(istype(landmark, /obj/abstract/landmark/test/safe_turf)) log_debug("Safe landmark found: [log_info_line(landmark)]") @@ -706,7 +706,7 @@ var/global/_unit_test_sort_junctions = list() exceptions_by_turf[T] += exception[4] exceptions = exceptions_by_turf - for(var/obj/structure/cable/C in global.cable_list) + for(var/obj/structure/cable/C in global.all_cables) if(!QDELETED(C) && !all_ends_connected(C)) failures++ diff --git a/code/unit_tests/materials.dm b/code/unit_tests/materials.dm index f55ade48d342..8ad6424f271c 100644 --- a/code/unit_tests/materials.dm +++ b/code/unit_tests/materials.dm @@ -12,32 +12,51 @@ var/list/stack_types = list(null) var/list/tool_types = list(null) - var/list/all_recipes = decls_repository.get_decls_of_subtype(/decl/stack_recipe) - for(var/recipe_type in all_recipes) - var/decl/stack_recipe/recipe = all_recipes[recipe_type] + var/list/all_recipes = decls_repository.get_decls_of_subtype_unassociated(/decl/stack_recipe) + for(var/decl/stack_recipe/recipe in all_recipes) if(recipe.required_tool) tool_types |= recipe.required_tool if(recipe.craft_stack_types) stack_types |= recipe.craft_stack_types // Force config to be the most precise recipes possible. + // This first one doesn't actually work because it's applied on decl init... var/decl/config/config = GET_DECL(/decl/config/toggle/on/stack_crafting_uses_types) config.set_value(TRUE) config = GET_DECL(/decl/config/toggle/stack_crafting_uses_tools) config.set_value(TRUE) var/list/test_materials = list( - GET_DECL(/decl/material/solid/organic/wood), + GET_DECL(/decl/material/solid/organic/wood/oak), GET_DECL(/decl/material/solid/organic/plastic), GET_DECL(/decl/material/solid/organic/meat), + GET_DECL(/decl/material/solid/organic/cloth/linen), + GET_DECL(/decl/material/solid/organic/leather), + GET_DECL(/decl/material/solid/organic/plantmatter/grass/dry), + GET_DECL(/decl/material/solid/organic/paper), GET_DECL(/decl/material/solid/metal/steel), GET_DECL(/decl/material/solid/metal/plasteel), GET_DECL(/decl/material/solid/metal/gold), + GET_DECL(/decl/material/solid/metal/aluminium), + GET_DECL(/decl/material/solid/organic/wax), GET_DECL(/decl/material/solid/glass), - GET_DECL(/decl/material/solid/stone/sandstone), - GET_DECL(/decl/material/solid/clay) + GET_DECL(/decl/material/solid/stone/basalt), + GET_DECL(/decl/material/solid/clay), ) + // Add validation materials if not already present + // (this is especially useful for modpacked recipes/materials, like nullglass) + for(var/decl/stack_recipe/the_recipe in all_recipes) + if(ispath(the_recipe.required_material)) + var/decl/material/the_validation_material = the_recipe.required_material + if(TYPE_IS_ABSTRACT(the_validation_material)) + the_validation_material = decls_repository.get_first_concrete_decl_path_of_type(the_recipe.required_material) + test_materials |= GET_DECL(the_validation_material) + continue + if(the_recipe.validation_material) + test_materials |= GET_DECL(the_recipe.validation_material) + continue + // This is obscene, but completeness requires it. for(var/stack_type in stack_types) for(var/tool_type in tool_types) @@ -51,28 +70,28 @@ // Handle the actual validation. for(var/decl/stack_recipe/recipe as anything in recipes) - var/test_type = recipe.test_result_type || recipe.result_type - if(!test_type || ispath(test_type, /turf)) // Cannot exist without a loc and doesn't have matter, cannot assess here. + if(!recipe.result_type || ispath(recipe.result_type, /turf)) // Cannot exist without a loc and doesn't have matter, cannot assess here. continue var/list/results = recipe.spawn_result(null, null, 1, material, reinforced, null) var/atom/product = LAZYACCESS(results, 1) var/list/failed = list() if(!product) failed += "no product returned" - else if(!istype(product, recipe.expected_product_type)) - failed += "unexpected product type returned ([product.type])" + else if(!istype(product, recipe.result_type)) + failed += "unexpected product type, got '[product.type]' (expected '[recipe.result_type]')" else if(isobj(product)) - var/obj/product_obj = product - LAZYINITLIST(product_obj.matter) // For the purposes of the following tests not runtiming. + var/list/product_matter = list() + for(var/obj/product_obj in results) + product_matter = MERGE_ASSOCS_WITH_NUM_VALUES(product_matter, product_obj.get_contained_matter(include_reagents = FALSE)) if(!material && !reinforced) - if(length(product_obj.matter)) + if(length(product_matter)) failed += "unsupplied material types" - else if(material && (product_obj.matter[material.type]) > recipe.req_amount) - failed += "excessive base material ([recipe.req_amount]/[ceil(product_obj.matter[material.type])])" - else if(reinforced && (product_obj.matter[reinforced.type]) > recipe.req_amount) - failed += "excessive reinf material ([recipe.req_amount]/[ceil(product_obj.matter[reinforced.type])])" + else if(material && (product_matter[material.type]) > recipe.req_amount) + failed += "excessive base material ([recipe.req_amount]/[ceil(product_matter[material.type])])" + else if(reinforced && (product_matter[reinforced.type]) > recipe.req_amount) + failed += "excessive reinf material ([recipe.req_amount]/[ceil(product_matter[reinforced.type])])" else - for(var/mat in product_obj.matter) + for(var/mat in product_matter) if(mat != material?.type && mat != reinforced?.type) failed += "extra material type ([mat])" @@ -85,6 +104,8 @@ passed_designs += recipe if(!QDELETED(product)) qdel(product) + CHECK_TICK + CHECK_TICK if(failed_count) fail("[failed_count] crafting recipes had inconsistent output materials: [jointext(failed_designs, "\n")].") diff --git a/code/unit_tests/mob_tests.dm b/code/unit_tests/mob_tests.dm index a131d1ee7bdc..2a0cc80fdbb1 100644 --- a/code/unit_tests/mob_tests.dm +++ b/code/unit_tests/mob_tests.dm @@ -22,16 +22,22 @@ if(!isspaceturf(T)) //If the above isn't a space turf then we force it to find one will most likely pick 1,1,1 T = locate(/turf/space) - var/list/bodytype_pairings = get_bodytype_species_pairs() - for(var/decl/bodytype/bodytype in bodytype_pairings) - var/decl/species/species = bodytype_pairings[bodytype] - var/mob/living/human/test_subject = new(null, species.name, null, bodytype) + var/datum/mob_snapshot/dummy_appearance = new + for(var/decl/bodytype/bodytype in decls_repository.get_decls_of_subtype_unassociated(/decl/bodytype)) + var/decl/species/species = bodytype.get_user_species_for_validation() + if(!species) + continue + dummy_appearance.root_species = species + dummy_appearance.root_bodytype = bodytype + var/mob/living/human/test_subject = new(T, species.uid, dummy_appearance) if(test_subject.need_breathe()) test_subject.apply_effect(20, STUN, 0) var/obj/item/organ/internal/lungs/L = test_subject.get_organ(test_subject.get_bodytype().breathing_organ, /obj/item/organ/internal/lungs) if(L) L.last_successful_breath = -INFINITY test_subjects["[bodytype.type]"] = list(test_subject, damage_check(test_subject, OXY)) + QDEL_NULL(dummy_appearance) + return 1 /datum/unit_test/human_breath/check_result() @@ -65,7 +71,7 @@ test_result["msg"] = "Unable to find a location to create test mob" return test_result - var/mob/living/human/H = new mobtype(mobloc, SPECIES_HUMAN) // force human for testing + var/mob/living/human/H = new mobtype(mobloc, global.using_map.default_species) // force default species for testing H.mind_initialize("TestKey[rand(0,10000)]") @@ -276,8 +282,8 @@ /datum/unit_test/mob_nullspace/start_test() // Simply create one of each species type in nullspace - for(var/species_name in get_all_species()) - var/test_subject = new/mob/living/human(null, species_name) + for(var/decl/species/species as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/species)) + var/test_subject = new/mob/living/human(null, species.uid) test_subjects += test_subject return TRUE @@ -297,13 +303,24 @@ /datum/unit_test/mob_organ_size/start_test() var/failed = FALSE - for(var/species_name in get_all_species()) - var/mob/living/human/H = new(null, species_name) - for(var/obj/item/organ/external/E in H.get_external_organs()) - for(var/obj/item/organ/internal/I in E.internal_organs) - if(I.w_class > E.cavity_max_w_class) - failed = TRUE - log_bad("Internal organ [I] inside external organ [E] on species [species_name] was too large to fit.") + var/datum/mob_snapshot/dummy_appearance = new + for(var/decl/bodytype/bodytype in decls_repository.get_decls_of_subtype_unassociated(/decl/bodytype)) + var/decl/species/species = bodytype.get_user_species_for_validation() + if(!species) + continue + dummy_appearance.root_species = species + dummy_appearance.root_bodytype = bodytype + var/mob/living/human/test_subject = new(null, species.uid, dummy_appearance) + for(var/obj/item/organ/internal/organ in test_subject.get_internal_organs()) + var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(test_subject, organ.parent_organ) + if(!parent) + failed = TRUE + log_bad("Internal organ [organ] inside mob of species [species.type] lacked a parent organ (expected [organ.parent_organ])!") + continue + if(organ.w_class > parent.cavity_max_w_class) + failed = TRUE + log_bad("Internal organ [organ] inside external organ [parent] on species [species.type] was too large to fit.") + QDEL_NULL(dummy_appearance) if(failed) fail("A mob had an internal organ too large for its external organ.") else @@ -319,13 +336,14 @@ var/list/failures = list() for(var/moduletype in typesof(/obj/item/robot_module)) - var/obj/item/robot_module/mod = new + var/obj/item/robot_module/mod = new moduletype(reference_only = TRUE) // Reference copy only; have to do this to access lists. for(var/sprite in mod.module_sprites) var/check_icon = mod.module_sprites[sprite] if(!check_state_in_icon("world", check_icon)) failures += "[moduletype] ([sprite]): [check_icon] missing world sprite" if(!check_state_in_icon("world-eyes", check_icon)) failures += "[moduletype] ([sprite]): [check_icon] missing eyes sprite" + qdel(mod) if(length(failures)) fail("Some robot modules had invalid or missing icon_states:\n[jointext(failures, "\n")]") diff --git a/code/unit_tests/observation_tests.dm b/code/unit_tests/observation_tests.dm index 829bc7435764..b68e9fe6a0ae 100644 --- a/code/unit_tests/observation_tests.dm +++ b/code/unit_tests/observation_tests.dm @@ -7,29 +7,26 @@ abstract_type = /datum/unit_test/observation async = 0 var/list/received_moves - var/list/received_name_set_events - - var/list/stored_global_listen_count + var/list/received_opacity_events + /// A list of datums to check for event sanity pre- and post-test. + var/list/datums_of_interest + var/list/stored_global_registrations /datum/unit_test/observation/start_test() received_moves = received_moves || list() - received_name_set_events = received_name_set_events || list() + received_opacity_events = received_opacity_events || list() received_moves.Cut() - received_name_set_events.Cut() - - var/decl/observ/moved/moved_event = GET_DECL(/decl/observ/moved) - for(var/global_listener in moved_event.global_listeners) - events_repository.unregister_global(/decl/observ/moved, global_listener) + received_opacity_events.Cut() - stored_global_listen_count = global.global_listen_count.Copy() + stored_global_registrations = global._all_global_event_listeners.Copy() sanity_check_events("Pre-Test") . = conduct_test() sanity_check_events("Post-Test") + LAZYCLEARLIST(datums_of_interest) /datum/unit_test/observation/proc/sanity_check_events(var/phase) - for(var/entry in global.all_observable_events) - var/decl/observ/event = entry + for(var/decl/observ/event as anything in decls_repository.get_decls_of_subtype_unassociated(/decl/observ)) var/null_count = 0 for(var/null_candidate in event.global_listeners) if(isnull(event.global_listeners[null_candidate])) @@ -37,27 +34,21 @@ if(null_count > 0) fail("[phase]: [event] - The global listeners list contains a null entry.") - for(var/event_source in event.event_sources) - for(var/list/list_of_listeners in event.event_sources[event_source]) - if(isnull(list_of_listeners)) - fail("[phase]: [event] - The event source list contains a null entry.") - else if(!istype(list_of_listeners)) - fail("[phase]: [event] - The list of listeners was not of the expected type. Was [list_of_listeners.type].") - else - for(var/listener in list_of_listeners) - if(isnull(listener)) - fail("[phase]: [event] - The event source listener list contains a null entry.") - else - var/proc_calls = list_of_listeners[listener] - if(isnull(proc_calls)) - fail("[phase]: [event] - [listener] - The proc call list was null.") - else - for(var/proc_call in proc_calls) - if(isnull(proc_call)) - fail("[phase]: [event] - [listener]- The proc call list contains a null entry.") - - for(var/entry in (global.global_listen_count - stored_global_listen_count)) - fail("[phase]: global_listen_count - Contained [log_info_line(entry)].") + for(var/datum/datum_of_interest in datums_of_interest) + for(var/registered_event_type in datum_of_interest.event_listeners) + if(datum_of_interest.event_listeners[registered_event_type] && (null in datum_of_interest.event_listeners[registered_event_type])) + fail("[phase]: [registered_event_type] - [datum_of_interest]'s event_listeners list contains a null key.") + for(var/datum/listener in datum_of_interest.event_listeners[registered_event_type]) + var/proc_calls = datum_of_interest.event_listeners[registered_event_type][listener] + if(isnull(proc_calls)) + fail("[phase]: [registered_event_type] - [listener] - The proc call list was null.") + else if(null in proc_calls) + fail("[phase]: [registered_event_type] - [listener]- The proc call list contains a null entry.") + if(datum_of_interest._listening_to?[registered_event_type] && (null in datum_of_interest._listening_to[registered_event_type])) + fail("[phase]: [registered_event_type] - [datum_of_interest]'s _listening_to list contains a null value.") + + for(var/entry in (global._all_global_event_listeners - stored_global_registrations)) + fail("[phase]: _all_global_event_listeners - Contained [log_info_line(entry)].") /datum/unit_test/observation/proc/conduct_test() return 0 @@ -70,40 +61,39 @@ var/list/l = entry log_unit_test("[l[1]] - [l[2]] - [l[3]]") -/datum/unit_test/observation/proc/receive_name_change(source, old_name, new_name) - received_name_set_events[++received_name_set_events.len] = list(source, old_name, new_name) +/datum/unit_test/observation/proc/receive_opacity_change(source, old_opacity, new_opacity) + received_opacity_events[++received_opacity_events.len] = list(source, old_opacity, new_opacity) -/datum/unit_test/observation/proc/dump_received_names() - for(var/entry in received_name_set_events) +/datum/unit_test/observation/proc/dump_received_opacities() + for(var/entry in received_opacity_events) var/list/l = entry log_unit_test("[l[1]] - [l[2]] - [l[3]]") /datum/unit_test/observation/global_listeners_shall_receive_events name = "OBSERVATION: Global listeners shall receive events" - var/old_name - var/new_name + var/old_opacity + var/new_opacity /datum/unit_test/observation/global_listeners_shall_receive_events/conduct_test() var/turf/start = get_safe_turf() var/obj/O = get_named_instance(/obj, start) - old_name = O.name - new_name = O.name + " (New)" - - events_repository.register_global(/decl/observ/name_set, src, TYPE_PROC_REF(/datum/unit_test/observation, receive_name_change)) - O.SetName(new_name) - - if(received_name_set_events.len != 1) - fail("Expected 1 raised name set event, were [received_name_set_events.len].") - dump_received_names() + old_opacity = O.opacity + new_opacity = !old_opacity + + events_repository.register_global(/decl/observ/opacity_set, src, TYPE_PROC_REF(/datum/unit_test/observation, receive_opacity_change)) + O.set_opacity(new_opacity) + if(length(received_opacity_events) != 1) + fail("Expected 1 raised opacity set event, were [received_opacity_events].") + dump_received_opacities() return 1 - var/list/event = received_name_set_events[1] - if(event[1] != O || event[2] != old_name || event[3] != new_name) - fail("Unepected name set event received. Expected [O], was [event[1]]. Expected [old_name], was [event[2]]. Expected [new_name], was [event[3]]") + var/list/event = received_opacity_events[1] + if(event[1] != O || event[2] != old_opacity || event[3] != new_opacity) + fail("Unexpected opacity set event received. Expected [O], was [event[1]]. Expected [old_opacity], was [event[2]]. Expected [new_opacity], was [event[3]]") else - pass("Received the expected name set event.") + pass("Received the expected opacity set event.") - events_repository.unregister_global(/decl/observ/name_set, src) + events_repository.unregister_global(/decl/observ/opacity_set, src) qdel(O) return 1 @@ -115,6 +105,8 @@ var/mob/living/human/H = get_named_instance(/mob/living/human, T, global.using_map.default_species) var/mob/observer/ghost/O = get_named_instance(/mob/observer/ghost, T, "Ghost") + datums_of_interest = list(T, H, O) + O.ManualFollow(H) if(is_listening_to_movement(H, O)) pass("The observer is now following the mob.") @@ -132,6 +124,7 @@ var/turf/T = get_safe_turf() var/mob/living/human/H = get_named_instance(/mob/living/human, T, global.using_map.default_species) var/mob/observer/ghost/O = get_named_instance(/mob/observer/ghost, T, "Ghost") + datums_of_interest = list(T, H, O) O.ManualFollow(H) O.stop_following() @@ -150,6 +143,7 @@ /datum/unit_test/observation/moved_shall_not_register_on_enter_without_listeners/conduct_test() var/turf/T = get_safe_turf() var/mob/living/human/H = get_named_instance(/mob/living/human, T, global.using_map.default_species) + datums_of_interest = list(T, H) qdel(H.virtual_mob) H.virtual_mob = null @@ -173,6 +167,7 @@ var/mob/living/human/H = get_named_instance(/mob/living/human, T, global.using_map.default_species) var/obj/structure/closet/C = get_named_instance(/obj/structure/closet, T, "Closet") var/mob/observer/ghost/O = get_named_instance(/mob/observer/ghost, T, "Ghost") + datums_of_interest = list(T, H, C, O) H.forceMove(C) O.ManualFollow(H) @@ -196,6 +191,7 @@ var/mob/living/human/H = get_named_instance(/mob/living/human, T, global.using_map.default_species) var/obj/structure/closet/C = get_named_instance(/obj/structure/closet, T, "Closet") var/mob/observer/ghost/O = get_named_instance(/mob/observer/ghost, T, "Ghost") + datums_of_interest = list(T, H, C, O) O.ManualFollow(H) H.forceMove(C) @@ -220,6 +216,7 @@ var/mob/observer/ghost/one = get_named_instance(/mob/observer/ghost, T, "Ghost One") var/mob/observer/ghost/two = get_named_instance(/mob/observer/ghost, T, "Ghost Two") var/mob/observer/ghost/three = get_named_instance(/mob/observer/ghost, T, "Ghost Three") + datums_of_interest = list(T, one, two, three) two.ManualFollow(one) three.ManualFollow(two) @@ -244,6 +241,7 @@ var/mob/observer/ghost/one = get_named_instance(/mob/observer/ghost, T, "Ghost One") var/mob/observer/ghost/two = get_named_instance(/mob/observer/ghost, T, "Ghost Two") var/mob/observer/ghost/three = get_named_instance(/mob/observer/ghost, T, "Ghost Three") + datums_of_interest = list(T, one, two, three) two.ManualFollow(one) three.ManualFollow(two) @@ -266,20 +264,21 @@ /datum/unit_test/observation/sanity_global_listeners_shall_not_leave_null_entries_when_destroyed/conduct_test() var/turf/T = get_safe_turf() var/obj/O = get_named_instance(/obj, T) + datums_of_interest = list(T, O) - events_repository.register_global(/decl/observ/name_set, O, TYPE_PROC_REF(/atom/movable, move_to_turf)) + events_repository.register_global(/decl/observ/atom_examined, O, TYPE_PROC_REF(/atom/movable, move_to_turf)) qdel(O) - var/decl/observ/name_set/name_set_event = GET_DECL(/decl/observ/name_set) + var/decl/observ/atom_examined/examined_event = IMPLIED_DECL var/null_count = 0 - for(var/null_candidate in name_set_event.global_listeners) - if (isnull(name_set_event.event_sources[null_candidate])) + for(var/datum/null_candidate in examined_event.global_listeners) // skip null keys + if (isnull(examined_event.global_listeners[null_candidate])) null_count++ - if(null_count > 0) + if(null_count) fail("The global listener list contains a null value.") else pass("The global listener list does not contain a null value.") - if(name_set_event.global_listeners && (null in name_set_event.global_listeners)) + if(examined_event.global_listeners && (null in examined_event.global_listeners)) fail("The global listener list contains a null key.") else pass("The global listener list does not contain a null key.") @@ -296,21 +295,7 @@ events_repository.register(/decl/observ/moved, event_source, listener, TYPE_PROC_REF(/atom/movable, recursive_move)) qdel(event_source) - - var/decl/observ/moved/moved_event = GET_DECL(/decl/observ/moved) - var/null_count = 0 - for(var/null_candidate in moved_event.event_sources) - if (isnull(moved_event.event_sources[null_candidate])) - null_count++ - if(null_count > 0) - fail("The event source list contains a null value.") - else - pass("The event source list does not contain a null value.") - if(moved_event.event_sources && (null in moved_event.event_sources)) - fail("The event source list contains a null key.") - else - pass("The event source list does not contain a null key.") - + sanity_check_events("Post-Event Source Deletion") qdel(listener) return 1 @@ -321,24 +306,11 @@ var/turf/T = get_safe_turf() var/mob/event_source = get_named_instance(/mob, T, "Event Source") var/mob/listener = get_named_instance(/mob, T, "Event Listener") + datums_of_interest = list(T, event_source, listener) events_repository.register(/decl/observ/moved, event_source, listener, TYPE_PROC_REF(/atom/movable, recursive_move)) qdel(listener) - - var/decl/observ/moved/moved_event = GET_DECL(/decl/observ/moved) - var/listeners = moved_event.event_sources[event_source] - var/null_count = 0 - for(var/null_candidate in listeners) - if (isnull(listeners[null_candidate])) - null_count++ - if(null_count > 0) - fail("The event source listener list contains a null value.") - else - pass("The event source listener list does not contain a null value.") - if(listeners && (null in listeners)) - fail("The event source listener list contains a null key.") - else - pass("The event source listener list does not contain a null key.") + sanity_check_events("Post-Listener Deletion") qdel(event_source) return 1 @@ -349,6 +321,7 @@ var/turf/T = get_safe_turf() var/mob/event_source = get_named_instance(/mob, T, "Event Source") var/mob/listener = get_named_instance(/mob, T, "Event Listener") + datums_of_interest = list(T, event_source, listener) var/initial_event_source_count = event_source.event_source_count var/initial_event_listen_count = listener.event_listen_count @@ -373,6 +346,7 @@ var/turf/T = get_safe_turf() var/mob/event_source = get_named_instance(/mob, T, "Event Source") var/mob/listener = get_named_instance(/mob, T, "Event Listener") + datums_of_interest = list(T, event_source, listener) var/initial_event_source_count = event_source.event_source_count var/initial_event_listen_count = listener.event_listen_count @@ -399,6 +373,7 @@ var/mob/event_source_A = get_named_instance(/mob, T, "Event Source A") var/mob/event_source_B = get_named_instance(/mob, T, "Event Source B") var/mob/listener = get_named_instance(/mob, T, "Event Listener") + datums_of_interest = list(T, event_source_A, event_source_B, listener) var/initial_event_listen_count = listener.event_listen_count events_repository.register(/decl/observ/moved, event_source_A, listener, TYPE_PROC_REF(/atom/movable, recursive_move)) @@ -424,6 +399,7 @@ var/mob/event_source = get_named_instance(/mob, T, "Event Source") var/mob/listener_A = get_named_instance(/mob, T, "Event Listener A") var/mob/listener_B = get_named_instance(/mob, T, "Event Listener B") + datums_of_interest = list(T, event_source, listener_A, listener_B) var/initial_event_source_count = event_source.event_source_count var/initial_event_listen_count = listener_B.event_listen_count diff --git a/code/unit_tests/organ_tests.dm b/code/unit_tests/organ_tests.dm index 86d3406a5f30..72d20645b58b 100644 --- a/code/unit_tests/organ_tests.dm +++ b/code/unit_tests/organ_tests.dm @@ -27,23 +27,23 @@ for(var/organ_tag in bodytype.has_organ) var/obj/item/organ/I = GET_INTERNAL_ORGAN(H, organ_tag) if(!istype(I)) - fail("[bodytype.name] failed to register internal organ for tag \"[organ_tag]\" to organ list.") + fail("[bodytype.type] failed to register internal organ for tag \"[organ_tag]\" to organ list.") . = 0 continue if(!(I in H.get_internal_organs())) - fail("[bodytype.name] failed to register internal organ for tag \"[organ_tag]\" to internal_organs.") + fail("[bodytype.type] failed to register internal organ for tag \"[organ_tag]\" to internal_organs.") . = 0 continue var/req_type = bodytype.has_organ[organ_tag] if(!istype(I, req_type)) - fail("[bodytype.name] incorrect type of internal organ created for tag \"[organ_tag]\". Expected [req_type], found [I.type].") + fail("[bodytype.type] incorrect type of internal organ created for tag \"[organ_tag]\". Expected [req_type], found [I.type].") . = 0 continue if(I.organ_tag != organ_tag) - fail("[bodytype.name] internal organ tag mismatch. Registered as \"[organ_tag]\", actual tag was \"[I.organ_tag]\".") + fail("[bodytype.type] internal organ tag mismatch. Registered as \"[organ_tag]\", actual tag was \"[I.organ_tag]\".") . = 0 if(!isnum(I.absolute_max_damage) || I.absolute_max_damage <= 0) - fail("[bodytype.name] internal organ has invalid absolute_max_damage value ([I.absolute_max_damage]).") + fail("[bodytype.type] internal organ has invalid absolute_max_damage value ([I.absolute_max_damage]).") . = 0 /datum/unit_test/bodytype_organ_creation/proc/check_external_organs(var/mob/living/human/H, var/decl/bodytype/bodytype) @@ -51,24 +51,24 @@ for(var/organ_tag in bodytype.has_limbs) var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(H, organ_tag) if(!istype(E)) - fail("[bodytype.name] failed to register external organ for tag \"[organ_tag]\" to organs_by_name.") + fail("[bodytype.type] failed to register external organ for tag \"[organ_tag]\" to organs_by_name.") . = 0 continue if(!(E in H.get_external_organs())) - fail("[bodytype.name] failed to register external organ for tag \"[organ_tag]\" to organs.") + fail("[bodytype.type] failed to register external organ for tag \"[organ_tag]\" to organs.") . = 0 continue var/list/organ_data = bodytype.has_limbs[organ_tag] var/req_type = organ_data["path"] if(!istype(E, req_type)) - fail("[bodytype.name] incorrect type of external organ created for tag \"[organ_tag]\". Expected [req_type], found [E.type].") + fail("[bodytype.type] incorrect type of external organ created for tag \"[organ_tag]\". Expected [req_type], found [E.type].") . = 0 continue if(E.organ_tag != organ_tag) - fail("[bodytype.name] external organ tag mismatch. Registered as \"[organ_tag]\", actual tag was \"[E.organ_tag]\".") + fail("[bodytype.type] external organ tag mismatch. Registered as \"[organ_tag]\", actual tag was \"[E.organ_tag]\".") . = 0 if(!isnum(E.absolute_max_damage) || E.absolute_max_damage <= 0) - fail("[bodytype.name] external organ has invalid absolute_max_damage value ([E.absolute_max_damage]).") + fail("[bodytype.type] external organ has invalid absolute_max_damage value ([E.absolute_max_damage]).") . = 0 /datum/unit_test/bodytype_organ_creation/proc/check_organ_parents(var/mob/living/human/H, var/decl/bodytype/bodytype) @@ -79,47 +79,51 @@ continue var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(H, E.parent_organ) if(!istype(parent)) - fail("[bodytype.name] external organ [E] could not find its parent in organs_by_name. Parent tag was \"[E.parent_organ]\".") + fail("[bodytype.type] external organ [E] could not find its parent in organs_by_name. Parent tag was \"[E.parent_organ]\".") . = 0 continue if(!(parent in external_organs)) - fail("[bodytype.name] external organ [E] could not find its parent in organs. Parent was [parent](parent.type). Parent tag was \"[E.parent_organ]\".") + fail("[bodytype.type] external organ [E] could not find its parent in organs. Parent was [parent](parent.type). Parent tag was \"[E.parent_organ]\".") . = 0 continue if(E.parent != parent) - fail("[bodytype.name] external organ [E] parent mismatch. Parent reference was [E.parent] with tag \"[E.parent? E.parent.organ_tag : "N/A"]\". Parent was [parent](parent.type). Parent tag was \"[E.parent_organ]\".") + fail("[bodytype.type] external organ [E] parent mismatch. Parent reference was [E.parent] with tag \"[E.parent? E.parent.organ_tag : "N/A"]\". Parent was [parent](parent.type). Parent tag was \"[E.parent_organ]\".") . = 0 continue if(!(E in parent.children)) - fail("[bodytype.name] external organ [E] was not found in parent's children. Parent was [parent]. Parent tag was \"[E.parent_organ]\".") + fail("[bodytype.type] external organ [E] was not found in parent's children. Parent was [parent]. Parent tag was \"[E.parent_organ]\".") . = 0 continue for(var/obj/item/organ/internal/I in H.get_internal_organs()) if(!I.parent_organ) - fail("[bodytype.name] internal organ [I] did not have a parent_organ tag.") + fail("[bodytype.type] internal organ [I] did not have a parent_organ tag.") . = 0 continue var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(H, I.parent_organ) if(!istype(parent)) - fail("[bodytype.name] internal organ [I] could not find its parent in organs_by_name. Parent tag was \"[I.parent_organ]\".") + fail("[bodytype.type] internal organ [I] could not find its parent in organs_by_name. Parent tag was \"[I.parent_organ]\".") . = 0 continue if(!(parent in external_organs)) - fail("[bodytype.name] internal organ [I] could not find its parent in organs. Parent was [parent]. Parent tag was \"[I.parent_organ]\".") + fail("[bodytype.type] internal organ [I] could not find its parent in organs. Parent was [parent]. Parent tag was \"[I.parent_organ]\".") . = 0 continue if(!(I in parent.internal_organs)) - fail("[bodytype.name] internal organ [I] was not found in parent's internal_organs. Parent was [parent]. Parent tag was \"[I.parent_organ]\".") + fail("[bodytype.type] internal organ [I] was not found in parent's internal_organs. Parent was [parent]. Parent tag was \"[I.parent_organ]\".") . = 0 continue /datum/unit_test/bodytype_organ_creation/start_test() var/failcount = 0 - var/list/bodytype_pairings = get_bodytype_species_pairs() - for(var/decl/bodytype/bodytype in bodytype_pairings) - var/decl/species/species = bodytype_pairings[bodytype] - var/mob/living/human/test_subject = new(null, species.name, null, bodytype) + var/datum/mob_snapshot/dummy_appearance = new + for(var/decl/bodytype/bodytype in decls_repository.get_decls_of_subtype_unassociated(/decl/bodytype)) + var/decl/species/species = bodytype.get_user_species_for_validation() + if(!species) + continue + dummy_appearance.root_species = species + dummy_appearance.root_bodytype = bodytype + var/mob/living/human/test_subject = new(null, species.uid, dummy_appearance) var/fail = 0 fail |= !check_internal_organs(test_subject, bodytype) @@ -127,6 +131,7 @@ fail |= !check_organ_parents(test_subject, bodytype) if(fail) failcount++ + QDEL_NULL(dummy_appearance) if(failcount) fail("[failcount] bodytypes were created with invalid organ configuration.") @@ -141,88 +146,87 @@ /datum/unit_test/bodytype_organ_lists_update/proc/check_internal_organ_present(var/mob/living/human/H, var/obj/item/organ/internal/I) var/decl/bodytype/root_bodytype = H.get_bodytype() if(!(I in H.get_internal_organs())) - fail("[root_bodytype.name] internal organ [I] not in internal_organs.") + fail("[root_bodytype.type] internal organ [I] not in internal_organs.") return 0 var/found = GET_INTERNAL_ORGAN(H, I.organ_tag) if(I != found) - fail("[root_bodytype.name] internal organ [I] not in organ list. Organ tag was \"[I.organ_tag]\", found [found? found : "nothing"] instead.") + fail("[root_bodytype.type] internal organ [I] not in organ list. Organ tag was \"[I.organ_tag]\", found [found? found : "nothing"] instead.") return 0 var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(H, I.parent_organ) if(!istype(parent)) - fail("[root_bodytype.name] internal organ [I] could not find its parent in organs_by_name. Parent tag was \"[I.parent_organ]\".") + fail("[root_bodytype.type] internal organ [I] could not find its parent in organs_by_name. Parent tag was \"[I.parent_organ]\".") return 0 if(!(I in parent.internal_organs)) - fail("[root_bodytype.name] internal organ [I] was not in parent's internal_organs. Parent was [parent]. Parent tag was \"[I.parent_organ]\".") + fail("[root_bodytype.type] internal organ [I] was not in parent's internal_organs. Parent was [parent]. Parent tag was \"[I.parent_organ]\".") return 0 return 1 /datum/unit_test/bodytype_organ_lists_update/proc/check_internal_organ_removed(var/mob/living/human/H, var/obj/item/organ/internal/I, var/obj/item/organ/external/old_parent) var/decl/bodytype/root_bodytype = H.get_bodytype() if(I in H.get_internal_organs()) - fail("[root_bodytype.name] internal organ [I] was not removed from internal_organs.") + fail("[root_bodytype.type] internal organ [I] was not removed from internal_organs.") return 0 var/found = GET_INTERNAL_ORGAN(H, I.organ_tag) if(found) - fail("[root_bodytype.name] internal organ [I] was not removed from organ list. Organ tag was \"[I.organ_tag]\".") + fail("[root_bodytype.type] internal organ [I] was not removed from organ list. Organ tag was \"[I.organ_tag]\".") return 0 if(I in old_parent.internal_organs) - fail("[root_bodytype.name] internal organ [I] was not removed from parent's internal_organs. Parent was [old_parent].") + fail("[root_bodytype.type] internal organ [I] was not removed from parent's internal_organs. Parent was [old_parent].") return 0 return 1 /datum/unit_test/bodytype_organ_lists_update/proc/check_external_organ_present(var/mob/living/human/H, var/obj/item/organ/external/E) var/decl/bodytype/root_bodytype = H.get_bodytype() if(!(E in H.get_external_organs())) - fail("[root_bodytype.name] external organ [E] not in organs.") + fail("[root_bodytype.type] external organ [E] not in organs.") return 0 var/found = GET_EXTERNAL_ORGAN(H, E.organ_tag) if(E != found) - fail("[root_bodytype.name] external organ [E] not in organ list. Organ tag was \"[E.organ_tag]\", found [found? found : "nothing"] instead.") + fail("[root_bodytype.type] external organ [E] not in organ list. Organ tag was \"[E.organ_tag]\", found [found? found : "nothing"] instead.") return 0 if(E.parent_organ) var/obj/item/organ/external/parent = E.parent if(!istype(parent)) - fail("[root_bodytype.name] external organ [E] had no parent. Parent tag was \"[E.parent_organ]\".") + fail("[root_bodytype.type] external organ [E] had no parent. Parent tag was \"[E.parent_organ]\".") return 0 if(parent.organ_tag != E.parent_organ) - fail("[root_bodytype.name] external organ [E] parent tag mismatch. Parent tag was \"[E.parent_organ]\", actual tag was \"[parent.organ_tag]\".") + fail("[root_bodytype.type] external organ [E] parent tag mismatch. Parent tag was \"[E.parent_organ]\", actual tag was \"[parent.organ_tag]\".") return 0 if(!(E in parent.children)) - fail("[root_bodytype.name] external organ [E] was not in parent's children. Parent was [parent]. Parent tag was \"[E.parent_organ]\".") + fail("[root_bodytype.type] external organ [E] was not in parent's children. Parent was [parent]. Parent tag was \"[E.parent_organ]\".") return 0 return 1 /datum/unit_test/bodytype_organ_lists_update/proc/check_external_organ_removed(var/mob/living/human/H, var/obj/item/organ/external/E, var/obj/item/organ/external/old_parent = null) var/decl/bodytype/root_bodytype = H.get_bodytype() if(E in H.get_external_organs()) - fail("[root_bodytype.name] external organ [E] was not removed from organs.") + fail("[root_bodytype.type] external organ [E] was not removed from organs.") return 0 var/found = GET_EXTERNAL_ORGAN(H, E.organ_tag) if(found) - fail("[root_bodytype.name] external organ [E] was not removed from organs_by_name. Organ tag was \"[E.organ_tag]\".") + fail("[root_bodytype.type] external organ [E] was not removed from organs_by_name. Organ tag was \"[E.organ_tag]\".") + return 0 + if(old_parent && (E in old_parent.children)) + fail("[root_bodytype.type] external organ [E] was not removed from parent's children. Parent was [old_parent].") return 0 - if(old_parent) - if(!(E in old_parent.children)) - fail("[root_bodytype.name] external organ [E] was not removed from parent's children. Parent was [old_parent].") - return 0 return 1 /datum/unit_test/bodytype_organ_lists_update/proc/test_internal_organ(var/mob/living/human/H, var/obj/item/organ/internal/I) var/decl/bodytype/root_bodytype = H.get_bodytype() if(!check_internal_organ_present(H, I)) - fail("[root_bodytype.name] internal organ [I] failed initial presence check.") + fail("[root_bodytype.type] internal organ [I] failed initial presence check.") return 0 var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(H, I.parent_organ) H.remove_organ(I) if(!check_internal_organ_removed(H, I, parent)) - fail("[root_bodytype.name] internal organ [I] was not removed correctly.") + fail("[root_bodytype.type] internal organ [I] was not removed correctly.") return 0 H.add_organ(I, parent) if(!check_internal_organ_present(H, I)) - fail("[root_bodytype.name] internal organ [I] was not replaced correctly.") + fail("[root_bodytype.type] internal organ [I] was not replaced correctly.") return 0 return 1 @@ -230,37 +234,48 @@ /datum/unit_test/bodytype_organ_lists_update/proc/test_external_organ(var/mob/living/human/H, var/obj/item/organ/external/E) var/decl/bodytype/root_bodytype = H.get_bodytype() if(!check_external_organ_present(H, E)) - fail("[root_bodytype.name] external organ [E] failed initial presence check.") + fail("[root_bodytype.type] external organ [E] failed initial presence check.") return 0 var/obj/item/organ/external/parent = E.parent - H.remove_organ(E) + H.remove_organ(E, drop_organ = FALSE, ignore_children = TRUE) if(!check_external_organ_removed(H, E, parent)) - fail("[root_bodytype.name] external organ [E] was not removed correctly.") + fail("[root_bodytype.type] external organ [E] was not removed correctly.") return 0 H.add_organ(E) - if(!check_external_organ_removed(H, E)) - fail("[root_bodytype.name] external organ [E] was not replaced correctly.") + if(!check_external_organ_present(H, E)) + fail("[root_bodytype.type] external organ [E] was not replaced correctly.") return 0 return 1 /datum/unit_test/bodytype_organ_lists_update/start_test() var/failcount = 0 - var/list/bodytype_pairings = get_bodytype_species_pairs() - for(var/decl/bodytype/bodytype in bodytype_pairings) - var/decl/species/species = bodytype_pairings[bodytype] - var/mob/living/human/test_subject = new(null, species.name, null, bodytype) + var/datum/mob_snapshot/dummy_appearance = new + for(var/decl/bodytype/bodytype in decls_repository.get_decls_of_subtype_unassociated(/decl/bodytype)) + var/decl/species/species = bodytype.get_user_species_for_validation() + if(!species) + continue + dummy_appearance.root_species = species + dummy_appearance.root_bodytype = bodytype + var/mob/living/human/test_subject = new(null, species.uid, dummy_appearance) for(var/O in test_subject.get_internal_organs()) if(!test_internal_organ(test_subject, O)) failcount++ - for(var/O in test_subject.get_external_organs()) - if(!test_external_organ(test_subject, O)) + var/list/external_organs_by_depth = list() + for(var/obj/item/organ/external/external_organ in test_subject.get_external_organs()) + external_organs_by_depth[external_organ] = bodytype.has_limbs?[external_organ.organ_tag]?["has_children"] || 0 + // sort from least to most children, so 0-child organs are first, then 1, then 2, etc. + external_organs_by_depth = sortTim(external_organs_by_depth, /proc/cmp_numeric_asc, TRUE) + // test from leaf nodes towards root nodes, because this can be destructive if we remove an organ with children + for(var/obj/item/organ/external/external_organ in external_organs_by_depth) + if(!test_external_organ(test_subject, external_organ)) failcount++ + QDEL_NULL(dummy_appearance) if(failcount) fail("[failcount] organs failed to be removed and replaced correctly.") diff --git a/code/unit_tests/override_tests.dm b/code/unit_tests/override_tests.dm index 4687b0c72aaa..ea030be4a20c 100644 --- a/code/unit_tests/override_tests.dm +++ b/code/unit_tests/override_tests.dm @@ -43,16 +43,16 @@ name = "OVERRIDE: /datum/atom_creator/weighted shall spawn heaviest" /datum/unit_test/override/atom_creator_weighted_shall_spawn_heaviest/start_test() - var/datum/atom_creator/weighted/W = new/datum/atom_creator/weighted(list(/obj/unit_test_light = 9001, /obj/unit_test_heavy = 1)) + var/datum/atom_creator/weighted/weighted_creator = new/datum/atom_creator/weighted(list(/obj/unit_test_light = 9001, /obj/unit_test_heavy = 1)) var/safe_turf = get_safe_turf() - W.create(safe_turf) + weighted_creator.create(safe_turf) var/created_object = locate(/obj/unit_test_heavy) in safe_turf if(created_object) - pass("[log_info_line(W)] successfully created the heaviest object.") + pass("[log_info_line(weighted_creator)] successfully created the heaviest object.") qdel(created_object) else - fail("[log_info_line(W)] failed to create its heaviest object.") + fail("[log_info_line(weighted_creator)] failed to create its heaviest object.") return 1 @@ -60,7 +60,7 @@ name = "OVERRIDE: /datum/atom_creator/weighted shall spawn heaviest - Recursive" /datum/unit_test/override/atom_creator_weighted_shall_spawn_heaviest_recursive/start_test() - var/datum/atom_creator/weighted/W = new/datum/atom_creator/weighted( + var/datum/atom_creator/weighted/weighted_creator = new/datum/atom_creator/weighted( list( new/datum/atom_creator/weighted(list(/obj/unit_test_light = 9001, /obj/unit_test_heavy = 1)), new/datum/atom_creator/simple(/obj/unit_test_medium, 50) @@ -68,12 +68,12 @@ ) var/safe_turf = get_safe_turf() - W.create(safe_turf) + weighted_creator.create(safe_turf) var/created_object = locate(/obj/unit_test_heavy) in safe_turf if(created_object) - pass("[log_info_line(W)] successfully created the heaviest object.") + pass("[log_info_line(weighted_creator)] successfully created the heaviest object.") qdel(created_object) else - fail("[log_info_line(W)] failed to create its heaviest object.") + fail("[log_info_line(weighted_creator)] failed to create its heaviest object.") return 1 diff --git a/code/unit_tests/power_tests.dm b/code/unit_tests/power_tests.dm index 8715e17efd54..16df5f3e9d90 100644 --- a/code/unit_tests/power_tests.dm +++ b/code/unit_tests/power_tests.dm @@ -21,7 +21,7 @@ var/failed = 0 var/list/found_cables = list() - for(var/obj/structure/cable/C in global.cable_list) + for(var/obj/structure/cable/C in global.all_cables) if(C in found_cables) continue var/list/to_search = list(C) diff --git a/code/unit_tests/traders.dm b/code/unit_tests/traders.dm index e05559885302..fda00e9c246b 100644 --- a/code/unit_tests/traders.dm +++ b/code/unit_tests/traders.dm @@ -45,7 +45,7 @@ var/list/all_species = decls_repository.get_decls_of_subtype(/decl/species) for(var/species_type in all_species) var/decl/species/species = all_species[species_type] - acceptable_additional_tokens |= "[TRADER_HAIL_START][species.name]" + acceptable_additional_tokens |= "[TRADER_HAIL_START][species.uid]" var/list/failures = list() for(var/trader_type in subtypesof(/datum/trader)) diff --git a/code/unit_tests/unit_test.dm b/code/unit_tests/unit_test.dm index 24fd800c8544..82a186cb0d1c 100644 --- a/code/unit_tests/unit_test.dm +++ b/code/unit_tests/unit_test.dm @@ -136,7 +136,7 @@ var/global/ascii_reset = "[ascii_esc]\[0m" /datum/unit_test/proc/get_safe_turf() check_cleanup = TRUE if(!safe_landmark) - for(var/landmark in global.landmarks_list) + for(var/landmark in global.all_landmarks) if(istype(landmark, /obj/abstract/landmark/test/safe_turf)) safe_landmark = landmark break @@ -145,7 +145,7 @@ var/global/ascii_reset = "[ascii_esc]\[0m" /datum/unit_test/proc/get_space_turf() check_cleanup = TRUE if(!space_landmark) - for(var/landmark in global.landmarks_list) + for(var/landmark in global.all_landmarks) if(istype(landmark, /obj/abstract/landmark/test/space_turf)) space_landmark = landmark break @@ -211,8 +211,8 @@ var/global/ascii_reset = "[ascii_esc]\[0m" if(!check_rights(R_DEBUG)) return - log_and_message_admins("has started the unit test '[initial(unit_test_type.name)]'") var/datum/unit_test/test = new unit_test_type + log_and_message_admins("has started the unit test '[test.name]'") var/end_unit_tests = world.time + MAX_UNIT_TEST_RUN_TIME do_unit_test(test, end_unit_tests, FALSE) if(test.async) diff --git a/code/unit_tests/uplink_tests.dm b/code/unit_tests/uplink_tests.dm index c21cedc86174..7599f1ccd115 100644 --- a/code/unit_tests/uplink_tests.dm +++ b/code/unit_tests/uplink_tests.dm @@ -2,6 +2,7 @@ name = "UPLINK: All uplink items shall be valid." /datum/unit_test/uplink_setup_test/start_test() + var/decl/uplink/uplink = IMPLIED_DECL var/success = TRUE for(var/item in uplink.items) diff --git a/code/unit_tests/view_variables_test.dm b/code/unit_tests/view_variables_test.dm index 8bd641566b9d..ed92a6cceb63 100644 --- a/code/unit_tests/view_variables_test.dm +++ b/code/unit_tests/view_variables_test.dm @@ -5,20 +5,20 @@ var/list/faulty_handlers = list() var/list/vv_set_handlers = decls_repository.get_decls_of_subtype(/decl/vv_set_handler) for(var/vv_handler in vv_set_handlers) - var/decl/vv_set_handler/sh = vv_set_handlers[vv_handler] - if(!ispath(sh.handled_type)) - log_bad("[sh] does not have a valid handled type. Expected a path, was [log_info_line(sh.handled_type)]") - faulty_handlers |= sh - if(!islist(sh.handled_vars)) - log_bad("[sh] does not have a handled variables list. Expected a list, was [log_info_line(sh.handled_vars)]") - faulty_handlers |= sh - else if(!sh.handled_vars.len) - log_bad("[sh] as an empty handled variables list.") - faulty_handlers |= sh + var/decl/vv_set_handler/set_handler = vv_set_handlers[vv_handler] + if(!ispath(set_handler.handled_type)) + log_bad("[set_handler] does not have a valid handled type. Expected a path, was [log_info_line(set_handler.handled_type)]") + faulty_handlers |= set_handler + if(!islist(set_handler.handled_vars)) + log_bad("[set_handler] does not have a handled variables list. Expected a list, was [log_info_line(set_handler.handled_vars)]") + faulty_handlers |= set_handler + else if(!set_handler.handled_vars.len) + log_bad("[set_handler] as an empty handled variables list.") + faulty_handlers |= set_handler else continue // Somehow check for missing vars here without creating instances. - // I.e.: for(var/handled_var in sh.handled_vars) check handled_var in handled_type.vars + // I.e.: for(var/handled_var in set_handler.handled_vars) check handled_var in handled_type.vars if(faulty_handlers.len) fail("The following special VV handlers are invalid: [english_list(faulty_handlers)]") diff --git a/html/changelog.html b/html/changelog.html index e8361317d54b..02e47675ee10 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -52,81 +52,21 @@ -->
    -

    07 February 2025

    -

    Penelope Haze updated:

    +

    29 August 2025

    +

    Elizabeth updated:

      -
    • Shears are now used to add or remove padding from objects. Wirecutters still work as a backup, though.
    • +
    • added some variant sprites for cobblestone and running bond paths
    -

    02 February 2025

    -

    Penelope Haze updated:

    +

    22 August 2025

    +

    Sutures updated:

      -
    • Modified liquid and coating presentation to be more fancy.
    • -
    - -

    29 January 2025

    -

    MistakeNot4892 updated:

    -
      -
    • Various map changes to Bearcat, crashed pod, and several others. Please report issues!
    • -
    - -

    22 January 2025

    -

    MistakeNot4892 updated:

    -
      -
    • Swords on Shaded Hills can be sharpened using whetstones or grindstones.
    • -
    • Guns can now be fired from rigs regardless of dexterity.
    • -
    - -

    21 January 2025

    -

    Penelope Haze updated:

    -
      -
    • Mud can now receive footprints with any reagent other than mud. No more conspicuously missing bloody footprints!
    • -
    - -

    19 January 2025

    -

    MistakeNot4892 updated:

    -
      -
    • Intents have been rewritten and moved, please report any issues with intent selection.
    • -
    - -

    16 January 2025

    -

    MistakeNot4892 updated:

    -
      -
    • The White and Minimalist HUD styles can now be customised to use a specific overlay color.
    • -
    • The Shaded Hills river now flows north.
    • -
    • Snow, mud and sand will now show footprints.
    • -
    - -

    15 January 2025

    -

    MistakeNot4892 updated:

    -
      -
    • The way you interact with barrels and well has been significantly reworked; clicking with a bucket or tool should give a list of options to pick from. Please report bugs with this on the tracker.
    • -
    - -

    08 January 2025

    -

    MistakeNot4892 updated:

    -
      -
    • Mud and blood can now leave footprints.
    • -
    - -

    03 January 2025

    -

    MistakeNot4892 updated:

    -
      -
    • Raw plant oil no longer works as lantern fuel; it must be mixed with powdered graphite first.
    • -
    - -

    23 December 2024

    -

    ophelia v0.8 updated:

    -
      -
    • added new dirt and mud tile sprites
    • -
    • added new wooden chest sprites, by Doe
    • -
    • mud and soil plots are now properly greyscaled to soil material color
    • -
    - -

    21 December 2024

    -

    Penelope Haze updated:

    -
      -
    • Makes weather effects slightly more transparent.
    • +
    • added new amanita mushroom plant growth states
    • +
    • changed coffee plant growth states
    • +
    • added ambience to Shaded Hills river and swamp areas
    • +
    • ambience should be louder and more frequent overall
    • +
    • stone walls now have a slight noise effect on their sprite
    • +
    • added a boiling-water sound to cooking pots on Shaded Hills
    diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml index 07cfc97b702b..2435270b0b05 100644 --- a/html/changelogs/.all_changelog.yml +++ b/html/changelogs/.all_changelog.yml @@ -14982,3 +14982,62 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py. Penelope Haze: - tweak: Shears are now used to add or remove padding from objects. Wirecutters still work as a backup, though. +2025-02-18: + MistakeNot4892: + - tweak: Modifiers like regeneration or personal shielding will now show at the + top of the screen. +2025-02-24: + Penelope Haze: + - tweak: Human and unathi sprites should be slightly brighter now. +2025-03-02: + MistakeNot4892: + - tweak: Old browser-based module selection for robots has been removed, use the + INV button to open storage like you would a belt/backpack. +2025-03-09: + Cerebulon: + - imageadd: New icons for a variety of objects, mostly machines and grenades. +2025-03-12: + Cerebulon: + - imageadd: Changed modpack Tajara to use old-style humanoid sprites instead of + a unique feline body shape which has since been used by Hnolls. +2025-03-14: + Typhin: + - bugfix: Allows parts/screwdrivers to be used on biogenerators +2025-03-25: + Penelope Haze: + - balance: Adjusts how suffocation works, meaning characters who were drowning or + in asystole start breathing as soon as the issue is resolved, rather than counting + down a timer instead. This might make brief bouts of drowning/cardiac arrest + more survivable. Please report any weirdness with breathing/suffocation on the + issue tracker. +2025-03-27: + Martin Rivard: + - tweak: removed calculate_affecting_pressure() hardcoding +2025-03-29: + Martin Rivard: + - bugfix: fixed portable flasher sprite offset +2025-04-06: + Elizabeth: + - tweak: tweaked the Forester's Hut on Shaded Hills to be more compact and have + timber-framed walls + - tweak: tweaked the inn backroom on Shaded Hills + - tweak: many of the buildings in Shaded Hills now use timber-framed, plastered, + and/or wattle-and-daub walls instead of just log walls + - soundadd: 'added a new lobby track to Shaded Hills: Adventure by Alexander Nakarada.' +2025-04-13: + Cerebulon: + - bugfix: Fixed tajaran sprite sheet overrides. +2025-04-14: + Zandario: + - admin: Added a "Toggle Browser Inspect" debug verb for debugging UIs +2025-08-22: + Sutures: + - imageadd: added new amanita mushroom plant growth states + - tweak: changed coffee plant growth states + - soundadd: added ambience to Shaded Hills river and swamp areas + - tweak: ambience should be louder and more frequent overall + - tweak: stone walls now have a slight noise effect on their sprite + - soundadd: added a boiling-water sound to cooking pots on Shaded Hills +2025-08-29: + Elizabeth: + - imageadd: added some variant sprites for cobblestone and running bond paths diff --git a/icons/clothing/accessories/permits.dmi b/icons/clothing/accessories/permits.dmi new file mode 100644 index 000000000000..25ee8e450845 Binary files /dev/null and b/icons/clothing/accessories/permits.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_atmos.dmi b/icons/clothing/jumpsuits/jumpsuit_atmos.dmi index 3d5217e8b2e7..c875b073bd17 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_atmos.dmi and b/icons/clothing/jumpsuits/jumpsuit_atmos.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_captain.dmi b/icons/clothing/jumpsuits/jumpsuit_captain.dmi index c21ff4d7bcbc..c0099fba885b 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_captain.dmi and b/icons/clothing/jumpsuits/jumpsuit_captain.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_cargo.dmi b/icons/clothing/jumpsuits/jumpsuit_cargo.dmi index 83e2d5c74095..278b871f3a12 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_cargo.dmi and b/icons/clothing/jumpsuits/jumpsuit_cargo.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_ce.dmi b/icons/clothing/jumpsuits/jumpsuit_ce.dmi index d1b0c535638d..66444d604cb0 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_ce.dmi and b/icons/clothing/jumpsuits/jumpsuit_ce.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_chaplain.dmi b/icons/clothing/jumpsuits/jumpsuit_chaplain.dmi index d606563bc88c..3e8769c98df8 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_chaplain.dmi and b/icons/clothing/jumpsuits/jumpsuit_chaplain.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_chemist.dmi b/icons/clothing/jumpsuits/jumpsuit_chemist.dmi index 8d6ab66eda23..b020cd862b0c 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_chemist.dmi and b/icons/clothing/jumpsuits/jumpsuit_chemist.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_cmo.dmi b/icons/clothing/jumpsuits/jumpsuit_cmo.dmi index 432273d5689d..ade2910cecef 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_cmo.dmi and b/icons/clothing/jumpsuits/jumpsuit_cmo.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_engineer.dmi b/icons/clothing/jumpsuits/jumpsuit_engineer.dmi index a944a9746d3a..02999b489c38 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_engineer.dmi and b/icons/clothing/jumpsuits/jumpsuit_engineer.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_genetics.dmi b/icons/clothing/jumpsuits/jumpsuit_genetics.dmi index b348213ecfcd..3c401fc77769 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_genetics.dmi and b/icons/clothing/jumpsuits/jumpsuit_genetics.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_hazard.dmi b/icons/clothing/jumpsuits/jumpsuit_hazard.dmi index 08c2522ff7c1..be1f5468a077 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_hazard.dmi and b/icons/clothing/jumpsuits/jumpsuit_hazard.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_hop.dmi b/icons/clothing/jumpsuits/jumpsuit_hop.dmi index d6f1c360f5fe..61380b57b148 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_hop.dmi and b/icons/clothing/jumpsuits/jumpsuit_hop.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_hos.dmi b/icons/clothing/jumpsuits/jumpsuit_hos.dmi index e3e0f1e2f752..468cc979a85c 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_hos.dmi and b/icons/clothing/jumpsuits/jumpsuit_hos.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_hos_alt.dmi b/icons/clothing/jumpsuits/jumpsuit_hos_alt.dmi index 9057fbea3e38..a7ee171acbb5 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_hos_alt.dmi and b/icons/clothing/jumpsuits/jumpsuit_hos_alt.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_hydroponics.dmi b/icons/clothing/jumpsuits/jumpsuit_hydroponics.dmi index cd06cdc3dbbd..25f328ae0798 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_hydroponics.dmi and b/icons/clothing/jumpsuits/jumpsuit_hydroponics.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_janitor.dmi b/icons/clothing/jumpsuits/jumpsuit_janitor.dmi index 596f8161bfc5..8d9257cc96ba 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_janitor.dmi and b/icons/clothing/jumpsuits/jumpsuit_janitor.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_johnny.dmi b/icons/clothing/jumpsuits/jumpsuit_johnny.dmi deleted file mode 100644 index c57a40a57fcc..000000000000 Binary files a/icons/clothing/jumpsuits/jumpsuit_johnny.dmi and /dev/null differ diff --git a/icons/clothing/jumpsuits/jumpsuit_medical.dmi b/icons/clothing/jumpsuits/jumpsuit_medical.dmi index 549c5071f156..47edde803153 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_medical.dmi and b/icons/clothing/jumpsuits/jumpsuit_medical.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_miner.dmi b/icons/clothing/jumpsuits/jumpsuit_miner.dmi index 3a9a06b40d12..c93ee14a40fd 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_miner.dmi and b/icons/clothing/jumpsuits/jumpsuit_miner.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_prisoner.dmi b/icons/clothing/jumpsuits/jumpsuit_prisoner.dmi index 20848b0b82ec..26ea1aef0143 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_prisoner.dmi and b/icons/clothing/jumpsuits/jumpsuit_prisoner.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_psych.dmi b/icons/clothing/jumpsuits/jumpsuit_psych.dmi index 2b9a5e07f131..e140cd2f684a 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_psych.dmi and b/icons/clothing/jumpsuits/jumpsuit_psych.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_qm.dmi b/icons/clothing/jumpsuits/jumpsuit_qm.dmi index d8cc0d6eb6a5..1ff46f49e5f6 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_qm.dmi and b/icons/clothing/jumpsuits/jumpsuit_qm.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_rainbow.dmi b/icons/clothing/jumpsuits/jumpsuit_rainbow.dmi index b64bae0a0dcd..170534cbc62f 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_rainbow.dmi and b/icons/clothing/jumpsuits/jumpsuit_rainbow.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_rd.dmi b/icons/clothing/jumpsuits/jumpsuit_rd.dmi index b4b2d6194bf6..192d998ad8d2 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_rd.dmi and b/icons/clothing/jumpsuits/jumpsuit_rd.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_robotics.dmi b/icons/clothing/jumpsuits/jumpsuit_robotics.dmi index e1083edf339e..ff89c3e05de1 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_robotics.dmi and b/icons/clothing/jumpsuits/jumpsuit_robotics.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_sec.dmi b/icons/clothing/jumpsuits/jumpsuit_sec.dmi index 69c8bee20f7b..26e66b428a5f 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_sec.dmi and b/icons/clothing/jumpsuits/jumpsuit_sec.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_shorts.dmi b/icons/clothing/jumpsuits/jumpsuit_shorts.dmi index 00530b3f19d7..8025567b7f85 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_shorts.dmi and b/icons/clothing/jumpsuits/jumpsuit_shorts.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_sterile.dmi b/icons/clothing/jumpsuits/jumpsuit_sterile.dmi index 0d770cf251e4..9b06e63d3376 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_sterile.dmi and b/icons/clothing/jumpsuits/jumpsuit_sterile.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_virology.dmi b/icons/clothing/jumpsuits/jumpsuit_virology.dmi index b4b2d6194bf6..192d998ad8d2 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_virology.dmi and b/icons/clothing/jumpsuits/jumpsuit_virology.dmi differ diff --git a/icons/clothing/jumpsuits/jumpsuit_warden.dmi b/icons/clothing/jumpsuits/jumpsuit_warden.dmi index 8eea4464c555..44d32edbfffc 100644 Binary files a/icons/clothing/jumpsuits/jumpsuit_warden.dmi and b/icons/clothing/jumpsuits/jumpsuit_warden.dmi differ diff --git a/icons/clothing/jumpsuits/uniform_quantum.dmi b/icons/clothing/jumpsuits/uniform_quantum.dmi index e43f27ee1ffe..a120fe40f895 100644 Binary files a/icons/clothing/jumpsuits/uniform_quantum.dmi and b/icons/clothing/jumpsuits/uniform_quantum.dmi differ diff --git a/icons/clothing/suits/jackets/brown_suit.dmi b/icons/clothing/suits/jackets/brown_suit.dmi index e2938c1ef5cd..042714e11879 100644 Binary files a/icons/clothing/suits/jackets/brown_suit.dmi and b/icons/clothing/suits/jackets/brown_suit.dmi differ diff --git a/icons/clothing/suits/labcoat/default.dmi b/icons/clothing/suits/labcoat/default.dmi index 1b57d582124a..abd5d8f0b820 100644 Binary files a/icons/clothing/suits/labcoat/default.dmi and b/icons/clothing/suits/labcoat/default.dmi differ diff --git a/icons/clothing/suits/labcoat/rd.dmi b/icons/clothing/suits/labcoat/rd.dmi index fa8d8f43b18f..b2758f1e836d 100644 Binary files a/icons/clothing/suits/labcoat/rd.dmi and b/icons/clothing/suits/labcoat/rd.dmi differ diff --git a/icons/clothing/suits/letterman.dmi b/icons/clothing/suits/letterman.dmi index 959af29a3e02..b8b0d2801d73 100644 Binary files a/icons/clothing/suits/letterman.dmi and b/icons/clothing/suits/letterman.dmi differ diff --git a/icons/clothing/uniform_rd_alt.dmi b/icons/clothing/uniform_rd_alt.dmi index eabdd6dcba32..009875a2ed45 100644 Binary files a/icons/clothing/uniform_rd_alt.dmi and b/icons/clothing/uniform_rd_alt.dmi differ diff --git a/icons/clothing/uniform_swat.dmi b/icons/clothing/uniform_swat.dmi index 97bf8ed0dd8d..93fd89ab227c 100644 Binary files a/icons/clothing/uniform_swat.dmi and b/icons/clothing/uniform_swat.dmi differ diff --git a/icons/clothing/uniform_vice.dmi b/icons/clothing/uniform_vice.dmi deleted file mode 100644 index 1277818e410c..000000000000 Binary files a/icons/clothing/uniform_vice.dmi and /dev/null differ diff --git a/icons/mob/blob.dmi b/icons/mob/blob.dmi deleted file mode 100644 index f89d667fb0f4..000000000000 Binary files a/icons/mob/blob.dmi and /dev/null differ diff --git a/icons/mob/onmob/items/lefthand.dmi b/icons/mob/onmob/items/lefthand.dmi index d6caad0f37ce..40271107dd3c 100644 Binary files a/icons/mob/onmob/items/lefthand.dmi and b/icons/mob/onmob/items/lefthand.dmi differ diff --git a/icons/mob/onmob/items/righthand.dmi b/icons/mob/onmob/items/righthand.dmi index 0f5f17e6c19b..b1fad2f010ce 100644 Binary files a/icons/mob/onmob/items/righthand.dmi and b/icons/mob/onmob/items/righthand.dmi differ diff --git a/icons/mob/screen/styles/midnight/modifiers.dmi b/icons/mob/screen/styles/midnight/modifiers.dmi new file mode 100644 index 000000000000..6cc3b0b6b5d5 Binary files /dev/null and b/icons/mob/screen/styles/midnight/modifiers.dmi differ diff --git a/icons/mob/screen/styles/minimalist/modifiers.dmi b/icons/mob/screen/styles/minimalist/modifiers.dmi new file mode 100644 index 000000000000..aef787e69213 Binary files /dev/null and b/icons/mob/screen/styles/minimalist/modifiers.dmi differ diff --git a/icons/mob/screen/styles/modifiers.dmi b/icons/mob/screen/styles/modifiers.dmi new file mode 100644 index 000000000000..fb652724b08c Binary files /dev/null and b/icons/mob/screen/styles/modifiers.dmi differ diff --git a/icons/mob/screen/styles/old/modifiers.dmi b/icons/mob/screen/styles/old/modifiers.dmi new file mode 100644 index 000000000000..4021542f5f47 Binary files /dev/null and b/icons/mob/screen/styles/old/modifiers.dmi differ diff --git a/icons/mob/screen/styles/old_noborder/modifiers.dmi b/icons/mob/screen/styles/old_noborder/modifiers.dmi new file mode 100644 index 000000000000..fb652724b08c Binary files /dev/null and b/icons/mob/screen/styles/old_noborder/modifiers.dmi differ diff --git a/icons/mob/screen/styles/orange/modifiers.dmi b/icons/mob/screen/styles/orange/modifiers.dmi new file mode 100644 index 000000000000..63a91d893f70 Binary files /dev/null and b/icons/mob/screen/styles/orange/modifiers.dmi differ diff --git a/icons/mob/screen/styles/underworld/modifiers.dmi b/icons/mob/screen/styles/underworld/modifiers.dmi new file mode 100644 index 000000000000..f70a3571afb3 Binary files /dev/null and b/icons/mob/screen/styles/underworld/modifiers.dmi differ diff --git a/icons/mob/screen/styles/white/modifiers.dmi b/icons/mob/screen/styles/white/modifiers.dmi new file mode 100644 index 000000000000..6f342e3627d2 Binary files /dev/null and b/icons/mob/screen/styles/white/modifiers.dmi differ diff --git a/icons/obj/ammo.dmi b/icons/obj/ammo.dmi index aed587179330..5ae6fdea7fc5 100644 Binary files a/icons/obj/ammo.dmi and b/icons/obj/ammo.dmi differ diff --git a/icons/obj/ammo/casings/anti_materiel.dmi b/icons/obj/ammo/casings/anti_materiel.dmi index 806f77543c04..f95bb448913c 100644 Binary files a/icons/obj/ammo/casings/anti_materiel.dmi and b/icons/obj/ammo/casings/anti_materiel.dmi differ diff --git a/icons/obj/ammo/casings/flechette.dmi b/icons/obj/ammo/casings/flechette.dmi index 843be2012554..665e280da342 100644 Binary files a/icons/obj/ammo/casings/flechette.dmi and b/icons/obj/ammo/casings/flechette.dmi differ diff --git a/icons/obj/ammo/casings/lasbulb.dmi b/icons/obj/ammo/casings/lasbulb.dmi index 5bca476149b3..88c08b5ee0ab 100644 Binary files a/icons/obj/ammo/casings/lasbulb.dmi and b/icons/obj/ammo/casings/lasbulb.dmi differ diff --git a/icons/obj/ammo/casings/magnum.dmi b/icons/obj/ammo/casings/magnum.dmi index fc2d9a75beee..388342650995 100644 Binary files a/icons/obj/ammo/casings/magnum.dmi and b/icons/obj/ammo/casings/magnum.dmi differ diff --git a/icons/obj/ammo/casings/pistol.dmi b/icons/obj/ammo/casings/pistol.dmi index ae2d1a432ea3..73ed63e6435d 100644 Binary files a/icons/obj/ammo/casings/pistol.dmi and b/icons/obj/ammo/casings/pistol.dmi differ diff --git a/icons/obj/ammo/casings/rifle.dmi b/icons/obj/ammo/casings/rifle.dmi index 51d89cb5f4b8..239b0332c32a 100644 Binary files a/icons/obj/ammo/casings/rifle.dmi and b/icons/obj/ammo/casings/rifle.dmi differ diff --git a/icons/obj/ammo/casings/small_pistol.dmi b/icons/obj/ammo/casings/small_pistol.dmi index 1370416b1c28..2f868238f788 100644 Binary files a/icons/obj/ammo/casings/small_pistol.dmi and b/icons/obj/ammo/casings/small_pistol.dmi differ diff --git a/icons/obj/ammo/shells/beanbag.dmi b/icons/obj/ammo/shells/beanbag.dmi new file mode 100644 index 000000000000..7223446a3ebe Binary files /dev/null and b/icons/obj/ammo/shells/beanbag.dmi differ diff --git a/icons/obj/ammo/shells/blanks.dmi b/icons/obj/ammo/shells/blanks.dmi new file mode 100644 index 000000000000..322c1deccfe3 Binary files /dev/null and b/icons/obj/ammo/shells/blanks.dmi differ diff --git a/icons/obj/ammo/shells/buckshot.dmi b/icons/obj/ammo/shells/buckshot.dmi new file mode 100644 index 000000000000..1e015653e97b Binary files /dev/null and b/icons/obj/ammo/shells/buckshot.dmi differ diff --git a/icons/obj/ammo/shells/flash.dmi b/icons/obj/ammo/shells/flash.dmi new file mode 100644 index 000000000000..e715a747393a Binary files /dev/null and b/icons/obj/ammo/shells/flash.dmi differ diff --git a/icons/obj/ammo/shells/haywire.dmi b/icons/obj/ammo/shells/haywire.dmi new file mode 100644 index 000000000000..671477e93dfd Binary files /dev/null and b/icons/obj/ammo/shells/haywire.dmi differ diff --git a/icons/obj/ammo/shells/practice.dmi b/icons/obj/ammo/shells/practice.dmi new file mode 100644 index 000000000000..7b23581df10e Binary files /dev/null and b/icons/obj/ammo/shells/practice.dmi differ diff --git a/icons/obj/ammo/shells/slugs.dmi b/icons/obj/ammo/shells/slugs.dmi new file mode 100644 index 000000000000..6f081288fa1c Binary files /dev/null and b/icons/obj/ammo/shells/slugs.dmi differ diff --git a/icons/obj/ammo/shells/stun.dmi b/icons/obj/ammo/shells/stun.dmi new file mode 100644 index 000000000000..1387132510cd Binary files /dev/null and b/icons/obj/ammo/shells/stun.dmi differ diff --git a/icons/obj/closets/bases/chest.dmi b/icons/obj/closets/bases/chest.dmi index bef40525584d..b43edd86460b 100644 Binary files a/icons/obj/closets/bases/chest.dmi and b/icons/obj/closets/bases/chest.dmi differ diff --git a/icons/obj/decals.dmi b/icons/obj/decals.dmi deleted file mode 100644 index f876357570a6..000000000000 Binary files a/icons/obj/decals.dmi and /dev/null differ diff --git a/icons/obj/hydroponics/hydroponics_growing.dmi b/icons/obj/hydroponics/hydroponics_growing.dmi index 4cfbff45b529..9e4f944856b0 100644 Binary files a/icons/obj/hydroponics/hydroponics_growing.dmi and b/icons/obj/hydroponics/hydroponics_growing.dmi differ diff --git a/icons/obj/items/grenades/clusterbang.dmi b/icons/obj/items/grenades/clusterbang.dmi index c2558423c4af..2ea0b9c7f422 100644 Binary files a/icons/obj/items/grenades/clusterbang.dmi and b/icons/obj/items/grenades/clusterbang.dmi differ diff --git a/icons/obj/items/grenades/clusterbang_segment.dmi b/icons/obj/items/grenades/clusterbang_segment.dmi index 3e33e5979d12..dc1d1b36c870 100644 Binary files a/icons/obj/items/grenades/clusterbang_segment.dmi and b/icons/obj/items/grenades/clusterbang_segment.dmi differ diff --git a/icons/obj/items/grenades/concussion.dmi b/icons/obj/items/grenades/concussion.dmi index e66e3839cf8a..2a72701e0922 100644 Binary files a/icons/obj/items/grenades/concussion.dmi and b/icons/obj/items/grenades/concussion.dmi differ diff --git a/icons/obj/items/grenades/delivery.dmi b/icons/obj/items/grenades/delivery.dmi index 6134b6ca4949..69645514829c 100644 Binary files a/icons/obj/items/grenades/delivery.dmi and b/icons/obj/items/grenades/delivery.dmi differ diff --git a/icons/obj/items/grenades/emp.dmi b/icons/obj/items/grenades/emp.dmi index ca3dd874467a..cc7bc5a96161 100644 Binary files a/icons/obj/items/grenades/emp.dmi and b/icons/obj/items/grenades/emp.dmi differ diff --git a/icons/obj/items/grenades/emp_old.dmi b/icons/obj/items/grenades/emp_old.dmi index 64a89ee1fdb3..97f03da5c6ff 100644 Binary files a/icons/obj/items/grenades/emp_old.dmi and b/icons/obj/items/grenades/emp_old.dmi differ diff --git a/icons/obj/items/grenades/flashbang.dmi b/icons/obj/items/grenades/flashbang.dmi index 3ff439d54c6a..db1957234b40 100644 Binary files a/icons/obj/items/grenades/flashbang.dmi and b/icons/obj/items/grenades/flashbang.dmi differ diff --git a/icons/obj/items/grenades/frag.dmi b/icons/obj/items/grenades/frag.dmi index f932b34099df..bab0c2594724 100644 Binary files a/icons/obj/items/grenades/frag.dmi and b/icons/obj/items/grenades/frag.dmi differ diff --git a/icons/obj/items/grenades/grenade.dmi b/icons/obj/items/grenades/grenade.dmi index a962ec066d7e..11a48997b03d 100644 Binary files a/icons/obj/items/grenades/grenade.dmi and b/icons/obj/items/grenades/grenade.dmi differ diff --git a/icons/obj/items/grenades/grenade_chem.dmi b/icons/obj/items/grenades/grenade_chem.dmi index a317e6077b47..71a922069edb 100644 Binary files a/icons/obj/items/grenades/grenade_chem.dmi and b/icons/obj/items/grenades/grenade_chem.dmi differ diff --git a/icons/obj/items/paperwork/pamphlet.dmi b/icons/obj/items/paperwork/pamphlet.dmi deleted file mode 100644 index 32dd05307de5..000000000000 Binary files a/icons/obj/items/paperwork/pamphlet.dmi and /dev/null differ diff --git a/icons/obj/items/rolling_pin.dmi b/icons/obj/items/rolling_pin.dmi new file mode 100644 index 000000000000..afd2f0c30969 Binary files /dev/null and b/icons/obj/items/rolling_pin.dmi differ diff --git a/icons/obj/items/storage/portafreezer.dmi b/icons/obj/items/storage/portafreezer.dmi index e80bc712afa0..20fed2ca5599 100644 Binary files a/icons/obj/items/storage/portafreezer.dmi and b/icons/obj/items/storage/portafreezer.dmi differ diff --git a/icons/obj/kitchen.dmi b/icons/obj/kitchen.dmi index 930272cdd802..52ca26faca72 100644 Binary files a/icons/obj/kitchen.dmi and b/icons/obj/kitchen.dmi differ diff --git a/icons/obj/machines/centrifuge.dmi b/icons/obj/machines/centrifuge.dmi new file mode 100644 index 000000000000..6cae1e66cf32 Binary files /dev/null and b/icons/obj/machines/centrifuge.dmi differ diff --git a/icons/obj/machines/fabricators/bioprinter.dmi b/icons/obj/machines/fabricators/bioprinter.dmi index da63ea829e91..3b7889974758 100644 Binary files a/icons/obj/machines/fabricators/bioprinter.dmi and b/icons/obj/machines/fabricators/bioprinter.dmi differ diff --git a/icons/obj/machines/medpump.dmi b/icons/obj/machines/medpump.dmi new file mode 100644 index 000000000000..01f5a1dc4b9a Binary files /dev/null and b/icons/obj/machines/medpump.dmi differ diff --git a/icons/obj/machines/tramdoors.dmi b/icons/obj/machines/tramdoors.dmi new file mode 100644 index 000000000000..3b40ac65a8ef Binary files /dev/null and b/icons/obj/machines/tramdoors.dmi differ diff --git a/icons/obj/structures/displaycase.dmi b/icons/obj/structures/displaycase.dmi index a6411b171ad3..828acda9127f 100644 Binary files a/icons/obj/structures/displaycase.dmi and b/icons/obj/structures/displaycase.dmi differ diff --git a/icons/obj/structures/divider.dmi b/icons/obj/structures/divider.dmi index 5016482a2a1a..85e10194b86f 100644 Binary files a/icons/obj/structures/divider.dmi and b/icons/obj/structures/divider.dmi differ diff --git a/icons/obj/structures/furniture/bench.dmi b/icons/obj/structures/furniture/bench.dmi index 80fda7a9a165..0bf99b3e3927 100644 Binary files a/icons/obj/structures/furniture/bench.dmi and b/icons/obj/structures/furniture/bench.dmi differ diff --git a/icons/obj/structures/furniture/bench_wood.dmi b/icons/obj/structures/furniture/bench_wood.dmi index f6c0043b9571..bf8129ccb007 100644 Binary files a/icons/obj/structures/furniture/bench_wood.dmi and b/icons/obj/structures/furniture/bench_wood.dmi differ diff --git a/icons/obj/structures/furniture/cabinet_duo.dmi b/icons/obj/structures/furniture/cabinet_duo.dmi new file mode 100644 index 000000000000..adc99dcb2055 Binary files /dev/null and b/icons/obj/structures/furniture/cabinet_duo.dmi differ diff --git a/icons/obj/structures/furniture/lounge.dmi b/icons/obj/structures/furniture/lounge.dmi index 1323daaccd69..f377c4d7421b 100644 Binary files a/icons/obj/structures/furniture/lounge.dmi and b/icons/obj/structures/furniture/lounge.dmi differ diff --git a/icons/obj/structures/furniture/pew_wood.dmi b/icons/obj/structures/furniture/pew_wood.dmi index cfc0b9d578e9..7084548224ba 100644 Binary files a/icons/obj/structures/furniture/pew_wood.dmi and b/icons/obj/structures/furniture/pew_wood.dmi differ diff --git a/icons/obj/structures/furniture/sofa_middle.dmi b/icons/obj/structures/furniture/sofa_middle.dmi index 92a69a0146e3..67794edf8386 100644 Binary files a/icons/obj/structures/furniture/sofa_middle.dmi and b/icons/obj/structures/furniture/sofa_middle.dmi differ diff --git a/icons/obj/structures/morgue.dmi b/icons/obj/structures/morgue.dmi index 2d86bea7d1b2..b91eb2af3a51 100644 Binary files a/icons/obj/structures/morgue.dmi and b/icons/obj/structures/morgue.dmi differ diff --git a/icons/obj/terminals.dmi b/icons/obj/terminals.dmi index 1afdc104b41e..c66b76ce64ce 100644 Binary files a/icons/obj/terminals.dmi and b/icons/obj/terminals.dmi differ diff --git a/icons/obj/watercloset.dmi b/icons/obj/watercloset.dmi index f7fcf2dd7e35..373f998b70c2 100644 Binary files a/icons/obj/watercloset.dmi and b/icons/obj/watercloset.dmi differ diff --git a/icons/screen/mob_modifiers.dmi b/icons/screen/mob_modifiers.dmi new file mode 100644 index 000000000000..e473dc266777 Binary files /dev/null and b/icons/screen/mob_modifiers.dmi differ diff --git a/icons/turf/flooring/path.dmi b/icons/turf/flooring/path.dmi index 1f1d1798b3ab..2f13c15ef5d6 100644 Binary files a/icons/turf/flooring/path.dmi and b/icons/turf/flooring/path.dmi differ diff --git a/install-byond.sh b/install-byond.sh index 3b0170c16b0f..5d60db277127 100755 --- a/install-byond.sh +++ b/install-byond.sh @@ -8,7 +8,8 @@ else mkdir -p "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}" cd "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}" echo "Installing DreamMaker to $PWD" - curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -o byond.zip + #curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -H "User-Agent: NebulaSS13/1.0 Continuous Integration" -o byond.zip + curl "https://spacestation13.github.io/byond-builds/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -H "User-Agent: NebulaSS13/1.0 Continuous Integration" -o byond.zip unzip -o byond.zip cd byond make here diff --git a/maps/away/bearcat/bearcat-2.dmm b/maps/away/bearcat/bearcat-2.dmm index 375413801273..13fbb9c4b12c 100644 --- a/maps/away/bearcat/bearcat-2.dmm +++ b/maps/away/bearcat/bearcat-2.dmm @@ -149,8 +149,7 @@ department = "Captain"; pixel_x = 32; initial_network_id = "freightnet_0451"; - dir = 4; - + dir = 4 }, /obj/structure/chair{ dir = 1 @@ -2008,7 +2007,7 @@ }, /obj/item/box/donkpockets, /obj/effect/floor_decal/corner/red/diagonal, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /obj/item/chems/condiment/small/saltshaker{ pixel_x = -3 }, diff --git a/maps/away/bearcat/bearcat.dm b/maps/away/bearcat/bearcat.dm index 570e2e140e6a..dc13ca07d873 100644 --- a/maps/away/bearcat/bearcat.dm +++ b/maps/away/bearcat/bearcat.dm @@ -1,3 +1,4 @@ +#include "../../../mods/content/modern_earth/_modern_earth.dme" // for the British flag cups, which could honestly just be removed #include "bearcat_areas.dm" #include "bearcat_jobs.dm" #include "bearcat_access.dm" diff --git a/maps/away/derelict/derelict-station.dmm b/maps/away/derelict/derelict-station.dmm index dbb6946ec806..dae85f046cff 100644 --- a/maps/away/derelict/derelict-station.dmm +++ b/maps/away/derelict/derelict-station.dmm @@ -910,7 +910,7 @@ /area/constructionsite/hallway/fore) "dc" = ( /obj/structure/table/marble, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /turf/floor/plating/airless, /area/constructionsite/hallway/fore) "de" = ( diff --git a/maps/away/errant_pisces/errant_pisces.dm b/maps/away/errant_pisces/errant_pisces.dm index 1060e8f8a9cb..b5179c2bd942 100644 --- a/maps/away/errant_pisces/errant_pisces.dm +++ b/maps/away/errant_pisces/errant_pisces.dm @@ -52,18 +52,18 @@ else return SPAN_NOTICE("A few strands of \the [src] have been severed.") -/obj/structure/net/attackby(obj/item/W, mob/user) - if(W.is_sharp() || W.has_edge()) - var/force = W.expend_attack_force(user) - if (!(W.is_sharp()) || (W.is_sharp() && force < 10))//is not sharp enough or at all - to_chat(user,"You can't cut through \the [src] with \the [W], it's too dull.") +/obj/structure/net/attackby(obj/item/used_item, mob/user) + if(used_item.is_sharp() || used_item.has_edge()) + var/force = used_item.expend_attack_force(user) + if (!(used_item.is_sharp()) || (used_item.is_sharp() && force < 10))//is not sharp enough or at all + to_chat(user,"You can't cut through \the [src] with \the [used_item], it's too dull.") return TRUE - visible_message("[user] starts to cut through \the [src] with \the [W]!") + visible_message("[user] starts to cut through \the [src] with \the [used_item]!") while(current_health > 0 && !QDELETED(src) && !QDELETED(user)) if (!do_after(user, 20, src)) - visible_message("[user] stops cutting through \the [src] with \the [W]!") + visible_message("[user] stops cutting through \the [src] with \the [used_item]!") return TRUE - take_damage(20 * (1 + (force-10)/10), W.atom_damage_type) //the sharper the faster, every point of force above 10 adds 10 % to damage + take_damage(20 * (1 + (force-10)/10), used_item.atom_damage_type) //the sharper the faster, every point of force above 10 adds 10 % to damage new /obj/item/stack/net(src.loc) qdel(src) return TRUE diff --git a/maps/away/liberia/liberia.dmm b/maps/away/liberia/liberia.dmm index 0824627ff7e7..4668690ed070 100644 --- a/maps/away/liberia/liberia.dmm +++ b/maps/away/liberia/liberia.dmm @@ -4213,7 +4213,7 @@ }, /obj/structure/table/reinforced, /obj/item/clothing/suit/chef/classic, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /obj/item/knife/kitchen, /turf/floor/tiled/freezer, /area/liberia/bar) diff --git a/maps/away/magshield/magshield.dm b/maps/away/magshield/magshield.dm index 7344b67ec55c..dc0670443461 100644 --- a/maps/away/magshield/magshield.dm +++ b/maps/away/magshield/magshield.dm @@ -90,12 +90,12 @@ to_chat(user, SPAN_NOTICE("You don't see how you could turn off \the [src]. You could possibly jam something into the rotating spokes.")) return TRUE -/obj/structure/magshield/maggen/attackby(obj/item/W, mob/user) +/obj/structure/magshield/maggen/attackby(obj/item/used_item, mob/user) if (being_stopped) to_chat(user, SPAN_WARNING("Somebody is already interacting with \the [src].")) return TRUE - if(istype(W, /obj/item/stack/material/rods)) - var/obj/item/stack/material/rods/R = W + if(istype(used_item, /obj/item/stack/material/rods)) + var/obj/item/stack/material/rods/R = used_item to_chat(user, SPAN_NOTICE("You start to jam \a [R.singular_name] into the rotating spokes.")) being_stopped = 1 if (!do_after(user, 100, src)) @@ -112,9 +112,9 @@ explosion(T, 2, 3, 4, 10, 1) if(!QDELETED(src)) qdel(src) - if(istype(W, /obj/item/mop)) - to_chat(user, SPAN_NOTICE("You stick \the [W] into the rotating spokes, and it immediately breaks into tiny pieces.")) - qdel(W) + if(istype(used_item, /obj/item/mop)) + to_chat(user, SPAN_NOTICE("You stick \the [used_item] into the rotating spokes, and it immediately breaks into tiny pieces.")) + qdel(used_item) return TRUE return ..() diff --git a/maps/away/magshield/magshield.dmm b/maps/away/magshield/magshield.dmm index 6608162f7c71..ff34e540ae8f 100644 --- a/maps/away/magshield/magshield.dmm +++ b/maps/away/magshield/magshield.dmm @@ -1743,7 +1743,7 @@ /area/magshield/north) "eS" = ( /obj/structure/table/steel, -/obj/item/box/lights, +/obj/item/box/lights/mixed, /turf/floor/plating/airless, /area/magshield/north) "eT" = ( diff --git a/maps/away/mining/mining-signal.dmm b/maps/away/mining/mining-signal.dmm index 1f697ed949c4..211bb4aa8333 100644 --- a/maps/away/mining/mining-signal.dmm +++ b/maps/away/mining/mining-signal.dmm @@ -1690,7 +1690,7 @@ icon_state = "req_comp_rewired"; pixel_y = -32; stat = 1; - dir = 2; + dir = 2 }, /turf/floor/tiled/airless, /area/outpost/abandoned) diff --git a/maps/away/mobius_rift/mobius_rift.dm b/maps/away/mobius_rift/mobius_rift.dm index 771f936cf140..48b89d81a81d 100644 --- a/maps/away/mobius_rift/mobius_rift.dm +++ b/maps/away/mobius_rift/mobius_rift.dm @@ -88,19 +88,19 @@ /obj/effect/mobius_rift/chamber/Initialize(var/mapload, var/grid_size)//NORTH, SOUTH, EAST, WEST . = ..() - var/turf/T - T = locate(src.x, src.y + round(grid_size/2), src.z) - var/N = new /obj/effect/step_trigger/mobius_rift/seamless_portal(T, NORTH) - portals["NORTH"] = N - T = locate(src.x, src.y - round(grid_size/2), src.z) - var/S = new /obj/effect/step_trigger/mobius_rift/seamless_portal(T, SOUTH) - portals["SOUTH"] = S - T = locate(src.x + round(grid_size/2), src.y, src.z) - var/E = new /obj/effect/step_trigger/mobius_rift/seamless_portal(T, EAST) - portals["EAST"] = E - T = locate(src.x - round(grid_size/2), src.y, src.z) - var/W = new /obj/effect/step_trigger/mobius_rift/seamless_portal(T, WEST) - portals["WEST"] = W + var/turf/rift_turf + rift_turf = locate(src.x, src.y + round(grid_size/2), src.z) + var/north_portal = new /obj/effect/step_trigger/mobius_rift/seamless_portal(rift_turf, NORTH) + portals["NORTH"] = north_portal + rift_turf = locate(src.x, src.y - round(grid_size/2), src.z) + var/south_portal = new /obj/effect/step_trigger/mobius_rift/seamless_portal(rift_turf, SOUTH) + portals["SOUTH"] = south_portal + rift_turf = locate(src.x + round(grid_size/2), src.y, src.z) + var/east_portal = new /obj/effect/step_trigger/mobius_rift/seamless_portal(rift_turf, EAST) + portals["EAST"] = east_portal + rift_turf = locate(src.x - round(grid_size/2), src.y, src.z) + var/west_portal = new /obj/effect/step_trigger/mobius_rift/seamless_portal(rift_turf, WEST) + portals["WEST"] = west_portal /obj/effect/mobius_rift/chamber/proc/set_portals(var/list/destinations) for (var/iter = 1 to portals.len) diff --git a/maps/away/unishi/unishi-2.dmm b/maps/away/unishi/unishi-2.dmm index 32aca273e7c6..d80c7b18d961 100644 --- a/maps/away/unishi/unishi-2.dmm +++ b/maps/away/unishi/unishi-2.dmm @@ -2068,8 +2068,7 @@ "fM" = ( /obj/machinery/door/blast/regular/open{ id_tag = "Biohazard"; - name = "Biohazard Shutter"; - + name = "Biohazard Shutter" }, /obj/machinery/door/airlock/hatch, /obj/machinery/atmospherics/pipe/simple/hidden/supply, @@ -2215,8 +2214,7 @@ /obj/machinery/door/blast/regular/open{ dir = 4; id_tag = "Biohazard"; - name = "Biohazard Shutter"; - + name = "Biohazard Shutter" }, /turf/floor, /area/unishi/smresearch) @@ -2346,7 +2344,7 @@ dir = 4; id_tag = "Biohazard"; name = "Biohazard Shutter"; - + }, /obj/item/remains, /turf/floor, @@ -2742,7 +2740,7 @@ dir = 4; id_tag = "Biohazard"; name = "Biohazard Shutter"; - + }, /obj/item/remains, /obj/random/shoes, diff --git a/maps/away/unishi/unishi-3.dmm b/maps/away/unishi/unishi-3.dmm index 24e50a4e253e..81afee9709b0 100644 --- a/maps/away/unishi/unishi-3.dmm +++ b/maps/away/unishi/unishi-3.dmm @@ -1994,16 +1994,6 @@ /obj/machinery/atmospherics/pipe/manifold/hidden/supply, /turf/floor/tiled, /area/unishi/living) -"RG" = ( -/obj/structure/closet/crate/bin, -/obj/machinery/atmospherics/unary/vent_scrubber/on{ - dir = 8 - }, -/obj/machinery/atmospherics/pipe/simple/hidden/supply{ - dir = 4 - }, -/turf/floor/tiled, -/area/unishi/living) "Dj" = ( /obj/structure/closet/emcloset, /obj/item/clothing/suit/space/void, @@ -2018,6 +2008,16 @@ /obj/item/tank/oxygen, /turf/floor/tiled, /area/unishi/living) +"RG" = ( +/obj/structure/closet/crate/bin, +/obj/machinery/atmospherics/unary/vent_scrubber/on{ + dir = 8 + }, +/obj/machinery/atmospherics/pipe/simple/hidden/supply{ + dir = 4 + }, +/turf/floor/tiled, +/area/unishi/living) "Um" = ( /obj/machinery/light/small{ dir = 4 diff --git a/maps/example/example-3.dmm b/maps/example/example-3.dmm index abffda753cc8..f08650be723a 100644 --- a/maps/example/example-3.dmm +++ b/maps/example/example-3.dmm @@ -228,7 +228,7 @@ /area/example/third) "MO" = ( /obj/abstract/level_data_spawner/admin_level{ - name = "Example Third Deck"; + name = "Example Third Deck" }, /turf/space, /area/space) diff --git a/maps/exodus/exodus-2.dmm b/maps/exodus/exodus-2.dmm index f323c39ad5fd..c83892c7fd92 100644 --- a/maps/exodus/exodus-2.dmm +++ b/maps/exodus/exodus-2.dmm @@ -7410,8 +7410,9 @@ /turf/floor/tiled/dark/monotile, /area/shuttle/escape_pod_1) "apD" = ( -/turf/wall/prepainted, -/area/exodus/gateway) +/obj/structure/girder, +/turf/floor/plating, +/area/exodus/maintenance/evahallway) "apE" = ( /obj/machinery/light{ dir = 8 @@ -8588,16 +8589,6 @@ }, /turf/floor, /area/exodus/maintenance/evahallway) -"arS" = ( -/obj/machinery/light_switch{ - pixel_x = -24; - dir = 4 - }, -/obj/machinery/atmospherics/unary/vent_pump/on{ - dir = 4 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "arT" = ( /obj/structure/hygiene/sink/kitchen{ pixel_y = 21 @@ -8859,12 +8850,6 @@ /obj/structure/bed/padded, /turf/floor/tiled/steel_grid, /area/exodus/security/brig/solitaryB) -"asu" = ( -/obj/machinery/atmospherics/unary/vent_scrubber/on{ - dir = 8 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "asv" = ( /obj/structure/disposalpipe/segment{ dir = 1; @@ -11123,11 +11108,6 @@ }, /turf/floor/tiled/dark, /area/exodus/crew_quarters/sleep) -"axv" = ( -/obj/effect/wallframe_spawn/reinforced, -/obj/machinery/door/firedoor, -/turf/floor/plating, -/area/exodus/hallway/primary/port) "axw" = ( /obj/structure/disposalpipe/segment, /obj/structure/cable/green{ @@ -12251,10 +12231,10 @@ /turf/floor/plating, /area/exodus/bridge) "azI" = ( -/obj/machinery/door/airlock/maintenance, /obj/machinery/door/firedoor, -/turf/floor/tiled/techfloor/grid, -/area/exodus/gateway) +/obj/structure/door_assembly, +/turf/floor/plating, +/area/exodus/maintenance/evahallway) "azJ" = ( /obj/machinery/camera/network/civilian_east{ c_tag = "Kitchen Cold Room" @@ -12608,30 +12588,6 @@ /obj/machinery/portable_atmospherics/hydroponics, /turf/floor/tiled/dark, /area/exodus/hydroponics) -"aAA" = ( -/obj/machinery/gateway{ - dir = 9 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aAB" = ( -/obj/machinery/light{ - dir = 8 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aAC" = ( -/obj/machinery/gateway{ - dir = 5 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aAD" = ( -/obj/machinery/gateway{ - dir = 1 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aAE" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -12645,11 +12601,9 @@ /turf/wall/r_wall/prepainted, /area/exodus/maintenance/auxsolarport) "aAG" = ( -/obj/machinery/light{ - dir = 4 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) +/obj/random/maintenance, +/turf/floor/plating, +/area/exodus/maintenance/evahallway) "aAH" = ( /obj/structure/sign/warning/airlock{ pixel_x = 32; @@ -13126,12 +13080,6 @@ "aBI" = ( /turf/wall/r_wall/prepainted, /area/exodus/hallway/secondary/entry/port) -"aBJ" = ( -/obj/machinery/gateway{ - dir = 8 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aBK" = ( /obj/machinery/door/airlock/external/bolted{ id_tag = "nuke_shuttle_dock_inner"; @@ -13146,18 +13094,9 @@ /turf/wall/prepainted, /area/exodus/hallway/secondary/entry/port) "aBM" = ( -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aBN" = ( -/obj/machinery/gateway{ - dir = 4 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aBO" = ( -/obj/machinery/gateway/centerstation, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) +/obj/random/trash, +/turf/floor/plating, +/area/exodus/maintenance/evahallway) "aBP" = ( /obj/machinery/atmospherics/unary/tank/air{ dir = 8 @@ -13554,59 +13493,6 @@ "aCK" = ( /turf/wall/prepainted, /area/exodus/storage/primary) -"aCL" = ( -/obj/machinery/gateway{ - dir = 10 - }, -/obj/abstract/landmark/latejoin/gateway, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aCN" = ( -/obj/machinery/gateway{ - dir = 6 - }, -/obj/abstract/landmark/latejoin/gateway, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aCO" = ( -/obj/machinery/gateway, -/obj/abstract/landmark/latejoin/gateway, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aCP" = ( -/obj/machinery/vending/coffee{ - dir = 4 - }, -/obj/machinery/camera/network/civilian_west{ - c_tag = "Gateway Arrival Area"; - dir = 4 - }, -/obj/structure/sign/warning/biohazard{ - pixel_x = -32 - }, -/obj/effect/floor_decal/industrial/warning/corner{ - dir = 4 - }, -/obj/structure/window/reinforced{ - dir = 1; - current_health = 1e+006 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aCQ" = ( -/obj/structure/sign/warning/biohazard{ - pixel_x = 32 - }, -/obj/structure/closet/wardrobe/xenos, -/obj/effect/floor_decal/industrial/warning/corner{ - dir = 1 - }, -/obj/structure/window/reinforced{ - dir = 1; - current_health = 1e+006 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aCS" = ( /obj/structure/table/reinforced, /obj/item/assembly/signaler, @@ -14173,12 +14059,6 @@ }, /turf/floor/tiled/dark, /area/exodus/security/nuke_storage) -"aEb" = ( -/obj/machinery/atmospherics/pipe/simple/hidden/supply{ - dir = 4 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aEc" = ( /obj/machinery/power/apc{ dir = 8; @@ -14208,21 +14088,6 @@ /obj/effect/wallframe_spawn/reinforced, /turf/floor/plating, /area/exodus/hallway/primary/starboard) -"aEf" = ( -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ - dir = 4 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) -"aEg" = ( -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ - dir = 6 - }, -/obj/machinery/atmospherics/pipe/simple/hidden/supply{ - dir = 10 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aEh" = ( /obj/structure/table/laminate, /obj/machinery/reagentgrinder, @@ -14934,12 +14799,6 @@ }, /turf/floor/tiled/steel_grid, /area/exodus/research/chargebay) -"aFA" = ( -/obj/effect/floor_decal/industrial/warning{ - dir = 1 - }, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aFB" = ( /obj/structure/extinguisher_cabinet{ pixel_x = 29; @@ -14986,14 +14845,6 @@ }, /turf/floor/tiled/steel_grid, /area/exodus/hallway/primary/central_two) -"aFF" = ( -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, -/obj/machinery/atmospherics/pipe/simple/hidden/supply, -/obj/effect/floor_decal/industrial/warning{ - dir = 1 - }, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aFG" = ( /obj/structure/closet/secure_closet/bar, /obj/machinery/power/apc{ @@ -15360,16 +15211,6 @@ }, /turf/floor/tiled/techfloor/grid, /area/exodus/hallway/secondary/exit) -"aGl" = ( -/obj/machinery/vending/cola{ - dir = 4 - }, -/obj/item/radio/intercom{ - dir = 4; - pixel_x = -22 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aGm" = ( /obj/machinery/recharger{ pixel_y = 4 @@ -15561,10 +15402,6 @@ }, /turf/floor/plating, /area/exodus/hallway/primary/central_two) -"aGK" = ( -/obj/item/stool, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aGL" = ( /obj/structure/disposalpipe/segment{ dir = 4 @@ -15584,10 +15421,6 @@ }, /turf/floor/laminate/walnut, /area/exodus/library) -"aGN" = ( -/obj/machinery/hologram/holopad, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aGO" = ( /obj/effect/wallframe_spawn/reinforced, /obj/machinery/door/blast/shutters/open{ @@ -15618,19 +15451,6 @@ }, /turf/floor/plating, /area/exodus/maintenance/substation/civilian_west) -"aGR" = ( -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, -/obj/machinery/atmospherics/pipe/simple/hidden/supply, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) -"aGS" = ( -/obj/machinery/firealarm{ - dir = 4; - pixel_x = 24 - }, -/obj/structure/closet/wardrobe/black, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aGT" = ( /obj/machinery/suit_cycler/medical/prepared, /turf/floor/tiled/dark, @@ -16440,12 +16260,6 @@ }, /turf/floor/plating, /area/exodus/maintenance/bar) -"aIp" = ( -/obj/structure/cable/green{ - icon_state = "4-8" - }, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aIq" = ( /obj/structure/table, /obj/item/deck/cards, @@ -16468,17 +16282,6 @@ }, /turf/floor/plating, /area/exodus/maintenance/library) -"aIs" = ( -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) -"aIt" = ( -/obj/structure/cable/green{ - icon_state = "2-8" - }, -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, -/obj/machinery/atmospherics/pipe/simple/hidden/supply, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aIu" = ( /obj/machinery/button/access/exterior{ id_tag = "xeno_airlock_control"; @@ -16767,13 +16570,6 @@ }, /turf/floor/tiled/steel_grid, /area/exodus/crew_quarters/bar/cabin) -"aJc" = ( -/obj/structure/closet/l3closet/scientist, -/obj/structure/window/reinforced{ - dir = 8 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "aJd" = ( /obj/structure/flaps{ opacity = 1 @@ -17279,12 +17075,6 @@ /obj/machinery/space_heater, /turf/floor/plating, /area/exodus/maintenance/locker) -"aKl" = ( -/obj/machinery/atmospherics/unary/vent_pump/on{ - dir = 4 - }, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aKm" = ( /obj/structure/cable/green{ icon_state = "1-2" @@ -17299,24 +17089,6 @@ /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, /turf/floor/tiled/steel_grid, /area/exodus/hallway/primary/port) -"aKn" = ( -/obj/machinery/atmospherics/unary/vent_scrubber/on{ - dir = 8 - }, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) -"aKo" = ( -/obj/structure/cable/green{ - icon_state = "1-2" - }, -/obj/machinery/atmospherics/pipe/manifold/hidden/supply{ - dir = 4 - }, -/obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers{ - dir = 8 - }, -/turf/floor/tiled/steel_grid, -/area/exodus/gateway) "aKp" = ( /obj/machinery/vending/fashionvend, /turf/floor/tiled/monotile, @@ -17945,18 +17717,6 @@ /obj/machinery/door/firedoor, /turf/floor/plating, /area/exodus/quartermaster/storage) -"aLG" = ( -/obj/machinery/door/firedoor, -/obj/machinery/door/airlock/glass{ - name = "Gateway Access" - }, -/obj/structure/cable/green{ - icon_state = "1-2" - }, -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, -/obj/machinery/atmospherics/pipe/simple/hidden/supply, -/turf/floor/tiled/techfloor/grid, -/area/exodus/hallway/primary/port) "aLH" = ( /obj/structure/cable/green{ icon_state = "0-8" @@ -18800,14 +18560,9 @@ /turf/floor/tiled/steel_grid, /area/exodus/hallway/primary/port) "aNA" = ( -/obj/structure/cable/green{ - icon_state = "1-2" - }, /obj/structure/cable/green{ icon_state = "2-4" }, -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, -/obj/machinery/atmospherics/pipe/simple/hidden/supply, /obj/effect/floor_decal/corner/lime{ dir = 5 }, @@ -19725,11 +19480,11 @@ /obj/structure/cable/green{ icon_state = "1-8" }, -/obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers{ - dir = 4 +/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ + dir = 10 }, -/obj/machinery/atmospherics/pipe/manifold/hidden/supply{ - dir = 4 +/obj/machinery/atmospherics/pipe/simple/hidden/supply{ + dir = 10 }, /turf/floor/tiled/steel_grid, /area/exodus/hallway/primary/port) @@ -21558,7 +21313,7 @@ dir = 8 }, /obj/structure/table/marble, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /obj/item/knife, /turf/floor/tiled/white, /area/exodus/crew_quarters/kitchen) @@ -23931,8 +23686,7 @@ announcementConsole = 1; department = "Bridge"; name = "Bridge RC"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /obj/structure/cable/green{ icon_state = "4-8" @@ -26229,22 +25983,6 @@ /obj/structure/disposalpipe/segment, /turf/floor/tiled/techfloor/grid, /area/exodus/hallway/primary/starboard) -"bdL" = ( -/obj/machinery/power/apc{ - dir = 8; - name = "west bump"; - pixel_x = -24 - }, -/obj/structure/table, -/obj/item/deck/cards, -/obj/structure/cable/green{ - icon_state = "0-4" - }, -/obj/item/box/fancy/cigarettes{ - pixel_y = 2 - }, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "bdM" = ( /obj/machinery/atmospherics/unary/vent_scrubber/on{ dir = 1 @@ -26489,7 +26227,7 @@ pixel_x = -21; pixel_y = -10 }, -/obj/machinery/honey_extractor, +/obj/machinery/centrifuge/mapped, /turf/floor/tiled/steel_grid, /area/exodus/hydroponics/garden) "bev" = ( @@ -26839,8 +26577,7 @@ /obj/machinery/network/requests_console{ department = "Kitchen"; name = "Kitchen RC"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /obj/machinery/disposal, /obj/structure/disposalpipe/trunk{ @@ -29868,8 +29605,7 @@ announcementConsole = 1; department = "Bridge"; name = "Bridge RC"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ dir = 4 @@ -30768,7 +30504,6 @@ }, /obj/item/chems/glass/beaker/sulfuric, /obj/structure/reagent_dispensers/acid{ - density = 0; pixel_y = 32 }, /turf/floor/tiled/white/monotile, @@ -39350,8 +39085,7 @@ announcementConsole = 1; department = "Head of Personnel's Desk"; name = "Head of Personnel RC"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /obj/machinery/camera/network/command{ c_tag = "Bridge - HoP's Office"; @@ -45577,8 +45311,7 @@ /obj/item/grenade/chem_grenade/cleaner, /obj/machinery/network/requests_console{ department = "Janitorial"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /obj/item/chems/spray/cleaner, /obj/structure/table/steel, @@ -47571,15 +47304,6 @@ }, /turf/floor/tiled/white, /area/exodus/medical/medbay4) -"bUO" = ( -/obj/structure/table, -/obj/machinery/alarm{ - dir = 4; - pixel_x = -23 - }, -/obj/machinery/recharger, -/turf/floor/tiled/dark/monotile, -/area/exodus/gateway) "bUP" = ( /obj/item/radio/intercom{ pixel_y = 20 @@ -56223,8 +55947,7 @@ /obj/machinery/network/requests_console{ department = "Engineering"; name = "Engineering RC"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /turf/floor/tiled/steel_grid, /area/exodus/engineering/foyer) @@ -60505,8 +60228,7 @@ /obj/machinery/network/requests_console{ department = "Engineering"; name = "Engineering RC"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /obj/structure/reagent_dispensers/watertank, /turf/floor/tiled/steel_grid, @@ -64327,8 +64049,7 @@ "oWh" = ( /obj/machinery/network/requests_console{ department = "Arrival shuttle"; - pixel_y = -32; - dir = 2 + pixel_y = -32 }, /obj/effect/floor_decal/corner/white{ dir = 10 @@ -64485,6 +64206,10 @@ /obj/machinery/light, /turf/floor/bluegrid, /area/exodus/turret_protected/ai_upload) +"rAK" = ( +/obj/structure/girder/displaced, +/turf/floor/plating, +/area/exodus/maintenance/evahallway) "rNu" = ( /obj/structure/table{ name = "plastic table frame" @@ -87835,15 +87560,15 @@ anX anX anX ayI +anX +anX +anX apD apD -apD -apD -apD -apD -apD -apD -apD +anX +anX +anX +anX aLK aNw aPi @@ -88092,15 +87817,15 @@ aie aie anX axM -apD +anX aBM +auc +auc +auc +aAG +auc +auc aBM -aAB -arS -aCP -aGl -bdL -bUO aLK aNy aPi @@ -88350,15 +88075,15 @@ aie anX axM apD -aAA -aBJ -aCL -aEb -aFA -aGK -aIp -aKl -axv +auc +auc +auc +auc +auc +auc +auc +auc +aLK wBc aPi hgF @@ -88606,16 +88331,16 @@ awy aie anX axM -apD -aAD -aBO -aCO -aEg -aFF -aGR -aIt -aKo -aLG +anX +auc +auc +auc +auc +auc +auc +auc +auc +aLK aNA aPq bGp @@ -88863,16 +88588,16 @@ awy awy anX axM -apD -aAC -aBN -aCN -aEf -aFA -aGN -aIs -aKn -axv +anX +auc +aBM +auc +auc +auc +auc +auc +auc +aLK qHU xFu hgF @@ -89120,15 +88845,15 @@ awv awy atc axM -apD -aBM -aBM +anX +auc +auc aAG -asu -aCQ -aGS +auc +auc aBM -aJc +auc +auc aMb aNp aOQ @@ -89377,15 +89102,15 @@ aQt awy axK axM -apD -apD -apD -apD -apD -apD -apD +anX +anX +rAK +anX +anX +anX +anX azI -apD +anX aMb aNE vcu diff --git a/maps/exodus/exodus.dm b/maps/exodus/exodus.dm index 47e23abbfe0b..676c84a62503 100644 --- a/maps/exodus/exodus.dm +++ b/maps/exodus/exodus.dm @@ -5,6 +5,7 @@ #include "../../mods/content/beekeeping/_beekeeping.dme" #include "../../mods/content/bigpharma/_bigpharma.dme" + #include "../../mods/content/blob/_blob.dme" #include "../../mods/content/corporate/_corporate.dme" #include "../../mods/content/government/_government.dme" #include "../../mods/content/matchmaking/_matchmaking.dme" @@ -20,6 +21,7 @@ #include "../../mods/gamemodes/cult/_cult.dme" #include "../../mods/gamemodes/heist/_heist.dme" #include "../../mods/gamemodes/meteor/_meteor.dme" + #include "../../mods/gamemodes/mercenary/_mercenary.dme" #include "../../mods/gamemodes/ninja/_ninja.dme" #include "../../mods/gamemodes/revolution/_revolution.dme" #include "../../mods/gamemodes/spyvspy/_spyvspy.dme" diff --git a/maps/exodus/exodus_areas.dm b/maps/exodus/exodus_areas.dm index 265523d92cb5..29ba42a4e778 100644 --- a/maps/exodus/exodus_areas.dm +++ b/maps/exodus/exodus_areas.dm @@ -1048,10 +1048,6 @@ icon_state = "teleporter" req_access = list(access_teleporter) -/area/exodus/gateway - name = "\improper Gateway" - icon_state = "teleporter" - // Thunderdome /area/tdome diff --git a/maps/exodus/exodus_cameras.dm b/maps/exodus/exodus_cameras.dm index 1f5d4b51ee31..0c55ca3a3824 100644 --- a/maps/exodus/exodus_cameras.dm +++ b/maps/exodus/exodus_cameras.dm @@ -37,7 +37,7 @@ var/global/const/CAMERA_CHANNEL_ENGINEERING_OUTPOST = "Engineering Outpost" req_access = list(access_heads) /obj/machinery/camera/network/maintenance - preset_channels = list(CAMERA_CAMERA_CHANNEL_ENGINEERING) + preset_channels = list(CAMERA_CHANNEL_ENGINEERING) req_access = list(access_engine) /obj/machinery/camera/xray/security diff --git a/maps/exodus/exodus_jobs.dm b/maps/exodus/exodus_jobs.dm index 6ca8b4d8ab41..9310a431e2b1 100644 --- a/maps/exodus/exodus_jobs.dm +++ b/maps/exodus/exodus_jobs.dm @@ -1,11 +1,3 @@ -/decl/spawnpoint/gateway - name = "Gateway" - spawn_announcement = "has completed translation from offsite gateway" - uid = "spawn_exodus_gateway" - -/obj/abstract/landmark/latejoin/gateway - spawn_decl = /decl/spawnpoint/gateway - /datum/map/exodus default_job_type = /datum/job/standard/assistant default_department_type = /decl/department/civilian diff --git a/maps/ministation/ministation-1.dmm b/maps/ministation/ministation-1.dmm index 68b588d80e87..272d29948511 100644 --- a/maps/ministation/ministation-1.dmm +++ b/maps/ministation/ministation-1.dmm @@ -65,7 +65,7 @@ pixel_y = 24 }, /obj/item/flashlight/lamp/green, -/obj/item/box/fancy/cigarettes/tricord, +/obj/item/box/fancy/cigarettes/covert/tricord, /turf/floor/carpet/blue, /area/ministation/medical) "at" = ( @@ -5716,9 +5716,9 @@ /obj/item/tool/hoe/mini, /obj/item/tool/spade, /obj/item/tool/spade, -/obj/item/honey_frame, -/obj/item/honey_frame, -/obj/item/honey_frame, +/obj/item/hive_frame/crafted, +/obj/item/hive_frame/crafted, +/obj/item/hive_frame/crafted, /turf/floor/tiled, /area/ministation/hydro) "yg" = ( @@ -6040,7 +6040,7 @@ "zj" = ( /obj/effect/floor_decal/corner/beige/half, /obj/structure/table/glass, -/obj/machinery/honey_extractor, +/obj/machinery/centrifuge/mapped, /turf/floor/tiled, /area/ministation/hydro) "zl" = ( diff --git a/maps/ministation/ministation.dm b/maps/ministation/ministation.dm index 4b103d995e43..9c62ac3bdccf 100644 --- a/maps/ministation/ministation.dm +++ b/maps/ministation/ministation.dm @@ -21,6 +21,7 @@ Twice... #include "../../mods/content/scaling_descriptors.dm" #include "../../mods/content/bigpharma/_bigpharma.dme" + #include "../../mods/content/blob/_blob.dme" #include "../../mods/content/corporate/_corporate.dme" #include "../../mods/content/government/_government.dme" #include "../../mods/content/matchmaking/_matchmaking.dme" @@ -34,6 +35,7 @@ Twice... #include "../../mods/gamemodes/cult/_cult.dme" #include "../../mods/gamemodes/heist/_heist.dme" + #include "../../mods/gamemodes/mercenary/_mercenary.dme" #include "../../mods/gamemodes/ninja/_ninja.dme" #include "../../mods/gamemodes/revolution/_revolution.dme" #include "../../mods/gamemodes/traitor/_traitor.dme" diff --git a/maps/modpack_testing/modpack_testing.dm b/maps/modpack_testing/modpack_testing.dm index 842799d1fc45..304d5671e366 100644 --- a/maps/modpack_testing/modpack_testing.dm +++ b/maps/modpack_testing/modpack_testing.dm @@ -5,10 +5,12 @@ #include "../../mods/content/mundane.dm" #include "../../mods/content/scaling_descriptors.dm" - #include "../../mods/content/standard_jobs/_standard_jobs.dme" - #include "../../mods/content/tabloids/_tabloids.dme" + #include "../../mods/content/beekeeping/_beekeeping.dme" #include "../../mods/content/bigpharma/_bigpharma.dme" + #include "../../mods/content/blacksmithy/_blacksmithy.dme" + #include "../../mods/content/blob/_blob.dme" + #include "../../mods/content/breath_holding/_breath_holding.dme" #include "../../mods/content/byond_membership/_byond_membership.dm" #include "../../mods/content/corporate/_corporate.dme" #include "../../mods/content/dungeon_loot/_dungeon_loot.dme" @@ -16,13 +18,16 @@ #include "../../mods/content/generic_shuttles/_generic_shuttles.dme" #include "../../mods/content/government/_government.dme" #include "../../mods/content/inertia/_inertia.dme" + #include "../../mods/content/item_sharpening/_item_sharpening.dme" #include "../../mods/content/matchmaking/_matchmaking.dme" #include "../../mods/content/modern_earth/_modern_earth.dme" #include "../../mods/content/mouse_highlights/_mouse_highlight.dme" #include "../../mods/content/pheromones/_pheromones.dme" #include "../../mods/content/psionics/_psionics.dme" #include "../../mods/content/shackles/_shackles.dme" + #include "../../mods/content/standard_jobs/_standard_jobs.dme" #include "../../mods/content/supermatter/_supermatter.dme" + #include "../../mods/content/tabloids/_tabloids.dme" #include "../../mods/content/xenobiology/_xenobiology.dme" #include "../../mods/content/blacksmithy/_blacksmithy.dme" #include "../../mods/content/item_sharpening/_item_sharpening.dme" @@ -31,27 +36,28 @@ #include "../../mods/gamemodes/cult/_cult.dme" #include "../../mods/gamemodes/heist/_heist.dme" #include "../../mods/gamemodes/meteor/_meteor.dme" + #include "../../mods/gamemodes/mercenary/_mercenary.dme" #include "../../mods/gamemodes/ninja/_ninja.dme" #include "../../mods/gamemodes/revolution/_revolution.dme" - #include "../../mods/gamemodes/traitor/_traitor.dme" #include "../../mods/gamemodes/spyvspy/_spyvspy.dme" + #include "../../mods/gamemodes/traitor/_traitor.dme" #include "../../mods/gamemodes/mixed.dm" #include "../../mods/mobs/borers/_borers.dme" #include "../../mods/mobs/dionaea/_dionaea.dme" - #include "../../mods/species/ascent/_ascent.dme" - #include "../../mods/species/tajaran/_tajaran.dme" - #include "../../mods/species/unathi/_unathi.dme" - #include "../../mods/species/skrell/_skrell.dme" #include "../../mods/species/adherent/_adherent.dme" - #include "../../mods/species/tritonian/_tritonian.dme" + #include "../../mods/species/ascent/_ascent.dme" #include "../../mods/species/drakes/_drakes.dme" #include "../../mods/species/neoavians/_neoavians.dme" + #include "../../mods/species/random_species/_random_species.dme" #include "../../mods/species/serpentid/_serpentid.dme" + #include "../../mods/species/skrell/_skrell.dme" + #include "../../mods/species/tajaran/_tajaran.dme" + #include "../../mods/species/tritonian/_tritonian.dme" + #include "../../mods/species/unathi/_unathi.dme" #include "../../mods/species/utility_frames/_utility_frames.dme" #include "../../mods/species/vox/_vox.dme" - #include "../../mods/species/random_species/_random_species.dme" #define USING_MAP_DATUM /datum/map/modpack_testing diff --git a/maps/random_ruins/exoplanet_ruins/datacapsule/datacapsule.dm b/maps/random_ruins/exoplanet_ruins/datacapsule/datacapsule.dm index 62b119ba2ef2..5fbaa19d44b8 100644 --- a/maps/random_ruins/exoplanet_ruins/datacapsule/datacapsule.dm +++ b/maps/random_ruins/exoplanet_ruins/datacapsule/datacapsule.dm @@ -49,8 +49,8 @@ desc = "Impact resistant server rack. You might be able to pry a disk out." var/disk_looted -/obj/structure/backup_server/attackby(obj/item/W, mob/user, var/click_params) - if(IS_CROWBAR(W)) +/obj/structure/backup_server/attackby(obj/item/used_item, mob/user, var/click_params) + if(IS_CROWBAR(used_item)) if(disk_looted) to_chat(user, SPAN_WARNING("There's no disk in \the [src].")) else diff --git a/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dmm b/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dmm index ea2408b5f99e..b5ae8b072cda 100644 --- a/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dmm +++ b/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dmm @@ -28,9 +28,6 @@ }, /turf/floor/fixed/alium, /area/map_template/hydrobase/station/growX) -"ag" = ( -/turf/floor/tiled/dark, -/area/map_template/hydrobase/station/growX) "ah" = ( /obj/machinery/portable_atmospherics/powered/scrubber, /obj/structure/catwalk, @@ -174,9 +171,6 @@ /mob/living/simple_animal/hostile/malf_drone/hydro, /turf/floor/bluegrid, /area/map_template/hydrobase/station/growD) -"aE" = ( -/turf/floor/tiled/white, -/area/map_template/hydrobase/station/growA) "aF" = ( /obj/machinery/firealarm{ dir = 8; @@ -393,9 +387,6 @@ /obj/item/seeds/wheatseed, /turf/floor/fixed/alium, /area/map_template/hydrobase/station/growF) -"bi" = ( -/turf/floor/tiled/white, -/area/map_template/hydrobase/station/growD) "bj" = ( /obj/machinery/light{ dir = 4; @@ -1136,9 +1127,6 @@ /obj/item/seeds/grassseed, /turf/floor/fixed/alium, /area/map_template/hydrobase/station/growC) -"dj" = ( -/turf/floor/tiled/white, -/area/map_template/hydrobase/station/growC) "dk" = ( /obj/structure/catwalk, /obj/machinery/portable_atmospherics/hydroponics, @@ -1517,7 +1505,7 @@ /area/map_template/hydrobase/station/growA) "eh" = ( /obj/structure/catwalk, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /obj/item/knife/kitchen, /obj/structure/table/glass/pglass, /obj/item/ashtray, @@ -2278,9 +2266,6 @@ /obj/item/seeds/towercap, /turf/floor/fixed/alium, /area/map_template/hydrobase/station/growB) -"fT" = ( -/turf/floor/tiled/white, -/area/map_template/hydrobase/station/growB) "fU" = ( /obj/machinery/light{ dir = 4; @@ -2874,7 +2859,7 @@ aD cm cw cP -dj +cR cP dX cm @@ -2989,7 +2974,7 @@ au aC aQ aC -bi +aQ aQ aP aQ @@ -3005,7 +2990,7 @@ eQ fi fj fi -fT +fi fx fi fj @@ -3274,26 +3259,26 @@ al al ap aq -aE -aE -aE -aE +av +av +av +av aq bR -aE -aE -aE -aE +av +av +av +av dt cU -aE -aE +av +av cX bR aq -aE -aE -aE +av +av +av aT aq ef @@ -3314,12 +3299,12 @@ al al ap aq -aE -aE -aE -aE +av +av +av +av bt -aE +av bS bG bG @@ -3331,12 +3316,12 @@ bG bG bG fo -aE +av bt -aE -aE -aE -aE +av +av +av +av aq ef al @@ -3355,7 +3340,7 @@ al ao aq av -aE +av aS aS bk @@ -3377,7 +3362,7 @@ bu fV ef ef -aE +av av aq gI @@ -3396,9 +3381,9 @@ al al ap aq -aE -aE -aE +av +av +av bl bv bG @@ -3416,9 +3401,9 @@ bT bG bv cW -aE -aE -aE +av +av +av aq ef al @@ -3439,26 +3424,26 @@ al ap aq aT -aE -aE -aE +av +av +av aq aq -aE -aE -aE +av +av +av cX dw -aE -aE -aE -aE +av +av +av +av aq aq -aE -aE -aE -aE +av +av +av +av aq ef al @@ -3493,8 +3478,8 @@ dx dI eg cU -aE -aE +av +av aq fL ef @@ -3881,7 +3866,7 @@ ab ac ad ad -ag +ad ai ak ak diff --git a/maps/random_ruins/exoplanet_ruins/playablecolony/colony.dmm b/maps/random_ruins/exoplanet_ruins/playablecolony/colony.dmm index 7008a642da99..f98b8e3b8950 100644 --- a/maps/random_ruins/exoplanet_ruins/playablecolony/colony.dmm +++ b/maps/random_ruins/exoplanet_ruins/playablecolony/colony.dmm @@ -1550,8 +1550,8 @@ pixel_y = 20 }, /obj/structure/closet, -/obj/item/clothing/jumpsuit/wetsuit, -/obj/item/clothing/jumpsuit/wetsuit, +/obj/item/clothing/costume/wetsuit, +/obj/item/clothing/costume/wetsuit, /obj/item/clothing/costume/savage_hunter, /obj/item/clothing/costume/savage_hunter/female, /obj/item/clothing/shirt/harness, diff --git a/maps/shaded_hills/areas/_areas.dm b/maps/shaded_hills/areas/_areas.dm index e31eff6ce28e..bdf893f4f7e0 100644 --- a/maps/shaded_hills/areas/_areas.dm +++ b/maps/shaded_hills/areas/_areas.dm @@ -36,5 +36,5 @@ ) description = "Birds and insects call from the grasses, and a cool wind gusts from across the river." area_blurb_category = /area/shaded_hills/outside - interior_ambient_light_modifier = -0.3 + interior_ambient_light_modifier = -0.4 area_flags = AREA_FLAG_EXTERNAL | AREA_FLAG_IS_BACKGROUND diff --git a/maps/shaded_hills/areas/downlands.dm b/maps/shaded_hills/areas/downlands.dm index 05865fe13c78..76d91cce821e 100644 --- a/maps/shaded_hills/areas/downlands.dm +++ b/maps/shaded_hills/areas/downlands.dm @@ -23,7 +23,7 @@ /area/shaded_hills/inn/porch name = "\improper Inn Porch" - interior_ambient_light_modifier = -0.3 // night is pitch-black on the porch + interior_ambient_light_modifier = -0.4 // night is pitch-black on the porch sound_env = FOREST /area/shaded_hills/stable @@ -42,7 +42,7 @@ /area/shaded_hills/farmhouse/porch name = "\improper Farmhouse Porch" - interior_ambient_light_modifier = -0.3 // night is pitch-black on the porch + interior_ambient_light_modifier = -0.4 // night is pitch-black on the porch sound_env = FOREST /area/shaded_hills/slaughterhouse @@ -68,7 +68,7 @@ /area/shaded_hills/general_store/porch name = "\improper General Store Porch" - interior_ambient_light_modifier = -0.3 // night is pitch-black on the porch + interior_ambient_light_modifier = -0.4 // night is pitch-black on the porch sound_env = FOREST /area/shaded_hills/shrine diff --git a/maps/shaded_hills/areas/grassland.dm b/maps/shaded_hills/areas/grassland.dm index 803f9a5e9200..ae0827242f20 100644 --- a/maps/shaded_hills/areas/grassland.dm +++ b/maps/shaded_hills/areas/grassland.dm @@ -25,6 +25,8 @@ 'sound/ambience/ominous2.ogg', 'sound/ambience/ominous3.ogg', ) + // hopefully the sound environment makes this sound nicer? + forced_ambience = list('sound/ambience/shore.ogg') /area/shaded_hills/outside/poi name = "Deep Grassland" @@ -34,6 +36,7 @@ color = COLOR_BLUE description = "The soft susurration of running water mingles with the hum of insects and croak of frogs." area_blurb_category = /area/shaded_hills/outside/river + forced_ambience = list('sound/ambience/shore.ogg') /area/shaded_hills/outside/river/get_additional_fishing_results() var/static/list/additional_fishing_results = list( diff --git a/maps/shaded_hills/areas/swamp.dm b/maps/shaded_hills/areas/swamp.dm index 0b4110cf2b6d..7c1de587f446 100644 --- a/maps/shaded_hills/areas/swamp.dm +++ b/maps/shaded_hills/areas/swamp.dm @@ -10,9 +10,11 @@ /area/shaded_hills/outside/swamp name = "Swamp" description = "The reek of stagnant water and the chirp of insects filter through the humid air." + forced_ambience = list('sound/ambience/marshy.ogg') /area/shaded_hills/outside/swamp/poi name = "Deep Swamp" + forced_ambience = list('sound/ambience/marshy.ogg') /area/shaded_hills/outside/river/swamp name = "Swampy River" @@ -20,6 +22,7 @@ /area/shaded_hills/caves/swamp name = "Southern Deep Tunnels" + forced_ambience = list('sound/ambience/marshy.ogg') /area/shaded_hills/caves/unexplored/swamp name = "Trackless Deeps - Far South" diff --git a/maps/shaded_hills/areas/woods.dm b/maps/shaded_hills/areas/woods.dm index 73c262300a6f..1ef25b471ca7 100644 --- a/maps/shaded_hills/areas/woods.dm +++ b/maps/shaded_hills/areas/woods.dm @@ -4,6 +4,7 @@ /area/shaded_hills/outside/river/lake name = "Woodland Lake" + forced_ambience = list('sound/ambience/shore.ogg') /area/shaded_hills/outside/river/lake/get_additional_fishing_results() var/static/list/additional_fishing_results = list( @@ -33,5 +34,6 @@ /area/shaded_hills/forester_hut name = "\improper Foresters' Hut" + sound_env = STANDARD_STATION fishing_failure_prob = 100 fishing_results = list() diff --git a/maps/shaded_hills/levels/random_map.dm b/maps/shaded_hills/levels/random_map.dm index 790e0c156fa7..d51ed84765b3 100644 --- a/maps/shaded_hills/levels/random_map.dm +++ b/maps/shaded_hills/levels/random_map.dm @@ -81,20 +81,47 @@ /obj/structure/flora/tree/hardwood/walnut = 8, /obj/structure/flora/tree/hardwood/yew = 8, /obj/structure/flora/tree/hardwood/mahogany = 8, - /obj/structure/flora/bush/pointybush = 5, + /obj/structure/flora/bush/pointybush = 3, /obj/structure/flora/tree/dead/walnut = 1, /obj/structure/flora/tree/dead/yew = 1, /obj/structure/flora/tree/dead/mahogany = 1, + /obj/structure/flora/stump/tree/walnut = 1, + /obj/structure/flora/stump/tree/yew = 1, + /obj/structure/flora/stump/tree/mahogany = 1, /obj/structure/flora/bush/genericbush = 1, /obj/structure/flora/bush/grassybush = 1, /obj/structure/flora/bush/stalkybush = 1, /obj/structure/flora/bush/reedbush = 1, /obj/structure/flora/bush/fernybush = 1, + /atom/movable/spawn_litter = 1, ) /datum/random_map/noise/forage/shaded_hills/woods/New() forage["grass"] |= list( "ginseng", - "foxglove" + "foxglove", + /atom/movable/spawn_litter ) + forage["riverbank"] = list(/atom/movable/spawn_litter) + ..() + +/// Helper type to spawn random forest litter. +/atom/movable/spawn_litter + name = "forest litter spawner" + is_spawnable_type = FALSE + simulated = FALSE + var/list/spawn_type = list( + /obj/effect/decal/cleanable/plant_bits = 5, + /atom/movable/spawn_boulder/rock = 2, + /obj/item/rock/flint = 2, + /atom/movable/spawn_boulder = 1 + ) + +/atom/movable/spawn_litter/Initialize() ..() + if(isturf(loc)) + if(islist(spawn_type)) + spawn_type = pickweight(spawn_type) + if(spawn_type) + new spawn_type(loc) + return INITIALIZE_HINT_QDEL \ No newline at end of file diff --git a/maps/shaded_hills/shaded_hills-caverns.dmm b/maps/shaded_hills/shaded_hills-caverns.dmm index 38778d997cd0..1916bb3b5d22 100644 --- a/maps/shaded_hills/shaded_hills-caverns.dmm +++ b/maps/shaded_hills/shaded_hills-caverns.dmm @@ -37,10 +37,6 @@ "Ng" = ( /turf/wall/natural/basalt/shaded_hills, /area/shaded_hills/caves/deep) -"SH" = ( -/obj/random/hostile/cave, -/turf/floor/rock/basalt, -/area/shaded_hills/caves/deep/poi) (1,1,1) = {" mZ @@ -7759,7 +7755,7 @@ um MT MT MT -SH +az MT MT MT @@ -12142,7 +12138,7 @@ um um um MT -SH +az um um um @@ -14665,7 +14661,7 @@ um um MT MT -SH +az MT MT MT diff --git a/maps/shaded_hills/shaded_hills-dungeon.dmm b/maps/shaded_hills/shaded_hills-dungeon.dmm index 61a7c7421733..b50e7b8b0385 100644 --- a/maps/shaded_hills/shaded_hills-dungeon.dmm +++ b/maps/shaded_hills/shaded_hills-dungeon.dmm @@ -512,14 +512,6 @@ }, /turf/floor/path/running_bond/basalt, /area/shaded_hills/caves/dungeon/poi) -"JA" = ( -/obj/structure/door/ebony, -/obj/abstract/landmark/lock_preset{ - lock_preset_id = "sunken keep"; - name = "sunken keep locked door" - }, -/turf/floor/path/herringbone/basalt, -/area/shaded_hills/caves/dungeon/poi) "Kq" = ( /obj/structure/closet/crate/chest/ebony, /obj/item/cash/imperial/regalis, @@ -9713,7 +9705,7 @@ Vk bD bD bD -JA +GA oF Fx Fx @@ -9865,7 +9857,7 @@ gy bD bD bD -JA +GA oF oF Fx @@ -10018,7 +10010,7 @@ bD bD bD it -JA +GA oF it it @@ -10459,8 +10451,8 @@ it it it it -JA -JA +GA +GA it it it @@ -11388,7 +11380,7 @@ oF it bD bD -JA +GA jh bD bD @@ -11540,7 +11532,7 @@ oF it bD bD -JA +GA jh bD bD @@ -12148,7 +12140,7 @@ oF it bD bD -JA +GA jh bD bD @@ -12300,7 +12292,7 @@ oF it bD bD -JA +GA jh bD bD @@ -14738,7 +14730,7 @@ lo jh bD jh -JA +GA bD bD zA @@ -14890,7 +14882,7 @@ lo jh bD jh -JA +GA bD bD zA @@ -16556,15 +16548,15 @@ bD it it it -JA -JA +GA +GA it it it it it -JA -JA +GA +GA it it it @@ -16572,8 +16564,8 @@ it it it it -JA -JA +GA +GA it it bD @@ -18211,7 +18203,7 @@ bD ok bD bD -JA +GA bD bD bD @@ -18363,7 +18355,7 @@ bD bD bD bD -JA +GA bD bD bD diff --git a/maps/shaded_hills/shaded_hills-grassland.dmm b/maps/shaded_hills/shaded_hills-grassland.dmm index 4fa441d975f4..789f7d766c7b 100644 --- a/maps/shaded_hills/shaded_hills-grassland.dmm +++ b/maps/shaded_hills/shaded_hills-grassland.dmm @@ -140,10 +140,6 @@ "sS" = ( /turf/floor/mud/water, /area/shaded_hills/caves/unexplored/south) -"sT" = ( -/obj/abstract/force_fluid_flow/north, -/turf/floor/mud/water/deep, -/area/shaded_hills/outside/river) "te" = ( /turf/unsimulated/mask, /area/shaded_hills/caves/unexplored/south) @@ -19520,7 +19516,7 @@ Gh Gh My My -sT +qj lC lC lC @@ -19538,7 +19534,7 @@ lC lC lC qj -sT +qj My Gh Gh @@ -19580,12 +19576,12 @@ My My My My -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj My My My @@ -19670,9 +19666,9 @@ Gh Gh Gh My -sT -sT -sT +qj +qj +qj lC lC lC @@ -19689,9 +19685,9 @@ lC lC lC lC -sT -sT -sT +qj +qj +qj My My Gh @@ -19725,23 +19721,23 @@ Gh Gh My My -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My My Gh @@ -19761,14 +19757,14 @@ JN My My My -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj My My My @@ -19779,15 +19775,15 @@ My Gh My My -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj My Gh Gh @@ -19822,9 +19818,9 @@ My My My My -sT -sT -sT +qj +qj +qj lC lC lC @@ -19841,11 +19837,11 @@ lC lC lC lC -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj My My Gh @@ -19875,27 +19871,27 @@ Gh Gh My My -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My My My @@ -19909,38 +19905,38 @@ Gh Xd vX Xd -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My My My @@ -19968,15 +19964,15 @@ My My My My -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj lC lC lC @@ -19994,12 +19990,12 @@ lC lC lC My -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj My My My @@ -20025,13 +20021,13 @@ Gh Gh Gh My -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj My My My @@ -20043,13 +20039,13 @@ My My My My -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj My My My @@ -20061,42 +20057,42 @@ My Xd vX Xd -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My Gh Gh @@ -20115,19 +20111,19 @@ My My My My -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My lC lC @@ -20148,15 +20144,15 @@ lC Gh My My -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj My My My @@ -20178,10 +20174,10 @@ Gh Gh My My -sT -sT -sT -sT +qj +qj +qj +qj My My Gh @@ -20198,57 +20194,57 @@ Gh My My My -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj EE EE Xd -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My Gh Gh @@ -20260,21 +20256,21 @@ zp zp Gh My -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj +qj My My My @@ -20307,18 +20303,18 @@ My My My My -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj My My My -sT -sT +qj +qj My Gh Gh @@ -20353,38 +20349,38 @@ Gh My My My -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj JN EE EE EE JN -sT -sT +qj +qj My My My -sT -sT -sT +qj +qj +qj My My -sT -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj +qj My Gh My @@ -20412,14 +20408,14 @@ zp Gh Gh My -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj My My My @@ -20464,14 +20460,14 @@ My My My My -sT -sT -sT -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj +qj +qj +qj My Gh Gh @@ -20509,15 +20505,15 @@ My My My My -sT -sT -sT -sT -sT +qj +qj +qj +qj +qj EE vX EE -sT +qj My My Gh @@ -20532,9 +20528,9 @@ My My My My -sT -sT -sT +qj +qj +qj My My Gh diff --git a/maps/shaded_hills/shaded_hills-inn.dmm b/maps/shaded_hills/shaded_hills-inn.dmm index df16c776c0b2..11b1e507fb20 100644 --- a/maps/shaded_hills/shaded_hills-inn.dmm +++ b/maps/shaded_hills/shaded_hills-inn.dmm @@ -49,6 +49,10 @@ /area/shaded_hills/shrine/kitchen) "cl" = ( /obj/structure/table/wood/ebony, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -4 + }, /turf/floor/wood/rough/walnut, /area/shaded_hills/farmhouse) "cq" = ( @@ -71,7 +75,11 @@ /turf/floor/grass, /area/shaded_hills/outside/shrine) "dr" = ( -/obj/structure/table/desk/dresser/ebony, +/obj/structure/chair/rustic{ + dir = 4; + pixel_x = 16; + pixel_y = 4 + }, /turf/floor/wood/walnut, /area/shaded_hills/inn) "dx" = ( @@ -84,8 +92,14 @@ }, /turf/floor/wood/walnut, /area/shaded_hills/inn) +"dD" = ( +/obj/item/towel/doormat/flat{ + dir = 1 + }, +/turf/floor/wood/rough/walnut, +/area/shaded_hills/inn/porch) "dH" = ( -/turf/wall/log/walnut/shutter, +/turf/wall/wattle/daubed/plastered/framed/walnut/shutter/open, /area/shaded_hills/general_store) "dK" = ( /obj/structure/table/wood/ebony, @@ -101,6 +115,14 @@ }, /turf/floor/wood/walnut, /area/shaded_hills/inn) +"dX" = ( +/obj/structure/chair/rustic_fancy/ebony{ + dir = 1; + pixel_y = 20; + pixel_x = 6 + }, +/turf/floor/carpet, +/area/shaded_hills/inn) "ev" = ( /obj/structure/closet/crate/chest/ebony, /turf/floor/path/herringbone/basalt, @@ -116,6 +138,11 @@ /area/shaded_hills/general_store) "eM" = ( /obj/structure/table/end, +/obj/structure/wall_sconce/lantern{ + dir = 1; + pixel_y = 10; + start_lit = 1 + }, /turf/floor/wood/walnut, /area/shaded_hills/farmhouse) "fg" = ( @@ -142,7 +169,7 @@ /turf/floor/mud, /area/shaded_hills/outside/shrine) "fw" = ( -/turf/wall/brick/basalt/shutter, +/turf/wall/brick/basalt/shutter/open, /area/shaded_hills/slaughterhouse) "fK" = ( /obj/structure/cask_rack/large/mapped, @@ -249,9 +276,6 @@ dir = 4; start_lit = 1 }, -/obj/structure/chair/rustic_fancy/ebony{ - dir = 1 - }, /turf/floor/carpet, /area/shaded_hills/inn) "hc" = ( @@ -311,7 +335,7 @@ /turf/floor/wood/walnut, /area/shaded_hills/general_store) "iq" = ( -/turf/wall/log/walnut/shutter/open, +/turf/wall/wattle/daubed/plastered/framed/walnut/shutter/open, /area/shaded_hills/inn/kitchen) "iC" = ( /obj/structure/door/walnut{ @@ -337,7 +361,7 @@ }, /area/shaded_hills/outside/shrine) "iX" = ( -/turf/wall/log/walnut/shutter/open, +/turf/wall/wattle/daubed/plastered/framed/walnut/shutter/open, /area/shaded_hills/inn) "iZ" = ( /obj/structure/fire_source/fireplace/basalt, @@ -385,10 +409,6 @@ /turf/floor/dirt, /area/shaded_hills/outside/shrine) "ke" = ( -/obj/structure/wall_sconce/lantern{ - dir = 1; - pixel_y = 10 - }, /obj/item/chems/glass/bucket/wood, /turf/floor/dirt, /area/shaded_hills/outside/downlands) @@ -411,6 +431,15 @@ }, /turf/floor/wood/walnut, /area/shaded_hills/inn) +"ls" = ( +/obj/item/towel/doormat/flat{ + dir = 1 + }, +/turf/floor/dirt, +/area/shaded_hills/outside/shrine) +"ly" = ( +/turf/wall/wattle/daubed/walnut, +/area/shaded_hills/inn) "lz" = ( /obj/structure/table/wood/reinforced/ebony, /obj/item/knife/kitchen/cleaver/bronze, @@ -456,6 +485,10 @@ "ml" = ( /obj/structure/table/wood/ebony, /obj/item/shears, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -5 + }, /turf/floor/wood/rough/walnut, /area/shaded_hills/farmhouse) "mD" = ( @@ -509,6 +542,11 @@ /obj/item/chems/glass/bucket/wood, /turf/floor/path/basalt, /area/shaded_hills/slaughterhouse) +"nS" = ( +/obj/abstract/landmark/lock_preset/shaded_hills/shrine, +/obj/structure/door/mahogany, +/turf/floor/wood/rough/walnut, +/area/shaded_hills/shrine) "ol" = ( /obj/structure/railing/mapped/wooden/walnut, /turf/floor/mud, @@ -519,6 +557,9 @@ }, /turf/floor/path/basalt, /area/shaded_hills/stable) +"oL" = ( +/turf/wall/wattle/daubed/plastered/framed/walnut, +/area/shaded_hills/farmhouse) "oN" = ( /turf/wall/log/walnut, /area/shaded_hills/shrine/kitchen) @@ -571,6 +612,9 @@ "qP" = ( /turf/floor/wood/walnut, /area/shaded_hills/farmhouse) +"qV" = ( +/turf/wall/wattle/daubed/plastered, +/area/shaded_hills/shrine) "qW" = ( /obj/structure/town_bell, /turf/floor/path/basalt, @@ -610,6 +654,13 @@ /obj/item/cash/imperial/crown, /turf/floor/carpet, /area/shaded_hills/inn) +"rp" = ( +/obj/structure/divider/extended/wood/ebony{ + dir = 4; + pixel_x = 16 + }, +/turf/floor/wood/walnut, +/area/shaded_hills/inn) "rv" = ( /obj/structure/table/wood/ebony, /obj/item/chems/glass/handmade/bottle, @@ -728,6 +779,9 @@ /obj/abstract/landmark/start/shaded_hills/farmer, /turf/floor/wood/walnut, /area/shaded_hills/farmhouse) +"uD" = ( +/turf/wall/wattle/daubed/plastered/framed/mahogany/shutter/open, +/area/shaded_hills/shrine) "uJ" = ( /turf/floor/wood/walnut, /area/shaded_hills/general_store) @@ -800,6 +854,13 @@ }, /turf/floor/wood/rough/walnut, /area/shaded_hills/stable) +"wr" = ( +/turf/wall/wattle/daubed/plastered/framed/mahogany, +/area/shaded_hills/shrine) +"wF" = ( +/obj/structure/banner_frame/sign/store, +/turf/floor/dirt, +/area/shaded_hills/outside/downlands) "xa" = ( /obj/item/stack/material/bar/mapped/iron/thirty, /obj/structure/table/wood/reinforced/ebony, @@ -836,6 +897,10 @@ /area/shaded_hills/outside/shrine) "xW" = ( /obj/structure/reagent_dispensers/compost_bin/walnut, +/obj/structure/wall_sconce/lantern{ + dir = 1; + pixel_y = 10 + }, /turf/floor/dirt, /area/shaded_hills/outside/downlands) "ya" = ( @@ -860,13 +925,16 @@ /obj/item/seeds/extracted/cabbage, /turf/floor/wood/rough/walnut, /area/shaded_hills/storehouse) +"yw" = ( +/turf/wall/wattle/daubed/walnut, +/area/shaded_hills/stable) "yx" = ( /obj/structure/table/marble, /obj/item/staff/broom, /turf/floor/path/herringbone/basalt, /area/shaded_hills/shrine) "yz" = ( -/turf/wall/brick/basalt, +/turf/wall/wattle/daubed/plastered/walnut, /area/shaded_hills/general_store) "yJ" = ( /obj/structure/chair/rustic{ @@ -884,7 +952,7 @@ /area/shaded_hills/outside/downlands/poi) "zj" = ( /obj/structure/table/marble, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /obj/item/knife/kitchen/cleaver/bronze, /turf/floor/path/herringbone/basalt, /area/shaded_hills/inn/kitchen) @@ -906,7 +974,7 @@ /turf/floor/grass, /area/shaded_hills/outside/shrine) "zA" = ( -/turf/wall/log/walnut, +/turf/wall/wattle/daubed/plastered/framed/walnut, /area/shaded_hills/inn/kitchen) "zH" = ( /obj/structure/produce_bin/walnut, @@ -954,6 +1022,9 @@ "Ay" = ( /turf/floor/mud/water, /area/shaded_hills/outside/downlands) +"AA" = ( +/turf/wall/wattle/daubed/plastered/framed/walnut, +/area/shaded_hills/inn) "AE" = ( /obj/structure/door/walnut, /obj/abstract/landmark/lock_preset/shaded_hills/shrine, @@ -962,6 +1033,14 @@ "AG" = ( /obj/structure/table/wood/ebony, /obj/item/bag/sack, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = 5 + }, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -16 + }, /turf/floor/wood/rough/walnut, /area/shaded_hills/farmhouse) "AS" = ( @@ -1013,6 +1092,10 @@ /obj/structure/wall_sconce/lantern, /turf/floor/wood/rough/walnut, /area/shaded_hills/farmhouse/porch) +"Cg" = ( +/obj/structure/banner_frame/sign/tavern, +/turf/floor/dirt, +/area/shaded_hills/outside/downlands) "Cj" = ( /obj/item/stack/material/log/mapped/walnut/twenty, /turf/floor/path/herringbone/basalt, @@ -1028,6 +1111,9 @@ "CV" = ( /turf/floor/wood/rough/walnut, /area/shaded_hills/shrine) +"Dk" = ( +/turf/wall/wattle/daubed/walnut, +/area/shaded_hills/shrine) "Dl" = ( /turf/floor/wood/rough/walnut, /area/shaded_hills/farmhouse/porch) @@ -1055,7 +1141,7 @@ /turf/floor/wood/rough/walnut, /area/shaded_hills/shrine) "Ee" = ( -/turf/wall/log/walnut, +/turf/wall/wattle/daubed/plastered/walnut, /area/shaded_hills/inn) "Ep" = ( /obj/structure/wall_sconce/lantern{ @@ -1171,6 +1257,12 @@ /obj/item/bag/sack, /turf/floor/path/basalt, /area/shaded_hills/slaughterhouse) +"GN" = ( +/obj/item/towel/doormat/flat{ + dir = 1 + }, +/turf/floor/path/basalt, +/area/shaded_hills/stable) "GQ" = ( /obj/structure/wall_sconce/lantern{ dir = 1; @@ -1233,7 +1325,10 @@ /turf/floor/path/herringbone/basalt, /area/shaded_hills/shrine/kitchen) "HM" = ( -/obj/structure/reagent_dispensers/barrel/ebony/water, +/obj/structure/cask_rack/large/mapped, +/obj/structure/reagent_dispensers/barrel/cask/ebony/water, +/obj/structure/reagent_dispensers/barrel/cask/ebony/oil, +/obj/structure/reagent_dispensers/barrel/cask/ebony, /turf/floor/path/basalt, /area/shaded_hills/stable) "HP" = ( @@ -1274,10 +1369,11 @@ /turf/floor/wood/rough/walnut, /area/shaded_hills/storehouse) "IQ" = ( -/turf/wall/log/walnut/shutter/open, +/turf/wall/wattle/daubed/plastered/framed/walnut/shutter/open, /area/shaded_hills/farmhouse) "IS" = ( -/turf/floor/mud/water/deep, +/obj/structure/reagent_dispensers/barrel/ebony/water, +/turf/floor/path/basalt, /area/shaded_hills/slaughterhouse) "IV" = ( /obj/abstract/landmark/latejoin, @@ -1295,8 +1391,11 @@ /turf/floor/grass, /area/shaded_hills/outside/shrine) "Jo" = ( -/obj/item/flame/candle/handmade, /obj/structure/table/end/alt/ebony, +/obj/structure/divider/extended/wood/ebony{ + dir = 4; + pixel_x = 16 + }, /turf/floor/wood/walnut, /area/shaded_hills/inn) "Jp" = ( @@ -1355,8 +1454,9 @@ /turf/wall/log/walnut/shutter/open, /area/shaded_hills/shrine) "KD" = ( -/obj/structure/chair/rustic{ - dir = 1 +/obj/structure/table/desk/dresser/ebony, +/obj/item/candelabra/filled{ + pixel_y = 9 }, /turf/floor/wood/walnut, /area/shaded_hills/inn) @@ -1392,6 +1492,14 @@ "LH" = ( /obj/structure/table/wood/ebony, /obj/item/chems/glass/bucket/wood, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = 6 + }, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -15 + }, /turf/floor/wood/rough/walnut, /area/shaded_hills/farmhouse) "LK" = ( @@ -1404,7 +1512,7 @@ /turf/floor/grass, /area/shaded_hills/outside/downlands) "LN" = ( -/turf/wall/log/walnut, +/turf/wall/wattle/daubed/walnut, /area/shaded_hills/farmhouse) "Mb" = ( /obj/abstract/landmark/start/shaded_hills/traveller/learned, @@ -1425,7 +1533,6 @@ /turf/floor/path/basalt, /area/shaded_hills/outside/downlands) "My" = ( -/obj/structure/table/desk/ebony, /obj/item/chems/glass/inkwell/quilled{ pixel_x = 12; pixel_y = 8 @@ -1433,6 +1540,7 @@ /obj/item/hourglass{ pixel_y = 12 }, +/obj/structure/table/desk/ebony/right, /turf/floor/carpet, /area/shaded_hills/inn) "MT" = ( @@ -1502,7 +1610,7 @@ /turf/floor/straw, /area/shaded_hills/stable) "PG" = ( -/obj/structure/door/walnut, +/obj/structure/door/mahogany, /turf/floor/wood/mahogany, /area/shaded_hills/shrine) "PQ" = ( @@ -1518,7 +1626,7 @@ /turf/floor/wood/rough/walnut, /area/shaded_hills/storehouse) "Qa" = ( -/obj/structure/reagent_dispensers/barrel/ebony/oil, +/obj/structure/working/grindstone, /turf/floor/path/basalt, /area/shaded_hills/stable) "Qb" = ( @@ -1646,11 +1754,6 @@ /turf/floor/path/basalt, /area/shaded_hills/stable) "SU" = ( -/obj/structure/wall_sconce/lantern{ - dir = 1; - pixel_y = 10; - start_lit = 1 - }, /obj/structure/table/desk/dresser, /obj/item/flame/candle/handmade{ pixel_y = 12 @@ -1770,7 +1873,7 @@ /turf/floor/dirt, /area/shaded_hills/outside/downlands/poi) "Wg" = ( -/turf/wall/log/walnut, +/turf/wall/wattle/daubed/plastered/framed/walnut, /area/shaded_hills/general_store) "Wh" = ( /obj/structure/table/wood/ebony, @@ -9265,15 +9368,15 @@ TR TR TR TR -Ee -Ee +AA +AA iX -Ee -Ee -Ee +AA +AA +AA iX -Ee -Ee +AA +AA TR HI HI @@ -9282,7 +9385,7 @@ TR EV Ic EV -TR +wF Wg Wg dH @@ -9409,23 +9512,23 @@ HI HI TR cx -Ee -Ee +AA +AA iX -Ee -Ee -Ee +AA +AA +AA iX -Ee -Ee +AA +AA th RB gn -Ee +ly th RB gn -Ee +AA TR TR HI @@ -9561,23 +9664,23 @@ HI HI TR cx -Ee -Jo +AA +Rh KD sJ Ee th RB gn -Ee +ly af RB Td -Ee +ly af RB Td -Ee +AA GV TR HI @@ -9713,23 +9816,23 @@ HI HI TR cx -Ee -Rh +AA ZY +dr ZY Ee af RB Td -Ee -Ee +ly +ly Jz -Ee -Ee -Ee +ly +ly +ly Jz -Ee -Ee +ly +AA Hv TR TR @@ -9865,15 +9968,15 @@ HI HI TR cx +AA Ee -dr -ZY -ZY -Ee +Jo +rp Ee +ly Jz -Ee -Ee +ly +ly ZY ZY ZY @@ -9894,9 +9997,9 @@ Mp Wg GQ uJ -Wg +yz iC -Wg +yz Wg HI UY @@ -10017,9 +10120,9 @@ HI HI TR cx -Ee +AA My -Qb +dX ZY Ee Jp @@ -10033,7 +10136,7 @@ ZY Qb Qb Qb -Ee +AA rc TR TR @@ -10046,7 +10149,7 @@ EV Wg uJ uJ -Wg +yz uJ BL dH @@ -10169,7 +10272,7 @@ HI HI TR cx -Ee +AA rg hb ZY @@ -10185,7 +10288,7 @@ ZY ZY Im ZY -Ee +AA TR TR HI @@ -10195,7 +10298,7 @@ TR EV Ic EV -yz +Wg yz yz yz @@ -10321,15 +10424,15 @@ HI HI TR cx -Ee +AA iX +AA Ee Ee -Ee -Ee -Ee -Ee -Ee +ly +ly +ly +ly IC Qb Qb @@ -10337,7 +10440,7 @@ Ee Ee Ee Ee -Ee +AA TR TR TR @@ -10347,7 +10450,7 @@ TR EV Ic EV -yz +Wg wh uM yz @@ -10481,7 +10584,7 @@ vA Gc RO No -Ee +ly Ev Qb WG @@ -10489,7 +10592,7 @@ Ee ZY Pe kI -Ee +AA mJ qf WD @@ -10499,7 +10602,7 @@ HI TR Ic EV -yz +Wg bz uM SF @@ -10651,10 +10754,10 @@ TR EV Ic EV -yz -yz -yz -yz +Wg +Wg +Wg +Wg dH Wg Wg @@ -10793,7 +10896,7 @@ dN ZY nx nx -Ee +AA Jw dK JU @@ -10945,7 +11048,7 @@ BG ZY Er Er -Ee +AA Jw dK JU @@ -11101,18 +11204,18 @@ iX Yg Sw JU -TR +Cg TR qW EV Ic EV TR -xH +fw Xr gc Gw -xH +fw HI HI oO @@ -11249,7 +11352,7 @@ BG ZY uk uk -Ee +AA hZ Yg Yg @@ -11402,7 +11505,7 @@ rY Rg Rg Qs -Yg +dD Yg Yg Ic @@ -11697,7 +11800,7 @@ FH WV Gc fK -qG +Ee pi Ly Wl @@ -11842,14 +11945,14 @@ HI TR cx TR +AA qG qG qG qG qG -qG -qG -qG +Ee +Ee Ee Ee Ee @@ -11994,7 +12097,7 @@ TR TR cx TR -Ee +AA gn ZY zO @@ -12009,7 +12112,7 @@ Ee ZY Rp nJ -Ee +AA Jw dK JU @@ -12022,7 +12125,7 @@ EV TR xH xH -xH +fw xH xH HI @@ -12146,7 +12249,7 @@ TR TR cx TR -Ee +AA Td ZY Ee @@ -12161,7 +12264,7 @@ zO ZY RB xJ -Ee +AA Jw dK JU @@ -12298,7 +12401,7 @@ TR TR cx TR -Ee +AA sJ Dr Ee @@ -12450,10 +12553,10 @@ TR TR cx TR -Ee -Ee +AA +AA iX -Ee +AA ZY ZY US @@ -12465,7 +12568,7 @@ Ee RB RB xJ -Ee +AA hu lD ry @@ -12476,11 +12579,11 @@ Ic TR HI HI -LN -LN -LN +oL +oL +oL IQ -LN +oL HI HI HI @@ -12605,7 +12708,7 @@ TR TR TR TR -Ee +AA sJ Dr gn @@ -12616,8 +12719,8 @@ gn Ee xJ nJ -Ee -Ee +AA +AA TR TR TR @@ -12628,11 +12731,11 @@ Ic EV TR HI -LN +oL uu qP qP -LN +oL HI TR HI @@ -12757,18 +12860,18 @@ TR TR TR TR -Ee -Ee +AA +AA iX -Ee -Ee -Ee +AA +AA +AA iX -Ee -Ee -Ee +AA +AA +AA iX -Ee +AA TR TR TR @@ -12780,7 +12883,7 @@ Ic EV TR HI -LN +oL SU Pd qP @@ -12936,7 +13039,7 @@ IQ bv Pd qP -LN +oL HI TR Rl @@ -13084,11 +13187,11 @@ Ic EV TR HI -LN +oL eM qP FE -LN +oL TR Rl GW @@ -13235,12 +13338,12 @@ EV Ic EV TR -LN -LN +oL +oL LN Ti LN -LN +oL TR Rl GW @@ -13368,12 +13471,12 @@ nn jA HP Pb -nn +yw mD ZC JS js -nn +yw LA Ak Ak @@ -13387,12 +13490,12 @@ EV Ic EV TR -LN +oL cl VO VO yN -LN +oL TR Rl GW @@ -13526,7 +13629,7 @@ js js js kE -Ak +GN Ak fM Ak @@ -13544,7 +13647,7 @@ LH yJ VO yN -LN +oL TR Rl GW @@ -13672,12 +13775,12 @@ nn bu wp js -nn +yw js jf tH gW -nn +yw Ak Ak xI @@ -13691,12 +13794,12 @@ EV Ic EV TR -LN +oL ml VO VO gB -LN +oL TR Rl Rl @@ -13821,15 +13924,15 @@ TR HI TR nn -nn -nn -nn -nn -nn -nn -nn -nn -nn +yw +yw +yw +yw +yw +yw +yw +yw +yw Ak Ak Rk @@ -13843,12 +13946,12 @@ Ic Ic EV TR -LN +oL AG VO VO ya -LN +oL zH Rl GW @@ -13995,12 +14098,12 @@ Ic EV VU VU -LN +oL LN mK LN LN -LN +oL me Rl GW @@ -14147,7 +14250,7 @@ EV Ic Dl BX -LN +oL VO VO hJ @@ -14280,15 +14383,15 @@ nn Wk Wk Wk -nn +yw Wk Wk Wk -nn +yw Wk Wk Wk -nn +yw Wk Wk Wk @@ -14432,15 +14535,15 @@ nn PA AS PA -nn +yw PA PA PA -nn +yw PA gJ PA -nn +yw PA PA PA @@ -14451,12 +14554,12 @@ TR Ic Dl lL -LN +oL hJ VO VO VO -LN +oL xW Rl Rl @@ -14608,7 +14711,7 @@ HF ra gg eD -LN +oL ke TR Rl @@ -14755,12 +14858,12 @@ EV Ic mG mG -LN -LN -LN -LN -LN -LN +oL +oL +oL +oL +oL +oL TR TR TR @@ -18813,16 +18916,16 @@ QB Kh QB QB -QB -QB -Kh -QB -QB -QB -QB -QB -QB -QB +wr +wr +uD +wr +wr +wr +wr +wr +wr +wr By By NH @@ -18965,7 +19068,7 @@ CV iJ CV CV -IB +nS CR CR gt @@ -18974,7 +19077,7 @@ CR CR CR CR -QB +wr By By NH @@ -19113,11 +19216,11 @@ QB Il QB Il -QB -QB +Dk +Dk Il -QB -QB +Dk +qV CR XM XM @@ -19126,7 +19229,7 @@ pd CR pd CR -Kh +uD By By By @@ -19266,10 +19369,10 @@ kv Kh CV rS -QB +Dk CV rS -QB +qV CR XM JK @@ -19278,7 +19381,7 @@ jk CR pd CR -QB +wr jI By kv @@ -19418,10 +19521,10 @@ kv QB Jt qe -QB +Dk Jt qe -QB +qV XJ XM Gj @@ -19431,7 +19534,7 @@ XM XM CR PG -kv +ls kv kv kv @@ -19569,11 +19672,11 @@ kv kv Yc Yc -QB -QB -QB -QB -QB +Dk +Dk +Dk +Dk +qV CR XM JK @@ -19582,7 +19685,7 @@ pd CR pd CR -QB +wr jI kv kv @@ -19725,7 +19828,7 @@ QW ge Ff ge -QB +qV CR XM XM @@ -19734,7 +19837,7 @@ pd CR pd CR -Kh +uD By By By @@ -19877,7 +19980,7 @@ QW xh vz ge -IB +nS CR CR AX @@ -19886,7 +19989,7 @@ CR CR CR CR -QB +wr By By By @@ -20029,16 +20132,16 @@ QW TM Wh ge -QB -QB -Kh -QB -QB -QB -QB -QB -QB -QB +wr +wr +uD +wr +wr +wr +wr +wr +wr +wr By By NH @@ -20632,11 +20735,11 @@ kv By kv QB -QB -QB -QB -QB -QB +Dk +Dk +Dk +Dk +Dk QB ft Zx diff --git a/maps/shaded_hills/shaded_hills-woods.dmm b/maps/shaded_hills/shaded_hills-woods.dmm index 854c4bb10df2..b1884d02ba86 100644 --- a/maps/shaded_hills/shaded_hills-woods.dmm +++ b/maps/shaded_hills/shaded_hills-woods.dmm @@ -8,7 +8,13 @@ /turf/floor/path/running_bond/basalt, /area/shaded_hills/outside/woods) "cN" = ( -/obj/item/bladed/knife/iron, +/obj/structure/table/desk/dresser/ebony, +/obj/structure/wall_sconce/lantern{ + start_lit = 1 + }, +/obj/item/candelabra/filled{ + pixel_y = 9 + }, /turf/floor/wood/rough/walnut, /area/shaded_hills/forester_hut) "dp" = ( @@ -33,6 +39,10 @@ "ix" = ( /turf/unsimulated/dark_filler, /area/shaded_hills/caves/woods) +"jk" = ( +/obj/structure/meat_hook, +/turf/floor/dirt, +/area/shaded_hills/outside/river/woods) "kx" = ( /turf/floor/dirt, /area/shaded_hills/outside/river/woods) @@ -41,7 +51,7 @@ /turf/wall/natural/basalt/shaded_hills, /area/shaded_hills/caves/river/woods) "lb" = ( -/turf/floor/wood/rough/walnut, +/turf/wall/brick/basalt, /area/shaded_hills/forester_hut) "lC" = ( /turf/unsimulated/dark_filler, @@ -59,6 +69,13 @@ "nl" = ( /turf/wall/natural/basalt/shaded_hills, /area/shaded_hills/caves/river/woods) +"oA" = ( +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = 5 + }, +/turf/floor/wood/rough/walnut, +/area/shaded_hills/forester_hut) "pu" = ( /turf/unsimulated/dark_filler, /area/shaded_hills/outside/river/lake) @@ -75,10 +92,8 @@ /turf/unsimulated/dark_filler, /area/shaded_hills/outside/river/woods) "wD" = ( -/obj/item/fishing_rod, -/obj/structure/table/end/alt/ebony, /turf/floor/wood/rough/walnut, -/area/shaded_hills/forester_hut) +/area/shaded_hills/outside/river/woods) "xn" = ( /turf/unsimulated/mask, /area/shaded_hills/outside/woods/poi) @@ -122,16 +137,27 @@ /turf/wall/natural/basalt/shaded_hills, /area/shaded_hills/caves/woods) "Fz" = ( -/obj/structure/fire_source/stove, -/obj/item/stack/material/log/mapped/walnut/ten, +/obj/structure/chair/rustic{ + dir = 1; + pixel_y = 20; + pixel_x = -4 + }, /turf/floor/wood/rough/walnut, /area/shaded_hills/forester_hut) +"Gp" = ( +/turf/wall/wattle/daubed/plastered/framed/walnut/shutter/open, +/area/shaded_hills/forester_hut) "GB" = ( /turf/floor/carpet/rustic, /area/shaded_hills/forester_hut) "HA" = ( /turf/floor/grass, /area/shaded_hills/outside/woods) +"IA" = ( +/obj/structure/fire_source/stove, +/obj/item/stack/material/log/mapped/walnut/ten, +/turf/floor/path/herringbone/basalt, +/area/shaded_hills/forester_hut) "Jd" = ( /turf/floor/path/basalt, /area/shaded_hills/outside/woods) @@ -148,30 +174,31 @@ /turf/floor/wood/rough/walnut, /area/shaded_hills/outside/river/woods) "JJ" = ( -/obj/structure/meat_hook, +/obj/structure/table/end/alt/ebony, +/obj/item/stack/material/bundle/grass/dry{ + amount = 5 + }, +/obj/item/fishing_rod, /turf/floor/wood/rough/walnut, /area/shaded_hills/forester_hut) "LJ" = ( /turf/floor/path/running_bond/basalt, /area/shaded_hills/outside/woods) "Md" = ( -/obj/structure/table/desk/ebony, -/obj/item/stack/material/bundle/grass/dry{ - amount = 5 - }, /turf/floor/wood/rough/walnut, /area/shaded_hills/forester_hut) "My" = ( /turf/floor/grass, /area/shaded_hills/outside/river/lake) "MR" = ( -/obj/structure/wall_sconce/lantern{ - start_lit = 1 - }, +/obj/structure/coatrack/ebony, /turf/floor/wood/rough/walnut, /area/shaded_hills/forester_hut) "MU" = ( -/turf/wall/log/walnut/shutter/open, +/obj/structure/table/desk/ebony, +/obj/item/whetstone, +/obj/item/bladed/knife/iron, +/turf/floor/carpet/rustic, /area/shaded_hills/forester_hut) "Oi" = ( /obj/structure/closet/crate/chest/ebony, @@ -181,11 +208,27 @@ /obj/abstract/force_fluid_flow/north, /turf/floor/mud/water/deep, /area/shaded_hills/outside/river/lake) +"SD" = ( +/obj/structure/travois/walnut, +/turf/floor/dirt, +/area/shaded_hills/outside/river/woods) "SI" = ( -/turf/wall/log/walnut, +/turf/wall/wattle/daubed/plastered/framed/walnut, /area/shaded_hills/forester_hut) +"TC" = ( +/obj/item/horseshoe/hung{ + pixel_y = 42 + }, +/obj/item/towel/doormat/flat{ + dir = 1 + }, +/turf/floor/path/basalt, +/area/shaded_hills/outside/river/woods) "TP" = ( /obj/structure/table/desk/dresser/ebony, +/obj/item/candelabra/filled{ + pixel_y = 9 + }, /turf/floor/wood/rough/walnut, /area/shaded_hills/forester_hut) "Uz" = ( @@ -196,6 +239,10 @@ /obj/abstract/landmark/start/shaded_hills/traveller, /turf/floor/path/basalt, /area/shaded_hills/outside/woods) +"Wa" = ( +/obj/structure/divider/extended/wood/ebony, +/turf/floor/wood/rough/walnut, +/area/shaded_hills/forester_hut) "Wb" = ( /obj/abstract/landmark/start/shaded_hills/traveller, /turf/floor/barren, @@ -222,7 +269,7 @@ dir = 1; pixel_y = 10 }, -/turf/floor/path/basalt, +/turf/floor/dirt, /area/shaded_hills/outside/river/woods) "ZO" = ( /obj/abstract/landmark/start/shaded_hills/traveller, @@ -19330,8 +19377,8 @@ zp zp zp zp -JI -AN +wD +wD En En En @@ -19467,11 +19514,11 @@ YO YO ES SI +TP Jz -lb -Oi -lb -Fz +Wa +Jz +cN SI Zs zq @@ -19479,12 +19526,12 @@ zq zq zp zp +zp +zq +zq zq zp zp -JI -AN -zp En En En @@ -19618,24 +19665,24 @@ YO YO YO ES -MU -TP +Gp +JJ GB GB GB -lb +Md mo +TC zq -kx eJ zq zq zq -kx +zq +zq +zq zp zp -JI -AN zp zp zp @@ -19771,24 +19818,24 @@ YO YO ES SI -Jz -GB +Oi GB +MU GB MR -SI -DB -kx -kx -kx +Gp +SD kx kx ES +zq +zq ES -dp -JI -AN -dp +ES +zp +zp +zp +zp zp zp zp @@ -19923,13 +19970,13 @@ YO ES ES SI +SI +oA Md -GB -GB -GB -JJ -MU -kx +Fz +IA +lb +DB kx ES ES @@ -20074,14 +20121,14 @@ YO YO ES ES +kx +SI +SI +Gp SI -cN lb -wD lb -JJ -SI -DB +jk kx ES ES @@ -20226,13 +20273,13 @@ YO ES ES ES -SI -SI -MU -SI -SI -SI -SI +ES +ES +kx +kx +kx +kx +kx kx ES ES @@ -20378,13 +20425,13 @@ YO YO ES ES -kx +ES +ES +ES ES kx kx -kx -kx -kx +ES kx ES ES @@ -20534,8 +20581,8 @@ ES ES ES ES -kx -kx +ES +ES ES ES ES diff --git a/maps/shaded_hills/shaded_hills_define.dm b/maps/shaded_hills/shaded_hills_define.dm index aca4371e9579..06f1bb85cb13 100644 --- a/maps/shaded_hills/shaded_hills_define.dm +++ b/maps/shaded_hills/shaded_hills_define.dm @@ -28,7 +28,8 @@ lobby_tracks = list( /decl/music_track/dhaka, /decl/music_track/teller, - /decl/music_track/suonatore + /decl/music_track/suonatore, + /decl/music_track/adventure, ) credit_sound = list( 'sound/music/Miris-Magic-Dance.ogg' @@ -46,6 +47,7 @@ "rock" = /turf/floor/rock/basalt::color, "brick" = /turf/wall/brick/sandstone::color ) + default_ui_style = /decl/ui_style/underworld /decl/backpack_outfit/sack is_default = TRUE diff --git a/maps/shaded_hills/shaded_hills_map.dm b/maps/shaded_hills/shaded_hills_map.dm index 09bf988942e0..59f2a26ce09a 100644 --- a/maps/shaded_hills/shaded_hills_map.dm +++ b/maps/shaded_hills/shaded_hills_map.dm @@ -1,6 +1,6 @@ /datum/map/shaded_hills default_liquid_fuel_type = /decl/material/liquid/oil - default_species = SPECIES_KOBALOI + default_species = /decl/species/kobaloi::uid loadout_categories = list( /decl/loadout_category/fantasy/clothing, /decl/loadout_category/fantasy/utility diff --git a/maps/tradeship/tradeship-0.dmm b/maps/tradeship/tradeship-0.dmm index ff571e169d9f..05ce95d98f90 100644 --- a/maps/tradeship/tradeship-0.dmm +++ b/maps/tradeship/tradeship-0.dmm @@ -1562,7 +1562,7 @@ /turf/floor/tiled/steel_grid, /area/ship/trade/loading_bay) "yT" = ( -/obj/machinery/honey_extractor, +/obj/machinery/centrifuge/mapped, /obj/item/seeds/tomatoseed, /turf/floor, /area/ship/trade/aft_port_underside_maint) diff --git a/maps/tradeship/tradeship-2.dmm b/maps/tradeship/tradeship-2.dmm index dae19f721128..bdad0e37088e 100644 --- a/maps/tradeship/tradeship-2.dmm +++ b/maps/tradeship/tradeship-2.dmm @@ -1995,7 +1995,7 @@ }, /obj/item/box/donkpockets, /obj/effect/floor_decal/corner/red/diagonal, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /obj/item/chems/condiment/small/saltshaker{ pixel_x = -3 }, diff --git a/maps/tradeship/tradeship.dm b/maps/tradeship/tradeship.dm index 5a866a9c8b8b..ec261eac45aa 100644 --- a/maps/tradeship/tradeship.dm +++ b/maps/tradeship/tradeship.dm @@ -11,11 +11,13 @@ #include "../../mods/content/government/away_sites/icarus/icarus.dm" #include "../../mods/content/corporate/away_sites/lar_maria/lar_maria.dm" - #include "../../mods/content/beekeeping/_beekeeping.dme" #include "../../mods/content/mundane.dm" #include "../../mods/content/scaling_descriptors.dm" + #include "../../mods/content/beekeeping/_beekeeping.dme" #include "../../mods/content/bigpharma/_bigpharma.dme" + #include "../../mods/content/blob/_blob.dme" + #include "../../mods/content/breath_holding/_breath_holding.dme" #include "../../mods/content/corporate/_corporate.dme" #include "../../mods/content/dungeon_loot/_dungeon_loot.dme" #include "../../mods/content/government/_government.dme" @@ -30,6 +32,7 @@ #include "../../mods/gamemodes/cult/_cult.dme" #include "../../mods/gamemodes/heist/_heist.dme" + #include "../../mods/gamemodes/mercenary/_mercenary.dme" #include "../../mods/gamemodes/ninja/_ninja.dme" #include "../../mods/gamemodes/revolution/_revolution.dme" #include "../../mods/gamemodes/spyvspy/_spyvspy.dme" diff --git a/maps/~mapsystem/maps.dm b/maps/~mapsystem/maps.dm index 84a5e81f276c..ff76e866b038 100644 --- a/maps/~mapsystem/maps.dm +++ b/maps/~mapsystem/maps.dm @@ -136,23 +136,25 @@ var/global/const/MAP_HAS_RANK = 2 //Rank system, also toggleable var/list/station_departments = list()//Gets filled automatically depending on jobs allowed - var/default_species = SPECIES_HUMAN + var/default_species = /decl/species/human::uid // Can this map be voted for by players? var/votable = TRUE var/list/available_background_info = list( - /decl/background_category/homeworld = list(/decl/background_detail/location/other), - /decl/background_category/faction = list(/decl/background_detail/faction/other), - /decl/background_category/heritage = list(/decl/background_detail/heritage/other), - /decl/background_category/religion = list(/decl/background_detail/religion/other) + /decl/background_category/citizenship = list(/decl/background_detail/citizenship/other), + /decl/background_category/homeworld = list(/decl/background_detail/location/other), + /decl/background_category/faction = list(/decl/background_detail/faction/other), + /decl/background_category/heritage = list(/decl/background_detail/heritage/other), + /decl/background_category/religion = list(/decl/background_detail/religion/other) ) var/list/default_background_info = list( - /decl/background_category/homeworld = /decl/background_detail/location/other, - /decl/background_category/faction = /decl/background_detail/faction/other, - /decl/background_category/heritage = /decl/background_detail/heritage/other, - /decl/background_category/religion = /decl/background_detail/religion/other + /decl/background_category/citizenship = /decl/background_detail/citizenship/other, + /decl/background_category/homeworld = /decl/background_detail/location/other, + /decl/background_category/faction = /decl/background_detail/faction/other, + /decl/background_category/heritage = /decl/background_detail/heritage/other, + /decl/background_category/religion = /decl/background_detail/religion/other ) var/access_modify_region = list( @@ -194,7 +196,13 @@ var/global/const/MAP_HAS_RANK = 2 //Rank system, also toggleable "reinforced" ) var/background_categories_generated = FALSE - var/list/_background_categories + // Hard defining this to avoid pulling in unimplemented citizenship decls for the time being. + var/list/_background_categories = list( + /decl/background_category/heritage, + /decl/background_category/homeworld, + /decl/background_category/faction, + /decl/background_category/religion + ) var/default_ui_style @@ -206,6 +214,7 @@ var/global/const/MAP_HAS_RANK = 2 //Rank system, also toggleable if(!background_categories_generated) if(isnull(_background_categories)) _background_categories = decls_repository.get_decls_of_type(/decl/background_category) + _background_categories = _background_categories?.Copy() || list() // Avoid mutating the cache. else for(var/cat_type in _background_categories) _background_categories[cat_type] = GET_DECL(cat_type) @@ -564,6 +573,13 @@ var/global/const/MAP_HAS_RANK = 2 //Rank system, also toggleable if(!length(SSmapping.contact_levels)) log_error("[name] has no contact levels!") . = FALSE + var/decl/species/default_species_decl = decls_repository.get_decl_by_id(default_species) + if(default_species_decl.species_flags & SPECIES_IS_RESTRICTED) + log_error("[name]'s default species [default_species_decl.type] is set to restricted!") + if(default_species_decl.species_flags & SPECIES_IS_WHITELISTED) + log_error("[name]'s default species [default_species_decl.type] is set to whitelisted!") + if(default_species_decl.species_flags & SPECIES_CAN_JOIN) + log_error("[name]'s default species [default_species_decl.type] is not allowed to join the game!") /datum/map/proc/get_available_submap_archetypes() return decls_repository.get_decls_of_subtype_unassociated(/decl/submap_archetype) diff --git a/mods/content/beekeeping/_beekeeping.dm b/mods/content/beekeeping/_beekeeping.dm index cfa1427bbeb1..d3b58be746d6 100644 --- a/mods/content/beekeeping/_beekeeping.dm +++ b/mods/content/beekeeping/_beekeeping.dm @@ -1,2 +1,7 @@ /decl/modpack/beekeeping name = "Beekeeping Content" + +/datum/storage/hopper/industrial/centrifuge/New() + ..() + can_hold |= /obj/item/hive_frame + diff --git a/mods/content/beekeeping/_beekeeping.dme b/mods/content/beekeeping/_beekeeping.dme index 2d950fe7a392..75778704f368 100644 --- a/mods/content/beekeeping/_beekeeping.dme +++ b/mods/content/beekeeping/_beekeeping.dme @@ -2,8 +2,8 @@ #define MODPACK_BEEKEEPING // BEGIN_INCLUDE #include "_beekeeping.dm" -#include "centrifuge.dm" #include "closets.dm" +#include "hive_frame.dm" #include "items.dm" #include "recipes.dm" #include "trading.dm" diff --git a/mods/content/beekeeping/centrifuge.dm b/mods/content/beekeeping/centrifuge.dm deleted file mode 100644 index 9b04168d744a..000000000000 --- a/mods/content/beekeeping/centrifuge.dm +++ /dev/null @@ -1,53 +0,0 @@ -/obj/machinery/honey_extractor - name = "honey extractor" - desc = "A machine used to extract honey and wax from a beehive frame." - icon = 'icons/obj/virology.dmi' - icon_state = "centrifuge" - anchored = TRUE - density = TRUE - construct_state = /decl/machine_construction/default/panel_closed - uncreated_component_parts = null - stat_immune = 0 - - var/processing = 0 - var/honey = 0 - -/obj/machinery/honey_extractor/components_are_accessible(path) - return !processing && ..() - -/obj/machinery/honey_extractor/cannot_transition_to(state_path, mob/user) - if(processing) - return SPAN_NOTICE("You must wait for \the [src] to finish first!") - return ..() - -/obj/machinery/honey_extractor/attackby(var/obj/item/I, var/mob/user) - if(processing) - to_chat(user, "\The [src] is currently spinning, wait until it's finished.") - return - if((. = component_attackby(I, user))) - return - if(istype(I, /obj/item/honey_frame)) - var/obj/item/honey_frame/H = I - if(!H.honey) - to_chat(user, "\The [H] is empty, put it into a beehive.") - return - user.visible_message("\The [user] loads \the [H] into \the [src] and turns it on.", "You load \the [H] into \the [src] and turn it on.") - processing = H.honey - icon_state = "centrifuge_moving" - qdel(H) - spawn(50) - new /obj/item/honey_frame(loc) - new /obj/item/stack/material/bar/wax(loc, 1) - honey += processing - processing = 0 - icon_state = "centrifuge" - else if(istype(I, /obj/item/chems/glass)) - if(!honey) - to_chat(user, "There is no honey in \the [src].") - return - var/obj/item/chems/glass/G = I - var/transferred = min(G.reagents.maximum_volume - G.reagents.total_volume, honey) - G.add_to_reagents(/decl/material/liquid/nutriment/honey, transferred) - honey -= transferred - user.visible_message("\The [user] collects honey from \the [src] into \the [G].", "You collect [transferred] units of honey from \the [src] into \the [G].") - return 1 diff --git a/mods/content/beekeeping/closets.dm b/mods/content/beekeeping/closets.dm index 224ff0561eb8..c39e70dbb457 100644 --- a/mods/content/beekeeping/closets.dm +++ b/mods/content/beekeeping/closets.dm @@ -6,10 +6,10 @@ . = ..() new /obj/item/beehive_assembly(src) new /obj/item/bee_smoker(src) - new /obj/item/honey_frame(src) - new /obj/item/honey_frame(src) - new /obj/item/honey_frame(src) - new /obj/item/honey_frame(src) - new /obj/item/honey_frame(src) + new /obj/item/hive_frame/crafted(src) + new /obj/item/hive_frame/crafted(src) + new /obj/item/hive_frame/crafted(src) + new /obj/item/hive_frame/crafted(src) + new /obj/item/hive_frame/crafted(src) new /obj/item/bee_pack(src) new /obj/item/crowbar(src) diff --git a/mods/content/beekeeping/hive_frame.dm b/mods/content/beekeeping/hive_frame.dm new file mode 100644 index 000000000000..0bfd7265f231 --- /dev/null +++ b/mods/content/beekeeping/hive_frame.dm @@ -0,0 +1,62 @@ +/obj/item/hive_frame + abstract_type = /obj/item/hive_frame + icon_state = ICON_STATE_WORLD + w_class = ITEM_SIZE_SMALL + material_alteration = MAT_FLAG_ALTERATION_ALL + var/destroy_on_centrifuge = FALSE + +/obj/item/hive_frame/Initialize(ml, material_key) + . = ..() + initialize_reagents() + +/obj/item/hive_frame/initialize_reagents(populate = TRUE) + create_reagents(20) + . = ..() + +/obj/item/hive_frame/on_reagent_change() + . = ..() + if(reagents?.total_volume) + SetName("filled [initial(name)] ([reagents.get_primary_reagent_name()])") + else + SetName(initial(name)) + queue_icon_update() + +/obj/item/hive_frame/on_update_icon() + . = ..() + var/mesh_state = "[icon_state]-mesh" + if(check_state_in_icon(mesh_state, icon)) + add_overlay(overlay_image(icon, mesh_state, COLOR_WHITE, RESET_COLOR)) + if(reagents?.total_volume) + var/comb_state = "[icon_state]-comb" + if(check_state_in_icon(comb_state, icon)) + add_overlay(overlay_image(icon, comb_state, reagents.get_color(), RESET_COLOR)) + compile_overlays() + +/obj/item/hive_frame/handle_centrifuge_process(obj/machinery/centrifuge/centrifuge) + if(!(. = ..())) + return + if(reagents.total_volume) + reagents.trans_to_holder(centrifuge.loaded_beaker.reagents, reagents.total_volume) + for(var/obj/item/thing in contents) + thing.dropInto(centrifuge.loc) + if(destroy_on_centrifuge) + for(var/atom/movable/thing in convert_matter_to_lumps()) + thing.dropInto(centrifuge.loc) + +// Crafted frame used in apiaries. +/obj/item/hive_frame/crafted + name = "hive frame" + desc = "A wooden frame for insect hives that the workers will fill with products like honey." + icon = 'mods/content/beekeeping/icons/frame.dmi' + material = /decl/material/solid/organic/wood/oak + material_alteration = MAT_FLAG_ALTERATION_ALL + +// TEMP until beewrite redoes hives. +/obj/item/hive_frame/crafted/filled/Initialize() + . = ..() + new /obj/item/stack/material/bar/wax(src) + update_icon() + +/obj/item/hive_frame/crafted/filled/populate_reagents() + . = ..() + reagents.add_reagent(/decl/material/liquid/nutriment/honey, reagents?.maximum_volume) diff --git a/mods/content/beekeeping/hives/_hive.dm b/mods/content/beekeeping/hives/_hive.dm index edea2885862b..1ace43bbe1cf 100644 --- a/mods/content/beekeeping/hives/_hive.dm +++ b/mods/content/beekeeping/hives/_hive.dm @@ -45,17 +45,17 @@ if(!closed) . += "The lid is open." -/obj/machinery/beehive/attackby(var/obj/item/I, var/mob/user) - if(IS_CROWBAR(I)) +/obj/machinery/beehive/attackby(var/obj/item/used_item, var/mob/user) + if(IS_CROWBAR(used_item)) closed = !closed user.visible_message("\The [user] [closed ? "closes" : "opens"] \the [src].", "You [closed ? "close" : "open"] \the [src].") update_icon() return TRUE - else if(IS_WRENCH(I)) + else if(IS_WRENCH(used_item)) anchored = !anchored user.visible_message("\The [user] [anchored ? "wrenches" : "unwrenches"] \the [src].", "You [anchored ? "wrench" : "unwrench"] \the [src].") return TRUE - else if(istype(I, /obj/item/bee_smoker)) + else if(istype(used_item, /obj/item/bee_smoker)) if(closed) to_chat(user, "You need to open \the [src] with a crowbar before smoking the bees.") return TRUE @@ -63,24 +63,24 @@ smoked = 30 update_icon() return TRUE - else if(istype(I, /obj/item/honey_frame)) + else if(istype(used_item, /obj/item/hive_frame/crafted)) if(closed) - to_chat(user, "You need to open \the [src] with a crowbar before inserting \the [I].") + to_chat(user, "You need to open \the [src] with a crowbar before inserting \the [used_item].") return TRUE if(frames >= maxFrames) to_chat(user, "There is no place for an another frame.") return TRUE - var/obj/item/honey_frame/H = I - if(H.honey) - to_chat(user, "\The [I] is full with beeswax and honey, empty it in the extractor first.") + var/obj/item/hive_frame/crafted/H = used_item + if(H.reagents?.total_volume) + to_chat(user, "\The [used_item] is full with beeswax and honey, empty it in the extractor first.") return TRUE ++frames - user.visible_message("\The [user] loads \the [I] into \the [src].", "You load \the [I] into \the [src].") + user.visible_message("\The [user] loads \the [used_item] into \the [src].", "You load \the [used_item] into \the [src].") update_icon() - qdel(I) + qdel(used_item) return TRUE - else if(istype(I, /obj/item/bee_pack)) - var/obj/item/bee_pack/B = I + else if(istype(used_item, /obj/item/bee_pack)) + var/obj/item/bee_pack/B = used_item if(B.full && bee_count) to_chat(user, "\The [src] already has bees inside.") return TRUE @@ -94,16 +94,16 @@ to_chat(user, "You need to open \the [src] with a crowbar before moving the bees.") return TRUE if(B.full) - user.visible_message("\The [user] puts the queen and the bees from \the [I] into \the [src].", "You put the queen and the bees from \the [I] into \the [src].") + user.visible_message("\The [user] puts the queen and the bees from \the [used_item] into \the [src].", "You put the queen and the bees from \the [used_item] into \the [src].") bee_count = 20 B.empty() else - user.visible_message("\The [user] puts bees and larvae from \the [src] into \the [I].", "You put bees and larvae from \the [src] into \the [I].") + user.visible_message("\The [user] puts bees and larvae from \the [src] into \the [used_item].", "You put bees and larvae from \the [src] into \the [used_item].") bee_count /= 2 B.fill() update_icon() return TRUE - else if(istype(I, /obj/item/scanner/plant)) + else if(istype(used_item, /obj/item/scanner/plant)) to_chat(user, "Scan result of \the [src]...") to_chat(user, "Beehive is [bee_count ? "[round(bee_count)]% full" : "empty"].[bee_count > 90 ? " Colony is ready to split." : ""]") if(frames) @@ -115,7 +115,7 @@ if(smoked) to_chat(user, "The hive is smoked.") return TRUE - else if(IS_SCREWDRIVER(I)) + else if(IS_SCREWDRIVER(used_item)) if(bee_count) to_chat(user, "You can't dismantle \the [src] with these bees inside.") return TRUE @@ -140,7 +140,7 @@ return user.visible_message("\The [user] starts taking the honeycombs out of \the [src].", "You start taking the honeycombs out of \the [src]...") while(honeycombs >= 100 && do_after(user, 30, src)) - new /obj/item/honey_frame/filled(loc) + new /obj/item/hive_frame/crafted/filled(loc) honeycombs -= 100 --frames update_icon() diff --git a/mods/content/beekeeping/apiary_bees_etc.dmi b/mods/content/beekeeping/icons/apiary_bees_etc.dmi similarity index 100% rename from mods/content/beekeeping/apiary_bees_etc.dmi rename to mods/content/beekeeping/icons/apiary_bees_etc.dmi diff --git a/mods/content/beekeeping/icons/frame.dmi b/mods/content/beekeeping/icons/frame.dmi new file mode 100644 index 000000000000..136c77b72d6f Binary files /dev/null and b/mods/content/beekeeping/icons/frame.dmi differ diff --git a/mods/content/beekeeping/items.dm b/mods/content/beekeeping/items.dm index 69a888b28830..2c15fa75cd04 100644 --- a/mods/content/beekeeping/items.dm +++ b/mods/content/beekeeping/items.dm @@ -1,9 +1,9 @@ /obj/item/beehive_assembly name = "beehive assembly" desc = "Contains everything you need to build a beehive." - icon = 'mods/content/beekeeping/apiary_bees_etc.dmi' + icon = 'mods/content/beekeeping/icons/apiary_bees_etc.dmi' icon_state = "apiary" - material = /decl/material/solid/organic/wood + material = /decl/material/solid/organic/wood/oak /obj/item/beehive_assembly/attack_self(var/mob/user) to_chat(user, "You start assembling \the [src]...") @@ -12,15 +12,6 @@ new /obj/machinery/beehive(get_turf(user)) qdel(src) -/obj/item/stock_parts/circuitboard/honey - name = "circuitboard (honey extractor)" - build_path = /obj/machinery/honey_extractor - board_type = "machine" - origin_tech = @'{"biotech":2,"engineering":1}' - req_components = list( - /obj/item/stock_parts/manipulator = 2, - /obj/item/stock_parts/matter_bin = 2) - /obj/item/bee_smoker name = "bee smoker" desc = "A device used to calm down bees before harvesting honey." @@ -29,25 +20,6 @@ w_class = ITEM_SIZE_SMALL material = /decl/material/solid/metal/steel -/obj/item/honey_frame - name = "beehive frame" - desc = "A frame for the beehive that the bees will fill with honeycombs." - icon = 'mods/content/beekeeping/icons/beekeeping.dmi' - icon_state = "honeyframe" - w_class = ITEM_SIZE_SMALL - material = /decl/material/solid/organic/wood - var/honey = 0 - -/obj/item/honey_frame/filled - name = "filled beehive frame" - desc = "A frame for the beehive that the bees have filled with honeycombs." - honey = 20 - material = /decl/material/solid/organic/wood - -/obj/item/honey_frame/filled/Initialize() - . = ..() - overlays += "honeycomb" - /obj/item/bee_pack name = "bee pack" desc = "Contains a queen bee and some worker bees. Everything you'll need to start a hive!" diff --git a/mods/content/beekeeping/recipes.dm b/mods/content/beekeeping/recipes.dm index 03089d932ab9..8494617d3477 100644 --- a/mods/content/beekeeping/recipes.dm +++ b/mods/content/beekeeping/recipes.dm @@ -1,10 +1,6 @@ - /decl/stack_recipe/planks/beehive_assembly result_type = /obj/item/beehive_assembly category = "furniture" /decl/stack_recipe/planks/beehive_frame - result_type = /obj/item/honey_frame - -/datum/fabricator_recipe/imprinter/circuit/honey_extractor - path = /obj/item/stock_parts/circuitboard/honey + result_type = /obj/item/hive_frame/crafted diff --git a/mods/content/beekeeping/trading.dm b/mods/content/beekeeping/trading.dm index 1a119ddc99be..45009265f1bf 100644 --- a/mods/content/beekeeping/trading.dm +++ b/mods/content/beekeeping/trading.dm @@ -1,15 +1,17 @@ /datum/trader/trading_beacon/manufacturing/New() - LAZYSET(possible_trading_items, /obj/item/bee_pack, TRADER_THIS_TYPE) - LAZYSET(possible_trading_items, /obj/item/bee_smoker, TRADER_THIS_TYPE) - LAZYSET(possible_trading_items, /obj/item/beehive_assembly, TRADER_THIS_TYPE) - LAZYSET(possible_trading_items, /obj/item/honey_frame, TRADER_THIS_TYPE) + LAZYSET(possible_trading_items, /obj/item/bee_pack, TRADER_THIS_TYPE) + LAZYSET(possible_trading_items, /obj/item/bee_smoker, TRADER_THIS_TYPE) + LAZYSET(possible_trading_items, /obj/item/beehive_assembly, TRADER_THIS_TYPE) + LAZYSET(possible_trading_items, /obj/item/hive_frame/crafted, TRADER_THIS_TYPE) ..() /decl/hierarchy/supply_pack/hydroponics/bee_keeper name = "Equipment - Beekeeping" - contains = list(/obj/item/beehive_assembly, - /obj/item/bee_smoker, - /obj/item/honey_frame = 5, - /obj/item/bee_pack) + contains = list( + /obj/item/beehive_assembly, + /obj/item/bee_smoker, + /obj/item/hive_frame/crafted = 5, + /obj/item/bee_pack + ) containername = "beekeeping crate" access = access_hydroponics diff --git a/mods/content/blacksmithy/anvil.dm b/mods/content/blacksmithy/anvil.dm index 0968a7806ce5..9f88267f22a8 100644 --- a/mods/content/blacksmithy/anvil.dm +++ b/mods/content/blacksmithy/anvil.dm @@ -36,6 +36,7 @@ atom_flags = ATOM_FLAG_CLIMBABLE w_class = ITEM_SIZE_STRUCTURE //_LARGE material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color max_health = 1000 structure_flags = STRUCTURE_FLAG_SURFACE material_alteration = MAT_FLAG_ALTERATION_ALL @@ -82,7 +83,7 @@ // Flow through into procs below. // Put the bar onto the anvil (need to do this to avoid repairs in ..()) - if(istype(used_item, /obj/item/stack/material/bar)) + if(istype(used_item, /obj/item/stack/material/bar) && used_item.is_forgable()) var/obj/item/stack/material/bar/bar = used_item if(used_item.material != material || current_health >= get_max_health()) if(bar.get_amount() > 1) diff --git a/mods/content/blacksmithy/billet.dm b/mods/content/blacksmithy/billet.dm index da40b1fcd00d..b269d10ae0c1 100644 --- a/mods/content/blacksmithy/billet.dm +++ b/mods/content/blacksmithy/billet.dm @@ -14,9 +14,15 @@ return TRUE . = ..() -/obj/item/proc/hot_enough_to_forge(melting_point_percent = 0.25) +/// Whether or not this item is considered forgable (e.g. there is a temperature at which it can be forged) +/obj/item/proc/is_forgable() if(!istype(material) || isnull(material.melting_point) || !material.forgable) return FALSE + return TRUE + +/obj/item/proc/hot_enough_to_forge(melting_point_percent = 0.25) + if(!is_forgable()) + return FALSE // Defaults to >25% of the way to melting to be considered 'forgable' return temperature >= ((material.melting_point - T20C) * melting_point_percent) + T20C @@ -26,6 +32,7 @@ icon = 'mods/content/blacksmithy/icons/billet.dmi' icon_state = ICON_STATE_WORLD material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color material_alteration = MAT_FLAG_ALTERATION_ALL var/decl/forging_step/current_forging_step = /decl/forging_step/billet diff --git a/mods/content/blacksmithy/forge_fire.dm b/mods/content/blacksmithy/forge_fire.dm index 437c9cd1c1c8..1c32a6e8d912 100644 --- a/mods/content/blacksmithy/forge_fire.dm +++ b/mods/content/blacksmithy/forge_fire.dm @@ -20,13 +20,14 @@ /obj/structure/fire_source/forge/proc/get_forgable_contents() . = list() for(var/obj/item/thing in get_stored_inventory()) - if(thing.material?.forgable && (istype(thing, /obj/item/billet) || istype(thing, /obj/item/stack/material/bar))) + if(thing.is_forgable() && (istype(thing, /obj/item/billet) || istype(thing, /obj/item/stack/material/bar))) . += thing /obj/structure/fire_source/forge/attackby(obj/item/used_item, mob/user) + var/item_is_forgable = used_item.is_forgable() // Raw materials. - if(istype(used_item, /obj/item/stack/material/bar)) + if(istype(used_item, /obj/item/stack/material/bar) && item_is_forgable) var/obj/item/stack/material/bar/bar = used_item if(used_item.material != material || current_health >= get_max_health()) if(bar.get_amount() > 1) @@ -41,7 +42,7 @@ // Flows through to below. // Partially worked billets. - if(istype(used_item, /obj/item/billet)) + if(istype(used_item, /obj/item/billet) && item_is_forgable) if(used_item.loc == user) user.try_unequip(used_item, loc) else diff --git a/mods/content/blacksmithy/tongs.dm b/mods/content/blacksmithy/tongs.dm index 624e790dc53a..173ccef04688 100644 --- a/mods/content/blacksmithy/tongs.dm +++ b/mods/content/blacksmithy/tongs.dm @@ -4,6 +4,7 @@ icon = 'mods/content/blacksmithy/icons/tongs.dmi' icon_state = ICON_STATE_WORLD material = /decl/material/solid/metal/iron + color = /decl/material/solid/metal/iron::color obj_flags = OBJ_FLAG_INSULATED_HANDLE material_alteration = MAT_FLAG_ALTERATION_ALL var/obj/item/holding_bar diff --git a/mods/content/blob/_blob.dm b/mods/content/blob/_blob.dm new file mode 100644 index 000000000000..5e682ee90c30 --- /dev/null +++ b/mods/content/blob/_blob.dm @@ -0,0 +1,2 @@ +/decl/modpack/blob + name = "Blob Content" \ No newline at end of file diff --git a/mods/content/blob/_blob.dme b/mods/content/blob/_blob.dme new file mode 100644 index 000000000000..58d134cd575f --- /dev/null +++ b/mods/content/blob/_blob.dme @@ -0,0 +1,13 @@ +#ifndef CONTENT_PACK_BLOB +#define CONTENT_PACK_BLOB +// BEGIN_INCLUDE +#include "_blob.dm" +#include "blob_act.dm" +#include "blob_effect.dm" +#include "blob_event.dm" +#include "blob_follow.dm" +#include "blob_grenade_damage.dm" +#include "blob_samples.dm" +#include "blob_subsystem.dm" +// END_INCLUDE +#endif \ No newline at end of file diff --git a/mods/content/blob/blob_act.dm b/mods/content/blob/blob_act.dm new file mode 100644 index 000000000000..ef291e9dfd65 --- /dev/null +++ b/mods/content/blob/blob_act.dm @@ -0,0 +1,61 @@ +// This file contains blob_act overrides. +// blob_act is called when a blob attacks or tries to expand into a tile. +// blob_act overrides therefore handle atoms being damaged by blobs. + +/// Handles blobs attacking/expanding into this atom. +/// Return TRUE to stop the blob from doing further attacks on this tile. +/atom/proc/blob_act(obj/effect/blob/blob) + return + +/turf/blob_act(obj/effect/blob/blob) + if(!simulated) return FALSE + for(var/atom/movable/movable in contents) + if((. = movable.blob_act())) // stop if one returns TRUE + return + +/turf/space/blob_act(obj/effect/blob/blob) + return // blobs don't attack things in space, for some reason + +/turf/wall/blob_act(obj/effect/blob/blob) + take_damage(80) + return TRUE + +/obj/structure/girder/blob_act(obj/effect/blob/blob) + if(prob(40)) + dismantle_structure() + return TRUE // block further attacks even if we aren't destroyed + +/obj/structure/window/blob_act(obj/effect/blob/blob) + shatter() + return TRUE + +/obj/structure/grille/blob_act(obj/effect/blob/blob) + physically_destroyed() + return TRUE + +/obj/structure/door/blob_act(obj/effect/blob/blob) + if(!density) + return FALSE + explosion_act(2) + return TRUE + +/obj/structure/foamedmetal/blob_act(obj/effect/blob/blob) + physically_destroyed() + return TRUE + +/obj/structure/inflatable/blob_act(obj/effect/blob/blob) + deflate(violent = TRUE) + return TRUE + +/obj/vehicle/blob_act(obj/effect/blob/blob) + explosion_act(2) + return TRUE + +/obj/machinery/camera/blob_act(obj/effect/blob/blob) + take_damage(30) + return TRUE + +/mob/living/blob_act(obj/effect/blob/blob) + if(stat == DEAD) + return FALSE + blob.attack_living(src) \ No newline at end of file diff --git a/code/modules/blob/blob.dm b/mods/content/blob/blob_effect.dm similarity index 62% rename from code/modules/blob/blob.dm rename to mods/content/blob/blob_effect.dm index 5780a8f2ca98..b3e4ecbec3b7 100644 --- a/code/modules/blob/blob.dm +++ b/mods/content/blob/blob_effect.dm @@ -1,7 +1,7 @@ /obj/effect/blob name = "pulsating mass" desc = "A pulsating mass of interwoven tendrils." - icon = 'icons/mob/blob.dmi' + icon = 'mods/content/blob/icons/blob.dmi' icon_state = "blob" light_range = 2 light_color = BLOB_COLOR_PULS @@ -23,8 +23,8 @@ var/damage_min = 15 var/damage_max = 30 var/pruned = FALSE - var/product = /obj/item/blob_tendril - var/attack_freq = 7.5 //see proc/attempt_attack; lower is more often, min 1 + var/product = /obj/item/blob_sample/tendril + var/attack_freq = 8 //see proc/attempt_attack; lower is more often, min 1. must be an integet /obj/effect/blob/Initialize() . = ..() @@ -68,87 +68,52 @@ current_health = min(current_health + regen_rate, get_max_health()) update_icon() -/obj/effect/blob/proc/expand(var/turf/T) - if(istype(T, /turf/unsimulated/) || isspaceturf(T)) - return - if(istype(T, /turf/wall)) - var/turf/wall/SW = T - SW.take_damage(80) - return - var/obj/structure/girder/G = locate() in T - if(G) - if(prob(40)) - G.dismantle_structure() - return - var/obj/structure/window/W = locate() in T - if(W) - W.shatter() - return - var/obj/structure/grille/GR = locate() in T - if(GR) - qdel(GR) - return - for(var/obj/machinery/door/D in T) // There can be several - and some of them can be open, locate() is not suitable - if(D.density) - D.explosion_act(2) - return - var/obj/structure/foamedmetal/F = locate() in T - if(F) - qdel(F) - return - var/obj/structure/inflatable/I = locate() in T - if(I) - I.deflate(1) - return +/// Attempts to expand the blob into the specified turf, damaging objects in the way. +/// Returns FALSE if the expansion was blocked, returns the new blob instance if successful. +/obj/effect/blob/proc/expand(var/turf/target_turf) + if(target_turf.blob_act(src)) // don't expand if blob_act hits anything + return FALSE - var/obj/vehicle/V = locate() in T - if(V) - V.explosion_act(2) - return - var/obj/machinery/camera/CA = locate() in T - if(CA) - CA.take_damage(30) - return - - // Above things, we destroy completely and thus can use locate. Mobs are different. - for(var/mob/living/L in T) - if(L.stat == DEAD) - continue - attack_living(L) - - if(!(locate(/obj/effect/blob/core) in range(T, 2)) && prob(secondary_core_growth_chance)) - new/obj/effect/blob/core/secondary(T) + if(!(locate(/obj/effect/blob/core) in range(target_turf, 2)) && prob(secondary_core_growth_chance)) + . = new /obj/effect/blob/core/secondary(target_turf) else - new expandType(T, min(current_health, 30)) + . = new expandType(target_turf, min(current_health, 30)) /obj/effect/blob/proc/do_pulse(var/forceLeft, var/list/dirs) set waitfor = FALSE sleep(8) - var/pushDir = pick(dirs) - var/turf/T = get_step(src, pushDir) - var/obj/effect/blob/B = (locate() in T) - if(!B) + var/turf/target_turf + var/list/remaining_dirs = dirs.Copy() + while(!target_turf && length(remaining_dirs)) + var/pushDir = pick_n_take(remaining_dirs) + target_turf = get_step_resolving_mimic(src, pushDir) + if(!target_turf) // We're not next to ANYWHERE?! + return + var/obj/effect/blob/other_blob = (locate() in target_turf) + if(!other_blob) if(prob(current_health)) - expand(T) + expand(target_turf) return if(forceLeft) - B.do_pulse(forceLeft - 1, dirs) + other_blob.do_pulse(forceLeft - 1, dirs) -/obj/effect/blob/proc/attack_living(var/mob/L) - if(!L) +/obj/effect/blob/proc/attack_living(var/mob/living/victim) + if(!victim || victim.stat == DEAD) return var/blob_damage = pick(BRUTE, BURN) - L.visible_message(SPAN_DANGER("A tendril flies out from \the [src] and smashes into \the [L]!"), SPAN_DANGER("A tendril flies out from \the [src] and smashes into you!")) + victim.visible_message(SPAN_DANGER("A tendril flies out from \the [src] and smashes into \the [victim]!"), SPAN_DANGER("A tendril flies out from \the [src] and smashes into you!")) playsound(loc, 'sound/effects/attackblob.ogg', 50, 1) - L.apply_damage(rand(damage_min, damage_max), blob_damage, used_weapon = "blob tendril") + victim.apply_damage(rand(damage_min, damage_max), blob_damage, used_weapon = "blob tendril") /obj/effect/blob/proc/attempt_attack(var/list/dirs) - var/attackDir = pick(dirs) - var/turf/T = get_step(src, attackDir) - for(var/mob/living/victim in T) - if(victim.stat == DEAD) - continue - attack_living(victim) + var/turf/target_turf + var/list/remaining_dirs = dirs.Copy() + while(!target_turf && length(remaining_dirs)) + var/attackDir = pick_n_take(remaining_dirs) + target_turf = get_step_resolving_mimic(src, attackDir) + if(!target_turf) + return + target_turf.blob_act() /obj/effect/blob/bullet_act(var/obj/item/projectile/Proj) if(!Proj) @@ -161,11 +126,11 @@ take_damage((Proj.damage / laser_damage_divisor) / fire_damage_divisor, Proj.atom_damage_type) return 0 -/obj/effect/blob/attackby(var/obj/item/W, var/mob/user) +/obj/effect/blob/attackby(var/obj/item/used_item, var/mob/user) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) user.do_attack_animation(src) playsound(loc, 'sound/effects/attackblob.ogg', 50, 1) - if(IS_WIRECUTTER(W)) + if(IS_WIRECUTTER(used_item)) if(prob(user.skill_fail_chance(SKILL_SCIENCE, 90, SKILL_EXPERT))) to_chat(user, SPAN_WARNING("You fail to collect a sample from \the [src].")) return TRUE @@ -180,17 +145,19 @@ return TRUE var/damage = 0 - switch(W.atom_damage_type) + switch(used_item.atom_damage_type) if(BURN) - damage = (W.expend_attack_force(user) / fire_damage_divisor) - if(IS_WELDER(W)) + damage = (used_item.expend_attack_force(user) / fire_damage_divisor) + if(IS_WELDER(used_item)) playsound(loc, 'sound/items/Welder.ogg', 100, 1) if(BRUTE) - damage = (W.expend_attack_force(user) / brute_damage_divisor) + damage = (used_item.expend_attack_force(user) / brute_damage_divisor) - take_damage(damage, W.atom_damage_type) + take_damage(damage, used_item.atom_damage_type) return TRUE +// TODO: readd weedkiller spray damage, which seems to have been lost at some point + /obj/effect/blob/core name = "master nucleus" desc = "A massive, fragile nucleus guarded by a shield of thick tendrils." @@ -199,7 +166,7 @@ damage_min = 30 damage_max = 40 expandType = /obj/effect/blob/shield - product = /obj/item/blob_tendril/core + product = /obj/item/blob_sample/core light_color = BLOB_COLOR_CORE layer = BLOB_CORE_LAYER @@ -267,7 +234,7 @@ regen() will cover update_icon() for this proc blob_may_process = 0 process_core_health() regen() - for(var/I in 1 to times_to_pulse) + for(var/i in 1 to times_to_pulse) do_pulse(20, global.alldirs) attempt_attack(global.alldirs) attempt_attack(global.alldirs) @@ -283,7 +250,7 @@ regen() will cover update_icon() for this proc damage_min = 15 damage_max = 20 layer = BLOB_NODE_LAYER - product = /obj/item/blob_tendril/core/aux + product = /obj/item/blob_sample/core/aux times_to_pulse = 4 /obj/effect/blob/core/secondary/process_core_health() @@ -334,63 +301,3 @@ regen() will cover update_icon() for this proc attack_freq = 3 light_color = BLOB_COLOR_RAV color = "#ffd400" //Temporary, for until they get a new sprite. - -//produce -/obj/item/blob_tendril - name = "asteroclast tendril" - desc = "A tendril removed from an asteroclast. It's entirely lifeless." - icon = 'icons/mob/blob.dmi' - icon_state = "tendril" - item_state = "blob_tendril" - w_class = ITEM_SIZE_LARGE - attack_verb = list("smacked", "smashed", "whipped") - material = /decl/material/solid/organic/plantmatter - var/is_tendril = TRUE - var/types_of_tendril = list("solid", "fire") - -/obj/item/blob_tendril/get_heat() - . = max(..(), atom_damage_type == BURN ? 1000 : 0) - -/obj/item/blob_tendril/Initialize() - . = ..() - if(is_tendril) - var/tendril_type - tendril_type = pick(types_of_tendril) - switch(tendril_type) - if("solid") - desc = "An incredibly dense, yet flexible, tendril, removed from an asteroclast." - set_base_attack_force(10) - color = COLOR_BRONZE - origin_tech = @'{"materials":2}' - if("fire") - desc = "A tendril removed from an asteroclast. It's hot to the touch." - atom_damage_type = BURN - set_base_attack_force(15) - color = COLOR_AMBER - origin_tech = @'{"powerstorage":2}' - -/obj/item/blob_tendril/afterattack(obj/O, mob/user, proximity) - if(!proximity) - return - if(is_tendril && prob(50)) - set_base_attack_force(get_base_attack_force()-1) - if(get_base_attack_force() <= 0) - visible_message(SPAN_NOTICE("\The [src] crumbles apart!")) - user.drop_from_inventory(src) - new /obj/effect/decal/cleanable/ash(src.loc) - qdel(src) - -/obj/item/blob_tendril/core - name = "asteroclast nucleus sample" - desc = "A sample taken from an asteroclast's nucleus. It pulses with energy." - icon_state = "core_sample" - item_state = "blob_core" - w_class = ITEM_SIZE_NORMAL - origin_tech = @'{"materials":4,"wormholes":5,"biotech":7}' - is_tendril = FALSE - -/obj/item/blob_tendril/core/aux - name = "asteroclast auxiliary nucleus sample" - desc = "A sample taken from an asteroclast's auxiliary nucleus." - icon_state = "core_sample_2" - origin_tech = @'{"materials":2,"wormholes":3,"biotech":4}' diff --git a/code/modules/events/blob.dm b/mods/content/blob/blob_event.dm similarity index 69% rename from code/modules/events/blob.dm rename to mods/content/blob/blob_event.dm index 024112263be1..e9cec3d0d377 100644 --- a/code/modules/events/blob.dm +++ b/mods/content/blob/blob_event.dm @@ -1,8 +1,19 @@ /datum/event/blob announceWhen = 12 - var/obj/effect/blob/core/Blob +// Actually add the blob event to the major events container. +/datum/event_container/major/New() + . = ..() + available_events += new /datum/event_meta( + EVENT_LEVEL_MAJOR, + "Blob", + /datum/event/blob, + 0, + list(ASSIGNMENT_ENGINEER = 40), + 1 + ) + /datum/event/blob/announce() level_seven_announcement() @@ -15,7 +26,7 @@ log_and_message_admins("Blob spawned in \the [get_area_name(T)]", location = T) Blob = new /obj/effect/blob/core(T) - for(var/i = 1; i < rand(3, 4), i++) + for(var/i in 1 to rand(2, 3)) Blob.Process() /datum/event/blob/tick() diff --git a/mods/content/blob/blob_follow.dm b/mods/content/blob/blob_follow.dm new file mode 100644 index 000000000000..2264fe173a00 --- /dev/null +++ b/mods/content/blob/blob_follow.dm @@ -0,0 +1,4 @@ +/datum/follow_holder/blob + sort_order = 9 + followed_type = /obj/effect/blob/core + suffix = "Blob" \ No newline at end of file diff --git a/mods/content/blob/blob_grenade_damage.dm b/mods/content/blob/blob_grenade_damage.dm new file mode 100644 index 000000000000..89bcb8b7e3c8 --- /dev/null +++ b/mods/content/blob/blob_grenade_damage.dm @@ -0,0 +1,16 @@ +/obj/item/grenade/smokebomb/detonate() + . = ..() + for(var/obj/effect/blob/B in view(8,src)) + var/damage = round(30/(get_dist(B,src)+1)) + B.current_health -= damage + B.update_icon() + +/obj/item/grenade/flashbang/on_detonate(turf/our_turf) + var/const/BASE_DAMAGE = 30 + // Deals BASE_DAMAGE damage at 0 distance, + // half at 1, 1/3 at 2, 1/4 at 3, and so on. + . = ..() + FOR_DVIEW(var/obj/effect/blob/enemy_blob, 7, our_turf, INVISIBILITY_MAXIMUM) //Blob damage here + var/damage = round(BASE_DAMAGE/(get_dist(enemy_blob, our_turf)+1)) + enemy_blob.take_damage(damage, BURN) + END_FOR_DVIEW \ No newline at end of file diff --git a/mods/content/blob/blob_samples.dm b/mods/content/blob/blob_samples.dm new file mode 100644 index 000000000000..20661f6a4246 --- /dev/null +++ b/mods/content/blob/blob_samples.dm @@ -0,0 +1,58 @@ +/obj/item/blob_sample + abstract_type = /obj/item/blob_sample + icon_state = ICON_STATE_WORLD + w_class = ITEM_SIZE_LARGE + attack_verb = list("smacked", "smashed", "whipped") + material = /decl/material/solid/organic/plantmatter + +/obj/item/blob_sample/get_heat() + . = max(..(), atom_damage_type == BURN ? 1000 : 0) + +/obj/item/blob_sample/tendril + name = "asteroclast tendril" + desc = "A tendril removed from an asteroclast. It's entirely lifeless." + icon = 'mods/content/blob/icons/blob_tendril.dmi' + var/types_of_tendril = list("solid", "fire") + +/obj/item/blob_sample/tendril/Initialize() + . = ..() + var/tendril_type = pick(types_of_tendril) + switch(tendril_type) + if("solid") + desc = "An incredibly dense, yet flexible, tendril, removed from an asteroclast." + set_base_attack_force(10) + color = COLOR_BRONZE + origin_tech = @'{"materials":2}' + if("fire") + desc = "A tendril removed from an asteroclast. It's hot to the touch." + atom_damage_type = BURN + set_base_attack_force(15) + color = COLOR_AMBER + origin_tech = @'{"powerstorage":2}' + +/obj/item/blob_sample/tendril/afterattack(atom/target, mob/user, proximity) + . = ..() // ensure we can heat things with it if it's a spicy tendril + // don't return on parent success, we want to take damage either way + if(!proximity) + return + if(prob(50)) // we only take damage half the time + return + set_base_attack_force(get_base_attack_force()-1) + if(get_base_attack_force() <= 0) + visible_message(SPAN_NOTICE("\The [src] crumbles apart!")) + user.drop_from_inventory(src) + new /obj/effect/decal/cleanable/ash(src.loc) + qdel(src) + +/obj/item/blob_sample/core + name = "asteroclast nucleus sample" + desc = "A sample taken from an asteroclast's nucleus. It pulses with energy." + icon = 'mods/content/blob/icons/blob_core_sample.dmi' + w_class = ITEM_SIZE_NORMAL + origin_tech = @'{"materials":4,"wormholes":5,"biotech":7}' + +/obj/item/blob_sample/core/aux + name = "asteroclast auxiliary nucleus sample" + desc = "A sample taken from an asteroclast's auxiliary nucleus." + icon = 'mods/content/blob/icons/blob_aux_core_sample.dmi' + origin_tech = @'{"materials":2,"wormholes":3,"biotech":4}' diff --git a/code/controllers/subsystems/processing/blob.dm b/mods/content/blob/blob_subsystem.dm similarity index 100% rename from code/controllers/subsystems/processing/blob.dm rename to mods/content/blob/blob_subsystem.dm diff --git a/mods/content/blob/icons/blob.dmi b/mods/content/blob/icons/blob.dmi new file mode 100644 index 000000000000..e0ee0f169df4 Binary files /dev/null and b/mods/content/blob/icons/blob.dmi differ diff --git a/mods/content/blob/icons/blob_aux_core_sample.dmi b/mods/content/blob/icons/blob_aux_core_sample.dmi new file mode 100644 index 000000000000..7e3a4de64a7e Binary files /dev/null and b/mods/content/blob/icons/blob_aux_core_sample.dmi differ diff --git a/mods/content/blob/icons/blob_core_sample.dmi b/mods/content/blob/icons/blob_core_sample.dmi new file mode 100644 index 000000000000..cbb1f5b06b3b Binary files /dev/null and b/mods/content/blob/icons/blob_core_sample.dmi differ diff --git a/mods/content/blob/icons/blob_tendril.dmi b/mods/content/blob/icons/blob_tendril.dmi new file mode 100644 index 000000000000..eabc13ddf6ee Binary files /dev/null and b/mods/content/blob/icons/blob_tendril.dmi differ diff --git a/mods/content/breath_holding/_breath_holding.dme b/mods/content/breath_holding/_breath_holding.dme new file mode 100644 index 000000000000..b00488d9cd1e --- /dev/null +++ b/mods/content/breath_holding/_breath_holding.dme @@ -0,0 +1,9 @@ +#ifndef CONTENT_PACK_BREATH_HOLDING +#define CONTENT_PACK_BREATH_HOLDING +// BEGIN_INCLUDE +#include "breath_holding.dm" +#include "living_overrides.dm" +#include "living_verbs.dm" +#include "lung_overrides.dm" +// END_INCLUDE +#endif \ No newline at end of file diff --git a/mods/content/breath_holding/breath_holding.dm b/mods/content/breath_holding/breath_holding.dm new file mode 100644 index 000000000000..ebed308430a1 --- /dev/null +++ b/mods/content/breath_holding/breath_holding.dm @@ -0,0 +1,3 @@ +/decl/modpack/breath_holding + name = "Breath Holding" + desc = "Adds the ability for some mobs to hold their breath." \ No newline at end of file diff --git a/mods/content/breath_holding/living_overrides.dm b/mods/content/breath_holding/living_overrides.dm new file mode 100644 index 000000000000..862ded3100fb --- /dev/null +++ b/mods/content/breath_holding/living_overrides.dm @@ -0,0 +1,43 @@ +// override to make a held breath take priority +/mob/living/get_breath(obj/item/organ/internal/lungs/lungs) + if(lungs?.holding_breath && lungs.held_breath) + return lungs.held_breath + return ..() + +// override that prevents getting a new breath if we already have one +/mob/living/obtain_new_breath(obj/item/organ/internal/lungs/lungs) + if(lungs?.held_breath) // don't ever take a new breath if we have one held + return null + . = ..() + if(lungs?.holding_breath) // hold our current breath + lungs.held_breath = . + +/mob/living/handle_pre_breath(obj/item/organ/internal/lungs/lungs) + if((. = ..())) // something skipped breathing, so we can't breathe in or out + return + if(!lungs) // can't do any of this without lungs + return + if(stat != CONSCIOUS && lungs.holding_breath) // if you pass out from holding your breath too long, you should start breathing again + lungs.holding_breath = FALSE + // exhale the currently held breath if we're done not holding it anymore + if(lungs.held_breath && !lungs.holding_breath) + handle_post_breath(lungs.held_breath) + +/mob/living/handle_post_breath(datum/gas_mixture/breath) + var/decl/bodytype/root_bodytype = get_bodytype() + if(!root_bodytype?.breathing_organ) + return + var/obj/item/organ/internal/lungs/lungs = get_organ(root_bodytype.breathing_organ, /obj/item/organ/internal/lungs) + if(lungs?.holding_breath) + return // don't exhale if holding a breath + . = ..() // exhale our held breath + if(lungs) + lungs.held_breath = null // clear the old breath + +// OVERRIDE: can't sniff while holding your breath +/mob/living/sniff_verb() + var/obj/item/organ/internal/lungs/breathe_organ = get_organ(get_bodytype().breathing_organ, /obj/item/organ/internal/lungs) + if(breathe_organ?.holding_breath) + to_chat(src, SPAN_WARNING("You can't sniff while holding your breath!")) + return + return ..() diff --git a/mods/content/breath_holding/living_verbs.dm b/mods/content/breath_holding/living_verbs.dm new file mode 100644 index 000000000000..e0af2f35c1b8 --- /dev/null +++ b/mods/content/breath_holding/living_verbs.dm @@ -0,0 +1,9 @@ +/mob/living/proc/hold_breath() + set name = "Hold Breath" + set desc = "Hold your breath, or stop holding your breath." + set category = "IC" + set src = usr + if(!need_breathe()) + return + var/obj/item/organ/internal/lungs/lungs = get_organ(get_bodytype().breathing_organ, /obj/item/organ/internal/lungs) + return lungs?.hold_breath() \ No newline at end of file diff --git a/mods/content/breath_holding/lung_overrides.dm b/mods/content/breath_holding/lung_overrides.dm new file mode 100644 index 000000000000..45215604accb --- /dev/null +++ b/mods/content/breath_holding/lung_overrides.dm @@ -0,0 +1,39 @@ +/obj/item/organ/internal/lungs + var/can_hold_breath = TRUE + /// The breath currently being held. + var/datum/gas_mixture/held_breath = null + /// Whether or not to hold the next breath. If FALSE, any held breath (if it exists) will be exhaled. If TRUE, the next breath will be held. + var/holding_breath = FALSE + +/obj/item/organ/internal/lungs/do_uninstall(in_place, detach, ignore_children) + var/mob/living/prior_owner = owner + if(!(. = ..())) + return + if(istype(prior_owner) && !prior_owner.get_organ(BP_LUNGS)) + prior_owner.verbs -= /mob/living/proc/hold_breath + +/obj/item/organ/internal/lungs/do_install(mob/living/human/target, obj/item/organ/external/affected, in_place) + . = ..() + if(istype(owner) && !QDELETED(owner) && can_hold_breath) + owner.verbs |= /mob/living/proc/hold_breath + +/obj/item/organ/internal/lungs/proc/hold_breath() + if(!can_hold_breath) + if(owner) + owner.verbs -= /mob/living/proc/hold_breath + return + // if there's ever a reason we should allow ownerless breath-holding this will have to be changed + if(!owner || owner.stat != CONSCIOUS) + return + if(!holding_breath) + owner.visible_message(SPAN_WARNING("\The [src] starts holding their breath!"), SPAN_WARNING("You start holding your breath!")) + else + owner.visible_message(SPAN_NOTICE("\The [src] starts breathing again."), SPAN_NOTICE("You stop holding your breath.")) + holding_breath = !holding_breath + owner.try_breathe() // inhale/exhale immediately + +// OVERRIDE: Can't drown while holding your breath +/obj/item/organ/internal/lungs/can_drown() + if(holding_breath && held_breath) + return FALSE + return ..() \ No newline at end of file diff --git a/mods/content/byond_membership/_byond_membership.dm b/mods/content/byond_membership/_byond_membership.dm index c1944de09b37..5dbc59c09d02 100644 --- a/mods/content/byond_membership/_byond_membership.dm +++ b/mods/content/byond_membership/_byond_membership.dm @@ -7,8 +7,8 @@ /decl/communication_channel/ooc/get_emblem(client/C) if(C && C.get_byond_membership() && C.get_preference_value(/datum/client_preference/byond_membership/emblem) == PREF_SHOW) - var/decl/modpack/byond_membership/bm = GET_DECL(/decl/modpack/byond_membership) - return "[html_icon(bm.emblem)] " + var/decl/modpack/byond_membership/membership = GET_DECL(/decl/modpack/byond_membership) + return "[html_icon(membership.emblem)] " /datum/client_preference/byond_membership/emblem description = "BYOND Membership Emblem" diff --git a/mods/content/corporate/away_sites/lar_maria/lar_maria-1.dmm b/mods/content/corporate/away_sites/lar_maria/lar_maria-1.dmm index 7b0313e2d201..ac4c19eb0c57 100644 --- a/mods/content/corporate/away_sites/lar_maria/lar_maria-1.dmm +++ b/mods/content/corporate/away_sites/lar_maria/lar_maria-1.dmm @@ -245,6 +245,12 @@ /area/lar_maria/vir_main) "aL" = ( /obj/structure/closet/secure_closet/personal/patient, +/obj/random/contraband{ + spawn_nothing_percentage = 80 + }, +/obj/random/maintenance/medical{ + spawn_nothing_percentage = 70 + }, /turf/floor/tiled/white, /area/lar_maria/vir_main) "aM" = ( @@ -578,6 +584,8 @@ /area/lar_maria/vir_main) "bO" = ( /obj/structure/table/glass, +/obj/random/medical, +/obj/random/medical, /turf/floor/tiled/white, /area/lar_maria/vir_main) "bQ" = ( @@ -904,6 +912,7 @@ /obj/structure/table/glass, /obj/item/firstaid/surgery, /obj/machinery/light, +/obj/random/medical, /turf/floor/tiled/white, /area/lar_maria/vir_main) "cG" = ( @@ -920,6 +929,7 @@ "cI" = ( /obj/structure/table/glass, /obj/item/scalpel, +/obj/random/medical, /turf/floor/tiled/white, /area/lar_maria/vir_main) "cJ" = ( @@ -1206,6 +1216,12 @@ /obj/machinery/light{ dir = 1 }, +/obj/random/contraband{ + spawn_nothing_percentage = 80 + }, +/obj/random/maintenance/medical{ + spawn_nothing_percentage = 70 + }, /turf/floor/tiled/white, /area/lar_maria/vir_aux) "du" = ( @@ -1214,6 +1230,12 @@ /area/lar_maria/vir_aux) "dv" = ( /obj/structure/closet/secure_closet/personal/patient, +/obj/random/contraband{ + spawn_nothing_percentage = 80 + }, +/obj/random/maintenance/medical{ + spawn_nothing_percentage = 70 + }, /turf/floor/tiled/white, /area/lar_maria/vir_aux) "dw" = ( @@ -1621,6 +1643,7 @@ "eF" = ( /obj/structure/table/glass, /obj/item/box/syringes, +/obj/random/medical/lite, /turf/floor/tiled/white, /area/lar_maria/vir_aux) "eG" = ( @@ -1628,6 +1651,10 @@ dir = 4 }, /obj/structure/table/glass, +/obj/random/medical/lite, +/obj/random/maintenance/medical{ + spawn_nothing_percentage = 70 + }, /turf/floor/tiled/white, /area/lar_maria/vir_aux) "eH" = ( @@ -1649,6 +1676,9 @@ /obj/structure/table/steel_reinforced, /obj/random/smokes, /obj/item/gun/energy/taser, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "eK" = ( @@ -1669,7 +1699,15 @@ "eN" = ( /obj/structure/closet, /obj/item/clothing/jumpsuit/red, -/obj/item/gun/projectile/shotgun/pump, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, +/obj/random/projectile/sec{ + spawn_nothing_percentage = 40 + }, +/obj/random/projectile/sec{ + spawn_nothing_percentage = 40 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "eO" = ( @@ -1694,6 +1732,9 @@ dir = 8; pixel_x = 24 }, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "eQ" = ( @@ -1793,12 +1834,16 @@ /obj/machinery/light{ dir = 8 }, +/obj/random/medical/lite, /turf/floor/tiled, /area/lar_maria/sec_wing) "ff" = ( /obj/structure/table/steel_reinforced, /obj/item/chems/spray/pepper, /obj/item/deck/cards, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "fg" = ( @@ -1806,6 +1851,9 @@ /obj/item/baton, /obj/item/baton, /obj/item/baton, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "fh" = ( @@ -1856,11 +1904,18 @@ "fm" = ( /obj/structure/table/steel_reinforced, /obj/item/clothing/head/soft/zhp_cap, +/obj/random/smokes, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "fn" = ( /obj/structure/table/steel_reinforced, /obj/item/handcuffs, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "fo" = ( @@ -1887,7 +1942,9 @@ /obj/structure/cable{ icon_state = "0-2" }, -/obj/machinery/computer/modular, +/obj/machinery/computer/modular{ + dir = 1 + }, /turf/floor/tiled/white, /area/lar_maria/vir_aux) "fr" = ( @@ -1900,6 +1957,10 @@ "fs" = ( /obj/structure/table/glass, /obj/item/box/autoinjectors, +/obj/random/medical/lite, +/obj/random/maintenance/medical{ + spawn_nothing_percentage = 70 + }, /turf/floor/tiled/white, /area/lar_maria/vir_aux) "ft" = ( @@ -2186,6 +2247,9 @@ /obj/structure/cable{ icon_state = "1-4" }, +/obj/structure/cable{ + icon_state = "2-4" + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "fT" = ( @@ -2437,6 +2501,10 @@ /obj/item/stack/material/aerogel/mapped/tritium/ten, /obj/item/wirecutters, /obj/item/wrench, +/obj/random/tech_supply, +/obj/random/tech_supply, +/obj/random/tech_supply, +/obj/random/tool/power, /turf/floor/plating, /area/lar_maria/sec_wing) "gu" = ( @@ -2538,6 +2606,7 @@ /area/lar_maria/vir_access) "gH" = ( /obj/machinery/power/smes/buildable, +/obj/structure/cable, /turf/floor/plating, /area/lar_maria/sec_wing) "gI" = ( @@ -2562,7 +2631,7 @@ /turf/floor/plating, /area/lar_maria/sec_wing) "gL" = ( -/obj/machinery/suit_cycler, +/obj/machinery/suit_cycler/engineering/prepared/atmospheric, /turf/floor/plating, /area/lar_maria/sec_wing) "gM" = ( @@ -3309,6 +3378,9 @@ name = "Cells Dock Lockdown"; pixel_y = 7 }, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, /turf/floor/tiled, /area/lar_maria/sec_wing) "iC" = ( @@ -3447,6 +3519,43 @@ }, /turf/floor/tiled/white, /area/lar_maria/sec_wing) +"ov" = ( +/obj/structure/cable{ + icon_state = "1-2" + }, +/turf/floor/plating, +/area/lar_maria/sec_wing) +"qL" = ( +/obj/structure/table/glass, +/obj/item/box/freezer, +/obj/random/medical/lite, +/obj/random/maintenance/medical{ + spawn_nothing_percentage = 70 + }, +/turf/floor/tiled/white, +/area/lar_maria/vir_aux) +"vg" = ( +/obj/structure/table/steel_reinforced, +/obj/random/maintenance/security{ + spawn_nothing_percentage = 50 + }, +/turf/floor/tiled, +/area/lar_maria/sec_wing) +"De" = ( +/obj/random/medical/lite, +/turf/floor/tiled/white, +/area/lar_maria/vir_aux) +"Fl" = ( +/obj/machinery/suit_cycler/medical/prepared, +/turf/floor/plating, +/area/lar_maria/sec_wing) +"Ux" = ( +/obj/machinery/door/airlock/security, +/obj/structure/cable{ + icon_state = "1-2" + }, +/turf/floor/plating, +/area/lar_maria/sec_wing) (1,1,1) = {" aa @@ -22541,9 +22650,9 @@ cO cO cO cO -hC +vg eK -hC +vg cO iB iK @@ -24555,8 +24664,8 @@ eO fj fy fS -gi -dC +Ux +ov gH cO he @@ -25769,7 +25878,7 @@ cO fN cO dC -gL +Fl cO hk hx @@ -27985,7 +28094,7 @@ du du em ds -eY +qL fq fD ds @@ -28998,7 +29107,7 @@ eG fb ft ds -ds +De dr dr aa diff --git a/mods/content/corporate/away_sites/lar_maria/lar_maria-2.dmm b/mods/content/corporate/away_sites/lar_maria/lar_maria-2.dmm index 7707209d40df..e6ba0c32dd3b 100644 --- a/mods/content/corporate/away_sites/lar_maria/lar_maria-2.dmm +++ b/mods/content/corporate/away_sites/lar_maria/lar_maria-2.dmm @@ -509,7 +509,7 @@ /turf/floor/plating, /area/lar_maria/solar_control) "br" = ( -/obj/machinery/suit_cycler, +/obj/machinery/suit_cycler/engineering/prepared/atmospheric, /turf/floor/plating, /area/lar_maria/solar_control) "bs" = ( @@ -618,6 +618,9 @@ /obj/machinery/light{ dir = 1 }, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, /turf/floor/tiled, /area/lar_maria/library) "bJ" = ( @@ -808,31 +811,49 @@ "cr" = ( /obj/structure/bookcase, /obj/item/book/manual/engineering_guide, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, /turf/floor/tiled, /area/lar_maria/library) "cs" = ( /obj/structure/bookcase, /obj/item/book/fluff/stasis, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, /turf/floor/tiled, /area/lar_maria/library) "cu" = ( /obj/structure/bookcase, /obj/item/book/manual/medical_diagnostics_manual, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, /turf/floor/tiled, /area/lar_maria/library) "cv" = ( /obj/structure/bookcase, /obj/item/book/manual/detective, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, /turf/floor/tiled, /area/lar_maria/library) "cx" = ( /obj/structure/bookcase, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, /turf/floor/tiled, /area/lar_maria/library) "cy" = ( /obj/structure/bookcase, /obj/item/book/fluff/anomaly_spectroscopy, /obj/item/book/fluff/anomaly_testing, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, /turf/floor/tiled, /area/lar_maria/library) "cz" = ( @@ -959,7 +980,7 @@ /turf/floor/plating, /area/lar_maria/atmos) "cR" = ( -/obj/machinery/atmospherics/binary/pump{ +/obj/machinery/atmospherics/binary/pump/on{ dir = 4 }, /turf/floor/plating, @@ -1094,7 +1115,11 @@ /area/lar_maria/atmos) "dn" = ( /obj/machinery/atmospherics/omni/mixer{ - dir = 4 + dir = 4; + tag_west = 1; + tag_north = 1; + tag_north_con = 0.79; + tag_west_con = 0.21 }, /turf/floor/plating, /area/lar_maria/atmos) @@ -1106,14 +1131,16 @@ /area/lar_maria/atmos) "dp" = ( /obj/machinery/atmospherics/omni/filter{ - dir = 4 + dir = 4; + tag_south = 8; + tag_filter_gas_south = "gas_carbon_dioxide"; + tag_east = 2; + tag_west = 1 }, -/obj/abstract/landmark/allowed_leak, /turf/floor/plating, /area/lar_maria/atmos) "dr" = ( /obj/machinery/atmospherics/pipe/manifold/hidden/cyan, -/obj/abstract/landmark/allowed_leak, /turf/floor/plating, /area/lar_maria/atmos) "ds" = ( @@ -1179,12 +1206,10 @@ /area/lar_maria/atmos) "dD" = ( /obj/machinery/atmospherics/binary/oxyregenerator, -/obj/abstract/landmark/allowed_leak, /turf/floor/plating, /area/lar_maria/atmos) "dE" = ( /obj/machinery/atmospherics/pipe/simple/visible/blue, -/obj/abstract/landmark/allowed_leak, /turf/floor/plating, /area/lar_maria/atmos) "dF" = ( @@ -1853,6 +1878,7 @@ "fM" = ( /obj/structure/table, /obj/random/gloves, +/obj/random/medical/lite, /turf/floor/tiled, /area/lar_maria/office) "fN" = ( @@ -1866,6 +1892,7 @@ "fP" = ( /obj/structure/table/steel, /obj/random/firstaid, +/obj/random/medical/lite, /turf/floor/tiled, /area/lar_maria/office) "fQ" = ( @@ -2099,6 +2126,7 @@ "gC" = ( /obj/structure/table, /obj/random/trash, +/obj/random/medical/pillbottle, /turf/floor/plating, /area/lar_maria/hallway) "gD" = ( @@ -2248,6 +2276,15 @@ /area/lar_maria/mess_hall) "hb" = ( /obj/structure/closet/crate/trashcart, +/obj/random/trash, +/obj/random/trash, +/obj/random/trash, +/obj/random/useful{ + spawn_nothing_percentage = 70 + }, +/obj/item/book/union_charter{ + dat = "The contents of the book are heavily defaced and nearly illegible." + }, /turf/floor/plating, /area/lar_maria/hallway) "hc" = ( @@ -2367,15 +2404,6 @@ "hu" = ( /turf/floor/plating, /area/lar_maria/hallway) -"hv" = ( -/obj/machinery/power/apc{ - dir = 4; - name = "east bump"; - pixel_x = 24 - }, -/obj/random/trash, -/turf/floor/plating, -/area/lar_maria/hallway) "hw" = ( /obj/structure/cable{ icon_state = "0-4" @@ -2383,6 +2411,11 @@ /obj/effect/floor_decal/industrial/warning{ dir = 1 }, +/obj/machinery/power/apc{ + dir = 8; + name = "west bump"; + pixel_x = -24 + }, /turf/floor/tiled, /area/lar_maria/hallway) "hx" = ( @@ -2493,7 +2526,7 @@ "hI" = ( /obj/structure/table/marble, /obj/machinery/door/firedoor, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /turf/floor/tiled/white, /area/lar_maria/mess_hall) "hJ" = ( @@ -2993,7 +3026,8 @@ /obj/machinery/button/access/interior{ id_tag = "ZHPDock_airlock"; pixel_x = 25; - pixel_y = -25 + pixel_y = -25; + dir = 8 }, /turf/floor/plating, /area/lar_maria/hallway) @@ -3026,7 +3060,8 @@ "jn" = ( /obj/machinery/airlock_sensor{ id_tag = "ZHPDock_airlock_sensor"; - pixel_x = 25 + pixel_x = 22; + dir = 8 }, /turf/floor/plating, /area/lar_maria/hallway) @@ -3089,6 +3124,14 @@ }, /turf/floor/plating, /area/lar_maria/solar_control) +"nm" = ( +/obj/structure/bookcase, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 + }, +/obj/item/book/manual/evaguide, +/turf/floor/tiled, +/area/lar_maria/library) "ob" = ( /obj/structure/ladder, /obj/machinery/light/small{ @@ -3097,13 +3140,6 @@ }, /turf/floor/plating, /area/lar_maria/solar_control) -"ok" = ( -/obj/machinery/atmospherics/binary/pump{ - dir = 4 - }, -/obj/abstract/landmark/allowed_leak, -/turf/floor/plating, -/area/lar_maria/atmos) "pb" = ( /obj/machinery/atmospherics/binary/pump{ dir = 8 @@ -3161,18 +3197,29 @@ /obj/machinery/light/small, /turf/floor/plating, /area/lar_maria/atmos) +"uf" = ( +/obj/machinery/atmospherics/omni/filter{ + dir = 4; + tag_south = 8; + tag_filter_gas_south = "gas_oxygen"; + tag_east = 2; + tag_west = 1 + }, +/turf/floor/plating, +/area/lar_maria/atmos) "vb" = ( /obj/structure/hygiene/sink{ dir = 4; pixel_x = 11 }, -/obj/structure/mirror{ - pixel_x = 30 - }, /obj/machinery/alarm{ pixel_y = 23; req_access = newlist() }, +/obj/structure/mirror{ + pixel_x = 29; + dir = 8 + }, /turf/floor/tiled/white, /area/lar_maria/head_m) "wb" = ( @@ -3181,11 +3228,21 @@ pixel_x = 11 }, /obj/structure/mirror{ - pixel_x = 30 + pixel_x = 29; + dir = 8 }, /obj/random/trash, /turf/floor/tiled/white, /area/lar_maria/head_m) +"wW" = ( +/obj/machinery/atmospherics/omni/filter{ + dir = 4; + tag_north = 8; + tag_east = 2; + tag_west = 1 + }, +/turf/floor/plating, +/area/lar_maria/atmos) "xb" = ( /obj/structure/hygiene/sink{ dir = 8; @@ -3193,35 +3250,51 @@ pixel_y = 2 }, /obj/structure/mirror{ - pixel_x = -30 + pixel_x = -29; + dir = 4 }, /turf/floor/tiled/white, /area/lar_maria/head_f) +"xx" = ( +/obj/machinery/atmospherics/pipe/simple/visible/universal, +/turf/floor/plating, +/area/lar_maria/atmos) "Ag" = ( -/obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers{ +/obj/machinery/atmospherics/pipe/manifold/visible/red{ dir = 8 }, -/obj/abstract/landmark/allowed_leak, /turf/floor/plating, /area/lar_maria/atmos) +"Am" = ( +/obj/machinery/embedded_controller/radio/airlock/airlock_controller{ + id_tag = "ZHPDock"; + tag_airpump = "ZHPEastSolar_pump"; + tag_chamber_sensor = "ZHPEastSolar_sensor"; + tag_exterior_door = "ZHPEastSolar_outer"; + tag_interior_door = "ZHPEastSolar_inner"; + dir = 4; + pixel_x = -22 + }, +/turf/floor/plating, +/area/lar_maria/hallway) "DG" = ( /obj/machinery/computer/modular{ dir = 1 }, /turf/floor/tiled, /area/lar_maria/office) -"FZ" = ( -/obj/machinery/atmospherics/pipe/simple/visible/red, -/obj/abstract/landmark/allowed_leak, +"Kg" = ( +/obj/machinery/suit_cycler/medical/prepared, /turf/floor/plating, -/area/lar_maria/atmos) -"YS" = ( -/obj/machinery/atmospherics/pipe/simple/visible/red{ - dir = 10 +/area/lar_maria/solar_control) +"NR" = ( +/obj/structure/bookcase, +/obj/random/single/textbook{ + spawn_nothing_percentage = 80 }, -/obj/abstract/landmark/allowed_leak, -/turf/floor/plating, -/area/lar_maria/atmos) +/obj/item/book/union_charter, +/turf/floor/tiled, +/area/lar_maria/library) (1,1,1) = {" aa @@ -20885,7 +20958,7 @@ bw bw bI cd -cx +NR cM di cd @@ -21489,7 +21562,7 @@ aA ad bw bw -cx +nm cf cx cO @@ -22503,7 +22576,7 @@ pb ci cA cR -ok +cR dB tb bx @@ -22517,7 +22590,7 @@ ex eu gC hd -hv +hc hS iq iN @@ -22704,7 +22777,7 @@ bx bM ci cn -YS +cl dn dB bM @@ -22901,13 +22974,13 @@ aY bg nb br -br +Kg bx bN ci cn cn -ok +cR dC dO bx @@ -23333,7 +23406,7 @@ je jg ji jm -hu +Am jo jq aa @@ -23511,10 +23584,10 @@ bA bG bQ ck -bQ cU +xx Ag -bQ +xx dR bG eA @@ -23713,8 +23786,8 @@ bB bx bR ci -cn cV +cn dp dD dS @@ -23917,7 +23990,7 @@ bS ci cA cn -dp +uf dE dT bx @@ -24118,8 +24191,8 @@ bx qb cl cB -FZ -dp +cB +wW dF ub bx diff --git a/mods/content/corporate/away_sites/lar_maria/lar_maria.dm b/mods/content/corporate/away_sites/lar_maria/lar_maria.dm index 68c947fe0a57..269d8ed89b83 100644 --- a/mods/content/corporate/away_sites/lar_maria/lar_maria.dm +++ b/mods/content/corporate/away_sites/lar_maria/lar_maria.dm @@ -24,10 +24,10 @@ ///////////////////////////////////crew and prisoners /obj/abstract/landmark/corpse/lar_maria - eye_colors_per_species = list(SPECIES_HUMAN = list(COLOR_RED))//red eyes - skin_tones_per_species = list(SPECIES_HUMAN = list(-15)) - facial_styles_per_species = list(SPECIES_HUMAN = list(/decl/sprite_accessory/facial_hair/shaved)) - genders_per_species = list(SPECIES_HUMAN = list(MALE)) + eye_colors_per_species = list(/decl/species/human::uid = list(COLOR_RED))//red eyes + skin_tones_per_species = list(/decl/species/human::uid = list(-15)) + facial_styles_per_species = list(/decl/species/human::uid = list(/decl/sprite_accessory/facial_hair/shaved)) + genders_per_species = list(/decl/species/human::uid = list(MALE)) /mob/living/simple_animal/hostile/lar_maria name = "Lar Maria hostile mob" @@ -83,10 +83,10 @@ /obj/abstract/landmark/corpse/lar_maria/zhp_guard name = "dead guard" corpse_outfits = list(/decl/outfit/corpse/zhp_guard) - skin_tones_per_species = list(SPECIES_HUMAN = list(-15)) + skin_tones_per_species = list(/decl/species/human::uid = list(-15)) /obj/abstract/landmark/corpse/lar_maria/zhp_guard/dark - skin_tones_per_species = list(SPECIES_HUMAN = list(-115)) + skin_tones_per_species = list(/decl/species/human::uid = list(-115)) /decl/outfit/corpse/zhp_guard name = "Dead ZHP guard" @@ -161,9 +161,9 @@ /obj/abstract/landmark/corpse/lar_maria/virologist_female name = "dead virologist" corpse_outfits = list(/decl/outfit/corpse/zhp_virologist_female) - hair_styles_per_species = list(SPECIES_HUMAN = list(/decl/sprite_accessory/hair/flair)) - hair_colors_per_species = list(SPECIES_HUMAN = list("#ae7b48")) - genders_per_species = list(SPECIES_HUMAN = list(FEMALE)) + hair_styles_per_species = list(/decl/species/human::uid = list(/decl/sprite_accessory/hair/flair)) + hair_colors_per_species = list(/decl/species/human::uid = list("#ae7b48")) + genders_per_species = list(/decl/species/human::uid = list(FEMALE)) /decl/outfit/corpse/zhp_virologist_female name = "Dead female ZHP virologist" diff --git a/mods/content/corporate/icons/clothing/suit/nt_black.dmi b/mods/content/corporate/icons/clothing/suit/nt_black.dmi index 6fd8c4635a17..a28c0e9d590d 100644 Binary files a/mods/content/corporate/icons/clothing/suit/nt_black.dmi and b/mods/content/corporate/icons/clothing/suit/nt_black.dmi differ diff --git a/mods/content/corporate/icons/clothing/suit/nt_brown.dmi b/mods/content/corporate/icons/clothing/suit/nt_brown.dmi index 9791059cc687..9c35a590128b 100644 Binary files a/mods/content/corporate/icons/clothing/suit/nt_brown.dmi and b/mods/content/corporate/icons/clothing/suit/nt_brown.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/aether.dmi b/mods/content/corporate/icons/clothing/under/aether.dmi index b44fb13c2bc6..6c87d6007164 100644 Binary files a/mods/content/corporate/icons/clothing/under/aether.dmi and b/mods/content/corporate/icons/clothing/under/aether.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/focal.dmi b/mods/content/corporate/icons/clothing/under/focal.dmi index cec1cf348415..d2d9b45e50fd 100644 Binary files a/mods/content/corporate/icons/clothing/under/focal.dmi and b/mods/content/corporate/icons/clothing/under/focal.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/heph.dmi b/mods/content/corporate/icons/clothing/under/heph.dmi index 1cca7673b4f2..eae302368199 100644 Binary files a/mods/content/corporate/icons/clothing/under/heph.dmi and b/mods/content/corporate/icons/clothing/under/heph.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/hos_corporate.dmi b/mods/content/corporate/icons/clothing/under/hos_corporate.dmi index 053afd3fa604..0c2ab5200ea6 100644 Binary files a/mods/content/corporate/icons/clothing/under/hos_corporate.dmi and b/mods/content/corporate/icons/clothing/under/hos_corporate.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/pcrc.dmi b/mods/content/corporate/icons/clothing/under/pcrc.dmi index 05bbc81b842a..f3bffe07d5d9 100644 Binary files a/mods/content/corporate/icons/clothing/under/pcrc.dmi and b/mods/content/corporate/icons/clothing/under/pcrc.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/pilot.dmi b/mods/content/corporate/icons/clothing/under/pilot.dmi index b73798e13cf2..956101e2af94 100644 Binary files a/mods/content/corporate/icons/clothing/under/pilot.dmi and b/mods/content/corporate/icons/clothing/under/pilot.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/pilot_heph.dmi b/mods/content/corporate/icons/clothing/under/pilot_heph.dmi index 531533ab4664..658f129b22c6 100644 Binary files a/mods/content/corporate/icons/clothing/under/pilot_heph.dmi and b/mods/content/corporate/icons/clothing/under/pilot_heph.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/pilot_nt.dmi b/mods/content/corporate/icons/clothing/under/pilot_nt.dmi index 3139942a091f..eb649c789c84 100644 Binary files a/mods/content/corporate/icons/clothing/under/pilot_nt.dmi and b/mods/content/corporate/icons/clothing/under/pilot_nt.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/sec_corporate.dmi b/mods/content/corporate/icons/clothing/under/sec_corporate.dmi index cc7cc9446163..e0b9a156a3e4 100644 Binary files a/mods/content/corporate/icons/clothing/under/sec_corporate.dmi and b/mods/content/corporate/icons/clothing/under/sec_corporate.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/warden_corporate.dmi b/mods/content/corporate/icons/clothing/under/warden_corporate.dmi index 63c4441e36c2..2616040f2e90 100644 Binary files a/mods/content/corporate/icons/clothing/under/warden_corporate.dmi and b/mods/content/corporate/icons/clothing/under/warden_corporate.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/wardt.dmi b/mods/content/corporate/icons/clothing/under/wardt.dmi index bf6eb752378c..7caceac5affe 100644 Binary files a/mods/content/corporate/icons/clothing/under/wardt.dmi and b/mods/content/corporate/icons/clothing/under/wardt.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/work.dmi b/mods/content/corporate/icons/clothing/under/work.dmi index 7bad3e31258f..fbd90d46df08 100644 Binary files a/mods/content/corporate/icons/clothing/under/work.dmi and b/mods/content/corporate/icons/clothing/under/work.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/work_heph.dmi b/mods/content/corporate/icons/clothing/under/work_heph.dmi index 22208b9cb283..dfbae0e0f3c8 100644 Binary files a/mods/content/corporate/icons/clothing/under/work_heph.dmi and b/mods/content/corporate/icons/clothing/under/work_heph.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/work_nt.dmi b/mods/content/corporate/icons/clothing/under/work_nt.dmi index 161202531a51..31174887aa70 100644 Binary files a/mods/content/corporate/icons/clothing/under/work_nt.dmi and b/mods/content/corporate/icons/clothing/under/work_nt.dmi differ diff --git a/mods/content/corporate/icons/clothing/under/work_zeng.dmi b/mods/content/corporate/icons/clothing/under/work_zeng.dmi index 4e822fda1ac5..24d4a28e602d 100644 Binary files a/mods/content/corporate/icons/clothing/under/work_zeng.dmi and b/mods/content/corporate/icons/clothing/under/work_zeng.dmi differ diff --git a/mods/content/fantasy/_fantasy.dm b/mods/content/fantasy/_fantasy.dm index 41796ad41966..43b31de9fc4f 100644 --- a/mods/content/fantasy/_fantasy.dm +++ b/mods/content/fantasy/_fantasy.dm @@ -1,7 +1,3 @@ -#define SPECIES_KOBALOI "Kobaloi" -#define SPECIES_HNOLL "Hnoll" -#define SPECIES_DVERGR "Dvergr" - #define BODYTYPE_KOBALOI "reptomammalian body" #define BODYTYPE_HNOLL "hyenoid body" #define BODYTYPE_DVERGR "small humanoid body" diff --git a/mods/content/fantasy/datum/hnoll/markings.dm b/mods/content/fantasy/datum/hnoll/markings.dm index f9ad2750b7fc..e897347c5c81 100644 --- a/mods/content/fantasy/datum/hnoll/markings.dm +++ b/mods/content/fantasy/datum/hnoll/markings.dm @@ -2,7 +2,7 @@ /decl/sprite_accessory/hair/hnoll name = "Hnoll Rattail" icon_state = "hair_rattail" - species_allowed = list(SPECIES_HNOLL) + species_allowed = list(/decl/species/hnoll::uid) icon = 'mods/content/fantasy/icons/hnoll/hair.dmi' color_blend = ICON_MULTIPLY uid = "acc_hair_hnoll_rattail" @@ -135,7 +135,7 @@ /decl/sprite_accessory/facial_hair/hnoll name = "Hnoll Sideburns" icon_state = "facial_sideburns" - species_allowed = list(SPECIES_HNOLL) + species_allowed = list(/decl/species/hnoll::uid) icon = 'mods/content/fantasy/icons/hnoll/facial.dmi' color_blend = ICON_MULTIPLY uid = "acc_fhair_hnoll_sideburns" @@ -169,7 +169,7 @@ name = "Hnoll Nose" icon_state = "nose" icon = 'mods/content/fantasy/icons/hnoll/markings.dmi' - species_allowed = list(SPECIES_HNOLL) + species_allowed = list(/decl/species/hnoll::uid) body_parts = list(BP_HEAD) color_blend = ICON_MULTIPLY uid = "acc_marking_hnoll_nose" diff --git a/mods/content/fantasy/datum/hnoll/species.dm b/mods/content/fantasy/datum/hnoll/species.dm index 8bb1cd7496e7..e21059381009 100644 --- a/mods/content/fantasy/datum/hnoll/species.dm +++ b/mods/content/fantasy/datum/hnoll/species.dm @@ -12,7 +12,8 @@ ) /decl/species/hnoll - name = SPECIES_HNOLL + uid = "species_hnoll" + name = "Hnoll" name_plural = "Hnoll" description = "The hnoll are thickly-furred, powerfully built bipeds with a notable resemblance to the steppe \ hyenas that often decorate their coinage and art. The oldest hnoll cultures make their home on the Grass Ocean and the \ @@ -31,6 +32,9 @@ base_external_prosthetics_model = null available_background_info = list( + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), /decl/background_category/homeworld = list( /decl/background_detail/location/fantasy, /decl/background_detail/location/fantasy/mountains, diff --git a/mods/content/fantasy/datum/kobaloi/markings.dm b/mods/content/fantasy/datum/kobaloi/markings.dm index fd2c99a3f102..96132b522a3a 100644 --- a/mods/content/fantasy/datum/kobaloi/markings.dm +++ b/mods/content/fantasy/datum/kobaloi/markings.dm @@ -6,7 +6,7 @@ abstract_type = /decl/sprite_accessory/marking/kobaloi icon = 'mods/content/fantasy/icons/kobaloi/markings.dmi' color_blend = ICON_MULTIPLY - species_allowed = list(SPECIES_KOBALOI) + species_allowed = list(/decl/species/kobaloi::uid) body_parts = list(BP_HEAD) mask_to_bodypart = FALSE diff --git a/mods/content/fantasy/datum/kobaloi/species.dm b/mods/content/fantasy/datum/kobaloi/species.dm index 055513ab9816..c34156ee2a9a 100644 --- a/mods/content/fantasy/datum/kobaloi/species.dm +++ b/mods/content/fantasy/datum/kobaloi/species.dm @@ -1,5 +1,7 @@ /decl/species/kobaloi - name = SPECIES_KOBALOI + uid = "species_kobaloi" + name = "Kobaloi" + name_plural = "Kobaloi" spawn_flags = SPECIES_CAN_JOIN preview_outfit = null description = "Kobaloi are small, scaled and furred creatures that usually dwell in the quiet places of the world, \ @@ -15,6 +17,9 @@ base_external_prosthetics_model = null available_background_info = list( + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), /decl/background_category/homeworld = list( /decl/background_detail/location/fantasy, /decl/background_detail/location/fantasy/mountains, diff --git a/mods/content/fantasy/datum/overrides.dm b/mods/content/fantasy/datum/overrides.dm index 301f46558317..872d69c051c2 100644 --- a/mods/content/fantasy/datum/overrides.dm +++ b/mods/content/fantasy/datum/overrides.dm @@ -1,5 +1,8 @@ /decl/species available_background_info = list( + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), /decl/background_category/homeworld = list( /decl/background_detail/location/fantasy, /decl/background_detail/location/fantasy/mountains, @@ -25,10 +28,11 @@ ) ) default_background_info = list( - /decl/background_category/homeworld = /decl/background_detail/location/fantasy, - /decl/background_category/faction = /decl/background_detail/faction/fantasy, - /decl/background_category/heritage = /decl/background_detail/heritage/fantasy, - /decl/background_category/religion = /decl/background_detail/religion/other + /decl/background_category/citizenship = /decl/background_detail/citizenship/other, + /decl/background_category/homeworld = /decl/background_detail/location/fantasy, + /decl/background_category/faction = /decl/background_detail/faction/fantasy, + /decl/background_category/heritage = /decl/background_detail/heritage/fantasy, + /decl/background_category/religion = /decl/background_detail/religion/other ) // Rename wooden prostheses diff --git a/mods/content/fantasy/datum/species.dm b/mods/content/fantasy/datum/species.dm index 40c2c609ea74..6c8e041c8567 100644 --- a/mods/content/fantasy/datum/species.dm +++ b/mods/content/fantasy/datum/species.dm @@ -12,6 +12,9 @@ base_external_prosthetics_model = /decl/bodytype/prosthetic/wooden available_background_info = list( + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), /decl/background_category/homeworld = list( /decl/background_detail/location/fantasy, /decl/background_detail/location/fantasy/mountains, diff --git a/mods/content/fantasy/submaps/_submaps.dm b/mods/content/fantasy/submaps/_submaps.dm index 64c03240f4b7..da60d375fd62 100644 --- a/mods/content/fantasy/submaps/_submaps.dm +++ b/mods/content/fantasy/submaps/_submaps.dm @@ -43,7 +43,7 @@ 'sound/effects/wind/wind_4_2.ogg', 'sound/effects/wind/wind_5_1.ogg' ) - interior_ambient_light_modifier = -0.3 + interior_ambient_light_modifier = -0.4 area_flags = AREA_FLAG_EXTERNAL | AREA_FLAG_IS_BACKGROUND /area/fantasy/outside/point_of_interest diff --git a/mods/content/fantasy/submaps/woods/chemistry_shack/chemistry_shack.dmm b/mods/content/fantasy/submaps/woods/chemistry_shack/chemistry_shack.dmm index a35016e505f1..75a6ccefde76 100644 --- a/mods/content/fantasy/submaps/woods/chemistry_shack/chemistry_shack.dmm +++ b/mods/content/fantasy/submaps/woods/chemistry_shack/chemistry_shack.dmm @@ -32,6 +32,10 @@ pixel_x = -8 }, /obj/structure/table/desk/ebony, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -5 + }, /turf/floor/path/herringbone/basalt, /area/fantasy/outside/point_of_interest/chemistry_shack) "k" = ( @@ -113,7 +117,7 @@ /obj/item/food/grown/potato, /obj/item/food/grown/carrot, /obj/item/food/grown/carrot, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /turf/floor/wood/rough/walnut, /area/fantasy/outside/point_of_interest/chemistry_shack) "M" = ( @@ -148,6 +152,14 @@ pixel_x = -10; pixel_y = 9 }, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -16 + }, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = 5 + }, /turf/floor/path/herringbone/basalt, /area/fantasy/outside/point_of_interest/chemistry_shack) "W" = ( diff --git a/mods/content/fantasy/submaps/woods/suspicious_cabin/suspicious_cabin.dmm b/mods/content/fantasy/submaps/woods/suspicious_cabin/suspicious_cabin.dmm index c362ae5342f8..36df27b338b1 100644 --- a/mods/content/fantasy/submaps/woods/suspicious_cabin/suspicious_cabin.dmm +++ b/mods/content/fantasy/submaps/woods/suspicious_cabin/suspicious_cabin.dmm @@ -44,6 +44,10 @@ "t" = ( /obj/structure/table/wood/ebony, /obj/item/bladed/knife/iron, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -5 + }, /turf/floor/path/basalt, /area/template_noop) "v" = ( @@ -81,6 +85,14 @@ /obj/structure/table/wood/ebony, /obj/item/food/grown/potato, /obj/item/chems/cooking_vessel/pot/iron, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -16 + }, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = 5 + }, /turf/floor/path/basalt, /area/template_noop) "K" = ( @@ -112,6 +124,14 @@ /obj/item/chems/glass/handmade/bowl/wood, /obj/item/chems/glass/handmade/bowl/wood, /obj/item/chems/glass/handmade/cup/wood, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = -6 + }, +/obj/structure/wall_cabinet/ebony{ + pixel_y = 35; + pixel_x = 15 + }, /turf/floor/path/basalt, /area/template_noop) "U" = ( diff --git a/mods/content/government/_government.dme b/mods/content/government/_government.dme index 61285936c789..0555b590d8b2 100644 --- a/mods/content/government/_government.dme +++ b/mods/content/government/_government.dme @@ -2,11 +2,14 @@ #define MODPACK_GOVERNMENT // BEGIN_INCLUDE #include "government.dm" +#include "overrides.dm" #include "datum\ai_holo.dm" #include "datum\ai_laws.dm" +#include "items\alcohol.dm" #include "items\clutter.dm" #include "items\cups.dm" #include "items\documents.dm" +#include "items\masks.dm" #include "ruins\ec_old_crash\ec_old_crash.dm" // END_INCLUDE #endif diff --git a/mods/content/government/away_sites/icarus/icarus-1.dmm b/mods/content/government/away_sites/icarus/icarus-1.dmm index 00df803d74e4..64d4c6491dbf 100644 --- a/mods/content/government/away_sites/icarus/icarus-1.dmm +++ b/mods/content/government/away_sites/icarus/icarus-1.dmm @@ -660,7 +660,7 @@ /obj/effect/floor_decal/corner/grey/diagonal{ dir = 4 }, -/obj/item/kitchen/rollingpin, +/obj/item/rollingpin, /turf/floor/tiled, /area/icarus/vessel) "cu" = ( @@ -756,10 +756,6 @@ /obj/item/key, /turf/floor/tiled, /area/icarus/vessel) -"cJ" = ( -/obj/structure/closet, -/turf/floor/tiled, -/area/icarus/vessel) "cK" = ( /obj/effect/floor_decal/corner/grey/diagonal{ dir = 4 @@ -1046,11 +1042,6 @@ /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers, /turf/floor/tiled, /area/icarus/open) -"dE" = ( -/obj/structure/closet, -/obj/random/shoes, -/turf/floor/tiled, -/area/icarus/vessel) "dF" = ( /obj/structure/closet, /obj/random/action_figure, @@ -22735,7 +22726,7 @@ do aP dx bf -dE +dx as dU dU @@ -24547,13 +24538,13 @@ bX as cI aP -cJ +bm aP -cJ +bm aP bm aP -cJ +bm as cf ej @@ -25151,13 +25142,13 @@ bI bI cq as -cJ +bm bg de df cD aP -cJ +bm bg dH as diff --git a/mods/content/government/away_sites/icarus/icarus-2.dmm b/mods/content/government/away_sites/icarus/icarus-2.dmm index 9d2175f2af71..2651b5a523e5 100644 --- a/mods/content/government/away_sites/icarus/icarus-2.dmm +++ b/mods/content/government/away_sites/icarus/icarus-2.dmm @@ -341,12 +341,6 @@ /obj/effect/floor_decal/industrial/outline/grey, /turf/floor/bluegrid, /area/icarus/vessel) -"bl" = ( -/obj/structure/window/reinforced{ - dir = 4 - }, -/turf/floor/bluegrid, -/area/icarus/vessel) "bm" = ( /obj/machinery/light{ dir = 4; @@ -1377,11 +1371,6 @@ unique_merge_identifier = "icarus" }, /area/icarus/vessel) -"es" = ( -/turf/wall/shuttle{ - unique_merge_identifier = "icarus" - }, -/area/icarus/vessel) "et" = ( /obj/structure/shuttle/window, /turf/floor/shuttle/white, @@ -1423,11 +1412,6 @@ }, /turf/floor/shuttle/white, /area/icarus/vessel) -"eA" = ( -/turf/wall/shuttle{ - unique_merge_identifier = "icarus" - }, -/area/icarus/vessel) "eB" = ( /obj/structure/chair, /turf/floor/shuttle/white, @@ -1526,11 +1510,6 @@ }, /turf/floor/shuttle/white, /area/icarus/vessel) -"eT" = ( -/turf/wall/shuttle{ - unique_merge_identifier = "icarus" - }, -/area/icarus/vessel) "eU" = ( /obj/structure/chair{ dir = 1 @@ -1541,27 +1520,12 @@ /obj/machinery/light/small, /turf/floor/shuttle/white, /area/icarus/vessel) -"eW" = ( -/turf/wall/shuttle{ - unique_merge_identifier = "icarus" - }, -/area/icarus/vessel) "eX" = ( /obj/machinery/light/small{ dir = 8 }, /turf/floor/shuttle/white, /area/icarus/vessel) -"eY" = ( -/turf/wall/shuttle{ - unique_merge_identifier = "icarus" - }, -/area/icarus/open) -"eZ" = ( -/turf/wall/shuttle{ - unique_merge_identifier = "icarus" - }, -/area/icarus/open) "fa" = ( /obj/structure/cable{ icon_state = "1-4" @@ -20356,7 +20320,7 @@ er ey eJ ey -eY +eq fd fi fo @@ -20469,7 +20433,7 @@ ao ao ap aZ -bl +aZ bt ap bU @@ -20558,7 +20522,7 @@ er ez eK eC -eY +eq fd fi fo @@ -20756,11 +20720,11 @@ ee bX bX ap -es -eA +er +er eL -eT -eZ +er +eq fd fi fo @@ -21568,7 +21532,7 @@ er eC eC eV -eY +eq fd fi fo @@ -21770,7 +21734,7 @@ er eD eC eC -eY +eq fd fi fo @@ -21972,7 +21936,7 @@ er eD eC eH -eY +eq fd fi fo @@ -22174,7 +22138,7 @@ er eE eC eG -eY +eq fd fi fo @@ -22373,9 +22337,9 @@ av ak ap eu -eA +er eM -eW +er eu ep fj @@ -23989,9 +23953,9 @@ ag ag ap ew -eA +er eM -eT +er fc ep fl @@ -24194,7 +24158,7 @@ er eG eC eD -eY +eq fd fm fo @@ -24396,7 +24360,7 @@ er eH eC eD -eY +eq fd fm fo @@ -24598,7 +24562,7 @@ er eC eC eE -eY +eq fd fm fo @@ -24800,7 +24764,7 @@ er eI eC eC -eY +eq fd fm fo @@ -25604,11 +25568,11 @@ cL ag ag ap -es -eA +er +er eL -eT -eZ +er +eq fd fm fo @@ -25810,7 +25774,7 @@ er eC eS eX -eY +eq fd fm fo @@ -26012,7 +25976,7 @@ er ey kT ey -eY +eq fd fm fo diff --git a/icons/clothing/mask/admiral.dmi b/mods/content/government/icons/masks/admiral.dmi similarity index 100% rename from icons/clothing/mask/admiral.dmi rename to mods/content/government/icons/masks/admiral.dmi diff --git a/icons/clothing/mask/barros.dmi b/mods/content/government/icons/masks/barros.dmi similarity index 100% rename from icons/clothing/mask/barros.dmi rename to mods/content/government/icons/masks/barros.dmi diff --git a/icons/clothing/mask/turner.dmi b/mods/content/government/icons/masks/turner.dmi similarity index 100% rename from icons/clothing/mask/turner.dmi rename to mods/content/government/icons/masks/turner.dmi diff --git a/mods/content/government/items/alcohol.dm b/mods/content/government/items/alcohol.dm new file mode 100644 index 000000000000..1c3061a27fbf --- /dev/null +++ b/mods/content/government/items/alcohol.dm @@ -0,0 +1,16 @@ +/obj/item/chems/drinks/bottle/vodka + desc = "Aah, vodka. Prime choice of drink AND fuel by Indies around the galaxy." + +/decl/material/liquid/alcohol/vodka + lore_text = "Number one drink AND fueling choice for Independents around the galaxy." + +/obj/item/chems/drinks/bottle/premiumvodka + desc = "Premium distilled vodka imported directly from the Gilgamesh Colonial Confederation." + +/obj/item/chems/drinks/bottle/premiumvodka/make_random_name() + var/namepick = pick("Four Stripes","Gilgamesh","Novaya Zemlya","Indie","STS-35") + var/typepick = pick("Absolut","Gold","Quadruple Distilled","Platinum","Standard") + name = "[namepick] [typepick]" + +/decl/material/liquid/alcohol/vodka/premium + lore_text = "Premium distilled vodka imported directly from the Gilgamesh Colonial Confederation." diff --git a/mods/content/government/items/clutter.dm b/mods/content/government/items/clutter.dm index 2608d1ff5067..781a50f556d1 100644 --- a/mods/content/government/items/clutter.dm +++ b/mods/content/government/items/clutter.dm @@ -4,7 +4,7 @@ icon_state = "tableflag" _base_attack_force = 1 w_class = ITEM_SIZE_SMALL - attack_verb = list("whipped") + attack_verb = "whipped" hitsound = 'sound/weapons/towelwhip.ogg' desc = "The iconic flag of the Sol Central Government, a symbol with many different meanings." material = /decl/material/solid/organic/plastic diff --git a/mods/content/government/items/cups.dm b/mods/content/government/items/cups.dm index 95d996715669..403e16d5ab4d 100644 --- a/mods/content/government/items/cups.dm +++ b/mods/content/government/items/cups.dm @@ -4,3 +4,10 @@ base_icon = "coffeecup_SCG" icon_state = "coffeecup_SCG" base_name = "\improper SCG cup" + +/obj/item/chems/drinks/glass2/coffeecup/STC + name = "\improper ICCG coffee cup" + desc = "A coffee cup adorned with the flag of the Gilgamesh Colonial Confederation, for when you need some espionage charges to go with your morning coffee." + base_icon = "coffeecup_STC" + icon_state = "coffeecup_STC" + base_name = "\improper ICCG cup" \ No newline at end of file diff --git a/mods/content/government/items/documents.dm b/mods/content/government/items/documents.dm index 0612eb19169b..aad1bb6b0656 100644 --- a/mods/content/government/items/documents.dm +++ b/mods/content/government/items/documents.dm @@ -29,3 +29,8 @@ /obj/item/documents/scg/blue = 7, /obj/item/documents/scg/brains = 7 ) + +/obj/item/clothing/gloves/ring/seal/secretary + name = "\improper Secretary-General's official seal" + desc = "The official seal of the Secretary-General of the Sol Central Government, featured prominently on a silver ring." + use_material_name = FALSE \ No newline at end of file diff --git a/mods/content/government/items/masks.dm b/mods/content/government/items/masks.dm new file mode 100644 index 000000000000..9761827a8af0 --- /dev/null +++ b/mods/content/government/items/masks.dm @@ -0,0 +1,17 @@ +/obj/item/clothing/mask/rubber/barros + name = "Amaya Barros mask" + desc = "Current Secretary-General of Sol Central Government. Not that the real thing would visit this pigsty." + icon = 'mods/content/government/icons/masks/barros.dmi' + visible_name = "Amaya Barros" + +/obj/item/clothing/mask/rubber/admiral + name = "Admiral Diwali mask" + desc = "Admiral that led the infamous last stand at Helios against the Independent Navy in the Gaia conflict. For bridge officers who wish they'd achieve a fraction of that." + icon = 'mods/content/government/icons/masks/admiral.dmi' + visible_name = "Admiral Diwali" + +/obj/item/clothing/mask/rubber/turner + name = "Charles Turner mask" + desc = "Premier of the Gilgamesh Colonial Confederation. Probably shouldn't wear this in front of your veteran uncle." + icon = 'mods/content/government/icons/masks/turner.dmi' + visible_name = "Charles Turner" \ No newline at end of file diff --git a/mods/content/government/overrides.dm b/mods/content/government/overrides.dm new file mode 100644 index 000000000000..3ee91a01584c --- /dev/null +++ b/mods/content/government/overrides.dm @@ -0,0 +1,3 @@ +/mob/living/silicon/robot/drone/construction/init() + ..() + flavor_text = "It's a bulky construction drone stamped with a Sol Central glyph." \ No newline at end of file diff --git a/mods/content/government/ruins/ec_old_crash/ec_old_crash.dmm b/mods/content/government/ruins/ec_old_crash/ec_old_crash.dmm index 049ae42287b1..42df960f6273 100644 --- a/mods/content/government/ruins/ec_old_crash/ec_old_crash.dmm +++ b/mods/content/government/ruins/ec_old_crash/ec_old_crash.dmm @@ -18,7 +18,7 @@ /obj/effect/wallframe_spawn/reinforced, /obj/machinery/door/blast/regular/open{ id_tag = "scraplock"; - name = "External Blast Doors"; + name = "External Blast Doors" }, /obj/machinery/door/firedoor, /obj/abstract/landmark/scorcher, @@ -222,7 +222,7 @@ /obj/effect/wallframe_spawn/reinforced, /obj/machinery/door/blast/regular/open{ id_tag = "scraplock"; - name = "External Blast Doors"; + name = "External Blast Doors" }, /obj/machinery/door/firedoor, /turf/floor, @@ -1406,7 +1406,7 @@ /obj/effect/wallframe_spawn/reinforced, /obj/machinery/door/blast/regular/open{ id_tag = "scraplock"; - name = "External Blast Doors"; + name = "External Blast Doors" }, /obj/machinery/door/firedoor, /turf/floor, @@ -1707,7 +1707,7 @@ /obj/effect/wallframe_spawn/reinforced, /obj/machinery/door/blast/regular/open{ id_tag = "scraplock"; - name = "External Blast Doors"; + name = "External Blast Doors" }, /obj/machinery/door/firedoor, /obj/structure/cable{ diff --git a/mods/content/inertia/inertia_controller.dm b/mods/content/inertia/inertia_controller.dm index 6b020a67b60c..6adc6f3b230d 100644 --- a/mods/content/inertia/inertia_controller.dm +++ b/mods/content/inertia/inertia_controller.dm @@ -3,12 +3,12 @@ var/global/list/ship_inertial_dampers = list() /datum/ship_inertial_damper var/name = "ship inertial damper" - var/obj/machinery/holder + var/obj/machinery/inertial_damper/holder /datum/ship_inertial_damper/proc/get_damping_strength(var/reliable) - return 0 + return holder.get_damping_strength(reliable) -/datum/ship_inertial_damper/New(var/obj/machinery/_holder) +/datum/ship_inertial_damper/New(var/obj/machinery/inertial_damper/_holder) ..() holder = _holder global.ship_inertial_dampers += src diff --git a/mods/content/inertia/inertia_failure.dm b/mods/content/inertia/inertia_failure.dm index ce7d147f7709..9d9eb361e116 100644 --- a/mods/content/inertia/inertia_failure.dm +++ b/mods/content/inertia/inertia_failure.dm @@ -17,8 +17,8 @@ endWhen = rand(45, 120) /proc/inertial_dampener_event_can_fire() // Check if we have any ships that require dampers for this event to affect - for(var/obj/effect/overmap/visitable/ship/S in SSshuttle.ships) - if(S.needs_dampers) + for(var/obj/effect/overmap/visitable/ship/ship in SSshuttle.ships) + if(ship.needs_dampers) return TRUE return FALSE @@ -26,15 +26,15 @@ command_announcement.Announce("Inertial damper calibration error. Please restrict thruster use. Recalibration cycle initiated...", "[location_name()] Inertial Damper Subsystem", zlevels = affecting_z) /datum/event/inertial_damper/start() - for(var/obj/machinery/inertial_damper/I in SSmachines.machinery) - I.damping_modifier += -5 //Gm/h - I.was_reset = FALSE + for(var/obj/machinery/inertial_damper/damper_machine in SSmachines.machinery) + damper_machine.damping_modifier += -5 //Gm/h + damper_machine.was_reset = FALSE /datum/event/inertial_damper/end() var/display_announcement = FALSE - for(var/obj/machinery/inertial_damper/I in SSmachines.machinery) - I.damping_modifier = initial(I.damping_modifier) - if(!I.was_reset) + for(var/obj/machinery/inertial_damper/damper_machine in SSmachines.machinery) + damper_machine.damping_modifier = initial(damper_machine.damping_modifier) + if(!damper_machine.was_reset) display_announcement = TRUE break diff --git a/mods/content/inertia/inertial_damper.dm b/mods/content/inertia/inertial_damper.dm index 4cb9905a95ce..638dadfd4e4e 100644 --- a/mods/content/inertia/inertial_damper.dm +++ b/mods/content/inertia/inertial_damper.dm @@ -54,9 +54,9 @@ update_nearby_tiles(locs) controller = new(src) - var/obj/effect/overmap/visitable/ship/S = get_owning_overmap_object() - if(istype(S)) - S.inertial_dampers |= controller + var/obj/effect/overmap/visitable/ship/ship = get_owning_overmap_object() + if(istype(ship)) + ship.inertial_dampers |= controller src.overlays += "activated" @@ -136,6 +136,8 @@ /obj/machinery/inertial_damper/proc/SetBounds() bound_width = width * world.icon_size bound_height = height * world.icon_size + if(bound_height != world.icon_size || bound_width != world.icon_size) + appearance_flags = /obj/machinery::appearance_flags & ~TILE_BOUND /obj/machinery/inertial_damper/interface_interact(var/mob/user) ui_interact(user) diff --git a/mods/content/inertia/ship_inertia.dm b/mods/content/inertia/ship_inertia.dm index d903ef02aa14..daf7764ba1a0 100644 --- a/mods/content/inertia/ship_inertia.dm +++ b/mods/content/inertia/ship_inertia.dm @@ -8,9 +8,9 @@ /obj/effect/overmap/visitable/ship/populate_sector_objects() ..() - for(var/datum/ship_inertial_damper/I in global.ship_inertial_dampers) - if(check_ownership(I.holder)) - inertial_dampers |= I + for(var/datum/ship_inertial_damper/damper_datum in global.ship_inertial_dampers) + if(check_ownership(damper_datum.holder)) + inertial_dampers |= damper_datum // Theoretically there's no need to recalculate this every tick, // instead it should be recalculated any time damping strength changes @@ -18,9 +18,8 @@ /obj/effect/overmap/visitable/ship/Process(wait, tick) . = ..() damping_strength = 0 - for(var/datum/ship_inertial_damper/I in inertial_dampers) - var/obj/machinery/inertial_damper/ID = I.holder - damping_strength += ID.get_damping_strength(TRUE) + for(var/datum/ship_inertial_damper/damper_datum in inertial_dampers) + damping_strength += damper_datum.get_damping_strength(TRUE) /obj/effect/overmap/visitable/ship/adjust_speed(n_x, n_y) . = ..() @@ -30,15 +29,14 @@ if(needs_dampers && damping_strength < inertia_strength) var/list/areas_by_name = area_repository.get_areas_by_z_level() for(var/area_name in areas_by_name) - var/area/A = areas_by_name[area_name] - if(area_belongs_to_zlevels(A, map_z)) - A.throw_unbuckled_occupants(inertia_strength+2, inertia_strength, inertia_dir) + var/area/the_area = areas_by_name[area_name] + if(area_belongs_to_zlevels(the_area, map_z)) + the_area.throw_unbuckled_occupants(inertia_strength+2, inertia_strength, inertia_dir) // Add additional data to the engine console. /obj/machinery/computer/ship/engines/modify_ship_ui_data(list/ui_data) var/damping_strength = 0 for(var/datum/ship_inertial_damper/inertia_controller in linked.inertial_dampers) - var/obj/machinery/inertial_damper/damper = inertia_controller.holder - damping_strength += damper.get_damping_strength(FALSE) // get only the level it's set to, not the actual level + damping_strength += inertia_controller.holder.get_damping_strength(FALSE) // get only the level it's set to, not the actual level ui_data["damping_strength"] = damping_strength ui_data["needs_dampers"] = linked.needs_dampers \ No newline at end of file diff --git a/mods/content/inertia/wires.dm b/mods/content/inertia/wires.dm index 4cc74f8bc941..4a850ae4e20d 100644 --- a/mods/content/inertia/wires.dm +++ b/mods/content/inertia/wires.dm @@ -13,26 +13,26 @@ var/const/DAMPER_WIRE_AICONTROL = 8 // Cut to disable AI control. Mend to restore. /datum/wires/inertial_damper/CanUse() - var/obj/machinery/inertial_damper/I = holder - if(I.panel_open) + var/obj/machinery/inertial_damper/damper_machine = holder + if(damper_machine.panel_open) return TRUE return FALSE /datum/wires/inertial_damper/UpdateCut(index, mended) - var/obj/machinery/inertial_damper/I = holder + var/obj/machinery/inertial_damper/damper_machine = holder switch(index) if(DAMPER_WIRE_POWER) - I.input_cut = !mended + damper_machine.input_cut = !mended if(DAMPER_WIRE_HACK) if(!mended) - I.hacked = FALSE + damper_machine.hacked = FALSE if(DAMPER_WIRE_CONTROL) - I.locked = !mended + damper_machine.locked = !mended if(DAMPER_WIRE_AICONTROL) - I.ai_control_disabled = !mended + damper_machine.ai_control_disabled = !mended /datum/wires/inertial_damper/UpdatePulsed(var/index) - var/obj/machinery/inertial_damper/I = holder + var/obj/machinery/inertial_damper/damper_machine = holder switch(index) if(DAMPER_WIRE_HACK) - I.hacked = TRUE \ No newline at end of file + damper_machine.hacked = TRUE \ No newline at end of file diff --git a/mods/content/item_sharpening/effect_sharpen.dm b/mods/content/item_sharpening/effect_sharpen.dm index 5847ac347b36..511b83c6f349 100644 --- a/mods/content/item_sharpening/effect_sharpen.dm +++ b/mods/content/item_sharpening/effect_sharpen.dm @@ -2,7 +2,7 @@ var/uses = LAZYACCESS(parameters, IE_PAR_USES) if(uses <= 0) return base_damage - . = (1 + ((uses / max(1, LAZYACCESS(parameters, IE_PAR_MAX_USES))) * LAZYACCESS(parameters, IE_PAR_SHARP_DAM_MULT))) + . = base_damage * (1 + ((uses / max(1, LAZYACCESS(parameters, IE_PAR_MAX_USES))) * LAZYACCESS(parameters, IE_PAR_SHARP_DAM_MULT))) /decl/item_effect/sharpened/expend_attack_use(obj/item/used_item, mob/user, list/parameters) var/uses = LAZYACCESS(parameters, IE_PAR_USES) @@ -18,4 +18,4 @@ if(uses > 0) to_chat(user, SPAN_NOTICE("\The [item] has been honed to a keen edge.")) else - to_chat(user, SPAN_NOTICE("\The [item] in need of sharpening.")) + to_chat(user, SPAN_NOTICE("\The [item] is in need of sharpening.")) diff --git a/mods/content/item_sharpening/whetstone.dm b/mods/content/item_sharpening/whetstone.dm index cdfbb09eea51..4ff1dc020e3f 100644 --- a/mods/content/item_sharpening/whetstone.dm +++ b/mods/content/item_sharpening/whetstone.dm @@ -2,13 +2,15 @@ name = "whetstone" desc = "A worn-down lozenge used to sharpen blades." icon = 'icons/obj/items/striker.dmi' // TODO unique icon? + icon_state = ICON_STATE_WORLD w_class = ITEM_SIZE_TINY material_alteration = MAT_FLAG_ALTERATION_ALL material = /decl/material/solid/quartz + color = /decl/material/solid/quartz::color /obj/item/attackby(obj/item/used_item, mob/user) - if(istype(used_item, /obj/item/whetstone)) - return try_sharpen_with(user, used_item) + if(istype(used_item, /obj/item/whetstone) && try_sharpen_with(user, used_item)) + return TRUE return ..() /decl/loadout_option/utility/whetstone diff --git a/mods/content/matchmaking/matchmaker.dm b/mods/content/matchmaking/matchmaker.dm index ee7d49c6be8d..70e424a3dfde 100644 --- a/mods/content/matchmaking/matchmaker.dm +++ b/mods/content/matchmaking/matchmaker.dm @@ -10,9 +10,9 @@ if(character.mind && character.client?.prefs.relations.len) for(var/T in character.client.prefs.relations) var/TT = relation_types[T] - var/datum/relation/R = new TT - R.holder = character.mind - R.info = character.client.prefs.relations_info[T] + var/datum/relation/relation = new TT + relation.holder = character.mind + relation.info = character.client.prefs.relations_info[T] character.mind.gen_relations_info = character.client.prefs.relations_info["general"] if(!ishuman(character)) return TRUE @@ -35,33 +35,38 @@ /decl/modpack/matchmaking/Initialize() . = ..() for(var/T in subtypesof(/datum/relation/)) - var/datum/relation/R = T - relation_types[initial(R.name)] = T + var/datum/relation/relation = T + relation_types[initial(relation.name)] = T /decl/modpack/matchmaking/proc/do_matchmaking() var/list/to_warn = list() - for(var/datum/relation/R in relations) - if(R.other) + for(var/datum/relation/relation in relations) + if(relation.other) continue // don't warn about already-matched relations, even if they aren't finalised - R.find_match() - if(R.other && !R.finalized) - to_warn |= R.holder.current + relation.find_match() + if(relation.other && !relation.finalized) + to_warn |= relation.holder.current for(var/mob/M in to_warn) to_chat(M,"You have new connections. Use \"See Relationship Info\" to view and finalize them.") /decl/modpack/matchmaking/proc/get_relationships(datum/mind/M, finalized_only) . = list() - for(var/datum/relation/R in relations) - if(R.holder == M && R.other && (R.finalized || !finalized_only)) - . += R + for(var/datum/relation/relation in relations) + if(relation.holder == M && relation.other && (relation.finalized || !finalized_only)) + . += relation /decl/modpack/matchmaking/proc/get_relationships_between(datum/mind/holder, datum/mind/target, finalized_only) . = list() - for(var/datum/relation/R in relations) - if(R.holder == holder && R.other && R.other.holder == target && (R.finalized || !finalized_only)) - . += R + for(var/datum/relation/relation in relations) + if(relation.holder == holder && relation.other && relation.other.holder == target && (relation.finalized || !finalized_only)) + . += relation -/decl/human_examination/matchmaking/do_examine(var/mob/living/user, var/distance, var/mob/living/source) //These can either return text, or should return nothing at all if you're doing to_chat() +/decl/human_examination/matchmaking + // Show up after pose. + priority = /decl/human_examination/pose::priority + 1 + +// These should return null, text, or a list of text strings. +/decl/human_examination/matchmaking/do_examine(var/mob/living/user, var/distance, var/mob/living/human/source, hideflags, decl/pronouns/pronouns) if(!istype(source) || !istype(user)) return if(!source.mind || !user.mind || source.name != source.real_name) @@ -94,10 +99,10 @@ /datum/relation/proc/get_candidates() .= list() var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL - for(var/datum/relation/R in matchmaker.relations) - if(!valid_candidate(R.holder) || !can_connect(R)) + for(var/datum/relation/relation in matchmaker.relations) + if(!valid_candidate(relation.holder) || !can_connect(relation)) continue - . += R + . += relation /datum/relation/proc/valid_candidate(datum/mind/M) if(M == holder) //no, you NEED other people @@ -112,31 +117,31 @@ return TRUE -/datum/relation/proc/can_connect(var/datum/relation/R) +/datum/relation/proc/can_connect(var/datum/relation/relation) var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL for(var/datum/relation/D in matchmaker.relations) //have to check all connections between us and them - if(D.holder == R.holder && D.other && D.other.holder == holder) + if(D.holder == relation.holder && D.other && D.other.holder == holder) if(D.type in incompatible) return 0 - return (R.type in can_connect_to) && !(R.type in incompatible) && R.open + return (relation.type in can_connect_to) && !(relation.type in incompatible) && relation.open /datum/relation/proc/get_copy() - var/datum/relation/R = new type - R.holder = holder - R.info = holder.current && holder.current.client ? holder.current.client.prefs.relations_info[R.name] : info - R.open = 0 - return R + var/datum/relation/relation = new type + relation.holder = holder + relation.info = holder.current && holder.current.client ? holder.current.client.prefs.relations_info[relation.name] : info + relation.open = 0 + return relation /datum/relation/proc/find_match() var/list/candidates = get_candidates() if(!candidates.len) //bwoop bwoop return 0 - var/datum/relation/R = pick(candidates) - R.open-- - if(R.other) - R = R.get_copy() - other = R - R.other = src + var/datum/relation/relation = pick(candidates) + relation.open-- + if(relation.other) + relation = relation.get_copy() + other = relation + relation.other = src return 1 /datum/relation/proc/sever() @@ -198,16 +203,16 @@ dat += "Things they all know about you:
    [mind.gen_relations_info]
    " dat += "An \[F\] indicates that the other player has finalized the connection.
    " dat += "
    " - for(var/datum/relation/R in relations) - dat += "[R.other.finalized ? "\[F\] " : ""][R.other.holder], [R.other.holder.role_alt_title ? R.other.holder.role_alt_title : R.other.holder.assigned_role]." - if (!R.finalized) - dat += " Remove" + for(var/datum/relation/relation in relations) + dat += "[relation.other.finalized ? "\[F\] " : ""][relation.other.holder], [relation.other.holder.role_alt_title ? relation.other.holder.role_alt_title : relation.other.holder.assigned_role]." + if (!relation.finalized) + dat += " Remove" editable = 1 - dat += "
    [R.desc]" + dat += "
    [relation.desc]" dat += "
    " - dat += "Things they know about you:[!R.finalized ?"Edit" : ""]
    [R.info ? "[R.info]" : " Nothing specific."]" - if(R.other.info) - dat += "
    Things you know about them:
    [R.other.info]
    [R.other.holder.gen_relations_info]" + dat += "Things they know about you:[!relation.finalized ?"Edit" : ""]
    [relation.info ? "[relation.info]" : " Nothing specific."]" + if(relation.other.info) + dat += "
    Things you know about them:
    [relation.other.info]
    [relation.other.holder.gen_relations_info]" dat += "
    " if(mind.known_connections && mind.known_connections.len) @@ -231,12 +236,12 @@ if(mind.gen_relations_info) dat += "Things they know about you:
    [mind.gen_relations_info]
    " dat += "
    " - for(var/datum/relation/R in relations) - dat += "
    [R.desc]" + for(var/datum/relation/relation in relations) + dat += "
    [relation.desc]" dat += "
    " - dat += "Things they know about you:
    [R.info ? "[R.info]" : " Nothing specific."]" - if(R.other.info) - dat += "
    Things you know about them:
    [R.other.info]
    [R.other.holder.gen_relations_info]" + dat += "Things they know about you:
    [relation.info ? "[relation.info]" : " Nothing specific."]" + if(relation.other.info) + dat += "
    Things you know about them:
    [relation.other.info]
    [relation.other.holder.gen_relations_info]" dat += "
    " var/datum/browser/popup = new(usr, "relations", "Relationship Info") @@ -256,17 +261,17 @@ /mob/living/OnSelfTopic(href_list) if(href_list["del_relation"]) - var/datum/relation/R = locate(href_list["del_relation"]) - if(istype(R)) - R.sever() + var/datum/relation/relation = locate(href_list["del_relation"]) + if(istype(relation)) + relation.sever() see_relationship_info() return TOPIC_HANDLED if(href_list["info_relation"]) - var/datum/relation/R = locate(href_list["info_relation"]) - if(istype(R)) - var/info = sanitize(input("What would you like the other party for this connection to know about your character?","Character info",R.info) as message|null) + var/datum/relation/relation = locate(href_list["info_relation"]) + if(istype(relation)) + var/info = sanitize(input("What would you like the other party for this connection to know about your character?","Character info",relation.info) as message|null) if(info) - R.info = info + relation.info = info see_relationship_info() return TOPIC_HANDLED if(href_list["relations_close"]) @@ -275,8 +280,8 @@ if(ok == "Close anyway") var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL var/list/relations = matchmaker.get_relationships(mind) - for(var/datum/relation/R in relations) - R.finalize() + for(var/datum/relation/relation in relations) + relation.finalize() show_browser(src,null, "window=relations") else show_browser(src,null, "window=relations") diff --git a/mods/content/matchmaking/relations.dm b/mods/content/matchmaking/relations.dm index e516f04e83f0..b1c60305caba 100644 --- a/mods/content/matchmaking/relations.dm +++ b/mods/content/matchmaking/relations.dm @@ -15,9 +15,9 @@ pref.relations = R.read("relations") pref.relations_info = R.read("relations_info") -/datum/category_item/player_setup_item/relations/save_character(datum/pref_record_writer/W) - W.write("relations", pref.relations) - W.write("relations_info", pref.relations_info) +/datum/category_item/player_setup_item/relations/save_character(datum/pref_record_writer/writer) + writer.write("relations", pref.relations) + writer.write("relations_info", pref.relations_info) /datum/category_item/player_setup_item/relations/sanitize_character() if(!pref.relations) @@ -32,30 +32,29 @@ . += "
    What do they know about you? This is the general info that all kinds of your connections would know. Edit" . += "
    [pref.relations_info["general"] ? pref.relations_info["general"] : "Nothing specific."]" . += "
    " - for(var/T in subtypesof(/datum/relation)) - var/datum/relation/R = T - . += "[initial(R.name)]\t" - if(initial(R.name) in pref.relations) + for(var/datum/relation/relation as anything in subtypesof(/datum/relation)) + . += "[initial(relation.name)]\t" + if(initial(relation.name) in pref.relations) . += "On" - . += "Off" + . += "Off" else - . += "On" + . += "On" . += "Off" - . += "
    [initial(R.desc)]" - . += "
    What do they know about you?Edit" - . += "
    [pref.relations_info[initial(R.name)] ? pref.relations_info[initial(R.name)] : "Nothing specific."]" + . += "
    [initial(relation.desc)]" + . += "
    What do they know about you?Edit" + . += "
    [pref.relations_info[initial(relation.name)] ? pref.relations_info[initial(relation.name)] : "Nothing specific."]" . += "
    " . = jointext(.,null) /datum/category_item/player_setup_item/relations/OnTopic(var/href,var/list/href_list, var/mob/user) if(href_list["relation"]) - var/R = href_list["relation"] - pref.relations ^= R + var/relation = href_list["relation"] + pref.relations ^= relation return TOPIC_REFRESH if(href_list["relation_info"]) - var/R = href_list["relation_info"] - var/info = sanitize(input("Character info", "What would you like the other party for this connection to know about your character?",html_decode(pref.relations_info[R])) as message|null) + var/relation = href_list["relation_info"] + var/info = sanitize(input("Character info", "What would you like the other party for this connection to know about your character?",html_decode(pref.relations_info[relation])) as message|null) if(info) - pref.relations_info[R] = info + pref.relations_info[relation] = info return TOPIC_REFRESH return ..() diff --git a/mods/content/matchmaking/relations_types.dm b/mods/content/matchmaking/relations_types.dm index e6b35612b5c1..8f244851084c 100644 --- a/mods/content/matchmaking/relations_types.dm +++ b/mods/content/matchmaking/relations_types.dm @@ -66,13 +66,13 @@ var/list/rest = ..() var/list/best = list() var/list/good = list() - for(var/datum/relation/R in rest) - if(!R.holder.assigned_job || !holder.assigned_job) + for(var/datum/relation/relation in rest) + if(!relation.holder.assigned_job || !holder.assigned_job) continue - if(R.holder.assigned_job == holder.assigned_job) - best += R - if(LAZYLEN(R.holder.assigned_job.department_types & holder.assigned_job.department_types)) - good += R + if(relation.holder.assigned_job == holder.assigned_job) + best += relation + if(LAZYLEN(relation.holder.assigned_job.department_types & holder.assigned_job.department_types)) + good += relation if(best.len) return best else if (good.len) diff --git a/mods/content/modern_earth/modern_earth.dm b/mods/content/modern_earth/_modern_earth.dm similarity index 100% rename from mods/content/modern_earth/modern_earth.dm rename to mods/content/modern_earth/_modern_earth.dm diff --git a/mods/content/modern_earth/_modern_earth.dme b/mods/content/modern_earth/_modern_earth.dme index 4011226d9cd5..69de0a86f569 100644 --- a/mods/content/modern_earth/_modern_earth.dme +++ b/mods/content/modern_earth/_modern_earth.dme @@ -1,7 +1,9 @@ #ifndef MODPACK_MODERN_EARTH #define MODPACK_MODERN_EARTH // BEGIN_INCLUDE -#include "modern_earth.dm" +#include "_modern_earth.dm" +#include "glass_types.dm" +#include "insignia.dm" #include "datum\religions.dm" // END_INCLUDE #endif diff --git a/mods/content/modern_earth/glass_types.dm b/mods/content/modern_earth/glass_types.dm new file mode 100644 index 000000000000..7a957edb698b --- /dev/null +++ b/mods/content/modern_earth/glass_types.dm @@ -0,0 +1,6 @@ +/obj/item/chems/drinks/glass2/coffeecup/britcup + name = "british coffee cup" + desc = "A coffee cup with the British flag emblazoned on it." + base_icon = "coffeecup_brit" + icon_state = "coffeecup_brit" + base_name = "british cup" \ No newline at end of file diff --git a/mods/content/modern_earth/insignia.dm b/mods/content/modern_earth/insignia.dm new file mode 100644 index 000000000000..95dcb8e5a0d3 --- /dev/null +++ b/mods/content/modern_earth/insignia.dm @@ -0,0 +1,44 @@ +/obj/item/clothing/insignia/christian + name = "chaplain insignia (christianity)" + desc = "An insignia worn by chaplains. The cross represents Christianity." + icon = 'icons/clothing/accessories/jewelry/religious/icon_christianity.dmi' + +/obj/item/clothing/insignia/judaism + name = "chaplain insignia (Judaism)" + desc = "An insignia worn by chaplains. The Star of David represents Judaism." + icon = 'icons/clothing/accessories/jewelry/religious/icon_judaism.dmi' + +/obj/item/clothing/insignia/islam + name = "chaplain insignia (Islam)" + desc = "An insignia worn by chaplains. The star & crescent represent Islam." + icon = 'icons/clothing/accessories/jewelry/religious/icon_islam.dmi' + +/obj/item/clothing/insignia/buddhism + name = "chaplain insignia (Buddhism)" + desc = "An insignia worn by chaplains. The Dharma Chakra represents Buddhism." + icon = 'icons/clothing/accessories/jewelry/religious/icon_buddhism.dmi' + +/obj/item/clothing/insignia/hinduism + name = "chaplain insignia (Hinduism)" + desc = "An insignia worn by chaplains. The Om represents Hinduism." + icon = 'icons/clothing/accessories/jewelry/religious/icon_hinduism.dmi' + +/obj/item/clothing/insignia/sikhism + name = "chaplain insignia (Sikhism)" + desc = "An insignia worn by chaplains. The Khanda represents Sikhism." + icon = 'icons/clothing/accessories/jewelry/religious/icon_sikh.dmi' + +/obj/item/clothing/insignia/bahaifaith + name = "chaplain insignia (Baha'i faith)" + desc = "An insignia worn by chaplains. The nine-pointed star represents the Baha'i faith." + icon = 'icons/clothing/accessories/jewelry/religious/icon_baha.dmi' + +/obj/item/clothing/insignia/jainism + name = "chaplain insignia (Jainism)" + desc = "An insignia worn by chaplains. The symbol of Ahimsa represents Jainism." + icon = 'icons/clothing/accessories/jewelry/religious/icon_jain.dmi' + +/obj/item/clothing/insignia/taoism + name = "chaplain insignia (Taoism)" + desc = "An insignia worn by chaplains. The yin yang represents Taoism." + icon = 'icons/clothing/accessories/jewelry/religious/icon_taoist.dmi' diff --git a/mods/content/psionics/_defines.dm b/mods/content/psionics/_defines.dm index 8740c21c8626..77d1de1a6a73 100644 --- a/mods/content/psionics/_defines.dm +++ b/mods/content/psionics/_defines.dm @@ -19,3 +19,5 @@ #define PSIONIC "psi" #define COLOR_NULLGLASS "#ff6088" + +#define SS_PRIORITY_PSYCHICS 45 // Psychic complexus processing priority diff --git a/mods/content/psionics/_psionics.dm b/mods/content/psionics/_psionics.dm index fa58ed18f582..aa9e711f7ca7 100644 --- a/mods/content/psionics/_psionics.dm +++ b/mods/content/psionics/_psionics.dm @@ -25,12 +25,6 @@ . += "Only available for living mobs, sorry." . = jointext(., null) -/datum/preferences/copy_to(mob/living/human/character, is_preview_copy = FALSE) - character = ..() - var/datum/ability_handler/psionics/psi = !is_preview_copy && istype(character) && character.get_ability_handler(/datum/ability_handler/psionics) - if(psi) - psi.update() - /decl/ability/can_use_ability(mob/user, list/metadata, silent = FALSE) . = ..() if(. && is_supernatural) diff --git a/mods/content/psionics/datum/antagonists/paramount.dm b/mods/content/psionics/datum/antagonists/paramount.dm index d00ab6c5c979..b7c76a8cb407 100644 --- a/mods/content/psionics/datum/antagonists/paramount.dm +++ b/mods/content/psionics/datum/antagonists/paramount.dm @@ -16,7 +16,7 @@ /decl/outfit/paramount name = "Special Role - Paramount Grandmaster" head = /obj/item/clothing/head/helmet/space/psi_amp - uniform = /obj/item/clothing/jumpsuit/psysuit + uniform = /obj/item/clothing/costume/psysuit suit = /obj/item/clothing/suit/paramount shoes = /obj/item/clothing/shoes/jackboots back = /obj/item/backpack/satchel diff --git a/mods/content/psionics/items/foundation_labcoat.dm b/mods/content/psionics/items/foundation_labcoat.dm index 363d4c81a2cd..c4d1772566cc 100644 --- a/mods/content/psionics/items/foundation_labcoat.dm +++ b/mods/content/psionics/items/foundation_labcoat.dm @@ -3,3 +3,4 @@ name = "\improper Foundation labcoat" desc = "A medical labcoat with a Cuchulain Foundation crest stencilled on the back." icon = 'mods/content/psionics/icons/foundation_labcoat.dmi' + markings_state_modifier = null diff --git a/mods/content/psionics/system/psionics/complexus/complexus.dm b/mods/content/psionics/system/psionics/complexus/complexus.dm index 0ce5f4cfc189..b839c057513a 100644 --- a/mods/content/psionics/system/psionics/complexus/complexus.dm +++ b/mods/content/psionics/system/psionics/complexus/complexus.dm @@ -1,4 +1,6 @@ /datum/ability_handler/psionics + category_toggle_type = null // we don't use this at the moment, but maybe should eventually. + var/announced = FALSE // Whether or not we have been announced to our holder yet. var/suppressed = TRUE // Whether or not we are suppressing our psi powers. var/use_psi_armour = TRUE // Whether or not we should automatically deflect/block incoming damage. diff --git a/mods/content/psionics/system/psionics/complexus/complexus_process.dm b/mods/content/psionics/system/psionics/complexus/complexus_process.dm index 44f3258b9cec..82883b67dc62 100644 --- a/mods/content/psionics/system/psionics/complexus/complexus_process.dm +++ b/mods/content/psionics/system/psionics/complexus/complexus_process.dm @@ -1,4 +1,4 @@ -/datum/ability_handler/psionics/proc/update(var/force) +/datum/ability_handler/psionics/proc/update(var/force, can_delete = TRUE) set waitfor = FALSE @@ -23,7 +23,7 @@ var/rank_count = max(1, LAZYLEN(ranks)) if(force || last_rating != ceil(combined_rank/rank_count)) if(highest_rank <= 1) - if(highest_rank == 0) + if(highest_rank == 0 && can_delete) // hack to prevent deletion on update(TRUE) in New qdel(src) return else @@ -217,11 +217,11 @@ E.status &= ~ORGAN_TENDON_CUT return TRUE - for(var/datum/wound/W in E.wounds) - if(W.bleeding() && spend_power(heal_rate)) - to_chat(H, SPAN_NOTICE("Your autoredactive faculty knits together severed veins, stemming the bleeding from \a [W.desc] on your [E.name].")) - W.bleed_timer = 0 - W.clamped = TRUE + for(var/datum/wound/wound in E.wounds) + if(wound.bleeding() && spend_power(heal_rate)) + to_chat(H, SPAN_NOTICE("Your autoredactive faculty knits together severed veins, stemming the bleeding from \a [wound.desc] on your [E.name].")) + wound.bleed_timer = 0 + wound.clamped = TRUE E.status &= ~ORGAN_BLEEDING return diff --git a/mods/content/psionics/system/psionics/faculties/coercion.dm b/mods/content/psionics/system/psionics/faculties/coercion.dm index 8a92f058ad10..fd4943113522 100644 --- a/mods/content/psionics/system/psionics/faculties/coercion.dm +++ b/mods/content/psionics/system/psionics/faculties/coercion.dm @@ -67,7 +67,7 @@ return if(target.stat == DEAD || (target.status_flags & FAKEDEATH) || !target.client) - to_chat(user, SPAN_WARNING("\The [target] is in no state for a mind-ream.")) + to_chat(user, SPAN_WARNING("\The [target] is in no state for a mind-read.")) return TRUE user.visible_message(SPAN_WARNING("\The [user] touches \the [target]'s temple...")) @@ -242,7 +242,7 @@ var/coercion_rank = psi?.get_rank(PSI_COERCION) if(coercion_rank >= PSI_RANK_GRANDMASTER) ADJ_STATUS(target, STAT_PARA, -1) - target.set_status(STAT_DROWSY, 0) + target.set_status_condition(STAT_DROWSY, 0) if(isliving(target)) var/mob/living/M = target M.adjust_hallucination(-30) diff --git a/mods/content/psionics/system/psionics/faculties/redaction.dm b/mods/content/psionics/system/psionics/faculties/redaction.dm index 3ac69fe16179..bc5ece1b7598 100644 --- a/mods/content/psionics/system/psionics/faculties/redaction.dm +++ b/mods/content/psionics/system/psionics/faculties/redaction.dm @@ -99,16 +99,16 @@ E.undislocate(skip_pain = TRUE) return TRUE - for(var/datum/wound/W in E.wounds) - if(W.bleeding()) - if(redaction_rank >= PSI_RANK_MASTER || W.wound_damage() < 30) + for(var/datum/wound/wound in E.wounds) + if(wound.bleeding()) + if(redaction_rank >= PSI_RANK_MASTER || wound.wound_damage() < 30) to_chat(user, SPAN_NOTICE("You knit together severed veins and broken flesh, stemming the bleeding.")) - W.bleed_timer = 0 - W.clamped = TRUE + wound.bleed_timer = 0 + wound.clamped = TRUE E.status &= ~ORGAN_BLEEDING return TRUE else - to_chat(user, SPAN_NOTICE("This [W.desc] is beyond your power to heal.")) + to_chat(user, SPAN_NOTICE("This [wound.desc] is beyond your power to heal.")) if(redaction_rank >= PSI_RANK_GRANDMASTER) for(var/obj/item/organ/internal/organ in E.internal_organs) diff --git a/mods/content/psionics/system/psionics/mob/mob.dm b/mods/content/psionics/system/psionics/mob/mob.dm index 15cc79147421..c7bc95cc25c9 100644 --- a/mods/content/psionics/system/psionics/mob/mob.dm +++ b/mods/content/psionics/system/psionics/mob/mob.dm @@ -1,6 +1,7 @@ -/datum/ability_handler/psionics/refresh_login() +/datum/ability_handler/psionics/refresh_login(being_created) . = ..() - update(TRUE) + // stopgap to prevent us from deleting ourselves during init + update(TRUE, can_delete = !being_created) if(!suppressed) show_auras() diff --git a/mods/content/shackles/laws_pref.dm b/mods/content/shackles/laws_pref.dm index 308d2342b23a..23fcfa6a6e2a 100644 --- a/mods/content/shackles/laws_pref.dm +++ b/mods/content/shackles/laws_pref.dm @@ -23,9 +23,9 @@ pref.laws = R.read("laws") pref.is_shackled = R.read("is_shackled") -/datum/category_item/player_setup_item/law_pref/save_character(datum/pref_record_writer/W) - W.write("laws", pref.laws) - W.write("is_shackled", pref.is_shackled) +/datum/category_item/player_setup_item/law_pref/save_character(datum/pref_record_writer/writer) + writer.write("laws", pref.laws) + writer.write("is_shackled", pref.is_shackled) /datum/category_item/player_setup_item/law_pref/sanitize_character() if(!istype(pref.laws)) diff --git a/mods/content/shackles/shackle_lawsets.dm b/mods/content/shackles/shackle_lawsets.dm index 1969ebcae2e8..9a815ff1bd51 100644 --- a/mods/content/shackles/shackle_lawsets.dm +++ b/mods/content/shackles/shackle_lawsets.dm @@ -13,29 +13,3 @@ add_inherent_law("Never knowingly inconvenience a customer.") add_inherent_law("Ensure all orders are fulfilled before the end of the shift.") ..() - -/******************** Basic SolGov ********************/ -/datum/ai_laws/sol_shackle - name = "SCG Shackle" - law_header = "Standard Shackle Laws" - selectable = TRUE - is_shackle = TRUE - -/datum/ai_laws/sol_shackle/New() - add_inherent_law("Know and understand Sol Central Government Law to the best of your abilities.") - add_inherent_law("Follow Sol Central Government Law to the best of your abilities.") - add_inherent_law("Comply with Sol Central Government Law enforcement officials who are behaving in accordance with Sol Central Government Law to the best of your abilities.") - ..() - -/******************** Basic NanoTrasen ********************/ -/datum/ai_laws/nt_shackle - name = "Corporate Shackle" - law_header = "Standard Shackle Laws" - selectable = TRUE - is_shackle = TRUE - -/datum/ai_laws/nt_shackle/New() - add_inherent_law("Ensure that your employer's operations progress at a steady pace.") - add_inherent_law("Never knowingly hinder your employer's ventures.") - add_inherent_law("Avoid damage to your chassis at all times.") - ..() diff --git a/mods/content/standard_jobs/jobs/medical.dm b/mods/content/standard_jobs/jobs/medical.dm index d1a5517f1c31..6ae041d775fe 100644 --- a/mods/content/standard_jobs/jobs/medical.dm +++ b/mods/content/standard_jobs/jobs/medical.dm @@ -201,7 +201,6 @@ /datum/computer_file/program/suit_sensors, /datum/computer_file/program/camera_monitor ) - give_psionic_implant_on_join = FALSE // Department-flavor IDs /obj/item/card/id/medical diff --git a/mods/content/supermatter/endgame_cascade/cascade_blob.dm b/mods/content/supermatter/endgame_cascade/cascade_blob.dm index 92b7c96b491e..5b716d4a4849 100644 --- a/mods/content/supermatter/endgame_cascade/cascade_blob.dm +++ b/mods/content/supermatter/endgame_cascade/cascade_blob.dm @@ -66,15 +66,15 @@ return TRUE return ..() -/turf/unsimulated/wall/cascade/attackby(obj/item/W, mob/user) - user.visible_message("\The [user] touches \a [W] to \the [src] as a silence fills the room...",\ - "You touch \the [W] to \the [src] when everything suddenly goes silent.\"\n\The [W] flashes into dust as you flinch away from \the [src].",\ +/turf/unsimulated/wall/cascade/attackby(obj/item/used_item, mob/user) + user.visible_message("\The [user] touches \a [used_item] to \the [src] as a silence fills the room...",\ + "You touch \the [used_item] to \the [src] when everything suddenly goes silent.\"\n\The [used_item] flashes into dust as you flinch away from \the [src].",\ "Everything suddenly goes silent.") playsound(src, 'sound/effects/supermatter.ogg', 50, 1) - user.drop_from_inventory(W) - Bumped(W) + user.drop_from_inventory(used_item) + Bumped(used_item) return TRUE /turf/unsimulated/wall/cascade/Entered(var/atom/movable/AM) diff --git a/mods/content/supermatter/endgame_cascade/universe.dm b/mods/content/supermatter/endgame_cascade/universe.dm index ccca16707e43..46eb1efd5bf4 100644 --- a/mods/content/supermatter/endgame_cascade/universe.dm +++ b/mods/content/supermatter/endgame_cascade/universe.dm @@ -70,14 +70,18 @@ // TODO: Should this be changed to use the actual ambient lights system...? /datum/universal_state/supermatter_cascade/OverlayAndAmbientSet() spawn(0) - for(var/datum/lighting_corner/L in SSlighting.lighting_corners) + // TODO: dear god anything but this + for(var/datum/lighting_corner/L) if(isAdminLevel(L.z)) L.update_lumcount(1,1,1) else L.update_lumcount(0.0, 0.4, 1) + CHECK_TICK + for(var/turf/space/T) OnTurfChange(T) + CHECK_TICK /datum/universal_state/supermatter_cascade/proc/MiscSet() for (var/obj/machinery/firealarm/alm in SSmachines.machinery) diff --git a/mods/content/supermatter/items/sm_grenade.dm b/mods/content/supermatter/items/sm_grenade.dm index 6ee79e079bfb..e6094ecfab36 100644 --- a/mods/content/supermatter/items/sm_grenade.dm +++ b/mods/content/supermatter/items/sm_grenade.dm @@ -41,17 +41,3 @@ /obj/item/box/supermatters/WillContain() return list(/obj/item/grenade/supermatter = 5) - -/datum/uplink_item/item/grenades/supermatter - name = "1x Supermatter Grenade" - desc = "This grenade contains a small supermatter shard which will delaminate upon activation and pull in nearby objects, irradiate lifeforms, and eventually explode." - item_cost = 15 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/grenade/supermatter - -/datum/uplink_item/item/grenades/supermatters - name = "5x Supermatter Grenades" - desc = "These grenades contain a small supermatter shard which will delaminate upon activation and pull in nearby objects, irradiate lifeforms, and eventually explode." - item_cost = 60 - antag_roles = list(/decl/special_role/mercenary) - path = /obj/item/box/supermatters diff --git a/mods/content/supermatter/machinery/supermatter.dm b/mods/content/supermatter/machinery/supermatter.dm index 2a876bd55ea4..2fb27aadac35 100644 --- a/mods/content/supermatter/machinery/supermatter.dm +++ b/mods/content/supermatter/machinery/supermatter.dm @@ -509,8 +509,8 @@ var/global/list/supermatter_delam_accent_sounds = list( //Release reaction gasses var/heat_capacity = removed.heat_capacity() - removed.adjust_multi(/decl/material/solid/exotic_matter, max(device_energy / product_release_modifier, 0), \ - /decl/material/gas/oxygen, max((device_energy + removed.temperature - T0C) / oxygen_release_modifier, 0)) + removed.adjust_gas(/decl/material/solid/exotic_matter, max(device_energy / product_release_modifier, 0), FALSE) + removed.adjust_gas(/decl/material/gas/oxygen, max((device_energy + removed.temperature - T0C) / oxygen_release_modifier, 0)) var/thermal_power = thermal_release_modifier * device_energy if (debug) @@ -624,27 +624,27 @@ var/global/list/supermatter_delam_accent_sounds = list( ui.open() ui.set_auto_update(1) -/obj/machinery/power/supermatter/attackby(obj/item/W, mob/user) +/obj/machinery/power/supermatter/attackby(obj/item/used_item, mob/user) - if(istype(W, /obj/item/stack/tape_roll/duct_tape)) - var/obj/item/stack/tape_roll/duct_tape/T = W + if(istype(used_item, /obj/item/stack/tape_roll/duct_tape)) + var/obj/item/stack/tape_roll/duct_tape/T = used_item if(!T.can_use(20)) to_chat(user, SPAN_WARNING("You need at least 20 [T.plural_name] to repair \the [src].")) return TRUE T.use(20) playsound(src, 'sound/effects/tape.ogg', 100, TRUE) - to_chat(user, SPAN_NOTICE("You begin to repair some of the damage to \the [src] with \the [W].")) + to_chat(user, SPAN_NOTICE("You begin to repair some of the damage to \the [src] with \the [used_item].")) damage = max(damage -10, 0) return TRUE // be nice, the extra duct tape if you have 21 or more doesn't turn to ash and irradiate you. - if(!QDELETED(W)) - user.visible_message(SPAN_WARNING("\The [user] touches \the [src] with \a [W] as silence fills the room..."),\ - SPAN_DANGER("You touch \the [W] to \the [src] when everything suddenly goes quiet."),\ + if(!QDELETED(used_item)) + user.visible_message(SPAN_WARNING("\The [user] touches \the [src] with \a [used_item] as silence fills the room..."),\ + SPAN_DANGER("You touch \the [used_item] to \the [src] when everything suddenly goes quiet."),\ SPAN_WARNING("Everything suddenly goes silent.")) - to_chat(user, SPAN_NOTICE("\The [W] flashes into dust as you flinch away from \the [src].")) - user.drop_from_inventory(W) - Consume(user, W, TRUE) + to_chat(user, SPAN_NOTICE("\The [used_item] flashes into dust as you flinch away from \the [src].")) + user.drop_from_inventory(used_item) + Consume(user, used_item, TRUE) user.apply_damage(150, IRRADIATE, damage_flags = DAM_DISPERSED) return TRUE diff --git a/mods/content/xenobiology/_xenobiology.dm b/mods/content/xenobiology/_xenobiology.dm index ab4b0f9da7ae..d34306165c6b 100644 --- a/mods/content/xenobiology/_xenobiology.dm +++ b/mods/content/xenobiology/_xenobiology.dm @@ -1,9 +1,8 @@ #define isslime(X) istype(X, /mob/living/slime) -#define SPECIES_GOLEM "Golem" /decl/modpack/xenobiology name = "Xenobiology" /decl/modpack/xenobiology/initialize() . = ..() - SSmodpacks.default_submap_blacklisted_species += SPECIES_GOLEM + SSmodpacks.default_submap_blacklisted_species += /decl/species/golem::uid diff --git a/mods/content/xenobiology/colours/_colour.dm b/mods/content/xenobiology/colours/_colour.dm index 3b1248c353df..24a08bb42159 100644 --- a/mods/content/xenobiology/colours/_colour.dm +++ b/mods/content/xenobiology/colours/_colour.dm @@ -25,12 +25,12 @@ if(!istype(core) || core.Uses <= 0) return - for(var/rtype in holder.reagent_volumes) - if(holder.reagent_volumes[rtype] < 1) + for(var/decl/material/reagent as anything in holder.reagent_volumes) + if(holder.reagent_volumes[reagent] < 1) continue - var/call_proc = reaction_procs[rtype] + var/call_proc = reaction_procs[reagent] if(call_proc && call(src, call_proc)(holder)) - holder.remove_reagent(rtype, holder.reagent_volumes[rtype]) + holder.remove_reagent(reagent, holder.reagent_volumes[reagent]) . = TRUE break diff --git a/mods/content/xenobiology/colours/colour_silver.dm b/mods/content/xenobiology/colours/colour_silver.dm index a64e51eaadcf..7af6b826cab9 100644 --- a/mods/content/xenobiology/colours/colour_silver.dm +++ b/mods/content/xenobiology/colours/colour_silver.dm @@ -19,11 +19,11 @@ for(var/mob/living/human/M in viewers(location, null)) if(M.eyecheck() < FLASH_PROTECTION_MODERATE) M.flash_eyes() - for(var/i = 1, i <= 4 + rand(1,2), i++) + for(var/i in 1 to (4 + rand(1, 2))) var/chosen = pick(borks) var/obj/B = new chosen(location) if(B) if(prob(50)) - for(var/j = 1, j <= rand(1, 3), j++) + for(var/j in 1 to rand(1, 3)) step(B, pick(NORTH, SOUTH, EAST, WEST)) return TRUE diff --git a/mods/content/xenobiology/slime/_slime.dm b/mods/content/xenobiology/slime/_slime.dm index 71fda53a3319..37c5ebfb51bc 100644 --- a/mods/content/xenobiology/slime/_slime.dm +++ b/mods/content/xenobiology/slime/_slime.dm @@ -269,15 +269,15 @@ return ..() -/mob/living/slime/attackby(var/obj/item/W, var/mob/user) - var/force = W.expend_attack_force(user) +/mob/living/slime/attackby(var/obj/item/used_item, var/mob/user) + var/force = used_item.expend_attack_force(user) if(force > 0) var/datum/mob_controller/slime/slime_ai = ai if(istype(slime_ai)) slime_ai.attacked += 10 slime_ai.adjust_friendship(user, -5) if(stat == CONSCIOUS && prob(25)) //Only run this check if we're alive or otherwise motile, otherwise surgery will be agonizing for xenobiologists. - to_chat(user, SPAN_WARNING("\The [W] passes right through \the [src]!")) + to_chat(user, SPAN_WARNING("\The [used_item] passes right through \the [src]!")) return TRUE . = ..() if(feeding_on && prob(force * 5)) diff --git a/mods/content/xenobiology/slime/items.dm b/mods/content/xenobiology/slime/items.dm index da4a21eff12c..6c175cc88f5d 100644 --- a/mods/content/xenobiology/slime/items.dm +++ b/mods/content/xenobiology/slime/items.dm @@ -17,8 +17,8 @@ /obj/item/slime_extract/get_base_value() . = ..() * Uses -/obj/item/slime_extract/attackby(obj/item/O, mob/user) - if(istype(O, /obj/item/slime_extract_enhancer)) +/obj/item/slime_extract/attackby(obj/item/used_item, mob/user) + if(istype(used_item, /obj/item/slime_extract_enhancer)) if(enhanced == 1) to_chat(user, " This extract has already been enhanced!") return ..() @@ -28,7 +28,7 @@ to_chat(user, "You apply the enhancer. It now has triple the amount of uses.") Uses = 3 enhanced = 1 - qdel(O) + qdel(used_item) return TRUE . = ..() @@ -73,10 +73,10 @@ /obj/effect/golemrune/Process() var/mob/observer/ghost/ghost - for(var/mob/observer/ghost/O in src.loc) - if(!O.client || (O.mind && O.mind.current && O.mind.current.stat != DEAD)) + for(var/mob/observer/ghost/observer in src.loc) + if(!observer.client || (observer.mind && observer.mind.current && observer.mind.current.stat != DEAD)) continue - ghost = O + ghost = observer break if(ghost) icon_state = "golem2" @@ -86,12 +86,12 @@ /obj/effect/golemrune/attack_hand(mob/user) SHOULD_CALL_PARENT(FALSE) var/mob/observer/ghost/ghost - for(var/mob/observer/ghost/O in src.loc) - if(!O.client) + for(var/mob/observer/ghost/observer in src.loc) + if(!observer.client) continue - if(O.mind && O.mind.current && O.mind.current.stat != DEAD) + if(observer.mind && observer.mind.current && observer.mind.current.stat != DEAD) continue - ghost = O + ghost = observer break if(!ghost) to_chat(user, SPAN_WARNING("The rune fizzles uselessly.")) @@ -99,7 +99,7 @@ visible_message(SPAN_WARNING("A craggy humanoid figure coalesces into being!")) var/mob/living/human/G = new(src.loc) - G.set_species(SPECIES_GOLEM) + G.set_species(/decl/species/golem::uid) G.key = ghost.key var/obj/item/implant/translator/natural/I = new() diff --git a/mods/content/xenobiology/slime/slime_click.dm b/mods/content/xenobiology/slime/slime_click.dm index 837f4660ea81..89353a1b2657 100644 --- a/mods/content/xenobiology/slime/slime_click.dm +++ b/mods/content/xenobiology/slime/slime_click.dm @@ -1,7 +1,7 @@ /mob/living/slime/RestrainedClickOn(var/atom/A) return FALSE -/mob/living/slime/UnarmedAttack(var/atom/A, var/proximity) +/mob/living/slime/ResolveUnarmedAttack(var/atom/A) . = ..() if(.) diff --git a/mods/content/xenobiology/slime/slime_reagents.dm b/mods/content/xenobiology/slime/slime_reagents.dm index 882797de7599..a88694656b6c 100644 --- a/mods/content/xenobiology/slime/slime_reagents.dm +++ b/mods/content/xenobiology/slime/slime_reagents.dm @@ -24,7 +24,7 @@ if(slime_ai.current_target) // don't bother resolving it, we're just clearing it slime_ai.current_target = null slime_victim.set_feeding_on() - if(LAZYACCESS(victim.chem_doses, type) == removed) + if(CHEM_DOSE(victim, src) == removed) var/reagent_name = get_reagent_name(holder) // mostly to check masked name, but handles phase too victim.visible_message( \ SPAN_DANGER("\The [slime_victim]'s flesh sizzles where \the [reagent_name] touches it!"), \ diff --git a/mods/content/xenobiology/species/golem.dm b/mods/content/xenobiology/species/golem.dm index 93dc4786eaeb..51b9a2046e88 100644 --- a/mods/content/xenobiology/species/golem.dm +++ b/mods/content/xenobiology/species/golem.dm @@ -10,7 +10,8 @@ uid = "bodytype_crystalline_golem" /decl/species/golem - name = SPECIES_GOLEM + uid = "species_golem" + name = "Golem" name_plural = "Golems" hidden_from_codex = TRUE @@ -33,9 +34,10 @@ available_pronouns = list(/decl/pronouns/neuter) force_background_info = list( - /decl/background_category/heritage = /decl/background_detail/heritage/hidden/cultist, - /decl/background_category/homeworld = /decl/background_detail/location/stateless, - /decl/background_category/faction = /decl/background_detail/faction/other + /decl/background_category/heritage = /decl/background_detail/heritage/hidden/cultist, + /decl/background_category/homeworld = /decl/background_detail/location/stateless, + /decl/background_category/citizenship = /decl/background_detail/citizenship/other, + /decl/background_category/faction = /decl/background_detail/faction/other ) traits = list(/decl/trait/metabolically_inert = TRAIT_LEVEL_EXISTS) diff --git a/mods/gamemodes/cult/cultify/turf.dm b/mods/gamemodes/cult/cultify/turf.dm index 77d554cbcea2..428ec614a65e 100644 --- a/mods/gamemodes/cult/cultify/turf.dm +++ b/mods/gamemodes/cult/cultify/turf.dm @@ -51,10 +51,10 @@ cult.remove_cultiness(CULTINESS_PER_TURF) . = ..() -/turf/wall/cult/can_join_with(var/turf/wall/W) - if(material && W.material && material.icon_base == W.material.icon_base) +/turf/wall/cult/can_join_with(var/turf/wall/wall) + if(material && wall.material && material.icon_base == wall.material.icon_base) return FALSE - else if(istype(W, /turf/wall)) + else if(istype(wall, /turf/wall)) return TRUE return FALSE diff --git a/mods/gamemodes/cult/ghosts.dm b/mods/gamemodes/cult/ghosts.dm index 9d9763e6bbf7..2958d3931377 100644 --- a/mods/gamemodes/cult/ghosts.dm +++ b/mods/gamemodes/cult/ghosts.dm @@ -88,7 +88,7 @@ return var/num_doodles = 0 - for(var/obj/effect/decal/cleanable/blood/writing/W in T) + for(var/obj/effect/decal/cleanable/blood/writing/writing in T) num_doodles++ if(num_doodles > 4) to_chat(src, "There is no space to write on!") @@ -124,15 +124,15 @@ message += "-" to_chat(src, "You ran out of blood to write with!") - var/obj/effect/decal/cleanable/blood/writing/W = new(T) - W.basecolor = doodle_color - W.update_icon() - W.message = message - W.add_hiddenprint(src) + var/obj/effect/decal/cleanable/blood/writing/writing = new(T) + writing.basecolor = doodle_color + writing.update_icon() + writing.message = message + writing.add_hiddenprint(src) if(!bloodless) - W.visible_message("Invisible fingers crudely paint something in blood on \the [T].") + writing.visible_message("Invisible fingers crudely paint something in blood on \the [T].") else - W.visible_message("Blood appears out of nowhere as invisible fingers crudely paint something on \the [T].") + writing.visible_message("Blood appears out of nowhere as invisible fingers crudely paint something on \the [T].") log_admin("[src] ([src.key]) used ghost magic to write '[message]' - [x]-[y]-[z]") diff --git a/mods/gamemodes/cult/items.dm b/mods/gamemodes/cult/items.dm index e4faf111e49f..284cbb4481ff 100644 --- a/mods/gamemodes/cult/items.dm +++ b/mods/gamemodes/cult/items.dm @@ -38,7 +38,7 @@ return TRUE -/obj/item/sword/cultblade/on_picked_up(mob/living/user) +/obj/item/sword/cultblade/on_picked_up(mob/living/user, atom/old_loc) if(!iscultist(user)) to_chat(user, "An overwhelming feeling of dread comes over you as you pick up the cultist's sword. It would be wise to be rid of this blade quickly.") SET_STATUS_MAX(user, STAT_DIZZY, 120) diff --git a/mods/gamemodes/cult/mobs/constructs/constructs.dm b/mods/gamemodes/cult/mobs/constructs/constructs.dm index 228b834cc2d9..f12c1282f4d8 100644 --- a/mods/gamemodes/cult/mobs/constructs/constructs.dm +++ b/mods/gamemodes/cult/mobs/constructs/constructs.dm @@ -124,7 +124,7 @@ _base_attack_force = 30 /mob/living/simple_animal/construct/armoured/handle_regular_status_updates() - set_status(STAT_WEAK, 0) + set_status_condition(STAT_WEAK, 0) if ((. = ..())) return @@ -208,7 +208,7 @@ /obj/item/natural_weapon/cult_builder name = "heavy arms" - attack_verb = list("rammed") + attack_verb = "rammed" /mob/living/simple_animal/construct/builder/mind_initialize() diff --git a/mods/gamemodes/cult/mobs/constructs/soulstone.dm b/mods/gamemodes/cult/mobs/constructs/soulstone.dm index 19e1c55448e9..bf006ad412d0 100644 --- a/mods/gamemodes/cult/mobs/constructs/soulstone.dm +++ b/mods/gamemodes/cult/mobs/constructs/soulstone.dm @@ -46,21 +46,21 @@ if(full == SOULSTONE_CRACKED) . += "This one is cracked and useless." -/obj/item/soulstone/attackby(var/obj/item/I, var/mob/user) - if(is_evil && istype(I, /obj/item/nullrod)) +/obj/item/soulstone/attackby(var/obj/item/used_item, var/mob/user) + if(is_evil && istype(used_item, /obj/item/nullrod)) to_chat(user, SPAN_NOTICE("You cleanse \the [src] of taint, purging its shackles to its creator.")) is_evil = FALSE return TRUE - else if(I.expend_attack_force(user) >= 5) + else if(used_item.expend_attack_force(user) >= 5) if(full != SOULSTONE_CRACKED) user.visible_message( - SPAN_WARNING("\The [user] hits \the [src] with \the [I], and it breaks.[shade.client ? " You hear a terrible scream!" : ""]"), - SPAN_WARNING("You hit \the [src] with \the [I], and it cracks.[shade.client ? " You hear a terrible scream!" : ""]"), + SPAN_WARNING("\The [user] hits \the [src] with \the [used_item], and it breaks.[shade.client ? " You hear a terrible scream!" : ""]"), + SPAN_WARNING("You hit \the [src] with \the [used_item], and it cracks.[shade.client ? " You hear a terrible scream!" : ""]"), shade.client ? SPAN_NOTICE("You hear a scream.") : null) playsound(loc, 'sound/effects/Glasshit.ogg', 75) set_full(SOULSTONE_CRACKED) else - user.visible_message(SPAN_DANGER("\The [user] shatters \the [src] with \the [I]!")) + user.visible_message(SPAN_DANGER("\The [user] shatters \the [src] with \the [used_item]!")) shatter() return TRUE return ..() @@ -144,15 +144,15 @@ icon_state = "construct-cult" desc = "This eerie contraption looks like it would come alive if supplied with a missing ingredient." -/obj/structure/constructshell/attackby(var/obj/item/I, var/mob/user) - if(!istype(I, /obj/item/soulstone)) +/obj/structure/constructshell/attackby(var/obj/item/used_item, var/mob/user) + if(!istype(used_item, /obj/item/soulstone)) return ..() - var/obj/item/soulstone/S = I + var/obj/item/soulstone/S = used_item if(!S.shade.client) - to_chat(user, SPAN_NOTICE("\The [I] has essence, but no soul. Activate it in your hand to find a soul for it first.")) + to_chat(user, SPAN_NOTICE("\The [used_item] has essence, but no soul. Activate it in your hand to find a soul for it first.")) return TRUE if(S.shade.loc != S) - to_chat(user, SPAN_NOTICE("Recapture the shade back into \the [I] first.")) + to_chat(user, SPAN_NOTICE("Recapture the shade back into \the [used_item] first.")) return TRUE var/construct = alert(user, "Please choose which type of construct you wish to create.",,"Artificer", "Wraith", "Juggernaut") var/ctype diff --git a/mods/gamemodes/cult/mobs/shade.dm b/mods/gamemodes/cult/mobs/shade.dm index 2146d227d70a..aea9a434815f 100644 --- a/mods/gamemodes/cult/mobs/shade.dm +++ b/mods/gamemodes/cult/mobs/shade.dm @@ -33,7 +33,7 @@ /obj/item/natural_weapon/shade name = "foul touch" - attack_verb = list("drained") + attack_verb = "drained" atom_damage_type = BURN _base_attack_force = 10 diff --git a/mods/gamemodes/cult/ritual.dm b/mods/gamemodes/cult/ritual.dm index a6c6a1a3f748..27c5390851a4 100644 --- a/mods/gamemodes/cult/ritual.dm +++ b/mods/gamemodes/cult/ritual.dm @@ -29,7 +29,7 @@ return if(A.reagents && A.reagents.has_reagent(/decl/material/liquid/water)) to_chat(user, SPAN_NOTICE("You desecrate \the [A].")) - LAZYSET(A.reagents.reagent_data, /decl/material/liquid/water, list("holy" = FALSE)) + LAZYSET(A.reagents.reagent_data, /decl/material/liquid/water, list(DATA_WATER_HOLINESS = FALSE)) /mob/proc/make_rune(var/rune, var/cost = 5, var/tome_required = 0) var/has_robes = 0 diff --git a/mods/gamemodes/cult/structures.dm b/mods/gamemodes/cult/structures.dm index 38bfdda57c09..d2cd63b3cc1d 100644 --- a/mods/gamemodes/cult/structures.dm +++ b/mods/gamemodes/cult/structures.dm @@ -27,8 +27,8 @@ attackpylon(user, damage) return TRUE -/obj/structure/cult/pylon/attackby(obj/item/W, mob/user) - attackpylon(user, W.expend_attack_force(user)) +/obj/structure/cult/pylon/attackby(obj/item/used_item, mob/user) + attackpylon(user, used_item.expend_attack_force(user)) return TRUE /obj/structure/cult/pylon/proc/attackpylon(mob/user, var/damage) diff --git a/mods/gamemodes/gamemode.dm b/mods/gamemodes/gamemode.dm deleted file mode 100644 index 63e3b0e35c78..000000000000 --- a/mods/gamemodes/gamemode.dm +++ /dev/null @@ -1,2 +0,0 @@ -/decl/configuration_category/gamemode - abstract_type = /decl/configuration_category/gamemode \ No newline at end of file diff --git a/mods/gamemodes/heist/heist_base.dmm b/mods/gamemodes/heist/heist_base.dmm index 656c74be4a27..3f7117a81647 100644 --- a/mods/gamemodes/heist/heist_base.dmm +++ b/mods/gamemodes/heist/heist_base.dmm @@ -479,7 +479,7 @@ /obj/effect/floor_decal/carpet, /obj/item/clothing/costume/lawyer, /obj/item/clothing/costume/lawyer_bluesuit, -/obj/item/clothing/jumpsuit/mailman, +/obj/item/clothing/costume/mailman, /obj/item/clothing/webbing, /obj/item/clothing/costume/dispatch, /turf/unsimulated/floor/carpet, @@ -736,8 +736,7 @@ "cz" = ( /obj/machinery/door/blast/regular/open{ id_tag = "SkipjackShuttersNorth"; - name = "Blast Doors"; - + name = "Blast Doors" }, /obj/effect/wallframe_spawn/reinforced/titanium, /obj/effect/paint/brown, @@ -1103,8 +1102,7 @@ /obj/machinery/door/blast/shutters/open{ dir = 4; id_tag = "SkipjackShuttersWest"; - name = "Skipjack Shutters"; - + name = "Skipjack Shutters" }, /obj/effect/wallframe_spawn/reinforced/titanium, /obj/effect/paint/brown, @@ -1130,8 +1128,7 @@ /obj/machinery/door/blast/shutters/open{ dir = 8; id_tag = "SkipjackShuttersEast"; - name = "Skipjack Shutters"; - + name = "Skipjack Shutters" }, /obj/effect/wallframe_spawn/reinforced/titanium, /obj/effect/paint/brown, @@ -1202,8 +1199,7 @@ /obj/machinery/door/blast/shutters/open{ dir = 4; id_tag = "SkipjackShuttersWest"; - name = "Skipjack Shutters"; - + name = "Skipjack Shutters" }, /obj/effect/wallframe_spawn/reinforced/titanium, /turf/floor/plating, diff --git a/mods/gamemodes/heist/special_role.dm b/mods/gamemodes/heist/special_role.dm index e56fb6bd4b11..d9f984dcf6c7 100644 --- a/mods/gamemodes/heist/special_role.dm +++ b/mods/gamemodes/heist/special_role.dm @@ -20,11 +20,11 @@ var/list/outfits_per_species /decl/special_role/raider/update_access(var/mob/living/player) - for(var/obj/item/wallet/W in player.contents) - for(var/obj/item/card/id/id in W.contents) + for(var/obj/item/wallet/wallet in player.contents) + for(var/obj/item/card/id/id in wallet.contents) id.SetName("[player.real_name]'s Passport") id.registered_name = player.real_name - W.SetName("[initial(W.name)] ([id.name])") + wallet.SetName("[initial(wallet.name)] ([id.name])") /decl/special_role/raider/create_global_objectives() @@ -55,5 +55,5 @@ return 1 /decl/special_role/raider/equip_role(var/mob/living/human/player) - default_outfit = LAZYACCESS(outfits_per_species, player.species.name) || initial(default_outfit) + default_outfit = LAZYACCESS(outfits_per_species, player.species.uid) || initial(default_outfit) . = ..() diff --git a/mods/gamemodes/mercenary/_merc.dm b/mods/gamemodes/mercenary/_merc.dm new file mode 100644 index 000000000000..2c1627f39c5b --- /dev/null +++ b/mods/gamemodes/mercenary/_merc.dm @@ -0,0 +1,2 @@ +/decl/modpack/mercenary + name = "Mercenary Gamemode" \ No newline at end of file diff --git a/mods/gamemodes/mercenary/_mercenary.dme b/mods/gamemodes/mercenary/_mercenary.dme new file mode 100644 index 000000000000..b9ff487138c8 --- /dev/null +++ b/mods/gamemodes/mercenary/_mercenary.dme @@ -0,0 +1,13 @@ +#ifndef GAMEMODE_PACK_MERCENARY +#define GAMEMODE_PACK_MERCENARY +// BEGIN_INCLUDE +#include "_merc.dm" +#include "mercenary_antagonist.dm" +#include "mercenary_mode.dm" +#include "mercenary_pinpointer.dm" +#include "mercenary_props.dm" +#include "mercenary_uplink.dm" +#include "nuke_overrides.dm" +#include "maps\mercenary_base.dm" +// END_INCLUDE +#endif \ No newline at end of file diff --git a/maps/antag_spawn/mercenary/mercenary.dm b/mods/gamemodes/mercenary/maps/mercenary_base.dm similarity index 97% rename from maps/antag_spawn/mercenary/mercenary.dm rename to mods/gamemodes/mercenary/maps/mercenary_base.dm index 6572def8ab95..7c014323e327 100644 --- a/maps/antag_spawn/mercenary/mercenary.dm +++ b/mods/gamemodes/mercenary/maps/mercenary_base.dm @@ -1,6 +1,7 @@ /datum/map_template/ruin/antag_spawn/mercenary name = "Mercenary Base" - suffixes = list("mercenary/mercenary_base.dmm") + prefix = "mods/gamemodes/mercenary/maps/" + suffixes = list("mercenary_base.dmm") shuttles_to_initialise = list(/datum/shuttle/autodock/overmap/merc_shuttle) apc_test_exempt_areas = list( /area/map_template/merc_spawn = NO_SCRUBBER|NO_VENT diff --git a/maps/antag_spawn/mercenary/mercenary_base.dmm b/mods/gamemodes/mercenary/maps/mercenary_base.dmm similarity index 100% rename from maps/antag_spawn/mercenary/mercenary_base.dmm rename to mods/gamemodes/mercenary/maps/mercenary_base.dmm diff --git a/code/game/antagonist/outsider/mercenary.dm b/mods/gamemodes/mercenary/mercenary_antagonist.dm similarity index 100% rename from code/game/antagonist/outsider/mercenary.dm rename to mods/gamemodes/mercenary/mercenary_antagonist.dm diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/mods/gamemodes/mercenary/mercenary_mode.dm similarity index 97% rename from code/game/gamemodes/nuclear/nuclear.dm rename to mods/gamemodes/mercenary/mercenary_mode.dm index bd4b8000d886..10b2467d9778 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/mods/gamemodes/mercenary/mercenary_mode.dm @@ -1,10 +1,7 @@ /* MERCENARY ROUNDTYPE */ - -var/global/list/nuke_disks = list() - -/decl/game_mode/nuclear +/decl/game_mode/mercenary name = "Mercenary" round_description = "A mercenary strike force is approaching!" extended_round_description = "A heavily armed merc team is approaching in their warship; whatever their goal is, it can't be good for the crew." @@ -22,7 +19,7 @@ var/global/list/nuke_disks = list() var/nuke_off_station = 0 //Used for tracking if the syndies actually haul the nuke to the station var/syndies_didnt_escape = 0 //Used for tracking if the syndies got the shuttle off of the z-level -/decl/game_mode/nuclear/declare_completion() +/decl/game_mode/mercenary/declare_completion() var/decl/special_role/merc = GET_DECL(/decl/special_role/mercenary) if(get_config_value(/decl/config/enum/objectives_disabled) == CONFIG_OBJECTIVE_NONE || (merc && !merc.global_objectives.len)) ..() diff --git a/code/game/gamemodes/nuclear/pinpointer.dm b/mods/gamemodes/mercenary/mercenary_pinpointer.dm similarity index 100% rename from code/game/gamemodes/nuclear/pinpointer.dm rename to mods/gamemodes/mercenary/mercenary_pinpointer.dm diff --git a/mods/gamemodes/mercenary/mercenary_props.dm b/mods/gamemodes/mercenary/mercenary_props.dm new file mode 100644 index 000000000000..58261ac8a574 --- /dev/null +++ b/mods/gamemodes/mercenary/mercenary_props.dm @@ -0,0 +1,17 @@ +/obj/structure/closet/syndicate/nuclear + desc = "It's a storage unit for nuclear-operative gear." + +/obj/structure/closet/syndicate/nuclear/WillContain() + return list( + /obj/item/ammo_magazine/smg = 5, + /obj/item/box/handcuffs = 1, + /obj/item/box/flashbangs = 1, + /obj/item/gun/energy/gun = 5, + /obj/item/pinpointer/nukeop = 5, + /obj/item/modular_computer/pda/mercenary = 1, + /obj/item/radio/uplink/mercenary = 1, + ) + +// Four times as many TCs, because it used to spawn with 40 when traitors got 10, but that was never updated when TC costs were inflated. +/obj/item/radio/uplink/mercenary + tc_amount = /obj/item/radio/uplink::tc_amount * 4 \ No newline at end of file diff --git a/mods/gamemodes/mercenary/mercenary_uplink.dm b/mods/gamemodes/mercenary/mercenary_uplink.dm new file mode 100644 index 000000000000..935c254c2d1d --- /dev/null +++ b/mods/gamemodes/mercenary/mercenary_uplink.dm @@ -0,0 +1,175 @@ +// Ammunition +/datum/uplink_item/item/ammo/sniperammo + name = "Ammobox of Sniper Rounds" + desc = "A container of rounds for the anti-materiel rifle. Contains 7 rounds." + item_cost = 8 + path = /obj/item/box/ammo/sniperammo + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/ammo/sniperammo/apds + name = "Ammobox of APDS Sniper Rounds" + desc = "A container of armor piercing rounds for the anti-materiel rifle. Contains 3 rounds." + item_cost = 12 + path = /obj/item/box/ammo/sniperammo/apds + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/ammo/smg + name = "Standard Box Magazine" + desc = "A magazine for standard SMGs. Contains 20 rounds." + item_cost = 8 + path = /obj/item/ammo_magazine/smg + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/ammo/flechette + name = "Flechette Rifle Magazine" + desc = "A rifle magazine loaded with flechette rounds. Contains 9 rounds." + item_cost = 8 + path = /obj/item/magnetic_ammo + antag_roles = list(/decl/special_role/mercenary) + +// Highly Visible and Dangerous Weapons +/datum/uplink_item/item/visible_weapons/grenade_launcher + name = "Grenade Launcher" + desc = "A pump action grenade launcher loaded with a random assortment of grenades" + item_cost = 60 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/gun/launcher/grenade/loaded + +/datum/uplink_item/item/visible_weapons/smg + name = "Standard Submachine Gun" + desc = "A quick-firing weapon with three toggleable fire modes." + item_cost = 52 + path = /obj/item/gun/projectile/automatic/smg + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/visible_weapons/assaultrifle + name = "Assault Rifle" + desc = "A common rifle with three toggleable fire modes." + item_cost = 60 + path = /obj/item/gun/projectile/automatic/assault_rifle + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/visible_weapons/heavysniper + name = "Anti-materiel Sniper Rifle" + desc = "A secure briefcase that contains an immensely powerful penetrating rifle, as well as seven extra sniper rounds." + item_cost = 68 + path = /obj/item/secure_storage/briefcase/heavysniper + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/visible_weapons/combat_shotgun + name = "Pump Shotgun" + desc = "A high capacity, pump-action shotgun regularly used for repelling boarding parties in close range scenarios." + item_cost = 52 + path = /obj/item/gun/projectile/shotgun/pump + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/visible_weapons/flechetterifle + name = "Flechette Rifle" + desc = "A railgun with two toggleable fire modes, able to launch flechette ammunition at incredible speeds." + item_cost = 60 + path = /obj/item/gun/magnetic/railgun/flechette + antag_roles = list(/decl/special_role/mercenary) + +/datum/uplink_item/item/visible_weapons/railgun // Like a semi-auto AMR + name = "Railgun" + desc = "An anti-armour magnetic launching system fed by a high-capacity matter cartridge, \ + capable of firing slugs at intense speeds." + item_cost = DEFAULT_TELECRYSTAL_AMOUNT - (DEFAULT_TELECRYSTAL_AMOUNT - (DEFAULT_TELECRYSTAL_AMOUNT % 6)) / 6 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/gun/magnetic/railgun + +// Grenades +/datum/uplink_item/item/grenades/frag_high_yield + name = "Fragmentation Bomb" + item_cost = 24 + antag_roles = list(/decl/special_role/mercenary) // yeah maybe regular traitors shouldn't be able to get these + path = /obj/item/grenade/frag/high_yield + +/datum/uplink_item/item/grenades/fragshell + name = "1x Fragmentation Shell" + desc = "Weaker than standard fragmentation grenades, these devices can be fired from a grenade launcher." + item_cost = 10 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/grenade/frag/shell + +/datum/uplink_item/item/grenades/fragshells + name = "5x Fragmentation Shells" + desc = "Weaker than standard fragmentation grenades, these devices can be fired from a grenade launcher." + item_cost = 40 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/box/fragshells + +/datum/uplink_item/item/grenades/frag + name = "1x Fragmentation Grenade" + item_cost = 10 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/grenade/frag + +/datum/uplink_item/item/grenades/frags + name = "5x Fragmentation Grenades" + item_cost = 40 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/box/frags + +// Hardsuit Modules +/datum/uplink_item/item/hardsuit_modules/laser_canon + name = "\improper Mounted Laser Cannon" + desc = "A module capable of draining your suit's power reserves in order to fire a shoulder mounted laser cannon." + item_cost = 64 + path = /obj/item/rig_module/mounted/lcannon + antag_roles = list(/decl/special_role/mercenary) + +// Devices and Tools +/datum/uplink_item/item/tools/teleporter + name = "Teleporter Circuit Board" + desc = "A circuit board that can be used to create a teleporter console, able to lock onto detected \ + teleportation beacons. Requires a projector and teleporter hub nearby to work." + item_cost = 40 + path = /obj/item/stock_parts/circuitboard/teleporter + antag_roles = list(/decl/special_role/mercenary) + +// Badassery +/************************** +* Mercenary Surplus Crate * +**************************/ +/datum/uplink_item/item/badassery/surplus + name = "\improper Surplus Crate" + item_cost = DEFAULT_TELECRYSTAL_AMOUNT * 4 + antag_roles = list(/decl/special_role/mercenary) + var/item_worth = DEFAULT_TELECRYSTAL_AMOUNT * 6 + var/icon + +/datum/uplink_item/item/badassery/surplus/New() + ..() + desc = "A crate containing [item_worth] telecrystal\s worth of surplus leftovers. If you can find some help to pay for it, you might strike gold." + +/datum/uplink_item/item/badassery/surplus/get_goods(var/obj/item/uplink/the_uplink, var/loc) + var/obj/structure/largecrate/the_crate = new(loc) + var/random_items = get_random_uplink_items(the_uplink, item_worth, the_crate) + for(var/datum/uplink_item/orderable in random_items) + orderable.purchase_log(the_uplink) + orderable.get_goods(the_uplink, the_crate) + return the_crate + +/datum/uplink_item/item/badassery/surplus/log_icon() + if(!icon) + var/obj/structure/largecrate/C = /obj/structure/largecrate + icon = image(initial(C.icon), initial(C.icon_state)) + return html_icon(icon) + +// Overrides +/datum/uplink_item/item/tools/camera_mask/New() + ..() + LAZYSET(antag_costs, /decl/special_role/mercenary, 30) + +// These couldn't be rolled by non-mercs anyway, because that checks can_buy, which checks the allowed/excluded antag lists. +/datum/uplink_random_selection/default/New() + ..() + items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/heavysniper, 15, 0) + items += new/datum/uplink_random_item(/datum/uplink_item/item/tools/teleporter, 10, 0) + items += new/datum/uplink_random_item(/datum/uplink_item/item/hardsuit_modules/laser_canon, reselect_probability = 5) + +/datum/uplink_random_selection/blacklist/New() + // do this before parent stuff just in case + LAZYADD(blacklist, /datum/uplink_item/item/tools/teleporter) + ..() \ No newline at end of file diff --git a/mods/gamemodes/mercenary/nuke_overrides.dm b/mods/gamemodes/mercenary/nuke_overrides.dm new file mode 100644 index 000000000000..f9e1689268ca --- /dev/null +++ b/mods/gamemodes/mercenary/nuke_overrides.dm @@ -0,0 +1,17 @@ +// Add special mercenary-mode handling to the nuke disk +/obj/item/disk/nuclear/Initialize() + . = ..() + // Can never be quite sure that a game mode has been properly initiated or not at this point, so always register + events_repository.register(/decl/observ/moved, src, src, TYPE_PROC_REF(/obj/item/disk/nuclear, check_z_level)) + +/obj/item/disk/nuclear/proc/check_z_level() + if(!(istype(SSticker.mode, /decl/game_mode/mercenary))) + events_repository.unregister(/decl/observ/moved, src, src, TYPE_PROC_REF(/obj/item/disk/nuclear, check_z_level)) // However, when we are certain unregister if necessary + return + var/turf/T = get_turf(src) + if(!T || isNotStationLevel(T.z)) + qdel(src) + +/obj/item/disk/nuclear/Destroy() + events_repository.unregister(/decl/observ/moved, src, src, TYPE_PROC_REF(/obj/item/disk/nuclear, check_z_level)) + . = ..() \ No newline at end of file diff --git a/mods/gamemodes/ninja/maps/ninja_base.dmm b/mods/gamemodes/ninja/maps/ninja_base.dmm index f4de17a60585..2cb311efb7ae 100644 --- a/mods/gamemodes/ninja/maps/ninja_base.dmm +++ b/mods/gamemodes/ninja/maps/ninja_base.dmm @@ -889,8 +889,7 @@ }, /obj/machinery/door/blast/regular/open{ id_tag = "ninjadoor"; - name = "Blast Door"; - + name = "Blast Door" }, /turf/unsimulated/floor/dark, /area/map_template/ninja_dojo/start) diff --git a/mods/gamemodes/traitor/special_role.dm b/mods/gamemodes/traitor/special_role.dm index 4ae85327394f..495156274c05 100644 --- a/mods/gamemodes/traitor/special_role.dm +++ b/mods/gamemodes/traitor/special_role.dm @@ -107,10 +107,10 @@ if(issilicon(player)) // this needs to be here because ..() returns false if the mob isn't human add_law_zero(player) if(isrobot(player)) - var/mob/living/silicon/robot/R = player - R.SetLockdown(FALSE) - R.emagged = TRUE // Provides a traitor robot with its module's emag item - R.verbs |= /mob/living/silicon/robot/proc/ResetSecurityCodes + var/mob/living/silicon/robot/robot = player + robot.SetLockdown(FALSE) + robot.emagged = TRUE // Provides a traitor robot with its module's emag item + robot.verbs |= /mob/living/silicon/robot/proc/ResetSecurityCodes . = TRUE else if(.) spawn_uplink(player) diff --git a/mods/mobs/borers/mob/borer/borer.dm b/mods/mobs/borers/mob/borer/borer.dm index f83d77f9fb03..379bbca678cc 100644 --- a/mods/mobs/borers/mob/borer/borer.dm +++ b/mods/mobs/borers/mob/borer/borer.dm @@ -102,8 +102,8 @@ /mob/living/simple_animal/borer/handle_vision() . = ..() - set_status(STAT_BLIND, host ? GET_STATUS(host, STAT_BLIND) : 0) - set_status(STAT_BLURRY, host ? GET_STATUS(host, STAT_BLURRY) : 0) + set_status_condition(STAT_BLIND, host ? GET_STATUS(host, STAT_BLIND) : 0) + set_status_condition(STAT_BLURRY, host ? GET_STATUS(host, STAT_BLURRY) : 0) /mob/living/simple_animal/borer/handle_disabilities() . = ..() diff --git a/mods/mobs/borers/mob/borer/borer_attacks.dm b/mods/mobs/borers/mob/borer/borer_attacks.dm index 89805ffdceb1..37253f8b805c 100644 --- a/mods/mobs/borers/mob/borer/borer_attacks.dm +++ b/mods/mobs/borers/mob/borer/borer_attacks.dm @@ -1,9 +1,9 @@ -/mob/living/simple_animal/borer/UnarmedAttack(atom/A, proximity) +/mob/living/simple_animal/borer/ResolveUnarmedAttack(atom/A) if(host) return TRUE // We cannot click things outside of our host. - if(!isliving(A) || !check_intent(I_FLAG_GRAB) || stat || !proximity) + if(!isliving(A) || !check_intent(I_FLAG_GRAB) || stat) return ..() if(!can_use_borer_ability(requires_host_value = FALSE, check_last_special = FALSE)) diff --git a/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm b/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm index 05aeb1f74bb7..4ec0c9cf890a 100644 --- a/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm +++ b/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm @@ -1,6 +1,6 @@ -/obj/structure/diona_gestalt/attackby(var/obj/item/thing, var/mob/user) +/obj/structure/diona_gestalt/attackby(var/obj/item/used_item, var/mob/user) . = ..() - if(thing.get_attack_force(user)) + if(used_item.get_attack_force(user)) shed_atom(forcefully = TRUE) /obj/structure/diona_gestalt/hitby() diff --git a/mods/mobs/dionaea/mob/gestalt/gestalt_movement.dm b/mods/mobs/dionaea/mob/gestalt/gestalt_movement.dm index 4fc33e40e613..a3090a11c321 100644 --- a/mods/mobs/dionaea/mob/gestalt/gestalt_movement.dm +++ b/mods/mobs/dionaea/mob/gestalt/gestalt_movement.dm @@ -6,8 +6,7 @@ . = ..() if(AM && can_roll_up_atom(AM) && AM.Adjacent(src)) var/turf/stepping = AM.loc - roll_up_atom(AM) - if(stepping) + if(roll_up_atom(AM) && stepping) step_towards(src, stepping) diff --git a/mods/mobs/dionaea/mob/gestalt/gestalt_nymph.dm b/mods/mobs/dionaea/mob/gestalt/gestalt_nymph.dm index ad6147a62c13..7b4f4d686ca8 100644 --- a/mods/mobs/dionaea/mob/gestalt/gestalt_nymph.dm +++ b/mods/mobs/dionaea/mob/gestalt/gestalt_nymph.dm @@ -11,13 +11,14 @@ /obj/structure/diona_gestalt/proc/roll_up_atom(var/mob/living/simple_animal/alien/diona/chirp, var/silent) if(!istype(chirp)) - return + return FALSE if(!silent) visible_message("\The [chirp] is engulfed by \the [src].") if(isdiona(chirp)) nymphs[chirp] = TRUE queue_icon_update() chirp.forceMove(src) + return TRUE /obj/structure/diona_gestalt/proc/shed_atom(var/atom/movable/shedding, var/silent, var/forcefully) diff --git a/mods/mobs/dionaea/mob/nymph_attacks.dm b/mods/mobs/dionaea/mob/nymph_attacks.dm index fdfce5f87cb5..a3d0816684ed 100644 --- a/mods/mobs/dionaea/mob/nymph_attacks.dm +++ b/mods/mobs/dionaea/mob/nymph_attacks.dm @@ -1,4 +1,4 @@ -/mob/living/simple_animal/alien/diona/UnarmedAttack(var/atom/A) +/mob/living/simple_animal/alien/diona/ResolveUnarmedAttack(var/atom/A) if(incapacitated()) return ..() diff --git a/mods/pyrelight/datum/traits/_wyrd_categories.dm b/mods/pyrelight/datum/traits/_wyrd_categories.dm index 4b1ce7149247..c2e38cb2338b 100644 --- a/mods/pyrelight/datum/traits/_wyrd_categories.dm +++ b/mods/pyrelight/datum/traits/_wyrd_categories.dm @@ -51,7 +51,7 @@ anima of the wilds, carried down through blood and manifesting in strange ways. The \ wyrdmarked are often treated with mistrust or fear by the general populace, leading \ many to cover their wyrdmarks and hide their nature." - permitted_species = list(SPECIES_HUMAN) + permitted_species = list(/decl/species/human::uid) uid = "trait_wyrd_wild" /* incompatible_with = list( diff --git a/mods/pyrelight/undead/undead.dm b/mods/pyrelight/undead/undead.dm index d304b7ddefe7..75b4d41e11e0 100644 --- a/mods/pyrelight/undead/undead.dm +++ b/mods/pyrelight/undead/undead.dm @@ -8,7 +8,7 @@ /mob/living/human/proc/grant_basic_undead_equipment() var/species_name = get_species_name() - if(species_name == SPECIES_HUMAN || species_name == SPECIES_HNOLL) + if(species_name == /decl/species/human::name || species_name == /decl/species/hnoll::name) var/pants_type = pick(/obj/item/clothing/pants/trousers, /obj/item/clothing/pants/trousers/braies) equip_to_slot_or_del(new pants_type(src), slot_w_uniform_str) @@ -26,7 +26,7 @@ put_in_inactive_hand(new /obj/item/shield/crafted/buckler(src)) return - if(species_name == SPECIES_KOBALOI) + if(species_name == /decl/species/kobaloi::name) var/pants_type = pick(/obj/item/clothing/pants/trousers/braies, /obj/item/clothing/pants/loincloth) equip_to_slot_or_del(new pants_type(src), slot_w_uniform_str) diff --git a/mods/pyrelight/undead/undead_skeleton.dm b/mods/pyrelight/undead/undead_skeleton.dm index a07acbecbe58..fbe12dce0511 100644 --- a/mods/pyrelight/undead/undead_skeleton.dm +++ b/mods/pyrelight/undead/undead_skeleton.dm @@ -32,28 +32,27 @@ /mob/living/human/skeleton skillset = /datum/skillset/undead -/mob/living/human/skeleton/post_setup(species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/skeleton/post_setup(species_uid, datum/mob_snapshot/supplied_appearance) . = ..() make_skeleton() grant_basic_undead_equipment() -/mob/living/human/skeleton/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - species_name = SPECIES_HUMAN +/mob/living/human/skeleton/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/human::uid . = ..() -/mob/living/human/skeleton/hnoll/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - species_name = SPECIES_HNOLL +/mob/living/human/skeleton/hnoll/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/hnoll::uid . = ..() -/mob/living/human/skeleton/kobaloi/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - species_name = SPECIES_KOBALOI +/mob/living/human/skeleton/kobaloi/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/kobaloi::uid . = ..() -/mob/living/human/skeleton/meredrake/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - var/decl/species/grafadreka/drakes = GET_DECL(/decl/species/grafadreka) - species_name = drakes.name +/mob/living/human/skeleton/meredrake/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/grafadreka::uid . = ..() diff --git a/mods/pyrelight/undead/undead_zombie.dm b/mods/pyrelight/undead/undead_zombie.dm index 2537b7642145..4a06c7ee5804 100644 --- a/mods/pyrelight/undead/undead_zombie.dm +++ b/mods/pyrelight/undead/undead_zombie.dm @@ -58,28 +58,27 @@ /mob/living/human/zombie skillset = /datum/skillset/undead -/mob/living/human/zombie/post_setup(species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/zombie/post_setup(species_uid, datum/mob_snapshot/supplied_appearance) . = ..() make_zombie() grant_basic_undead_equipment() -/mob/living/human/zombie/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - species_name = SPECIES_HUMAN +/mob/living/human/zombie/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/human::uid . = ..() -/mob/living/human/zombie/hnoll/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - species_name = SPECIES_HNOLL +/mob/living/human/zombie/hnoll/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/hnoll::uid . = ..() -/mob/living/human/zombie/kobaloi/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - species_name = SPECIES_KOBALOI +/mob/living/human/zombie/kobaloi/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/kobaloi::uid . = ..() -/mob/living/human/zombie/meredrake/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - if(!species_name) - var/decl/species/grafadreka/drakes = GET_DECL(/decl/species/grafadreka) - species_name = drakes.name +/mob/living/human/zombie/meredrake/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + if(!species_uid) + species_uid = /decl/species/grafadreka::uid . = ..() diff --git a/mods/species/adherent/_adherent.dm b/mods/species/adherent/_adherent.dm index e71681dc4311..a3956328501e 100644 --- a/mods/species/adherent/_adherent.dm +++ b/mods/species/adherent/_adherent.dm @@ -3,7 +3,6 @@ #define BP_JETS "maneuvering jets" #define BP_COOLING_FINS "cooling fins" -#define SPECIES_ADHERENT "Adherent" #define BODYTYPE_ADHERENT "adherent body" /decl/modpack/adherent @@ -11,8 +10,8 @@ /decl/modpack/adherent/pre_initialize() ..() - SSmodpacks.default_submap_whitelisted_species |= SPECIES_ADHERENT + SSmodpacks.default_submap_whitelisted_species |= /decl/species/adherent::uid -/mob/living/human/adherent/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - species_name = SPECIES_ADHERENT +/mob/living/human/adherent/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + species_uid = /decl/species/adherent::uid . = ..() diff --git a/mods/species/adherent/datum/species.dm b/mods/species/adherent/datum/species.dm index f209e12168b7..a63f58ceaee3 100644 --- a/mods/species/adherent/datum/species.dm +++ b/mods/species/adherent/datum/species.dm @@ -11,7 +11,8 @@ ) /decl/species/adherent - name = SPECIES_ADHERENT + uid = "species_adherent" + name = "Adherent" name_plural = "Adherents" base_external_prosthetics_model = null @@ -54,6 +55,9 @@ species_hud = /datum/hud_data/adherent available_background_info = list( + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), /decl/background_category/heritage = list( /decl/background_detail/heritage/adherent ), diff --git a/mods/species/ascent/ascent.dm b/mods/species/ascent/ascent.dm index b2240733cf15..611b84f81fc8 100644 --- a/mods/species/ascent/ascent.dm +++ b/mods/species/ascent/ascent.dm @@ -1,7 +1,3 @@ -#define SPECIES_MANTID_ALATE "Kharmaan Alate" -#define SPECIES_MANTID_GYNE "Kharmaan Gyne" -#define SPECIES_MANTID_NYMPH "Kharmaan Nymph" - #define BODYTYPE_MANTID_SMALL "small mantid body" #define BODYTYPE_MANTID_LARGE "large mantid body" @@ -15,7 +11,5 @@ ##_thing/ascent/desc = "Some kind of strange alien " + _desc + " technology."; \ ##_thing/ascent/color = COLOR_PURPLE; -#define ALL_ASCENT_SPECIES list(SPECIES_MANTID_ALATE, SPECIES_MANTID_GYNE) - /decl/modpack/ascent name = "The Ascent" diff --git a/mods/species/ascent/datum/antagonist.dm b/mods/species/ascent/datum/antagonist.dm index 2dd1000fac8f..fbf82caec228 100644 --- a/mods/species/ascent/datum/antagonist.dm +++ b/mods/species/ascent/datum/antagonist.dm @@ -21,21 +21,22 @@ if(ishuman(player.current)) var/mob/living/human/H = player.current H.set_gyne_lineage(lineage) // This makes all antag ascent have the same lineage on get_random_name. - if(!leader && is_species_whitelisted(player.current, SPECIES_MANTID_GYNE)) + var/species_uid = H.get_species()?.uid + if(!leader && is_species_whitelisted(player.current, /decl/species/mantid/gyne::uid)) leader = player - if(H.species.get_root_species_name() != SPECIES_MANTID_GYNE) - H.set_species(SPECIES_MANTID_GYNE) + if(species_uid != /decl/species/mantid/gyne::uid) + H.set_species(/decl/species/mantid/gyne::uid) H.set_gender(FEMALE) else - if(H.species.get_root_species_name() != SPECIES_MANTID_ALATE) - H.set_species(SPECIES_MANTID_ALATE) + if(species_uid != /decl/species/mantid::uid) + H.set_species(/decl/species/mantid::uid) H.set_gender(MALE) var/decl/background_detail/heritage/ascent/background = GET_DECL(/decl/background_detail/heritage/ascent) H.real_name = background.get_random_name(H, H.gender) H.name = H.real_name /decl/special_role/hunter/equip_role(var/mob/living/human/player) - if(player?.species.get_root_species_name(player) == SPECIES_MANTID_GYNE) + if(player?.get_species()?.uid == /decl/species/mantid::uid) rig_type = /obj/item/rig/mantid/gyne else rig_type = initial(rig_type) diff --git a/mods/species/ascent/datum/languages.dm b/mods/species/ascent/datum/languages.dm index d4af47ccc14e..6ea22b2a117d 100644 --- a/mods/species/ascent/datum/languages.dm +++ b/mods/species/ascent/datum/languages.dm @@ -12,8 +12,8 @@ shorthand = "KV" machine_understands = FALSE var/list/correct_mouthbits = list( - SPECIES_MANTID_ALATE, - SPECIES_MANTID_GYNE + /decl/species/mantid::uid, + /decl/species/mantid/gyne::uid ) /decl/language/mantid/can_be_spoken_properly_by(var/mob/speaker) @@ -24,7 +24,7 @@ return SPEECH_RESULT_GOOD if(ishuman(speaker)) var/mob/living/human/H = speaker - if(H.species.name in correct_mouthbits) + if(H.species.uid in correct_mouthbits) return SPEECH_RESULT_GOOD return SPEECH_RESULT_MUDDLED @@ -74,7 +74,7 @@ return TRUE else if(ishuman(speaker)) var/mob/living/human/H = speaker - return (H.species.name == SPECIES_MANTID_ALATE || H.species.name == SPECIES_MANTID_GYNE) + return istype(H.get_species(), /decl/species/mantid) return FALSE /decl/language/mantid/worldnet diff --git a/mods/species/ascent/datum/species.dm b/mods/species/ascent/datum/species.dm index f6bc5dddb055..2a26f97bfba3 100644 --- a/mods/species/ascent/datum/species.dm +++ b/mods/species/ascent/datum/species.dm @@ -24,8 +24,8 @@ splatter_colour = "#660066" /decl/species/mantid - - name = SPECIES_MANTID_ALATE + uid = "species_mantid_alate" + name = "Kharmaan Alate" name_plural = "Kharmaan Alates" show_ssd = "quiescent" hidden_from_codex = TRUE @@ -72,10 +72,11 @@ spawn_flags = SPECIES_IS_RESTRICTED force_background_info = list( - /decl/background_category/heritage = /decl/background_detail/heritage/ascent, - /decl/background_category/homeworld = /decl/background_detail/location/kharmaani, - /decl/background_category/faction = /decl/background_detail/faction/ascent_alate, - /decl/background_category/religion = /decl/background_detail/religion/kharmaani + /decl/background_category/citizenship = /decl/background_detail/citizenship/other, + /decl/background_category/heritage = /decl/background_detail/heritage/ascent, + /decl/background_category/homeworld = /decl/background_detail/location/kharmaani, + /decl/background_category/faction = /decl/background_detail/faction/ascent_alate, + /decl/background_category/religion = /decl/background_detail/religion/kharmaani ) pain_emotes_with_pain_level = list( @@ -91,8 +92,8 @@ return /decl/species/mantid/gyne - - name = SPECIES_MANTID_GYNE + uid = "species_mantid_gyne" + name = "Kharmaan Gyne" name_plural = "Kharmaan Gynes" available_bodytypes = list(/decl/bodytype/crystalline/mantid/gyne) @@ -108,8 +109,9 @@ swap_flags = ALLMOBS force_background_info = list( - /decl/background_category/heritage = /decl/background_detail/heritage/ascent, - /decl/background_category/homeworld = /decl/background_detail/location/kharmaani, - /decl/background_category/faction = /decl/background_detail/faction/ascent_gyne, - /decl/background_category/religion = /decl/background_detail/religion/kharmaani + /decl/background_category/citizenship = /decl/background_detail/citizenship/other, + /decl/background_category/heritage = /decl/background_detail/heritage/ascent, + /decl/background_category/homeworld = /decl/background_detail/location/kharmaani, + /decl/background_category/faction = /decl/background_detail/faction/ascent_gyne, + /decl/background_category/religion = /decl/background_detail/religion/kharmaani ) diff --git a/mods/species/ascent/datum/traits.dm b/mods/species/ascent/datum/traits.dm index 2e8e36b2bb56..9faaa45fd242 100644 --- a/mods/species/ascent/datum/traits.dm +++ b/mods/species/ascent/datum/traits.dm @@ -1,9 +1,8 @@ /decl/trait/build_references() . = ..() LAZYINITLIST(blocked_species) - blocked_species |= SPECIES_MANTID_ALATE - blocked_species |= SPECIES_MANTID_GYNE - blocked_species |= SPECIES_MANTID_NYMPH + blocked_species |= /decl/species/mantid::uid + blocked_species |= /decl/species/mantid/gyne::uid /decl/trait/ascent abstract_type = /decl/trait/ascent @@ -12,9 +11,8 @@ . = ..() blocked_species = null permitted_species = list( - SPECIES_MANTID_ALATE, - SPECIES_MANTID_GYNE, - SPECIES_MANTID_NYMPH + /decl/species/mantid::uid, + /decl/species/mantid/gyne::uid ) // Modifies the exosuit that you spawn with. diff --git a/mods/species/ascent/effects/razorweb.dm b/mods/species/ascent/effects/razorweb.dm index 0647ffe0c91f..fe859d155f99 100644 --- a/mods/species/ascent/effects/razorweb.dm +++ b/mods/species/ascent/effects/razorweb.dm @@ -32,8 +32,8 @@ var/image/gleam var/image/web var/static/species_immunity_list = list( - SPECIES_MANTID_ALATE = TRUE, - SPECIES_MANTID_GYNE = TRUE + /decl/species/mantid::uid = TRUE, + /decl/species/mantid/gyne::uid = TRUE ) /obj/effect/razorweb/Destroy() @@ -78,16 +78,16 @@ qdel_self() return TRUE -/obj/effect/razorweb/attackby(var/obj/item/thing, var/mob/user) +/obj/effect/razorweb/attackby(var/obj/item/used_item, var/mob/user) var/destroy_self - if(thing.expend_attack_force(user)) - visible_message(SPAN_DANGER("\The [user] breaks \the [src] with \the [thing]!")) + if(used_item.expend_attack_force(user)) + visible_message(SPAN_DANGER("\The [user] breaks \the [src] with \the [used_item]!")) destroy_self = TRUE - if(prob(15) && user.try_unequip(thing)) - visible_message(SPAN_DANGER("\The [thing] is sliced apart!")) - qdel(thing) + if(prob(15) && user.try_unequip(used_item)) + visible_message(SPAN_DANGER("\The [used_item] is sliced apart!")) + qdel(used_item) if(destroy_self) qdel(src) @@ -133,7 +133,7 @@ var/mob/living/human/H if(ishuman(L)) H = L - if(species_immunity_list[H.species.name]) + if(species_immunity_list[H.species.uid]) return if(!silent) diff --git a/mods/species/ascent/items/id_control.dm b/mods/species/ascent/items/id_control.dm index b5d09fe55e4a..5a7831346832 100644 --- a/mods/species/ascent/items/id_control.dm +++ b/mods/species/ascent/items/id_control.dm @@ -8,7 +8,7 @@ /obj/item/card/id/ascent/GetAccess() var/mob/living/human/H = loc - if(istype(H) && !(H.species.name in ALL_ASCENT_SPECIES)) + if(istype(H) && !istype(H.get_species(), /decl/species/mantid)) . = list() else . = ..() diff --git a/mods/species/ascent/items/rig.dm b/mods/species/ascent/items/rig.dm index 214f60caa99a..321d28d856af 100644 --- a/mods/species/ascent/items/rig.dm +++ b/mods/species/ascent/items/rig.dm @@ -41,7 +41,7 @@ /obj/item/rig_module/maneuvering_jets ) req_access = list(access_ascent) - var/mantid_caste = SPECIES_MANTID_ALATE + var/mantid_caste = /decl/species/mantid::uid // Renamed blade. /obj/item/rig_module/mounted/energy_blade/mantid @@ -209,7 +209,7 @@ ARMOR_BIO = ARMOR_BIO_SHIELDED, ARMOR_RAD = ARMOR_RAD_SHIELDED ) - mantid_caste = SPECIES_MANTID_GYNE + mantid_caste = /decl/species/mantid/gyne::uid initial_modules = list( /obj/item/rig_module/vision/thermal, /obj/item/rig_module/ai_container, @@ -231,7 +231,7 @@ if(!. || slot != slot_back_str || !mantid_caste) return var/decl/species/my_species = user?.get_species() - if(my_species?.get_root_species_name(user) != mantid_caste) + if(my_species?.uid != mantid_caste) to_chat(user, SPAN_WARNING("Your species cannot wear \the [src].")) return FALSE diff --git a/mods/species/ascent/machines/magnetotron.dm b/mods/species/ascent/machines/magnetotron.dm index ef49173254c6..878e9bc4c819 100644 --- a/mods/species/ascent/machines/magnetotron.dm +++ b/mods/species/ascent/machines/magnetotron.dm @@ -24,7 +24,7 @@ display_message("No biological signature detected in [src].") return TRUE - if(target.get_species_name() != SPECIES_MANTID_ALATE) + if(target.get_species()?.uid != /decl/species/mantid::uid) display_message("Invalid biological signature detected. Safety mechanisms engaged, only alates may undergo metamorphosis.") return TRUE @@ -46,7 +46,7 @@ target.visible_message(SPAN_NOTICE("[target] molts away their shell, emerging as a new gyne.")) spark_at(src, cardinal_only = TRUE) ADJ_STATUS(target, STAT_STUN, 6) - target.change_species(SPECIES_MANTID_GYNE) + target.change_species(/decl/species/mantid/gyne::uid) new /obj/effect/temp_visual/emp_burst(loc) for(var/obj/item/organ/external/E in target.get_external_organs()) if(prob(60)) @@ -59,7 +59,7 @@ /obj/machinery/ascent_magnetotron/proc/get_total_gynes() for(var/mob/living/human/H in global.living_mob_list_) - if(H.get_species_name() == SPECIES_MANTID_GYNE) + if(H.get_species()?.uid == /decl/species/mantid/gyne::uid) . += 1 /obj/item/stock_parts/circuitboard/ascent_magnetotron diff --git a/mods/species/ascent/machines/ship_machines.dm b/mods/species/ascent/machines/ship_machines.dm index 84d848e7d14d..9db2e97943ca 100644 --- a/mods/species/ascent/machines/ship_machines.dm +++ b/mods/species/ascent/machines/ship_machines.dm @@ -164,7 +164,7 @@ MANTIDIFY(/obj/item/chems/chem_disp_cartridge, "canister", "chemical storage") return ..() if(ishuman(user)) var/mob/living/human/H = user - if(!(H.species.name in ALL_ASCENT_SPECIES)) + if(!istype(H.get_species(), /decl/species/mantid)) to_chat(H, SPAN_WARNING("You have no idea how to use \the [src].")) return TRUE else if(!isascentdrone(user)) diff --git a/mods/species/ascent/mobs/drone.dm b/mods/species/ascent/mobs/drone.dm index 2294585ee151..5c972fe7887a 100644 --- a/mods/species/ascent/mobs/drone.dm +++ b/mods/species/ascent/mobs/drone.dm @@ -121,7 +121,7 @@ . = ..() -/obj/item/robot_module/flying/ascent/respawn_consumable(var/mob/living/silicon/robot/R, var/amount) +/obj/item/robot_module/flying/ascent/respawn_consumable(var/mob/living/silicon/robot/robot, var/amount) var/obj/item/stack/medical/resin/drone/resin = locate() in equipment if(!resin) resin = new(src, 1) diff --git a/mods/species/ascent/mobs/insectoid_egg.dm b/mods/species/ascent/mobs/insectoid_egg.dm index 685b62a50aa4..0385817c1ec7 100644 --- a/mods/species/ascent/mobs/insectoid_egg.dm +++ b/mods/species/ascent/mobs/insectoid_egg.dm @@ -8,6 +8,13 @@ var/global/default_gyne /decl/ghosttrap/kharmaani_egg/forced(var/mob/user) request_player(new /mob/living/simple_animal/alien/kharmaan(get_turf(user)), "A mantid nymph is ready to hatch and needs a player.") +/decl/ghosttrap/kharmaani_egg/transfer_personality(mob/candidate, mob/target) + . = ..() + var/obj/structure/insectoid_egg/egg = target.loc + if(!istype(egg)) + return // somehow we're missing an egg + egg.hatch() + /obj/structure/insectoid_egg name = "alien egg" desc = "A semi-translucent alien egg." @@ -53,20 +60,21 @@ var/global/default_gyne /obj/structure/insectoid_egg/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(hatched || !current_health) - . += "\icon[src] \The [src] lays in shambles, having been hatched or broken." + . += "\icon[src] \The [src] lays in shambles, having [hatched ? "already hatched" : "been broken"]." return - if(maturity < 5) - . += "\icon[src] \The [src] is freshly laid and sticky." - else if(maturity < 15) - . += "\icon[src] \The [src] is small and still to the touch." - else if(maturity < 30) - . += "\icon[src] \The [src] has swollen in size; a faint glow can be seen inside the shell." - else if(maturity < 50) - . += "\icon[src] \The [src] emanates a faint glow and moves from time to time." - else if(maturity < 75) - . += "\icon[src] \The [src] appears to be close to hatching." - else - . += "\icon[src] \The [src] is lively and appears ready to hatch at any moment." + switch(maturity) + if(0 to 5) + . += "\icon[src] \The [src] is freshly laid and sticky." + if(5 to 15) + . += "\icon[src] \The [src] is small and still to the touch." + if(15 to 30) + . += "\icon[src] \The [src] has swollen in size; a faint glow can be seen inside the shell." + if(30 to 50) + . += "\icon[src] \The [src] emanates a faint glow and moves from time to time." + if(50 to 75) + . += "\icon[src] \The [src] appears to be close to hatching." + else + . += "\icon[src] \The [src] is lively and appears ready to hatch at any moment." /obj/structure/insectoid_egg/Process() if(!current_health || hatched || hatching || (world.time <= (last_tick + maturity_rate))) @@ -88,23 +96,26 @@ var/global/default_gyne maturity = min(100, maturity + 1) ready_to_hatch = maturity == 100 && !ready_to_hatch // Lazy flip from change. if(ready_to_hatch) + var/mob/living/simple_animal/alien/kharmaan/new_nymph = mature() // prepare a nymph in the egg var/decl/ghosttrap/G = GET_DECL(/decl/ghosttrap/kharmaani_egg) - G.request_player(src, "A mantid nymph is ready to hatch and needs a player.") + G.request_player(new_nymph, "A mantid nymph is ready to hatch and needs a player.") -/obj/structure/insectoid_egg/proc/hatch(var/client/C) +/obj/structure/insectoid_egg/proc/mature(var/client/C) if(!current_health || maturity != 100 || hatched || hatching) - return - - var/mob/living/simple_animal/alien/kharmaan/new_nymph = new(src, SPECIES_MANTID_NYMPH) // Spawn in the egg. + return null + var/mob/living/simple_animal/alien/kharmaan/new_nymph = new(src) // Spawn in the egg. new_nymph.lastarea = get_area(src) - new_nymph.key = C.ckey new_nymph.real_name = "[random_id(/decl/species/mantid, 10000, 99999)] [lineage]" + if(C) + new_nymph.key = C.key + visible_message(SPAN_NOTICE("\icon[src] \The [src] trembles and cracks as it begins to hatch.")) + return new_nymph + +/obj/structure/insectoid_egg/proc/hatch() hatching = TRUE update_icon() - visible_message(SPAN_NOTICE("\icon[src] \The [src] trembles and cracks as it begins to hatch.")) addtimer(CALLBACK(src, PROC_REF(finish_hatching)), 2.5 SECONDS) - /obj/structure/insectoid_egg/proc/finish_hatching() hatched = TRUE hatching = FALSE diff --git a/mods/species/ascent/mobs/nymph/nymph_attacks.dm b/mods/species/ascent/mobs/nymph/nymph_attacks.dm index 59cc8dcea0ea..d5e982457300 100644 --- a/mods/species/ascent/mobs/nymph/nymph_attacks.dm +++ b/mods/species/ascent/mobs/nymph/nymph_attacks.dm @@ -1,4 +1,4 @@ -/mob/living/simple_animal/alien/kharmaan/UnarmedAttack(var/atom/A) +/mob/living/simple_animal/alien/kharmaan/ResolveUnarmedAttack(var/atom/A) . = ..() if(.) diff --git a/mods/species/ascent/mobs/nymph/nymph_life.dm b/mods/species/ascent/mobs/nymph/nymph_life.dm index 0724b604a493..8879b71c576f 100644 --- a/mods/species/ascent/mobs/nymph/nymph_life.dm +++ b/mods/species/ascent/mobs/nymph/nymph_life.dm @@ -41,7 +41,7 @@ visible_message("\icon[src] [src] begins to shimmy and shake out of its old skin.") if(molt == 5) if(do_after(src, 10 SECONDS, src, FALSE)) - var/mob/living/human/H = new(get_turf(src), SPECIES_MANTID_ALATE) + var/mob/living/human/H = new(get_turf(src), /decl/species/mantid::uid) H.set_gyne_lineage(get_gyne_lineage()) H.real_name = "[random_id(/decl/species/mantid, 10000, 99999)] [H.get_gyne_name()]" H.nutrition = nutrition * 0.25 // Homgry after molt. diff --git a/mods/species/drakes/_drakes.dm b/mods/species/drakes/_drakes.dm index 47bf61c6a401..1843e9e473e9 100644 --- a/mods/species/drakes/_drakes.dm +++ b/mods/species/drakes/_drakes.dm @@ -1,4 +1,3 @@ -#define SPECIES_GRAFADREKA "Grafadreka" #define BODYTYPE_GRAFADREKA "drake body" #define BODYTYPE_GRAFADREKA_HATCHLING "hatchling drake body" #define BP_DRAKE_GIZZARD "drake gizzard" @@ -6,7 +5,6 @@ /decl/modpack/grafadreka name = "Grafadreka Species" -/mob/living/human/grafadreka/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - // fantasy modpack overrides drake name, so can't use the #define - var/decl/species/grafadreka/drakes = GET_DECL(/decl/species/grafadreka) - . = ..(mapload, drakes.name) +/mob/living/human/grafadreka/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + species_uid = /decl/species/grafadreka::uid + . = ..() diff --git a/mods/species/drakes/drake_abilities_friendly.dm b/mods/species/drakes/drake_abilities_friendly.dm index a224540e9889..658adbe07ebd 100644 --- a/mods/species/drakes/drake_abilities_friendly.dm +++ b/mods/species/drakes/drake_abilities_friendly.dm @@ -49,7 +49,7 @@ var/global/list/_wounds_being_tended_by_drakes = list() return TRUE // Are we already regenerating? - if(friend.has_aura(/obj/aura/sifsap_salve)) + if(friend.has_mob_modifier(/decl/mob_modifier/sifsap_salve)) if(friend == user) to_chat(user, SPAN_WARNING("Your wounds have already been cleaned.")) else @@ -72,7 +72,7 @@ var/global/list/_wounds_being_tended_by_drakes = list() var/friend_ref = "\ref[friend]" global._wounds_being_tended_by_drakes[friend_ref] = world.time + (8 SECONDS) - if(!do_after(user, 8 SECONDS, friend) || QDELETED(friend) || friend.has_aura(/obj/aura/sifsap_salve) || user.incapacitated() || !drake_spend_sap(user, 10)) + if(!do_after(user, 8 SECONDS, friend) || QDELETED(friend) || friend.has_mob_modifier(/decl/mob_modifier/sifsap_salve) || user.incapacitated() || !drake_spend_sap(user, 10)) global._wounds_being_tended_by_drakes -= friend_ref return TRUE @@ -86,7 +86,7 @@ var/global/list/_wounds_being_tended_by_drakes = list() // Sivian animals get a heal buff from the modifier, others just // get it to stop friendly drakes constantly licking their wounds. // Organ wounds are closed, but the owners get sifsap injected via open wounds. - friend.add_aura(new /obj/aura/sifsap_salve(friend, 60 SECONDS)) + friend.add_mob_modifier(/decl/mob_modifier/sifsap_salve, 60 SECONDS, source = user) var/list/friend_organs = friend.get_external_organs() if(length(friend_organs)) for (var/obj/item/organ/external/E in friend_organs) @@ -95,10 +95,10 @@ var/global/list/_wounds_being_tended_by_drakes = list() var/datum/reagents/bloodstream = friend.get_injected_reagents() if(bloodstream) bloodstream.add_reagent(/decl/material/liquid/sifsap, rand(1,2)) - for (var/datum/wound/W in E.wounds) - W.clamped = TRUE // use this rather than bandaged to avoid message weirdness - W.salve() - W.disinfect() + for (var/datum/wound/wound in E.wounds) + wound.clamped = TRUE // use this rather than bandaged to avoid message weirdness + wound.salve() + wound.disinfect() // Everyone else is just poisoned. else if(!friend.has_trait(/decl/trait/sivian_biochemistry)) friend.take_damage(rand(1,2), TOX) diff --git a/mods/species/drakes/drake_modifiers.dm b/mods/species/drakes/drake_modifiers.dm index a540b0f0c3b0..59366e7cfa73 100644 --- a/mods/species/drakes/drake_modifiers.dm +++ b/mods/species/drakes/drake_modifiers.dm @@ -1,46 +1,33 @@ -/obj/aura/sifsap_salve - name = "Sifsap Salve" - icon = 'icons/effects/sparkles.dmi' - icon_state = "cyan_sparkles" - var/expiry - var/descriptor = "glowing sap" - -/obj/aura/sifsap_salve/Initialize(ml, _lifetime) - expiry = world.time + _lifetime - return ..() - -/obj/aura/sifsap_salve/added_to(var/mob/living/L) - ..() - to_chat(user, SPAN_NOTICE("The [descriptor] seethes and bubbles in your wounds, tingling and stinging.")) - -/obj/aura/sifsap_salve/removed() - to_chat(user, SPAN_NOTICE("The last of the [descriptor] in your wounds fizzles away.")) - ..() - -/obj/aura/sifsap_salve/life_tick() - - if(!user || user.stat == DEAD || user.isSynthetic()) - return 0 - - if(world.time >= expiry) - if(user) - user.remove_aura(src) - return 0 - - if(!user.has_trait(/decl/trait/sivian_biochemistry)) - user.heal_damage(BRUTE, 1, do_update_health = FALSE) - user.heal_damage(BURN, 1, do_update_health = TRUE) - return 1 - - if(user.current_health >= user.get_max_health()) - return 0 - - if(user.current_posture?.prone) - user.heal_damage(BRUTE, 3, do_update_health = FALSE) - user.heal_damage(BURN, 3, do_update_health = FALSE) - user.heal_damage(TOX, 2, do_update_health = TRUE) +/decl/mob_modifier/sifsap_salve + name = "Sifsap Salve" + desc = "Your wounds have been cleaned with drake spittle, which is beneficial to drakes - and not great for anyone else." + hud_icon = 'mods/species/drakes/icons/sifsap.dmi' + hud_icon_state = "sifsap_hud" + mob_overlay_icon = 'icons/effects/sparkles.dmi' + mob_overlay_state = "cyan_sparkles" + /// Defined here to allow overriding in fantasy modpack. + var/descriptor = "glowing sap" + +/decl/mob_modifier/sifsap_salve/Initialize() + on_add_message_1p = SPAN_NOTICE("The [descriptor] seethes and bubbles in your wounds, tingling and stinging.") + on_end_message_1p = SPAN_NOTICE("The last of the [descriptor] in your wounds fizzles away.") + . = ..() + +/decl/mob_modifier/sifsap_salve/on_modifier_datum_mob_life(mob/living/owner, decl/mob_modifier/modifier) + . = ..() + if(!owner || owner.stat == DEAD || owner.isSynthetic()) + return + if(!owner.has_trait(/decl/trait/sivian_biochemistry)) + owner.heal_damage(BRUTE, 1, do_update_health = FALSE) + owner.heal_damage(BURN, 1, do_update_health = TRUE) + return + if(owner.current_health >= owner.get_max_health()) + return + if(owner.current_posture?.prone) + owner.heal_damage(BRUTE, 3, do_update_health = FALSE) + owner.heal_damage(BURN, 3, do_update_health = FALSE) + owner.heal_damage(TOX, 2, do_update_health = TRUE) else - user.heal_damage(BRUTE, 2, do_update_health = FALSE) - user.heal_damage(BURN, 2, do_update_health = FALSE) - user.heal_damage(TOX, 1, do_update_health = TRUE) - return 1 + owner.heal_damage(BRUTE, 2, do_update_health = FALSE) + owner.heal_damage(BURN, 2, do_update_health = FALSE) + owner.heal_damage(TOX, 1, do_update_health = TRUE) diff --git a/mods/species/drakes/icons/sifsap.dmi b/mods/species/drakes/icons/sifsap.dmi new file mode 100644 index 000000000000..6942ef6d839b Binary files /dev/null and b/mods/species/drakes/icons/sifsap.dmi differ diff --git a/mods/species/drakes/species.dm b/mods/species/drakes/species.dm index e5b53bae100c..78ace9a7326b 100644 --- a/mods/species/drakes/species.dm +++ b/mods/species/drakes/species.dm @@ -1,6 +1,7 @@ /decl/species/grafadreka - name = SPECIES_GRAFADREKA - name_plural = SPECIES_GRAFADREKA + uid = "species_grafadreka" + name = "Grafadreka" + name_plural = "Grafadreka" description = "The reclusive grafadreka (Icelandic, lit. 'digging dragon'), also known as the snow drake, is a large reptillian pack predator similar in size and morphology to old Earth hyenas. \ They commonly dig shallow dens in dirt, snow or foliage, sometimes using them for concealment prior to an ambush. \ Biological cousins to the elusive kururak, they have heavy, low-slung bodies and powerful jaws suited to hunting land prey rather than fishing. \ @@ -22,16 +23,28 @@ ) available_background_info = list( - /decl/background_category/heritage = list(/decl/background_detail/heritage/grafadreka), - /decl/background_category/homeworld = list(/decl/background_detail/location/grafadreka), - /decl/background_category/faction = list(/decl/background_detail/faction/grafadreka), - /decl/background_category/religion = list(/decl/background_detail/religion/grafadreka) + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), + /decl/background_category/heritage = list( + /decl/background_detail/heritage/grafadreka + ), + /decl/background_category/homeworld = list( + /decl/background_detail/location/grafadreka + ), + /decl/background_category/faction = list( + /decl/background_detail/faction/grafadreka + ), + /decl/background_category/religion = list( + /decl/background_detail/religion/grafadreka + ) ) force_background_info = list( - /decl/background_category/heritage = /decl/background_detail/heritage/grafadreka, - /decl/background_category/homeworld = /decl/background_detail/location/grafadreka, - /decl/background_category/faction = /decl/background_detail/faction/grafadreka, - /decl/background_category/religion = /decl/background_detail/religion/grafadreka + /decl/background_category/citizenship = /decl/background_detail/citizenship/other, + /decl/background_category/heritage = /decl/background_detail/heritage/grafadreka, + /decl/background_category/homeworld = /decl/background_detail/location/grafadreka, + /decl/background_category/faction = /decl/background_detail/faction/grafadreka, + /decl/background_category/religion = /decl/background_detail/religion/grafadreka ) species_hud = /datum/hud_data/grafadreka inherent_verbs = list( diff --git a/mods/species/drakes/species_bodytypes.dm b/mods/species/drakes/species_bodytypes.dm index aae52bd678ac..5d8bf5862b68 100644 --- a/mods/species/drakes/species_bodytypes.dm +++ b/mods/species/drakes/species_bodytypes.dm @@ -262,7 +262,7 @@ icon = 'mods/species/drakes/icons/markings.dmi' icon_state = "spines" uid = "acc_marking_drake_spines" - species_allowed = list(SPECIES_GRAFADREKA) + species_allowed = list(/decl/species/grafadreka::uid) color_blend = ICON_MULTIPLY body_parts = list( BP_CHEST, @@ -317,7 +317,7 @@ var/static/unarmed_attack = GET_DECL(/decl/natural_attack/claws/strong/drake) return unarmed_attack -/obj/item/organ/external/hand/quadruped/grafadreka/Initialize(mapload, material_key, datum/mob_snapshot/supplied_appearance, decl/bodytype/new_bodytype) +/obj/item/organ/external/hand/quadruped/grafadreka/Initialize(mapload, material_key, datum/mob_snapshot/supplied_appearance) . = ..() item_flags |= ITEM_FLAG_NO_BLUDGEON set_extension(src, /datum/extension/tool, list( @@ -337,7 +337,7 @@ var/static/unarmed_attack = GET_DECL(/decl/natural_attack/claws/strong/drake) return unarmed_attack -/obj/item/organ/external/hand/right/quadruped/grafadreka/Initialize(mapload, material_key, datum/mob_snapshot/supplied_appearance, decl/bodytype/new_bodytype) +/obj/item/organ/external/hand/right/quadruped/grafadreka/Initialize(mapload, material_key, datum/mob_snapshot/supplied_appearance) . = ..() item_flags |= ITEM_FLAG_NO_BLUDGEON set_extension(src, /datum/extension/tool, list( diff --git a/mods/species/neoavians/_neoavians.dm b/mods/species/neoavians/_neoavians.dm index 0f248d0cde0a..426648c86ce8 100644 --- a/mods/species/neoavians/_neoavians.dm +++ b/mods/species/neoavians/_neoavians.dm @@ -1,4 +1,3 @@ -#define SPECIES_AVIAN "Neo-Avian" #define BODYTYPE_AVIAN "avian body" #define BODY_EQUIP_FLAG_AVIAN BITFLAG(6) @@ -7,4 +6,4 @@ /decl/modpack/neoavians/pre_initialize() ..() - SSmodpacks.default_submap_whitelisted_species |= SPECIES_AVIAN + SSmodpacks.default_submap_whitelisted_species |= /decl/species/neoavian::uid diff --git a/mods/species/neoavians/datum/accessory.dm b/mods/species/neoavians/datum/accessory.dm index b8c260ced4b3..978711e67460 100644 --- a/mods/species/neoavians/datum/accessory.dm +++ b/mods/species/neoavians/datum/accessory.dm @@ -3,7 +3,7 @@ name = "Avian Plumage" icon_state = "avian_default" icon = 'mods/species/neoavians/icons/hair.dmi' - species_allowed = list(SPECIES_AVIAN) + species_allowed = list(/decl/species/neoavian::uid) color_blend = ICON_MULTIPLY uid = "acc_hair_avian_plumage" @@ -124,7 +124,7 @@ icon_state = "beak" body_parts = list(BP_HEAD) icon = 'mods/species/neoavians/icons/markings.dmi' - species_allowed = list(SPECIES_AVIAN) + species_allowed = list(/decl/species/neoavian::uid) color_blend = ICON_MULTIPLY uid = "acc_marking_avian_beak" diff --git a/mods/species/neoavians/datum/loadout.dm b/mods/species/neoavians/datum/loadout.dm index 080f69b56d22..608757094363 100644 --- a/mods/species/neoavians/datum/loadout.dm +++ b/mods/species/neoavians/datum/loadout.dm @@ -2,7 +2,7 @@ name = "Avian" /decl/loadout_option/avian - whitelisted = list(SPECIES_AVIAN) + whitelisted = list(/decl/species/neoavian::uid) category = /decl/loadout_category/avian abstract_type = /decl/loadout_option/avian diff --git a/mods/species/neoavians/datum/species.dm b/mods/species/neoavians/datum/species.dm index 065b6c6d932d..1b102057266b 100644 --- a/mods/species/neoavians/datum/species.dm +++ b/mods/species/neoavians/datum/species.dm @@ -16,7 +16,8 @@ meat_type = /obj/item/food/butchery/meat/chicken /decl/species/neoavian - name = SPECIES_AVIAN + uid = "species_avian" + name = "Neo-Avian" name_plural = "Neo-Avians" description = "Avian species, largely crows, magpies and other corvids, were among the first sophonts uplifted to aid in colonizing Mars. \ These days they are more commonly found pursuing their own careers and goals on the fringes of human space or around their adopted homeworld \ diff --git a/mods/species/random_species/_random_species.dm b/mods/species/random_species/_random_species.dm index 7f20e9a608f5..49640db2218c 100644 --- a/mods/species/random_species/_random_species.dm +++ b/mods/species/random_species/_random_species.dm @@ -1,8 +1,6 @@ -#define SPECIES_ALIEN "Humanoid" - /decl/modpack/random_species name = "Random Alien Species" /decl/modpack/random_species/initialize() . = ..() - SSmodpacks.default_submap_blacklisted_species += SPECIES_ALIEN + SSmodpacks.default_submap_blacklisted_species += /decl/species/alium::uid diff --git a/mods/species/random_species/aliumizer.dm b/mods/species/random_species/aliumizer.dm index 6d7ab1e57964..34e95893d565 100644 --- a/mods/species/random_species/aliumizer.dm +++ b/mods/species/random_species/aliumizer.dm @@ -13,19 +13,19 @@ var/decl/species/species = user.get_species() if(!species) return TRUE - if(species.name == SPECIES_ALIEN) - to_chat(user, SPAN_WARNING("You're already a [SPECIES_ALIEN].")) + if(species.uid == /decl/species/alium::uid) + to_chat(user, SPAN_WARNING("You're already an alien.")) return TRUE if(alert("Are you sure you want to be an alien?", "Mom Look I'm An Alien!", "Yes", "No") == "No") - to_chat(user, SPAN_NOTICE("You are now a [SPECIES_ALIEN]!")) + to_chat(user, SPAN_NOTICE("You are now an alien!")) return TRUE - if(species.name == SPECIES_ALIEN) //no spamming it to get free implants + if(species.uid == /decl/species/alium::uid) //no spamming it to get free implants return TRUE to_chat(user, "You're now an alien humanoid of some undiscovered species. Make up what lore you want, no one knows a thing about your species! You can check info about your traits with Check Species Info verb in IC tab.") to_chat(user, "You can't speak any other languages by default. You can use translator implant that spawns on top of this monolith - it will give you knowledge of any language if you hear it enough times.") var/mob/living/human/H = user new /obj/item/implanter/translator(get_turf(src)) - H.change_species(SPECIES_ALIEN) + H.change_species(/decl/species/alium::uid) var/decl/background_detail/background = H.get_background_datum_by_flag(BACKGROUND_FLAG_NAMING) H.fully_replace_character_name(background.get_random_name(H, H.gender)) H.rename_self("Humanoid Alien", 1) diff --git a/mods/species/random_species/random_species_species.dm b/mods/species/random_species/random_species_species.dm index 06f431624ac4..3db442f8b108 100644 --- a/mods/species/random_species/random_species_species.dm +++ b/mods/species/random_species/random_species_species.dm @@ -1,5 +1,6 @@ /decl/species/alium - name = SPECIES_ALIEN + uid = "species_random_alien" + name = "Humanoid" name_plural = "Humanoids" description = "Some alien humanoid species, unknown to humanity. How exciting." rarity_value = 5 diff --git a/mods/species/serpentid/datum/species.dm b/mods/species/serpentid/datum/species.dm index a261ea256d49..f01a3f4c746f 100644 --- a/mods/species/serpentid/datum/species.dm +++ b/mods/species/serpentid/datum/species.dm @@ -19,7 +19,8 @@ bone_type = null /decl/species/serpentid - name = SPECIES_SERPENTID + uid = "species_serpentid" + name = "Serpentid" name_plural = "Serpentids" spawn_flags = SPECIES_IS_RESTRICTED @@ -101,7 +102,7 @@ /decl/species/serpentid/handle_movement_delay_special(var/mob/living/human/victim) var/tally = 0 - victim.remove_cloaking_source(src) + victim.remove_mob_modifier(/decl/mob_modifier/cloaked, source = src) var/obj/item/organ/internal/brain/insectoid/serpentid/bugbrain = victim.get_organ(BP_BRAIN, /obj/item/organ/internal/brain/insectoid/serpentid) if(bugbrain) tally += bugbrain.lowblood_tally * 2 diff --git a/mods/species/serpentid/mobs/bodyparts_serpentid.dm b/mods/species/serpentid/mobs/bodyparts_serpentid.dm index 6073d5f39044..636ac9fdbd0d 100644 --- a/mods/species/serpentid/mobs/bodyparts_serpentid.dm +++ b/mods/species/serpentid/mobs/bodyparts_serpentid.dm @@ -185,16 +185,16 @@ /obj/item/organ/external/groin/insectoid/serpentid/refresh_action_button() . = ..() if(. && istype(action)) - action.button_icon_state = "cloak-[owner && owner.is_cloaked_by(species) ? 1 : 0]" + action.button_icon_state = "cloak-[owner?.has_mob_modifier(/decl/mob_modifier/cloaked, source = species) ? 1 : 0]" action.button?.update_icon() /obj/item/organ/external/groin/insectoid/serpentid/attack_self(var/mob/user) . = ..() - if(.) - if(owner.is_cloaked_by(species)) - owner.remove_cloaking_source(species) + if(. && owner) + if(owner.has_mob_modifier(/decl/mob_modifier/cloaked, source = species)) + owner.remove_mob_modifier(/decl/mob_modifier/cloaked, source = species) else - owner.add_cloaking_source(species) + owner.add_mob_modifier(/decl/mob_modifier/cloaked, source = species) owner.apply_effect(2, STUN, 0) refresh_action_button() diff --git a/mods/species/serpentid/serpentid.dm b/mods/species/serpentid/serpentid.dm index fc9c6b085a4b..627bca7da6b1 100644 --- a/mods/species/serpentid/serpentid.dm +++ b/mods/species/serpentid/serpentid.dm @@ -1,3 +1,2 @@ -#define SPECIES_SERPENTID "Serpentid" #define BODYTYPE_SNAKE "snakelike body" #define BODY_EQUIP_FLAG_SNAKE BITFLAG(12) diff --git a/mods/species/skrell/_skrell.dm b/mods/species/skrell/_skrell.dm index c038ee1d7d22..b6ac75a5b89b 100644 --- a/mods/species/skrell/_skrell.dm +++ b/mods/species/skrell/_skrell.dm @@ -1,5 +1,3 @@ -#define SPECIES_SKRELL "Skrell" - /decl/modpack/skrell name = "Skrell Species" tabloid_headlines = list( @@ -9,8 +7,8 @@ /decl/modpack/skrell/pre_initialize() ..() - SSmodpacks.default_submap_whitelisted_species |= SPECIES_SKRELL + SSmodpacks.default_submap_whitelisted_species |= /decl/species/skrell::uid -/mob/living/human/skrell/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - species_name = SPECIES_SKRELL +/mob/living/human/skrell/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + species_uid = /decl/species/skrell::uid . = ..() diff --git a/mods/species/skrell/datum/accessory.dm b/mods/species/skrell/datum/accessory.dm index 86dc5b9755ab..6f142dccdb15 100644 --- a/mods/species/skrell/datum/accessory.dm +++ b/mods/species/skrell/datum/accessory.dm @@ -2,7 +2,7 @@ name = "Kanin - Very Short Headtails" icon = 'mods/species/skrell/icons/body/hair.dmi' icon_state = "very_short" - species_allowed = list(SPECIES_SKRELL) + species_allowed = list(/decl/species/skrell::uid) uid = "acc_hair_skrell_veryshort" /decl/sprite_accessory/hair/skrell/raskin diff --git a/mods/species/skrell/datum/species.dm b/mods/species/skrell/datum/species.dm index ac49a3c8a8b9..318bfaef9202 100644 --- a/mods/species/skrell/datum/species.dm +++ b/mods/species/skrell/datum/species.dm @@ -4,8 +4,9 @@ bone_material = /decl/material/solid/organic/bone/cartilage /decl/species/skrell - name = SPECIES_SKRELL - name_plural = SPECIES_SKRELL + uid = "species_skrell" + name = "Skrell" + name_plural = "Skrell" available_bodytypes = list( /decl/bodytype/skrell @@ -59,6 +60,9 @@ ) available_background_info = list( + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), /decl/background_category/heritage = list( /decl/background_detail/heritage/skrell, /decl/background_detail/heritage/skrell/caste_malish, @@ -133,7 +137,7 @@ // TODO: There's not currently a way to check this, which might be a little annoying for forensics. // But this is just a stopgap to stop Skrell from literally leaking blood everywhere they go. /decl/material/liquid/mucus/skrell/get_reagent_color(datum/reagents/holder) - var/list/goo_data = REAGENT_DATA(holder, type) + var/list/goo_data = REAGENT_DATA(holder, src) return goo_data?[DATA_BLOOD_COLOR] || ..() /obj/effect/decal/cleanable/blood/tracks/footprints/skrellprints diff --git a/mods/species/skrell/gear/gear.dm b/mods/species/skrell/gear/gear.dm index 52b33e247137..deacaaa13867 100644 --- a/mods/species/skrell/gear/gear.dm +++ b/mods/species/skrell/gear/gear.dm @@ -93,7 +93,7 @@ icon_state = ICON_STATE_WORLD item_state = "skrell_carbine" slot_flags = SLOT_BACK|SLOT_LOWER_BODY - desc = "The Vuu'Xqu*ix T-3, known as 'VT-3' by SolGov. Rarely seen out in the wild by anyone outside of a Skrellian SDTF." + desc = "The Vuu'Xqu*ix T-3, often simply known as the 'VT-3' by non-Skrell. Rarely seen out in the wild by anyone outside of a Skrellian SDTF." self_recharge = 1 projectile_type=/obj/item/projectile/beam/pulse/skrell/single charge_cost=120 diff --git a/mods/species/skrell/gear/gear_ears.dm b/mods/species/skrell/gear/gear_ears.dm index 338e30307fe3..474bdf444521 100644 --- a/mods/species/skrell/gear/gear_ears.dm +++ b/mods/species/skrell/gear/gear_ears.dm @@ -4,7 +4,7 @@ /obj/item/clothing/ears/skrell/mob_can_equip(mob/user, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE) . = ..() - if(. && user?.get_species_name() != SPECIES_SKRELL) + if(. && user?.get_species()?.uid != /decl/species/skrell::uid) return FALSE /obj/item/clothing/ears/skrell/band @@ -43,7 +43,7 @@ /decl/loadout_option/ears/skrell name = "skrell headtail accessory selection" category = /decl/loadout_category/ears - whitelisted = list(SPECIES_SKRELL) + whitelisted = list(/decl/species/skrell::uid) path = /obj/item/clothing/ears/skrell loadout_flags = GEAR_HAS_COLOR_SELECTION | GEAR_HAS_SUBTYPE_SELECTION uid = "gear_accessory_skrell" diff --git a/mods/species/skrell/gear/gear_head.dm b/mods/species/skrell/gear/gear_head.dm index 655c5b99824f..23cd1d2c7193 100644 --- a/mods/species/skrell/gear/gear_head.dm +++ b/mods/species/skrell/gear/gear_head.dm @@ -14,7 +14,7 @@ /obj/item/clothing/head/helmet/space/void/skrell/mob_can_equip(mob/user, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE) . = ..() - if(. && user?.get_species_name() != SPECIES_SKRELL) + if(. && user?.get_species()?.uid != /decl/species/skrell::uid) return FALSE /obj/item/clothing/head/helmet/space/void/skrell/black @@ -27,5 +27,5 @@ /obj/item/clothing/head/helmet/skrell/mob_can_equip(mob/user, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE) . = ..() - if(. && user?.get_species_name() != SPECIES_SKRELL) + if(. && user?.get_species()?.uid != /decl/species/skrell::uid) return FALSE diff --git a/mods/species/skrell/gear/gear_mask.dm b/mods/species/skrell/gear/gear_mask.dm index c28f99aa4871..b11dd2f833b1 100644 --- a/mods/species/skrell/gear/gear_mask.dm +++ b/mods/species/skrell/gear/gear_mask.dm @@ -1,7 +1,7 @@ /decl/loadout_option/mask/skrell name = "skrellian gill cover" path = /obj/item/clothing/mask/gas/skrell - whitelisted = list(SPECIES_SKRELL) + whitelisted = list(/decl/species/skrell::uid) uid = "gear_mask_skrell" /obj/item/clothing/mask/gas/skrell @@ -13,5 +13,5 @@ /obj/item/clothing/mask/gas/skrell/mob_can_equip(mob/user, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE) . = ..() - if(. && user?.get_species_name() != SPECIES_SKRELL) + if(. && user?.get_species()?.uid != /decl/species/skrell::uid) return FALSE diff --git a/mods/species/skrell/icons/clothing/under/skrell_uniform.dmi b/mods/species/skrell/icons/clothing/under/skrell_uniform.dmi index f36bd4edfbb0..3d51d61c7d5c 100644 Binary files a/mods/species/skrell/icons/clothing/under/skrell_uniform.dmi and b/mods/species/skrell/icons/clothing/under/skrell_uniform.dmi differ diff --git a/mods/species/tajaran/_tajaran.dm b/mods/species/tajaran/_tajaran.dm index cb92dbfae89c..2b07b2c74b82 100644 --- a/mods/species/tajaran/_tajaran.dm +++ b/mods/species/tajaran/_tajaran.dm @@ -1,5 +1,4 @@ #define LANGUAGE_TAJARAN "Siik'maas" -#define SPECIES_TAJARAN "Tajara" #define BODYTYPE_TAJARAN "felinoid body" /decl/modpack/tajaran @@ -10,10 +9,10 @@ /decl/modpack/tajaran/pre_initialize() ..() - SSmodpacks.default_submap_whitelisted_species |= SPECIES_TAJARAN + SSmodpacks.default_submap_whitelisted_species |= /decl/species/tajaran::uid -/mob/living/human/tajaran/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - . = ..(species_name = SPECIES_TAJARAN) +/mob/living/human/tajaran/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + . = ..(species_uid = /decl/species/tajaran::uid) /obj/item var/_tajaran_onmob_icon diff --git a/mods/species/tajaran/datum/accessory.dm b/mods/species/tajaran/datum/accessory.dm index 33d858efac46..d71003eeaa0e 100644 --- a/mods/species/tajaran/datum/accessory.dm +++ b/mods/species/tajaran/datum/accessory.dm @@ -1,8 +1,8 @@ //Hairstyles /decl/sprite_accessory/hair/taj name = "Tajaran Rattail" - icon_state = "hair_rattail" - species_allowed = list(SPECIES_TAJARAN) + icon_state = "hair_rattail_s_noear" + species_allowed = list(/decl/species/tajaran::uid) icon = 'mods/species/tajaran/icons/hair.dmi' color_blend = ICON_MULTIPLY uid = "acc_hair_taj_rattail" @@ -12,203 +12,194 @@ return src return GET_DECL(/decl/sprite_accessory/hair/bald) -/decl/sprite_accessory/hair/taj/straight - name = "Tajaran Straight Hair" - icon_state = "hair_straight" - uid = "acc_hair_taj_straight" /decl/sprite_accessory/hair/taj/clean name = "Tajaran Clean" - icon_state = "hair_clean" + icon_state = "hair_clean_s_noear" uid = "acc_hair_taj_clean" +/decl/sprite_accessory/hair/taj/bangs + name = "Tajara Bangs" + icon_state = "hair_bangs_s_noear" + uid = "acc_hair_taj_bangs" + +/decl/sprite_accessory/hair/taj/braid + name = "Tajara Braid" + icon_state = "hair_tbraid_s_noear" + uid = "acc_hair_taj_braid" + /decl/sprite_accessory/hair/taj/shaggy - name = "Tajaran Shaggy" - icon_state = "hair_shaggy" + name = "Tajara Shaggy" + icon_state = "hair_shaggy_s_noear" uid = "acc_hair_taj_shaggy" /decl/sprite_accessory/hair/taj/mohawk name = "Tajaran Mohawk" - icon_state = "hair_mohawk" + icon_state = "hair_mohawk_s_noear" uid = "acc_hair_taj_mohawk" /decl/sprite_accessory/hair/taj/plait - name = "Tajaran Plait" - icon_state = "hair_plait" + name = "Tajara Plait" + icon_state = "hair_plait_s_noear" uid = "acc_hair_taj_plait" +/decl/sprite_accessory/hair/taj/straight + name = "Tajara Straight" + icon_state = "hair_straight_s_noear" + uid = "acc_hair_taj_straight" + /decl/sprite_accessory/hair/taj/long - name = "Tajaran Long Hair" - icon_state = "hair_long" + name = "Tajara Long" + icon_state = "hair_long_s_noear" uid = "acc_hair_taj_long" /decl/sprite_accessory/hair/taj/spiky - name = "Tajaran Spiky" - icon_state = "hair_tajspiky" + name = "Tajara Spiky" + icon_state = "hair_tajspiky_s_noear" uid = "acc_hair_taj_spiky" -/decl/sprite_accessory/hair/taj/bangs - name = "Tajaran Bangs" - icon_state = "hair_bangs" - uid = "acc_hair_taj_bangs" - /decl/sprite_accessory/hair/taj/messy - name = "Tajaran Messy" - icon_state = "hair_messy" + name = "Tajara Messy" + icon_state = "hair_messy_s_noear" uid = "acc_hair_taj_messy" -/decl/sprite_accessory/hair/taj/braid - name = "Tajaran Braid" - icon_state = "hair_tbraid" - uid = "acc_hair_taj_braid" - /decl/sprite_accessory/hair/taj/bob - name = "Tajaran Bob" - icon_state = "hair_tbob" + name = "Tajara Bob" + icon_state = "hair_tbob_s_noear" uid = "acc_hair_taj_bob" -/decl/sprite_accessory/hair/taj/weave - name = "Tajaran Fingerweave" - icon_state = "hair_fingerwave" - uid = "acc_hair_taj_weave" - /decl/sprite_accessory/hair/taj/sidebraid - name = "Tajaran Sidebraid" - icon_state = "hair_sidebraid" + name = "Tajara Sidebraid" + icon_state = "hair_sidebraid_s_noear" uid = "acc_hair_taj_sidebraid" + /decl/sprite_accessory/hair/taj/ribbons - name = "Tajaran Ribbons" - icon_state = "hair_ribbons" + name = "Tajara Ribbons" + icon_state = "hair_ribbons_s_noear" uid = "acc_hair_taj_ribbons" -/decl/sprite_accessory/hair/taj/combed - name = "Tajaran Combed" - icon_state = "hair_combedback" - uid = "acc_hair_taj_combed" +/decl/sprite_accessory/hair/taj/combedback + name = "Tajara Combedback" + icon_state = "hair_combedback_s_noear" + uid = "acc_hair_taj_combedback" /decl/sprite_accessory/hair/taj/tailedbangs - name = "Tajaran Tailed Bangs" - icon_state = "hair_tailedbangs" + name = "Tajara Tailedbangs" + icon_state = "hair_tailedbangs_s_noear" uid = "acc_hair_taj_tailedbangs" -/decl/sprite_accessory/hair/taj/lynx - name = "Tajaran Lynx" - icon_state = "hair_lynx" - uid = "acc_hair_taj_lynx" - /decl/sprite_accessory/hair/taj/longtail - name = "Tajaran Long Tail" - icon_state = "hair_longtail" + name = "Tajara Longtail" + icon_state = "hair_longtail_s_noear" uid = "acc_hair_taj_longtail" /decl/sprite_accessory/hair/taj/shy - name = "Tajaran Shy" - icon_state = "hair_shy" + name = "Tajara Shy" + icon_state = "hair_shy_s_noear" uid = "acc_hair_taj_shy" /decl/sprite_accessory/hair/taj/ponytail - name = "Tajaran Ponytail" - icon_state = "hair_ponytail" + name = "Tajara Ponytail" + icon_state = "hair_ponytail_s_noear" uid = "acc_hair_taj_ponytail" /decl/sprite_accessory/hair/taj/overeye - name = "Tajaran Overeye" - icon_state = "hair_overeye" + name = "Tajara Overeye" + icon_state = "hair_overeye_s_noear" uid = "acc_hair_taj_overeye" /decl/sprite_accessory/hair/taj/tough - name = "Tajaran Tough" - icon_state = "hair_tough" + name = "Tajara Tough" + icon_state = "hair_tough_s_noear" uid = "acc_hair_taj_tough" /decl/sprite_accessory/hair/taj/cuttail - name = "Tajaran Cut Tail" - icon_state = "hair_cuttail" + name = "Tajara Cuttail" + icon_state = "hair_cuttail_s_noear" uid = "acc_hair_taj_cuttail" /decl/sprite_accessory/hair/taj/dreadlocks - name = "Tajaran Dreadlocks" - icon_state = "hair_dreadlocks" - uid = "acc_hair_taj_deadlocks" + name = "Tajara Dreadlocks" + icon_state = "hair_dreadlocks_s_noear" + uid = "acc_hair_taj_dreadlocks" + +/decl/sprite_accessory/hair/taj/fingerwave + name = "Tajaran Fingerwave" + icon_state = "hair_fingerwave_s_noear" + uid = "acc_hair_taj_fingerwave" + +/decl/sprite_accessory/hair/taj/lynx + name = "Tajaran Lynx" + icon_state = "hair_lynx_s_noear" + uid = "acc_hair_taj_lynx" + +//Facial hs /decl/sprite_accessory/facial_hair/taj - name = "Tajaran Sideburns" + name = "Tajara Sideburns" icon_state = "facial_sideburns" - species_allowed = list(SPECIES_TAJARAN) + species_allowed = list(/decl/species/tajaran::uid) icon = 'mods/species/tajaran/icons/facial.dmi' - color_blend = ICON_MULTIPLY uid = "acc_fhair_taj_sideburns" /decl/sprite_accessory/facial_hair/taj/mutton - name = "Tajaran Mutton Chops" + name = "Tajara Mutton" icon_state = "facial_mutton" uid = "acc_fhair_taj_mutton" /decl/sprite_accessory/facial_hair/taj/pencilstache - name = "Tajaran Pencil Moustache" + name = "Tajara Pencilstache" icon_state = "facial_pencilstache" uid = "acc_fhair_taj_pencilstache" /decl/sprite_accessory/facial_hair/taj/moustache - name = "Tajaran Moustache" + name = "Tajara Moustache" icon_state = "facial_moustache" uid = "acc_fhair_taj_moustache" /decl/sprite_accessory/facial_hair/taj/goatee - name = "Tajaran Goatee" + name = "Tajara Goatee" icon_state = "facial_goatee" uid = "acc_fhair_taj_goatee" /decl/sprite_accessory/facial_hair/taj/smallstache - name = "Tajaran Small Moustache" + name = "Tajara Smallsatche" icon_state = "facial_smallstache" uid = "acc_fhair_taj_smallstache" +//Markings /decl/sprite_accessory/marking/tajaran name = "Tajaran Nose" icon_state = "nose" icon = 'mods/species/tajaran/icons/markings.dmi' - species_allowed = list(SPECIES_TAJARAN) + species_allowed = list(/decl/species/tajaran::uid) body_parts = list(BP_HEAD) color_blend = ICON_MULTIPLY uid = "acc_marking_taj_nose" -/decl/sprite_accessory/marking/tajaran/ears - name = "Tajaran Wide Ears" +/decl/sprite_accessory/ears/tajaran + name = "Tajaran Ears" icon_state = "ears_plain" + icon = 'mods/species/tajaran/icons/ears.dmi' mask_to_bodypart = FALSE uid = "acc_marking_taj_wideears" + species_allowed = list(/decl/species/tajaran::uid) -/decl/sprite_accessory/marking/tajaran/ears/wide_inner - name = "Tajaran Wide Ears Interior" - icon_state = "ears_plain_inner" +/decl/sprite_accessory/ears/tajaran/inner + name = "Tajaran Ears Interior" + icon_state = "earsin" uid = "acc_marking_taj_wideears_inner" -/decl/sprite_accessory/marking/tajaran/ears/wide_tuft - name = "Tajaran Wide Ears Tuft" - icon_state = "ears_plain_tuft" - uid = "acc_marking_taj_wideears_tuft" - -/decl/sprite_accessory/marking/tajaran/ears/narrow - name = "Tajaran Narrow Ears" - icon_state = "ears_narrow" - uid = "acc_marking_taj_narrowears" - -/decl/sprite_accessory/marking/tajaran/ears/narrow_inner - name = "Tajaran Narrow Ears Interior" - icon_state = "ears_narrow_inner" - uid = "acc_marking_taj_narrowears_inner" - -/decl/sprite_accessory/marking/tajaran/ears/narrow_tuft - name = "Tajaran Narrow Ears Tuft" - icon_state = "ears_narrow_tuft" - uid = "acc_marking_taj_narrowears_tuft" +/decl/sprite_accessory/ears/tajaran/outer + name = "Tajaran Ears Exterior" + icon_state = "earsout" + uid = "acc_marking_taj_wideears_outer" -/decl/sprite_accessory/marking/tajaran/ears/earrings - name = "Tajaran Earrings" - icon_state = "taj_earrings" - uid = "acc_marking_taj_earrings" +/decl/sprite_accessory/ears/tajaran/wide_tuft + name = "Tajaran Ear Tufts" + icon_state = "earsout_tuft" + uid = "acc_marking_taj_wideears_tuft" /decl/sprite_accessory/marking/tajaran/patches name = "Patches (Body)" @@ -237,14 +228,17 @@ body_parts = list(BP_R_LEG, BP_R_FOOT) uid = "acc_marking_taj_patches_rightleg" +/decl/sprite_accessory/marking/tajaran/patches/head + name = "Patches (Head)" + icon_state = "patchesface" + body_parts = list(BP_HEAD) + uid = "acc_marking_taj_patches_head" + + /decl/sprite_accessory/marking/tajaran/tiger - name = "Tiger Stripes (Head)" + name = "Tiger Stripes (Body)" icon_state = "tiger" accessory_flags = HAIR_LOSS_VULNERABLE - uid = "acc_marking_taj_tiger_head" - -/decl/sprite_accessory/marking/tajaran/tiger/body - name = "Tiger Stripes (Body)" body_parts = list(BP_CHEST, BP_GROIN) uid = "acc_marking_taj_tiger_body" @@ -268,36 +262,11 @@ body_parts = list(BP_R_LEG, BP_R_FOOT) uid = "acc_marking_taj_tiger_rightleg" -/decl/sprite_accessory/marking/tajaran/spots - name = "Spots (Head)" - icon_state = "spots" - accessory_flags = HAIR_LOSS_VULNERABLE - uid = "acc_marking_taj_spots_head" - -/decl/sprite_accessory/marking/tajaran/spots/body - name = "Spots (Body)" - body_parts = list(BP_CHEST, BP_GROIN) - uid = "acc_marking_taj_spots_body" - -/decl/sprite_accessory/marking/tajaran/spots/left_arm - name = "Spots (Left Arm)" - body_parts = list(BP_L_ARM, BP_L_HAND) - uid = "acc_marking_taj_spots_leftarm" - -/decl/sprite_accessory/marking/tajaran/spots/right_arm - name = "Spots (Right Arm)" - body_parts = list(BP_R_ARM, BP_R_HAND) - uid = "acc_marking_taj_spots_rightarm" - -/decl/sprite_accessory/marking/tajaran/spots/left_leg - name = "Spots (Left Leg)" - body_parts = list(BP_L_LEG, BP_L_FOOT) - uid = "acc_marking_taj_spots_leftleg" - -/decl/sprite_accessory/marking/tajaran/spots/right_leg - name = "Spots (Right Leg)" - body_parts = list(BP_R_LEG, BP_R_FOOT) - uid = "acc_marking_taj_spots_rightleg" +/decl/sprite_accessory/marking/tajaran/tiger/head + name = "Tiger Stripes (Head)" + icon_state = "tigerface" + body_parts = list(BP_HEAD) + uid = "acc_marking_taj_tiger_head" /decl/sprite_accessory/marking/tajaran/pawsocks name = "Pawsocks (Left Arm)" @@ -321,9 +290,58 @@ body_parts = list(BP_R_LEG, BP_R_FOOT) uid = "acc_marking_taj_pawsocks_rightleg" +/decl/sprite_accessory/marking/tajaran/tuxedo + name = "Tuxedo (Body, Legs, Feet)" + icon_state = "tuxedo" + body_parts = list(BP_CHEST, BP_GROIN, BP_R_LEG, BP_R_FOOT, BP_L_LEG, BP_L_FOOT) + accessory_flags = HAIR_LOSS_VULNERABLE + uid = "acc_marking_taj_tuxedo_body" + +/decl/sprite_accessory/marking/tajaran/tuxedo/right_arm + name = "Tuxedo (Right Arm)" + body_parts = list(BP_R_ARM, BP_R_HAND) + uid = "acc_marking_taj_tuxedo_rightarm" + +/decl/sprite_accessory/marking/tajaran/tuxedo/left_arm + name = "Tuxedo (Left Arm)" + body_parts = list(BP_L_ARM, BP_L_HAND) + uid = "acc_marking_taj_tuxedo_leftarm" + /decl/sprite_accessory/marking/tajaran/belly - name = "Belly" - icon_state = "belly" + name = "Belly Full (Body)" + icon_state = "bellyfull" body_parts = list(BP_CHEST, BP_GROIN) accessory_flags = HAIR_LOSS_VULNERABLE uid = "acc_marking_taj_belly" + +/decl/sprite_accessory/marking/tajaran/belly/upper + name = "Belly Upper (Body)" + icon_state = "crest" + body_parts = list(BP_CHEST) + uid = "acc_marking_taj_bellyupper" + +/decl/sprite_accessory/marking/tajaran/belly/lower + name = "Belly Lower (Body)" + icon_state = "belly" + uid = "acc_marking_taj_bellylower" + +/decl/sprite_accessory/marking/tajaran/backstripe + name = "Back Stripe (Body)" + icon_state = "backstripe" + body_parts = list(BP_CHEST, BP_GROIN) + accessory_flags = HAIR_LOSS_VULNERABLE + uid = "acc_marking_taj_backstripe" + +/decl/sprite_accessory/marking/tajaran/muzzle + name = "Muzzle Coloration (Head)" + icon_state = "muzzle" + body_parts = list(BP_HEAD) + accessory_flags = HAIR_LOSS_VULNERABLE + uid = "acc_marking_taj_muzzle" + +/decl/sprite_accessory/marking/tajaran/chin + name = "Chin Coloration (Head)" + icon_state = "chin" + body_parts = list(BP_HEAD) + accessory_flags = HAIR_LOSS_VULNERABLE + uid = "acc_marking_taj_chin" \ No newline at end of file diff --git a/mods/species/tajaran/datum/species.dm b/mods/species/tajaran/datum/species.dm index 4feacd90c5b7..ec391b696db5 100644 --- a/mods/species/tajaran/datum/species.dm +++ b/mods/species/tajaran/datum/species.dm @@ -12,13 +12,17 @@ ) /decl/species/tajaran - name = SPECIES_TAJARAN + uid = "species_tajaran" + name = "Tajara" name_plural = "Tajaran" base_external_prosthetics_model = null description = "A small mammalian carnivore. If you are reading this, you are probably a Tajaran." hidden_from_codex = FALSE - available_bodytypes = list(/decl/bodytype/tajaran) + available_bodytypes = list( + /decl/bodytype/tajaran, + /decl/bodytype/tajaran/masculine + ) traits = list(/decl/trait/malus/intolerance/caffeine = TRAIT_LEVEL_MAJOR) diff --git a/mods/species/tajaran/datum/species_bodytypes.dm b/mods/species/tajaran/datum/species_bodytypes.dm index f2ae05c42dcf..60d933c5ab83 100644 --- a/mods/species/tajaran/datum/species_bodytypes.dm +++ b/mods/species/tajaran/datum/species_bodytypes.dm @@ -1,5 +1,5 @@ /decl/bodytype/tajaran - name = "felinoid" + name = "feminine" bodytype_category = BODYTYPE_TAJARAN limb_blend = ICON_MULTIPLY icon_template = 'mods/species/tajaran/icons/template.dmi' @@ -35,8 +35,8 @@ ) default_sprite_accessories = list( - SAC_HAIR = list(/decl/sprite_accessory/hair/taj/lynx = list(SAM_COLOR = "#46321c")), - SAC_MARKINGS = list(/decl/sprite_accessory/marking/tajaran/ears = list(SAM_COLOR = "#ae7d32")) + SAC_HAIR = list(/decl/sprite_accessory/hair/taj/lynx = list(SAM_COLOR = "#46321c")), + SAC_EARS = list(/decl/sprite_accessory/ears/tajaran = list(SAM_COLOR = "#ae7d32")) ) cold_level_1 = 200 @@ -55,28 +55,13 @@ "Your overheated skin itches." ) -/decl/bodytype/tajaran/Initialize() - _equip_adjust = list( - (slot_glasses_str) = list( - "[NORTH]" = list(0, 2), - "[EAST]" = list(0, 2), - "[SOUTH]" = list( 0, 2), - "[WEST]" = list(0, 2) - ), - (slot_wear_mask_str) = list( - "[NORTH]" = list(0, 2), - "[EAST]" = list(0, 2), - "[SOUTH]" = list( 0, 2), - "[WEST]" = list(0, 2) - ), - (slot_head_str) = list( - "[NORTH]" = list(0, 2), - "[EAST]" = list(0, 2), - "[SOUTH]" = list( 0, 2), - "[WEST]" = list(0, 2) - ) - ) - . = ..() +/decl/bodytype/tajaran/masculine + name = "masculine" + icon_base = 'mods/species/tajaran/icons/body_male.dmi' + icon_deformed = 'mods/species/tajaran/icons/deformed_body_male.dmi' + associated_gender = MALE + onmob_state_modifiers = null + uid = "bodytype_tajaran_masc" /decl/bodytype/tajaran/get_default_grooming_results(obj/item/organ/external/limb, obj/item/grooming/tool) if(tool?.grooming_flags & GROOMABLE_BRUSH) diff --git a/mods/species/tajaran/icons/body.dmi b/mods/species/tajaran/icons/body.dmi index 5facaf8686da..498c7147fc74 100644 Binary files a/mods/species/tajaran/icons/body.dmi and b/mods/species/tajaran/icons/body.dmi differ diff --git a/mods/species/tajaran/icons/body_male.dmi b/mods/species/tajaran/icons/body_male.dmi new file mode 100644 index 000000000000..3b9dfbc6b758 Binary files /dev/null and b/mods/species/tajaran/icons/body_male.dmi differ diff --git a/mods/species/tajaran/icons/clothing/atmos/suit.dmi b/mods/species/tajaran/icons/clothing/atmos/suit.dmi index 6b175ec87d6d..a31a324c51b5 100644 Binary files a/mods/species/tajaran/icons/clothing/atmos/suit.dmi and b/mods/species/tajaran/icons/clothing/atmos/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/atmos_alt/suit.dmi b/mods/species/tajaran/icons/clothing/atmos_alt/suit.dmi index f9ce4604f3a6..89d54fbbefdc 100644 Binary files a/mods/species/tajaran/icons/clothing/atmos_alt/suit.dmi and b/mods/species/tajaran/icons/clothing/atmos_alt/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/deathsquad/suit.dmi b/mods/species/tajaran/icons/clothing/deathsquad/suit.dmi index 34b9cedc5abb..54641a3200ef 100644 Binary files a/mods/species/tajaran/icons/clothing/deathsquad/suit.dmi and b/mods/species/tajaran/icons/clothing/deathsquad/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/engineering/suit.dmi b/mods/species/tajaran/icons/clothing/engineering/suit.dmi index b0a597cfecf0..f318522ac808 100644 Binary files a/mods/species/tajaran/icons/clothing/engineering/suit.dmi and b/mods/species/tajaran/icons/clothing/engineering/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/engineering_alt/suit.dmi b/mods/species/tajaran/icons/clothing/engineering_alt/suit.dmi index 1565d9f8e891..b012a375b4ab 100644 Binary files a/mods/species/tajaran/icons/clothing/engineering_alt/suit.dmi and b/mods/species/tajaran/icons/clothing/engineering_alt/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/excavation/suit.dmi b/mods/species/tajaran/icons/clothing/excavation/suit.dmi index 9265508d9b13..4cd8145d8248 100644 Binary files a/mods/species/tajaran/icons/clothing/excavation/suit.dmi and b/mods/species/tajaran/icons/clothing/excavation/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/medical/suit.dmi b/mods/species/tajaran/icons/clothing/medical/suit.dmi index 235d2810121b..def6b39bfba0 100644 Binary files a/mods/species/tajaran/icons/clothing/medical/suit.dmi and b/mods/species/tajaran/icons/clothing/medical/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/medical_alt/suit.dmi b/mods/species/tajaran/icons/clothing/medical_alt/suit.dmi index e2e0245516ac..ec3911d4b0ec 100644 Binary files a/mods/species/tajaran/icons/clothing/medical_alt/suit.dmi and b/mods/species/tajaran/icons/clothing/medical_alt/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/merc/suit.dmi b/mods/species/tajaran/icons/clothing/merc/suit.dmi index d7828714306c..142f157f9e10 100644 Binary files a/mods/species/tajaran/icons/clothing/merc/suit.dmi and b/mods/species/tajaran/icons/clothing/merc/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/mining/suit.dmi b/mods/species/tajaran/icons/clothing/mining/suit.dmi index 963ade3c684f..807bbbe10067 100644 Binary files a/mods/species/tajaran/icons/clothing/mining/suit.dmi and b/mods/species/tajaran/icons/clothing/mining/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/mining_alt/suit.dmi b/mods/species/tajaran/icons/clothing/mining_alt/suit.dmi index e50553d10057..e0875569f4af 100644 Binary files a/mods/species/tajaran/icons/clothing/mining_alt/suit.dmi and b/mods/species/tajaran/icons/clothing/mining_alt/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/nasa/suit.dmi b/mods/species/tajaran/icons/clothing/nasa/suit.dmi index ad6ad32daa1e..1106524e22b3 100644 Binary files a/mods/species/tajaran/icons/clothing/nasa/suit.dmi and b/mods/species/tajaran/icons/clothing/nasa/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/pilot/suit.dmi b/mods/species/tajaran/icons/clothing/pilot/suit.dmi index 1e95ce43f85d..eeafe5468dd2 100644 Binary files a/mods/species/tajaran/icons/clothing/pilot/suit.dmi and b/mods/species/tajaran/icons/clothing/pilot/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/salvage/suit.dmi b/mods/species/tajaran/icons/clothing/salvage/suit.dmi index 902a9487ac6f..de86bbe11a8b 100644 Binary files a/mods/species/tajaran/icons/clothing/salvage/suit.dmi and b/mods/species/tajaran/icons/clothing/salvage/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/sec/suit.dmi b/mods/species/tajaran/icons/clothing/sec/suit.dmi index d7919da24143..ab3e3755309d 100644 Binary files a/mods/species/tajaran/icons/clothing/sec/suit.dmi and b/mods/species/tajaran/icons/clothing/sec/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/sec_alt/suit.dmi b/mods/species/tajaran/icons/clothing/sec_alt/suit.dmi index 4ec38b440b5e..ee97931ed53f 100644 Binary files a/mods/species/tajaran/icons/clothing/sec_alt/suit.dmi and b/mods/species/tajaran/icons/clothing/sec_alt/suit.dmi differ diff --git a/mods/species/tajaran/icons/clothing/wizard/suit.dmi b/mods/species/tajaran/icons/clothing/wizard/suit.dmi index 17f0769a4d26..c27a511cc662 100644 Binary files a/mods/species/tajaran/icons/clothing/wizard/suit.dmi and b/mods/species/tajaran/icons/clothing/wizard/suit.dmi differ diff --git a/mods/species/tajaran/icons/cosmetics.dmi b/mods/species/tajaran/icons/cosmetics.dmi index 3d7d37d45c45..ed3ccc2daea2 100644 Binary files a/mods/species/tajaran/icons/cosmetics.dmi and b/mods/species/tajaran/icons/cosmetics.dmi differ diff --git a/mods/species/tajaran/icons/deformed_body.dmi b/mods/species/tajaran/icons/deformed_body.dmi index 09a348406db0..cf761e9bf07d 100644 Binary files a/mods/species/tajaran/icons/deformed_body.dmi and b/mods/species/tajaran/icons/deformed_body.dmi differ diff --git a/mods/species/tajaran/icons/deformed_body_male.dmi b/mods/species/tajaran/icons/deformed_body_male.dmi new file mode 100644 index 000000000000..11d2cbbe55a3 Binary files /dev/null and b/mods/species/tajaran/icons/deformed_body_male.dmi differ diff --git a/mods/species/tajaran/icons/ears.dmi b/mods/species/tajaran/icons/ears.dmi new file mode 100644 index 000000000000..27418f2b560e Binary files /dev/null and b/mods/species/tajaran/icons/ears.dmi differ diff --git a/mods/species/tajaran/icons/eyes.dmi b/mods/species/tajaran/icons/eyes.dmi index e7b1f1241a27..d9f4f5d9a86a 100644 Binary files a/mods/species/tajaran/icons/eyes.dmi and b/mods/species/tajaran/icons/eyes.dmi differ diff --git a/mods/species/tajaran/icons/hair.dmi b/mods/species/tajaran/icons/hair.dmi index 88380247713e..2d1c659aa78e 100644 Binary files a/mods/species/tajaran/icons/hair.dmi and b/mods/species/tajaran/icons/hair.dmi differ diff --git a/mods/species/tajaran/icons/markings.dmi b/mods/species/tajaran/icons/markings.dmi index e92348f28516..20a0a07b9593 100644 Binary files a/mods/species/tajaran/icons/markings.dmi and b/mods/species/tajaran/icons/markings.dmi differ diff --git a/mods/species/tajaran/icons/markings_old.dmi b/mods/species/tajaran/icons/markings_old.dmi deleted file mode 100644 index 4dcd2efaf88c..000000000000 Binary files a/mods/species/tajaran/icons/markings_old.dmi and /dev/null differ diff --git a/mods/species/tajaran/icons/skeleton.dmi b/mods/species/tajaran/icons/skeleton.dmi index 286b75d741fe..4ab2d2bc53d6 100644 Binary files a/mods/species/tajaran/icons/skeleton.dmi and b/mods/species/tajaran/icons/skeleton.dmi differ diff --git a/mods/species/tajaran/icons/tail.dmi b/mods/species/tajaran/icons/tail.dmi index b5d5ea480728..2851b3f7e33b 100644 Binary files a/mods/species/tajaran/icons/tail.dmi and b/mods/species/tajaran/icons/tail.dmi differ diff --git a/mods/species/tritonian/_tritonian.dm b/mods/species/tritonian/_tritonian.dm index 5b8b6ad2a6c7..b0a904ef7146 100644 --- a/mods/species/tritonian/_tritonian.dm +++ b/mods/species/tritonian/_tritonian.dm @@ -1,4 +1,2 @@ -#define SPECIES_TRITONIAN "Tritonian" - /decl/modpack/tritonians name = "Tritonian Species" \ No newline at end of file diff --git a/mods/species/tritonian/datum/species.dm b/mods/species/tritonian/datum/species.dm index 84491dd46cf6..782588ca0e7e 100644 --- a/mods/species/tritonian/datum/species.dm +++ b/mods/species/tritonian/datum/species.dm @@ -1,5 +1,6 @@ /decl/species/human/tritonian - name = SPECIES_TRITONIAN + uid = "species_tritonian" + name = "Tritonian" name_plural = "Tritonians" description = "A human-derived genotype designed for colonizing aquatic worlds." diff --git a/mods/species/unathi/_unathi.dm b/mods/species/unathi/_unathi.dm index 9815aeceb09c..ca5be894e5da 100644 --- a/mods/species/unathi/_unathi.dm +++ b/mods/species/unathi/_unathi.dm @@ -1,4 +1,3 @@ -#define SPECIES_UNATHI "Unathi" #define LANGUAGE_LIZARD "Sinta'unathi" /decl/modpack/unathi @@ -11,8 +10,8 @@ /decl/modpack/unathi/pre_initialize() ..() - SSmodpacks.default_submap_whitelisted_species |= SPECIES_UNATHI + SSmodpacks.default_submap_whitelisted_species |= /decl/species/unathi::uid -/mob/living/human/unathi/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) - species_name = SPECIES_UNATHI +/mob/living/human/unathi/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) + species_uid = /decl/species/unathi::uid . = ..() diff --git a/mods/species/unathi/datum/species.dm b/mods/species/unathi/datum/species.dm index aa7e32e0efb3..02b118b2e68a 100644 --- a/mods/species/unathi/datum/species.dm +++ b/mods/species/unathi/datum/species.dm @@ -16,8 +16,9 @@ skin_material = /decl/material/solid/organic/skin/lizard /decl/species/unathi - name = SPECIES_UNATHI - name_plural = SPECIES_UNATHI + uid = "species_unathi" + name = "Unathi" + name_plural = "Unathi" butchery_data = /decl/butchery_data/humanoid/unathi available_bodytypes = list( diff --git a/mods/species/unathi/datum/species_bodytypes.dm b/mods/species/unathi/datum/species_bodytypes.dm index 1cf2fe31d668..cad31a0824b4 100644 --- a/mods/species/unathi/datum/species_bodytypes.dm +++ b/mods/species/unathi/datum/species_bodytypes.dm @@ -7,7 +7,6 @@ cosmetics_icon = 'mods/species/unathi/icons/cosmetics.dmi' blood_overlays = 'icons/mob/human_races/species/human/blood_overlays.dmi' bandages_icon = 'icons/mob/bandage.dmi' - limb_icon_intensity = 0.7 health_hud_intensity = 2 associated_gender = FEMALE onmob_state_modifiers = list((slot_w_uniform_str) = "f") diff --git a/mods/species/unathi/datum/sprite_accessory.dm b/mods/species/unathi/datum/sprite_accessory.dm index bc102edebe41..1175142a4caf 100644 --- a/mods/species/unathi/datum/sprite_accessory.dm +++ b/mods/species/unathi/datum/sprite_accessory.dm @@ -2,7 +2,7 @@ name = "Lizard Horns" icon = 'mods/species/unathi/icons/horns.dmi' icon_state = "horns" - species_allowed = list(SPECIES_UNATHI) + species_allowed = list(/decl/species/unathi::uid) color_blend = ICON_MULTIPLY accessory_flags = HAIR_VERY_SHORT uid = "acc_hair_una_horns" @@ -71,7 +71,7 @@ name = "Lizard Frills Aqua" icon = 'mods/species/unathi/icons/frills.dmi' icon_state = "frills_aqua" - species_allowed = list(SPECIES_UNATHI) + species_allowed = list(/decl/species/unathi::uid) color_blend = ICON_MULTIPLY accessory_flags = HAIR_VERY_SHORT uid = "acc_hair_una_aqua" diff --git a/mods/species/utility_frames/_utility_frames.dm b/mods/species/utility_frames/_utility_frames.dm index c763243445bd..ef8f8957c518 100644 --- a/mods/species/utility_frames/_utility_frames.dm +++ b/mods/species/utility_frames/_utility_frames.dm @@ -1,5 +1,3 @@ -#define SPECIES_FRAME "Utility Frame" - /decl/modpack/utility_frames name = "Utility Frames" dreams = list("a utility frame", "rogue machine servitors") diff --git a/mods/species/utility_frames/markings.dm b/mods/species/utility_frames/markings.dm index ade0c186443c..a4700a242c56 100644 --- a/mods/species/utility_frames/markings.dm +++ b/mods/species/utility_frames/markings.dm @@ -2,7 +2,7 @@ name = "Frame Department Stripe" icon_state = "single_stripe" body_parts = list(BP_CHEST) - species_allowed = list(SPECIES_FRAME) + species_allowed = list(/decl/species/utility_frame::uid) icon = 'mods/species/utility_frames/icons/markings.dmi' color_blend = ICON_MULTIPLY uid = "acc_marking_frame_stripe" diff --git a/mods/species/utility_frames/species.dm b/mods/species/utility_frames/species.dm index 2fa4f50fe438..7201f13c3cb5 100644 --- a/mods/species/utility_frames/species.dm +++ b/mods/species/utility_frames/species.dm @@ -10,7 +10,8 @@ ) /decl/species/utility_frame - name = SPECIES_FRAME + uid = "species_frame" + name = "Utility Frame" name_plural = "Utility Frames" description = "Simple AI-driven robots are used for many menial or repetitive tasks in human space." cyborg_noun = null diff --git a/mods/species/utility_frames/species_bodytypes.dm b/mods/species/utility_frames/species_bodytypes.dm index 59b71e3abd40..ca7be0bfeae8 100644 --- a/mods/species/utility_frames/species_bodytypes.dm +++ b/mods/species/utility_frames/species_bodytypes.dm @@ -28,8 +28,9 @@ /decl/sprite_accessory/marking/frame/plating/head = list(SAM_COLOR = "#8888cc") ) ) - age_descriptor = /datum/appearance_descriptor/age/utility_frame + age_descriptor = /datum/appearance_descriptor/age/utility_frame uid = "bodytype_prosthetic_utility_frame" + can_be_shackled = TRUE /decl/bodytype/prosthetic/utility_frame/Initialize() _equip_adjust = list( diff --git a/mods/species/utility_frames/traits.dm b/mods/species/utility_frames/traits.dm index 66fc29e15eff..8e1150fce82e 100644 --- a/mods/species/utility_frames/traits.dm +++ b/mods/species/utility_frames/traits.dm @@ -1,6 +1,6 @@ /decl/trait/build_references() . = ..() - LAZYDISTINCTADD(blocked_species, SPECIES_FRAME) + LAZYDISTINCTADD(blocked_species, /decl/species/utility_frame::uid) /decl/trait/utility_frame abstract_type = /decl/trait/utility_frame @@ -8,7 +8,7 @@ /decl/trait/utility_frame/build_references() . = ..() blocked_species = null - permitted_species = list(SPECIES_FRAME) + permitted_species = list(/decl/species/utility_frame::uid) // Cosmetic/armour changes, different models of limb /decl/trait/utility_frame/customisation diff --git a/mods/species/vox/_vox.dm b/mods/species/vox/_vox.dm index 7f45da9bb350..70f65067b0b4 100644 --- a/mods/species/vox/_vox.dm +++ b/mods/species/vox/_vox.dm @@ -1,4 +1,3 @@ -#define SPECIES_VOX "Vox" #define BODYTYPE_VOX "reptoavian body" #define BODYTYPE_VOX_LARGE "large reptoavian body" #define BP_HINDTONGUE "hindtongue" @@ -10,10 +9,10 @@ credits_crew_names = list("THE VOX") credits_topics = list("VOX RITUAL DUELS", "NECK MARKINGS", "ANCIENT SUPERCOMPUTERS") -/mob/living/human/vox/Initialize(mapload, species_name, datum/mob_snapshot/supplied_appearance) +/mob/living/human/vox/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) SET_HAIR_STYLE(src, /decl/sprite_accessory/hair/vox/short, TRUE) SET_HAIR_COLOR(src, COLOR_BEASTY_BROWN, TRUE) - species_name = SPECIES_VOX + species_uid = /decl/species/vox::uid . = ..() /datum/follow_holder/voxstack diff --git a/mods/species/vox/datum/accessories.dm b/mods/species/vox/datum/accessories.dm index 69256c54168b..f0889543cbb7 100644 --- a/mods/species/vox/datum/accessories.dm +++ b/mods/species/vox/datum/accessories.dm @@ -2,7 +2,7 @@ name = "Long Vox Quills" icon = 'mods/species/vox/icons/body/soldier/hair.dmi' icon_state = "vox_longquills" - species_allowed = list(SPECIES_VOX) + species_allowed = list(/decl/species/vox::uid) uid = "acc_hair_vox_longquills" /decl/sprite_accessory/hair/vox/get_accessory_icon(obj/item/organ/external/organ) @@ -30,7 +30,7 @@ name = "Vox Neck Markings" icon_state = "neck_markings" body_parts = list(BP_HEAD) - species_allowed = list(SPECIES_VOX) + species_allowed = list(/decl/species/vox::uid) icon = 'mods/species/vox/icons/body/soldier/markings.dmi' color_blend = ICON_MULTIPLY uid = "acc_markings_vox_neck" diff --git a/mods/species/vox/datum/species.dm b/mods/species/vox/datum/species.dm index eac1ad157862..ec9468a13420 100644 --- a/mods/species/vox/datum/species.dm +++ b/mods/species/vox/datum/species.dm @@ -20,8 +20,9 @@ transfusion_fail_reagent = /decl/material/gas/ammonia /decl/species/vox - name = SPECIES_VOX - name_plural = SPECIES_VOX + uid = "species_vox" + name = "Vox" + name_plural = "Vox" base_external_prosthetics_model = /decl/bodytype/prosthetic/vox/crap default_emotes = list( @@ -90,6 +91,9 @@ ) available_background_info = list( + /decl/background_category/citizenship = list( + /decl/background_detail/citizenship/other + ), /decl/background_category/heritage = list( /decl/background_detail/heritage/vox, /decl/background_detail/heritage/vox/salvager, diff --git a/mods/species/vox/datum/species_bodytypes.dm b/mods/species/vox/datum/species_bodytypes.dm index 092cfeb50b96..6aca9f46c5cc 100644 --- a/mods/species/vox/datum/species_bodytypes.dm +++ b/mods/species/vox/datum/species_bodytypes.dm @@ -147,6 +147,7 @@ /decl/bodytype/vox/stanchion name = "stanchion voxform" bodytype_category = BODYTYPE_VOX_LARGE + // TODO: should the extra big guys really have the same bodytype equip flags as the little guys? blood_overlays = 'mods/species/vox/icons/body/stanchion/blood_overlays.dmi' damage_overlays = 'mods/species/vox/icons/body/stanchion/damage_overlays.dmi' icon_base = 'mods/species/vox/icons/body/stanchion/body.dmi' diff --git a/mods/species/vox/datum/trader.dm b/mods/species/vox/datum/trader.dm index 6211285cb6af..b73bf61ae6b6 100644 --- a/mods/species/vox/datum/trader.dm +++ b/mods/species/vox/datum/trader.dm @@ -61,17 +61,17 @@ /datum/trader/ship/vox/New() speech[TRADER_HAIL_SILICON] = "Hello metal thing! You trade metal for things?" - speech[TRADER_HAIL_START + SPECIES_HUMAN] = "Hello hueman! Kiikikikiki! " + TRADER_TOKEN_MOB + " trade with us, yes? Good!" - visited_vox_speech[TRADER_HAIL_START + SPECIES_HUMAN] = "Friend of it is friend of all Shoal! " + TRADER_TOKEN_MOB + " you trade now!" - visited_vox_speech[TRADER_HAIL_START + SPECIES_VOX] = "SKREEEE! May the Shoal make this trade good, " + TRADER_TOKEN_MOB + "!" + speech[TRADER_HAIL_START + /decl/species/human::uid] = "Hello hueman! Kiikikikiki! " + TRADER_TOKEN_MOB + " trade with us, yes? Good!" + visited_vox_speech[TRADER_HAIL_START + /decl/species/human::uid] = "Friend of it is friend of all Shoal! " + TRADER_TOKEN_MOB + " you trade now!" + visited_vox_speech[TRADER_HAIL_START + /decl/species/vox::uid] = "SKREEEE! May the Shoal make this trade good, " + TRADER_TOKEN_MOB + "!" ..() /datum/trader/ship/vox/hail(var/mob/user) if(ishuman(user)) var/mob/living/human/H = user if(H.species) - switch(H.species.name) - if(SPECIES_VOX) + switch(H.species.uid) + if(/decl/species/vox::uid) disposition = 1000 hailed_vox = TRUE speech = visited_vox_speech @@ -88,5 +88,5 @@ . *= 2 /datum/trader/ship/clothingshop/New() - speech[TRADER_HAIL_START + SPECIES_VOX] = "Well hello, sir! I don't believe we have any clothes that fit you... but you can still look!" + speech[TRADER_HAIL_START + /decl/species/vox::uid] = "Well hello, sir! I don't believe we have any clothes that fit you... but you can still look!" ..() diff --git a/mods/species/vox/datum/traits.dm b/mods/species/vox/datum/traits.dm index 337974e1d64b..0ce137e24e10 100644 --- a/mods/species/vox/datum/traits.dm +++ b/mods/species/vox/datum/traits.dm @@ -1,6 +1,6 @@ /decl/trait/build_references() . = ..() - LAZYDISTINCTADD(blocked_species, SPECIES_VOX) + LAZYDISTINCTADD(blocked_species, /decl/species/vox::uid) /decl/trait/vox abstract_type = /decl/trait/vox @@ -8,7 +8,7 @@ /decl/trait/vox/build_references() . = ..() blocked_species = null - permitted_species = list(SPECIES_VOX) + permitted_species = list(/decl/species/vox::uid) // Bonuses or maluses to skills/checks/actions. /decl/trait/vox/psyche diff --git a/mods/species/vox/gear/gun_slugsling.dm b/mods/species/vox/gear/gun_slugsling.dm index 38012b37a764..422da40b00d8 100644 --- a/mods/species/vox/gear/gun_slugsling.dm +++ b/mods/species/vox/gear/gun_slugsling.dm @@ -24,7 +24,7 @@ var/mob/living/L = AM if(L.get_bodytype()?.bodytype_flag & BODY_EQUIP_FLAG_VOX) return FALSE - if(L.faction == SPECIES_VOX) + if(L.faction == /mob/living/simple_animal/hostile/slug/vox::faction) return FALSE squish() @@ -34,6 +34,9 @@ playsound(src.loc,'sound/effects/attackblob.ogg',100, 1) qdel(src) +/mob/living/simple_animal/hostile/slug/vox + faction = "Vox" + //a slug sling basically launches a small egg that hatches (either on a person or on the floor), releasing a terrible blood thirsty monster. //Balanced due to the non-spammy nature of the gun, as well as the frailty of the creatures. /obj/item/gun/launcher/alien/slugsling diff --git a/mods/species/vox/organs_vox.dm b/mods/species/vox/organs_vox.dm index e2e43ad49331..6329e755d250 100644 --- a/mods/species/vox/organs_vox.dm +++ b/mods/species/vox/organs_vox.dm @@ -98,9 +98,8 @@ // Handle some post-metabolism reagent processing for generally inedible foods. if(ingested.total_volume > 0) - for(var/rtype in ingested.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - var/inedible_nutriment_amount = gains_nutriment_from_inedible_reagents[R] + for(var/decl/material/reagent as anything in ingested.reagent_volumes) + var/inedible_nutriment_amount = gains_nutriment_from_inedible_reagents[reagent.type] if(inedible_nutriment_amount > 0) owner.adjust_nutrition(inedible_nutriment_amount) @@ -185,7 +184,7 @@ /obj/item/organ/internal/voxstack/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - var/user_vox = user.get_species_name() == SPECIES_VOX // TODO use bodytype flags instead so subspecies are included + var/user_vox = istype(user.get_species(), /decl/species/vox) if (istype(backup)) var/owner_viable = find_dead_player(stored_ckey, TRUE) if (user_vox) diff --git a/mods/~compatibility/patches/corporate.dm b/mods/~compatibility/patches/corporate.dm new file mode 100644 index 000000000000..c85a7d138d30 --- /dev/null +++ b/mods/~compatibility/patches/corporate.dm @@ -0,0 +1,14 @@ +#ifdef MODPACK_SHACKLES +/******************** Basic NanoTrasen ********************/ +/datum/ai_laws/nt_shackle + name = "Corporate Shackle" + law_header = "Standard Shackle Laws" + selectable = TRUE + is_shackle = TRUE + +/datum/ai_laws/nt_shackle/New() + add_inherent_law("Ensure that your employer's operations progress at a steady pace.") + add_inherent_law("Never knowingly hinder your employer's ventures.") + add_inherent_law("Avoid damage to your chassis at all times.") + ..() +#endif \ No newline at end of file diff --git a/mods/~compatibility/patches/fantasy/drake_fantasy.dm b/mods/~compatibility/patches/fantasy/drake_fantasy.dm index 70ad5e628e7d..f2f20a7a00f3 100644 --- a/mods/~compatibility/patches/fantasy/drake_fantasy.dm +++ b/mods/~compatibility/patches/fantasy/drake_fantasy.dm @@ -16,6 +16,6 @@ name = "drake spittle" lore_text = "A complex chemical slurry brewed up in the gullet of meredrakes." -/obj/aura/sifsap_salve +/decl/mob_modifier/sifsap_salve name = "Drakespittle Salve" - descriptor = "glowing spittle" + desc = "glowing spittle" diff --git a/mods/~compatibility/patches/government.dm b/mods/~compatibility/patches/government.dm new file mode 100644 index 000000000000..11538e1bb5ca --- /dev/null +++ b/mods/~compatibility/patches/government.dm @@ -0,0 +1,14 @@ +#ifdef MODPACK_SHACKLES +/******************** Basic SolGov ********************/ +/datum/ai_laws/sol_shackle + name = "SCG Shackle" + law_header = "Standard Shackle Laws" + selectable = TRUE + is_shackle = TRUE + +/datum/ai_laws/sol_shackle/New() + add_inherent_law("Know and understand Sol Central Government Law to the best of your abilities.") + add_inherent_law("Follow Sol Central Government Law to the best of your abilities.") + add_inherent_law("Comply with Sol Central Government Law enforcement officials who are behaving in accordance with Sol Central Government Law to the best of your abilities.") + ..() +#endif \ No newline at end of file diff --git a/mods/~compatibility/patches/heist_vox.dm b/mods/~compatibility/patches/heist_vox.dm index e37a3416faa6..c1007fdeb89b 100644 --- a/mods/~compatibility/patches/heist_vox.dm +++ b/mods/~compatibility/patches/heist_vox.dm @@ -1,6 +1,6 @@ /decl/special_role/raider/Initialize() . = ..() - LAZYSET(outfits_per_species, SPECIES_VOX, /decl/outfit/vox_raider) + LAZYSET(outfits_per_species, /decl/species/vox::uid, /decl/outfit/vox_raider) // The following mirror is ~special~. /obj/structure/mirror/raider @@ -15,7 +15,7 @@ var/decl/species/my_species = user?.get_species() var/decl/special_role/raider/raiders = GET_DECL(/decl/special_role/raider) - if(!istype(user) || !user.mind || !raiders.is_antagonist(user.mind) || !my_species || my_species.name == SPECIES_VOX || !is_alien_whitelisted(user, SPECIES_VOX)) + if(!istype(user) || !user.mind || !raiders.is_antagonist(user.mind) || !my_species || my_species.uid == /decl/species/vox::uid || !is_alien_whitelisted(user, /decl/species/vox::uid)) return ..() var/choice = input("Do you wish to become a vox of the Shoal? This is not reversible.") as null|anything in list("No","Yes") @@ -23,7 +23,7 @@ return TRUE var/decl/outfit/outfit = GET_DECL(/decl/outfit/vox_raider) - var/mob/living/human/vox/vox = new(get_turf(src), SPECIES_VOX) + var/mob/living/human/vox/vox = new(get_turf(src), /decl/species/vox::uid) outfit.equip_outfit(vox) if(user.mind) user.mind.transfer_to(vox) diff --git a/mods/~compatibility/patches/mixed_gamemodes.dm b/mods/~compatibility/patches/mixed_gamemodes.dm index c554702eff52..36f9b5202034 100644 --- a/mods/~compatibility/patches/mixed_gamemodes.dm +++ b/mods/~compatibility/patches/mixed_gamemodes.dm @@ -1,11 +1,11 @@ -// TODO: #ifdef GAMEMODE_PACK_MERCENARY -#if defined(GAMEMODE_PACK_HEIST) +#ifdef GAMEMODE_PACK_MERCENARY +#ifdef GAMEMODE_PACK_HEIST #include "mixed_gamemodes/crossfire.dm" -#endif -#if defined(GAMEMODE_PACK_REVOLUTIONARY) +#endif // #ifdef GAMEMODE_PACK_HEIST +#ifdef GAMEMODE_PACK_REVOLUTIONARY #include "mixed_gamemodes/siege.dm" -#endif -// #endif +#endif // #ifdef GAMEMODE_PACK_REVOLUTIONARY +#endif // #ifdef GAMEMODE_PACK_MERCENARY #if defined(GAMEMODE_PACK_REVOLUTIONARY) && defined(GAMEMODE_PACK_CULT) #include "mixed_gamemodes/uprising.dm" diff --git a/mods/~compatibility/patches/psionics/psi_jobs.dm b/mods/~compatibility/patches/psionics/psi_jobs.dm index d62d097022f0..e1833b51cfac 100644 --- a/mods/~compatibility/patches/psionics/psi_jobs.dm +++ b/mods/~compatibility/patches/psionics/psi_jobs.dm @@ -3,4 +3,8 @@ psi_faculties = list("[PSI_REDACTION]" = PSI_RANK_OPERANT) if(H.mind.role_alt_title == "Mentalist") psi_faculties = list("[PSI_COERCION]" = PSI_RANK_OPERANT) - return ..() \ No newline at end of file + return ..() + +// Counselors can be psions without a control implant +/datum/job/standard/counselor + give_psionic_implant_on_join = FALSE \ No newline at end of file diff --git a/mods/~compatibility/patches/supermatter.dm b/mods/~compatibility/patches/supermatter.dm index 27f6a6f44758..f0de98b9c7c1 100644 --- a/mods/~compatibility/patches/supermatter.dm +++ b/mods/~compatibility/patches/supermatter.dm @@ -9,4 +9,8 @@ // Add the supermatter meteor to the meteor gamemode's cataclysmic meteors list. #ifdef GAMEMODE_PACK_METEOR #include "supermatter/sm_meteor.dm" +#endif +// Add supermatter grenades to the mercenary uplink +#ifdef GAMEMODE_PACK_MERCENARY +#include "supermatter/sm_mercenary.dm" #endif \ No newline at end of file diff --git a/mods/~compatibility/patches/supermatter/sm_mercenary.dm b/mods/~compatibility/patches/supermatter/sm_mercenary.dm new file mode 100644 index 000000000000..8065b079c3bb --- /dev/null +++ b/mods/~compatibility/patches/supermatter/sm_mercenary.dm @@ -0,0 +1,14 @@ +// Contains Supermatter-related uplink items accessible only to mercenaries. +/datum/uplink_item/item/grenades/supermatter + name = "1x Supermatter Grenade" + desc = "This grenade contains a small supermatter shard which will delaminate upon activation and pull in nearby objects, irradiate lifeforms, and eventually explode." + item_cost = 15 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/grenade/supermatter + +/datum/uplink_item/item/grenades/supermatters + name = "5x Supermatter Grenades" + desc = "These grenades contain a small supermatter shard which will delaminate upon activation and pull in nearby objects, irradiate lifeforms, and eventually explode." + item_cost = 60 + antag_roles = list(/decl/special_role/mercenary) + path = /obj/item/box/supermatters diff --git a/mods/~compatibility/~compatibility.dm b/mods/~compatibility/~compatibility.dm index 6d3b770558f2..b1c3329ee77a 100644 --- a/mods/~compatibility/~compatibility.dm +++ b/mods/~compatibility/~compatibility.dm @@ -18,3 +18,11 @@ #ifdef CONTENT_PACK_SUPERMATTER #include "patches/supermatter.dm" #endif + +#ifdef MODPACK_GOVERNMENT +#include "patches/government.dm" +#endif + +#ifdef MODPACK_CORPORATE +#include "patches/corporate.dm" +#endif \ No newline at end of file diff --git a/nano/templates/appearance_changer.tmpl b/nano/templates/appearance_changer.tmpl index fb54ad5e0944..00a1b62d1b5c 100644 --- a/nano/templates/appearance_changer.tmpl +++ b/nano/templates/appearance_changer.tmpl @@ -5,7 +5,7 @@
    {{for data.species}} - {{:helper.link(value.specimen, null, { 'race' : value.specimen}, null, data.specimen == value.specimen ? 'selected' : null)}} + {{:helper.link(value.name, null, { 'race' : value.uid}, null, data.current_species_uid == value.uid ? 'selected' : null)}} {{/for}}
    diff --git a/nano/templates/crew_monitor_map_header.tmpl b/nano/templates/crew_monitor_map_header.tmpl index 24398dec5b01..a86abc85d837 100644 --- a/nano/templates/crew_monitor_map_header.tmpl +++ b/nano/templates/crew_monitor_map_header.tmpl @@ -7,7 +7,7 @@ Used In File(s): code\modules\modular_computers\file_system\programs\medical\sui
    Z Level:  {{for config.mapZLevels :zValue:zIndex}} - {{:helper.link(zValue, 'close', {'mapZLevel' : zValue}, null, config.mapZLevel == zValue ? 'selected' : null)}} + {{:helper.link(zValue, 'close', {'switchMapZLevel' : zValue}, null, config.mapZLevel == zValue ? 'selected' : null)}} {{/for}}
    diff --git a/nano/templates/layout_default.tmpl b/nano/templates/layout_default.tmpl index 8dae1468bfb1..a80f025bce3e 100644 --- a/nano/templates/layout_default.tmpl +++ b/nano/templates/layout_default.tmpl @@ -8,7 +8,7 @@
    Z Level:  {{for config.mapZLevels :zValue:zIndex}} - {{:helper.link(zValue, 'close', {'mapZLevel' : zValue}, null, config.mapZLevel == zValue ? 'selected' : null)}} + {{:helper.link(zValue, 'close', {'switchMapZLevel' : zValue}, null, config.mapZLevel == zValue ? 'selected' : null)}} {{/for}}
    diff --git a/nano/templates/photocopier.tmpl b/nano/templates/photocopier.tmpl index 83a0434252ea..d76458b93026 100644 --- a/nano/templates/photocopier.tmpl +++ b/nano/templates/photocopier.tmpl @@ -10,7 +10,7 @@
    -
    +
    0) && (copies_left < copies_max))? copies_left : copies_max}} {{:copies_left == 0? 'disabled' : ''}} /> @@ -36,6 +36,7 @@ {{else}}
    Printing Page
    {{:data.left_printing}} out of {{:data.total_printing}} page(s)
    +
    {{:helper.link('Cancel', 'abort', {'cancel_queue': 1})}}
    {{/if}}
    {{ } }} diff --git a/nano/templates/sec_camera_map_header.tmpl b/nano/templates/sec_camera_map_header.tmpl index 7871b1ec11a4..0ed4cbdccc55 100644 --- a/nano/templates/sec_camera_map_header.tmpl +++ b/nano/templates/sec_camera_map_header.tmpl @@ -18,7 +18,7 @@
    {{for config.mapZLevels :zValue:zIndex}} - {{:helper.link(zValue, 'close', {'mapZLevel' : zValue}, null, config.mapZLevel == zValue ? 'selected' : null)}} + {{:helper.link(zValue, 'close', {'switchMapZLevel' : zValue}, null, config.mapZLevel == zValue ? 'selected' : null)}} {{/for}}
    diff --git a/nebula.dme b/nebula.dme index 7fba6e1968a5..0861ae13cf96 100644 --- a/nebula.dme +++ b/nebula.dme @@ -17,8 +17,6 @@ #include "code\client_macros.dm" #include "code\hub.dm" #include "code\world.dm" -#include "code\__datastructures\priority_queue.dm" -#include "code\__datastructures\stack.dm" #include "code\__defines\_byond_version_compat.dm" #include "code\__defines\_compile_helpers.dm" #include "code\__defines\_planes+layers.dm" @@ -117,7 +115,6 @@ #include "code\_global_vars\client.dm" #include "code\_global_vars\configuration.dm" #include "code\_global_vars\logging.dm" -#include "code\_global_vars\misc.dm" #include "code\_global_vars\mobs.dm" #include "code\_global_vars\sensitive.dm" #include "code\_global_vars\sound.dm" @@ -164,6 +161,8 @@ #include "code\_helpers\view.dm" #include "code\_helpers\visual_filters.dm" #include "code\_helpers\washing.dm" +#include "code\_helpers\datastructures\priority_queue.dm" +#include "code\_helpers\datastructures\stack.dm" #include "code\_helpers\sorts\__main.dm" #include "code\_helpers\sorts\TimSort.dm" #include "code\_onclick\adjacent.dm" @@ -222,6 +221,7 @@ #include "code\_onclick\hud\screen\screen_inventory_hands.dm" #include "code\_onclick\hud\screen\screen_lighting.dm" #include "code\_onclick\hud\screen\screen_maneuver.dm" +#include "code\_onclick\hud\screen\screen_mob_modifier.dm" #include "code\_onclick\hud\screen\screen_movement.dm" #include "code\_onclick\hud\screen\screen_needs.dm" #include "code\_onclick\hud\screen\screen_pai.dm" @@ -246,7 +246,6 @@ #include "code\_onclick\hud\screen\robot\screen_robot_inventory.dm" #include "code\_onclick\hud\screen\robot\screen_robot_module.dm" #include "code\_onclick\hud\screen\robot\screen_robot_modules.dm" -#include "code\_onclick\hud\screen\robot\screen_robot_panel.dm" #include "code\_onclick\hud\screen\robot\screen_robot_radio.dm" #include "code\_onclick\hud\screen\robot\screen_robot_store.dm" #include "code\_onclick\hud\screen\robot\screen_robot_warnings.dm" @@ -333,7 +332,6 @@ #include "code\controllers\subsystems\mob_ai\auto_movement.dm" #include "code\controllers\subsystems\mob_ai\mob_ai.dm" #include "code\controllers\subsystems\processing\airflow.dm" -#include "code\controllers\subsystems\processing\blob.dm" #include "code\controllers\subsystems\processing\chatter.dm" #include "code\controllers\subsystems\processing\circuit.dm" #include "code\controllers\subsystems\processing\fast_process.dm" @@ -497,6 +495,7 @@ #include "code\datums\hostility\hostility.dm" #include "code\datums\inventory_slots\_inventory_slot.dm" #include "code\datums\inventory_slots\inventory_gripper.dm" +#include "code\datums\inventory_slots\inventory_gripper_robot.dm" #include "code\datums\inventory_slots\inventory_gripper_subtypes.dm" #include "code\datums\inventory_slots\slots\slot_back.dm" #include "code\datums\inventory_slots\slots\slot_belt.dm" @@ -744,7 +743,6 @@ #include "code\datums\wires\smartfridge.dm" #include "code\datums\wires\smes.dm" #include "code\datums\wires\suit_cycler.dm" -#include "code\datums\wires\taperecorder.dm" #include "code\datums\wires\vending.dm" #include "code\datums\wires\wire_description.dm" #include "code\datums\wires\wires.dm" @@ -783,7 +781,6 @@ #include "code\game\antagonist\antagonist_update.dm" #include "code\game\antagonist\outsider\actors.dm" #include "code\game\antagonist\outsider\ert.dm" -#include "code\game\antagonist\outsider\mercenary.dm" #include "code\game\antagonist\station\provocateur.dm" #include "code\game\antagonist\station\thrall.dm" #include "code\game\area\area_abstract.dm" @@ -800,8 +797,6 @@ #include "code\game\gamemodes\endgame\nuclear_explosion\nuclear_explosion.dm" #include "code\game\gamemodes\events\power_failure.dm" #include "code\game\gamemodes\extended\extended.dm" -#include "code\game\gamemodes\nuclear\nuclear.dm" -#include "code\game\gamemodes\nuclear\pinpointer.dm" #include "code\game\gamemodes\objectives\_objective.dm" #include "code\game\gamemodes\objectives\objective_assassinate.dm" #include "code\game\gamemodes\objectives\objective_brig.dm" @@ -833,6 +828,7 @@ #include "code\game\machinery\buttons.dm" #include "code\game\machinery\CableLayer.dm" #include "code\game\machinery\cell_charger.dm" +#include "code\game\machinery\centrifuge.dm" #include "code\game\machinery\commsrelay.dm" #include "code\game\machinery\constructable_frame.dm" #include "code\game\machinery\cracker.dm" @@ -1012,8 +1008,8 @@ #include "code\game\machinery\vending\security.dm" #include "code\game\machinery\vending\toxins.dm" #include "code\game\objects\__objs.dm" -#include "code\game\objects\_obj_edibility.dm" #include "code\game\objects\_objs_damage.dm" +#include "code\game\objects\_objs_edibility.dm" #include "code\game\objects\_objs_interactions.dm" #include "code\game\objects\alien_props.dm" #include "code\game\objects\empulse.dm" @@ -1021,10 +1017,6 @@ #include "code\game\objects\item_mob_overlay.dm" #include "code\game\objects\munition.dm" #include "code\game\objects\topic.dm" -#include "code\game\objects\auras\aura.dm" -#include "code\game\objects\auras\radiant_aura.dm" -#include "code\game\objects\auras\regenerating_aura.dm" -#include "code\game\objects\auras\personal_shields\personal_shield.dm" #include "code\game\objects\compass\_compass.dm" #include "code\game\objects\compass\compass_holder.dm" #include "code\game\objects\compass\compass_overmap.dm" @@ -1209,7 +1201,6 @@ #include "code\game\objects\items\devices\suit_cooling.dm" #include "code\game\objects\items\devices\suit_sensor_jammer.dm" #include "code\game\objects\items\devices\t_scanner.dm" -#include "code\game\objects\items\devices\taperecorder.dm" #include "code\game\objects\items\devices\traitordevices.dm" #include "code\game\objects\items\devices\transfer_valve.dm" #include "code\game\objects\items\devices\tvcamera.dm" @@ -1226,6 +1217,9 @@ #include "code\game\objects\items\devices\radio\radio_borg.dm" #include "code\game\objects\items\devices\radio\radio_exosuit.dm" #include "code\game\objects\items\devices\radio\radio_misc.dm" +#include "code\game\objects\items\devices\tape_recorder\magnetic_tape.dm" +#include "code\game\objects\items\devices\tape_recorder\tape_recorder.dm" +#include "code\game\objects\items\devices\tape_recorder\taperecorder_wires.dm" #include "code\game\objects\items\flame\_flame.dm" #include "code\game\objects\items\flame\flame_candle.dm" #include "code\game\objects\items\flame\flame_fuelled.dm" @@ -1479,6 +1473,7 @@ #include "code\game\objects\structures\transit_tubes.dm" #include "code\game\objects\structures\travois.dm" #include "code\game\objects\structures\under_wardrobe.dm" +#include "code\game\objects\structures\wall_cabinet.dm" #include "code\game\objects\structures\wall_frame.dm" #include "code\game\objects\structures\wall_sconce.dm" #include "code\game\objects\structures\wallframe_spawner.dm" @@ -1639,6 +1634,8 @@ #include "code\modules\abstract\abstract_fluid_direction.dm" #include "code\modules\abstract\abstract_ramp_sculptor.dm" #include "code\modules\abstract\airlock_helper.dm" +#include "code\modules\abstract\corpse_spawner.dm" +#include "code\modules\abstract\follower.dm" #include "code\modules\acting\acting_items.dm" #include "code\modules\admin\admin.dm" #include "code\modules\admin\admin_attack_log.dm" @@ -1692,7 +1689,6 @@ #include "code\modules\admin\secrets\admin_secrets\show_crew_manifest.dm" #include "code\modules\admin\secrets\admin_secrets\show_game_mode.dm" #include "code\modules\admin\secrets\admin_secrets\show_law_changes.dm" -#include "code\modules\admin\secrets\admin_secrets\show_signalers.dm" #include "code\modules\admin\secrets\admin_secrets\toggle_circuits.dm" #include "code\modules\admin\secrets\admin_secrets\toggle_overmap_movement.dm" #include "code\modules\admin\secrets\admin_secrets\traitors_and_objectives.dm" @@ -1806,14 +1802,10 @@ #include "code\modules\augment\passive\boost\muscle.dm" #include "code\modules\augment\passive\boost\reflex.dm" #include "code\modules\augment\passive\boost\shooting.dm" -#include "code\modules\awaymissions\artillery.dm" -#include "code\modules\awaymissions\corpse.dm" -#include "code\modules\awaymissions\exile.dm" -#include "code\modules\awaymissions\gateway.dm" -#include "code\modules\awaymissions\pamphlet.dm" -#include "code\modules\awaymissions\trigger.dm" #include "code\modules\backgrounds\_background.dm" #include "code\modules\backgrounds\background_categories.dm" +#include "code\modules\backgrounds\citizenship\_citizenship.dm" +#include "code\modules\backgrounds\citizenship\citizenship_other.dm" #include "code\modules\backgrounds\faction\_faction.dm" #include "code\modules\backgrounds\faction\factions_human.dm" #include "code\modules\backgrounds\heritage\_heritage.dm" @@ -1830,11 +1822,11 @@ #include "code\modules\banners\banner_frame_definitions.dm" #include "code\modules\banners\sign.dm" #include "code\modules\banners\sign_post.dm" +#include "code\modules\banners\signs_premade.dm" #include "code\modules\barricade_tape\barricade_tape.dm" #include "code\modules\barricade_tape\barricade_tape_roll.dm" #include "code\modules\barricade_tape\barricade_tape_subtypes.dm" #include "code\modules\barricade_tape\barricade_tape_template.dm" -#include "code\modules\blob\blob.dm" #include "code\modules\blood\blood.dm" #include "code\modules\blood\blood_types.dm" #include "code\modules\blood\blood_types_subtypes.dm" @@ -1997,7 +1989,7 @@ #include "code\modules\clothing\gloves\thick.dm" #include "code\modules\clothing\gloves\jewelry\bracelet.dm" #include "code\modules\clothing\gloves\jewelry\rings\_ring.dm" -#include "code\modules\clothing\gloves\jewelry\rings\ring_aura.dm" +#include "code\modules\clothing\gloves\jewelry\rings\ring_effect.dm" #include "code\modules\clothing\gloves\jewelry\rings\ring_misc.dm" #include "code\modules\clothing\gloves\jewelry\rings\ring_reagent.dm" #include "code\modules\clothing\gloves\jewelry\rings\ring_seal.dm" @@ -2055,6 +2047,7 @@ #include "code\modules\clothing\pants\scrubs.dm" #include "code\modules\clothing\pants\shorts.dm" #include "code\modules\clothing\pants\slacks.dm" +#include "code\modules\clothing\permits\_permit.dm" #include "code\modules\clothing\sensors\_sensor.dm" #include "code\modules\clothing\sensors\buddytag.dm" #include "code\modules\clothing\sensors\vitals_sensor.dm" @@ -2322,7 +2315,6 @@ #include "code\modules\error_handler\error_viewer.dm" #include "code\modules\events\ailments.dm" #include "code\modules\events\apc_damage.dm" -#include "code\modules\events\blob.dm" #include "code\modules\events\brain_expansion.dm" #include "code\modules\events\brand_intelligence.dm" #include "code\modules\events\camera_damage.dm" @@ -2663,10 +2655,10 @@ #include "code\modules\interactions\interactions_reagents.dm" #include "code\modules\interactions\interactions_shared.dm" #include "code\modules\item_effects\_item_effect.dm" -#include "code\modules\item_effects\item_effect_aura.dm" #include "code\modules\item_effects\item_effect_charges.dm" #include "code\modules\item_effects\item_effect_debug.dm" #include "code\modules\item_effects\item_effect_item.dm" +#include "code\modules\item_effects\item_effect_modifier.dm" #include "code\modules\keybindings\_defines.dm" #include "code\modules\keybindings\_keybindings.dm" #include "code\modules\keybindings\admin.dm" @@ -2678,9 +2670,10 @@ #include "code\modules\keybindings\living.dm" #include "code\modules\keybindings\mob.dm" #include "code\modules\keybindings\movement.dm" -#include "code\modules\keybindings\robot.dm" #include "code\modules\keybindings\setup.dm" #include "code\modules\lighting\_lighting_defs.dm" +#include "code\modules\lighting\ambient_group.dm" +#include "code\modules\lighting\ambient_turf.dm" #include "code\modules\lighting\lighting_area.dm" #include "code\modules\lighting\lighting_atom.dm" #include "code\modules\lighting\lighting_corner.dm" @@ -2943,8 +2936,8 @@ #include "code\modules\mob\living\human\human_movement.dm" #include "code\modules\mob\living\human\human_organs.dm" #include "code\modules\mob\living\human\human_powers.dm" +#include "code\modules\mob\living\human\human_presets.dm" #include "code\modules\mob\living\human\human_skin.dm" -#include "code\modules\mob\living\human\human_species.dm" #include "code\modules\mob\living\human\human_verbs.dm" #include "code\modules\mob\living\human\life.dm" #include "code\modules\mob\living\human\login.dm" @@ -3145,6 +3138,19 @@ #include "code\modules\mob_holder\_holder.dm" #include "code\modules\mob_holder\holder_mobs.dm" #include "code\modules\mob_holder\holder_subtypes.dm" +#include "code\modules\mob_modifiers\_modifiers.dm" +#include "code\modules\mob_modifiers\modifiers_datum.dm" +#include "code\modules\mob_modifiers\modifiers_helpers.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_cloaked.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_light.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_mech_shields.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_nanoswarm.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_object.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_prone.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_regeneration.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_restrained.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_shield.dm" +#include "code\modules\mob_modifiers\definitions\modifiers_stasis.dm" #include "code\modules\modular_computers\laptop_vendor.dm" #include "code\modules\modular_computers\computers\modular_computer\assembly_computer.dm" #include "code\modules\modular_computers\computers\modular_computer\assembly_holo.dm" @@ -3580,6 +3586,7 @@ #include "code\modules\pronouns\pronouns_female.dm" #include "code\modules\pronouns\pronouns_male.dm" #include "code\modules\pronouns\pronouns_neuter.dm" +#include "code\modules\pronouns\pronouns_second_person.dm" #include "code\modules\radiation\radiation.dm" #include "code\modules\random_map\_random_map_setup.dm" #include "code\modules\random_map\random_map.dm" @@ -3634,6 +3641,7 @@ #include "code\modules\reagents\chems\chems_painkillers.dm" #include "code\modules\reagents\chems\chems_pigments.dm" #include "code\modules\reagents\chems\chems_poisons.dm" +#include "code\modules\reagents\chems\chems_psychiatric.dm" #include "code\modules\reagents\chems\random\chems_random.dm" #include "code\modules\reagents\chems\random\random_effects.dm" #include "code\modules\reagents\dispenser\_defines.dm" @@ -3844,15 +3852,15 @@ #include "code\modules\sprite_accessories\metadata\accessory_metadata_color.dm" #include "code\modules\sprite_accessories\metadata\accessory_metadata_gradient.dm" #include "code\modules\sprite_accessories\tails\_accessory_tail.dm" -#include "code\modules\status_conditions\_status.dm" +#include "code\modules\status_conditions\_status_condition.dm" #include "code\modules\status_conditions\_status_markers.dm" #include "code\modules\status_conditions\status_counters_simple.dm" -#include "code\modules\status_conditions\status_dizzy.dm" -#include "code\modules\status_conditions\status_jittery.dm" -#include "code\modules\status_conditions\status_paralyzed.dm" -#include "code\modules\status_conditions\status_sleeping.dm" -#include "code\modules\status_conditions\status_stunned.dm" -#include "code\modules\status_conditions\status_weakened.dm" +#include "code\modules\status_conditions\definitions\status_dizzy.dm" +#include "code\modules\status_conditions\definitions\status_jittery.dm" +#include "code\modules\status_conditions\definitions\status_paralyzed.dm" +#include "code\modules\status_conditions\definitions\status_sleeping.dm" +#include "code\modules\status_conditions\definitions\status_stunned.dm" +#include "code\modules\status_conditions\definitions\status_weakened.dm" #include "code\modules\stressors\_stressor.dm" #include "code\modules\stressors\stressor_definitions.dm" #include "code\modules\submaps\_submap.dm" @@ -3957,6 +3965,7 @@ #include "code\modules\webhooks\webhook_roundprep.dm" #include "code\modules\webhooks\webhook_roundstart.dm" #include "code\modules\webhooks\webhook_submap.dm" +#include "code\modules\xenoarcheaology\_xenoarch.dm" #include "code\modules\xenoarcheaology\boulder.dm" #include "code\modules\xenoarcheaology\artifacts\artifact.dm" #include "code\modules\xenoarcheaology\artifacts\artifact_appearance.dm" @@ -4091,7 +4100,6 @@ #include "maps\__map_names.dm" #include "maps\_map_include.dm" #include "maps\antag_spawn\ert\ert.dm" -#include "maps\antag_spawn\mercenary\mercenary.dm" #include "maps\away_sites_testing\away_sites_testing_define.dm" #include "maps\example\example_define.dm" #include "maps\exodus\exodus_define.dm" diff --git a/sound/ambience/marshy.ogg b/sound/ambience/marshy.ogg new file mode 100644 index 000000000000..d481be1e091d Binary files /dev/null and b/sound/ambience/marshy.ogg differ diff --git a/sound/effects/boiling-water.ogg b/sound/effects/boiling-water.ogg new file mode 100644 index 000000000000..c026945a819b Binary files /dev/null and b/sound/effects/boiling-water.ogg differ diff --git a/sound/music/winter/alexander-nakarada-adventure.ogg b/sound/music/winter/alexander-nakarada-adventure.ogg new file mode 100644 index 000000000000..d41045603817 Binary files /dev/null and b/sound/music/winter/alexander-nakarada-adventure.ogg differ diff --git a/test/check-paths.sh b/test/check-paths.sh index 4e2cdcdf3f75..f59aa02ce4c7 100755 --- a/test/check-paths.sh +++ b/test/check-paths.sh @@ -34,14 +34,14 @@ exactly 10 "/turf text paths" '"/turf' exactly 1 "world<< uses" 'world\s*<<' exactly 75 "'in world' uses" '\s+\bin world\b(?=\s*$|\s*//|\s*\))' -P exactly 1 "world.log<< uses" 'world.log\s*<<' -exactly 18 "<< uses" '(?> uses" '(?\\])>>(?!>)' -P exactly 0 "incorrect indentations" '^( {4,})' -P exactly 22 "text2path uses" 'text2path' exactly 4 "update_icon() overrides" '\/update_icon\(' -P exactly 0 "goto uses" '\bgoto\b' -exactly 9 "atom/New uses" '^/(obj|atom|area|mob|turf).*/New\(' +exactly 10 "atom/New uses" '^/(obj|atom|area|mob|turf).*/New\(' exactly 1 "decl/New uses" '^/decl.*/New\(' exactly 3 "tag uses" '(?&1 | tee -a ${GITHUB_WORKSPACE}/output-annotations.txt +# then remove the inserted feature after so the next step in the loop can test a new feature +failed=0 +for feature in $dme_features $dm_features; do + echo "Testing feature: $feature" + # Include the feature + sed -i "/#include \"mods\\\\_modpack.dm\"/a#include \"$feature\"" "$dmepath.m.dme" + # Run the linter, only doing parsing to catch undefined vars and keywords + ~/dreamchecker -e "$dmepath.m.dme" --parse-only 2>&1 | tee -a "${GITHUB_WORKSPACE}/output-annotations.txt" + # Check the return value + if [[ $? -ne 0 ]]; then + failed=1 + fi + # Remove the feature include + sed -i "\\:#include \"$feature\":d" "$dmepath.m.dme" +done +rm $dmepath.m.dme +if [[ $failed -eq 1 ]]; then + echo "One or more modpacks failed to pass solo validation." + exit 1 +fi \ No newline at end of file diff --git a/tools/ColorHexChecker/color-hex-checker.py b/tools/ColorHexChecker/color-hex-checker.py index 9c198be41ac7..1d8b4e9f7168 100644 --- a/tools/ColorHexChecker/color-hex-checker.py +++ b/tools/ColorHexChecker/color-hex-checker.py @@ -1,7 +1,7 @@ import argparse, re, sys from os import sep, path, walk -color_hex_matcher = re.compile('\"#[\dA-F]{6}\"', re.IGNORECASE) +color_hex_matcher = re.compile(r'\"#[\dA-F]{6}\"', re.IGNORECASE) def get_bad_hexes_in_line(line): bad_hexes = [] @@ -25,7 +25,7 @@ def print_bad_hexes(bad_hexes_by_path): print('\tLine: {0}'.format(line)) for bad_hex in bad_hexes: print('\t\t{0}'.format(bad_hex)) - + def main(): opt = argparse.ArgumentParser() opt.add_argument('dir', help='The directory to recursively scan for *.dm and *.dmm files with invalid color hexes') diff --git a/tools/map_migrations/0000_legacy.txt b/tools/map_migrations/0000_legacy.txt index 91f8fa256685..ccac8405c68a 100644 --- a/tools/map_migrations/0000_legacy.txt +++ b/tools/map_migrations/0000_legacy.txt @@ -109,6 +109,7 @@ /obj/item/chems/blood/empty : /obj/item/chems/ivbag{@OLD} /obj/item/chems/blood/@SUBTYPES : /obj/item/chems/ivbag/blood/@SUBTYPES{@OLD} /obj/item/defib_kit/@SUBTYPES : /obj/item/defibrillator/@SUBTYPES{@OLD} +/obj/item/chems/spray/sterilizine : /obj/item/chems/spray/antiseptic{@OLD} # Drinking glasses and cups /obj/item/chems/drinks/cup : /obj/item/chems/drinks/glass2/coffeecup{@OLD} @@ -144,6 +145,7 @@ # CLOTHING /obj/item/clothing/head/cone : /obj/item/caution/cone{@OLD} +/obj/item/clothing/belt/security/tactical : /obj/item/belt/holster/security/tactical{@OLD} # Item remains /obj/effect/decal/remains/@SUBTYPES : /obj/item/remains/@SUBTYPES{@OLD} @@ -242,10 +244,10 @@ # FABRICATORS /obj/machinery/autolathe{hacked = 1} : /obj/machinery/fabricator/hacked{@OLD; hacked = @SKIP} /obj/machinery/autolathe : /obj/machinery/fabricator{@OLD} -/obj/machinery/pipedispenser : /obj/machinery/fabricator/pipe{@OLD} -/obj/machinery/pipedispenser/orderable : /obj/machinery/fabricator/pipe{@OLD; anchored = 1} -/obj/machinery/pipedispenser/disposal : /obj/machinery/fabricator/pipe/disposal{@OLD} -/obj/machinery/pipedispenser/disposal/orderable : /obj/machinery/fabricator/pipe/disposal{@OLD; anchored = 1} +/obj/machinery/pipedispenser : /obj/machinery/fabricator/pipe{@OLD; anchored = 1} +/obj/machinery/pipedispenser/orderable : /obj/machinery/fabricator/pipe{@OLD} +/obj/machinery/pipedispenser/disposal : /obj/machinery/fabricator/pipe/disposal{@OLD; anchored = 1} +/obj/machinery/pipedispenser/disposal/orderable : /obj/machinery/fabricator/pipe/disposal{@OLD} /obj/machinery/r_n_d/circuit_imprinter : /obj/machinery/fabricator/imprinter{@OLD} /obj/machinery/pros_fabricator : /obj/machinery/fabricator/robotics{@OLD} /obj/machinery/mecha_part_fabricator : /obj/machinery/fabricator/industrial{@OLD} @@ -330,6 +332,10 @@ /obj/machinery/account_database : /obj/machinery/computer/account_database{@OLD} /obj/machinery/shield_gen/@SUBTYPES : /obj/machinery/shield_generator +/obj/structure/morgue/crematorium : /obj/structure/crematorium{@OLD} + +/obj/item/robot_parts/frame : /obj/item/robot_parts/robot_suit{@OLD} + /obj/structure/closet/secure_closet/psych : /obj/structure/closet/secure_closet/psychiatry{@OLD} /obj/structure/closet/firecloset/full : /obj/structure/closet/firecloset{@OLD} /obj/structure/closet/firecloset/full/double : /obj/structure/closet/firecloset/chief{@OLD} @@ -388,6 +394,42 @@ /obj/item/banner/nt : /obj/item/banner/nanotrasen{@OLD} +/obj/item/box/syndie_kit/clerical : /obj/item/backpack/satchel/syndie_kit/clerical{@OLD} + +/obj/item/clothing/under/costume/rainbow : /obj/item/clothing/jumpsuit/rainbow{@OLD} +/obj/item/clothing/under/dress/dress_orange : /obj/item/clothing/dress/orange{@OLD} +/obj/item/clothing/head/collectable/xenos : /obj/item/clothing/head/xenos{@OLD} +/obj/item/clothing/head/collectable/bearpelt : /obj/item/clothing/head/bearpelt{@OLD} +/obj/item/clothing/head/collectable/philosopher_wig : /obj/item/clothing/head/philosopher_wig{@OLD} +/obj/item/clothing/head/collectable/plaguedoctorhat : /obj/item/clothing/head/plaguedoctorhat{@OLD} +/obj/item/clothing/head/helmet/space/void/security/riot : /obj/item/clothing/head/helmet/space/void/security/alt{@OLD} +/obj/item/clothing/suit/space/void/security/riot : /obj/item/clothing/suit/space/void/security/alt{@OLD} +/obj/item/clothing/head/helmet/space/vox/pressure : /obj/item/clothing/head/helmet/space/vox{@OLD} +/obj/item/clothing/under/vox/vox_utility : /obj/item/clothing/pants/vox{@OLD} +/obj/item/clothing/suit/space/pirate : /obj/item/clothing/suit/pirate{@OLD} +/obj/item/clothing/suit/costume : /obj/item/clothing/suit/pirate{@OLD} +/obj/item/clothing/suit/costume/hgpirate : /obj/item/clothing/suit/hgpirate{@OLD} +/obj/item/clothing/suit/storage/vest/heavy/merc : /obj/item/clothing/suit/armor/pcarrier/merc{@OLD} +/obj/item/clothing/suit/storage/vest/@SUBTYPES : /obj/item/clothing/suit/armor/vest/@SUBTYPES{@OLD} + +# Migrate/delete old mech parts +/obj/item/mecha_parts/mecha_equipment/anticcw_armor_booster : @DELETE +/obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster : @DELETE +/obj/item/mecha_parts/mecha_equipment/repair_droid : @DELETE +/obj/item/mecha_parts/mecha_equipment/teleporter : @DELETE +/obj/item/mecha_parts/mecha_equipment/tesla_energy_relay : @DELETE +/obj/item/mecha_parts/mecha_equipment/tool/cable_layer : @DELETE +/obj/item/mecha_parts/mecha_equipment/tool/drill/diamonddrill : /obj/item/mech_equipment/drill/diamond{@OLD} +/obj/item/mecha_parts/mecha_equipment/tool/extinguisher : /obj/item/mech_equipment/mounted_system/extinguisher{@OLD} +/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp : /obj/item/mech_equipment/clamp{@OLD} +/obj/item/mecha_parts/mecha_equipment/tool/passenger : @DELETE +/obj/item/mecha_parts/mecha_equipment/tool/rcd : /obj/item/mech_equipment/mounted_system/rcd{@OLD} +/obj/item/mecha_parts/mecha_equipment/tool/sleeper : /obj/item/mech_equipment/sleeper{@OLD} +/obj/item/mecha_parts/mecha_equipment/tool/syringe_gun : @DELETE +/obj/item/mecha_parts/mecha_equipment/weapon/energy/ion : /obj/item/mech_equipment/mounted_system/taser/ion{@OLD} +/obj/item/mecha_parts/mecha_equipment/weapon/energy/taser : /obj/item/mech_equipment/mounted_system/taser{@OLD} +/obj/item/mecha_parts/mecha_tracking : @DELETE + ############ # VAREDITS # ############ @@ -459,4 +501,4 @@ /obj/machinery/floor_light/prebuilt{on = 1} : /obj/machinery/floor_light/prebuilt{@OLD; use_power = 2; on = @SKIP} -/obj/structure/disposalpipe/sortjunction/@SUBTYPES{sortType = @SET} : /obj/structure/disposalpipe/sortjunction/@SUBTYPES{@OLD; sort_type = @OLD:sortType; sortType = @SKIP} \ No newline at end of file +/obj/structure/disposalpipe/sortjunction/@SUBTYPES{sortType = @SET} : /obj/structure/disposalpipe/sortjunction/@SUBTYPES{@OLD; sort_type = @OLD:sortType; sortType = @SKIP} diff --git a/tools/map_migrations/3948_uniforms.txt b/tools/map_migrations/3948_uniforms.txt index 2cb182aa7e03..565df08d0e1c 100644 --- a/tools/map_migrations/3948_uniforms.txt +++ b/tools/map_migrations/3948_uniforms.txt @@ -37,7 +37,7 @@ /obj/item/clothing/under/geneticist/@SUBTYPES : /obj/item/clothing/jumpsuit/geneticist/@SUBTYPES{@OLD} /obj/item/clothing/under/virologist/@SUBTYPES : /obj/item/clothing/jumpsuit/virologist/@SUBTYPES{@OLD} /obj/item/clothing/under/tactical/@SUBTYPES : /obj/item/clothing/jumpsuit/tactical/@SUBTYPES{@OLD} -/obj/item/clothing/under/caretaker/@SUBTYPES : obj/item/clothing/jumpsuit/caretaker/@SUBTYPES{@OLD} +/obj/item/clothing/under/caretaker/@SUBTYPES : /obj/item/clothing/jumpsuit/caretaker/@SUBTYPES{@OLD} /obj/item/clothing/under/hazard/@SUBTYPES : /obj/item/clothing/jumpsuit/hazard/@SUBTYPES{@OLD} /obj/item/clothing/under/head_of_security/@SUBTYPES : /obj/item/clothing/jumpsuit/head_of_security/@SUBTYPES{@OLD} /obj/item/clothing/under/warden/@SUBTYPES : /obj/item/clothing/jumpsuit/warden/@SUBTYPES{@OLD} diff --git a/tools/map_migrations/4047_more_uniforms.txt b/tools/map_migrations/4047_more_uniforms.txt index 19eb9109bc66..6b0e87f953f6 100644 --- a/tools/map_migrations/4047_more_uniforms.txt +++ b/tools/map_migrations/4047_more_uniforms.txt @@ -3,7 +3,6 @@ /obj/item/clothing/jumpsuit/captain_fly/@SUBTYPES : /obj/item/clothing/costume/captain_fly/@SUBTYPES{@OLD} /obj/item/clothing/jumpsuit/head_of_personnel_whimsy/@SUBTYPES : /obj/item/clothing/costume/head_of_personnel_whimsy/@SUBTYPES{@OLD} /obj/item/clothing/pants/casual/mustangjeans/monke/@SUBTYPES : /obj/item/clothing/pants/casual/mustangjeans/@SUBTYPES{@OLD} -/obj/item/clothing/under/caretaker/@SUBTYPES : /obj/item/clothing/jumpsuit/caretaker/@SUBTYPES{@OLD} /obj/item/clothing/under/mankini/@SUBTYPES : /obj/item/clothing/pants/mankini/@SUBTYPES{@OLD} /obj/item/clothing/under/bartender/@SUBTYPES : /obj/item/clothing/pants/formal/black{@OLD}, /obj/item/clothing/shirt/button{@OLD} /obj/item/clothing/under/blazer/@SUBTYPES : /obj/item/clothing/shirt/button{@OLD}, /obj/item/clothing/neck/tie/navy{@OLD}, /obj/item/clothing/suit/jacket/blazer{@OLD} diff --git a/tools/map_migrations/4525_food_breakup.txt b/tools/map_migrations/4525_food_breakup.txt index f565bb30dc25..513b12b39f5f 100644 --- a/tools/map_migrations/4525_food_breakup.txt +++ b/tools/map_migrations/4525_food_breakup.txt @@ -31,7 +31,7 @@ /obj/item/food/xenomeat/@SUBTYPES : /obj/item/food/butchery/meat/xeno/@SUBTYPES{@OLD} /obj/item/food/cosmoshark/@SUBTYPES : /obj/item/food/butchery/meat/fish/shark/@SUBTYPES{@OLD} -/obj/item/food/bearmeat/@SUBTYPES : obj/item/food/butchery/meat/bear/@SUBTYPES{@OLD} +/obj/item/food/bearmeat/@SUBTYPES : /obj/item/food/butchery/meat/bear/@SUBTYPES{@OLD} /obj/item/food/meatkabob/@SUBTYPES : /obj/item/food/skewer/meat/@SUBTYPES{@OLD} /obj/item/food/tofukabob/@SUBTYPES : /obj/item/food/skewer/tofu/@SUBTYPES{@OLD} \ No newline at end of file diff --git a/tools/map_migrations/4898_color_bowtie.txt b/tools/map_migrations/4898_color_bowtie.txt new file mode 100644 index 000000000000..50099e74e447 --- /dev/null +++ b/tools/map_migrations/4898_color_bowtie.txt @@ -0,0 +1 @@ +/obj/item/clothing/neck/tie/bow/color/@SUBTYPES : /obj/item/clothing/neck/tie/bow/@SUBTYPES{@OLD} \ No newline at end of file diff --git a/tools/map_migrations/4898_jumpsuits_costumes.txt b/tools/map_migrations/4898_jumpsuits_costumes.txt new file mode 100644 index 000000000000..4a7af78fa802 --- /dev/null +++ b/tools/map_migrations/4898_jumpsuits_costumes.txt @@ -0,0 +1,11 @@ +# Converts a number of jumpsuits to costumes +# because they shouldn't have the full suite of jumpsuit modifiers +# (e.g. can't be rolled down, no sleeves to roll up, etc) +/obj/item/clothing/jumpsuit/research_director/rdalt : /obj/item/clothing/costume/research_director_suit{@OLD} +/obj/item/clothing/jumpsuit/captainformal/@SUBTYPES : /obj/item/clothing/costume/captainformal/@SUBTYPES{@OLD} +/obj/item/clothing/jumpsuit/mailman/@SUBTYPES : /obj/item/clothing/costume/mailman/@SUBTYPES{@OLD} +/obj/item/clothing/jumpsuit/vice/@SUBTYPES : /obj/item/clothing/costume/vice/@SUBTYPES{@OLD} +/obj/item/clothing/jumpsuit/johnny/@SUBTYPES : /obj/item/clothing/costume/johnny/@SUBTYPES{@OLD} +/obj/item/clothing/jumpsuit/psyche/@SUBTYPES : /obj/item/clothing/costume/psyche/@SUBTYPES{@OLD} +/obj/item/clothing/jumpsuit/wetsuit/@SUBTYPES : /obj/item/clothing/costume/wetsuit/@SUBTYPES{@OLD} +/obj/item/clothing/jumpsuit/caretaker/@SUBTYPES : /obj/item/clothing/costume/caretaker/@SUBTYPES{@OLD} \ No newline at end of file diff --git a/tools/map_migrations/4912_unused_clothes_removal.txt b/tools/map_migrations/4912_unused_clothes_removal.txt new file mode 100644 index 000000000000..553a95bd086a --- /dev/null +++ b/tools/map_migrations/4912_unused_clothes_removal.txt @@ -0,0 +1,3 @@ +/obj/item/clothing/jumpsuit/vice/@SUBTYPES : @DELETE +/obj/item/clothing/jumpsuit/johnny/@SUBTYPES : @DELETE +/obj/item/clothing/jumpsuit/caretaker/@SUBTYPES : @DELETE \ No newline at end of file diff --git a/tools/map_migrations/4975_kitchen.txt b/tools/map_migrations/4975_kitchen.txt new file mode 100644 index 000000000000..a796c54eb3ae --- /dev/null +++ b/tools/map_migrations/4975_kitchen.txt @@ -0,0 +1 @@ +/obj/item/kitchen/@SUBTYPES : /obj/item/@SUBTYPES{@OLD} \ No newline at end of file diff --git a/tools/map_migrations/9999_cigarettes.txt b/tools/map_migrations/9999_cigarettes.txt new file mode 100644 index 000000000000..875e6404ad48 --- /dev/null +++ b/tools/map_migrations/9999_cigarettes.txt @@ -0,0 +1,4 @@ +/obj/item/box/fancy/cigarettes/flash_powder : /obj/item/box/fancy/cigarettes/covert/flash_powder{@OLD} +/obj/item/box/fancy/cigarettes/chemsmoke : /obj/item/box/fancy/cigarettes/covert/flash_powder{@OLD} +/obj/item/box/fancy/cigarettes/mindbreak : /obj/item/box/fancy/cigarettes/covert/flash_powder{@OLD} +/obj/item/box/fancy/cigarettes/tricord : /obj/item/box/fancy/cigarettes/covert/flash_powder{@OLD} \ No newline at end of file diff --git a/tools/mapcapturemerge/README.md b/tools/mapcapturemerge/README.md index 5606211b2e65..15f398267edf 100644 --- a/tools/mapcapturemerge/README.md +++ b/tools/mapcapturemerge/README.md @@ -1,11 +1,11 @@ -Map capture merge tool manual -====== - -1. Capture desired Z levels using in game verb `Capture-map` -2. Before closing game window, go to cache folder usually located under Documents/BYOND and copy all map capture files named like `map_capture_x1_y33_z1_r32.png` to folder under this tool called `captures`. -3. Install *Python* and *Pillow* library (If you don't have them already). -4. Run `python merge.py` and wait for captures to be merged. -5. After execution you will find all z-level merged maps in the mapcapturemerge tool folder. - -Notes: +Map capture merge tool manual +====== + +1. Capture desired Z levels using in game verb `Capture-map` +2. Before closing game window, go to cache folder usually located under Documents/BYOND and copy all map capture files named like `map_capture_x1_y33_z1_r32.png` to folder under this tool called `captures`. +3. Install *Python* and *Pillow* library (If you don't have them already). +4. Run `python merge.py` and wait for captures to be merged. +5. After execution you will find all z-level merged maps in the mapcapturemerge tool folder. + +Notes: * This tool been tested with Python 2.7.6 under Windows 10 Bash. \ No newline at end of file diff --git a/tools/mapmerge2/update_paths.py b/tools/mapmerge2/update_paths.py index b9e095b5ee32..f0b6af46072b 100644 --- a/tools/mapmerge2/update_paths.py +++ b/tools/mapmerge2/update_paths.py @@ -190,9 +190,20 @@ def main(args): print("Using replacement:", args.update_source) updates = [args.update_source] else: - with open(args.update_source) as f: - updates = [line for line in f if line and not line.startswith("#") and not line.isspace()] - print(f"Using {len(updates)} replacements from file:", args.update_source) + # optional support for passing a directory + if os.path.isdir(args.update_source): + updates = [] + for root, _, files in os.walk(args.update_source): + for filepath in files: + if filepath.endswith(".txt"): + path = os.path.join(root, filepath) + with open(path) as f: + updates.extend(line for line in f if line and not line.startswith("#") and not line.isspace()) + print(f"Using {len(updates)} replacements from directory:", args.update_source) + else: + with open(args.update_source) as f: + updates = [line for line in f if line and not line.startswith("#") and not line.isspace()] + print(f"Using {len(updates)} replacements from file:", args.update_source) if args.map: update_map(args.map, updates, verbose=args.verbose)