diff --git a/code/__defines/chemistry.dm b/code/__defines/chemistry.dm index 5e70c1e79047..db1cd4817e1a 100644 --- a/code/__defines/chemistry.dm +++ b/code/__defines/chemistry.dm @@ -78,13 +78,30 @@ #define HANDLE_REACTIONS(_reagents) if(!QDELETED(_reagents)) { SSmaterials.active_holders[_reagents] = TRUE; } #define UNQUEUE_REACTIONS(_reagents) SSmaterials.active_holders -= _reagents -#define REAGENT_LIST(R) (R.reagents?.get_reagents() || "No reagent holder") +#define REAGENT_LIST(R) ((istype(R, /datum/reagents) && R:get_reagents()) || "No reagent holder") + +#define REAGENT_TOTAL_VOLUME(R) (UNLINT((istype(R, /datum/reagents) && R:total_volume) || 0)) +#define REAGENT_TOTAL_LIQUID_VOLUME(R) (UNLINT((istype(R, /datum/reagents) && R:total_liquid_volume) || 0)) + +#define REAGENT_MAXIMUM_VOLUME(R) (UNLINT((istype(R, /datum/reagents) && R:maximum_volume) || 0)) +#define REAGENTS_FREE_SPACE(R) (UNLINT(istype(R, /datum/reagents) ? (R.maximum_volume - R.total_volume) : 0)) + +#define REAGENT_VOLUMES(R) ( (istype(R, /datum/reagents) && UNLINT(R:reagent_volumes)) || null ) +#define REAGENT_SOLID_VOLUMES(R) ( (istype(R, /datum/reagents) && UNLINT(R:solid_volumes)) || null ) +#define REAGENT_LIQUID_VOLUMES(R) ( (istype(R, /datum/reagents) && UNLINT(R:liquid_volumes)) || null ) +#define REAGENT_GET_MAX_VOL(R) ( (istype(R, /datum/reagents) && UNLINT(R:maximum_volume)) || 0 ) +#define REAGENT_GET_ATOM(R) ( (istype(R, /datum/reagents) && UNLINT(R:my_atom)) || null ) + +#define REAGENT_VOLUME(R, M) ( istype(R, /datum/reagents) && UNLINT(R:reagent_volumes && R:reagent_volumes[RESOLVE_TO_DECL(M)]) ) +#define LIQUID_VOLUME(R, M) ( istype(R, /datum/reagents) && UNLINT(R:liquid_volumes && R:liquid_volumes[RESOLVE_TO_DECL(M)]) ) +#define SOLID_VOLUME(R, M) ( istype(R, /datum/reagents) && UNLINT(R:solid_volumes && R:solid_volumes[RESOLVE_TO_DECL(M)]) ) +#define REAGENT_DATA(R, M) ( istype(R, /datum/reagents) && UNLINT(R:reagent_data && R:reagent_data[RESOLVE_TO_DECL(M)]) ) + +#define REAGENT_SET_MAX_VOL(R, V) if(istype(R, /datum/reagents)) { UNLINT(R:maximum_volume = V) } +#define REAGENT_ADD_MAX_VOL(R, V) if(istype(R, /datum/reagents)) { UNLINT(R:maximum_volume += V) } +#define REAGENT_SET_ATOM(R, A) if(istype(R, /datum/reagents)) { UNLINT(R:my_atom = A) } +#define REAGENT_SET_DATA(R, M, D) if(istype(R, /datum/reagents)) { LAZYSET(UNLINT(R:reagent_data), M, D) } -#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[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 CHEM_DOSE(M, R) LAZYACCESS(M._chem_doses, RESOLVE_TO_DECL(R)) diff --git a/code/__defines/damage_organs.dm b/code/__defines/damage_organs.dm index 4c300aeeec52..8fbc2d9a9b0f 100644 --- a/code/__defines/damage_organs.dm +++ b/code/__defines/damage_organs.dm @@ -77,6 +77,8 @@ #define ORGAN_CATEGORY_STANCE "stance" /// Limb is considered the 'root' of a given stance limb (leg) - also counted for stance damage a la ORGAN_CATEGORY_STANCE #define ORGAN_CATEGORY_STANCE_ROOT "stance_root" +// Limb is considered a manipulator, currently only used when trying to pilot a wheelchair. +#define ORGAN_CATEGORY_MANIPLE "maniple" // Droplimb types. #define DISMEMBER_METHOD_EDGE 0 diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index 55874616e038..75c9ac6ef8ce 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -150,30 +150,15 @@ #define BP_EYES "eyes" #define BP_HEART "heart" #define BP_LUNGS "lungs" -#define BP_TRACH "tracheae" #define BP_BRAIN "brain" #define BP_LIVER "liver" #define BP_KIDNEYS "kidneys" #define BP_STOMACH "stomach" -#define BP_PLASMA "plasma vessel" #define BP_APPENDIX "appendix" #define BP_CELL "cell" -#define BP_HIVE "hive node" -#define BP_NUTRIENT "nutrient vessel" -#define BP_ACID "acid gland" -#define BP_EGG "egg sac" -#define BP_RESIN "resin spinner" -#define BP_STRATA "neural strata" -#define BP_RESPONSE "response node" -#define BP_GBLADDER "gas bladder" -#define BP_POLYP "polyp segment" -#define BP_ANCHOR "anchoring ligament" -#define BP_ACETONE "acetone reactor" // Robo Organs. #define BP_VOICE "vocal synthesiser" -#define BP_STACK "stack" -#define BP_OPTICS "optics" //Augmetations #define BP_AUGMENT_R_ARM "right arm augment" @@ -351,6 +336,7 @@ var/global/list/dexterity_levels = list( // Additional pronoun sets. #define NEUTER_ANIMATE "animate singular neutral" #define SECOND_PERSON_SINGULAR "second person singular" +#define PSEUDOPLURAL "pseudoplural" // Equipment Overlays Indices // #define HO_CONDITION_LAYER 1 diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index 7bb01c2778df..daeb63811418 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -37,12 +37,15 @@ var/global/list/string_slot_flags = list( ) // Used to avoid constantly generating new lists during movement. +var/global/list/all_maniple_limbs = list( + (ORGAN_CATEGORY_MANIPLE) +) var/global/list/all_stance_limbs = list( - ORGAN_CATEGORY_STANCE, - ORGAN_CATEGORY_STANCE_ROOT + (ORGAN_CATEGORY_STANCE), + (ORGAN_CATEGORY_STANCE_ROOT) ) var/global/list/child_stance_limbs = list( - ORGAN_CATEGORY_STANCE + (ORGAN_CATEGORY_STANCE) ) // TODO: Replace keybinding datums with keybinding decls to make this unnecessary. diff --git a/code/_helpers/lists.dm b/code/_helpers/lists.dm index b9d16ba65ab1..a39367a43233 100644 --- a/code/_helpers/lists.dm +++ b/code/_helpers/lists.dm @@ -27,13 +27,17 @@ input -= thing var/thing_string = isatom(thing) ? thing.name : "\proper [thing]" thing_count[thing_string] += 1 - thing_gender[thing_string] = isatom(thing) ? thing.gender : NEUTER + if(ismob(thing)) + var/mob/mob_thing = thing + thing_gender[thing_string] = mob_thing.get_gender() + else + thing_gender[thing_string] = isatom(thing) ? thing.gender : NEUTER input = list() for(var/thing_string in thing_count) if(thing_count[thing_string] == 1) input += "\the [thing_string]" else - input += "[thing_count[thing_string]] [thing_string][thing_gender[thing_string] == PLURAL ? "" : "s"]" + input += "[thing_count[thing_string]] [thing_gender[thing_string] == PLURAL ? text_make_plural(thing_string) : thing_string]" switch(length(input)) if(1) @@ -172,7 +176,7 @@ //Checks for specific types in specifically structured (Assoc "type" = TRUE) lists ('typecaches') /proc/is_type_in_typecache(atom/A, list/cache) - if(!cache || !cache.len || !A) + if(!LAZYLEN(cache) || !A) return 0 return cache[A.type] diff --git a/code/_helpers/medical_scans.dm b/code/_helpers/medical_scans.dm index 5d4b84e8df90..8cf60c06560e 100644 --- a/code/_helpers/medical_scans.dm +++ b/code/_helpers/medical_scans.dm @@ -42,15 +42,14 @@ .["immune_system"] = get_immunity() .["reagents"] = list() - if(reagents?.total_volume) - for(var/decl/material/reagent as anything in reagents.liquid_volumes) + if(REAGENT_TOTAL_VOLUME(reagents)) + for(var/decl/material/reagent as anything in REAGENT_LIQUID_VOLUMES(reagents)) 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) + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(reagents)) 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) @@ -98,8 +97,8 @@ .["blood_pressure"] = get_blood_pressure() .["blood_o2"] = get_blood_oxygenation() if(vessel) - .["blood_volume"] = vessel.total_volume - .["blood_volume_max"] = vessel.maximum_volume + .["blood_volume"] = REAGENT_TOTAL_VOLUME(vessel) + .["blood_volume_max"] = REAGENT_MAXIMUM_VOLUME(vessel) /proc/display_medical_data_header(var/list/scan, skill_level = SKILL_DEFAULT) //In case of problems, abort. diff --git a/code/_helpers/text.dm b/code/_helpers/text.dm index a264a7fff67a..cef6a0ba6e65 100644 --- a/code/_helpers/text.dm +++ b/code/_helpers/text.dm @@ -366,11 +366,22 @@ var/global/regex/starts_lowercase_regex = regex(@"^[a-z]") return trim_left(trim_right(text)) //Returns a string with the first element of the string capitalized. +// NOTE: This will not work if there are any HTML tags. /proc/capitalize(text) if(text) text = uppertext(text[1]) + copytext(text, 1 + length(text[1])) return text +// Returns a string with the first alphabetical element of the string capitalized, skipping HTML tags. +/proc/capitalize_proper_html(text) + var/static/regex/split_html_regex = regex(@"(^<[^>]*>)([A-Za-z])(.+)$") + if(!text) + return text + if(!split_html_regex.Find(text)) + return capitalize(text) + split_html_regex.group[2] = uppertext(split_html_regex.group[2]) + return JOINTEXT(split_html_regex.group) + //Returns a string with the first element of the every word of the string capitalized. /proc/capitalize_words(text) var/list/S = splittext(text, " ") @@ -784,6 +795,48 @@ var/global/list/plural_words_unchanged = list( word = "[jointext(splited, " ", 1, length(splited))] [word]" return word +var/global/list/copula_verbs = list("is" = TRUE, "am" = TRUE, "are" = TRUE) +var/global/list/has_verbs = list("has" = TRUE, "have" = TRUE) +var/global/list/does_verbs = list("does" = TRUE, "do" = TRUE) +var/global/list/agreement_exception_verbs = list("can" = TRUE, "cannot" = TRUE, "can't" = TRUE, "will" = TRUE, "won't" = TRUE, "shall" = TRUE, "shan't" = TRUE, "may" = TRUE, "must" = TRUE, "ought" = TRUE, "could" = TRUE, "would" = TRUE, "should" = TRUE) +/proc/verb_agree_with_pronouns(var/use_verb, var/decl/pronouns/use_pronouns, is_after_pronoun = TRUE) + // deal with compound verb phrases here! + // basically, skip all our adverbs, inflect only the first non-adverb word we find (which is hopefully a verb) and then keep everything after unchanged + // this will properly handle "successfully finish doing" and "properly manage to do" + // but not "somehow finish doing" which will get turned into "somehows finish doing" :( + // todo: fix that + var/list/words = splittext(use_verb, " ") + if(length(words) > 1) + var/last_adverb = 1 + for(var/word_index in 1 to length(words)) + if(text_ends_with(words[word_index], "ly")) + last_adverb = max(word_index, last_adverb) + use_verb = words[last_adverb] + // This overengineered nonsense ensures that we shouldn't end up with any doubled or missing spaces. + return jointext_no_nulls(list(jointext(words.Copy(1, last_adverb), " "), verb_agree_with_pronouns(use_verb, use_pronouns, is_after_pronoun = is_after_pronoun), jointext(words.Copy(last_adverb + 1, length(words) + 1), " ")), " ") + if(!is_after_pronoun && use_pronouns.pluralize_verb == /decl/pronouns::PLURALIZE_PSEUDO) + return use_verb // do not inflect pseudoplural unless after a pronoun + if(global.copula_verbs[use_verb]) + return use_pronouns.is + else if(global.has_verbs[use_verb]) + return use_pronouns.has + else if(global.does_verbs[use_verb]) + return use_pronouns.does + else if(global.agreement_exception_verbs[use_verb]) + return use_verb + // text_make_plural is intended for nouns, but should hopefully work for "fly" -> "flies" and similar. + switch(use_pronouns.pluralize_verb) + if(/decl/pronouns::PLURALIZE_NONE) + return use_verb + if(/decl/pronouns::PLURALIZE_PSEUDO) + // technically only the plural side can get hit here + // but better safe than sorry + return is_after_pronoun ? text_make_plural(use_verb) : use_verb + if(/decl/pronouns::PLURALIZE_ALL) + return text_make_plural(use_verb) + else + CRASH("Invalid value [use_pronouns.pluralize_verb] for [use_pronouns]!") + // Surely we have this defined somewhere already?? /proc/repeatstring(str, num) . = list() diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 6b3c62d1249e..840e6121527f 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -765,15 +765,17 @@ var/global/list/WALLITEMS = list( /**Returns a number string with its ordinal suffix th, st, nd, rd */ /proc/get_ordinal_string(var/num) - if(num < 10 && num > 20) //11, 12, 13 are exceptions in english, and just get 'th' like everything else + . = num + num %= 100 + if(num < 10 || num > 20) //11, 12, 13 are exceptions in english, and just get 'th' like everything else switch(num % 10) if(1) - return "[num]st" + return "[.]st" if(2) - return "[num]nd" + return "[.]nd" if(3) - return "[num]rd" - return "[num]th" + return "[.]rd" + return "[.]th" ///A do nothing proc used to prevent empty block warnings ///In hot code (like atmos checks), use EMPTY_BLOCK_GUARD instead. diff --git a/code/controllers/subsystems/event.dm b/code/controllers/subsystems/event.dm index e0abcf5b02c6..6412bef40015 100644 --- a/code/controllers/subsystems/event.dm +++ b/code/controllers/subsystems/event.dm @@ -28,10 +28,11 @@ SUBSYSTEM_DEF(event) /datum/controller/subsystem/event/Initialize() if(!event_containers) + // Order must conform to EVENT_LEVEL_MUNDANE, EVENT_LEVEL_MODERATE, EVENT_LEVEL_MAJOR. event_containers = list( - EVENT_LEVEL_MUNDANE = new global.using_map.event_container_mundane, - EVENT_LEVEL_MODERATE = new global.using_map.event_container_moderate, - EVENT_LEVEL_MAJOR = new global.using_map.event_container_major + new global.using_map.event_container_mundane, + new global.using_map.event_container_moderate, + new global.using_map.event_container_major ) all_events = null diff --git a/code/controllers/subsystems/fluids.dm b/code/controllers/subsystems/fluids.dm index 0b9faea243ed..b05b4ed11f8a 100644 --- a/code/controllers/subsystems/fluids.dm +++ b/code/controllers/subsystems/fluids.dm @@ -100,7 +100,7 @@ SUBSYSTEM_DEF(fluids) i++ current_fluid_holder = processing_fluids[i] - if(QDELETED(current_fluid_holder) || !current_fluid_holder.reagents?.total_volume) + if(QDELETED(current_fluid_holder) || !REAGENT_TOTAL_VOLUME(current_fluid_holder.reagents)) REMOVE_ACTIVE_FLUID(current_fluid_holder) continue @@ -110,7 +110,7 @@ SUBSYSTEM_DEF(fluids) reagent_holder = current_fluid_holder.reagents UPDATE_FLUID_BLOCKED_DIRS(current_fluid_holder) - current_depth = reagent_holder?.total_volume || 0 + current_depth = REAGENT_TOTAL_VOLUME(reagent_holder) // How is this happening if(QDELETED(reagent_holder) || current_depth == -1.#IND || current_depth == 1.#IND) @@ -123,7 +123,7 @@ SUBSYSTEM_DEF(fluids) current_depth = current_fluid_holder.get_fluid_depth() // Mimimum liquid depth for creation of slurries. Do this after evaporation since it may change the total depth. - if(reagent_holder?.total_liquid_volume < FLUID_SLURRY) + if(REAGENT_TOTAL_LIQUID_VOLUME(reagent_holder) < FLUID_SLURRY) current_fluid_holder.dump_solid_reagents() current_depth = current_fluid_holder.get_fluid_depth() @@ -135,7 +135,7 @@ SUBSYSTEM_DEF(fluids) // Wash our turf. current_fluid_holder.fluid_act(reagent_holder) - if(isspaceturf(current_fluid_holder) || (istype(current_fluid_holder, /turf/floor) && (current_fluid_holder.turf_flags & TURF_FLAG_ABSORB_LIQUID) && (current_fluid_holder.reagents?.total_volume + current_fluid_holder.get_physical_height()) > 0)) + if(isspaceturf(current_fluid_holder) || (istype(current_fluid_holder, /turf/floor) && (current_fluid_holder.turf_flags & TURF_FLAG_ABSORB_LIQUID) && (REAGENT_TOTAL_VOLUME(current_fluid_holder.reagents) + current_fluid_holder.get_physical_height()) > 0)) removing = round(current_depth * 0.5) if(removing > 0) current_fluid_holder.remove_fluids(removing, defer_update = TRUE) @@ -154,8 +154,9 @@ SUBSYSTEM_DEF(fluids) if(other_fluid_holder) UPDATE_FLUID_BLOCKED_DIRS(other_fluid_holder) if(!(other_fluid_holder.fluid_blocked_dirs & UP) && other_fluid_holder.CanFluidPass(UP)) - if(!QDELETED(other_fluid_holder) && other_fluid_holder.reagents?.total_volume < FLUID_MAX_DEPTH) - current_fluid_holder.transfer_fluids_to(other_fluid_holder, min(floor(current_depth*0.5), FLUID_MAX_DEPTH - other_fluid_holder.reagents?.total_volume)) + var/other_volume = REAGENT_TOTAL_VOLUME(other_fluid_holder.reagents) + if(!QDELETED(other_fluid_holder) && other_volume < FLUID_MAX_DEPTH) + current_fluid_holder.transfer_fluids_to(other_fluid_holder, min(floor(current_depth*0.5), FLUID_MAX_DEPTH - other_volume)) current_depth = current_fluid_holder.get_fluid_depth() // Flow into the lowest level neighbor. @@ -173,7 +174,7 @@ SUBSYSTEM_DEF(fluids) if((neighbor.fluid_blocked_dirs & coming_from) || !neighbor.CanFluidPass(coming_from) || neighbor.is_flooded(absolute = TRUE) || !neighbor.CanFluidPass(global.reverse_dir[spread_dir])) continue other_fluid_holder = neighbor - neighbor_depth = (other_fluid_holder?.reagents?.total_volume || 0) + neighbor.get_physical_height() + neighbor_depth = (REAGENT_TOTAL_VOLUME(other_fluid_holder.reagents)) + neighbor.get_physical_height() flow_amount = round((current_turf_depth - neighbor_depth)*0.5) // TODO: multiply flow amount or minimum transfer amount by some // viscosity calculation to allow for piles of jelly vs piles of water. @@ -235,7 +236,7 @@ SUBSYSTEM_DEF(fluids) if(current_fluid_holder.last_flow_strength >= 10) // Catwalks mean items will be above the turf; subtract the turf height from our volume. // TODO: somehow handle stuff that is on a catwalk or on the turf within the same turf. - var/effective_volume = current_fluid_holder.reagents?.total_volume + var/effective_volume = REAGENT_TOTAL_VOLUME(current_fluid_holder.reagents) if(current_fluid_holder.get_supporting_platform()) // Depth is negative height, hence +=. TODO: positive heights? No idea how to handle that. effective_volume += current_fluid_holder.get_physical_height() diff --git a/code/controllers/subsystems/jobs.dm b/code/controllers/subsystems/jobs.dm index 35519221dbfe..a166bb41242d 100644 --- a/code/controllers/subsystems/jobs.dm +++ b/code/controllers/subsystems/jobs.dm @@ -556,7 +556,7 @@ SUBSYSTEM_DEF(jobs) if(job.req_admin_notify) to_chat(H, "You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via adminhelp.") - if(H.needs_wheelchair()) + if(H.cannot_stand()) equip_wheelchair(H) BITSET(H.hud_updateflag, ID_HUD) diff --git a/code/datums/extensions/abilities/ability_decl.dm b/code/datums/extensions/abilities/ability_decl.dm index 9f271846750d..a3cb3726f89f 100644 --- a/code/datums/extensions/abilities/ability_decl.dm +++ b/code/datums/extensions/abilities/ability_decl.dm @@ -173,7 +173,7 @@ if(!prepare_to_cast(user, target, metadata, handler)) if(fail_cast_1p_str) - to_chat(user, SPAN_WARNING(capitalize(emote_replace_user_tokens(fail_cast_1p_str, user)))) + to_chat(user, SPAN_WARNING(capitalize_proper_html(emote_replace_user_tokens(fail_cast_1p_str, user)))) return if(projectile_type) @@ -209,25 +209,25 @@ /decl/ability/proc/show_cast_channel_msg(mob/user, atom/target, list/metadata) if(prepare_message_3p_str && prepare_message_1p_str) user.visible_message( - SPAN_NOTICE(capitalize(emote_replace_target_tokens(emote_replace_user_tokens(prepare_message_3p_str, user), target))), - SPAN_NOTICE(capitalize(emote_replace_target_tokens(prepare_message_1p_str, target))) + SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(emote_replace_user_tokens(prepare_message_3p_str, user), target))), + SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(prepare_message_1p_str, target))) ) else if(prepare_message_1p_str) - user.visible_message(SPAN_NOTICE(capitalize(emote_replace_target_tokens(prepare_message_1p_str, target)))) + user.visible_message(SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(prepare_message_1p_str, target)))) else if(prepare_message_3p_str) - user.visible_message(SPAN_NOTICE(capitalize(emote_replace_target_tokens(emote_replace_user_tokens(prepare_message_3p_str, user), target)))) + user.visible_message(SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(emote_replace_user_tokens(prepare_message_3p_str, user), target)))) /decl/ability/proc/show_ability_cast_msg(mob/user, list/targets, list/metadata) var/atom/target = targets[1] if(cast_message_3p_str && cast_message_1p_str) user.visible_message( - SPAN_NOTICE(capitalize(emote_replace_target_tokens(emote_replace_user_tokens(cast_message_3p_str, user), target))), - SPAN_NOTICE(capitalize(emote_replace_target_tokens(cast_message_1p_str, target))) + SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(emote_replace_user_tokens(cast_message_3p_str, user), target))), + SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(cast_message_1p_str, target))) ) else if(cast_message_1p_str) - user.visible_message(SPAN_NOTICE(capitalize(emote_replace_target_tokens(cast_message_1p_str, target)))) + user.visible_message(SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(cast_message_1p_str, target)))) else if(cast_message_3p_str) - user.visible_message(SPAN_NOTICE(capitalize(emote_replace_target_tokens(emote_replace_user_tokens(cast_message_3p_str, user), target)))) + user.visible_message(SPAN_NOTICE(capitalize_proper_html(emote_replace_target_tokens(emote_replace_user_tokens(cast_message_3p_str, user), target)))) /decl/ability/proc/prepare_to_cast(mob/user, atom/target, list/metadata, datum/ability_handler/handler) var/use_cooldown_time = get_cooldown_time(metadata) diff --git a/code/datums/extensions/abilities/ability_handler.dm b/code/datums/extensions/abilities/ability_handler.dm index 5ac742b00384..0b773cb469d5 100644 --- a/code/datums/extensions/abilities/ability_handler.dm +++ b/code/datums/extensions/abilities/ability_handler.dm @@ -226,7 +226,7 @@ if(!prepared_ability) return FALSE if(prepared_ability.cancel_ability_1p_str) - to_chat(owner, capitalize(emote_replace_user_tokens(prepared_ability.cancel_ability_1p_str), owner)) + to_chat(owner, capitalize_proper_html(emote_replace_user_tokens(prepared_ability.cancel_ability_1p_str), owner)) var/obj/screen/ability/button/button = LAZYACCESS(screen_elements, prepared_ability) prepared_ability = null if(istype(button)) @@ -238,7 +238,7 @@ return FALSE prepared_ability = ability if(ability.ready_ability_1p_str) - to_chat(owner, capitalize(emote_replace_user_tokens(ability.ready_ability_1p_str), owner)) + to_chat(owner, capitalize_proper_html(emote_replace_user_tokens(ability.ready_ability_1p_str), owner)) var/obj/screen/ability/button/button = LAZYACCESS(screen_elements, ability) if(istype(button)) button.update_icon() diff --git a/code/datums/extensions/milkable/milkable.dm b/code/datums/extensions/milkable/milkable.dm index a377c2293ce9..198dc791e7b7 100644 --- a/code/datums/extensions/milkable/milkable.dm +++ b/code/datums/extensions/milkable/milkable.dm @@ -73,7 +73,7 @@ if(critter.stat == DEAD) return FALSE - if(udder?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(udder) <= 0) to_chat(user, SPAN_WARNING("\The [critter]'s udder is dry. Wait a little longer.")) return TRUE @@ -108,7 +108,7 @@ if(critter.stat == DEAD) return FALSE - if(udder?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(udder) <= 0) to_chat(user, SPAN_WARNING("\The [critter]'s udder is dry. Wait a little longer.")) return TRUE diff --git a/code/datums/inventory_slots/_inventory_slot.dm b/code/datums/inventory_slots/_inventory_slot.dm index 6f23b1b51a10..086db0ce8990 100644 --- a/code/datums/inventory_slots/_inventory_slot.dm +++ b/code/datums/inventory_slots/_inventory_slot.dm @@ -171,6 +171,4 @@ /datum/inventory_slot/proc/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding) - if(user == owner) - return "You are wearing [_holding.get_examine_line()]." return "[pronouns.He] [pronouns.is] wearing [_holding.get_examine_line()]." diff --git a/code/datums/inventory_slots/inventory_gripper.dm b/code/datums/inventory_slots/inventory_gripper.dm index 2f87394ca74e..14140fc65fd1 100644 --- a/code/datums/inventory_slots/inventory_gripper.dm +++ b/code/datums/inventory_slots/inventory_gripper.dm @@ -25,8 +25,6 @@ /datum/inventory_slot/gripper/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding) var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(owner, slot_id) - if(user == owner) - return "You are holding [_holding.get_examine_line()] in your [E?.name || lowertext(slot_name)]." return "[pronouns.He] [pronouns.is] holding [_holding.get_examine_line()] in [pronouns.his] [E?.name || lowertext(slot_name)]." /datum/inventory_slot/gripper/can_equip_to_slot(var/mob/user, var/obj/item/prop, var/disable_warning) diff --git a/code/datums/inventory_slots/inventory_gripper_subtypes.dm b/code/datums/inventory_slots/inventory_gripper_subtypes.dm index bced228d5d54..0205f4785b21 100644 --- a/code/datums/inventory_slots/inventory_gripper_subtypes.dm +++ b/code/datums/inventory_slots/inventory_gripper_subtypes.dm @@ -23,8 +23,9 @@ // This means critters can hoover up beakers as a kind of impromptu chem disposal // technique, so long as they're okay with the reagents reacting inside them. - if(prop.reagents?.total_volume) - prop.reagents.trans_to_mob(src, prop.reagents.total_volume, CHEM_INGEST) + var/prop_reagents = REAGENT_TOTAL_VOLUME(prop.reagents) + if(prop_reagents) + prop.reagents.trans_to_mob(src, prop_reagents, CHEM_INGEST) // It also means they can do the old school cartoon schtick of eating // an entire sandwich and spitting up an empty plate. Ptooie. diff --git a/code/datums/inventory_slots/slots/slot_back.dm b/code/datums/inventory_slots/slots/slot_back.dm index 7c2496867edf..1f900ae9f4d6 100644 --- a/code/datums/inventory_slots/slots/slot_back.dm +++ b/code/datums/inventory_slots/slots/slot_back.dm @@ -15,6 +15,4 @@ /datum/inventory_slot/back/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding) - if(user == owner) - return "You have [_holding.get_examine_line()] on your back." return "[pronouns.He] [pronouns.has] [_holding.get_examine_line()] on [pronouns.his] back." diff --git a/code/datums/inventory_slots/slots/slot_belt.dm b/code/datums/inventory_slots/slots/slot_belt.dm index c2521798b6c8..636d8e8d8ee1 100644 --- a/code/datums/inventory_slots/slots/slot_belt.dm +++ b/code/datums/inventory_slots/slots/slot_belt.dm @@ -25,6 +25,4 @@ /datum/inventory_slot/belt/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding) - if(user == owner) - return "You have [_holding.get_examine_line()] about your waist." return "[pronouns.He] [pronouns.has] [_holding.get_examine_line()] about [pronouns.his] waist." diff --git a/code/datums/inventory_slots/slots/slot_cuffs.dm b/code/datums/inventory_slots/slots/slot_cuffs.dm index 9ff985ec94bc..5bbac50af5df 100644 --- a/code/datums/inventory_slots/slots/slot_cuffs.dm +++ b/code/datums/inventory_slots/slots/slot_cuffs.dm @@ -24,6 +24,4 @@ /datum/inventory_slot/handcuffs/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding) - if(user == owner) - return SPAN_WARNING("You are [html_icon(_holding)] restrained with \the [_holding]!") return SPAN_WARNING("[pronouns.He] [pronouns.is] [html_icon(_holding)] restrained with \the [_holding]!") diff --git a/code/datums/inventory_slots/slots/slot_ears.dm b/code/datums/inventory_slots/slots/slot_ears.dm index 1e905433cfc3..96cba77d68ac 100644 --- a/code/datums/inventory_slots/slots/slot_ears.dm +++ b/code/datums/inventory_slots/slots/slot_ears.dm @@ -22,8 +22,6 @@ /datum/inventory_slot/ear/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding && !(hideflags & HIDEEARS)) - if(user == owner) - return "You have [_holding.get_examine_line()] on your [lowertext(slot_name)]." return "[pronouns.He] [pronouns.has] [_holding.get_examine_line()] on [pronouns.his] [lowertext(slot_name)]." /datum/inventory_slot/ear/unequipped(var/mob/living/user, var/obj/item/prop, var/redraw_mob = TRUE) diff --git a/code/datums/inventory_slots/slots/slot_glasses.dm b/code/datums/inventory_slots/slots/slot_glasses.dm index d686ac93edb9..5d4bea87ae2b 100644 --- a/code/datums/inventory_slots/slots/slot_glasses.dm +++ b/code/datums/inventory_slots/slots/slot_glasses.dm @@ -15,6 +15,4 @@ /datum/inventory_slot/glasses/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding && !(hideflags & HIDEEYES)) - if(user == owner) - return "You have [_holding.get_examine_line()] covering your eyes." return "[pronouns.He] [pronouns.has] [_holding.get_examine_line()] covering [pronouns.his] eyes." diff --git a/code/datums/inventory_slots/slots/slot_gloves.dm b/code/datums/inventory_slots/slots/slot_gloves.dm index 3877aaf32cf1..c48572fbffa2 100644 --- a/code/datums/inventory_slots/slots/slot_gloves.dm +++ b/code/datums/inventory_slots/slots/slot_gloves.dm @@ -32,11 +32,7 @@ /datum/inventory_slot/gloves/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding && !(hideflags & HIDEGLOVES)) - if(user == owner) - return "You have [_holding.get_examine_line()] on your hands." return "[pronouns.He] [pronouns.has] [_holding.get_examine_line()] on [pronouns.his] hands." for(var/obj/item/organ/external/E in owner.get_hands_organs()) if(E.coating) - if(user == owner) - return "There's something on your hands!" return "There's something on [pronouns.his] hands!" diff --git a/code/datums/inventory_slots/slots/slot_mask.dm b/code/datums/inventory_slots/slots/slot_mask.dm index 53fa82f64213..319bbe36e9ff 100644 --- a/code/datums/inventory_slots/slots/slot_mask.dm +++ b/code/datums/inventory_slots/slots/slot_mask.dm @@ -39,12 +39,6 @@ /datum/inventory_slot/mask/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding && !(hideflags & HIDEMASK)) if(_holding.body_parts_covered & SLOT_FACE) - if(user == owner) - return "You are wearing [_holding.get_examine_line()] on your face." - else - return "[pronouns.He] [pronouns.is] wearing [_holding.get_examine_line()] on [pronouns.his] face." + return "[pronouns.He] [pronouns.is] wearing [_holding.get_examine_line()] on [pronouns.his] face." else - if(user == owner) - return "You are wearing [_holding.get_examine_line()] around your neck." - else - return "[pronouns.He] [pronouns.is] wearing [_holding.get_examine_line()] around [pronouns.his] neck." + return "[pronouns.He] [pronouns.is] wearing [_holding.get_examine_line()] around [pronouns.his] neck." diff --git a/code/datums/inventory_slots/slots/slot_shoes.dm b/code/datums/inventory_slots/slots/slot_shoes.dm index 6fc4889be0bd..44f7ce62aa4b 100644 --- a/code/datums/inventory_slots/slots/slot_shoes.dm +++ b/code/datums/inventory_slots/slots/slot_shoes.dm @@ -23,7 +23,7 @@ var/blood_color for(var/foot_tag in list(BP_L_FOOT, BP_R_FOOT)) var/obj/item/organ/external/stomper = GET_EXTERNAL_ORGAN(user, foot_tag) - if(stomper && stomper.coating?.total_volume) + if(REAGENT_TOTAL_VOLUME(stomper?.coating)) blood_color = stomper.coating.get_color() break if(blood_color) @@ -34,12 +34,8 @@ /datum/inventory_slot/shoes/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding && !(hideflags & HIDESHOES)) - if(user == owner) - return "You are wearing [_holding.get_examine_line()] on your feet." return "[pronouns.He] [pronouns.is] wearing [_holding.get_examine_line()] on [pronouns.his] feet." for(var/bp in list(BP_L_FOOT, BP_R_FOOT)) var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(owner, bp) - if(E && E.coating?.total_volume) - if(user == owner) - return "There's something on your feet!" + if(REAGENT_TOTAL_VOLUME(E?.coating)) return "There's something on [pronouns.his] feet!" diff --git a/code/datums/inventory_slots/slots/slot_suit_storage.dm b/code/datums/inventory_slots/slots/slot_suit_storage.dm index 832a72563294..6fb3f2e7e1df 100644 --- a/code/datums/inventory_slots/slots/slot_suit_storage.dm +++ b/code/datums/inventory_slots/slots/slot_suit_storage.dm @@ -23,6 +23,4 @@ /datum/inventory_slot/suit_storage/get_examined_string(mob/owner, mob/user, distance, hideflags, decl/pronouns/pronouns) if(_holding && !(hideflags & HIDESUITSTORAGE)) - if(user == owner) - return "[.]\nYou are carrying [_holding.get_examine_line()] on your [_holding.name]." return "[.]\n[pronouns.He] [pronouns.is] carrying [_holding.get_examine_line()] on [pronouns.his] [_holding.name]." diff --git a/code/datums/mind/mind.dm b/code/datums/mind/mind.dm index 1ffcf5a68b56..88afba2ce3ee 100644 --- a/code/datums/mind/mind.dm +++ b/code/datums/mind/mind.dm @@ -108,7 +108,7 @@ out += "
" out += "Objectives
" - if(objectives && objectives.len) + if(LAZYLEN(objectives)) var/num = 1 for(var/datum/objective/O in objectives) out += "Objective #[num]: [O.explanation_text] " diff --git a/code/datums/storage/_storage.dm b/code/datums/storage/_storage.dm index cead225909e9..9e5989f7e5d6 100644 --- a/code/datums/storage/_storage.dm +++ b/code/datums/storage/_storage.dm @@ -193,7 +193,7 @@ var/global/list/_test_storage_items = list() if(!M.try_unequip(inserting)) return FALSE - if(holder.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(holder.reagents)) inserting.fluid_act(holder.reagents) if(QDELETED(inserting)) return FALSE diff --git a/code/datums/storage/subtypes_box.dm b/code/datums/storage/subtypes_box.dm index 479c9460eb88..3803830d60f4 100644 --- a/code/datums/storage/subtypes_box.dm +++ b/code/datums/storage/subtypes_box.dm @@ -51,7 +51,7 @@ 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(removing, (atom_holder.reagents.total_volume/max(1, length(get_contents())))) + atom_holder.reagents.trans_to_obj(removing, (REAGENT_TOTAL_VOLUME(atom_holder.reagents)/max(1, length(get_contents())))) return ..() /datum/storage/box/cigarettes @@ -63,7 +63,7 @@ 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(removing, (atom_holder.reagents.total_volume/max(1, length(get_contents())))) + atom_holder.reagents.trans_to_obj(removing, (REAGENT_TOTAL_VOLUME(atom_holder.reagents)/max(1, length(get_contents())))) return ..() /datum/storage/box/cigarettes/cigarello diff --git a/code/datums/storage/subtypes_misc.dm b/code/datums/storage/subtypes_misc.dm index 5f51b0ffc9de..f2788e711e97 100644 --- a/code/datums/storage/subtypes_misc.dm +++ b/code/datums/storage/subtypes_misc.dm @@ -124,7 +124,7 @@ . = ..() if(!.) return - return inserting_item.reagents?.total_volume > 0 + return REAGENT_TOTAL_VOLUME(inserting_item.reagents) > 0 /datum/storage/photo_album storage_slots = DEFAULT_BOX_STORAGE //yes, that's storage_slots. Photos are w_class 1 so this has as many slots equal to the number of photos you could put in a box diff --git a/code/datums/trading/_trader.dm b/code/datums/trading/_trader.dm index a62d75f584e5..27444f108d19 100644 --- a/code/datums/trading/_trader.dm +++ b/code/datums/trading/_trader.dm @@ -67,7 +67,7 @@ /datum/trader/proc/add_to_pool(var/list/pool, var/list/possible, var/base_chance = 100, var/force = 0) var/divisor = 1 - if(pool && pool.len) + if(LAZYLEN(pool)) divisor = pool.len if(force || prob(base_chance/divisor)) var/new_item = get_possible_item(possible) @@ -160,7 +160,7 @@ return value /datum/trader/proc/offer_items_for_trade(var/list/offers, var/num, var/turf/location, skill = SKILL_MAX) - if(!offers || !offers.len) + if(!LAZYLEN(offers)) return TRADER_NOT_ENOUGH num = clamp(num, 1, trading_items.len) var/offer_worth = 0 @@ -229,7 +229,7 @@ return get_response(TRADER_COMPLIMENT_ACCEPT, "Thank you!") /datum/trader/proc/trade(var/list/offers, var/num, var/turf/location) - if(offers && offers.len) + if(LAZYLEN(offers)) for(var/offer in offers) if(ismob(offer)) var/text = mob_transfer_message @@ -263,7 +263,7 @@ /datum/trader/proc/sell_items(var/list/offers, skill = SKILL_MAX) if(!(trade_flags & TRADER_GOODS)) return TRADER_NO_GOODS - if(!offers || !offers.len) + if(!LAZYLEN(offers)) return TRADER_NOT_ENOUGH var/wanted diff --git a/code/datums/underwear/underwear.dm b/code/datums/underwear/underwear.dm index ff0813a3e9f5..d1d2c0a3ca75 100644 --- a/code/datums/underwear/underwear.dm +++ b/code/datums/underwear/underwear.dm @@ -67,7 +67,7 @@ var/global/datum/category_collection/underwear/underwear = new() var/obj/item/underwear/UW = new underwear_type() UW.SetName(underwear_name) - UW.gender = underwear_gender + UW.set_gender(underwear_gender) UW.icon = icon UW.icon_state = icon_state diff --git a/code/datums/uplink/uplink_sources.dm b/code/datums/uplink/uplink_sources.dm index 37f30e941cc9..69fe364a6c1d 100644 --- a/code/datums/uplink/uplink_sources.dm +++ b/code/datums/uplink/uplink_sources.dm @@ -122,7 +122,7 @@ var/global/list/default_uplink_source_priority = list( if(M.client && M.client.prefs) priority_order = M.client.prefs.uplink_sources - if(!priority_order || !priority_order.len) + if(!LAZYLEN(priority_order)) priority_order = list() for(var/entry in global.default_uplink_source_priority) priority_order |= GET_DECL(entry) diff --git a/code/game/antagonist/antagonist_objectives.dm b/code/game/antagonist/antagonist_objectives.dm index 51caf655579f..a4ad2463e7a9 100644 --- a/code/game/antagonist/antagonist_objectives.dm +++ b/code/game/antagonist/antagonist_objectives.dm @@ -1,7 +1,7 @@ /decl/special_role/proc/create_global_objectives(var/override=0) if(get_config_value(/decl/config/enum/objectives_disabled) != CONFIG_OBJECTIVE_ALL && !override) return 0 - if(global_objectives && global_objectives.len) + if(LAZYLEN(global_objectives)) return 0 return 1 diff --git a/code/game/antagonist/antagonist_panel.dm b/code/game/antagonist/antagonist_panel.dm index d34d47f6fe4d..2d4904c726ff 100644 --- a/code/game/antagonist/antagonist_panel.dm +++ b/code/game/antagonist/antagonist_panel.dm @@ -5,7 +5,7 @@ if(is_antagonist(player)) dat += "\[-\]" dat += "\[equip\]" - if(starting_locations && starting_locations.len) + if(LAZYLEN(starting_locations)) dat += "\[move to spawn\]" if(extra) dat += "[extra]" else @@ -19,7 +19,7 @@ /decl/special_role/proc/get_check_antag_output(var/datum/admins/calling_admin) - if(!current_antagonists || !current_antagonists.len) + if(!LAZYLEN(current_antagonists)) return "" var/dat = "
" diff --git a/code/game/antagonist/antagonist_place.dm b/code/game/antagonist/antagonist_place.dm index a81a4cb0dfb4..fb2210e8559a 100644 --- a/code/game/antagonist/antagonist_place.dm +++ b/code/game/antagonist/antagonist_place.dm @@ -21,7 +21,7 @@ return /decl/special_role/proc/place_mob(var/mob/living/mob) - if(!starting_locations || !starting_locations.len) + if(!LAZYLEN(starting_locations)) return var/turf/T = pick_mobless_turf_if_exists(starting_locations) mob.forceMove(T) diff --git a/code/game/antagonist/antagonist_print.dm b/code/game/antagonist/antagonist_print.dm index bcc921e5f413..dd875e8e0e17 100644 --- a/code/game/antagonist/antagonist_print.dm +++ b/code/game/antagonist/antagonist_print.dm @@ -19,7 +19,7 @@ text += "
Their goals for today were..." text += "
[ambitions.summarize()]" - if(global_objectives && global_objectives.len) + if(LAZYLEN(global_objectives)) text += "
Their objectives were:" var/num = 1 for(var/datum/objective/O in global_objectives) @@ -38,7 +38,7 @@ var/role if(ply.assigned_role) role = ply.assigned_role - else + else role = ply.get_special_role_name("unknown role") role = "\improper [role]" diff --git a/code/game/antagonist/station/provocateur.dm b/code/game/antagonist/station/provocateur.dm deleted file mode 100644 index 5bb230e89437..000000000000 --- a/code/game/antagonist/station/provocateur.dm +++ /dev/null @@ -1,12 +0,0 @@ -/decl/special_role/provocateur - name = "Provocateur" - name_plural = "Provocateurs" - antaghud_indicator = "hud_traitor" - flags = ANTAG_RANDOM_EXCEPTED - welcome_text = "You're an unsavoury sort, aren't you?" - antag_text = "This role is not a full license-to-kill antagonist role, but it does permit \ - you to make trouble, commit crimes and make a nusiance of yourself beyond the restrictions \ - normally placed on the crew, within reason. Think of it as a license to harass rather than \ - a license to kill." - blacklisted_jobs = list() - skill_setter = null diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 720499d4db30..452a1a0f3fa2 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -31,7 +31,8 @@ var/global/list/areas = list() var/lightswitch = TRUE var/requires_power = TRUE - var/always_unpowered = FALSE //this gets overriden to 1 for space in area/New() + /// Disables constructing or using APCs in this area. + var/always_unpowered = FALSE var/atmosalm = 0 var/power_equip = 1 // Status @@ -44,6 +45,8 @@ var/global/list/areas = list() var/oneoff_light = 0 var/oneoff_environ = 0 var/has_gravity = TRUE + /// If FALSE, this area is unable to have its gravity overridden by a gravity generator. Used on /area/space. + var/can_have_gravity = TRUE var/air_doors_activated = FALSE var/obj/machinery/apc/apc @@ -307,7 +310,7 @@ var/global/list/areas = list() #define DO_PARTY(COLOR) animate(color = COLOR, time = 0.5 SECONDS, easing = QUAD_EASING) /area/on_update_icon() - if((atmosalm || fire || eject || party) && (!requires_power||power_environ) && !istype(src, /area/space))//If it doesn't require power, can still activate this proc. + if((atmosalm || fire || eject || party) && (!requires_power||power_environ) && !always_unpowered)//If it doesn't require power, can still activate this proc. if(fire && !atmosalm && !eject && !party) // FIRE color = "#ff9292" animate(src) // stop any current animations. @@ -412,9 +415,8 @@ var/global/list/mob/living/forced_ambiance_list = new sound_to(L, sound(null, channel = sound_channels.lobby_channel)) forced_ambiance_list -= L -/area/proc/gravitychange(var/gravitystate = 0) +/area/proc/gravitychange(gravitystate = 0) has_gravity = gravitystate - for(var/mob/M in src) if(has_gravity) thunk(M) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 18af0e9a1886..28a1dc589ec6 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -164,7 +164,7 @@ /atom/proc/on_reagent_change() SHOULD_CALL_PARENT(TRUE) - if(storage && reagents?.total_volume) + if(storage && REAGENT_TOTAL_VOLUME(reagents)) for(var/obj/item/thing in get_stored_inventory()) thing.fluid_act(reagents) return TRUE @@ -445,9 +445,10 @@ * Most useful for calculating worth or deconstructing something along with its contents. */ /atom/proc/get_contained_matter(include_reagents = TRUE) - if(include_reagents && length(reagents?.reagent_volumes)) + var/list/reagent_volumes = REAGENT_VOLUMES(reagents) + if(include_reagents && length(reagent_volumes)) LAZYINITLIST(.) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in 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(include_reagents)) @@ -504,7 +505,7 @@ */ /atom/proc/try_detonate_reagents(var/severity = 3) if(reagents) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) reagent.explosion_act(src, severity) /** @@ -1026,13 +1027,13 @@ return istype(turf) ? turf.is_outside() : OUTSIDE_UNCERTAIN /atom/proc/can_be_poured_into(atom/source) - return (reagents?.maximum_volume > 0) && ATOM_IS_OPEN_CONTAINER(src) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) && ATOM_IS_OPEN_CONTAINER(src) /// This is whether it's physically possible to pour from this atom to the target atom, based on context like user intent and src being open, etc. /// This should not check things like whether there is actually anything in src to pour. /// It should also not check anything controlled by the target atom, because can_be_poured_into() already exists. /atom/proc/can_be_poured_from(mob/user, atom/target) - return (reagents?.maximum_volume > 0) && ATOM_IS_OPEN_CONTAINER(src) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) && ATOM_IS_OPEN_CONTAINER(src) /atom/proc/take_vaporized_reagent(reagent, amount) return @@ -1040,8 +1041,11 @@ /atom/proc/is_watertight() return !ATOM_IS_OPEN_CONTAINER(src) +/atom/proc/reaction_can_overflow(decl/chemical_reaction/reaction) + return ATOM_IS_OPEN_CONTAINER(src) + /atom/proc/can_drink_from(mob/user) - return ATOM_IS_OPEN_CONTAINER(src) && reagents?.total_volume && user.check_has_mouth() + return ATOM_IS_OPEN_CONTAINER(src) && REAGENT_TOTAL_VOLUME(reagents) && user.check_has_mouth() /atom/proc/adjust_required_attack_dexterity(mob/user, required_dexterity) if(storage) // TODO: possibly check can_be_inserted() to avoid being able to shoot mirrors as a drake. diff --git a/code/game/atoms_fluids.dm b/code/game/atoms_fluids.dm index bf49a3469c05..127ec73d713e 100644 --- a/code/game/atoms_fluids.dm +++ b/code/game/atoms_fluids.dm @@ -3,9 +3,12 @@ /atom/proc/fluid_act(var/datum/reagents/fluids) SHOULD_CALL_PARENT(TRUE) - if(reagents && reagents != fluids && fluids?.total_volume >= FLUID_SHALLOW && !is_watertight()) - reagents.trans_to_holder(fluids, reagents.total_volume) - fluids.trans_to_holder(reagents, min(fluids.total_volume, reagents.maximum_volume)) + if(reagents && reagents != fluids && !is_watertight()) + var/fluid_volume = REAGENT_TOTAL_VOLUME(fluids) + if(fluid_volume >= FLUID_SHALLOW) + var/reagent_volume = REAGENT_MAXIMUM_VOLUME(reagents) + reagents.trans_to_holder(fluids, reagent_volume) + fluids.trans_to_holder(reagents, fluid_volume, reagent_volume) /atom/proc/check_fluid_depth(var/min = 1) return 0 diff --git a/code/game/atoms_interactions.dm b/code/game/atoms_interactions.dm index 1f8c07525c1b..d4e352ba6835 100644 --- a/code/game/atoms_interactions.dm +++ b/code/game/atoms_interactions.dm @@ -40,5 +40,5 @@ var/global/list/_reagent_interactions = list( RETURN_TYPE(/list) if(storage) LAZYADD(., /decl/interaction_handler/storage_open) - if(reagents?.maximum_volume) + if(REAGENT_MAXIMUM_VOLUME(reagents)) LAZYADD(., global._reagent_interactions) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 0d998a4a5ec1..94c8602eefee 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -285,7 +285,7 @@ if(isturf(loc)) var/turf/T = loc - if(T.reagents?.total_volume && submerged()) + if(REAGENT_TOTAL_VOLUME(T.reagents) && submerged()) fluid_act(T.reagents) for(var/mob/viewer in storage?.storage_ui?.is_seeing) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index e6a2f45c19a4..584abf220f3f 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -134,7 +134,7 @@ var/global/list/additional_antag_types = list() to_world("The current game mode is [capitalize(name)]!") if(round_description) to_world("[round_description]") if(round_autoantag) to_world("Antagonists will be added to the round automagically as needed.") - if(antag_templates && antag_templates.len) + if(LAZYLEN(antag_templates)) var/antag_summary = "Possible antagonist types: " var/i = 1 for(var/decl/special_role/antag in antag_templates) @@ -170,7 +170,7 @@ var/global/list/additional_antag_types = list() if(!antag) continue var/list/potential = list() - if(antag_templates && antag_templates.len) + if(LAZYLEN(antag_templates)) if(antag.flags & ANTAG_OVERRIDE_JOB) potential = antag.pending_antagonists else @@ -327,7 +327,7 @@ var/global/list/additional_antag_types = list() /decl/game_mode/proc/check_finished() if(SSevac.evacuation_controller?.round_over() || station_was_nuked) return 1 - if(end_on_antag_death && antag_templates && antag_templates.len) + if(end_on_antag_death && LAZYLEN(antag_templates)) var/has_antags = 0 for(var/decl/special_role/antag in antag_templates) if(!antag.antags_are_dead()) diff --git a/code/game/jobs/job/_job.dm b/code/game/jobs/job/_job.dm index ddd275fdf323..6fe1006de269 100644 --- a/code/game/jobs/job/_job.dm +++ b/code/game/jobs/job/_job.dm @@ -23,7 +23,6 @@ var/minimum_character_age // List of species = age, if species is not here, it's auto-pass var/ideal_character_age = 30 // Preferred character age when populate job at roundstart. var/create_record = 1 // Do we announce/make records for people who spawn on this job? - var/is_semi_antagonist = FALSE // Whether or not this job is given semi-antagonist status. var/account_allowed = 1 // Does this job type come with a station account? var/economic_power = 2 // With how much does this job modify the initial account amount? var/is_holy = FALSE // Can this role perform blessings? @@ -401,8 +400,6 @@ var/list/reasons = list() if(jobban_isbanned(calling_client, title)) reasons["You are jobbanned."] = TRUE - if(is_semi_antagonist && jobban_isbanned(calling_client, /decl/special_role/provocateur)) - reasons["You are semi-antagonist banned."] = TRUE if(!player_old_enough(calling_client)) reasons["Your player age is too low."] = TRUE if(!is_position_available()) @@ -434,8 +431,6 @@ return FALSE if(jobban_isbanned(calling_client, title)) return FALSE - if(is_semi_antagonist && jobban_isbanned(calling_client, /decl/special_role/provocateur)) - return FALSE if(!player_old_enough(calling_client)) return FALSE return TRUE @@ -482,10 +477,9 @@ break return spawnpos +/// Used for applying "finishing touches" to characters, like additional role text or applying a /decl/special_role. /datum/job/proc/post_equip_job_title(var/mob/person, var/alt_title, var/rank) - if(is_semi_antagonist && person.mind) - var/decl/special_role/provocateur/provocateurs = GET_DECL(/decl/special_role/provocateur) - provocateurs.add_antagonist(person.mind) + return /datum/job/proc/get_alt_title_for(var/client/C) return C.prefs.GetPlayerAltTitle(src) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index dc25d0685b56..0d703b829e3b 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -59,7 +59,7 @@ to_chat(user, SPAN_WARNING("\The [src] cannot accept any more chemical canisters.")) return FALSE if(!emagged) - for(var/decl/material/reagent as anything in canister.reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(canister.reagents)) 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.")) @@ -125,7 +125,7 @@ . += SPAN_NOTICE("There are no chemical canisters loaded.") /obj/machinery/sleeper/proc/has_room_in_beaker() - return beaker && beaker.reagents.total_volume < beaker.reagents.maximum_volume + return beaker && REAGENT_TOTAL_VOLUME(beaker.reagents) < REAGENT_MAXIMUM_VOLUME(beaker.reagents) /obj/machinery/sleeper/Process() if(stat & (NOPOWER|BROKEN)) @@ -142,7 +142,8 @@ if(filtering) if(has_room_in_beaker()) - var/trans_volume = LAZYLEN(occupant.reagents?.reagent_volumes) + var/trans_volumes = REAGENT_VOLUMES(occupant.reagents) + var/trans_volume = LAZYLEN(trans_volumes) if(trans_volume) occupant.reagents.trans_to_obj(beaker, pump_speed * trans_volume) occupant.vessel.trans_to_obj(beaker, trans_volume + 1) @@ -153,7 +154,8 @@ if(has_room_in_beaker()) var/datum/reagents/ingested = occupant.get_ingested_reagents() if(ingested) - var/trans_volume = LAZYLEN(ingested.reagent_volumes) + var/trans_volumes = REAGENT_VOLUMES(ingested) + var/trans_volume = LAZYLEN(trans_volumes) if(trans_volume) ingested.trans_to_obj(beaker, pump_speed * trans_volume) else @@ -163,7 +165,8 @@ if(has_room_in_beaker()) var/datum/reagents/inhaled = occupant.get_inhaled_reagents() if(inhaled) - var/trans_volume = LAZYLEN(inhaled?.reagent_volumes) + var/trans_volumes = REAGENT_VOLUMES(inhaled) + var/trans_volume = LAZYLEN(trans_volumes) if(trans_volume) inhaled.trans_to_obj(beaker, pump_speed * trans_volume) else @@ -208,7 +211,7 @@ var/empties = 0 var/list/loaded_reagents = list() for(var/obj/item/chems/chem_disp_cartridge/canister in loaded_canisters) - if(!canister.reagents || !canister.reagents.total_volume) + if(!canister.reagents || !REAGENT_TOTAL_VOLUME(canister.reagents)) empties++ continue var/list/reagent = list() @@ -218,7 +221,7 @@ else reagent ["name"] = "unlabeled" reagent["id"] = "\ref[canister]" - reagent["amount"] = canister.reagents.total_volume + reagent["amount"] = REAGENT_TOTAL_VOLUME(canister.reagents) loaded_reagents += list(reagent) data["reagents"] = loaded_reagents data["empty_canisters"] = empties @@ -258,7 +261,7 @@ if(href_list["eject_empties"]) . = TOPIC_NOACTION for(var/obj/item/canister in loaded_canisters) - if(!canister.reagents || !canister.reagents.total_volume) + if(!canister.reagents || !REAGENT_TOTAL_VOLUME(canister.reagents)) eject_reagent_canister(null, canister) . = TOPIC_REFRESH if(href_list["eject"]) @@ -435,17 +438,16 @@ if(!istype(canister) || canister.loc != src) to_chat(user, SPAN_WARNING("\The [src] cannot locate that canister.")) return - if(canister.reagents?.total_volume < amount) + if(REAGENT_TOTAL_VOLUME(canister.reagents) < amount) to_chat(user, SPAN_WARNING("\The [canister] has less than [amount] unit\s left.")) return if(!occupant || !occupant.reagents) to_chat(user, SPAN_WARNING("There's no suitable occupant in \the [src].")) return - if(!emagged && 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 + var/decl/material/chem = canister.reagents?.get_primary_reagent_decl() + if(!emagged && chem?.overdose && REAGENT_VOLUME(occupant.reagents, chem) + amount >= chem.overdose) + to_chat(user, SPAN_WARNING("Injecting more [chem.name] presents an overdose risk to the subject.")) + return canister.reagents.trans_to_mob(occupant, amount, target_transfer_type) to_chat(user, SPAN_NOTICE("You use \the [src] to [target_transfer_type == CHEM_INJECT ? "inject" : "infuse"] [amount] unit\s from \the [canister] into \the [occupant].")) diff --git a/code/game/machinery/_machines_base/machinery.dm b/code/game/machinery/_machines_base/machinery.dm index 0a6de242520c..eb27136f261c 100644 --- a/code/game/machinery/_machines_base/machinery.dm +++ b/code/game/machinery/_machines_base/machinery.dm @@ -472,7 +472,7 @@ Class Procs: // This is really pretty crap and should be overridden for specific machines. /obj/machinery/fluid_act(var/datum/reagents/fluids) ..() - if(!QDELETED(src) && !(stat & (NOPOWER|BROKEN)) && !waterproof && (fluids?.total_volume > FLUID_DEEP)) + if(!QDELETED(src) && !(stat & (NOPOWER|BROKEN)) && !waterproof && (REAGENT_TOTAL_VOLUME(fluids) > FLUID_DEEP)) explosion_act(3) /obj/machinery/Move() diff --git a/code/game/machinery/_machines_base/machinery_components.dm b/code/game/machinery/_machines_base/machinery_components.dm index d4fecb27c52d..da820f74e750 100644 --- a/code/game/machinery/_machines_base/machinery_components.dm +++ b/code/game/machinery/_machines_base/machinery_components.dm @@ -33,7 +33,7 @@ var/global/list/machine_path_to_circuit_type LAZYINITLIST(uncreated_component_parts) for(var/type in req_components) uncreated_component_parts[type] += (req_components[type] || 1) - if(initial_access && length(initial_access) > 0) + if(LAZYLEN(initial_access) > 0) for(var/access_list in initial_access) // Each part is an AND component. var/obj/item/stock_parts/network_receiver/network_lock/lock = install_component(/obj/item/stock_parts/network_receiver/network_lock/buildable, refresh_parts = FALSE) diff --git a/code/game/machinery/_machines_base/machinery_public_vars_common.dm b/code/game/machinery/_machines_base/machinery_public_vars_common.dm index 8906b31d08c5..82739c5e4f02 100644 --- a/code/game/machinery/_machines_base/machinery_public_vars_common.dm +++ b/code/game/machinery/_machines_base/machinery_public_vars_common.dm @@ -104,7 +104,7 @@ Public vars at /obj/machinery level. Just because they are here does not mean th var_type = VAR_FORMAT_LIST /decl/public_access/public_variable/reagents/access_var(obj/machinery/machine) - return machine?.reagents?.reagent_data + return istype(machine?.reagents) ? UNLINT(machine.reagents.reagent_data) : null /decl/public_access/public_variable/reagents/volumes name = "reagents volumes" @@ -112,7 +112,7 @@ Public vars at /obj/machinery level. Just because they are here does not mean th var_type = VAR_FORMAT_LIST /decl/public_access/public_variable/reagents/volumes/access_var(obj/machinery/machine) - return machine?.reagents?.reagent_volumes + return istype(machine?.reagents) ? UNLINT(REAGENT_VOLUMES(machine.reagents)) : null /decl/public_access/public_variable/reagents/free_space name = "reagents free space" @@ -128,7 +128,7 @@ Public vars at /obj/machinery level. Just because they are here does not mean th var_type = VAR_FORMAT_NUMBER /decl/public_access/public_variable/reagents/total_volume/access_var(obj/machinery/machine) - return machine?.reagents?.total_volume + return REAGENT_TOTAL_VOLUME(machine?.reagents) /decl/public_access/public_variable/reagents/maximum_volume name = "reagents maximum volume" @@ -136,7 +136,7 @@ Public vars at /obj/machinery level. Just because they are here does not mean th var_type = VAR_FORMAT_NUMBER /decl/public_access/public_variable/reagents/maximum_volume/access_var(obj/machinery/machine) - return machine?.reagents?.maximum_volume + return REAGENT_MAXIMUM_VOLUME(machine?.reagents) /decl/public_access/public_method/toggle_power name = "toggle power" diff --git a/code/game/machinery/centrifuge.dm b/code/game/machinery/centrifuge.dm index 217e63809e5e..f992197e156e 100644 --- a/code/game/machinery/centrifuge.dm +++ b/code/game/machinery/centrifuge.dm @@ -5,7 +5,7 @@ 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(REAGENT_TOTAL_VOLUME(thing.reagents) <= 0) if(user) to_chat(user, SPAN_WARNING("\The [thing] is empty.")) return FALSE diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index 13b2847b3440..37b55f182398 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -26,7 +26,7 @@ continue // Out of range if(!chem_implant.implanted) continue - dat += "[chem_implant.imp_in.name] | Remaining Units: [chem_implant.reagents.total_volume] | Inject: " + dat += "[chem_implant.imp_in.name] | Remaining Units: [REAGENT_TOTAL_VOLUME(chem_implant.reagents)] | Inject: " dat += "((1))" dat += "((5))" dat += "((10))
" diff --git a/code/game/machinery/cracker.dm b/code/game/machinery/cracker.dm index 2de58f1e211c..9c6951170b78 100644 --- a/code/game/machinery/cracker.dm +++ b/code/game/machinery/cracker.dm @@ -40,19 +40,21 @@ if(use_power == POWER_USE_IDLE) return - // Produce materials. var/turf/T = get_turf(src) - if(istype(T) && T.reagents?.total_volume) - - // Drink more water! - var/consuming = min(T.reagents.total_volume, fluid_consumption_per_tick) - T.remove_any_reagents(consuming) - T.show_bubbles() - - // Gas production. - var/datum/gas_mixture/produced = new - var/gen_amt = min(1, (gas_generated_per_tick * (consuming/fluid_consumption_per_tick))) - produced.adjust_gas(/decl/material/gas/oxygen, gen_amt) - produced.adjust_gas(/decl/material/gas/hydrogen, gen_amt * 2) - produced.temperature = T20C //todo water temperature - air_contents.merge(produced) + if(!istype(T)) + return + + var/local_fluid = REAGENT_VOLUME(T.reagents, /decl/material/liquid/water) // TODO: make this some list on the material? + if(local_fluid <= 0) + return + + var/consuming = min(REAGENT_TOTAL_VOLUME(T.reagents), fluid_consumption_per_tick) + T.remove_any_reagents(consuming) + T.show_bubbles() + + var/datum/gas_mixture/produced = new + var/gen_amt = min(1, (gas_generated_per_tick * (consuming/fluid_consumption_per_tick))) + produced.adjust_gas(/decl/material/gas/oxygen, gen_amt) + produced.adjust_gas(/decl/material/gas/hydrogen, gen_amt * 2) + produced.temperature = T20C //todo water temperature + air_contents.merge(produced) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 7a0bf2fccd41..fd685f5d9a8f 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -386,7 +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))) + visible_message(SPAN_NOTICE(capitalize_proper_html(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) @@ -398,7 +398,7 @@ return if(!user.incapacitated() && !user.anchored && user.Adjacent(src) && user.Adjacent(target)) if(target == user) - visible_message(SPAN_NOTICE(emote_replace_user_tokens(emote_replace_target_tokens(on_enter_visible_message, src), usr)), range = 3) + visible_message(SPAN_NOTICE(capitalize_proper_html(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)) diff --git a/code/game/machinery/kitchen/cooking_machines/_cooker.dm b/code/game/machinery/kitchen/cooking_machines/_cooker.dm index a340029c6599..0eeac4289ae0 100644 --- a/code/game/machinery/kitchen/cooking_machines/_cooker.dm +++ b/code/game/machinery/kitchen/cooking_machines/_cooker.dm @@ -131,8 +131,9 @@ cook_path = /obj/item/food/variable var/obj/item/food/result = new cook_path(src) //Holy typepaths, Batman. - if(cooking_obj.reagents && cooking_obj.reagents.total_volume) - cooking_obj.reagents.trans_to(result, cooking_obj.reagents.total_volume) + var/cooking_reagents = REAGENT_TOTAL_VOLUME(cooking_obj.reagents) + if(cooking_reagents > 0) + cooking_obj.reagents.trans_to(result, cooking_reagents) // Set icon and appearance. change_product_appearance(result) diff --git a/code/game/machinery/kitchen/icecream.dm b/code/game/machinery/kitchen/icecream.dm index f4a52486e668..01586b8549e9 100644 --- a/code/game/machinery/kitchen/icecream.dm +++ b/code/game/machinery/kitchen/icecream.dm @@ -96,11 +96,11 @@ dat += "Chocolate cones:DispenseMakex5 [product_types[CONE_CHOC]] cones left. (Ingredients: flour, sugar, coco powder)
" dat += "
" dat += "VAT CONTENT
" - for(var/decl/material/reagent as anything in reagents?.liquid_volumes) + for(var/decl/material/reagent as anything in REAGENT_LIQUID_VOLUMES(reagents)) dat += "[reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID)]: [LIQUID_VOLUME(reagents, reagent)]" dat += "Purge
" - for(var/decl/material/reagent as anything in reagents?.solid_volumes) + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(reagents)) dat += "[reagent.get_reagent_name(reagents, MAT_PHASE_SOLID)]: [SOLID_VOLUME(reagents, reagent)]" dat += "Purge
" @@ -120,8 +120,9 @@ icecream.add_ice_cream(flavour_name) // if(beaker) // 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) + var/icecream_volume = REAGENT_TOTAL_VOLUME(icecream.reagents) + if(icecream_volume < 10) + icecream.add_to_reagents(/decl/material/liquid/nutriment/sugar, 10 - icecream_volume) else to_chat(user, "There is not enough icecream left!") else diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index 1455ec5907ac..2e0e8d8d14ad 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -180,8 +180,9 @@ for(var/obj/used_item in get_contained_external_atoms()) data["cooking_items"][used_item.name]++ data["cooking_reagents"] = list() - for(var/decl/material/reagent as anything in reagents.reagent_volumes) - data["cooking_reagents"][reagent.name] = reagents.reagent_volumes[reagent] + var/reagent_volumes = REAGENT_VOLUMES(reagents) + for(var/decl/material/reagent as anything in reagent_volumes) + data["cooking_reagents"][reagent.name] = reagent_volumes[reagent] data["on"] = !!operating data["broken"] = broken > 0 data["dirty"] = dirty >= 100 @@ -209,12 +210,13 @@ if(stat & (NOPOWER|BROKEN)) return - if (!reagents.total_volume && !length(get_contained_external_atoms())) //dry run + var/reagent_volume = REAGENT_TOTAL_VOLUME(reagents) + if (!reagent_volume && !length(get_contained_external_atoms())) //dry run start() return - if (reagents.total_volume && prob(50)) // 50% chance a liquid recipe gets messy - dirty += ceil(reagents.total_volume / 10) + if (reagent_volume && prob(50)) // 50% chance a liquid recipe gets messy + dirty += ceil(reagent_volume / 10) var/decl/recipe/recipe = select_recipe(RECIPE_CATEGORY_MICROWAVE, src, cooking_temperature) if (!recipe) @@ -253,7 +255,7 @@ break //Any leftover reagents are divided amongst the foods - var/total = reagents.total_volume + var/total = REAGENT_TOTAL_VOLUME(reagents) for (var/obj/item/I in cooked_items) reagents.trans_to_holder(I.reagents, total/cooked_items.len) I.dropInto(loc) // since eject only ejects ingredients! @@ -347,11 +349,12 @@ /obj/machinery/microwave/proc/dispose(var/mob/user, var/message = TRUE) var/list/ingredients = get_contained_external_atoms() - if (!LAZYLEN(ingredients) && !reagents.total_volume) + var/reagent_volume = REAGENT_TOTAL_VOLUME(reagents) + if (!LAZYLEN(ingredients) && !reagent_volume) return for (var/obj/thing in ingredients) thing.dropInto(loc) - if (reagents.total_volume) + if (reagent_volume) dirty++ reagents.clear_reagents() if(user && message) @@ -367,7 +370,7 @@ SSnano.update_uis(src) /obj/machinery/microwave/proc/eject_reagent(var/mob/user, var/decl/material/reagent) - if(!reagents.reagent_volumes[reagent]) + if(!REAGENT_VOLUME(reagents, 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() @@ -404,8 +407,9 @@ for (var/obj/thing in ingredients) amount++ - if (thing.reagents && thing.reagents.primary_reagent) - amount += REAGENT_VOLUME(thing.reagents, thing.reagents.primary_reagent) + var/thing_reagent = istype(thing.reagents) && thing.reagents.get_primary_reagent_decl() + if (thing_reagent) + amount += REAGENT_VOLUME(thing.reagents, thing_reagent) qdel(thing) reagents.clear_reagents() SSnano.update_uis(src) @@ -432,7 +436,7 @@ return TOPIC_REFRESH if ("ejectreagent") - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.name == href_list["target"]) eject_reagent(user, reagent) break diff --git a/code/game/machinery/smartfridge/foods.dm b/code/game/machinery/smartfridge/foods.dm index 1d3cf0d5b89e..b023cc97a94b 100644 --- a/code/game/machinery/smartfridge/foods.dm +++ b/code/game/machinery/smartfridge/foods.dm @@ -11,4 +11,4 @@ /obj/item/chems/glass/bowl, /obj/item/chems/glass/handmade/bowl ) - return istype(O) && O.reagents?.total_volume && is_type_in_list(O, _food_types) + return istype(O) && REAGENT_TOTAL_VOLUME(O.reagents) && is_type_in_list(O, _food_types) diff --git a/code/game/machinery/vending/_vending.dm b/code/game/machinery/vending/_vending.dm index 0587601e9378..5fa543120f98 100644 --- a/code/game/machinery/vending/_vending.dm +++ b/code/game/machinery/vending/_vending.dm @@ -404,6 +404,11 @@ SSnano.update_uis(src) +/// Used to get a slogan to say in Process(). +/// If you want to do things like non-constant token replacement you can do that in an override. +/obj/machinery/vending/proc/get_slogan() + return pick(slogan_list) + /obj/machinery/vending/Process() if(stat & (BROKEN|NOPOWER)) return @@ -415,8 +420,8 @@ seconds_electrified-- //Pitch to the people! Really sell it! - if(((last_slogan + slogan_delay) <= world.time) && (slogan_list.len > 0) && (!shut_up) && prob(5)) - var/slogan = pick(slogan_list) + if(((last_slogan + slogan_delay) <= world.time) && length(slogan_list) && (!shut_up) && prob(5)) + var/slogan = get_slogan() speak(slogan) last_slogan = world.time diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index 1113f10ec678..00387a12bbbc 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -65,7 +65,7 @@ /obj/machinery/washing_machine/proc/wash() if(operable()) var/list/washing_atoms = get_contained_external_atoms() - var/amount_per_atom = floor(reagents.total_volume / length(washing_atoms)) + var/amount_per_atom = floor(REAGENT_TOTAL_VOLUME(reagents) / length(washing_atoms)) if(amount_per_atom > 0) var/decl/material/smelliest = get_smelliest_reagent(reagents) @@ -94,13 +94,13 @@ 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) + if(REAGENT_TOTAL_VOLUME(reagents) >= REAGENT_MAXIMUM_VOLUME(reagents)) to_chat(user, SPAN_WARNING("The detergent port is full!")) return TRUE if(!user.try_unequip(used_item)) return TRUE // Directly transfer to the holder to avoid touch reactions. - used_item.reagents?.trans_to_holder(reagents, used_item.reagents.total_volume) + used_item.reagents?.trans_to_holder(reagents, REAGENT_TOTAL_VOLUME(used_item.reagents)) to_chat(user, SPAN_NOTICE("You dissolve \the [used_item] in the detergent port.")) qdel(used_item) return TRUE @@ -200,7 +200,7 @@ to_chat(user, SPAN_WARNING("\The [src] isn't functioning!")) return - if(!reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_WARNING("There are no cleaning products loaded in \the [src]!")) return diff --git a/code/game/objects/__objs.dm b/code/game/objects/__objs.dm index 7295fe42516e..01cc88b50e31 100644 --- a/code/game/objects/__objs.dm +++ b/code/game/objects/__objs.dm @@ -269,7 +269,7 @@ */ /obj/proc/initialize_reagents(var/populate = TRUE) SHOULD_CALL_PARENT(TRUE) - if(reagents?.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(reagents) > 0) log_warning("\The [src] possibly is initializing its reagents more than once!") create_or_update_reagents(chem_volume) if(populate) @@ -331,7 +331,7 @@ /obj/fluid_act(var/datum/reagents/fluids) ..() - if(!QDELETED(src) && fluids?.total_volume) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids)) fluids.touch_obj(src) // TODO: maybe iterate the entire matter list or do some partial damage handling @@ -345,8 +345,9 @@ . = ..() if(QDELETED(src)) return - if(reagents?.total_volume) - reagents.trans_to(loc, reagents.total_volume) + var/reagent_volume = REAGENT_TOTAL_VOLUME(reagents) + if(reagent_volume) + reagents.trans_to(loc, reagent_volume) dump_contents() return place_melted_product(meltable_materials) @@ -424,12 +425,12 @@ /obj/physically_destroyed(skip_qdel) var/dumped_reagents = FALSE var/atom/last_loc = loc - if(last_loc && reagents?.total_volume) - reagents.trans_to(loc, reagents.total_volume, defer_update = TRUE) + if(last_loc && REAGENT_TOTAL_VOLUME(reagents)) + reagents.trans_to(loc, REAGENT_TOTAL_VOLUME(reagents), defer_update = TRUE) dumped_reagents = TRUE reagents.clear_reagents() // We are qdeling, don't bother with a more nuanced update. . = ..() - if(dumped_reagents && last_loc && !QDELETED(last_loc) && last_loc.reagents?.total_volume) + if(dumped_reagents && last_loc && !QDELETED(last_loc) && REAGENT_TOTAL_VOLUME(last_loc.reagents)) last_loc.reagents.handle_update() HANDLE_REACTIONS(last_loc.reagents) diff --git a/code/game/objects/_objs_edibility.dm b/code/game/objects/_objs_edibility.dm index 65fc62ced6a4..ed8f1000448a 100644 --- a/code/game/objects/_objs_edibility.dm +++ b/code/game/objects/_objs_edibility.dm @@ -151,12 +151,12 @@ show_feed_message_start(user, target, consumption_method) if(!do_mob(user, target)) return EATEN_UNABLE - var/contained = json_encode(REAGENT_LIST(src)) + var/contained = json_encode(REAGENT_LIST(reagents)) admin_attack_log(user, target, "Fed the victim with [name] (Reagents: [contained])", "Was fed [src] (Reagents: [contained])", "used [src] (Reagents: [contained]) to feed") 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/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) target.update_personal_goal(/datum/goal/achievement/specific_object/drink, reagent) handle_consumed(user, target, consumption_method) diff --git a/code/game/objects/effects/chem/chemsmoke.dm b/code/game/objects/effects/chem/chemsmoke.dm index 1305d6ee4112..ff08e746ae14 100644 --- a/code/game/objects/effects/chem/chemsmoke.dm +++ b/code/game/objects/effects/chem/chemsmoke.dm @@ -106,7 +106,7 @@ /datum/effect/effect/system/smoke_spread/chem/set_up(var/datum/reagents/carry = null, n = 10, c = 0, loca, direct) range = n * 0.3 cardinals = c - carry.trans_to_obj(chemholder, carry.total_volume, copy = 1) + carry.trans_to_obj(chemholder, REAGENT_TOTAL_VOLUME(carry), copy = 1) if(istype(loca, /turf/)) location = loca @@ -157,7 +157,8 @@ if(!location) return - if(LAZYLEN(chemholder.reagents.reagent_volumes)) + var/trans_volumes = REAGENT_VOLUMES(chemholder.reagents) + if(LAZYLEN(trans_volumes)) for(var/turf/T in (wallList|targetTurfs)) chemholder.reagents.touch_turf(T) @@ -216,8 +217,9 @@ else smoke = new /obj/effect/effect/smoke/chem(location, smoke_duration + rand(0, 20), T, I) - if(LAZYLEN(chemholder.reagents.reagent_volumes)) - chemholder.reagents.trans_to_obj(smoke, chemholder.reagents.total_volume / dist, copy = 1) //copy reagents to the smoke so mob/breathe() can handle inhaling the reagents + var/trans_volumes = REAGENT_VOLUMES(chemholder.reagents) + if(LAZYLEN(trans_volumes)) + chemholder.reagents.trans_to_obj(smoke, REAGENT_TOTAL_VOLUME(chemholder.reagents) / dist, copy = 1) //copy reagents to the smoke so mob/breathe() can handle inhaling the reagents //Kinda ugly, but needed unless the system is reworked if(splash_initial) diff --git a/code/game/objects/effects/chem/foam.dm b/code/game/objects/effects/chem/foam.dm index a961e82da284..56e37741123b 100644 --- a/code/game/objects/effects/chem/foam.dm +++ b/code/game/objects/effects/chem/foam.dm @@ -57,8 +57,8 @@ F = new(T, metal) F.amount = amount - if(!metal && reagents?.total_volume) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(!metal && REAGENT_TOTAL_VOLUME(reagents)) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) 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 @@ -92,7 +92,7 @@ // 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/decl/material/reagent as anything in carry.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(carry)) carried_reagents += reagent /datum/effect/effect/system/foam_spread/start() diff --git a/code/game/objects/effects/chem/water.dm b/code/game/objects/effects/chem/water.dm index aafbd41b47df..5f7beccd2297 100644 --- a/code/game/objects/effects/chem/water.dm +++ b/code/game/objects/effects/chem/water.dm @@ -34,15 +34,16 @@ //each step splash 1/5 of the reagents on non-mobs //could determine the # of steps until target, but that would be complicated + // TODO: fix this logic so it isn't using an increasingly smaller amount each iteration. for(var/atom/A in splash_others) - reagents.splash(A, (reagents.total_volume/step_count)/splash_others.len) + reagents.splash(A, (REAGENT_TOTAL_VOLUME(reagents)/step_count)/splash_others.len) for(var/mob/living/M in splash_mobs) - reagents.splash(M, reagents.total_volume/splash_mobs.len) - if(reagents.total_volume < 1) + reagents.splash(M, REAGENT_TOTAL_VOLUME(reagents)/splash_mobs.len) + if(REAGENT_TOTAL_VOLUME(reagents) < 1) break if(T == get_turf(target)) for(var/atom/A in splash_others) - reagents.splash(A, reagents.total_volume/splash_others.len) //splash anything left + reagents.splash(A, REAGENT_TOTAL_VOLUME(reagents)/splash_others.len) //splash anything left break sleep(delay) diff --git a/code/game/objects/effects/decals/Cleanable/misc.dm b/code/game/objects/effects/decals/Cleanable/misc.dm index 6758e59d78c8..634c454322af 100644 --- a/code/game/objects/effects/decals/Cleanable/misc.dm +++ b/code/game/objects/effects/decals/Cleanable/misc.dm @@ -101,7 +101,7 @@ /obj/effect/decal/cleanable/vomit/Crossed(atom/movable/AM) . = ..() - if(!QDELETED(src) && reagents?.total_volume >= 1 && isliving(AM)) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(reagents) >= 1 && isliving(AM)) var/mob/living/walker = AM walker.add_walking_contaminant(reagents, rand(2, 3)) diff --git a/code/game/objects/effects/decals/Cleanable/tracks.dm b/code/game/objects/effects/decals/Cleanable/tracks.dm index d2e28c977da5..0b839df5ebea 100644 --- a/code/game/objects/effects/decals/Cleanable/tracks.dm +++ b/code/game/objects/effects/decals/Cleanable/tracks.dm @@ -27,7 +27,7 @@ /obj/effect/decal/cleanable/blood/tracks/reveal_blood() // don't reveal non-blood tracks if(ispath(chemical, /decl/material/liquid/blood) && !fluorescent) - if(stack && stack.len) + if(LAZYLEN(stack)) for(var/datum/fluidtrack/track in stack) track.basecolor = COLOR_LUMINOL ..() diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index d8cd0b321ec1..036251e4ea38 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -72,7 +72,7 @@ /obj/effect/decal/cleanable/fluid_act(var/datum/reagents/fluid) SHOULD_CALL_PARENT(FALSE) - if(fluid?.total_liquid_volume && !QDELETED(src)) - if(reagents?.total_volume) - reagents.trans_to(fluid, reagents.total_volume) + if(REAGENT_TOTAL_LIQUID_VOLUME(fluid) && !QDELETED(src)) + if(REAGENT_TOTAL_VOLUME(reagents)) + reagents.trans_to(fluid, REAGENT_TOTAL_VOLUME(reagents)) qdel(src) diff --git a/code/game/objects/items/__item.dm b/code/game/objects/items/__item.dm index 5c0a8f52c946..f548bcbfada6 100644 --- a/code/game/objects/items/__item.dm +++ b/code/game/objects/items/__item.dm @@ -414,7 +414,7 @@ if(drying_wetness > 0 && drying_wetness != initial(drying_wetness)) desc_comp += "\The [src] is [get_dryness_text()]." - if(coating?.total_volume) + if(REAGENT_TOTAL_VOLUME(coating)) desc_comp += "It is covered in [coating.get_coated_name()]." // It is covered in dilute oily slimy bloody mud. if(check_rights(R_DEBUG, 0, user)) @@ -1057,14 +1057,14 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. if(!coating) return coating.remove_any(amount) - if(coating.total_volume <= MINIMUM_CHEMICAL_VOLUME) + if(REAGENT_TOTAL_VOLUME(coating) <= MINIMUM_CHEMICAL_VOLUME) clean(FALSE) /obj/item/proc/transfer_coating_to(atom/target, amount = 1, multiplier = 1, copy = 0, defer_update = FALSE, transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) if(!coating) return coating.trans_to(target, amount, multiplier) - if(coating.total_volume <= MINIMUM_CHEMICAL_VOLUME) + if(REAGENT_TOTAL_VOLUME(coating) <= MINIMUM_CHEMICAL_VOLUME) clean(FALSE) /obj/item/clean(clean_forensics=TRUE) @@ -1211,9 +1211,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/decl/material/reagent as anything in reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.fishing_bait_value) - . += reagents.reagent_volumes[reagent] * reagent.fishing_bait_value * BAIT_VALUE_CONSTANT + . += REAGENT_VOLUME(reagents, reagent) * reagent.fishing_bait_value * BAIT_VALUE_CONSTANT #undef BAIT_VALUE_CONSTANT /obj/item/proc/get_storage_cost() @@ -1277,7 +1277,7 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. /// @returns: /// - reagent_overlay as /image|null - the overlay image representing the reagents in this object /obj/item/proc/get_reagents_overlay(state_prefix) - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) return var/decl/material/primary_reagent = reagents.get_primary_reagent_decl() if(!primary_reagent) @@ -1292,7 +1292,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/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(!reagent.reagent_overlay) continue var/modified_reagent_overlay = state_prefix ? "[state_prefix]_[reagent.reagent_overlay]" : reagent.reagent_overlay @@ -1304,7 +1304,7 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. /obj/item/on_reagent_change() . = ..() // You can't put liquids in clay/sand/dirt vessels, sorry. - if(reagents?.total_liquid_volume > 0 && material && material.hardness <= MAT_VALUE_MALLEABLE && !QDELETED(src)) + if(REAGENT_TOTAL_LIQUID_VOLUME(reagents) > 0 && material && material.hardness <= MAT_VALUE_MALLEABLE && !QDELETED(src)) visible_message(SPAN_DANGER("\The [src] falls apart!")) squash_item() if(!QDELETED(src)) @@ -1314,7 +1314,7 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out. return null /obj/item/get_examine_prefix() - if(coating?.total_volume) + if(REAGENT_TOTAL_VOLUME(coating)) var/coating_string = coating.get_coated_adjectives() // component coloring is handled in here if(get_config_value(/decl/config/enum/colored_coating_names) == CONFIG_COATING_COLOR_MIXTURE) coating_string = FONT_COLORED(coating.get_color(), coating_string) diff --git a/code/game/objects/items/_item_drying.dm b/code/game/objects/items/_item_drying.dm index 5357133fe505..5e69b30dd96f 100644 --- a/code/game/objects/items/_item_drying.dm +++ b/code/game/objects/items/_item_drying.dm @@ -38,7 +38,8 @@ if(color && dried_product_takes_color) thing.color = color if(isturf(loc) && !silent) - visible_message(SPAN_NOTICE("\The [src] [gender == PLURAL ? "are" : "is"] dry!")) + var/decl/pronouns/pronouns = get_pronouns() + visible_message(SPAN_NOTICE("\The [src] [pronouns.is] dry!")) if(thing != src) qdel(src) return thing diff --git a/code/game/objects/items/_item_edibility.dm b/code/game/objects/items/_item_edibility.dm index 4957dbecff8f..ecf12a115591 100644 --- a/code/game/objects/items/_item_edibility.dm +++ b/code/game/objects/items/_item_edibility.dm @@ -8,7 +8,7 @@ var/utensil_food_type = get_utensil_food_type() if(!istype(utensil) || !utensil_food_type) return - var/remove_amt = min(reagents?.total_volume, get_food_default_transfer_amount(user)) + var/remove_amt = min(REAGENT_TOTAL_VOLUME(reagents), get_food_default_transfer_amount(user)) if(remove_amt) // Create a dummy copy of the target food item. @@ -28,7 +28,7 @@ utensil.loaded_food.reagents.clear_reagents() reagents.trans_to(utensil.loaded_food, remove_amt) handle_chunk_separated() - if(!reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) handle_consumed(user) // it's not actually being consumed, so i'm not sure this is correct utensil.update_icon() diff --git a/code/game/objects/items/_item_reagents.dm b/code/game/objects/items/_item_reagents.dm index 9431fb7e70c2..24f8656fc072 100644 --- a/code/game/objects/items/_item_reagents.dm +++ b/code/game/objects/items/_item_reagents.dm @@ -2,7 +2,7 @@ if(!istype(target) || isnull(target.get_reagent_amount_dispensed()) || (!skip_container_check && (target.atom_flags & ATOM_FLAG_OPEN_CONTAINER))) return FALSE - if(!target.reagents || !target.reagents.total_volume) + if(!target.reagents || !REAGENT_TOTAL_VOLUME(target.reagents)) to_chat(user, SPAN_NOTICE("[target] is empty of reagents.")) return TRUE @@ -22,7 +22,7 @@ to_chat(user, SPAN_NOTICE("You can't splash people on help intent.")) return TRUE - if(!reagents || !reagents.total_volume) + if(!reagents || !REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_NOTICE("[src] is empty of reagents.")) return TRUE @@ -30,14 +30,14 @@ to_chat(user, SPAN_NOTICE("[target] is full of reagents.")) return TRUE - var/contained = REAGENT_LIST(src) + var/contained = REAGENT_LIST(reagents) admin_attack_log(user, target, "Used \the [name] containing [contained] to splash the victim.", "Was splashed by \the [name] containing [contained].", "used \the [name] containing [contained] to splash") user.visible_message( \ SPAN_DANGER("\The [target] has been splashed with the contents of \the [src] by \the [user]!"), \ SPAN_DANGER("You splash \the [target] with the contents of \the [src].")) - reagents.splash(target, reagents.total_volume) + reagents.splash(target, REAGENT_TOTAL_VOLUME(reagents)) return TRUE /obj/item/proc/standard_pour_into(mob/user, atom/target, amount = 5) // This goes into afterattack and yes, it's atom-level @@ -55,7 +55,7 @@ if(!can_be_poured_from(user, target)) return TRUE // don't splash if we can't pour - if(!reagents || !reagents.total_volume) + if(!reagents || !REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_NOTICE("[src] is empty of reagents.")) return TRUE @@ -63,7 +63,8 @@ to_chat(user, SPAN_NOTICE("[target] is full of reagents.")) return TRUE - var/had_liquids = length(reagents.liquid_volumes) + var/liquid_volumes = REAGENT_LIQUID_VOLUMES(reagents) + var/had_liquids = length(liquid_volumes) var/transferred_amount = reagents.trans_to(target, amount) if(had_liquids) @@ -71,5 +72,5 @@ else // Sounds more like pouring small pellets or dust. playsound(src, 'sound/effects/refill.ogg', 25, 1) - to_chat(user, SPAN_NOTICE("You transfer [transferred_amount] unit\s of the solution to \the [target]. \The [src] now contains [reagents.total_volume] unit\s.")) + to_chat(user, SPAN_NOTICE("You transfer [transferred_amount] unit\s of the solution to \the [target]. \The [src] now contains [REAGENT_TOTAL_VOLUME(reagents)] unit\s.")) return TRUE diff --git a/code/game/objects/items/contraband.dm b/code/game/objects/items/contraband.dm index 8b62f298f8f7..669e5876b86f 100644 --- a/code/game/objects/items/contraband.dm +++ b/code/game/objects/items/contraband.dm @@ -48,10 +48,10 @@ add_to_reagents(reagent, picked_reagents[reagent]) var/list/names = new - for(var/decl/material/reagent as anything in reagents.liquid_volumes) + for(var/decl/material/reagent as anything in REAGENT_LIQUID_VOLUMES(reagents)) names += reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID) - for(var/decl/material/reagent as anything in reagents.solid_volumes) + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(reagents)) 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/devices/boombox.dm b/code/game/objects/items/devices/boombox.dm index 0c3e1c273082..6570fe37400d 100644 --- a/code/game/objects/items/devices/boombox.dm +++ b/code/game/objects/items/devices/boombox.dm @@ -1,10 +1,6 @@ -/obj/item/boombox +/obj/item/music_player/boombox 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 = 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}' material = /decl/material/solid/organic/plastic matter = list( @@ -12,85 +8,25 @@ /decl/material/solid/metal/aluminium = MATTER_AMOUNT_REINFORCEMENT, /decl/material/solid/silicon = MATTER_AMOUNT_TRACE, ) - var/playing = 0 - var/track_num = 1 - var/music_volume = 20 - var/max_volume = 40 - var/frequency = 1 - var/datum/sound_token/sound_token - var/list/datum/track/tracks - var/sound_id + player_name = "BOOMTASTIC 3000" + interact_sound = "switch" + icon = 'icons/obj/items/device/boombox.dmi' + var/break_chance = 3 var/broken var/panel = TRUE -/obj/item/boombox/attack_self(var/mob/user) - interact(user) - -/obj/item/boombox/Initialize() - . = ..() - sound_id = "[type]_[sequential_id(type)]" - tracks = setup_music_tracks(tracks) - -/obj/item/boombox/emp_act(severity) +/obj/item/music_player/boombox/emp_act(severity) boombox_break() -/obj/item/boombox/get_examine_strings(mob/user, distance, infix, suffix) +/obj/item/music_player/boombox/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(!panel) . += SPAN_NOTICE("The front panel is unhinged.") if(broken) . += SPAN_WARNING("It's broken.") -/obj/item/boombox/Destroy() - stop() - . = ..() - -/obj/item/boombox/interact(var/mob/user) - if(!CanPhysicallyInteract(user)) - return - var/dat = "NEXT" - dat += "PREV" - dat += "PLAY" - dat += "STOP" - dat += "VOL -" - dat += "VOL +" - var/datum/browser/popup = new(user, "boombox", "BOOMTASTIC 3000", 290, 110) - popup.set_content(dat) - popup.open() - -/obj/item/boombox/DefaultTopicState() - return global.physical_topic_state - -/obj/item/boombox/CouldUseTopic(var/mob/user) - ..() - playsound(src, "switch", 40) - -/obj/item/boombox/OnTopic(var/user, var/list/href_list) - if(href_list["tracknum"]) - var/diff = text2num(href_list["tracknum"]) - track_num += diff - if(track_num > tracks.len) - track_num = 1 - else if (track_num < 1) - track_num = tracks.len - if(playing) - start() - return TOPIC_REFRESH - if(href_list["stop"]) - stop() - return TOPIC_HANDLED - if(href_list["start"] && !broken) - start() - return TOPIC_HANDLED - if(href_list["volup"]) - change_volume(music_volume + 10) - return TOPIC_HANDLED - if(href_list["voldown"]) - change_volume(music_volume - 10) - return TOPIC_HANDLED - -/obj/item/boombox/attackby(var/obj/item/used_item, var/mob/user) +/obj/item/music_player/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 [used_item]."), SPAN_NOTICE("You re-attach \the [src]'s front panel.")) @@ -115,7 +51,7 @@ else . = ..() -/obj/item/boombox/proc/AdjustFrequency(var/obj/item/used_item, var/mob/user) +/obj/item/music_player/boombox/proc/AdjustFrequency(var/obj/item/used_item, var/mob/user) var/const/MIN_FREQUENCY = 0.5 var/const/MAX_FREQUENCY = 1.5 @@ -126,9 +62,9 @@ var/tighten = "Tighten (play slower)" var/loosen = "Loosen (play faster)" - if(frequency > MIN_FREQUENCY) + if(music_frequency > MIN_FREQUENCY) options += tighten - if(frequency < MAX_FREQUENCY) + if(music_frequency < MAX_FREQUENCY) options += loosen var/operation = input(user, "How do you wish to adjust the player head?", "Adjust player", options[1]) as null|anything in options @@ -143,61 +79,43 @@ return FALSE if(operation == loosen) - frequency += 0.1 + music_frequency += 0.1 else if(operation == tighten) - frequency -= 0.1 - frequency = clamp(frequency, MIN_FREQUENCY, MAX_FREQUENCY) + music_frequency -= 0.1 + music_frequency = clamp(music_frequency, MIN_FREQUENCY, MAX_FREQUENCY) user.visible_message(SPAN_NOTICE("\The [user] adjusts \the [src]'s player head."), SPAN_NOTICE("You adjust \the [src]'s player head.")) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - if(frequency > 1.0) + if(music_frequency > 1.0) to_chat(user, SPAN_NOTICE("\The [src] should be playing faster than usual.")) - else if(frequency < 1.0) + else if(music_frequency < 1.0) to_chat(user, SPAN_NOTICE("\The [src] should be playing slower than usual.")) else to_chat(user, SPAN_NOTICE("\The [src] should be playing as fast as usual.")) return TRUE -/obj/item/boombox/proc/MayAdjust(var/mob/user) +/obj/item/music_player/boombox/proc/MayAdjust(var/mob/user) if(playing) to_chat(user, "You can only adjust \the [src] when it's not playing.") return FALSE return TRUE -/obj/item/boombox/on_update_icon() - . = ..() - icon_state = get_world_inventory_state() - if(playing) - icon_state = "[icon_state]_on" - -/obj/item/boombox/proc/stop() - playing = 0 - update_icon() - QDEL_NULL(sound_token) - -/obj/item/boombox/proc/start() - QDEL_NULL(sound_token) - var/datum/track/T = tracks[track_num] - sound_token = play_looping_sound(src, sound_id, T.GetTrack(), volume = music_volume, frequency = frequency, range = 7, falloff = 4, prefer_mute = TRUE, preference = /datum/client_preference/play_game_music, streaming = TRUE) - playing = 1 - update_icon() - if(prob(break_chance)) - boombox_break() - -/obj/item/boombox/proc/boombox_break() +/obj/item/music_player/boombox/proc/boombox_break() audible_message(SPAN_WARNING("\The [src]'s speakers pop with a sharp crack!")) playsound(src.loc, 'sound/effects/snap.ogg', 100, 1) broken = TRUE stop() -/obj/item/boombox/proc/change_volume(var/new_volume) - music_volume = clamp(new_volume, 0, max_volume) - if(sound_token) - sound_token.SetVolume(music_volume) +/obj/item/music_player/boombox/start() + if(broken) + return + . = ..() + if(prob(break_chance)) + boombox_break() /obj/random_multi/single_item/boombox name = "boombox spawnpoint" id = "boomtastic" - item_path = /obj/item/boombox + item_path = /obj/item/music_player/boombox diff --git a/code/game/objects/items/devices/music_player.dm b/code/game/objects/items/devices/music_player.dm new file mode 100644 index 000000000000..249f10c0c5f8 --- /dev/null +++ b/code/game/objects/items/devices/music_player.dm @@ -0,0 +1,101 @@ +/obj/item/music_player + abstract_type = /obj/item/music_player + 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 + + var/playing = 0 + var/track_num = 1 + var/music_volume = 20 + var/max_volume = 40 + var/datum/sound_token/sound_token + var/list/datum/track/tracks + var/sound_id + var/player_name = "Music Player" + var/interact_sound + var/music_frequency = 1 + +/obj/item/music_player/on_update_icon() + . = ..() + icon_state = get_world_inventory_state() + if(playing) + icon_state = "[icon_state]_on" + +/obj/item/music_player/proc/stop() + playing = 0 + update_icon() + QDEL_NULL(sound_token) + +/obj/item/music_player/proc/start() + QDEL_NULL(sound_token) + var/datum/track/T = tracks[track_num] + sound_token = play_looping_sound(src, sound_id, T.GetTrack(), volume = music_volume, frequency = music_frequency, range = 7, falloff = 4, prefer_mute = TRUE, preference = /datum/client_preference/play_game_music, streaming = TRUE) + playing = 1 + update_icon() + +/obj/item/music_player/attack_self(var/mob/user) + interact(user) + +/obj/item/music_player/Initialize() + . = ..() + sound_id = "[type]_[sequential_id(type)]" + tracks = setup_music_tracks(tracks) + +/obj/item/music_player/Destroy() + stop() + . = ..() + +/obj/item/music_player/interact(var/mob/user) + if(!CanPhysicallyInteract(user)) + return + var/dat = list() + var/datum/track/T = tracks[track_num] + if(istype(T) && T.title) + dat += "

[T.title]


" + dat += "NEXT" + dat += "PREV" + dat += "PLAY" + dat += "STOP" + dat += "VOL -" + dat += "VOL +" + var/datum/browser/popup = new(user, "music_player_[name]", "[player_name]", 350, 150) + popup.set_content(JOINTEXT(dat)) + popup.open() + +/obj/item/music_player/DefaultTopicState() + return global.physical_topic_state + +/obj/item/music_player/CouldUseTopic(var/mob/user) + ..() + if(interact_sound) + playsound(src, interact_sound, 40) + +/obj/item/music_player/OnTopic(var/user, var/list/href_list) + if(href_list["tracknum"]) + var/diff = text2num(href_list["tracknum"]) + track_num += diff + if(track_num > tracks.len) + track_num = 1 + else if (track_num < 1) + track_num = tracks.len + if(playing) + start() + interact(user) + return TOPIC_REFRESH + if(href_list["stop"]) + stop() + return TOPIC_HANDLED + if(href_list["start"]) + start() + return TOPIC_HANDLED + if(href_list["volup"]) + change_volume(music_volume + 10) + return TOPIC_HANDLED + if(href_list["voldown"]) + change_volume(music_volume - 10) + return TOPIC_HANDLED + +/obj/item/music_player/proc/change_volume(var/new_volume) + music_volume = clamp(new_volume, 0, max_volume) + if(sound_token) + sound_token.SetVolume(music_volume) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index fd4ef2152a3c..48244d9fcdae 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -76,7 +76,7 @@ /obj/item/radio/proc/can_decrypt(var/list/secured) if(decrypt_all_messages) return TRUE - if(!secured || !length(secured)) + if(!LAZYLEN(secured)) return TRUE if(!islist(secured)) secured = list(secured) diff --git a/code/game/objects/items/flame/_flame.dm b/code/game/objects/items/flame/_flame.dm index 86fa054e41ab..d57f5a8ce1f7 100644 --- a/code/game/objects/items/flame/_flame.dm +++ b/code/game/objects/items/flame/_flame.dm @@ -158,19 +158,19 @@ /obj/item/flame/fluid_act(var/datum/reagents/fluids) ..() - if(QDELETED(src) || !fluids?.total_volume || !lit) + if(QDELETED(src) || !REAGENT_TOTAL_VOLUME(fluids) || !lit) return var/turf/location = get_turf(src) if(location) location.hotspot_expose(700, 5) // Potentially set fire to fuel etc. - if(QDELETED(src) || !fluids?.total_volume) + if(QDELETED(src) || !REAGENT_TOTAL_VOLUME(fluids)) return if(waterproof) return - if(fluids.total_volume >= FLUID_PUDDLE) + if(REAGENT_TOTAL_VOLUME(fluids) >= FLUID_PUDDLE) snuff_out(no_message = TRUE) /obj/item/flame/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) diff --git a/code/game/objects/items/flame/flame_fuelled.dm b/code/game/objects/items/flame/flame_fuelled.dm index 51cdb60beefe..f956496fca12 100644 --- a/code/game/objects/items/flame/flame_fuelled.dm +++ b/code/game/objects/items/flame/flame_fuelled.dm @@ -22,9 +22,9 @@ /obj/item/flame/fuelled/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) if(get_attack_force() && !(item_flags & ITEM_FLAG_NO_BLUDGEON) && user.check_intent(I_FLAG_HARM)) . = ..() - if(reagents?.total_volume && !QDELETED(target)) + if(REAGENT_TOTAL_VOLUME(reagents) && !QDELETED(target)) target.visible_message(SPAN_DANGER("Some of the contents of \the [src] splash onto \the [target].")) - reagents.splash(target, reagents.total_volume) + reagents.splash(target, REAGENT_TOTAL_VOLUME(reagents)) return TRUE return FALSE @@ -40,9 +40,9 @@ return TRUE if(handle_eaten_by_mob(user, target) != EATEN_INVALID) return TRUE - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_NOTICE("You splash a small amount of the contents of \the [src] onto \the [target].")) - reagents.splash(target, min(reagents.total_volume, 5)) + reagents.splash(target, min(REAGENT_TOTAL_VOLUME(reagents), 5)) return TRUE . = ..() @@ -56,8 +56,9 @@ if(fuel_reagent) . += SPAN_NOTICE("\The [src] is designed to burn [fuel_reagent.liquid_name].") - if(reagents?.maximum_volume) - switch(reagents.total_volume / reagents.maximum_volume) + var/max_vol = REAGENT_MAXIMUM_VOLUME(reagents) + if(max_vol) + switch(REAGENT_TOTAL_VOLUME(reagents) / max_vol) if(0 to 0.1) . += SPAN_WARNING("\The [src] is nearly empty.") if(0.1 to 0.25) @@ -84,8 +85,10 @@ return FALSE /obj/item/flame/fuelled/populate_reagents() - if(start_fuelled && fuel_type && reagents?.maximum_volume) - add_to_reagents(fuel_type, reagents.maximum_volume) + if(start_fuelled && fuel_type) + var/max_vol = REAGENT_MAXIMUM_VOLUME(reagents) + if(max_vol) + add_to_reagents(fuel_type, max_vol) /obj/item/flame/fuelled/Process() . = ..() diff --git a/code/game/objects/items/flame/flame_torch.dm b/code/game/objects/items/flame/flame_torch.dm index 0e2f14c1022f..0ad60d0d86f7 100644 --- a/code/game/objects/items/flame/flame_torch.dm +++ b/code/game/objects/items/flame/flame_torch.dm @@ -20,7 +20,7 @@ return available_scents /obj/item/flame/torch/light(mob/user, no_message) - if(coating?.total_volume && coating.get_accelerant_value() < FUEL_VALUE_NONE) + if(REAGENT_TOTAL_VOLUME(coating) && coating.get_accelerant_value() < FUEL_VALUE_NONE) to_chat(user, SPAN_WARNING("You cannot light \the [src] while it is wet!")) return FALSE if(burnt) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 545cc0b21be6..a8c443c40ed9 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -52,42 +52,43 @@ _base_attack_force = 0 /obj/item/chems/water_balloon/adjust_mob_overlay(mob/living/user_mob, bodytype, image/overlay, slot, bodypart, use_fallback_if_icon_missing = TRUE) - if(overlay && reagents?.total_volume <= 0) + if(overlay && REAGENT_TOTAL_VOLUME(reagents) <= 0) overlay.icon_state = "[overlay.icon_state]_empty" . = ..() /obj/item/chems/water_balloon/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(distance <= 1) - . += "It's [reagents?.total_volume > 0? "filled with liquid sloshing around" : "empty"]." + . += "It's [REAGENT_TOTAL_VOLUME(reagents) > 0? "filled with liquid sloshing around" : "empty"]." /obj/item/chems/water_balloon/on_reagent_change() if(!(. = ..())) return - w_class = (reagents?.total_volume > 0)? ITEM_SIZE_SMALL : ITEM_SIZE_TINY + w_class = (REAGENT_TOTAL_VOLUME(reagents) > 0)? ITEM_SIZE_SMALL : ITEM_SIZE_TINY //#TODO: Maybe acids should handle eating their own containers themselves? - for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) 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) ..() - if(reagents?.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(reagents) > 0) visible_message(SPAN_WARNING("\The [src] bursts!")) physically_destroyed() /obj/item/chems/water_balloon/physically_destroyed(skip_qdel) - if(reagents?.total_volume > 0) + var/reagent_volume = REAGENT_TOTAL_VOLUME(reagents) + if(reagent_volume > 0) new /obj/effect/temporary(src, 5, icon, "[get_world_inventory_state()]_burst") - reagents.splash_turf(get_turf(src), reagents.total_volume) + reagents.splash_turf(get_turf(src), reagent_volume) playsound(src, 'sound/effects/balloon-pop.ogg', 75, TRUE, 3) . = ..() /obj/item/chems/water_balloon/on_update_icon() . = ..() icon_state = get_world_inventory_state() - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) icon_state = "[icon_state]_empty" /obj/item/chems/water_balloon/afterattack(obj/target, mob/user, proximity) diff --git a/code/game/objects/items/waterskin.dm b/code/game/objects/items/waterskin.dm index 729f6b1e9240..94c7166bc657 100644 --- a/code/game/objects/items/waterskin.dm +++ b/code/game/objects/items/waterskin.dm @@ -65,4 +65,4 @@ /obj/item/chems/glass/waterskin/crafted/wine/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/wine, reagents?.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/wine, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/game/objects/items/weapons/ecigs.dm b/code/game/objects/items/weapons/ecigs.dm index 305d0aa5f5ce..ca7f2f6eb060 100644 --- a/code/game/objects/items/weapons/ecigs.dm +++ b/code/game/objects/items/weapons/ecigs.dm @@ -39,7 +39,7 @@ /obj/item/clothing/mask/smokable/ecig/simple/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(ec_cartridge) - . += SPAN_NOTICE("There are [round(ec_cartridge.reagents.total_volume, 1)] units of liquid remaining.") + . += SPAN_NOTICE("There are [round(REAGENT_TOTAL_VOLUME(ec_cartridge.reagents), 1)] units of liquid remaining.") else . += SPAN_NOTICE("There's no cartridge connected.") @@ -58,7 +58,7 @@ /obj/item/clothing/mask/smokable/ecig/util/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(ec_cartridge) - . += SPAN_NOTICE("There are [round(ec_cartridge.reagents.total_volume, 1)] units of liquid remaining.") + . += SPAN_NOTICE("There are [round(REAGENT_TOTAL_VOLUME(ec_cartridge.reagents), 1)] units of liquid remaining.") else . += SPAN_NOTICE("There's no cartridge connected.") @@ -74,7 +74,7 @@ /obj/item/clothing/mask/smokable/ecig/deluxe/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(ec_cartridge) - . += SPAN_NOTICE("There are [round(ec_cartridge.reagents.total_volume, 1)] units of liquid remaining.") + . += SPAN_NOTICE("There are [round(REAGENT_TOTAL_VOLUME(ec_cartridge.reagents), 1)] units of liquid remaining.") else . += SPAN_NOTICE("There's no cartridge connected.") @@ -102,8 +102,9 @@ if(ishuman(loc)) var/mob/living/human/user = loc - if (!lit || !ec_cartridge || !ec_cartridge.reagents.total_volume)//no cartridge - if(!ec_cartridge.reagents.total_volume) + var/cart_vol = REAGENT_TOTAL_VOLUME(ec_cartridge.reagents) + if (!lit || !ec_cartridge || !cart_vol)//no cartridge + if(!cart_vol) to_chat(user, SPAN_NOTICE("There's no liquid left in \the [src], so you shut it down.")) Deactivate() return @@ -152,7 +153,7 @@ if (!ec_cartridge) to_chat(user, SPAN_NOTICE("You can't use \the [src] with no cartridge installed!")) return - else if(!ec_cartridge.reagents.total_volume) + else if(!REAGENT_TOTAL_VOLUME(ec_cartridge.reagents)) to_chat(user, SPAN_NOTICE("You can't use \the [src] with no liquid left!")) return else if(!cell.check_charge(power_usage * CELLRATE)) @@ -189,7 +190,7 @@ /obj/item/chems/ecig_cartridge/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - . += "The cartridge has [reagents.total_volume] units of liquid remaining." + . += "The cartridge has [REAGENT_TOTAL_VOLUME(reagents)] units of liquid remaining." //flavours /obj/item/chems/ecig_cartridge/blank diff --git a/code/game/objects/items/weapons/extinguisher.dm b/code/game/objects/items/weapons/extinguisher.dm index 7c57b93689e5..074cdfc5de33 100644 --- a/code/game/objects/items/weapons/extinguisher.dm +++ b/code/game/objects/items/weapons/extinguisher.dm @@ -45,7 +45,7 @@ _base_attack_force = 3 /obj/item/chems/spray/extinguisher/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/spray/extinguisher/has_safety() 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 d5bb28f18f47..2b69b2c9e4a3 100644 --- a/code/game/objects/items/weapons/grenades/chem_grenade.dm +++ b/code/game/objects/items/weapons/grenades/chem_grenade.dm @@ -18,6 +18,9 @@ QDEL_NULL_LIST(beakers) . = ..() +/obj/item/grenade/chem_grenade/reaction_can_overflow(decl/chemical_reaction/reaction) + return TRUE // will always overflow despite not being open + /obj/item/grenade/chem_grenade/attack_self(mob/user) if(!stage || stage==1) if(detonator) @@ -101,7 +104,7 @@ to_chat(user, "The grenade can not hold more containers.") return TRUE else - if(used_item.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(used_item.reagents)) if(!user.try_unequip(used_item, src)) return TRUE to_chat(user, "You add \the [used_item] to the assembly.") @@ -138,7 +141,7 @@ var/has_reagents = 0 for(var/obj/item/chems/glass/G in beakers) - if(G.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(G.reagents)) has_reagents = TRUE break @@ -162,13 +165,13 @@ M.toggle_throw_mode(FALSE) for(var/obj/item/chems/glass/G in beakers) - G.reagents.trans_to_obj(src, G.reagents.total_volume) + G.reagents.trans_to_obj(src, REAGENT_TOTAL_VOLUME(G.reagents)) anchored = TRUE set_invisibility(INVISIBILITY_MAXIMUM) // Visual effect to show the grenade going off. - if(reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) var/datum/effect/effect/system/steam_spread/steam = new steam.set_up(10, 0, get_turf(src)) steam.attach(src) @@ -177,13 +180,14 @@ // Allow time for reactions to proc. var/max_delays = 5 var/delays = 0 - while(reagents.total_volume && delays <= max_delays) + while(REAGENT_TOTAL_VOLUME(reagents) && delays <= max_delays) delays++ sleep(SSmaterials.wait) // The reactions didn't use up all reagents, dump them as a fluid. - if(reagents.total_volume) - reagents.trans_to(loc, reagents.total_volume) + var/reagent_volume = REAGENT_TOTAL_VOLUME(reagents) + if(reagent_volume) + reagents.trans_to(loc, reagent_volume) qdel(src) @@ -212,7 +216,7 @@ var/obj/item/chems/glass/beaker/B2 = new(src) B1.add_to_reagents(/decl/material/solid/metal/aluminium, 30) B2.add_to_reagents(/decl/material/liquid/foaming_agent, 10) - B2.add_to_reagents(/decl/material/liquid/acid/polyacid, 10) + B2.add_to_reagents(/decl/material/liquid/acid, 10) detonator = new/obj/item/assembly_holder/timer_igniter(src) beakers += B1 beakers += B2 diff --git a/code/game/objects/items/weapons/mop.dm b/code/game/objects/items/weapons/mop.dm index d46890df842d..05ae7042beb4 100644 --- a/code/game/objects/items/weapons/mop.dm +++ b/code/game/objects/items/weapons/mop.dm @@ -35,13 +35,14 @@ if(!istype(moppable_turf)) return ..() - if(moppable_turf?.reagents?.total_volume > 0) - if(moppable_turf.reagents.total_volume > FLUID_SHALLOW) + var/mop_reagents = REAGENT_TOTAL_VOLUME(moppable_turf?.reagents) + if(mop_reagents > 0) + if(mop_reagents > FLUID_SHALLOW) to_chat(user, SPAN_WARNING("There is too much water here to be mopped up.")) return TRUE user.visible_message(SPAN_NOTICE("\The [user] begins to mop up \the [moppable_turf].")) if(do_after(user, 40, moppable_turf) && !QDELETED(moppable_turf)) - if(moppable_turf.reagents?.total_volume > FLUID_SHALLOW) + if(REAGENT_TOTAL_VOLUME(moppable_turf.reagents) > FLUID_SHALLOW) to_chat(user, SPAN_WARNING("There is too much water here to be mopped up.")) else to_chat(user, SPAN_NOTICE("You have finished mopping!")) @@ -51,7 +52,7 @@ if(!is_type_in_list(A, moppable_types)) return ..() - if(reagents?.total_volume < 1) + if(REAGENT_TOTAL_VOLUME(reagents) < 1) to_chat(user, SPAN_WARNING("\The [src] is dry!")) return TRUE @@ -59,7 +60,7 @@ user.visible_message(SPAN_DANGER("\The [user] begins to aggressively mop \the [moppable_turf]!")) else user.visible_message(SPAN_NOTICE("\The [user] begins to clean \the [moppable_turf].")) - if(do_after(user, mopspeed, moppable_turf) && reagents?.total_volume) + if(do_after(user, mopspeed, moppable_turf) && REAGENT_TOTAL_VOLUME(reagents)) reagents.touch_turf(moppable_turf) reagents.remove_any(1) to_chat(user, SPAN_NOTICE("You have finished mopping!")) @@ -103,7 +104,7 @@ playsound(user, 'sound/machines/click.ogg', 30, 1) /obj/item/mop/advanced/Process() - if(reagents.total_volume < reagents.maximum_volume) + if(REAGENT_TOTAL_VOLUME(reagents) < REAGENT_MAXIMUM_VOLUME(reagents)) add_to_reagents(refill_reagent, refill_rate) /obj/item/mop/advanced/get_examine_strings(mob/user, distance, infix, suffix) diff --git a/code/game/objects/items/weapons/paint.dm b/code/game/objects/items/weapons/paint.dm index ddbe13a497ee..4c3c8685558c 100644 --- a/code/game/objects/items/weapons/paint.dm +++ b/code/game/objects/items/weapons/paint.dm @@ -10,7 +10,7 @@ var/pigment /obj/item/chems/glass/bucket/paint/populate_reagents() - var/amt = reagents.maximum_volume + var/amt = REAGENT_MAXIMUM_VOLUME(reagents) if(pigment) amt = round(amt/2) add_to_reagents(pigment, amt) diff --git a/code/game/objects/items/weapons/soap.dm b/code/game/objects/items/weapons/soap.dm index 47518ab9b3d0..15e1cb314ab5 100644 --- a/code/game/objects/items/weapons/soap.dm +++ b/code/game/objects/items/weapons/soap.dm @@ -68,7 +68,7 @@ wet() return TRUE - if(reagents?.total_volume < 1) + if(REAGENT_TOTAL_VOLUME(reagents) < 1) to_chat(user, SPAN_WARNING("\The [src] is too dry to clean \the [target].")) return TRUE @@ -77,7 +77,7 @@ if(!isturf(target)) return ..() user.visible_message(SPAN_NOTICE("\The [user] starts scrubbing \the [target].")) - if(!do_after(user, 8 SECONDS, target) && reagents?.total_volume) + if(!do_after(user, 8 SECONDS, target) && REAGENT_TOTAL_VOLUME(reagents)) return TRUE to_chat(user, SPAN_NOTICE("You scrub \the [target] clean.")) else if(istype(target,/obj/effect/decal/cleanable)) @@ -97,11 +97,11 @@ if(user.get_target_zone() == BP_MOUTH && victim.check_has_mouth()) user.visible_message(SPAN_DANGER("\The [user] washes \the [target]'s mouth out with soap!")) if(reagents) - reagents.trans_to_mob(target, reagents.total_volume / 2, CHEM_INGEST) + reagents.trans_to_mob(target, REAGENT_TOTAL_VOLUME(reagents) / 2, CHEM_INGEST) else user.visible_message(SPAN_NOTICE("\The [user] cleans \the [target].")) if(reagents) - reagents.trans_to(target, reagents.total_volume / 8) + reagents.trans_to(target, REAGENT_TOTAL_VOLUME(reagents) / 8) target.clean() user.setClickCooldown(DEFAULT_QUICK_COOLDOWN) //prevent spam return TRUE diff --git a/code/game/objects/items/weapons/storage/bible.dm b/code/game/objects/items/weapons/storage/bible.dm index 37a12e8d3dcc..8787cc2814d0 100644 --- a/code/game/objects/items/weapons/storage/bible.dm +++ b/code/game/objects/items/weapons/storage/bible.dm @@ -89,7 +89,7 @@ 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(DATA_WATER_HOLINESS = TRUE)) + REAGENT_SET_DATA(A.reagents, /decl/material/liquid/water, list(DATA_WATER_HOLINESS = TRUE)) /obj/item/bible/attackby(obj/item/used_item, mob/user) if(storage?.use_sound) diff --git a/code/game/objects/items/weapons/storage/fancy/cigarettes.dm b/code/game/objects/items/weapons/storage/fancy/cigarettes.dm index 80610b50e2cc..79fa5b45156a 100644 --- a/code/game/objects/items/weapons/storage/fancy/cigarettes.dm +++ b/code/game/objects/items/weapons/storage/fancy/cigarettes.dm @@ -42,7 +42,7 @@ storage?.remove_from_storage(user, cig, null) user.equip_to_slot(cig, slot_wear_mask_str) - reagents.maximum_volume = 5 * contents.len + create_or_update_reagents(5 * contents.len) to_chat(user, SPAN_NOTICE("You take a cigarette out of the pack.")) update_icon() return TRUE diff --git a/code/game/objects/items/weapons/storage/med_pouch.dm b/code/game/objects/items/weapons/storage/med_pouch.dm index a24f2ff187cb..0bb25ee3ac04 100644 --- a/code/game/objects/items/weapons/storage/med_pouch.dm +++ b/code/game/objects/items/weapons/storage/med_pouch.dm @@ -198,36 +198,36 @@ Single Use Emergency Pouches /obj/item/chems/pill/pouch_pill/Initialize(ml, material_key) . = ..() - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) log_warning("[log_info_line(src)] was deleted for containing no reagents during init!") return INITIALIZE_HINT_QDEL if(reagents?.get_primary_reagent_name() && !_reagent_name) - _reagent_name = "emergency [reagents.get_primary_reagent_name()] pill ([reagents.total_volume]u)" + _reagent_name = "emergency [reagents.get_primary_reagent_name()] pill ([REAGENT_TOTAL_VOLUME(reagents)]u)" if(_reagent_name) SetName(_reagent_name) /obj/item/chems/pill/pouch_pill/stabilizer/populate_reagents() - add_to_reagents(/decl/material/liquid/stabilizer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/stabilizer, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/pill/pouch_pill/antitoxins/populate_reagents() - add_to_reagents(/decl/material/liquid/antitoxins, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antitoxins, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/pill/pouch_pill/oxy_meds/populate_reagents() - add_to_reagents(/decl/material/liquid/oxy_meds, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/oxy_meds, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/pill/pouch_pill/painkillers/populate_reagents() - add_to_reagents(/decl/material/liquid/painkillers, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/painkillers, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/pill/pouch_pill/brute_meds/populate_reagents() - add_to_reagents(/decl/material/liquid/brute_meds, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/brute_meds, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/pill/pouch_pill/burn_meds/populate_reagents() - add_to_reagents(/decl/material/liquid/burn_meds, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/burn_meds, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() // Injectors diff --git a/code/game/objects/items/weapons/swords_axes_etc.dm b/code/game/objects/items/weapons/swords_axes_etc.dm index eb8b3a9e3a8b..7a8a2308bde2 100644 --- a/code/game/objects/items/weapons/swords_axes_etc.dm +++ b/code/game/objects/items/weapons/swords_axes_etc.dm @@ -66,7 +66,7 @@ update_held_icon() /obj/item/telebaton/on_update_icon() - if(coating?.total_volume || blood_DNA) + if(REAGENT_TOTAL_VOLUME(coating) || blood_DNA) generate_coating_overlay(TRUE) // Force recheck. . = ..() if(on) diff --git a/code/game/objects/items/weapons/towels.dm b/code/game/objects/items/weapons/towels.dm index 623042a6c029..087980586f43 100644 --- a/code/game/objects/items/weapons/towels.dm +++ b/code/game/objects/items/weapons/towels.dm @@ -27,7 +27,7 @@ // Does not rely on ATOM_IS_OPEN_CONTAINER because we want to be able to pour in but not out. /obj/item/towel/can_be_poured_into(atom/source) - return (reagents?.maximum_volume > 0) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) /obj/item/towel/proc/update_material_description() if(!istype(material) || !(material_alteration & MAT_FLAG_ALTERATION_DESC)) @@ -39,9 +39,11 @@ /obj/item/towel/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - if(reagents?.total_volume && distance <= 1) + var/total_vol = REAGENT_TOTAL_VOLUME(reagents) + if(total_vol && distance <= 1) + var/max_vol = REAGENT_MAXIMUM_VOLUME(reagents) var/liquid_adjective = "damp" - switch(reagents.total_volume / reagents.maximum_volume) + switch(total_vol / max_vol) if(0 to 0.1) return // not enough to even bother worrying about if(0.4 to 0.6) @@ -61,13 +63,14 @@ // Slowly dry out. /obj/item/towel/Process() - if(reagents?.total_volume) - reagents.remove_any(max(MINIMUM_CHEMICAL_VOLUME, CHEMS_QUANTIZE(reagents.total_volume * 0.05))) - if(!reagents?.total_volume) + var/total_volume = REAGENT_TOTAL_VOLUME(reagents) + if(total_volume) + reagents.remove_any(max(MINIMUM_CHEMICAL_VOLUME, CHEMS_QUANTIZE(total_volume * 0.05))) + if(!REAGENT_TOTAL_VOLUME(reagents)) return PROCESS_KILL /obj/item/towel/update_name() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) if(!REAGENTS_FREE_SPACE(reagents)) name_prefix = "waterlogged" else @@ -80,7 +83,7 @@ if(!(. = ..())) return update_name() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) if(!is_processing) START_PROCESSING(SSobj, src) else if(is_processing) @@ -93,17 +96,17 @@ /obj/item/towel/proc/dry_mob(mob/living/target, mob/living/user) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - var/reagent_space = reagents.maximum_volume - reagents.total_volume + var/reagent_space = REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(reagents) if(reagent_space <= 0) to_chat(user, SPAN_WARNING("\The [src] is too saturated to dry [user == target ? "yourself" : "\the [target]"] off effectively.")) else var/decl/pronouns/pronouns = target.get_pronouns() var/datum/reagents/touching_reagents = target.get_contact_reagents() - if(!touching_reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(touching_reagents)) to_chat(user, SPAN_WARNING("[user == target ? "You are" : "\The [target] [pronouns.is]"] already dry.")) else user.visible_message(SPAN_NOTICE("\The [user] uses \the [src] to towel [user == target ? pronouns.self : "\the [target]"] dry.")) - touching_reagents.trans_to(src, min(touching_reagents.total_volume, reagent_space)) + touching_reagents.trans_to(src, min(REAGENT_TOTAL_VOLUME(touching_reagents), reagent_space)) playsound(user, 'sound/weapons/towelwipe.ogg', 25, 1) return TRUE @@ -142,10 +145,11 @@ variability = 70 // 30-170%, clamped to be 30-100% for(var/obj/item/target in targets) var/datum/reagents/target_coating = target.coating - if(!target_coating?.total_volume) + var/coating_volume = REAGENT_TOTAL_VOLUME(target_coating) + if(!coating_volume) continue var/fraction_cleaned = clamp(CHEMS_QUANTIZE(rand(100 - variability, 100 + variability) / 100), 0, 100) - target.transfer_coating_to(src, fraction_cleaned * target_coating.total_volume) + target.transfer_coating_to(src, fraction_cleaned * coating_volume) if(!REAGENTS_FREE_SPACE(reagents)) break diff --git a/code/game/objects/items/welding/weldbackpack.dm b/code/game/objects/items/welding/weldbackpack.dm index 82db07b9617a..3dba78bfd1ff 100644 --- a/code/game/objects/items/welding/weldbackpack.dm +++ b/code/game/objects/items/welding/weldbackpack.dm @@ -85,14 +85,15 @@ if(user.check_intent(I_FLAG_HARM)) if(standard_splash_mob(user, O)) return TRUE - if(reagents && reagents.total_volume) + var/total_vol = REAGENT_TOTAL_VOLUME(reagents) + if(reagents && total_vol) to_chat(user, SPAN_DANGER("You splash the contents of \the [src] onto \the [O].")) - reagents.splash(O, reagents.total_volume) + reagents.splash(O, total_vol) return TRUE return ..() /obj/item/chems/weldpack/populate_reagents() - add_to_reagents(/decl/material/liquid/fuel, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/fuel, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/weldpack/Initialize(ml, material_key) if(ispath(welder)) @@ -127,20 +128,20 @@ if(!tool.tank) to_chat(user, SPAN_WARNING("\The [tool] has no tank attached!")) return TRUE - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_WARNING("\The [src] is empty!")) return TRUE - reagents.trans_to_obj(tool.tank, tool.tank.reagents.maximum_volume) + reagents.trans_to_obj(tool.tank, REAGENT_MAXIMUM_VOLUME(tool.tank.reagents)) to_chat(user, SPAN_NOTICE("You refuel \the [used_item].")) playsound(src, 'sound/effects/refill.ogg', 50, TRUE, -6) return TRUE else if(istype(used_item, /obj/item/chems/welder_tank)) - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_WARNING("\The [src] is empty!")) return TRUE var/obj/item/chems/welder_tank/tank = used_item - reagents.trans_to_obj(tank, tank.reagents.maximum_volume) + reagents.trans_to_obj(tank, REAGENT_MAXIMUM_VOLUME(tank.reagents)) to_chat(user, SPAN_NOTICE("You refuel \the [used_item].")) playsound(src, 'sound/effects/refill.ogg', 50, TRUE, -6) return TRUE @@ -180,7 +181,7 @@ /obj/item/chems/weldpack/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - . += "[html_icon(src)] [reagents.total_volume] unit\s of fuel left!" + . += "[html_icon(src)] [REAGENT_TOTAL_VOLUME(reagents)] unit\s of fuel left!" /obj/item/chems/weldpack/dropped(mob/user) . = ..() diff --git a/code/game/objects/items/welding/weldingtool.dm b/code/game/objects/items/welding/weldingtool.dm index 720957f0b6d0..c02b83119e9c 100644 --- a/code/game/objects/items/welding/weldingtool.dm +++ b/code/game/objects/items/welding/weldingtool.dm @@ -169,7 +169,7 @@ /obj/item/weldingtool/fluid_act(var/datum/reagents/fluids) ..() - if(!QDELETED(src) && fluids?.total_volume && welding && !waterproof) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids) && welding && !waterproof) var/turf/location = get_turf(src) if(location) location.hotspot_expose(WELDING_TOOL_HOTSPOT_TEMP_ACTIVE, 50, 1) diff --git a/code/game/objects/items/welding/weldingtool_tank.dm b/code/game/objects/items/welding/weldingtool_tank.dm index ed87e2be8489..ae40b17cb8fd 100644 --- a/code/game/objects/items/welding/weldingtool_tank.dm +++ b/code/game/objects/items/welding/weldingtool_tank.dm @@ -20,17 +20,18 @@ var/lit_force = 11 /obj/item/chems/welder_tank/populate_reagents() - add_to_reagents(/decl/material/liquid/fuel, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/fuel, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/welder_tank/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(distance > 1) return - if(reagents.total_volume <= 0) + var/total_vol = REAGENT_TOTAL_VOLUME(reagents) + if(total_vol <= 0) . += SPAN_WARNING("It is empty.") else - . += "It contains [reagents.total_volume] units of liquid." - . += "It can hold up to [reagents.maximum_volume] units." + . += "It contains [total_vol] units of liquid." + . += "It can hold up to [REAGENT_MAXIMUM_VOLUME(reagents)] units." /obj/item/chems/welder_tank/afterattack(obj/O, mob/user, proximity, click_parameters) if (!ATOM_IS_OPEN_CONTAINER(src) || !proximity) @@ -44,9 +45,10 @@ if(user.check_intent(I_FLAG_HARM)) if(standard_splash_mob(user, O)) return TRUE - if(reagents && reagents.total_volume) + var/total_vol = REAGENT_TOTAL_VOLUME(reagents) + if(reagents && total_vol) to_chat(user, SPAN_DANGER("You splash the contents of \the [src] onto \the [O].")) - reagents.splash(O, reagents.total_volume) + reagents.splash(O, total_vol) return TRUE return ..() @@ -136,7 +138,7 @@ return ..() /obj/item/chems/welder_tank/experimental/Process() - if(REAGENT_VOLUME(reagents, /decl/material/liquid/fuel) < reagents.maximum_volume) + if(REAGENT_VOLUME(reagents, /decl/material/liquid/fuel) < REAGENT_MAXIMUM_VOLUME(reagents)) var/gen_amount = ((world.time-last_gen)/25) add_to_reagents(/decl/material/liquid/fuel, gen_amount) last_gen = world.time \ No newline at end of file diff --git a/code/game/objects/structures/__structure.dm b/code/game/objects/structures/__structure.dm index 704ab61cde54..be2c2102ae50 100644 --- a/code/game/objects/structures/__structure.dm +++ b/code/game/objects/structures/__structure.dm @@ -86,15 +86,16 @@ . += "\The [src] [structure_pronouns.has] been [paint_verb]." if(distance <= 2 && !isnull(get_possible_reagent_transfer_amounts()) && reagents) . += SPAN_NOTICE("It contains:") - if(LAZYLEN(reagents.reagent_volumes)) - for(var/decl/material/reagent as anything in reagents.liquid_volumes) + var/reagent_volumes = REAGENT_VOLUMES(reagents) + if(LAZYLEN(reagent_volumes)) + for(var/decl/material/reagent as anything in REAGENT_LIQUID_VOLUMES(reagents)) . += 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) + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(reagents)) . += 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." + if(REAGENT_MAXIMUM_VOLUME(reagents)) + . += "It may contain up to [REAGENT_MAXIMUM_VOLUME(reagents)] unit\s." /obj/structure/get_examine_hints(mob/user, distance, infix, suffix) . = ..() diff --git a/code/game/objects/structures/barrels/barrel.dm b/code/game/objects/structures/barrels/barrel.dm index c14f9007882d..25f8d585eadf 100644 --- a/code/game/objects/structures/barrels/barrel.dm +++ b/code/game/objects/structures/barrels/barrel.dm @@ -26,13 +26,13 @@ // Overrides due to wonky reagent_dispeners opencontainer flag handling. /obj/structure/reagent_dispensers/barrel/can_be_poured_from(mob/user, atom/target) - return (reagents?.maximum_volume > 0) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) /obj/structure/reagent_dispensers/barrel/can_be_poured_into(mob/user, atom/target) - return (reagents?.maximum_volume > 0) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) // Override to skip open container check. /obj/structure/reagent_dispensers/barrel/can_drink_from(mob/user) - return reagents?.total_volume && user.check_has_mouth() + return REAGENT_TOTAL_VOLUME(reagents) && user.check_has_mouth() /obj/structure/reagent_dispensers/barrel/Initialize() if(ispath(metal_material)) @@ -73,7 +73,7 @@ // Add lid/reagents overlay/lid metal. if(show_liquid_contents && ATOM_IS_OPEN_CONTAINER(src)) if(reagents) - var/overlay_amount = NONUNIT_CEILING(reagents.total_liquid_volume / reagents.maximum_volume * 100, 10) + var/overlay_amount = NONUNIT_CEILING(REAGENT_TOTAL_LIQUID_VOLUME(reagents) / REAGENT_MAXIMUM_VOLUME(reagents) * 100, 10) var/image/filling_overlay = overlay_image(icon, "[icon_state]-[overlay_amount]", reagents.get_color(), RESET_COLOR | RESET_ALPHA) add_overlay(filling_overlay) add_overlay(overlay_image(icon, "[icon_state]-lidopen", material?.color, RESET_COLOR)) @@ -89,7 +89,7 @@ /obj/structure/reagent_dispensers/barrel/get_standard_interactions(var/mob/user) . = ..() - if(reagents?.maximum_volume) + if(REAGENT_MAXIMUM_VOLUME(reagents)) LAZYADD(., global._reagent_interactions) // Disambiguation actions, since barrels can have several different potential interactions for @@ -120,16 +120,16 @@ /obj/structure/reagent_dispensers/barrel/ebony/water/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/barrel/ebony/beer/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/beer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/beer, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/barrel/ebony/wine/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/wine, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/wine, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/barrel/ebony/oil/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/oil, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/oil, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/game/objects/structures/barrels/cask.dm b/code/game/objects/structures/barrels/cask.dm index 603cf2d64335..7143cc94a952 100644 --- a/code/game/objects/structures/barrels/cask.dm +++ b/code/game/objects/structures/barrels/cask.dm @@ -30,16 +30,16 @@ /obj/structure/reagent_dispensers/barrel/cask/ebony/water/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/barrel/cask/ebony/beer/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/beer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/beer, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/barrel/cask/ebony/wine/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/wine, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/wine, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/barrel/cask/ebony/oil/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/oil, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/oil, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/game/objects/structures/beds/rollerbed.dm b/code/game/objects/structures/beds/rollerbed.dm index 39ad505e97d4..d7e7f102ec6d 100644 --- a/code/game/objects/structures/beds/rollerbed.dm +++ b/code/game/objects/structures/beds/rollerbed.dm @@ -24,7 +24,7 @@ icon_state = "down" if(beaker?.reagents) var/image/iv = image(icon, "iv[iv_attached]") - var/percentage = round((beaker.reagents.total_volume / max(beaker.reagents.maximum_volume, 1)) * 100, 25) + var/percentage = round((REAGENT_TOTAL_VOLUME(beaker.reagents) / max(REAGENT_MAXIMUM_VOLUME(beaker.reagents), 1)) * 100, 25) var/image/filling = image(icon, "iv_filling[percentage]") filling.color = beaker.reagents.get_color() iv.overlays += filling @@ -74,7 +74,7 @@ if(SSobj.times_fired % 2) return - if(beaker.reagents?.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(beaker.reagents) > 0) beaker.reagents.trans_to_mob(buckled_mob, beaker.amount_per_transfer_from_this, CHEM_INJECT) queue_icon_update() diff --git a/code/game/objects/structures/chemistry/filter_stand.dm b/code/game/objects/structures/chemistry/filter_stand.dm index b236e3f3dd29..3bffecf5ffe2 100644 --- a/code/game/objects/structures/chemistry/filter_stand.dm +++ b/code/game/objects/structures/chemistry/filter_stand.dm @@ -84,17 +84,17 @@ // Pouring directly into the filter via attackby() is not working, so we just dump our reagents into our filter or the turf. /obj/structure/filter_stand/on_reagent_change() . = ..() - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) return - if(filter?.reagents?.maximum_volume) - var/taking = min(reagents?.total_volume, REAGENTS_FREE_SPACE(filter.reagents)) + if(REAGENT_MAXIMUM_VOLUME(filter?.reagents)) + var/taking = min(REAGENT_TOTAL_VOLUME(reagents), REAGENTS_FREE_SPACE(filter.reagents)) if(taking > 0) reagents.trans_to_holder(filter.reagents, taking) - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) return var/turf/my_turf = get_turf(src) if(istype(my_turf)) - reagents.trans_to_turf(my_turf, reagents.total_volume) + reagents.trans_to_turf(my_turf, REAGENT_TOTAL_VOLUME(reagents)) /obj/item/chems/filter name = "filter" @@ -109,7 +109,7 @@ /obj/item/chems/filter/on_reagent_change() . = ..() - if(reagents?.total_liquid_volume) + if(REAGENT_TOTAL_LIQUID_VOLUME(reagents)) if(!is_processing) START_PROCESSING(SSobj, src) else @@ -117,11 +117,11 @@ STOP_PROCESSING(SSobj, src) /obj/item/chems/filter/Process() - if(!reagents?.total_liquid_volume) + if(!REAGENT_TOTAL_LIQUID_VOLUME(reagents)) return PROCESS_KILL var/dumping = 0 - var/dripping = min(reagents.total_liquid_volume, rand(3,5)) + var/dripping = min(REAGENT_TOTAL_LIQUID_VOLUME(reagents), rand(3,5)) var/obj/structure/filter_stand/stand = loc if(!istype(stand) || stand.filter != src || !stand.loaded?.reagents) dumping = dripping diff --git a/code/game/objects/structures/compost.dm b/code/game/objects/structures/compost.dm index 5d9c3dd623ed..b1929ed281e6 100644 --- a/code/game/objects/structures/compost.dm +++ b/code/game/objects/structures/compost.dm @@ -84,8 +84,9 @@ var/global/const/COMPOST_WORM_HUNGER_FACTOR = MINIMUM_CHEMICAL_VOLUME /obj/structure/reagent_dispensers/compost_bin/physically_destroyed() dump_contents() - if(reagents) - reagents.trans_to(loc, reagents.total_volume) + var/reagent_volume = REAGENT_TOTAL_VOLUME(reagents) + if(reagent_volume) + reagents.trans_to(loc, reagent_volume) return ..() /obj/structure/reagent_dispensers/compost_bin/attackby(obj/item/used_item, mob/user) @@ -158,8 +159,8 @@ var/global/const/COMPOST_WORM_HUNGER_FACTOR = MINIMUM_CHEMICAL_VOLUME for(var/obj/item/thing in composting.get_contained_external_atoms()) thing.forceMove(src) - if(composting.reagents?.total_volume) - composting.reagents.trans_to_holder(reagents, composting.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(composting.reagents)) + composting.reagents.trans_to_holder(reagents, REAGENT_TOTAL_VOLUME(composting.reagents)) composting.reagents.clear_reagents() composting.clear_matter() @@ -174,12 +175,12 @@ var/global/const/COMPOST_WORM_HUNGER_FACTOR = MINIMUM_CHEMICAL_VOLUME remains.update_primary_material() // Digest reagents. - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(istype(reagent, /decl/material/liquid/fertilizer)) continue if(!reagent.compost_value) continue - var/clamped_worm_drink_amount = min(round(worm_eat_amount * REAGENT_UNITS_PER_MATERIAL_UNIT), reagents.reagent_volumes[reagent]) + var/clamped_worm_drink_amount = min(round(worm_eat_amount * REAGENT_UNITS_PER_MATERIAL_UNIT), REAGENT_VOLUME(reagents, 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 diff --git a/code/game/objects/structures/fires.dm b/code/game/objects/structures/fires.dm index 273c685709aa..48f1205c014c 100644 --- a/code/game/objects/structures/fires.dm +++ b/code/game/objects/structures/fires.dm @@ -126,8 +126,8 @@ /obj/structure/fire_source/fluid_act(datum/reagents/fluids) . = ..() - if(!QDELETED(src) && fluids?.total_volume && reagents) - var/transfer = min(reagents.maximum_volume - reagents.total_volume, max(max(1, round(fluids.total_volume * 0.25)))) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids) && reagents) + var/transfer = min(REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(reagents), max(max(1, round(REAGENT_TOTAL_VOLUME(fluids) * 0.25)))) if(transfer > 0) fluids.trans_to_obj(src, transfer) @@ -363,13 +363,13 @@ /obj/structure/fire_source/on_reagent_change() if(!(. = ..())) return - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) var/do_steam = FALSE var/datum/gas_mixture/our_air = return_air() var/ambient_pressure = our_air ? our_air.return_pressure() : ONE_ATMOSPHERE var/list/waste = list() - for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.accelerant_value <= FUEL_VALUE_SUPPRESSANT && reagent.phase_at_temperature(get_effective_burn_temperature(), ambient_pressure) == MAT_PHASE_GAS) do_steam = TRUE diff --git a/code/game/objects/structures/fishtanks.dm b/code/game/objects/structures/fishtanks.dm index a8855275998b..c9ab4bc5f72e 100644 --- a/code/game/objects/structures/fishtanks.dm +++ b/code/game/objects/structures/fishtanks.dm @@ -53,7 +53,7 @@ var/global/list/fishtank_cache = list() /obj/structure/glass_tank/populate_reagents() if(fill_type) - add_to_reagents(fill_type, reagents.maximum_volume) + add_to_reagents(fill_type, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/glass_tank/attack_hand(var/mob/user) if(user.check_intent(I_FLAG_HARM)) @@ -77,7 +77,7 @@ var/global/list/fishtank_cache = list() if(paint_color) shard.set_color(paint_color) if(!silent) - if(contents.len || reagents.total_volume) + if(contents.len || REAGENT_TOTAL_VOLUME(reagents)) visible_message(SPAN_DANGER("\The [src] shatters, spilling its contents everywhere!")) else visible_message(SPAN_DANGER("\The [src] shatters!")) @@ -90,8 +90,8 @@ var/global/list/fishtank_cache = list() /obj/structure/glass_tank/dump_contents(atom/forced_loc = loc, mob/user) . = ..() var/turf/T = get_turf(forced_loc) - if(reagents?.total_volume && T) - reagents.trans_to_turf(T, reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents) && T) + reagents.trans_to_turf(T, REAGENT_TOTAL_VOLUME(reagents)) var/global/list/global/aquarium_states_and_layers = list( "b" = FLY_LAYER - 0.02, @@ -119,7 +119,7 @@ var/global/list/global/aquarium_states_and_layers = list( tank_overlay.cut_overlays() for(var/i = 1 to 4) for(var/key_mod in global.aquarium_states_and_layers) - if(key_mod == "w" && (!reagents || !reagents.total_volume)) + if(key_mod == "w" && (!reagents || !REAGENT_TOTAL_VOLUME(reagents))) continue var/cache_key = "[c_states[i]][key_mod]-[i]" if(!global.fishtank_cache[cache_key]) diff --git a/code/game/objects/structures/fountain.dm b/code/game/objects/structures/fountain.dm index d4287c844c53..da68645ad82a 100644 --- a/code/game/objects/structures/fountain.dm +++ b/code/game/objects/structures/fountain.dm @@ -117,7 +117,7 @@ light_power = null /obj/structure/fountain/mundane/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) //Don't give free water when building one + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) //Don't give free water when building one /obj/structure/fountain/mundane/attack_hand(mob/user) if(user.check_intent(I_FLAG_HARM)) diff --git a/code/game/objects/structures/iv_drip.dm b/code/game/objects/structures/iv_drip.dm index e6dbe8176ab3..661a79f2e52b 100644 --- a/code/game/objects/structures/iv_drip.dm +++ b/code/game/objects/structures/iv_drip.dm @@ -38,8 +38,8 @@ add_overlay(base) if(beaker?.reagents) - var/percent = round((beaker.reagents.total_volume / beaker.reagents.maximum_volume) * 100) - if(beaker.reagents.total_volume) + var/percent = round((REAGENT_TOTAL_VOLUME(beaker.reagents) / REAGENT_MAXIMUM_VOLUME(beaker.reagents)) * 100) + if(REAGENT_TOTAL_VOLUME(beaker.reagents)) var/mutable_appearance/filling = mutable_appearance(icon, "reagent") switch(percent) if(0) @@ -119,11 +119,11 @@ return if(mode) // Give blood - if(beaker.reagents?.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(beaker.reagents) > 0) beaker.reagents.trans_to_mob(attached, transfer_amount, CHEM_INJECT) queue_icon_update() else // Take blood - var/amount = beaker.reagents.maximum_volume - beaker.reagents.total_volume + var/amount = REAGENT_MAXIMUM_VOLUME(beaker.reagents) - REAGENT_TOTAL_VOLUME(beaker.reagents) amount = min(amount, 4) if(amount == 0) // If the beaker is full, ping @@ -192,8 +192,8 @@ . += "The IV drip is [mode ? "injecting" : "taking blood"]." . += "It is set to transfer [transfer_amount]u of chemicals per cycle." if(beaker) - if(beaker.reagents?.total_volume) - . += SPAN_NOTICE("Attached is \a [beaker] with [beaker.reagents.total_volume] units of liquid.") + if(REAGENT_TOTAL_VOLUME(beaker.reagents)) + . += SPAN_NOTICE("Attached is \a [beaker] with [REAGENT_TOTAL_VOLUME(beaker.reagents)] units of liquid.") else . += SPAN_NOTICE("Attached is an empty [beaker].") else diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 7f01952bc4b6..75f4e5f78586 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -18,7 +18,7 @@ /obj/structure/janitorialcart/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(distance <= 1) - . += "\The [src] [html_icon(src)] contains [reagents.total_volume] unit\s of liquid!" + . += "\The [src] [html_icon(src)] contains [REAGENT_TOTAL_VOLUME(reagents)] unit\s of liquid!" /obj/structure/janitorialcart/attackby(obj/item/used_item, mob/user) if(istype(used_item, /obj/item/bag/trash) && !mybag) @@ -31,11 +31,11 @@ return TRUE 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) + if(REAGENT_TOTAL_VOLUME(used_item.reagents) < REAGENT_MAXIMUM_VOLUME(used_item.reagents)) //if it's not completely soaked we assume they want to wet it, otherwise store it + if(REAGENT_TOTAL_VOLUME(reagents) < 1) to_chat(user, "[src] is out of water!") else - reagents.trans_to_obj(used_item, used_item.reagents.maximum_volume) + reagents.trans_to_obj(used_item, REAGENT_MAXIMUM_VOLUME(used_item.reagents)) to_chat(user, "You wet [used_item] in [src].") playsound(loc, 'sound/effects/slosh.ogg', 25, 1) return TRUE @@ -209,14 +209,14 @@ /obj/structure/janicart/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(distance <= 1) - . += "[html_icon(src)] This [callme] contains [reagents.total_volume] unit\s of water!" + . += "[html_icon(src)] This [callme] contains [REAGENT_TOTAL_VOLUME(reagents)] unit\s of water!" if(mybag) . += "\A [mybag] is hanging on the [callme]." /obj/structure/janicart/attackby(obj/item/used_item, mob/user) if(istype(used_item, /obj/item/mop)) - if(reagents.total_volume > 1) + if(REAGENT_TOTAL_VOLUME(reagents) > 1) 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) diff --git a/code/game/objects/structures/mop_bucket.dm b/code/game/objects/structures/mop_bucket.dm index 57cc6d0e03f6..8e37b95f89f6 100644 --- a/code/game/objects/structures/mop_bucket.dm +++ b/code/game/objects/structures/mop_bucket.dm @@ -11,11 +11,11 @@ /obj/structure/mopbucket/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(distance <= 1) - . += "\The [src] [html_icon(src)] contains [reagents.total_volume] unit\s of water!" + . += "\The [src] [html_icon(src)] contains [REAGENT_TOTAL_VOLUME(reagents)] unit\s of water!" /obj/structure/mopbucket/attackby(obj/item/used_item, mob/user) if(istype(used_item, /obj/item/mop)) - if(reagents.total_volume < 1) + if(REAGENT_TOTAL_VOLUME(reagents) < 1) to_chat(user, SPAN_WARNING("\The [src] is out of water!")) else if(REAGENTS_FREE_SPACE(used_item.reagents) >= 5) reagents.trans_to_obj(used_item, 5) diff --git a/code/game/objects/structures/skele_stand.dm b/code/game/objects/structures/skele_stand.dm index 4b3d9d944d18..58ac90d99e01 100644 --- a/code/game/objects/structures/skele_stand.dm +++ b/code/game/objects/structures/skele_stand.dm @@ -9,7 +9,7 @@ /obj/structure/skele_stand/Initialize() . = ..() - gender = pick(MALE, FEMALE, PLURAL) + set_gender(pick(MALE, FEMALE, PLURAL)) /obj/structure/skele_stand/proc/rattle_bones(mob/user, atom/thingy) if((world.time - cooldown) <= 1 SECOND) @@ -54,7 +54,8 @@ for(var/slot in swag) var/obj/item/clothing/C = swag[slot] swagnames += C.get_examine_line() - . += "[gender == MALE ? "He" : "She"] is wearing [english_list(swagnames)]." + var/decl/pronouns/stand_pronouns = get_pronouns() + . += "[stand_pronouns.He] [stand_pronouns.is] wearing [english_list(swagnames)]." /obj/structure/skele_stand/attackby(obj/item/used_item, mob/user) if(IS_PEN(used_item)) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 76b4a59db265..b3ea8979b730 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -92,7 +92,7 @@ var/global/list/hygiene_props = list() visible_message("\The [src] gurgles and overflows!") next_gurgle = world.time + 80 playsound(T, pick(SSfluids.gurgles), 50, 1) - var/adding = min(flood_amt-T?.reagents?.total_volume, rand(30,50)*clogged) + var/adding = min(flood_amt - REAGENT_TOTAL_VOLUME(T?.reagents), rand(30,50)*clogged) if(adding > 0) T.add_to_reagents(/decl/material/liquid/water, adding) @@ -336,7 +336,7 @@ var/global/list/hygiene_props = list() add_to_reagents(/decl/material/liquid/water, REAGENTS_FREE_SPACE(reagents)) if(world.time >= next_wash) next_wash = world.time + (10 SECONDS) - reagents.splash(get_turf(src), reagents.total_volume, max_spill = 0) + reagents.splash(get_turf(src), REAGENT_TOTAL_VOLUME(reagents), max_spill = 0) /obj/structure/hygiene/shower/proc/process_heat(mob/living/M) if(!on || !istype(M)) @@ -370,7 +370,7 @@ var/global/list/hygiene_props = list() . = ..() if(!. && isitem(dropping) && ATOM_IS_OPEN_CONTAINER(dropping)) var/obj/item/thing = dropping - if(thing.reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(thing.reagents) <= 0) to_chat(usr, SPAN_WARNING("\The [thing] is empty.")) else visible_message(SPAN_NOTICE("\The [user] tips the contents of \the [thing] into \the [src].")) diff --git a/code/game/objects/structures/well.dm b/code/game/objects/structures/well.dm index 9480d5721d51..0faa71321e7c 100644 --- a/code/game/objects/structures/well.dm +++ b/code/game/objects/structures/well.dm @@ -20,12 +20,12 @@ // Override to skip open container check. /obj/structure/reagent_dispensers/well/can_drink_from(mob/user) - return reagents?.total_volume && user.check_has_mouth() + return REAGENT_TOTAL_VOLUME(reagents) && user.check_has_mouth() /obj/structure/reagent_dispensers/well/populate_reagents() . = ..() if(auto_refill) - add_to_reagents(auto_refill, reagents.maximum_volume) + add_to_reagents(auto_refill, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/well/Destroy() if(is_processing) @@ -34,7 +34,7 @@ /obj/structure/reagent_dispensers/well/on_update_icon() . = ..() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) add_overlay(overlay_image(icon, "[icon_state]-fluid", reagents.get_color(), (RESET_COLOR | RESET_ALPHA))) if(istype(reinf_material)) // reinf_material -> roof and posts, at this point in time var/image/roof_image = overlay_image(icon, "[icon_state]-roof", reinf_material.color, RESET_COLOR | RESET_ALPHA | KEEP_APART) @@ -50,25 +50,25 @@ // Overrides due to wonky reagent_dispeners opencontainer flag handling. /obj/structure/reagent_dispensers/well/can_be_poured_from(mob/user, atom/target) - return (reagents?.maximum_volume > 0) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) /obj/structure/reagent_dispensers/well/can_be_poured_into(mob/user, atom/target) - return (reagents?.maximum_volume > 0) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) /obj/structure/reagent_dispensers/well/get_standard_interactions(var/mob/user) . = ..() - if(reagents?.maximum_volume) + if(REAGENT_MAXIMUM_VOLUME(reagents)) LAZYADD(., global._reagent_interactions) /obj/structure/reagent_dispensers/well/Process() if(!reagents || !auto_refill) // if we're full, we only stop at the end of the proc; we need to check for contaminants first return PROCESS_KILL var/amount_to_add = rand(5, 10) - if(length(reagents.reagent_volumes) > 1) // we have impurities! + if(length(REAGENT_VOLUMES(reagents)) > 1) // we have impurities! reagents.remove_any(amount_to_add, defer_update = TRUE, skip_reagents = list(auto_refill)) // defer update until the add_reagent call below - if(reagents.total_volume < reagents.maximum_volume) + if(REAGENT_TOTAL_VOLUME(reagents) < REAGENT_MAXIMUM_VOLUME(reagents)) reagents.add_reagent(auto_refill, amount_to_add) return // don't stop processing - else if(length(reagents.reagent_volumes) == 1 && reagents.get_primary_reagent_type() == auto_refill) + else if(length(REAGENT_VOLUMES(reagents)) == 1 && reagents.get_primary_reagent_type() == auto_refill) // only one reagent and it's our auto_refill, our work is done here return PROCESS_KILL // if we get here, it means we have a full well with contaminants, so we keep processing diff --git a/code/game/turfs/flooring/flooring_mud.dm b/code/game/turfs/flooring/flooring_mud.dm index 001a0c33ce90..bdce5b2859e8 100644 --- a/code/game/turfs/flooring/flooring_mud.dm +++ b/code/game/turfs/flooring/flooring_mud.dm @@ -14,7 +14,7 @@ uid = "floor_mud" /decl/flooring/mud/fire_act(turf/floor/target, datum/gas_mixture/air, exposed_temperature, exposed_volume) - if(!target.reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(target.reagents)) if(target.get_topmost_flooring() == src) target.set_flooring(/decl/flooring/dry_mud) else if(target.get_base_flooring() == src) diff --git a/code/game/turfs/flooring/flooring_snow.dm b/code/game/turfs/flooring/flooring_snow.dm index 78e5b5f0b486..881da81bdcce 100644 --- a/code/game/turfs/flooring/flooring_snow.dm +++ b/code/game/turfs/flooring/flooring_snow.dm @@ -25,7 +25,7 @@ . = max(., 0) /decl/flooring/snow/fire_act(turf/floor/target, datum/gas_mixture/air, exposed_temperature, exposed_volume) - if(!target.reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(target.reagents)) if(target.get_topmost_flooring() == src) target.remove_flooring(src) else if(target.get_base_flooring() == src) diff --git a/code/game/turfs/floors/_floor.dm b/code/game/turfs/floors/_floor.dm index d31643ba2deb..3982c3dab82d 100644 --- a/code/game/turfs/floors/_floor.dm +++ b/code/game/turfs/floors/_floor.dm @@ -67,8 +67,8 @@ /turf/floor/proc/fill_to_zero_height() var/my_height = get_physical_height() - if(fill_reagent_type && my_height < 0 && (!reagents || !QDELING(reagents)) && reagents?.total_volume < abs(my_height)) - var/reagents_to_add = abs(my_height) - reagents?.total_volume + if(fill_reagent_type && my_height < 0 && (!reagents || !QDELING(reagents)) && REAGENT_TOTAL_VOLUME(reagents) < abs(my_height)) + var/reagents_to_add = abs(my_height) - REAGENT_TOTAL_VOLUME(reagents) add_to_reagents(fill_reagent_type, reagents_to_add, phase = MAT_PHASE_LIQUID) /turf/floor/can_climb_from_below(var/mob/climber) diff --git a/code/game/turfs/floors/floor_acts.dm b/code/game/turfs/floors/floor_acts.dm index b231da61241b..ee60bcbf367f 100644 --- a/code/game/turfs/floors/floor_acts.dm +++ b/code/game/turfs/floors/floor_acts.dm @@ -27,7 +27,7 @@ /turf/floor/fluid_act(var/datum/reagents/fluids) . = ..() - if(!QDELETED(fluids) && fluids.total_volume) + if(!QDELETED(fluids) && REAGENT_TOTAL_VOLUME(fluids)) for(var/decl/flooring/flooring in get_all_flooring()) if(flooring.fluid_act(src, fluids)) return diff --git a/code/game/turfs/floors/floor_layers.dm b/code/game/turfs/floors/floor_layers.dm index 18cfa6f04fe9..8fb98f91fa6a 100644 --- a/code/game/turfs/floors/floor_layers.dm +++ b/code/game/turfs/floors/floor_layers.dm @@ -207,7 +207,8 @@ update_floor_strings() - gender = copy_from.gender + set_gender(copy_from.gender) + layer = copy_from.floor_layer turf_flags = copy_from.turf_flags z_flags = copy_from.z_flags diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 36fa7f51f578..33828543cd5d 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -211,8 +211,8 @@ if(weather) . += weather.get_movement_delay(return_air(), travel_dir) // TODO: check user species webbed feet, wearing swimming gear - if(!get_supporting_platform() && reagents?.total_volume > FLUID_PUDDLE) - . += (reagents.total_volume > FLUID_SHALLOW) ? 6 : 3 + if(!get_supporting_platform() && REAGENT_TOTAL_VOLUME(reagents) > FLUID_PUDDLE) + . += (REAGENT_TOTAL_VOLUME(reagents) > FLUID_SHALLOW) ? 6 : 3 /turf/attack_hand(mob/user) @@ -354,8 +354,8 @@ var/mob/mover_mob = mover if(!istype(mover_mob) || (!mover_mob.throwing && !mover_mob.can_overcome_gravity())) var/turf/old_turf = mover.loc - var/old_height = old_turf.get_physical_height() + old_turf.reagents?.total_volume - var/current_height = get_physical_height() + reagents?.total_volume + var/old_height = old_turf.get_physical_height() + REAGENT_TOTAL_VOLUME(old_turf.reagents) + var/current_height = get_physical_height() + REAGENT_TOTAL_VOLUME(reagents) if(abs(current_height - old_height) > FLUID_SHALLOW) if(current_height > old_height) return 0 diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm index dedebcfc16aa..5c849feec9a2 100644 --- a/code/game/turfs/turf_changing.dm +++ b/code/game/turfs/turf_changing.dm @@ -64,6 +64,7 @@ var/old_affecting_lights = affecting_lights var/old_lighting_overlay = lighting_overlay var/old_dynamic_lighting = TURF_IS_DYNAMICALLY_LIT_UNSAFE(src) + var/old_z_opacity = z_flags & ZM_ALLOW_LIGHTING var/old_flooded = flooded var/old_outside = is_outside var/old_is_open = is_open() @@ -145,6 +146,11 @@ if (old_ambience != ambient_light || old_ambience_mult != ambient_light_multiplier) update_ambient_light(FALSE) + var/new_z_opacity = z_flags & ZM_ALLOW_LIGHTING + if (new_z_opacity != old_z_opacity) + for (var/datum/lighting_corner/corn in corners) + corn.rebuild_ztraversal(!new_z_opacity) + var/tidlu = TURF_IS_DYNAMICALLY_LIT_UNSAFE(src) if ((old_opacity != opacity) || (tidlu != old_dynamic_lighting) || force_lighting_update) reconsider_lights() diff --git a/code/game/turfs/turf_enter.dm b/code/game/turfs/turf_enter.dm index a83d87a855fe..cb1849868ab6 100644 --- a/code/game/turfs/turf_enter.dm +++ b/code/game/turfs/turf_enter.dm @@ -33,8 +33,8 @@ if(isturf(old_loc) && has_gravity() && A.can_fall() && !isnull(platform) && !(weakref(A) in skip_height_fall_for)) var/turf/old_turf = old_loc - var/old_height = old_turf.get_physical_height() + old_turf.reagents?.total_volume - var/current_height = get_physical_height() + reagents?.total_volume + var/old_height = old_turf.get_physical_height() + REAGENT_TOTAL_VOLUME(old_turf.reagents) + var/current_height = get_physical_height() + REAGENT_TOTAL_VOLUME(reagents) var/height_difference = abs(current_height - old_height) if(current_height < old_height && height_difference > FLUID_SHALLOW) diff --git a/code/game/turfs/turf_fluids.dm b/code/game/turfs/turf_fluids.dm index bb59234398df..fe248f689773 100644 --- a/code/game/turfs/turf_fluids.dm +++ b/code/game/turfs/turf_fluids.dm @@ -30,7 +30,7 @@ continue LAZYDISTINCTADD(spread_into_neighbors, neighbor) if(length(spread_into_neighbors)) - var/spreading = round(reagents.total_volume / length(spread_into_neighbors)) + var/spreading = round(REAGENT_TOTAL_VOLUME(reagents) / length(spread_into_neighbors)) if(spreading > 0) for(var/turf/spread_into_turf as anything in spread_into_neighbors) reagents.trans_to_turf(spread_into_turf, spreading) @@ -83,8 +83,8 @@ return FLUID_MAX_DEPTH var/obj/structure/glass_tank/aquarium = locate() in contents if(aquarium) - return aquarium.reagents?.total_volume * TANK_WATER_MULTIPLIER - return reagents?.total_volume || 0 + return REAGENT_TOTAL_VOLUME(aquarium.reagents) * TANK_WATER_MULTIPLIER + return REAGENT_TOTAL_VOLUME(reagents) /turf/proc/show_bubbles() set waitfor = FALSE @@ -102,7 +102,7 @@ T.fluid_update(TRUE) if(flooded) ADD_ACTIVE_FLUID_SOURCE(src) - else if(reagents?.total_volume > FLUID_QDEL_POINT) + else if(REAGENT_TOTAL_VOLUME(reagents) > FLUID_QDEL_POINT) ADD_ACTIVE_FLUID(src) /turf/get_reagents() @@ -119,10 +119,10 @@ /turf/fluid_act(var/datum/reagents/fluids) ..() - if(!QDELETED(src) && fluids?.total_volume) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids)) fluids.touch_turf(src, touch_atoms = FALSE) // Handled in fluid_act() below. // Wet items that are not supported on a platform or such. - var/effective_volume = fluids?.total_volume + var/effective_volume = REAGENT_TOTAL_VOLUME(fluids) if(get_supporting_platform()) // Depth is negative height, hence +=. TODO: positive heights? No idea how to handle that. effective_volume += get_physical_height() @@ -133,7 +133,7 @@ AM.fluid_act(fluids) /turf/proc/remove_fluids(var/amount, var/defer_update) - if(!reagents?.total_liquid_volume) + if(!REAGENT_TOTAL_LIQUID_VOLUME(reagents)) return remove_any_reagents(amount, defer_update = defer_update, removed_phases = MAT_PHASE_LIQUID) if(defer_update && !QDELETED(reagents)) @@ -141,12 +141,12 @@ /turf/proc/transfer_fluids_to(var/turf/target, var/amount, var/defer_update = TRUE) // No flowing of reagents without liquids, but this proc should not be called if liquids are not present regardless. - if(!reagents?.total_liquid_volume) + if(!REAGENT_TOTAL_LIQUID_VOLUME(reagents)) return target.create_or_update_reagents(FLUID_MAX_DEPTH) // We reference total_volume instead of total_liquid_volume here because the maximum volume limits of the turfs still respect solid volumes, and depth is still determined by total volume. - reagents.trans_to_turf(target, min(reagents.total_volume, min(target.reagents.maximum_volume - target.reagents.total_volume, amount)), defer_update = defer_update) + reagents.trans_to_turf(target, min(REAGENT_TOTAL_VOLUME(reagents), min(REAGENT_MAXIMUM_VOLUME(target.reagents) - REAGENT_TOTAL_VOLUME(target.reagents), amount)), defer_update = defer_update) if(defer_update) if(!QDELETED(reagents)) SSfluids.holders_to_update[reagents] = TRUE @@ -159,12 +159,12 @@ vaporize_fuel(air) /turf/proc/vaporize_fuel(datum/gas_mixture/air) - if(!length(reagents?.reagent_volumes) || !istype(air)) + if(!length(REAGENT_VOLUMES(reagents)) || !istype(air)) return var/update_air = FALSE - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.gas_flags & XGM_GAS_FUEL) - var/moles = round(reagents.reagent_volumes[reagent] / REAGENT_UNITS_PER_GAS_MOLE) + var/moles = round(REAGENT_VOLUME(reagents, reagent) / REAGENT_UNITS_PER_GAS_MOLE) if(moles > 0) air.adjust_gas(reagent.type, moles, FALSE) remove_from_reagents(reagent, round(moles * REAGENT_UNITS_PER_GAS_MOLE)) @@ -179,10 +179,10 @@ if(!(. = ..())) return - if(reagents?.total_liquid_volume < FLUID_SLURRY) + if(REAGENT_TOTAL_LIQUID_VOLUME(reagents) < FLUID_SLURRY) dump_solid_reagents() - if(reagents?.total_volume > FLUID_QDEL_POINT) + if(REAGENT_TOTAL_VOLUME(reagents) > 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) >= primary_reagent.slippery_amount)) @@ -204,16 +204,17 @@ for(var/checkdir in global.cardinal) var/turf/neighbor = get_step_resolving_mimic(src, checkdir) - if(neighbor?.reagents?.total_volume > FLUID_QDEL_POINT) + if(REAGENT_TOTAL_VOLUME(neighbor?.reagents) > FLUID_QDEL_POINT) ADD_ACTIVE_FLUID(neighbor) /turf/proc/dump_solid_reagents(datum/reagents/solids) if(!istype(solids)) solids = reagents - if(LAZYLEN(solids?.solid_volumes)) + var/solid_volumes = REAGENT_SOLID_VOLUMES(solids) + if(LAZYLEN(solid_volumes)) var/list/matter_list = list() - for(var/decl/material/reagent as anything in solids.solid_volumes) - var/reagent_amount = solids.solid_volumes[reagent] + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(solid_volumes)) + var/reagent_amount = SOLID_VOLUME(solids, 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) diff --git a/code/game/turfs/walls/wall_attacks.dm b/code/game/turfs/walls/wall_attacks.dm index 15cd5a1dbeec..d736a234400d 100644 --- a/code/game/turfs/walls/wall_attacks.dm +++ b/code/game/turfs/walls/wall_attacks.dm @@ -17,7 +17,6 @@ for(var/turf/turf in loc) if(turf.simulated) SSair.mark_for_update(turf) - set_light(density) update_icon() update_air() refresh_opacity() diff --git a/code/game/turfs/walls/wall_natural_xenoarch.dm b/code/game/turfs/walls/wall_natural_xenoarch.dm index 85a49e5282fb..e1ea12d7dd46 100644 --- a/code/game/turfs/walls/wall_natural_xenoarch.dm +++ b/code/game/turfs/walls/wall_natural_xenoarch.dm @@ -78,12 +78,12 @@ var/excav_level = P.get_tool_property(TOOL_PICK, TOOL_PROP_EXCAVATION_DEPTH) excavation_level += excav_level //archaeo overlays - if(!archaeo_overlay && finds && finds.len) + if(!archaeo_overlay && LAZYLEN(finds)) var/datum/find/F = finds[1] if(F.excavation_required <= excavation_level + F.view_range) archaeo_overlay = image('icons/turf/excavation_overlays.dmi',"overlay_archaeo[rand(1,3)]") queue_icon_update() - else if(archaeo_overlay && (!finds || !finds.len)) + else if(archaeo_overlay && !LAZYLEN(finds)) archaeo_overlay = null queue_icon_update() diff --git a/code/game/world_topic_commands.dm b/code/game/world_topic_commands.dm index ab871592c196..43ef54a7e8f1 100644 --- a/code/game/world_topic_commands.dm +++ b/code/game/world_topic_commands.dm @@ -349,11 +349,3 @@ return "Ckey not found" else return "Database connection failed or not set up" - -/decl/topic_command/secure/prometheus_metrics - name = "prometheus_metrics" - uid = "topic_command_prometheus_metrics" - -/decl/topic_command/secure/prometheus_metrics/use() - var/static/decl/prometheus_metrics/prometheus_metrics = IMPLIED_DECL - return prometheus_metrics.collect() diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 1cd43c395226..151a6da37714 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -277,7 +277,7 @@ var/global/BSACooldown = 0 var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav") var/list/infos from_file(info, infos) - if(!infos || !infos.len) return 0 + if(!LAZYLEN(infos)) return 0 else return 1 diff --git a/code/modules/admin/admin_attack_log.dm b/code/modules/admin/admin_attack_log.dm index 433420e57eb1..ad2970300484 100644 --- a/code/modules/admin/admin_attack_log.dm +++ b/code/modules/admin/admin_attack_log.dm @@ -11,7 +11,7 @@ message_admins(user ? "[key_name_admin(user)] [message]" : "EVENT [message]") /proc/log_and_message_admins_many(var/list/mob/users, var/message) - if(!users || !users.len) + if(!LAZYLEN(users)) return var/list/user_keys = list() @@ -95,7 +95,7 @@ return FALSE /proc/admin_attacker_log_many_victims(var/mob/attacker, var/list/mob/victims, var/attacker_message, var/victim_message, var/admin_message) - if(!victims || !victims.len) + if(!LAZYLEN(victims)) return for(var/mob/victim in victims) diff --git a/code/modules/admin/buildmode/mode_areas.dm b/code/modules/admin/buildmode/mode_areas.dm index 39b28fa353c1..4df3b7e41797 100644 --- a/code/modules/admin/buildmode/mode_areas.dm +++ b/code/modules/admin/buildmode/mode_areas.dm @@ -39,7 +39,7 @@ /datum/build_mode/areas/Configurate() var/mode = alert("Pick or Create an area.", "Build Mode: Areas", "Pick", "Create", "Cancel") if (mode == "Pick") - var/area/path = select_subpath((selected_area?.type || /area/space), /area) + var/area/path = select_subpath((selected_area?.type || world.area), /area) if (path) for (var/area/build_area in global.areas) if (build_area.type == path) @@ -55,7 +55,7 @@ new_area.power_equip = 0 new_area.power_light = 0 new_area.power_environ = 0 - new_area.always_unpowered = 0 + new_area.always_unpowered = FALSE SelectArea(new_area) user.client.debug_variables(selected_area) to_chat(user, "Created area [new_area.proper_name]") diff --git a/code/modules/admin/dbban/functions.dm b/code/modules/admin/dbban/functions.dm index fc8594d64e76..f86f8d0cb4bb 100644 --- a/code/modules/admin/dbban/functions.dm +++ b/code/modules/admin/dbban/functions.dm @@ -415,13 +415,13 @@ if(playercid) cidsearch = "AND `computerid` = '[playercid]' " else - if(adminckey && length(adminckey) >= 3) + if(length(adminckey) >= 3) adminsearch = "AND `a_ckey` LIKE '[adminckey]%' " - if(playerckey && length(playerckey) >= 3) + if(length(playerckey) >= 3) playersearch = "AND `ckey` LIKE '[playerckey]%' " - if(playerip && length(playerip) >= 3) + if(length(playerip) >= 3) ipsearch = "AND `ip` LIKE '[playerip]%' " - if(playercid && length(playercid) >= 7) + if(length(playercid) >= 7) cidsearch = "AND `computerid` LIKE '[playercid]%' " if(dbbantype) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 29ed77d51145..4d920bdc9f79 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1,4 +1,5 @@ #define MAX_JOBBAN_CELLS 5 +var/global/list/misc_jobban_roles = list("Botany Roles", "Graffiti") /datum/admins/Topic(href, href_list) ..() @@ -385,11 +386,10 @@ jobs += "
[name_plural]
" #undef ANTAG_COLUMNS - var/list/misc_roles = list("Botany Roles", "Graffiti") //Other roles (BLUE, because I have no idea what other color to make this) jobs += "" - jobs += "" - for(var/entry in misc_roles) + jobs += "" + for(var/entry in misc_jobban_roles) if(jobban_isbanned(M, entry)) jobs += "" else diff --git a/code/modules/atmospherics/datum_pipeline.dm b/code/modules/atmospherics/datum_pipeline.dm index 89e598b527ff..ef8b9c372610 100644 --- a/code/modules/atmospherics/datum_pipeline.dm +++ b/code/modules/atmospherics/datum_pipeline.dm @@ -30,7 +30,7 @@ STOP_PROCESSING(SSprocessing, src) QDEL_NULL(network) - if(air?.total_volume || liquid?.total_volume) + if(air?.total_volume || REAGENT_TOTAL_VOLUME(liquid)) temporarily_store_fluids() QDEL_NULL(air) @@ -61,7 +61,7 @@ /datum/pipeline/proc/temporarily_store_fluids() //Update individual gas_mixtures by volume ratio - var/liquid_transfer_per_pipe = min(REAGENT_UNITS_PER_PIPE, (liquid && length(members)) ? (liquid.total_volume / length(members)) : 0) + var/liquid_transfer_per_pipe = min(REAGENT_UNITS_PER_PIPE, (liquid && length(members)) ? (REAGENT_TOTAL_VOLUME(liquid) / length(members)) : 0) if(!air?.total_volume && !liquid_transfer_per_pipe) return @@ -119,9 +119,9 @@ air.merge(item.air_temporary) item.air_temporary = null - liquid.maximum_volume += REAGENT_UNITS_PER_PIPE + REAGENT_ADD_MAX_VOL(liquid, REAGENT_UNITS_PER_PIPE) if(item.liquid_temporary) - item.liquid_temporary.trans_to_holder(liquid, item.liquid_temporary.total_volume) + item.liquid_temporary.trans_to_holder(liquid, REAGENT_TOTAL_VOLUME(item.liquid_temporary)) item.liquid_temporary = null if(item.leaking) @@ -135,7 +135,7 @@ possible_expansions -= borderline air.total_volume = temp_volume - liquid.maximum_volume = length(members) * REAGENT_UNITS_PER_PIPE + REAGENT_SET_MAX_VOL(liquid, (length(members) * REAGENT_UNITS_PER_PIPE)) /datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) if(new_network.line_members.Find(src)) @@ -186,7 +186,7 @@ air.merge(air_sample) //turf_air already modified by equalize_gases() - if(liquid?.total_volume) + if(REAGENT_TOTAL_VOLUME(liquid)) liquid.trans_to_turf(target, FLUID_PUDDLE) if(network) diff --git a/code/modules/atmospherics/pipes.dm b/code/modules/atmospherics/pipes.dm index ef7fa5484345..5d7ee7e8cb1f 100644 --- a/code/modules/atmospherics/pipes.dm +++ b/code/modules/atmospherics/pipes.dm @@ -128,7 +128,7 @@ loc.assume_air(air_temporary) air_temporary = null if(liquid_temporary) - liquid_temporary.trans_to(loc, liquid_temporary.total_volume) + liquid_temporary.trans_to(loc, REAGENT_TOTAL_VOLUME(liquid_temporary)) liquid_temporary = null if(leaking) STOP_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF) diff --git a/code/modules/augment/passive/boost.dm b/code/modules/augment/passive/boost.dm index dad34c1554e2..35d63a124403 100644 --- a/code/modules/augment/passive/boost.dm +++ b/code/modules/augment/passive/boost.dm @@ -48,7 +48,7 @@ return 1 /obj/item/organ/internal/augment/boost/proc/buff() - if(!buffs || !buffs.len) + if(!LAZYLEN(buffs)) return 0 var/list/B = owner.fetch_buffs_of_type(buffpath, 0) for(var/datum/skill_buff/augment/D in B) diff --git a/code/modules/bodytype/_bodytype.dm b/code/modules/bodytype/_bodytype.dm index e706f5b387ae..fd6206eefa45 100644 --- a/code/modules/bodytype/_bodytype.dm +++ b/code/modules/bodytype/_bodytype.dm @@ -415,20 +415,19 @@ var/global/list/bodytypes_by_category = list() var/list/organ_data = has_limbs[organ_tag] var/obj/item/organ/organ = organ_data["path"] organ_data["descriptor"] = initial(organ.name) - var/organ_cat = initial(organ.organ_category) - if(organ_cat) + for(var/organ_cat in cached_json_decode(initial(organ.organ_categories))) LAZYINITLIST(_organs_by_category) 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] - var/organ_cat = initial(organ.organ_category) - if(organ_cat) + for(var/organ_cat in cached_json_decode(initial(organ.organ_categories))) LAZYINITLIST(_organs_by_category) LAZYADD(_organs_by_category[organ_cat], organ) LAZYINITLIST(_organ_tags_by_category) diff --git a/code/modules/butchery/butchery_data.dm b/code/modules/butchery/butchery_data.dm index 1cd4c1850cf0..9988721f2b15 100644 --- a/code/modules/butchery/butchery_data.dm +++ b/code/modules/butchery/butchery_data.dm @@ -85,7 +85,7 @@ for(var/obj/item/food/slab in .) LAZYADD(meat, slab) if(length(meat)) - var/reagent_split = round(donor.reagents.total_volume/length(meat), 1) + var/reagent_split = round(REAGENT_TOTAL_VOLUME(donor.reagents)/length(meat), 1) for(var/obj/item/food/slab as anything in meat) donor.reagents.trans_to_obj(slab, reagent_split) diff --git a/code/modules/butchery/butchery_products.dm b/code/modules/butchery/butchery_products.dm index 268f02b43d93..76e3440dbd80 100644 --- a/code/modules/butchery/butchery_products.dm +++ b/code/modules/butchery/butchery_products.dm @@ -171,7 +171,7 @@ /obj/item/food/butchery/offal/fluid_act(var/datum/reagents/fluids) . = ..() - if(!QDELETED(src) && fluids?.total_volume && material?.tans_to) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids) && material?.tans_to) if(!dried_type) dried_type = type drying_wetness = get_max_drying_wetness() @@ -264,8 +264,8 @@ /obj/item/food/butchery/stomach/get_dried_product() var/obj/item/chems/glass/waterskin/result = ..() - if(istype(result) && reagents?.total_volume) - reagents.trans_to_holder(result.reagents, reagents.total_volume) + if(istype(result) && REAGENT_TOTAL_VOLUME(reagents)) + reagents.trans_to_holder(result.reagents, REAGENT_TOTAL_VOLUME(reagents)) return result /obj/item/food/butchery/stomach/get_max_drying_wetness() diff --git a/code/modules/client/asset_cache.dm b/code/modules/client/asset_cache.dm index b27ec40f29d6..67bb71649839 100644 --- a/code/modules/client/asset_cache.dm +++ b/code/modules/client/asset_cache.dm @@ -67,7 +67,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the return FALSE var/list/unreceived = asset_list - (client.cache + client.sending) - if(!unreceived || !unreceived.len) + if(!LAZYLEN(unreceived)) return 0 if (unreceived.len >= ASSET_CACHE_TELL_CLIENT_AMOUNT) to_chat(client, "Sending resources...") diff --git a/code/modules/clothing/_clothing.dm b/code/modules/clothing/_clothing.dm index 354290fd7b2a..f6980156009e 100644 --- a/code/modules/clothing/_clothing.dm +++ b/code/modules/clothing/_clothing.dm @@ -102,8 +102,8 @@ to_chat(user, SPAN_WARNING("You should remove the accessories attached to \the [src] first.")) return TRUE if(!isturf(loc) && !(src in user.get_held_items())) - var/it = gender == PLURAL ? "them" : "it" - to_chat(user, SPAN_WARNING("You must either be holding \the [src], or [it] must be on the ground, before you can shred [it].")) + var/decl/pronouns/pronouns = get_pronouns() + to_chat(user, SPAN_WARNING("You must either be holding \the [src], or [pronouns.he] must be on the ground, before you can shred [pronouns.him].")) return TRUE playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1) user.visible_message(SPAN_DANGER("\The [user] begins ripping apart \the [src] with \the [used_item].")) @@ -268,7 +268,8 @@ else . = (bodytype_equip_flags & root_bodytype.bodytype_flag) if(!. && !disable_warning) - to_chat(user, SPAN_WARNING("\The [src] [gender == PLURAL ? "do" : "does"] not fit you.")) + var/decl/pronouns/pronouns = get_pronouns() + to_chat(user, SPAN_WARNING("\The [src] [pronouns.does] not fit you.")) /obj/item/clothing/equipped(var/mob/user) update_icon() diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 5802d8fe8b91..3e9aad057df7 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -51,12 +51,14 @@ if(electric) if(ishuman(src.loc)) var/mob/living/human/M = src.loc + var/decl/pronouns/pronouns = get_pronouns() + var/malfunction = verb_agree_with_pronouns("malfunction", pronouns, is_after_pronoun = FALSE) if(M.get_equipped_item(slot_glasses_str) != src) - to_chat(M, SPAN_DANGER("\The [src] malfunction[gender != PLURAL ? "s":""], releasing a small spark.")) + to_chat(M, SPAN_DANGER("\The [src] [malfunction], releasing a small spark.")) else SET_STATUS_MAX(M, STAT_BLIND, 2) SET_STATUS_MAX(M, STAT_BLURRY, 4) - to_chat(M, SPAN_DANGER("Your [name] malfunction[gender != PLURAL ? "s":""], blinding you!")) + to_chat(M, SPAN_DANGER("Your [name] [malfunction], blinding you!")) // Don't cure being nearsighted if(!M.has_genetic_condition(GENE_COND_NEARSIGHTED)) diff --git a/code/modules/clothing/gloves/jewelry/rings/ring_reagent.dm b/code/modules/clothing/gloves/jewelry/rings/ring_reagent.dm index c38fdeaa1319..25d2752b5ded 100644 --- a/code/modules/clothing/gloves/jewelry/rings/ring_reagent.dm +++ b/code/modules/clothing/gloves/jewelry/rings/ring_reagent.dm @@ -10,10 +10,10 @@ if(istype(H) && H.get_equipped_item(slot_gloves_str) == src) to_chat(H, SPAN_DANGER("You feel a prick as you slip on the ring.")) - if(reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) if(H.reagents) var/contained_reagents = reagents.get_reagents() - var/trans = reagents.trans_to_mob(H, reagents.total_volume, CHEM_INJECT) + var/trans = reagents.trans_to_mob(H, REAGENT_TOTAL_VOLUME(reagents), CHEM_INJECT) admin_inject_log(usr, H, src, contained_reagents, trans) return diff --git a/code/modules/clothing/masks/chewable.dm b/code/modules/clothing/masks/chewable.dm index c6d6285826bc..f79a3ce67ba0 100644 --- a/code/modules/clothing/masks/chewable.dm +++ b/code/modules/clothing/masks/chewable.dm @@ -33,7 +33,7 @@ /obj/item/clothing/mask/chewable/proc/chew(amount) chewtime -= amount - if(reagents && reagents.total_volume) + if(reagents && REAGENT_TOTAL_VOLUME(reagents)) if(ishuman(loc)) var/mob/living/human/user = loc if (src == user.get_equipped_item(slot_wear_mask_str) && user.check_has_mouth()) @@ -133,7 +133,7 @@ /obj/item/clothing/mask/chewable/candy/Initialize() . = ..() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) set_color(reagents.get_color()) desc += " This one is labeled '[reagents.get_primary_reagent_name()]'." diff --git a/code/modules/clothing/masks/miscellaneous.dm b/code/modules/clothing/masks/miscellaneous.dm index 26982600a61e..03225c4afe38 100644 --- a/code/modules/clothing/masks/miscellaneous.dm +++ b/code/modules/clothing/masks/miscellaneous.dm @@ -20,6 +20,9 @@ say_messages = list("Mmfph!", "Mmmf mrrfff!", "Mmmf mnnf!") say_verbs = list("mumbles", "says") +/obj/item/clothing/mask/muzzle/blocks_speech_in_mouth(mob/wearer) + return TRUE + // Clumsy folks can't take the mask off themselves. /obj/item/clothing/mask/muzzle/attack_hand(mob/user) if(user.get_equipped_item(slot_wear_mask_str) != src || user.check_dexterity(DEXTERITY_HOLD_ITEM)) diff --git a/code/modules/clothing/masks/smokable.dm b/code/modules/clothing/masks/smokable.dm index 34327fc8e7ca..01cd25482a79 100644 --- a/code/modules/clothing/masks/smokable.dm +++ b/code/modules/clothing/masks/smokable.dm @@ -55,7 +55,7 @@ /obj/item/clothing/mask/smokable/proc/smoke(amount, manual) smoketime -= amount - if(reagents && reagents.total_volume) // check if it has any reagents at all + if(reagents && REAGENT_TOTAL_VOLUME(reagents)) // check if it has any reagents at all var/smoke_loc = loc if(ishuman(loc)) var/mob/living/human/user = loc @@ -120,7 +120,7 @@ /obj/item/clothing/mask/smokable/fluid_act(var/datum/reagents/fluids) ..() - if(!QDELETED(src) && fluids?.total_volume && !waterproof && lit) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids) && !waterproof && lit) var/turf/location = get_turf(src) if(location) location.hotspot_expose(700, 5) @@ -147,7 +147,7 @@ if(flavor_text) var/turf/T = get_turf(src) T.visible_message(flavor_text) - smoke_amount = reagents.total_volume / smoketime + smoke_amount = REAGENT_TOTAL_VOLUME(reagents) / smoketime START_PROCESSING(SSobj, src) /obj/item/clothing/mask/smokable/extinguish_fire(mob/user, no_message = FALSE) @@ -392,11 +392,11 @@ if(!ATOM_IS_OPEN_CONTAINER(glass)) to_chat(user, SPAN_NOTICE("You need to take the lid off first.")) return TRUE - var/transfered = glass.reagents.trans_to_obj(src, glass.reagents.total_volume) + var/transfered = glass.reagents.trans_to_obj(src, REAGENT_TOTAL_VOLUME(glass.reagents)) if(transfered) //if reagents were transfered, show the message to_chat(user, SPAN_NOTICE("You dip \the [src] into \the [glass].")) else //if not, either the beaker was empty, or the cigarette was full - if(!glass.reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(glass.reagents)) to_chat(user, SPAN_NOTICE("[glass] is empty.")) else to_chat(user, SPAN_NOTICE("[src] is full.")) @@ -549,7 +549,7 @@ return TRUE smoketime = 1000 if(grown.reagents) - grown.reagents.trans_to_obj(src, grown.reagents.total_volume) + grown.reagents.trans_to_obj(src, REAGENT_TOTAL_VOLUME(grown.reagents)) SetName("[grown.name]-packed [initial(name)]") qdel(grown) update_icon() diff --git a/code/modules/clothing/masks/voice.dm b/code/modules/clothing/masks/voice.dm index 8ecc47d727ce..97d04acc3a3a 100644 --- a/code/modules/clothing/masks/voice.dm +++ b/code/modules/clothing/masks/voice.dm @@ -23,7 +23,7 @@ set src in usr var/voice = sanitize(name, MAX_NAME_LEN) - if(!voice || !length(voice)) return + if(!length(voice)) return changer.voice = voice to_chat(usr, "You are now mimicking [changer.voice].") diff --git a/code/modules/clothing/spacesuits/breaches.dm b/code/modules/clothing/spacesuits/breaches.dm index 87213ef88351..b454453a943a 100644 --- a/code/modules/clothing/spacesuits/breaches.dm +++ b/code/modules/clothing/spacesuits/breaches.dm @@ -48,7 +48,7 @@ //Repair a certain amount of brute or burn damage to the suit. /obj/item/clothing/suit/space/proc/repair_breaches(var/damtype, var/amount, var/mob/user) - if(!can_breach || !breaches || !breaches.len) + if(!can_breach || !LAZYLEN(breaches)) to_chat(user, "There are no breaches to repair on \the [src].") return @@ -146,7 +146,7 @@ burn_damage = 0 var/all_patched = TRUE - if(!can_breach || !breaches || !breaches.len) + if(!can_breach || !LAZYLEN(breaches)) SetName(initial(name)) return 0 @@ -260,7 +260,7 @@ /obj/item/clothing/suit/space/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - if(can_breach && breaches && breaches.len) + if(can_breach && LAZYLEN(breaches)) for(var/datum/breach/B in breaches) . += SPAN_DANGER("It has \a [B.descriptor].") diff --git a/code/modules/clothing/spacesuits/rig/modules/modules.dm b/code/modules/clothing/spacesuits/rig/modules/modules.dm index 2a8833f0c58f..ab631a4e18af 100644 --- a/code/modules/clothing/spacesuits/rig/modules/modules.dm +++ b/code/modules/clothing/spacesuits/rig/modules/modules.dm @@ -118,7 +118,7 @@ if(suit_overlay_inactive) suit_overlay = suit_overlay_inactive - if(charges && charges.len) + if(LAZYLEN(charges)) var/list/processed_charges = list() for(var/list/charge in charges) var/datum/rig_charge/charge_dat = new diff --git a/code/modules/clothing/spacesuits/rig/modules/utility.dm b/code/modules/clothing/spacesuits/rig/modules/utility.dm index b024ab15dae1..61de910f0e97 100644 --- a/code/modules/clothing/spacesuits/rig/modules/utility.dm +++ b/code/modules/clothing/spacesuits/rig/modules/utility.dm @@ -192,13 +192,13 @@ if(!ATOM_IS_OPEN_CONTAINER(input_item)) return 0 - if(!input_item.reagents || !input_item.reagents.total_volume) + if(!input_item.reagents || !REAGENT_TOTAL_VOLUME(input_item.reagents)) to_chat(user, "\The [input_item] is empty.") return 0 // Magical chemical filtration system, do not question it. var/total_transferred = 0 - for(var/decl/material/reagent as anything in input_item.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(input_item.reagents)) for(var/chargetype in charges) var/datum/rig_charge/charge = charges[chargetype] if(charge.product_type == reagent.type) diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index a132830f78d1..54818e20751b 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -119,7 +119,8 @@ for(var/obj/item/piece in list(helmet,gloves,chest,boots)) if(!piece || piece.loc != wearer) continue - . += "[html_icon(piece)] \The [piece] [piece.gender == PLURAL ? "are" : "is"] deployed." + var/decl/pronouns/piece_pronouns = piece.get_pronouns() + . += "[html_icon(piece)] \The [piece] [piece_pronouns.is] deployed." if(src.loc == user) . += "The access panel is [locked? "locked" : "unlocked"]." . += "The maintenance panel is [open ? "open" : "closed"]." @@ -138,7 +139,7 @@ START_PROCESSING(SSobj, src) - if(initial_modules && initial_modules.len) + if(LAZYLEN(initial_modules)) for(var/path in initial_modules) var/obj/item/rig_module/module = new path(src) installed_modules += module @@ -731,7 +732,7 @@ holder = use_obj.loc if(istype(holder)) if(use_obj && check_slot == use_obj) - to_chat(wearer, SPAN_HARDSUIT("Your [use_obj.name] [use_obj.gender == PLURAL ? "retract" : "retracts"] swiftly.")) + to_chat(wearer, SPAN_HARDSUIT("Your [use_obj.name] [verb_agree_with_pronouns("retract", use_obj.get_pronouns(), is_after_pronoun = FALSE)] swiftly.")) use_obj.canremove = 1 holder.drop_from_inventory(use_obj, src) use_obj.canremove = 0 @@ -743,10 +744,11 @@ if(!wearer.equip_to_slot_if_possible(use_obj, equip_to, 0, 1)) use_obj.forceMove(src) if(check_slot) - to_chat(initiator, "You are unable to deploy \the [piece] as \the [check_slot] [check_slot.gender == PLURAL ? "are" : "is"] in the way.") + var/decl/pronouns/check_slot_pronouns = check_slot.get_pronouns() + to_chat(initiator, SPAN_DANGER("You are unable to deploy \the [piece] as \the [check_slot] [check_slot_pronouns.is] in the way.")) return else - to_chat(wearer, "Your [use_obj.name] [use_obj.gender == PLURAL ? "deploy" : "deploys"] swiftly.") + to_chat(wearer, SPAN_HARDSUIT("Your [use_obj.name] [verb_agree_with_pronouns("deploy", use_obj.get_pronouns(), is_after_pronoun = FALSE)] swiftly.")) use_obj.icon_state = initial(use_obj.icon_state) if(piece == "helmet" && helmet) diff --git a/code/modules/clothing/spacesuits/rig/rig_attackby.dm b/code/modules/clothing/spacesuits/rig/rig_attackby.dm index 46b880bac891..e8a48b533701 100644 --- a/code/modules/clothing/spacesuits/rig/rig_attackby.dm +++ b/code/modules/clothing/spacesuits/rig/rig_attackby.dm @@ -125,7 +125,7 @@ var/list/current_mounts = list() if(cell) current_mounts += "cell" if(air_supply) current_mounts += "tank" - if(installed_modules && installed_modules.len) current_mounts += "system module" + if(LAZYLEN(installed_modules)) current_mounts += "system module" var/to_remove = input("Which would you like to modify?") as null|anything in current_mounts if(!to_remove) diff --git a/code/modules/crafting/handmade_items.dm b/code/modules/crafting/handmade_items.dm index ab4636d25369..047be5253bb3 100644 --- a/code/modules/crafting/handmade_items.dm +++ b/code/modules/crafting/handmade_items.dm @@ -86,12 +86,12 @@ /obj/item/chems/glass/handmade/bottle/beer/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/beer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/beer, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/glass/handmade/bottle/tall/wine/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/wine, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/wine, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/glass/handmade/bottle/wide/whiskey/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/alcohol/whiskey, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/whiskey, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/modules/crafting/metalwork/metalwork_items.dm b/code/modules/crafting/metalwork/metalwork_items.dm index 511d68ec109b..328646d809a4 100644 --- a/code/modules/crafting/metalwork/metalwork_items.dm +++ b/code/modules/crafting/metalwork/metalwork_items.dm @@ -33,23 +33,23 @@ if(istype(used_item, /obj/item/chems) && ATOM_IS_OPEN_CONTAINER(used_item) && used_item.reagents) // Pour contents into the crucible. - if(used_item.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(used_item.reagents)) var/obj/item/chems/pouring = used_item if(pouring.standard_pour_into(user, src)) return TRUE // Attempting to skim off slag. // TODO: check for appropriate vessel material? Check melting point against temperature of crucible? - if(reagents?.total_volume && length(reagents.reagent_volumes) > 1) + if(REAGENT_TOTAL_VOLUME(reagents) && length(REAGENT_VOLUMES(reagents)) > 1) var/removing = min(amount_per_transfer_from_this, REAGENTS_FREE_SPACE(used_item.reagents)) - if(removing < length(reagents.reagent_volumes)-1) + if(removing < length(REAGENT_VOLUMES(reagents))-1) to_chat(user, SPAN_WARNING("\The [used_item] is full.")) return TRUE // Remove a portion, excepting the primary reagent. - var/old_amt = used_item.reagents.total_volume + var/old_amt = REAGENT_TOTAL_VOLUME(used_item.reagents) var/decl/material/primary_mat = reagents.get_primary_reagent_decl() reagents.trans_to_holder(used_item.reagents, removing, skip_reagents = list(primary_mat.type)) - to_chat(user, SPAN_NOTICE("You skim [used_item.reagents.total_volume-old_amt] unit\s of slag from the top of \the [primary_mat].")) + to_chat(user, SPAN_NOTICE("You skim [REAGENT_TOTAL_VOLUME(used_item.reagents)-old_amt] unit\s of slag from the top of \the [primary_mat].")) return TRUE return ..() diff --git a/code/modules/crafting/pottery/pottery_moulds.dm b/code/modules/crafting/pottery/pottery_moulds.dm index 42339a40f1ae..4d07621fdd15 100644 --- a/code/modules/crafting/pottery/pottery_moulds.dm +++ b/code/modules/crafting/pottery/pottery_moulds.dm @@ -82,15 +82,15 @@ if(!product_type) return FALSE - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) to_chat(user, SPAN_WARNING("\The [src] is empty!")) return TRUE - if(reagents.total_volume < reagents.maximum_volume) + if(REAGENT_TOTAL_VOLUME(reagents) < REAGENT_MAXIMUM_VOLUME(reagents)) to_chat(user, SPAN_WARNING("\The [src] is not full yet!")) return TRUE - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) 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 @@ -109,11 +109,11 @@ product.dropInto(loc) reagents.remove_reagent(product_mat.type, REAGENT_VOLUME(reagents, product_mat.type)) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.type == product_mat.type) continue LAZYINITLIST(product.matter) - product.matter[reagent.type] += max(1, round(reagents.reagent_volumes[reagent] / REAGENT_UNITS_PER_MATERIAL_UNIT)) + product.matter[reagent.type] += max(1, round(REAGENT_VOLUME(reagents, 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/working/quern.dm b/code/modules/crafting/working/quern.dm index afe6821edc73..3ff1832811c7 100644 --- a/code/modules/crafting/working/quern.dm +++ b/code/modules/crafting/working/quern.dm @@ -3,21 +3,20 @@ max_storage_space = DEFAULT_BOX_STORAGE /obj/structure/working/quern - name = "quern-stone" - desc = "A pair of heavy stones connected by an axle, used to grind plants and minerals into powder." - icon = 'icons/obj/structures/quern.dmi' - material = /decl/material/solid/stone/granite - color = /decl/material/solid/stone/granite::color - storage = /datum/storage/hopper/mortar/quern - work_skill = SKILL_COOKING // Maybe? - var/tmp/volume = 1000 // Same as reagent dispensers. Possibly too large? + name = "quern-stone" + desc = "A pair of heavy stones connected by an axle, used to grind plants and minerals into powder." + icon = 'icons/obj/structures/quern.dmi' + material = /decl/material/solid/stone/granite + color = /decl/material/solid/stone/granite::color + storage = /datum/storage/hopper/mortar/quern + work_skill = SKILL_COOKING // Maybe? + chem_volume = 1000 // Same as reagent dispensers. Possibly too large? var/amount_dispensed = 10 var/tmp/possible_transfer_amounts = @"[10,25,50,100,500]" /obj/structure/working/quern/Initialize() . = ..() atom_flags |= ATOM_FLAG_OPEN_CONTAINER - initialize_reagents() /obj/structure/working/quern/try_start_working(mob/user) @@ -51,20 +50,13 @@ var/decl/material/crushing_material = grinding.get_material() if(!attacking_material || !crushing_material || attacking_material.hardness <= crushing_material.hardness) return FALSE - if(REAGENTS_FREE_SPACE(reagents) < grinding.reagents?.total_volume) + if(REAGENTS_FREE_SPACE(reagents) < REAGENT_TOTAL_VOLUME(grinding.reagents)) return FALSE - if(grinding.reagents?.total_volume) // if it has no reagents, skip all the fluff and destroy it instantly - grinding.reagents.trans_to(src, grinding.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(grinding.reagents)) // if it has no reagents, skip all the fluff and destroy it instantly + grinding.reagents.trans_to(src, REAGENT_TOTAL_VOLUME(grinding.reagents)) QDEL_NULL(grinding) return TRUE -/obj/structure/working/quern/initialize_reagents(populate = TRUE) - if(!reagents) - create_reagents(volume) - else - reagents.maximum_volume = max(reagents.maximum_volume, volume) - . = ..() - /obj/structure/working/quern/set_reagent_amount_dispensed(new_amount) amount_dispensed = new_amount diff --git a/code/modules/detectivework/tools/luminol.dm b/code/modules/detectivework/tools/luminol.dm index 9a6556e31045..e687cf00035e 100644 --- a/code/modules/detectivework/tools/luminol.dm +++ b/code/modules/detectivework/tools/luminol.dm @@ -9,4 +9,4 @@ chem_volume = 250 /obj/item/chems/spray/luminol/populate_reagents() - add_to_reagents(/decl/material/liquid/luminol, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/luminol, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/modules/detectivework/tools/rag.dm b/code/modules/detectivework/tools/rag.dm index bebd8ca7d69d..96d91b2e784d 100644 --- a/code/modules/detectivework/tools/rag.dm +++ b/code/modules/detectivework/tools/rag.dm @@ -39,7 +39,7 @@ extinguish_fire() return TRUE - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) remove_contents(user) return TRUE @@ -62,7 +62,7 @@ /obj/item/chems/rag/update_name() if(is_on_fire()) name_prefix = "burning" - else if(reagents && reagents.total_volume) + else if(reagents && REAGENT_TOTAL_VOLUME(reagents)) name_prefix = "damp" else name_prefix = "dry" @@ -78,19 +78,19 @@ /obj/item/chems/rag/proc/remove_contents(mob/user, atom/trans_dest = null) if(!trans_dest && !user.loc) return - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) return var/target_text = trans_dest? "\the [trans_dest]" : "\the [user.loc]" user.visible_message( SPAN_NOTICE("\The [user] begins to wring out [src] over [target_text]."), SPAN_NOTICE("You begin to wring out \the [src] over [target_text].") ) - if(!do_after(user, reagents.total_volume*5, progress = 0) || !reagents?.total_volume) //50 for a fully soaked rag + if(!do_after(user, REAGENT_TOTAL_VOLUME(reagents)*5, progress = 0) || !REAGENT_TOTAL_VOLUME(reagents)) //50 for a fully soaked rag return if(trans_dest) - reagents.trans_to(trans_dest, reagents.total_volume) + reagents.trans_to(trans_dest, REAGENT_TOTAL_VOLUME(reagents)) else - reagents.splash(user.loc, reagents.total_volume) + reagents.splash(user.loc, REAGENT_TOTAL_VOLUME(reagents)) user.visible_message( SPAN_NOTICE("\The [user] wrings out \the [src] over [target_text]."), SPAN_NOTICE("You finish to wringing out \the [src].") @@ -99,7 +99,7 @@ /obj/item/chems/rag/proc/wipe_down(atom/target, mob/user) - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_WARNING("The [initial(name)] is dry.")) return @@ -120,7 +120,7 @@ target.ignite_fire() return TRUE - if(reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) if(user.get_target_zone() != BP_MOUTH) wipe_down(target, user) return TRUE @@ -184,8 +184,8 @@ var/total_fuel = 0 var/total_volume = 0 if(reagents) - total_volume += reagents.total_volume - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + total_volume += REAGENT_TOTAL_VOLUME(reagents) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) total_fuel += REAGENT_VOLUME(reagents, reagent) * reagent.accelerant_value . = (total_fuel >= 2 && total_fuel >= total_volume*0.5) @@ -233,7 +233,7 @@ qdel(src) return - if(reagents?.total_volume) - remove_from_reagents(/decl/material/liquid/fuel, reagents.maximum_volume/25) + if(REAGENT_TOTAL_VOLUME(reagents)) + remove_from_reagents(/decl/material/liquid/fuel, REAGENT_MAXIMUM_VOLUME(reagents)/25) update_name() burn_time-- diff --git a/code/modules/economy/_worth.dm b/code/modules/economy/_worth.dm index 7e623d2907d0..f2f476a776b9 100644 --- a/code/modules/economy/_worth.dm +++ b/code/modules/economy/_worth.dm @@ -10,7 +10,7 @@ /atom/proc/get_single_monetary_worth() . = get_base_value() * get_value_multiplier() if(reagents) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) . += reagent.get_value() * REAGENT_VOLUME(reagents, reagent) * REAGENT_WORTH_MULTIPLIER . = max(0, round(.)) diff --git a/code/modules/emotes/emote_define.dm b/code/modules/emotes/emote_define.dm index b76c74f5c98a..3cf18471cd43 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$", "[target]") + . = replacetext(., "$TARGET$", "\the [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$", "[user]") + . = replacetext(., "$USER$", "\the [user]") // Note about emote messages: // - $USER$ / $TARGET$ will be replaced with the relevant name, in bold. @@ -242,7 +242,7 @@ var/global/list/_emotes_by_key if(use_1p) if(target) use_1p = emote_replace_target_tokens(use_1p, target) - use_1p = "[capitalize(emote_replace_user_tokens(use_1p, user))]" + use_1p = "[capitalize_proper_html(emote_replace_user_tokens(use_1p, user))]" var/use_3p = get_emote_message_3p(user, target, extra_params) if(use_3p) diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index 275ce04101b2..58ea5ef3f194 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -1,4 +1,5 @@ -var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT_LEVEL_MODERATE = "Moderate", EVENT_LEVEL_MAJOR = "Major") +// Ordering of these values must confirm to EVENT_LEVEL_MUNDANE, EVENT_LEVEL_MODERATE, EVENT_LEVEL_MAJOR. +var/global/list/severity_to_string = list("Mundane", "Moderate", "Major") /datum/event_container var/severity = -1 diff --git a/code/modules/fabrication/fabricator_intake.dm b/code/modules/fabrication/fabricator_intake.dm index 3d2f8cf9e294..47ab2071e12c 100644 --- a/code/modules/fabrication/fabricator_intake.dm +++ b/code/modules/fabrication/fabricator_intake.dm @@ -6,7 +6,7 @@ /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/decl/material/reagent as anything in thing.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(thing.reagents)) if(!base_storage_capacity[reagent.type]) continue var/taking_reagent = min(REAGENT_VOLUME(thing.reagents, reagent), floor((storage_capacity[reagent.type] - stored_material[reagent.type]) * REAGENT_UNITS_PER_MATERIAL_UNIT)) @@ -24,7 +24,7 @@ // Otherwise take the first applicable and useful reagent. if(stored_material[reagent.type] == storage_capacity[reagent.type]) return SUBSTANCE_TAKEN_FULL - else if(thing.reagents.total_volume > 0) + else if(REAGENT_TOTAL_VOLUME(thing.reagents) > 0) return SUBSTANCE_TAKEN_SOME else return SUBSTANCE_TAKEN_ALL diff --git a/code/modules/fluids/_fluid.dm b/code/modules/fluids/_fluid.dm index 58f73cd55c46..8dd93caf8988 100644 --- a/code/modules/fluids/_fluid.dm +++ b/code/modules/fluids/_fluid.dm @@ -22,7 +22,7 @@ /atom/movable/fluid_overlay/on_update_icon() var/datum/reagents/loc_reagents = loc?.reagents - var/reagent_volume = loc_reagents?.total_volume + var/reagent_volume = REAGENT_TOTAL_VOLUME(loc_reagents) // Update layer. var/new_layer @@ -108,7 +108,7 @@ var/global/list/_fluid_edge_mask_cache = list() sleep(0) updating_edge_mask = FALSE - if(loc?.reagents?.total_volume <= FLUID_PUDDLE) + if(REAGENT_TOTAL_VOLUME(loc?.reagents) <= FLUID_PUDDLE) remove_filter("fluid_edge_mask") return @@ -117,7 +117,7 @@ var/global/list/_fluid_edge_mask_cache = list() var/list/connections for(var/checkdir in global.alldirs) var/turf/neighbor = get_step_resolving_mimic(loc, checkdir) - if(!neighbor || neighbor.density || neighbor?.reagents?.total_volume > FLUID_PUDDLE) + if(!neighbor || neighbor.density || REAGENT_TOTAL_VOLUME(neighbor?.reagents) > FLUID_PUDDLE) LAZYADD(connections, checkdir) else LAZYADD(ignored, checkdir) diff --git a/code/modules/food/cooking/_recipe.dm b/code/modules/food/cooking/_recipe.dm index aaba7b53fca2..689948f81d0a 100644 --- a/code/modules/food/cooking/_recipe.dm +++ b/code/modules/food/cooking/_recipe.dm @@ -122,7 +122,7 @@ var/global/list/_cooking_recipe_cache = list() /decl/recipe/proc/check_reagents(datum/reagents/avail_reagents) // 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)) + if(length(REAGENT_VOLUMES(avail_reagents)) < length(reagents)) return FALSE for(var/reagent in reagents) if(REAGENT_VOLUME(avail_reagents, reagent) < reagents[reagent]) @@ -185,8 +185,8 @@ var/global/list/_cooking_recipe_cache = list() if(!istype(container) || QDELETED(container) || !container.simulated) CRASH("Recipe trying to create a result with null or invalid container: [container || "NULL"], [container?.simulated || "NULL"]") - if(!container.reagents?.maximum_volume) - CRASH("Recipe trying to create a result in a container with null or zero capacity reagent holder: [container.reagents?.maximum_volume || "NULL"]") + if(!REAGENT_MAXIMUM_VOLUME(container.reagents)) + CRASH("Recipe trying to create a result in a container with null or zero capacity reagent holder: [istype(reagents) ? REAGENT_MAXIMUM_VOLUME(container.reagents) : "NULL"]") if(ispath(result, /atom/movable)) return create_result_atom(container, used_ingredients) @@ -194,7 +194,7 @@ var/global/list/_cooking_recipe_cache = list() if(ispath(result, /decl/material)) var/created_volume = result_quantity for(var/obj/item/ingredient in (used_ingredients[RECIPE_COMPONENT_ITEMS]|used_ingredients[RECIPE_COMPONENT_FRUIT])) - created_volume += ingredient.reagents?.total_volume + created_volume += REAGENT_TOTAL_VOLUME(ingredient.reagents) container.reagents?.add_reagent(result, created_volume, get_result_data(container, used_ingredients)) return null @@ -222,11 +222,8 @@ var/global/list/_cooking_recipe_cache = list() // We collected the used ingredients before removing them in case // the result proc needs to check the list for procedural products. - var/list/used_ingredients = list( - RECIPE_COMPONENT_ITEMS = list(), - RECIPE_COMPONENT_FRUIT = list(), - RECIPE_COMPONENT_CHEMS = list() - ) + // This mapping is indexed by RECIPE_COMPONENT_FOO defines. + var/list/used_ingredients = list(list(), list(), list()) // Find items we need. var/list/container_contents = container.get_contained_external_atoms() @@ -297,14 +294,14 @@ var/global/list/_cooking_recipe_cache = list() for(var/atom/item as anything in used_ingredients[RECIPE_COMPONENT_ITEMS]) if(item.reagents) if(buffer) - item.reagents.trans_to_holder(buffer, item.reagents.total_volume) + item.reagents.trans_to_holder(buffer, REAGENT_TOTAL_VOLUME(item.reagents)) else item.reagents.clear_reagents() item.physically_destroyed() for(var/atom/fruit as anything in used_ingredients[RECIPE_COMPONENT_FRUIT]) if(fruit.reagents) if(buffer) - fruit.reagents.trans_to_holder(buffer, fruit.reagents.total_volume) + fruit.reagents.trans_to_holder(buffer, REAGENT_TOTAL_VOLUME(fruit.reagents)) else fruit.reagents.clear_reagents() fruit.physically_destroyed() @@ -340,18 +337,18 @@ var/global/list/_cooking_recipe_cache = list() holder = temporary_holder if(length(.) > 1) for(var/atom/movable/result_obj in .) - result_obj.reagents.trans_to_holder(holder, result_obj.reagents.total_volume) + result_obj.reagents.trans_to_holder(holder, REAGENT_TOTAL_VOLUME(result_obj.reagents)) switch(reagent_mix) if(REAGENT_SUM) //Sum is easy, just shove the entire buffer into the result - buffer.trans_to_holder(holder, buffer.total_volume) + buffer.trans_to_holder(holder, REAGENT_TOTAL_VOLUME(buffer)) 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/decl/material/reagent as anything in buffer.reagent_volumes) + for (var/decl/material/reagent as anything in REAGENT_VOLUMES(buffer)) var/rvol = REAGENT_VOLUME(holder, reagent) var/bvol = REAGENT_VOLUME(buffer, reagent) if (rvol < bvol) @@ -361,7 +358,7 @@ var/global/list/_cooking_recipe_cache = list() 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/decl/material/reagent as anything in buffer.reagent_volumes) + for (var/decl/material/reagent as anything in REAGENT_VOLUMES(buffer)) var/rvol = REAGENT_VOLUME(holder, reagent) var/bvol = REAGENT_VOLUME(buffer, reagent) if (rvol == 0) //If the target has zero of this reagent @@ -376,7 +373,7 @@ var/global/list/_cooking_recipe_cache = list() if(length(.) > 1) // If we're here, then holder is a buffer containing the total reagents // for all the results. So now we redistribute it among them. - var/total = round(holder.total_volume / length(.)) + var/total = round(REAGENT_TOTAL_VOLUME(holder) / length(.)) for(var/atom/result as anything in .) holder.trans_to(result, total) diff --git a/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm b/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm index d51bd227cc42..501a99f2282a 100644 --- a/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm +++ b/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm @@ -37,7 +37,7 @@ // Fill or take from the vessel. if(used_item.reagents && ATOM_IS_OPEN_CONTAINER(used_item)) - if(used_item.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(used_item.reagents)) if(istype(used_item, /obj/item/chems)) var/obj/item/chems/vessel = used_item if(vessel.standard_pour_into(user, src)) @@ -66,16 +66,18 @@ return TRUE if(handle_eaten_by_mob(user, target) != EATEN_INVALID) return TRUE + + var/total_vol = REAGENT_TOTAL_VOLUME(reagents) if(user.check_intent(I_FLAG_HARM)) if(standard_splash_mob(user,target)) return TRUE - if(reagents && reagents.total_volume) + if(reagents && total_vol) to_chat(user, SPAN_DANGER("You splash the contents of \the [src] onto \the [target].")) - reagents.splash(target, reagents.total_volume) + reagents.splash(target, total_vol) return TRUE - else if(reagents && reagents.total_volume) + else if(reagents && total_vol) to_chat(user, SPAN_NOTICE("You splash a small amount of the contents of \the [src] onto \the [target].")) - reagents.splash(target, min(reagents.total_volume, 5)) + reagents.splash(target, min(total_vol, 5)) return TRUE . = ..() // End boilerplate. @@ -87,18 +89,18 @@ for(var/obj/item/thing in get_stored_inventory()) . += "\the [thing]" - if(reagents?.total_volume) - 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)]" + if(REAGENT_TOTAL_VOLUME(reagents)) + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(reagents)) + . += "[SOLID_VOLUME(reagents, reagent)]u of [reagent.get_reagent_name(reagents, MAT_PHASE_SOLID)]" var/datum/gas_mixture/environment = loc?.return_air() var/ambient_pressure = environment ? environment.return_pressure() : ONE_ATMOSPHERE - for(var/decl/material/reagent as anything in reagents.liquid_volumes) + for(var/decl/material/reagent as anything in REAGENT_LIQUID_VOLUMES(reagents)) var/reagent_name = reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID) if(reagent.phase_at_temperature(temperature, ambient_pressure) == MAT_PHASE_GAS && reagent.soup_hot_desc) - . += "[reagents.liquid_volumes[reagent]]u of [reagent.soup_hot_desc] [reagent_name]" + . += "[LIQUID_VOLUME(reagents, reagent)]u of [reagent.soup_hot_desc] [reagent_name]" else - . += "[reagents.liquid_volumes[reagent]]u of [reagent_name]" + . += "[LIQUID_VOLUME(reagents, reagent)]u of [reagent_name]" /obj/item/chems/cooking_vessel/get_examine_strings(mob/user, distance, infix, suffix) . = ..() diff --git a/code/modules/food/cooking/cooking_vessels/pot.dm b/code/modules/food/cooking/cooking_vessels/pot.dm index 2152ea77b56f..d84c2eca7faf 100644 --- a/code/modules/food/cooking/cooking_vessels/pot.dm +++ b/code/modules/food/cooking/cooking_vessels/pot.dm @@ -39,7 +39,7 @@ last_boil_temp = use_temperature var/next_boil_status = FALSE - for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.phase_at_temperature(use_temperature, ambient_pressure) == MAT_PHASE_GAS) next_boil_status = TRUE break diff --git a/code/modules/food/cooking/recipes/recipe_soup.dm b/code/modules/food/cooking/recipes/recipe_soup.dm index 38dc8a8e1b3a..47ec28c55cd9 100644 --- a/code/modules/food/cooking/recipes/recipe_soup.dm +++ b/code/modules/food/cooking/recipes/recipe_soup.dm @@ -58,7 +58,7 @@ ingredients[meat.meat_name]++ if(precursor_type) - var/list/precursor_data = LAZYACCESS(container.reagents?.reagent_data, precursor_type) + var/list/precursor_data = REAGENT_DATA(container.reagents, precursor_type) var/list/precursor_taste = LAZYACCESS(precursor_data, DATA_TASTE) if(length(precursor_taste)) for(var/taste in precursor_taste) diff --git a/code/modules/food/utensils/_utensil.dm b/code/modules/food/utensils/_utensil.dm index d04d06979d96..9941844187f4 100644 --- a/code/modules/food/utensils/_utensil.dm +++ b/code/modules/food/utensils/_utensil.dm @@ -104,7 +104,7 @@ else show_slice_message(user, tool, src) - var/reagents_per_slice = max(1, round(reagents.total_volume / slice_num)) + var/reagents_per_slice = max(1, round(REAGENT_TOTAL_VOLUME(reagents) / slice_num)) for(var/i = 1 to slice_num) var/atom/movable/slice = create_slice() if(slice) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index eebf86d0ccb9..7ed077da24fe 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -22,8 +22,8 @@ /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) + if(REAGENT_TOTAL_VOLUME(reagents)) + reagents.trans_to_holder(centrifuge.loaded_beaker.reagents, REAGENT_TOTAL_VOLUME(reagents)) for(var/obj/item/thing in contents) thing.dropInto(centrifuge.loc) for(var/atom/movable/thing in convert_matter_to_lumps()) @@ -96,8 +96,8 @@ . = ..(mapload, material_key, skip_plate) //Init reagents update_desc() - if(reagents.total_volume > 0) - bitesize = 1 + round(reagents.total_volume / 2, 1) + if(REAGENT_TOTAL_VOLUME(reagents) > 0) + bitesize = 1 + round(REAGENT_TOTAL_VOLUME(reagents) / 2, 1) update_icon() /obj/item/food/grown/populate_reagents() @@ -143,7 +143,7 @@ var/list/descriptors = list() - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.fruit_descriptor) descriptors |= reagent.fruit_descriptor if(reagent.reflectiveness >= MAT_VALUE_SHINY) @@ -285,9 +285,9 @@ var/global/list/_wood_materials = list( return TRUE var/obj/item/clothing/mask/smokable/cigarette/rolled/R = new(get_turf(src)) - R.create_or_update_reagents(max(R.reagents?.maximum_volume, reagents?.total_volume)) + R.create_or_update_reagents(max(REAGENT_MAXIMUM_VOLUME(R.reagents), REAGENT_TOTAL_VOLUME(reagents))) R.brand = "[src] handrolled in \the [used_item]." - reagents.trans_to_holder(R.reagents, R.reagents.total_volume) + reagents.trans_to_holder(R.reagents, REAGENT_TOTAL_VOLUME(R.reagents)) to_chat(user, SPAN_NOTICE("You roll \the [src] into \the [used_item].")) user.put_in_active_hand(R) qdel(used_item) @@ -308,7 +308,7 @@ var/global/list/_wood_materials = list( . = ..() if(seed && seed.get_trait(TRAIT_STINGS)) - if(!reagents || reagents.total_volume <= 0) + if(!reagents || REAGENT_TOTAL_VOLUME(reagents) <= 0) return remove_any_reagents(rand(1,3)) seed.thrown_at(src, target) @@ -347,7 +347,7 @@ var/global/list/_wood_materials = list( var/mob/living/human/H = user if(istype(H) && H.get_equipped_item(slot_gloves_str)) return - if(!reagents || reagents.total_volume <= 0) + if(!reagents || REAGENT_TOTAL_VOLUME(reagents) <= 0) return remove_any_reagents(rand(1,3)) //Todo, make it actually remove the reagents the seed uses. var/affected = pick(BP_R_HAND,BP_L_HAND) diff --git a/code/modules/hydroponics/seed.dm b/code/modules/hydroponics/seed.dm index 236a5ae569a3..9aa93b32bfb0 100644 --- a/code/modules/hydroponics/seed.dm +++ b/code/modules/hydroponics/seed.dm @@ -209,7 +209,7 @@ make_splat(T, thrown) var/datum/reagents/splat_reagents = thrown?.reagents - if(!splat_reagents?.maximum_volume) // if thrown doesn't exist or has no reagents, use the seed's default reagents. + if(!REAGENT_MAXIMUM_VOLUME(splat_reagents)) // if thrown doesn't exist or has no reagents, use the seed's default reagents. splat_reagents = new /datum/reagents(INFINITY, global.temp_reagents_holder) var/potency = get_trait(TRAIT_POTENCY) var/list/seed_chems = get_chemical_composition() @@ -263,7 +263,7 @@ var/health_change = 0 // Handle gas consumption. - if(consume_gasses && consume_gasses.len) + if(LAZYLEN(consume_gasses)) var/missing_gas = 0 for(var/gas in consume_gasses) if(LAZYACCESS(environment?.gas, gas) >= consume_gasses[gas]) @@ -284,7 +284,7 @@ health_change += rand(1,3) * growth_rate // Handle gas production. - if(exude_gasses && exude_gasses.len && !check_only) + if(LAZYLEN(exude_gasses) && !check_only) for(var/gas in exude_gasses) environment.adjust_gas(gas, max(1,round((exude_gasses[gas]*(get_trait(TRAIT_POTENCY)/5))/exude_gasses.len))) @@ -508,7 +508,7 @@ //Returns a key corresponding to an entry in the global seed list. /datum/seed/proc/get_mutant_variant() - if(!mutants || !mutants.len || get_trait(TRAIT_IMMUTABLE) > 0) return 0 + if(!LAZYLEN(mutants) || get_trait(TRAIT_IMMUTABLE) > 0) return 0 return pick(mutants) //Mutates the plant overall (randomly). diff --git a/code/modules/hydroponics/spreading/spreading_growth.dm b/code/modules/hydroponics/spreading/spreading_growth.dm index dcc68137e6f5..fab8effc38a0 100644 --- a/code/modules/hydroponics/spreading/spreading_growth.dm +++ b/code/modules/hydroponics/spreading/spreading_growth.dm @@ -62,7 +62,7 @@ //Find a victim if(!buckled_mob) var/list/mob/living/targets = targets_in_range() - if(targets && targets.len && prob(round(seed.get_trait(TRAIT_POTENCY)/4))) + if(LAZYLEN(targets) && prob(round(seed.get_trait(TRAIT_POTENCY)/4))) entangle(pick(targets)) //Handle the victim diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index c286fd0c874c..f31aa5eb279c 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -230,12 +230,12 @@ if(!reagents) return - if(reagents.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) return - reagents.trans_to_obj(temp_chem_holder, min(reagents.total_volume,rand(1,3))) + reagents.trans_to_obj(temp_chem_holder, min(REAGENT_TOTAL_VOLUME(reagents),rand(1,3))) - for(var/decl/material/reagent as anything in temp_chem_holder.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(temp_chem_holder.reagents)) var/reagent_total = REAGENT_VOLUME(temp_chem_holder.reagents, reagent) diff --git a/code/modules/hydroponics/trays/tray_process.dm b/code/modules/hydroponics/trays/tray_process.dm index a62c81a8d1e2..d692dc841a51 100644 --- a/code/modules/hydroponics/trays/tray_process.dm +++ b/code/modules/hydroponics/trays/tray_process.dm @@ -6,15 +6,15 @@ var/growth_rate = get_growth_rate() var/turf/my_turf = get_turf(src) if(istype(my_turf) && !closed_system) - var/space_left = reagents ? (reagents.maximum_volume - reagents.total_volume) : 0 - if(space_left > 0 && reagents.total_volume < 10) + var/space_left = reagents ? (REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(reagents)) : 0 + if(space_left > 0 && REAGENT_TOTAL_VOLUME(reagents) < 10) // Handle nearby smoke if any. for(var/obj/effect/effect/smoke/chem/smoke in view(1, src)) - if(smoke.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(smoke.reagents)) smoke.reagents.trans_to_obj(src, 5, copy = 1) // Handle environmental effects like weather and flooding. - if(my_turf.reagents?.total_volume) - my_turf.reagents.trans_to_obj(src, min(space_left, min(my_turf.reagents.total_volume, rand(5,10)))) + if(REAGENT_TOTAL_VOLUME(my_turf.reagents)) + my_turf.reagents.trans_to_obj(src, min(space_left, min(REAGENT_TOTAL_VOLUME(my_turf.reagents), rand(5,10)))) if(istype(my_turf.weather?.weather_system?.current_state, /decl/state/weather/rain)) var/decl/state/weather/rain/rain = my_turf.weather.weather_system.current_state if(rain.is_liquid) diff --git a/code/modules/hydroponics/trays/tray_soil.dm b/code/modules/hydroponics/trays/tray_soil.dm index e0c42fa58163..7e74e1aa0147 100644 --- a/code/modules/hydroponics/trays/tray_soil.dm +++ b/code/modules/hydroponics/trays/tray_soil.dm @@ -80,14 +80,14 @@ return if(closed_system || !reagents || waterlevel >= 100) return - if((reagents.maximum_volume - reagents.total_volume) <= 0 || reagents.total_volume >= 10) + if((REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(reagents)) <= 0 || REAGENT_TOTAL_VOLUME(reagents) >= 10) return for(var/step_dir in global.alldirs) var/turf/neighbor = get_step_resolving_mimic(src, step_dir) - if(neighbor == my_turf || !neighbor?.reagents?.total_volume || !Adjacent(neighbor)) + if(neighbor == my_turf || !REAGENT_TOTAL_VOLUME(neighbor?.reagents) || !Adjacent(neighbor)) continue neighbor.reagents.trans_to_obj(src, rand(2,3)) - if((reagents.maximum_volume - reagents.total_volume) <= 0 || reagents.total_volume >= 10) + if((REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(reagents)) <= 0 || REAGENT_TOTAL_VOLUME(reagents) >= 10) break return ..() diff --git a/code/modules/implants/implant_types/chem.dm b/code/modules/implants/implant_types/chem.dm index b00656a0cbf6..10210ac18f74 100644 --- a/code/modules/implants/implant_types/chem.dm +++ b/code/modules/implants/implant_types/chem.dm @@ -42,11 +42,11 @@ var/global/list/chem_implants = list() /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) + if(REAGENT_TOTAL_VOLUME(reagents) >= REAGENT_MAXIMUM_VOLUME(reagents)) to_chat(user, SPAN_WARNING("\The [src] is full.")) else if(do_after(user, 0.5 SECONDS, src)) used_item.reagents.trans_to_obj(src, 5) - to_chat(user, SPAN_NOTICE("You inject 5 units of the solution. The syringe now contains [used_item.reagents.total_volume] units.")) + to_chat(user, SPAN_NOTICE("You inject 5 units of the solution. The syringe now contains [REAGENT_TOTAL_VOLUME(used_item.reagents)] units.")) return TRUE return ..() diff --git a/code/modules/interactions/interactions_reagents.dm b/code/modules/interactions/interactions_reagents.dm index 80de48cc9177..213da09980da 100644 --- a/code/modules/interactions/interactions_reagents.dm +++ b/code/modules/interactions/interactions_reagents.dm @@ -4,7 +4,7 @@ examine_desc = "dip an item into $TARGET_THEM$" /decl/interaction_handler/dip_item/is_possible(atom/target, mob/user, obj/item/prop) - return ..() && target != prop && target.reagents?.total_volume >= FLUID_MINIMUM_TRANSFER && istype(prop) && target.can_be_poured_from(user, prop) + return ..() && target != prop && REAGENT_TOTAL_VOLUME(target.reagents) >= FLUID_MINIMUM_TRANSFER && istype(prop) && target.can_be_poured_from(user, prop) /decl/interaction_handler/dip_item/invoked(atom/target, mob/user, obj/item/prop) user.visible_message(SPAN_NOTICE("\The [user] dips \the [prop] into \the [target.reagents.get_primary_reagent_name()].")) @@ -13,7 +13,7 @@ var/transferring = min(target_obj.get_food_default_transfer_amount(user), REAGENTS_FREE_SPACE(prop.reagents)) if(transferring) target.reagents.trans_to_holder(prop.reagents, transferring) - if(target.reagents?.total_volume >= FLUID_MINIMUM_TRANSFER) + if(REAGENT_TOTAL_VOLUME(target.reagents) >= FLUID_MINIMUM_TRANSFER) prop.fluid_act(target.reagents) return TRUE @@ -25,7 +25,7 @@ /decl/interaction_handler/fill_from/is_possible(atom/target, mob/user, obj/item/prop) if(!(. = ..())) return - if(target == prop || target.reagents?.total_volume < FLUID_PUDDLE) + if(target == prop || REAGENT_TOTAL_VOLUME(target.reagents) < FLUID_PUDDLE) return FALSE if(!istype(prop) || (!isitem(target) && !istype(target, /obj/structure))) return FALSE @@ -52,7 +52,7 @@ /decl/interaction_handler/empty_into/is_possible(atom/target, mob/user, obj/item/prop) if(!(. = ..())) return - if(target == prop || !istype(prop) || prop.reagents?.total_volume <= 0) + if(target == prop || !istype(prop) || REAGENT_TOTAL_VOLUME(prop.reagents) <= 0) return FALSE return target.can_be_poured_into(user, prop) && prop.can_be_poured_from(user, target) @@ -128,7 +128,7 @@ target.show_food_no_mouth_message(user, user) return - if(!target?.reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(target?.reagents)) target.show_food_empty_message(user, EATING_METHOD_DRINK) return diff --git a/code/modules/lighting/ambient_turf.dm b/code/modules/lighting/ambient_turf.dm index 5b9ba5a03d9a..4b34c863ed90 100644 --- a/code/modules/lighting/ambient_turf.dm +++ b/code/modules/lighting/ambient_turf.dm @@ -69,10 +69,6 @@ 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 @@ -86,15 +82,17 @@ ambient_light_old_g += lg ambient_light_old_b += lb - if (!corners || !lighting_corners_initialised) - if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(src)) + if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(src)) + if (!corners || !lighting_corners_initialised) 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) + // 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) + + if (!ambient_active) + SSlighting.total_ambient_turfs += 1 + ambient_active = TRUE /// Wipe the entire self-ambience channel. This will preserve ambience from ambience groups. /turf/proc/clear_ambient_light() diff --git a/code/modules/lighting/lighting_corner.dm b/code/modules/lighting/lighting_corner.dm index 3d150896b47b..639b0a023872 100644 --- a/code/modules/lighting/lighting_corner.dm +++ b/code/modules/lighting/lighting_corner.dm @@ -34,7 +34,7 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, var/self_g = 0 var/self_b = 0 - // The intensity we're inheriting from the turf below us, if we're a Z-turf. + // The intensity we're inheriting from the turf below us, if we're a Z-turf. This is a sum of all below turfs in the Z-stack. var/below_r = 0 var/below_g = 0 var/below_b = 0 @@ -189,22 +189,26 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, var/turf/T var/Ti // Grab the first master that's a Z-turf, if one exists. - if (t1 && (T = GET_ABOVE(t1)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + // The above var cannot be relied on due to init ordering, but we can use it if it is set. + if (t1 && (T = t1.above || GET_ABOVE(t1)) && (T.z_flags & ZM_ALLOW_LIGHTING)) Ti = t1i - else if (t2 && (T = GET_ABOVE(t2)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + else if (t2 && (T = t2.above || GET_ABOVE(t2)) && (T.z_flags & ZM_ALLOW_LIGHTING)) Ti = t2i - else if (t3 && (T = GET_ABOVE(t3)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + else if (t3 && (T = t3.above || GET_ABOVE(t3)) && (T.z_flags & ZM_ALLOW_LIGHTING)) Ti = t3i - else if (t4 && (T = GET_ABOVE(t4)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + else if (t4 && (T = t4.above || GET_ABOVE(t4)) && (T.z_flags & ZM_ALLOW_LIGHTING)) Ti = t4i else // Nothing above us that cares about below light. T = null if (TURF_IS_DYNAMICALLY_LIT(T)) - if (!T.corners || !T.corners[Ti]) - T.generate_missing_corners() - var/datum/lighting_corner/above = T.corners[Ti] - above.update_below_lumcount(delta_r, delta_g, delta_b, now) + do + if (!T.corners || !T.corners[Ti]) + T.generate_missing_corners() + + // Above corners never get instant updates; they're less important, so better to avoid risk of lag. + T.corners[Ti].update_below_lumcount(delta_r, delta_g, delta_b) + while ((T = T.above) && (T.z_flags & ZM_ALLOW_LIGHTING)) // This needs to be down here instead of the above if so the lum values are properly updated. if (needs_update) @@ -216,7 +220,7 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, needs_update = TRUE SSlighting.corner_queue += src -/datum/lighting_corner/proc/update_below_lumcount(delta_r, delta_g, delta_b, now = FALSE) +/datum/lighting_corner/proc/update_below_lumcount(delta_r, delta_g, delta_b) if (!(delta_r + delta_g + delta_b)) return @@ -232,11 +236,8 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, if (needs_update) return - if (!now) - needs_update = TRUE - SSlighting.corner_queue += src - else - update_overlays(TRUE) + needs_update = TRUE + SSlighting.corner_queue += src /datum/lighting_corner/proc/update_ambient_lumcount(delta_r, delta_g, delta_b, skip_update = FALSE) @@ -251,26 +252,21 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, var/turf/T var/Ti - if (t1 && (t1.below || HasBelow(t1.z)) && (t1.z_flags & ZM_ALLOW_LIGHTING) && TURF_IS_DYNAMICALLY_LIT_UNSAFE(t1)) + if (t1) T = t1 Ti = t1i - else if (t2 && (t2.below || HasBelow(t2.z)) && (t2.z_flags & ZM_ALLOW_LIGHTING) && TURF_IS_DYNAMICALLY_LIT_UNSAFE(t2)) + else if (t2) T = t2 Ti = t2i - else if (t3 && (t3.below || HasBelow(t3.z)) && (t3.z_flags & ZM_ALLOW_LIGHTING) && TURF_IS_DYNAMICALLY_LIT_UNSAFE(t3)) + else if (t3) T = t3 Ti = t3i - else if (t4 && (t4.below || HasBelow(t4.z)) && (t4.z_flags & ZM_ALLOW_LIGHTING) && TURF_IS_DYNAMICALLY_LIT_UNSAFE(t4)) + else if (t4) T = t4 Ti = t4i - // No MZ candidates below, just update. - else if (needs_update || skip_update) - return else - // Always queue for this, not important enough to hit the synchronous path. - needs_update = TRUE - SSlighting.corner_queue += src - return + // This should be impossible to reach -- how do we exist without at least one master turf? + CRASH("Corner has no masters!") var/datum/lighting_corner/below = src @@ -303,8 +299,6 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, needs_update = TRUE SSlighting.corner_queue += src -#undef UPDATE_APPARENT - /datum/lighting_corner/proc/update_overlays(now = FALSE) var/lr = apparent_r var/lg = apparent_g @@ -339,6 +333,75 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, Ov.needs_update = TRUE SSlighting.overlay_queue += Ov +// This is called when our turf's downward Z-opacity changes. +/datum/lighting_corner/proc/rebuild_ztraversal(new_opacity) + /* + If opacity transitions to off: + - Look down stack, removing below lights contributing to us + - Look up stack, updating turfs with our new below lighting value + If opacity transitions to on: + - Look down stack, add below contributors + - Look up stack, updating turfs with our new below lighting value + */ + below_r = below_g = below_b = 0 + var/turf/T = null + var/datum/lighting_corner/Tcorn = src + var/Ti + + if (!new_opacity) + for (;;) + if (Tcorn.t1 && (T = Tcorn.t1.below || GET_BELOW(Tcorn.t1)) && (T.above?.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t1i + else if (Tcorn.t2 && (T = Tcorn.t2.below || GET_BELOW(Tcorn.t2)) && (T.above?.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t2i + else if (Tcorn.t3 && (T = Tcorn.t3.below || GET_BELOW(Tcorn.t3)) && (T.above?.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t3i + else if (Tcorn.t4 && (T = Tcorn.t4.below || GET_BELOW(Tcorn.t4)) && (T.above?.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t4i + else // Nothing above us that cares about below light. + break + + Tcorn = T.corners[Ti] + below_r += Tcorn.apparent_r + below_g += Tcorn.apparent_g + below_b += Tcorn.apparent_b + + UPDATE_APPARENT(src, r) + UPDATE_APPARENT(src, g) + UPDATE_APPARENT(src, b) + + if (!needs_update) + needs_update = TRUE + SSlighting.corner_queue += src + + T = null + Tcorn = src + + for (;;) + if (Tcorn.t1 && (T = Tcorn.t1.above || GET_ABOVE(Tcorn.t1)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t1i + else if (Tcorn.t2 && (T = Tcorn.t2.above || GET_ABOVE(Tcorn.t2)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t2i + else if (Tcorn.t3 && (T = Tcorn.t3.above || GET_ABOVE(Tcorn.t3)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t3i + else if (Tcorn.t4 && (T = Tcorn.t4.above || GET_ABOVE(Tcorn.t4)) && (T.z_flags & ZM_ALLOW_LIGHTING)) + Ti = Tcorn.t4i + else // Nothing above us that cares about below light. + break + + Tcorn = T.corners[Ti] + Tcorn.below_r += apparent_r + Tcorn.below_g += apparent_g + Tcorn.below_b += apparent_b + + UPDATE_APPARENT(Tcorn, r) + UPDATE_APPARENT(Tcorn, g) + UPDATE_APPARENT(Tcorn, b) + + if (!Tcorn.needs_update) + Tcorn.needs_update = TRUE + SSlighting.corner_queue += Tcorn + /datum/lighting_corner/Destroy(force = FALSE) PRINT_STACK_TRACE("Someone [force ? "force-" : ""]deleted a lighting corner.") if (!force) @@ -349,3 +412,5 @@ var/global/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, /datum/lighting_corner/dummy/New() return + +#undef UPDATE_APPARENT diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index 724b2d46182e..08d7fadca5c6 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -126,6 +126,11 @@ recalc_atom_opacity() // Make sure to do this before reconsider_lights(), incase we're on instant updates. reconsider_lights() +// The normal opacity logic doesn't work for entities not located inside turfs, such as turfs. +/turf/set_opacity(new_opacity) + . = ..() + reconsider_lights() + // This block isn't needed now, but it's here if supporting area dyn lighting changes is needed later. // /turf/change_area(area/old_area, area/new_area) diff --git a/code/modules/lights/light_bulbs_tubes.dm b/code/modules/lights/light_bulbs_tubes.dm index 6923213ab2b8..403bf7f4662b 100644 --- a/code/modules/lights/light_bulbs_tubes.dm +++ b/code/modules/lights/light_bulbs_tubes.dm @@ -125,10 +125,10 @@ // if a syringe, can inject flammable liquids to make it explode /obj/item/light/attackby(var/obj/item/used_item, var/mob/user) ..() - if(istype(used_item, /obj/item/chems/syringe) && used_item.reagents?.total_volume) + if(istype(used_item, /obj/item/chems/syringe) && REAGENT_TOTAL_VOLUME(used_item.reagents)) var/obj/item/chems/syringe/S = used_item to_chat(user, "You inject the solution into \the [src].") - for(var/decl/material/reagent as anything in S.reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(S.reagents)) if(reagent.accelerant_value > FUEL_VALUE_ACCELERANT) rigged = TRUE log_and_message_admins("injected a light with flammable reagents, rigging it to explode.", user) diff --git a/code/modules/maps/template_types/random_exoplanet/random_planet_level_data.dm b/code/modules/maps/template_types/random_exoplanet/random_planet_level_data.dm index 26ad0dee2a5d..8166b19f7f61 100644 --- a/code/modules/maps/template_types/random_exoplanet/random_planet_level_data.dm +++ b/code/modules/maps/template_types/random_exoplanet/random_planet_level_data.dm @@ -80,7 +80,7 @@ //Try to adopt our parent planet's ambient lighting preferences apply_planet_ambient_lighting(parent_planetoid) //Rename the surface area if we have one yet - adapt_location_name(parent_planetoid.name) + adapt_to_location_name(parent_planetoid.name) ///If we're getting atmos from our parent planet, apply it. /datum/level_data/planetoid/proc/apply_planet_atmosphere(var/datum/planetoid_data/P) @@ -96,13 +96,12 @@ if(!ambient_light_color) ambient_light_level = P.surface_light_color -/datum/level_data/planetoid/adapt_location_name(location_name) - if(!(. = ..())) - return +/datum/level_data/planetoid/adapt_to_location_name(location_name) if(!ispath(base_area) || ispath(base_area, world.area)) return var/area/A = get_base_area_instance() //Make sure we're not going to rename the world's base area if(!istype(A, world.area)) + // vvvv This feels bad, should we be doing this? vvvv global.using_map.area_purity_test_exempt_areas |= A.type //Make sure we add any of those, so unit tests calm down when we rename A.SetName("[location_name]") diff --git a/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm b/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm index 348abd21f1c3..0d6b27a9c82b 100644 --- a/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm +++ b/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm @@ -168,7 +168,7 @@ M.add_chemical_effect(CE_NOPULSE, 1) /decl/material/liquid/zombiepowder/on_leaving_metabolism(datum/reagents/metabolism/holder) - var/mob/M = holder?.my_atom + var/mob/M = REAGENT_GET_ATOM(holder) if(istype(M)) M.status_flags &= ~FAKEDEATH . = ..() diff --git a/code/modules/materials/definitions/liquids/materials_liquid_water.dm b/code/modules/materials/definitions/liquids/materials_liquid_water.dm index 7524049c51de..20950348514f 100644 --- a/code/modules/materials/definitions/liquids/materials_liquid_water.dm +++ b/code/modules/materials/definitions/liquids/materials_liquid_water.dm @@ -34,7 +34,8 @@ coated_adjective = "wet" /decl/material/liquid/water/build_coated_name(datum/reagents/coating, list/accumulator) - if(length(coating.reagent_volumes) > 1) + var/coating_volumes = REAGENT_VOLUMES(coating) + if(length(coating_volumes) > 1) accumulator.Insert(1, "dilute") // dilute always comes first! also this is intentionally not colored in component color mode return // don't insert 'wet' ..() @@ -50,7 +51,7 @@ /decl/material/liquid/water/get_reagent_name(datum/reagents/holder, phase = MAT_PHASE_LIQUID) . = ..() // length == 1 implies primary reagent, so checking both is redundant - if(phase == MAT_PHASE_LIQUID && length(holder?.reagent_volumes) == 1) + if(phase == MAT_PHASE_LIQUID && length(REAGENT_VOLUMES(holder)) == 1) return "fresh [.]" return diff --git a/code/modules/materials/definitions/solids/materials_solid_elements.dm b/code/modules/materials/definitions/solids/materials_solid_elements.dm index 2e1c477f4aa7..0cbed95b3386 100644 --- a/code/modules/materials/definitions/solids/materials_solid_elements.dm +++ b/code/modules/materials/definitions/solids/materials_solid_elements.dm @@ -43,9 +43,10 @@ /decl/material/solid/carbon/affect_ingest(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() 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/decl/material/reagent as anything in ingested.reagent_volumes) + var/ingested_volumes = REAGENT_VOLUMES(ingested) + if(ingested && LAZYLEN(ingested_volumes) > 1) + var/effect = 1 / (LAZYLEN(ingested_volumes) - 1) + for(var/decl/material/reagent as anything in ingested_volumes) if(reagent.type != type) ingested.remove_reagent(reagent, removed * effect) diff --git a/code/modules/materials/material_data.dm b/code/modules/materials/material_data.dm index 322847dbeead..dddb985f8ada 100644 --- a/code/modules/materials/material_data.dm +++ b/code/modules/materials/material_data.dm @@ -5,7 +5,12 @@ .[DATA_INGREDIENT_FLAGS] |= allergen_flags /decl/material/proc/mix_data(var/datum/reagents/reagents, var/list/newdata, var/amount) - reagents.cached_color = null // colour masking may change + + if(!istype(reagents)) + return + + UNLINT(reagents.cached_color = null) // colour masking may change + . = REAGENT_DATA(reagents, src) if(!length(newdata) || !islist(newdata)) return diff --git a/code/modules/materials/material_debris.dm b/code/modules/materials/material_debris.dm index 0eece4d7788d..879efc811ad5 100644 --- a/code/modules/materials/material_debris.dm +++ b/code/modules/materials/material_debris.dm @@ -135,7 +135,7 @@ return if((REALTIMEOFDAY - time_created) < 5 SECONDS) return - if(!QDELETED(src) && fluids?.total_liquid_volume >= FLUID_SLURRY) + if(!QDELETED(src) && REAGENT_TOTAL_LIQUID_VOLUME(fluids) >= FLUID_SLURRY) var/free_space = REAGENTS_FREE_SPACE(fluids) for(var/matter_type in matter) if(free_space <= MINIMUM_CHEMICAL_VOLUME) diff --git a/code/modules/materials/material_display.dm b/code/modules/materials/material_display.dm index c0e6125a0f5f..6ec5d67c60a9 100644 --- a/code/modules/materials/material_display.dm +++ b/code/modules/materials/material_display.dm @@ -1,8 +1,9 @@ /decl/material/proc/get_presentation_name(var/obj/item/prop) - if(islist(prop?.reagents?.reagent_data)) - . = LAZYACCESS(prop.reagents.reagent_data[src], DATA_MASK_NAME) + var/list/presentation_data = REAGENT_DATA(prop.reagents, src) + if(islist(presentation_data)) + . = LAZYACCESS(presentation_data, DATA_MASK_NAME) . ||= glass_name || get_reagent_name(prop?.reagents) - if(prop?.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(prop?.reagents)) . = build_presentation_name_from_reagents(prop, .) /decl/material/proc/build_presentation_name_from_reagents(var/obj/item/prop, var/supplied) @@ -16,7 +17,7 @@ /decl/material/proc/get_presentation_desc(var/obj/item/prop) . = glass_desc - if(prop?.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(prop?.reagents)) . = build_presentation_desc_from_reagents(prop, .) /decl/material/proc/build_presentation_desc_from_reagents(var/obj/item/prop, var/supplied) @@ -29,8 +30,9 @@ /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[src] + var/reagent_data = REAGENT_DATA(holder, src) + if(istype(holder) && islist(reagent_data)) + var/list/rdata = reagent_data[src] if(rdata) var/data_name = rdata[DATA_MASK_NAME] if(data_name) @@ -54,8 +56,9 @@ return "something" /decl/material/proc/get_reagent_color(datum/reagents/holder) - if(istype(holder) && holder.reagent_data) - var/list/rdata = holder.reagent_data[src] + var/list/reagent_data = REAGENT_DATA(holder, src) + if(istype(holder) && islist(reagent_data)) + var/list/rdata = reagent_data[src] if(rdata) var/data_color = rdata[DATA_MASK_COLOR] if(data_color) diff --git a/code/modules/materials/material_drying.dm b/code/modules/materials/material_drying.dm index 089ed0d251d6..eb57baa10228 100644 --- a/code/modules/materials/material_drying.dm +++ b/code/modules/materials/material_drying.dm @@ -1,6 +1,6 @@ /obj/item/stack/material/fluid_act(var/datum/reagents/fluids) . = ..() - if(!QDELETED(src) && fluids?.total_volume && material?.tans_to) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids) && material?.tans_to) if(!dried_type) dried_type = type drying_wetness = get_max_drying_wetness() diff --git a/code/modules/materials/material_metabolism.dm b/code/modules/materials/material_metabolism.dm index 0223b10a6738..71714cf27fb7 100644 --- a/code/modules/materials/material_metabolism.dm +++ b/code/modules/materials/material_metabolism.dm @@ -57,7 +57,8 @@ if(length(vapor_products)) var/result_volume = REAGENT_VOLUME(holder, src) - var/temperature = holder?.my_atom?.temperature || T20C + var/atom/reagent_atom = REAGENT_GET_ATOM(holder) + var/temperature = reagent_atom?.temperature || T20C for(var/vapor in vapor_products) touching_turf.assume_gas(vapor, (result_volume * vapor_products[vapor]), temperature) holder.remove_reagent(src, result_volume) diff --git a/code/modules/mechs/components/frame.dm b/code/modules/mechs/components/frame.dm index 6ad92e633602..867a6b831ec7 100644 --- a/code/modules/mechs/components/frame.dm +++ b/code/modules/mechs/components/frame.dm @@ -295,9 +295,10 @@ return TRUE /obj/structure/heavy_vehicle_frame/proc/install_component(var/obj/item/thing, var/mob/user) - var/obj/item/mech_component/MC = thing - if(istype(MC) && !MC.ready_to_install()) - to_chat(user, SPAN_WARNING("\The [MC] [MC.gender == PLURAL ? "are" : "is"] not ready to install.")) + var/obj/item/mech_component/component = thing + if(istype(component) && !component.ready_to_install()) + var/decl/pronouns/component_pronouns = component.get_pronouns() + to_chat(user, SPAN_WARNING("\The [component] [component_pronouns.is] not ready to install.")) return 0 if(user) visible_message(SPAN_NOTICE("\The [user] begins installing \the [thing] into \the [src].")) diff --git a/code/modules/mechs/equipment/engineering.dm b/code/modules/mechs/equipment/engineering.dm index d0ff7b2006b8..607226f683e0 100644 --- a/code/modules/mechs/equipment/engineering.dm +++ b/code/modules/mechs/equipment/engineering.dm @@ -32,10 +32,10 @@ icon_state = "mech_exting" /obj/item/chems/spray/extinguisher/mech/get_hardpoint_maptext() - return "[reagents.total_volume]/[reagents.maximum_volume]" + return "[REAGENT_TOTAL_VOLUME(reagents)]/[REAGENT_MAXIMUM_VOLUME(reagents)]" /obj/item/chems/spray/extinguisher/mech/get_hardpoint_status_value() - return reagents.total_volume/reagents.maximum_volume + return REAGENT_TOTAL_VOLUME(reagents)/REAGENT_MAXIMUM_VOLUME(reagents) /obj/item/mech_equipment/mounted_system/extinguisher icon_state = "mech_exting" diff --git a/code/modules/mechs/mech.dm b/code/modules/mechs/mech.dm index 2530ea6bd46d..25f9ecbf7873 100644 --- a/code/modules/mechs/mech.dm +++ b/code/modules/mechs/mech.dm @@ -192,7 +192,8 @@ for(var/obj/item/mech_component/thing in list(arms, legs, head, body)) if(!thing) continue - . += "Its [thing.name] [thing.gender == PLURAL ? "are" : "is"] [thing.get_damage_string()]." + var/decl/pronouns/component_pronouns = thing.get_pronouns() + . += "Its [thing.name] [component_pronouns.is] [thing.get_damage_string()]." . += "It menaces with reinforcements of [material]." /mob/living/exosuit/return_air() diff --git a/code/modules/mining/machinery/material_compressor.dm b/code/modules/mining/machinery/material_compressor.dm index 5814e0edc7a9..32ae10fdc219 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/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/decl/material/reagent as anything in REAGENT_VOLUMES(O.reagents)) + stored[reagent.type] = stored[reagent.type] + floor((REAGENT_VOLUME(O.reagents, 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 6b19126688c1..b93b539f40af 100644 --- a/code/modules/mining/machinery/material_extractor.dm +++ b/code/modules/mining/machinery/material_extractor.dm @@ -70,7 +70,7 @@ if(!use_power || (stat & (BROKEN|NOPOWER))) return - if(reagents?.total_volume >= MAX_LIQUID) + if(REAGENT_TOTAL_VOLUME(reagents) >= MAX_LIQUID) return if(input_turf) @@ -83,8 +83,8 @@ eating.dropInto(output_turf) continue eaten++ - if(eating.reagents?.total_volume) - eating.reagents.trans_to_obj(src, eating.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(eating.reagents)) + eating.reagents.trans_to_obj(src, REAGENT_TOTAL_VOLUME(eating.reagents)) for(var/mtype in eating.matter) add_to_reagents(mtype, floor(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) qdel(eating) @@ -97,7 +97,7 @@ return var/adjusted_reagents = FALSE - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) adjusted_reagents = max(adjusted_reagents, process_non_liquid(reagent)) if(adjusted_reagents) @@ -199,10 +199,10 @@ if(href_list["dispense"]) var/reagent_index = text2num(href_list["dispense"]) - if(!reagent_index || length(reagents.reagent_volumes) < reagent_index) + if(!reagent_index || length(REAGENT_VOLUMES(reagents)) < reagent_index) return TOPIC_HANDLED - var/mtype = reagents.reagent_volumes[reagent_index] + var/mtype = REAGENT_VOLUME(reagents, reagent_index) // Only liquids are allowed to dispense. Otherwise, try to process the reagent. if(process_non_liquid(mtype)) @@ -232,20 +232,20 @@ data["dispense_amount"] = dispense_amount if(output_container) - var/curr_volume = output_container.reagents?.total_volume || 0 - var/max_volume = output_container.reagents?.maximum_volume || 0 + var/curr_volume = REAGENT_TOTAL_VOLUME(output_container.reagents) + var/max_volume = REAGENT_MAXIMUM_VOLUME(output_container.reagents) data["container"] = "[output_container.name] ([curr_volume] / [max_volume] U)" data["reagents"] = list() var/index = 0 - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) index += 1 // TODO: Must be revised once state changes are in. Reagent names might be a litle odd in the meantime. 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["reagents"] += list(list("label" = "[reagent.liquid_name] ([REAGENT_VOLUME(reagents, reagent)] U)", "index" = index, "liquid" = is_liquid)) - data["full"] = reagents.total_volume >= MAX_LIQUID + data["full"] = REAGENT_TOTAL_VOLUME(reagents) >= MAX_LIQUID data["gas_pressure"] = gas_contents?.return_pressure() return data diff --git a/code/modules/mining/machinery/material_smelter.dm b/code/modules/mining/machinery/material_smelter.dm index b5f609877800..489327ec51c4 100644 --- a/code/modules/mining/machinery/material_smelter.dm +++ b/code/modules/mining/machinery/material_smelter.dm @@ -31,7 +31,7 @@ if(!(. = ..()) || !reagents) return - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) show_materials |= reagent.type /obj/machinery/material_processing/smeltery/ProcessAtomTemperature() @@ -70,8 +70,8 @@ eating.dropInto(output_turf) continue eaten++ - if(eating.reagents?.total_volume) - eating.reagents.trans_to_obj(src, floor(eating.reagents.total_volume * 0.75)) // liquid reagents, lossy + if(REAGENT_TOTAL_VOLUME(eating.reagents)) + eating.reagents.trans_to_obj(src, floor(REAGENT_TOTAL_VOLUME(eating.reagents) * 0.75)) // liquid reagents, lossy for(var/mtype in eating.matter) add_to_reagents(mtype, floor(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) qdel(eating) diff --git a/code/modules/mob/examine.dm b/code/modules/mob/examine.dm index 6eb5ade8cbcf..c2de3a0ce789 100644 --- a/code/modules/mob/examine.dm +++ b/code/modules/mob/examine.dm @@ -1,12 +1,16 @@ /mob/proc/get_visible_pronouns(hideflags) //suits/masks/helmets make it hard to tell their gender if((hideflags & HIDEJUMPSUIT) && (hideflags & HIDEFACE)) - return GET_DECL(/decl/pronouns) + return GET_DECL(/decl/pronouns/pseudoplural) return get_pronouns() +// At some point this could have a client pref or server config option that switches second-person to first-person. +/mob/proc/get_self_pronouns() + return GET_DECL(/decl/pronouns/second_person_singular) + /mob/proc/get_visible_pronouns_for_viewer(mob/viewer, hideflags) if(viewer == src) - return GET_DECL(/decl/pronouns/self) + return get_self_pronouns() return get_visible_pronouns(hideflags) /mob/proc/get_equipment_visibility() @@ -27,10 +31,8 @@ if(slot_desc) . += slot_desc if(buckled) - if(user == src) - . += SPAN_WARNING("You are [html_icon(buckled)] buckled to [buckled]!") - else - . += SPAN_WARNING("[pronouns.He] [pronouns.is] [html_icon(buckled)] buckled to [buckled]!") + // pronouns can be second-person here if user == src so no need to handle that explicitly + . += 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 list() diff --git a/code/modules/mob/hugs.dm b/code/modules/mob/hugs.dm index afa0d6264737..f38eec055bc8 100644 --- a/code/modules/mob/hugs.dm +++ b/code/modules/mob/hugs.dm @@ -40,8 +40,8 @@ var/global/list/_default_hug_messages = list( hug_3p = emote_replace_target_tokens(hug_3p, target) hug_1p = emote_replace_target_tokens(hug_1p, target) visible_message( - SPAN_NOTICE(capitalize(hug_3p)), - SPAN_NOTICE(capitalize(hug_1p)) + SPAN_NOTICE(capitalize_proper_html(hug_3p)), + SPAN_NOTICE(capitalize_proper_html(hug_1p)) ) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) diff --git a/code/modules/mob/language/language.dm b/code/modules/mob/language/language.dm index 6b2f4b688bd1..1c7008ad9e63 100644 --- a/code/modules/mob/language/language.dm +++ b/code/modules/mob/language/language.dm @@ -100,7 +100,7 @@ if(!prob(understand_chance)) nword = scramble_word(w) if(new_sentence) - nword = capitalize(nword) + nword = capitalize_proper_html(nword) new_sentence = FALSE if(ends_sentence) nword = trim(nword) @@ -112,7 +112,7 @@ scrambled_text += nword . = jointext(scrambled_text, null) - . = capitalize(.) + . = capitalize_proper_html(.) . = trim(.) /decl/language/proc/get_next_scramble_token() @@ -121,7 +121,7 @@ return "..." /decl/language/proc/scramble_word(var/input) - if(!syllables || !syllables.len) + if(!LAZYLEN(syllables)) return stars(input) // If the input is cached already, move it to the end of the cache and return it diff --git a/code/modules/mob/living/bot/farmbot.dm b/code/modules/mob/living/bot/farmbot.dm index 79229f89faf0..a5b195163b27 100644 --- a/code/modules/mob/living/bot/farmbot.dm +++ b/code/modules/mob/living/bot/farmbot.dm @@ -40,7 +40,7 @@ . = ..() . += "
Water tank: " if(tank) - . += "[tank.reagents.total_volume]/[tank.reagents.maximum_volume]" + . += "[REAGENT_TOTAL_VOLUME(tank.reagents)]/[REAGENT_MAXIMUM_VOLUME(tank.reagents)]" else . += "error: not found" @@ -118,7 +118,7 @@ if(confirmTarget(tray)) target = tray return - if(!target && refills_water && tank && tank.reagents.total_volume < tank.reagents.maximum_volume) + if(!target && refills_water && tank && REAGENT_TOTAL_VOLUME(tank.reagents) < REAGENT_MAXIMUM_VOLUME(tank.reagents)) for(var/obj/structure/hygiene/sink/source in view(7, src)) target = source return @@ -171,13 +171,13 @@ update_icon() T.update_icon() else if(istype(A, /obj/structure/hygiene/sink)) - if(!tank || tank.reagents.total_volume >= tank.reagents.maximum_volume) + if(!tank || REAGENT_TOTAL_VOLUME(tank.reagents) >= REAGENT_MAXIMUM_VOLUME(tank.reagents)) return TRUE action = "water" update_icon() visible_message("[src] starts refilling its tank from \the [A].") busy = 1 - while(do_after(src, 10) && tank.reagents.total_volume < tank.reagents.maximum_volume) + while(do_after(src, 10) && REAGENT_TOTAL_VOLUME(tank.reagents) < REAGENT_MAXIMUM_VOLUME(tank.reagents)) tank.add_to_reagents(/decl/material/liquid/water, 100) if(prob(5)) playsound(loc, 'sound/effects/slosh.ogg', 25, 1) @@ -228,7 +228,7 @@ return 0 if(istype(target, /obj/structure/hygiene/sink)) - if(!tank || tank.reagents.total_volume >= tank.reagents.maximum_volume) + if(!tank || REAGENT_TOTAL_VOLUME(tank.reagents) >= REAGENT_MAXIMUM_VOLUME(tank.reagents)) return 0 return 1 @@ -242,13 +242,13 @@ if(tray.dead && removes_dead || tray.harvest && collects_produce) return FARMBOT_COLLECT - else if(refills_water && tray.waterlevel < 40 && !tray.reagents.has_reagent(/decl/material/liquid/water) && (tank?.reagents.total_volume > 0)) + else if(refills_water && tray.waterlevel < 40 && !tray.reagents.has_reagent(/decl/material/liquid/water) && (REAGENT_TOTAL_VOLUME(tank?.reagents) > 0)) return FARMBOT_WATER else if(uproots_weeds && tray.weedlevel > 3) return FARMBOT_UPROOT - else if(replaces_nutriment && tray.nutrilevel < 1 && tray.reagents.total_volume < 1) + else if(replaces_nutriment && tray.nutrilevel < 1 && REAGENT_TOTAL_VOLUME(tray.reagents) < 1) return FARMBOT_NUTRIMENT return 0 diff --git a/code/modules/mob/living/bot/medibot.dm b/code/modules/mob/living/bot/medibot.dm index 9d1b66b783d5..30a2c37e4250 100644 --- a/code/modules/mob/living/bot/medibot.dm +++ b/code/modules/mob/living/bot/medibot.dm @@ -199,7 +199,7 @@ . = ..() . += "
Beaker: " if(reagent_glass) - . += "Loaded \[[reagent_glass.reagents.total_volume]/[reagent_glass.reagents.maximum_volume]\]" + . += "Loaded \[[REAGENT_TOTAL_VOLUME(reagent_glass.reagents)]/[REAGENT_MAXIMUM_VOLUME(reagent_glass.reagents)]\]" else . += "None loaded" @@ -306,7 +306,7 @@ // 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/decl/material/reagent as anything in reagent_glass.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagent_glass.reagents)) if(!patient.reagents.has_reagent(reagent)) return 1 continue diff --git a/code/modules/mob/living/human/examine.dm b/code/modules/mob/living/human/examine.dm index d33940b0c301..3ea28d2aadad 100644 --- a/code/modules/mob/living/human/examine.dm +++ b/code/modules/mob/living/human/examine.dm @@ -64,8 +64,8 @@ /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(REAGENT_TOTAL_VOLUME(touching_reagents) >= 1) + var/saturation = REAGENT_TOTAL_VOLUME(touching_reagents) / REAGENT_MAXIMUM_VOLUME(touching_reagents) if(saturation > 0.9) . += "[pronouns.He] [pronouns.is] completely saturated." else if(saturation > 0.6) @@ -284,7 +284,7 @@ continue if(last_divider) // insert the divider from the last entry . += last_divider - else if(length(.)) // we already have prior entries, insert our prefix + else if(length(.) && examiner.section_prefix) // we already have prior entries, insert our prefix . += examiner.section_prefix . += adding_text last_divider = examiner.section_postfix diff --git a/code/modules/mob/living/human/human.dm b/code/modules/mob/living/human/human.dm index 08c623244b06..a296f4413444 100644 --- a/code/modules/mob/living/human/human.dm +++ b/code/modules/mob/living/human/human.dm @@ -302,7 +302,7 @@ var/obj/item/organ/internal/stomach/stomach = get_organ(BP_STOMACH, /obj/item/organ/internal/stomach) var/nothing_to_puke = FALSE if(should_have_organ(BP_STOMACH)) - if(!stomach || (stomach.ingested.total_volume <= 0 && stomach.contents.len == 0)) + if(!stomach || (REAGENT_TOTAL_VOLUME(stomach.ingested) <= 0 && stomach.contents.len == 0)) nothing_to_puke = TRUE else if(!(locate(/mob) in contents)) nothing_to_puke = TRUE @@ -328,8 +328,8 @@ var/turf/location = loc if(istype(location) && location.simulated) var/obj/effect/decal/cleanable/vomit/splat = new /obj/effect/decal/cleanable/vomit(location) - if(stomach.ingested.total_volume) - stomach.ingested.trans_to_obj(splat, min(15, stomach.ingested.total_volume)) + if(REAGENT_TOTAL_VOLUME(stomach.ingested)) + stomach.ingested.trans_to_obj(splat, min(15, REAGENT_TOTAL_VOLUME(stomach.ingested))) handle_additional_vomit_reagents(splat) splat.update_icon() @@ -880,7 +880,7 @@ /mob/living/human/fluid_act(var/datum/reagents/fluids) ..() - if(!QDELETED(src) && fluids?.total_volume) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids)) species.fluid_act(src, fluids) /mob/living/human/proc/set_background_value(var/cat_type, var/decl/background_detail/_background, var/defer_language_update) diff --git a/code/modules/mob/living/human/human_blood.dm b/code/modules/mob/living/human/human_blood.dm index fd5f388ee845..7c0e00da1270 100644 --- a/code/modules/mob/living/human/human_blood.dm +++ b/code/modules/mob/living/human/human_blood.dm @@ -30,18 +30,20 @@ make_blood() if(!should_have_organ(BP_HEART)) - vessel.clear_reagents() - vessel.maximum_volume = 0 + if(istype(vessel)) + vessel.clear_reagents() + REAGENT_SET_MAX_VOL(vessel, 0) return - if(vessel.total_volume < species.blood_volume) - vessel.maximum_volume = species.blood_volume - adjust_blood(species.blood_volume - vessel.total_volume) - else if(vessel.total_volume > species.blood_volume) - vessel.remove_any(vessel.total_volume - species.blood_volume) - vessel.maximum_volume = species.blood_volume + if(istype(vessel)) + if(REAGENT_TOTAL_VOLUME(vessel) < species.blood_volume) + REAGENT_SET_MAX_VOL(vessel, species.blood_volume) + adjust_blood(species.blood_volume - REAGENT_TOTAL_VOLUME(vessel)) + else if(REAGENT_TOTAL_VOLUME(vessel) > species.blood_volume) + vessel.remove_any(REAGENT_TOTAL_VOLUME(vessel) - species.blood_volume) + REAGENT_SET_MAX_VOL(vessel, species.blood_volume) - LAZYSET(vessel.reagent_data, species.blood_reagent, list( + REAGENT_SET_DATA(vessel, species.blood_reagent, list( DATA_BLOOD_DONOR = weakref(src), DATA_BLOOD_SPECIES = get_species_name(), DATA_BLOOD_DNA = get_unique_enzymes(), @@ -54,9 +56,9 @@ /mob/living/human/proc/drip(var/amt, var/tar = src, var/ddir) var/datum/reagents/bloodstream = get_injected_reagents() if(remove_blood(amt)) - if(bloodstream.total_volume && vessel.total_volume) - var/chem_share = round(0.3 * amt * (bloodstream.total_volume/vessel.total_volume), 0.01) - bloodstream.remove_any(chem_share * bloodstream.total_volume) + if(REAGENT_TOTAL_VOLUME(bloodstream) && REAGENT_TOTAL_VOLUME(vessel)) + var/chem_share = round(0.3 * amt * (REAGENT_TOTAL_VOLUME(bloodstream) / REAGENT_TOTAL_VOLUME(vessel)), 0.01) + bloodstream.remove_any(chem_share * REAGENT_TOTAL_VOLUME(bloodstream)) blood_splatter(tar, src, (ddir && ddir>0), spray_dir = ddir) return amt return 0 @@ -154,7 +156,7 @@ if(stress_modifier) amount *= 1-(get_config_value(/decl/config/num/health_stress_blood_recovery_constant) * stress_modifier) - var/blood_volume_raw = vessel.total_volume + var/blood_volume_raw = REAGENT_TOTAL_VOLUME(vessel) amount = max(0,min(amount, species.blood_volume - blood_volume_raw)) if(amount) adjust_blood(amount, get_blood_data()) @@ -170,16 +172,16 @@ reagents.trans_to_obj(container, amount) return 1 - if(vessel.total_volume < amount) + if(REAGENT_TOTAL_VOLUME(vessel) < amount) return null if(vessel.has_reagent(species.blood_reagent)) - LAZYSET(vessel.reagent_data, species.blood_reagent, get_blood_data()) + REAGENT_SET_DATA(vessel, species.blood_reagent, get_blood_data()) vessel.trans_to_holder(container.reagents, amount) return 1 //Percentage of maximum blood volume. /mob/living/human/proc/get_blood_volume() - return species.blood_volume ? round((vessel.total_volume/species.blood_volume)*100) : 0 + return species.blood_volume ? round((REAGENT_TOTAL_VOLUME(vessel)/species.blood_volume)*100) : 0 //Percentage of maximum blood volume, affected by the condition of circulation organs /mob/living/human/proc/get_blood_circulation() diff --git a/code/modules/mob/living/human/human_movement.dm b/code/modules/mob/living/human/human_movement.dm index 012f9071302a..0d2c601638e9 100644 --- a/code/modules/mob/living/human/human_movement.dm +++ b/code/modules/mob/living/human/human_movement.dm @@ -25,20 +25,25 @@ if(can_feel_pain() && get_shock() >= 10) tally += (get_shock() / 10) //pain shouldn't slow you down if you can't even feel it + var/list/limbs_to_check if(istype(buckled, /obj/structure/chair/wheelchair)) - for(var/organ_name in list(BP_L_HAND, BP_R_HAND, BP_L_ARM, BP_R_ARM)) - var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(src, organ_name) - tally += E ? E.get_movement_delay(4) : 4 - else for(var/obj/item/I in get_equipped_items(include_carried = TRUE)) var/slot = get_equipped_slot_for_item(I) tally += LAZYACCESS(I.slowdown_per_slot, slot) tally += I.slowdown_general tally += I.slowdown_accessory + limbs_to_check = global.all_maniple_limbs + else + limbs_to_check = global.all_stance_limbs - for(var/organ_name in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT)) - var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(src, organ_name) - tally += E ? E.get_movement_delay(4) : 4 + var/missing_limbs = H ? H.bodytype.get_expected_organ_count_for_categories(limbs_to_check) : 4 + if(missing_limbs > 0) + var/max_delay_per_limb = ceil(16/missing_limbs) + for(var/obj/item/organ/external/limb in get_organs_by_categories(limbs_to_check)) + tally += limb.get_movement_delay(max_delay_per_limb) + missing_limbs-- + if(missing_limbs > 0) + tally += missing_limbs * max_delay_per_limb if(shock_stage >= 10 || get_stamina() <= 0) tally += 3 @@ -96,6 +101,11 @@ handle_leg_damage() species.handle_post_move(src) +/mob/living/human/forceMove() + . = ..() + if(.) + species.handle_post_move(src, exertion = FALSE) + /mob/living/human/proc/handle_leg_damage() if(!can_feel_pain()) return diff --git a/code/modules/mob/living/human/human_organs.dm b/code/modules/mob/living/human/human_organs.dm index 1b4884758d9c..6549dcb8a6f8 100644 --- a/code/modules/mob/living/human/human_organs.dm +++ b/code/modules/mob/living/human/human_organs.dm @@ -70,9 +70,10 @@ LAZYDISTINCTADD(external_organs, O) // Update our organ category lists, if neeed. - if(O.organ_category) - LAZYINITLIST(organs_by_category) - LAZYDISTINCTADD(organs_by_category[O.organ_category], O) + if(O.organ_categories) + for(var/category in cached_json_decode(O.organ_categories)) + LAZYINITLIST(organs_by_category) + LAZYDISTINCTADD(organs_by_category[category], O) // Update stat organs as well if(O.has_stat_info) @@ -112,10 +113,11 @@ LAZYREMOVE(external_organs, O) // Update our organ category lists, if neeed. - if(O.organ_category && islist(organs_by_category)) - organs_by_category[O.organ_category] -= O - if(LAZYLEN(organs_by_category[O.organ_category]) <= 0) - LAZYREMOVE(organs_by_category, O.organ_category) + if(O.organ_categories && islist(organs_by_category)) + for(var/category in cached_json_decode(O.organ_categories)) + organs_by_category[category] -= O + if(LAZYLEN(organs_by_category[category]) <= 0) + LAZYREMOVE(organs_by_category, category) // Update stat organs as well if(O.has_stat_info && stat_organs) @@ -217,8 +219,8 @@ if(!(. = ..())) return //Move some blood over to the organ - if(!BP_IS_PROSTHETIC(O) && O.species && O.reagents?.total_volume < 5) - vessel.trans_to(O, 5 - O.reagents.total_volume, 1, 1) + if(!BP_IS_PROSTHETIC(O) && O.species && REAGENT_TOTAL_VOLUME(O.reagents) < 5) + vessel.trans_to(O, 5 - REAGENT_TOTAL_VOLUME(O.reagents), 1, 1) /mob/living/human/is_asystole() diff --git a/code/modules/mob/living/human/human_presets.dm b/code/modules/mob/living/human/human_presets.dm index 29ec5b8d1411..802158c14986 100644 --- a/code/modules/mob/living/human/human_presets.dm +++ b/code/modules/mob/living/human/human_presets.dm @@ -73,6 +73,6 @@ /mob/living/human/monkey/Initialize(mapload, species_uid, datum/mob_snapshot/supplied_appearance) if(gender == PLURAL) - gender = pick(MALE, FEMALE) + set_gender(pick(MALE, FEMALE)) species_uid = /decl/species/monkey::uid . = ..() diff --git a/code/modules/mob/living/human/say.dm b/code/modules/mob/living/human/say.dm index 4f41bcf192ac..3b7ce80dab1f 100644 --- a/code/modules/mob/living/human/say.dm +++ b/code/modules/mob/living/human/say.dm @@ -72,20 +72,6 @@ return verb -/mob/living/human/handle_speech_problems(var/list/message_data) - if(HAS_STATUS(src, STAT_SILENCE) || has_genetic_condition(GENE_COND_MUTED)) - to_chat(src, SPAN_WARNING("You are unable to speak!")) - message_data[1] = "" - return TRUE - - var/obj/item/clothing/mask/M = get_equipped_item(slot_wear_mask_str) - if(istype(M) && M.voicechange) - message_data[1] = pick(M.say_messages) - message_data[2] = pick(M.say_verbs) - return TRUE - - return ..(message_data) - /mob/living/human/handle_message_mode(message_mode, message, verb, speaking, used_radios) if(message_mode == MESSAGE_MODE_WHISPER) //It's going to get sanitized again immediately, so decode. whisper_say(html_decode(message), speaking) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 189965c89c8c..ff9a8613746d 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -271,10 +271,10 @@ if(!loc) return var/datum/reagents/touching_reagents = get_contact_reagents() - if(touching_reagents?.total_volume <= FLUID_MINIMUM_TRANSFER) + if(REAGENT_TOTAL_VOLUME(touching_reagents) <= FLUID_MINIMUM_TRANSFER) touching_reagents?.clear_reagents() return - var/drip_amount = max(FLUID_MINIMUM_TRANSFER, round(touching_reagents.total_volume * 0.2)) + var/drip_amount = max(FLUID_MINIMUM_TRANSFER, round(REAGENT_TOTAL_VOLUME(touching_reagents) * 0.2)) if(drip_amount) touching_reagents.trans_to(loc, drip_amount) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 1e6497c10a04..956ae903000c 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -805,22 +805,22 @@ default behaviour is: var/inhale_amount = 0 if(inhaled) inhale_amount = rand(2,5) - T.reagents?.trans_to_holder(inhaled, min(T.reagents.total_volume, inhale_amount)) + T.reagents?.trans_to_holder(inhaled, min(REAGENT_TOTAL_VOLUME(T.reagents), inhale_amount)) if(ingested) var/ingest_amount = 5 - inhale_amount - reagents?.trans_to_holder(ingested, min(T.reagents.total_volume, ingest_amount)) + reagents?.trans_to_holder(ingested, min(REAGENT_TOTAL_VOLUME(T.reagents), ingest_amount)) T.show_bubbles() return TRUE // Presumably chemical smoke can't be breathed while you're underwater. /mob/living/fluid_act(var/datum/reagents/fluids) ..() - if(QDELETED(src) || fluids?.total_volume < FLUID_PUDDLE) + if(QDELETED(src) || REAGENT_TOTAL_VOLUME(fluids) < FLUID_PUDDLE) return fluids.touch_mob(src) - if(QDELETED(src) || fluids?.total_volume < FLUID_PUDDLE) + if(QDELETED(src) || REAGENT_TOTAL_VOLUME(fluids) < FLUID_PUDDLE) return - var/on_turf = fluids.my_atom == get_turf(src) + var/on_turf = REAGENT_GET_ATOM(fluids) == get_turf(src) for(var/atom/movable/A as anything in get_equipped_items(TRUE)) if(!A.simulated) continue @@ -829,23 +829,15 @@ default behaviour is: if(on_turf && !A.submerged()) continue A.fluid_act(fluids) - if(QDELETED(src) || !fluids.total_volume) + if(QDELETED(src) || !REAGENT_TOTAL_VOLUME(fluids)) return // TODO: review saturation logic so we can end up with more than like 15 water in our contact reagents. var/datum/reagents/touching_reagents = get_contact_reagents() if(touching_reagents) - var/saturation = min(fluids.total_volume, round(mob_size * 1.5 * reagent_permeability()) - touching_reagents.total_volume) + var/saturation = min(REAGENT_TOTAL_VOLUME(fluids), round(mob_size * 1.5 * reagent_permeability()) - REAGENT_TOTAL_VOLUME(touching_reagents)) if(saturation > 0) fluids.trans_to_holder(touching_reagents, saturation) -/mob/living/proc/needs_wheelchair() - var/tmp_stance_damage = 0 - for(var/limb_tag in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT)) - var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(src, limb_tag) - if(!E || !E.is_usable()) - tmp_stance_damage += 2 - return tmp_stance_damage >= 4 - /mob/living/proc/seizure() set waitfor = 0 sleep(rand(5,10)) @@ -993,7 +985,8 @@ default behaviour is: /mob/living/proc/get_food_satiation(consumption_method = EATING_METHOD_EAT) . = (consumption_method == EATING_METHOD_EAT) ? get_nutrition() : get_hydration() - . += get_ingested_reagents()?.total_volume * 5 + var/datum/reagents/ingested = get_ingested_reagents() + . += REAGENT_TOTAL_VOLUME(ingested) * 5 /mob/living/proc/get_ingested_reagents() RETURN_TYPE(/datum/reagents) @@ -1378,7 +1371,7 @@ default behaviour is: //flush away reagents on the skin var/datum/reagents/touching_reagents = get_contact_reagents() if(touching_reagents) - var/remove_amount = touching_reagents.maximum_volume * reagent_permeability() //take off your suit first + var/remove_amount = REAGENT_MAXIMUM_VOLUME(touching_reagents) * reagent_permeability() //take off your suit first touching_reagents.remove_any(remove_amount) var/obj/item/mask = get_equipped_item(slot_wear_mask_str) @@ -1562,11 +1555,11 @@ default behaviour is: var/obj/item/clothing/shoes/shoes = get_equipped_item(slot_shoes_str) if(istype(shoes)) shoes.handle_movement(src, MOVING_QUICKLY(src)) - if(shoes.coating && shoes.coating.total_volume > 1) + if(shoes.coating && REAGENT_TOTAL_VOLUME(shoes.coating) > 1) source = shoes else for(var/obj/item/organ/external/stomper in get_organs_by_categories(global.child_stance_limbs)) - if(stomper.coating?.total_volume > 1) + if(REAGENT_TOTAL_VOLUME(stomper.coating) > 1) source = stomper break @@ -1579,7 +1572,10 @@ default behaviour is: if(!use_move_trail) return - var/decl/material/contaminant = source.coating.reagent_volumes[1] // take [1] instead of primary reagent to match what remove_any will probably remove + if(!istype(source.coating)) + return + + var/decl/material/contaminant = UNLINT(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. @@ -1954,7 +1950,7 @@ default behaviour is: . += SPAN_WARNING("\The [src] will be ready to be sheared in [ceil((shearable.next_fleece-world.time) / 10)] second\s.") if(has_extension(src, /datum/extension/milkable)) var/datum/extension/milkable/milkable = get_extension(src, /datum/extension/milkable) - if(milkable.udder.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(milkable.udder) > 0) . += SPAN_NOTICE("\The [src] can be milked into a bucket or other container.") else . += SPAN_WARNING("\The [src] cannot currently be milked.") diff --git a/code/modules/mob/living/living_blood.dm b/code/modules/mob/living/living_blood.dm index dffee4ed0dcc..bdd172360d72 100644 --- a/code/modules/mob/living/living_blood.dm +++ b/code/modules/mob/living/living_blood.dm @@ -18,7 +18,7 @@ data[DATA_BLOOD_SPECIES] = species_name var/list/temp_chem = list() - for(var/decl/material/reagent as anything in reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) temp_chem[reagent.type] = REAGENT_VOLUME(reagents, reagent) data[DATA_BLOOD_TRACE_CHEM] = temp_chem data[DATA_BLOOD_DOSE_CHEM] = _chem_doses?.Copy() || list() diff --git a/code/modules/mob/living/living_breath.dm b/code/modules/mob/living/living_breath.dm index 43d33f644d02..2731659ccbf1 100644 --- a/code/modules/mob/living/living_breath.dm +++ b/code/modules/mob/living/living_breath.dm @@ -132,7 +132,7 @@ return for(var/obj/effect/effect/smoke/chem/smoke in view(1, src)) - if(smoke.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(smoke.reagents)) smoke.reagents.trans_to_mob(src, 5, CHEM_INGEST, copy = 1) smoke.reagents.trans_to_mob(src, 5, CHEM_INJECT, copy = 1) // I dunno, maybe the reagents enter the blood stream through the lungs? diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index db1058faccbb..ad212a096151 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -1,10 +1,5 @@ - /mob/living/Login() . = ..() - //login during ventcrawl - if(is_ventcrawling && istype(loc, /obj/machinery/atmospherics)) //attach us back into the pipes - remove_ventcrawl() - add_ventcrawl(loc) //Mind updates mind_initialize() //updates the mind (or creates and initializes one if one doesn't exist) mind.active = 1 //indicates that the mind is currently synced with a client diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 64d683017724..49e187b25a7f 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -26,27 +26,35 @@ //Takes a list of the form list(message, verb, whispering) and modifies it as needed //Returns 1 if a speech problem was applied, 0 otherwise -/mob/living/proc/handle_speech_problems(var/list/message_data) - var/message = message_data[1] - var/verb = message_data[2] - - . = 0 - - if(HAS_STATUS(src, STAT_SLUR)) - message = slur(message) - verb = pick("slobbers","slurs") - . = 1 +/mob/living/proc/handle_speech_problems(var/list/message_data, var/decl/language/spoken) + var/say_message = message_data[1] + var/say_verb = message_data[2] + + . = FALSE + var/obj/item/clothing/mask/M = get_equipped_item(slot_wear_mask_str) + if(istype(M) && M.voicechange) + say_message = pick(M.say_messages) + say_verb = pick(M.say_verbs) + . = TRUE + else if(HAS_STATUS(src, STAT_SILENCE) || has_genetic_condition(GENE_COND_MUTED)) + to_chat(src, SPAN_WARNING("You are unable to speak!")) + say_message = "" + . = TRUE + else if(HAS_STATUS(src, STAT_SLUR)) + say_message = slur(say_message) + say_verb = pick("slobbers","slurs") + . = TRUE else if(HAS_STATUS(src, STAT_STUTTER)) - message = NewStutter(message) - verb = pick("stammers","stutters") - . = 1 + say_message = NewStutter(say_message) + say_verb = pick("stammers","stutters") + . = TRUE else if(has_chemical_effect(CE_SQUEAKY, 1)) - message = "[message]" - verb = "squeaks" - . = 1 + say_message = "[say_message]" + say_verb = "squeaks" + . = TRUE - message_data[1] = message - message_data[2] = verb + message_data[1] = say_message + message_data[2] = say_verb // Grabs any radios equipped to the mob, with message_mode used to // determine relevancy. See handle_message_mode below. @@ -179,6 +187,9 @@ to_chat(src, SPAN_WARNING("You don't have the right equipment to communicate in that way!")) // weird phrasing, but needs to cover speaking and signing return + // The LANG_FLAG_NO_STUTTER check means nonvocal or unusually-produced + // languages (e.g. sign language, noise emotes, computer beeps) + // will not be affected by stuttering, slurring, silence, etc. effects. if(!(speaking && (speaking.flags & LANG_FLAG_NO_STUTTER))) var/list/message_data = list(message, verb, 0) if(handle_speech_problems(message_data)) 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 3e9944558ac7..9046c5549b4d 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 @@ -70,8 +70,8 @@ /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.reagents.maximum_volume) - var/adding = min(PS.reagents.maximum_volume-PS.reagents.total_volume, 2*amount) + if(PS && REAGENT_TOTAL_VOLUME(PS.reagents) < REAGENT_MAXIMUM_VOLUME(PS.reagents)) + var/adding = min(REAGENT_MAXIMUM_VOLUME(PS.reagents)-REAGENT_TOTAL_VOLUME(PS.reagents), 2*amount) if(adding > 0) PS.add_to_reagents(/decl/material/liquid/acid/polyacid, adding) ..() 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 9ea5d4ee7ef6..1ba23a2809c1 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 @@ -41,8 +41,8 @@ if(!luminol) luminol = new(src) equipment += luminol - if(luminol.reagents.total_volume < luminol.reagents.maximum_volume) - var/adding = min(luminol.reagents.maximum_volume-luminol.reagents.total_volume, 2*amount) + if(REAGENT_TOTAL_VOLUME(luminol.reagents) < REAGENT_MAXIMUM_VOLUME(luminol.reagents)) + var/adding = min(REAGENT_MAXIMUM_VOLUME(luminol.reagents)-REAGENT_TOTAL_VOLUME(luminol.reagents), 2*amount) if(adding > 0) luminol.add_to_reagents(/decl/material/liquid/luminol, adding) ..() diff --git a/code/modules/mob/living/silicon/robot/modules/_module.dm b/code/modules/mob/living/silicon/robot/modules/_module.dm index 5de1f45f8dec..29f7b69c5f74 100644 --- a/code/modules/mob/living/silicon/robot/modules/_module.dm +++ b/code/modules/mob/living/silicon/robot/modules/_module.dm @@ -195,7 +195,7 @@ F.update_icon() else if(F.times_used) F.times_used-- - if(!synths || !synths.len) + if(!LAZYLEN(synths)) return for(var/datum/matter_synth/T in synths) T.add_charge(T.recharge_rate * rate) diff --git a/code/modules/mob/living/silicon/robot/modules/module_uncertified.dm b/code/modules/mob/living/silicon/robot/modules/module_uncertified.dm index 6b21bb2b4209..a151a66d63e3 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_uncertified.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_uncertified.dm @@ -18,7 +18,7 @@ CAMERA_CHANNEL_TELEVISION ) equipment = list( - /obj/item/boombox, + /obj/item/music_player/boombox, /obj/item/bikehorn/airhorn, /obj/item/flashlight/party, /obj/item/gun/launcher/money diff --git a/code/modules/mob/living/simple_animal/alien/alien.dm b/code/modules/mob/living/simple_animal/alien/alien.dm index 952843112ff4..8c2bce14bff7 100644 --- a/code/modules/mob/living/simple_animal/alien/alien.dm +++ b/code/modules/mob/living/simple_animal/alien/alien.dm @@ -11,7 +11,6 @@ var/instance_num /mob/living/simple_animal/alien/Initialize() - verbs += /mob/living/proc/ventcrawl verbs += /mob/living/proc/hide instance_num = rand(1, 1000) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 985e71554779..99e38a6baa01 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -223,7 +223,7 @@ /mob/living/simple_animal/passive/cat/kitten/Initialize() . = ..() - gender = pick(MALE, FEMALE) + set_gender(pick(MALE, FEMALE)) /mob/living/simple_animal/passive/cat/fluff/ran name = "Runtime" diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm index 9264cd3be0f4..a125c209d960 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm @@ -163,7 +163,7 @@ /mob/living/simple_animal/corgi/puppy/Initialize() . = ..() - gender = pick(MALE, FEMALE) + set_gender(pick(MALE, FEMALE)) //pupplies cannot wear anything. /mob/living/simple_animal/corgi/puppy/OnTopic(mob/user, href_list) diff --git a/code/modules/mob/living/simple_animal/friendly/possum.dm b/code/modules/mob/living/simple_animal/friendly/possum.dm index d57bba3eff9b..ef8c318ade27 100644 --- a/code/modules/mob/living/simple_animal/friendly/possum.dm +++ b/code/modules/mob/living/simple_animal/friendly/possum.dm @@ -97,7 +97,6 @@ /mob/living/simple_animal/opossum/Initialize() . = ..() - verbs += /mob/living/proc/ventcrawl verbs += /mob/living/proc/hide /mob/living/simple_animal/opossum/poppy diff --git a/code/modules/mob/living/simple_animal/hostile/vagrant.dm b/code/modules/mob/living/simple_animal/hostile/vagrant.dm index 2724d98aede4..28731e48512a 100644 --- a/code/modules/mob/living/simple_animal/hostile/vagrant.dm +++ b/code/modules/mob/living/simple_animal/hostile/vagrant.dm @@ -54,7 +54,7 @@ gripping = null else if(gripping.should_have_organ(BP_HEART)) - var/blood_volume = round(gripping.vessel.total_volume) + var/blood_volume = round(REAGENT_TOTAL_VOLUME(gripping.vessel)) if(blood_volume > 5) gripping.vessel.remove_any(blood_per_tick) heal_overall_damage(health_per_tick) diff --git a/code/modules/mob/living/simple_animal/passive/mouse.dm b/code/modules/mob/living/simple_animal/passive/mouse.dm index 39a71bc81699..72d3815596e2 100644 --- a/code/modules/mob/living/simple_animal/passive/mouse.dm +++ b/code/modules/mob/living/simple_animal/passive/mouse.dm @@ -52,7 +52,6 @@ INVOKE_ASYNC(body, TYPE_PROC_REF(/mob/living/simple_animal, audible_emote), "snuffles.") /mob/living/simple_animal/passive/mouse/Initialize() - verbs += /mob/living/proc/ventcrawl verbs += /mob/living/proc/hide if(name == initial(name)) name = "[name] ([sequential_id(/mob/living/simple_animal/passive/mouse)])" diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 5ccfdad3ebe1..dadb2de1b99d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -123,6 +123,122 @@ if(bound_overlay) bound_overlay.visible_message(message, self_message, blind_message) +/mob/proc/get_action_string(is_self, var/using_verb, var/object_phrase, var/infix, var/postfix) + var/decl/pronouns/using_pronouns = is_self ? get_self_pronouns() : get_visible_pronouns() + // A little kludgy/special-cased: we don't use the name for self messages. + var/actor_string = is_self ? using_pronouns.He : "\The [src]" + // this will hopefully handle is/does/has agreement properly + . = "[actor_string] [verb_agree_with_pronouns(using_verb, using_pronouns, is_after_pronoun = is_self)] [infix ? infix + " " : null][object_phrase][postfix ? " " + postfix : null]" + // uh oh, time to handle tokens. + . = replacetext(., "$USER$", "\the [src]") + . = replacetext(., "$USER'S$", "\the [src]'s") + . = replacetext(., "$USER_THEY$", using_pronouns.he) + . = replacetext(., "$USER_THEM$", using_pronouns.him) + . = replacetext(., "$USER_THEIR$", using_pronouns.his) + . = replacetext(., "$USER_SELF$", using_pronouns.self) + . = replacetext(., "$USER_DOES$", using_pronouns.does) + . = replacetext(., "$USER_HAS$", using_pronouns.has) + . = replacetext(., "$USER_IS$", using_pronouns.is) + . = replacetext(., "$USER_S$", using_pronouns.s) + . = replacetext(., "$USER_ES$", using_pronouns.es) + +/mob/proc/get_targeted_action_string(mob/target, is_self, var/using_verb, var/object_phrase, var/infix, var/postfix) + . = get_action_string(is_self, using_verb, object_phrase, infix, postfix) + var/target_is_self = target == src + var/decl/pronouns/target_pronouns = target_is_self ? target.get_self_pronouns() : target.get_visible_pronouns() + // A little kludgy/special-cased: we don't use the name if it's self-targeted, regardless of who's viewing + . = replacetext(., "$TARGET$", target_is_self ? target_pronouns.self : "\the [target]") + . = replacetext(., "$TARGET'S$", target_is_self ? target_pronouns.his : "\the [target]'s") + . = replacetext(., "$TARGET_THEM$", target_is_self ? target_pronouns.self : target_pronouns.him) // reflexive if self, so use self instead of them + . = replacetext(., "$TARGET_THEIR$", target_pronouns.his) + . = replacetext(., "$TARGET_THEY$", target_pronouns.he) + . = replacetext(., "$TARGET_DOES$", target_pronouns.does) + . = replacetext(., "$TARGET_HAS$", target_pronouns.has) + . = replacetext(., "$TARGET_IS$", target_pronouns.is) + . = replacetext(., "$TARGET_S$", target_pronouns.s) + . = replacetext(., "$TARGET_ES$", target_pronouns.es) + +// Determines span styling used for visible_action_message. +/// Uses SPAN_NOTICE for both self and other messages. +var/global/const/ACTION_DANGER_NONE = 0 +/// Uses SPAN_DANGER for others and SPAN_WARNING for self. +var/global/const/ACTION_DANGER_OTHERS = 1 +/// Uses SPAN_DANGER for both self and others. +var/global/const/ACTION_DANGER_ALL = 2 +/** + Show an action message to all mobs and objects in sight of this mob. + + Used for atoms performing visible actions. Handles basic self-messages automatically. + + - `using_verb`: The verb to use in the message, e.g. "open", "is", "attack". Should be in the base form (no "s" at the end). + - `object_phrase`: The phrase to use after the verb, e.g. "\the [used_item]". Could be a phrase including a gerund or infinitive, like "repairing \the [machine]." + - `dangerous?`: One of the ACTION_DANGER_* constants, determining the styling of the message, OR a string style class. Default: ACTION_DANGER_NONE + - `blind_message?`: The string blind mobs will see. Example: "You hear something!" Default: null + - `range?`: The number of tiles away the message will be visible from. Default: world.view + - `self_infix?`: An optional infix to insert between the verb and object phrase in the self message. Default: null + - `self_postfix?`: An optional postfix to insert after the object phrase in the self message. Default: null + - `other_infix?`: An optional infix to insert between the verb and object phrase in the other message. Default: null + - `other_postfix?`: An optional postfix to insert after the object phrase in the other message. Default: null +*/ +/mob/proc/visible_action_message(var/using_verb, var/object_phrase, var/dangerous = ACTION_DANGER_NONE, var/blind_message = null, var/range = world.view, var/self_infix = null, var/self_postfix = null, var/other_infix = null, var/other_postfix = null) + var/self_message = get_action_string(TRUE, using_verb, object_phrase, self_infix, self_postfix) + var/other_message = get_action_string(FALSE, using_verb, object_phrase, other_infix, other_postfix) + switch(dangerous) + if(ACTION_DANGER_NONE) + other_message = SPAN_NOTICE(other_message) + self_message = SPAN_NOTICE(self_message) + if(ACTION_DANGER_OTHERS) + other_message = SPAN_DANGER(other_message) + self_message = SPAN_WARNING(self_message) + if(ACTION_DANGER_ALL) + other_message = SPAN_DANGER(other_message) + self_message = SPAN_DANGER(self_message) + else // fallback for stuff like lighter styling + other_message = SPAN_CLASS(dangerous, other_message) + self_message = SPAN_CLASS(dangerous, self_message) + visible_message( + other_message, + self_message, + blind_message, + range + ) + +/mob/proc/targeted_visible_action_message(var/mob/target, var/using_verb, var/object_phrase, var/dangerous = ACTION_DANGER_NONE, var/blind_message = null, var/range = world.view, var/self_infix = null, var/self_postfix = null, var/other_infix = null, var/other_postfix = null) + var/self_message = get_targeted_action_string(target, TRUE, using_verb, object_phrase, self_infix, self_postfix) + var/other_message = get_targeted_action_string(target, FALSE, using_verb, object_phrase, other_infix, other_postfix) + switch(dangerous) + if(ACTION_DANGER_NONE) + other_message = SPAN_NOTICE(other_message) + self_message = SPAN_NOTICE(self_message) + if(ACTION_DANGER_OTHERS) + other_message = SPAN_DANGER(other_message) + self_message = SPAN_WARNING(self_message) + if(ACTION_DANGER_ALL) + other_message = SPAN_DANGER(other_message) + self_message = SPAN_DANGER(self_message) + else // fallback for stuff like lighter styling + other_message = SPAN_CLASS(dangerous, other_message) + self_message = SPAN_CLASS(dangerous, self_message) + visible_message( + other_message, + self_message, + blind_message, + range + ) + +/mob/proc/self_action_message(var/using_verb, var/object_phrase, var/dangerous = ACTION_DANGER_NONE, var/infix, var/postfix) + var/the_message = get_targeted_action_string(src, TRUE, using_verb, object_phrase, infix, postfix) + switch(dangerous) + if(ACTION_DANGER_NONE) + the_message = SPAN_NOTICE(the_message) + if(ACTION_DANGER_OTHERS) + the_message = SPAN_WARNING(the_message) + if(ACTION_DANGER_ALL) + the_message = SPAN_DANGER(the_message) + else // fallback for stuff like lighter styling + the_message = SPAN_CLASS(dangerous, the_message) + to_chat(src, the_message) + // Show a message to all mobs and objects in earshot of this one // This would be for audible actions by the src mob // message is the message output to anyone who can hear. diff --git a/code/modules/mob/observer/eye/blueprints_eye.dm b/code/modules/mob/observer/eye/blueprints_eye.dm index 7742f8f2c6bf..c7bae7b5f9c7 100644 --- a/code/modules/mob/observer/eye/blueprints_eye.dm +++ b/code/modules/mob/observer/eye/blueprints_eye.dm @@ -53,7 +53,7 @@ /mob/observer/eye/blueprints/proc/create_area() var/area_name = sanitize_safe(input("New area name:","Area Creation", ""), MAX_NAME_LEN) - if(!area_name || !length(area_name)) + if(!length(area_name)) return if(length(area_name) > MAX_NAME_LEN) to_chat(owner, SPAN_WARNING("That name is too long!")) diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index a7363022c794..db8faa6840aa 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -103,14 +103,17 @@ var/global/list/special_channel_keys = list( /mob/proc/is_silenced() . = !!get_item_blocking_speech() +/obj/item/proc/blocks_speech_in_mouth(mob/wearer) + return FALSE + /mob/proc/get_item_blocking_speech() // Can't talk with something in your mouth. var/datum/inventory_slot/mouth_slot = get_inventory_slot_datum(BP_MOUTH) . = mouth_slot?.get_equipped_item() if(!.) var/obj/item/mask = get_equipped_item(slot_wear_mask_str) - if(istype(mask, /obj/item/clothing/mask/muzzle) || istype(mask, /obj/item/sealant)) - . = mask + if(mask?.blocks_speech_in_mouth(src)) + return mask /// Adds punctuation to an emote or speech message automatically. /mob/proc/handle_autopunctuation(message) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 43b674835701..bebc25e3b4b5 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -253,7 +253,7 @@ log_admin("[key_name(src)] has transformed into a zombie!") SET_STATUS_MAX(src, STAT_WEAK, 5) if (should_have_organ(BP_HEART)) - adjust_blood(species.blood_volume - vessel.total_volume) + adjust_blood(species.blood_volume - REAGENT_TOTAL_VOLUME(vessel)) for (var/o in get_external_organs()) var/obj/item/organ/organ = o if (!BP_IS_PROSTHETIC(organ)) diff --git a/code/modules/mob_modifiers/_modifiers.dm b/code/modules/mob_modifiers/_modifiers.dm index 677608454afb..cd019876af4e 100644 --- a/code/modules/mob_modifiers/_modifiers.dm +++ b/code/modules/mob_modifiers/_modifiers.dm @@ -56,7 +56,7 @@ . += "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)) + return capitalize_proper_html(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) diff --git a/code/modules/multiz/level_data.dm b/code/modules/multiz/level_data.dm index ea5984672f15..389f3e24923b 100644 --- a/code/modules/multiz/level_data.dm +++ b/code/modules/multiz/level_data.dm @@ -504,12 +504,9 @@ mob_count-- CHECK_TICK -///Changes anything named we may need to rename accordingly to the parent location name. For instance, exoplanets levels. -/datum/level_data/proc/adapt_location_name(var/location_name) - SHOULD_CALL_PARENT(TRUE) - if(!base_area || ispath(base_area, /area/space)) - return FALSE - return TRUE +///Changes anything named we may need to rename based on the parent location name. For instance, exoplanet surface areas. +/datum/level_data/proc/adapt_to_location_name(var/location_name) + return //#TODO: this could probably be done in a more elegant way. Since most map templates will never call this. ///Called before a runtime generated template is generated on our z-level. Only applies to templates generated onto new z-levels. diff --git a/code/modules/organs/ailments/_ailment.dm b/code/modules/organs/ailments/_ailment.dm index 713dfcdc7aab..fc3853f0b4a8 100644 --- a/code/modules/organs/ailments/_ailment.dm +++ b/code/modules/organs/ailments/_ailment.dm @@ -94,7 +94,7 @@ . = replacetext(., "$TARGET$", "\the [target]") if(organ) . = replacetext(., "$ORGAN$", organ.name) - var/decl/pronouns/organ_pronouns = get_pronouns_by_gender(organ.gender) + var/decl/pronouns/organ_pronouns = organ.get_pronouns() . = replacetext(., "$ORGAN_DOES$", organ_pronouns.does) . = replacetext(., "$ORGAN_IS$", organ_pronouns.is) . = capitalize(trim(.)) diff --git a/code/modules/organs/external/quadruped.dm b/code/modules/organs/external/quadruped.dm index 1411f8e91e10..5ea0d59dde9c 100644 --- a/code/modules/organs/external/quadruped.dm +++ b/code/modules/organs/external/quadruped.dm @@ -20,7 +20,7 @@ amputation_point = "front left knee" tendon_name = "cruciate ligament" artery_name = "femoral artery" - organ_category = ORGAN_CATEGORY_STANCE_ROOT + organ_categories = @"['" + ORGAN_CATEGORY_STANCE_ROOT + "']" limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_CAN_STAND | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE /obj/item/organ/external/arm/right/quadruped @@ -29,7 +29,7 @@ amputation_point = "front right knee" tendon_name = "cruciate ligament" artery_name = "femoral artery" - organ_category = ORGAN_CATEGORY_STANCE_ROOT + organ_categories = @"['" + ORGAN_CATEGORY_STANCE_ROOT + "']" limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_CAN_STAND | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE /obj/item/organ/external/hand/quadruped @@ -38,7 +38,7 @@ amputation_point = "front left ankle" tendon_name = "Achilles tendon" limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_CAN_STAND | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE - organ_category = ORGAN_CATEGORY_STANCE + organ_categories = @"['" + ORGAN_CATEGORY_STANCE + "']" gripper_type = null /obj/item/organ/external/hand/right/quadruped @@ -47,5 +47,5 @@ amputation_point = "front right ankle" tendon_name = "Achilles tendon" limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_CAN_STAND | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE - organ_category = ORGAN_CATEGORY_STANCE + organ_categories = @"['" + ORGAN_CATEGORY_STANCE + "']" gripper_type = null diff --git a/code/modules/organs/external/standard.dm b/code/modules/organs/external/standard.dm index 85c880a0a84c..570c39460722 100644 --- a/code/modules/organs/external/standard.dm +++ b/code/modules/organs/external/standard.dm @@ -61,6 +61,7 @@ artery_name = "basilic vein" arterial_bleed_severity = 0.75 limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE + organ_categories = @"['" + ORGAN_CATEGORY_MANIPLE + "']" /obj/item/organ/external/arm/right organ_tag = BP_R_ARM @@ -83,7 +84,7 @@ tendon_name = "cruciate ligament" artery_name = "femoral artery" arterial_bleed_severity = 0.75 - organ_category = ORGAN_CATEGORY_STANCE_ROOT + organ_categories = @"['" + ORGAN_CATEGORY_STANCE_ROOT + "']" limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_CAN_STAND | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE /obj/item/organ/external/leg/right @@ -108,7 +109,7 @@ tendon_name = "Achilles tendon" arterial_bleed_severity = 0.5 limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_CAN_STAND | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE - organ_category = ORGAN_CATEGORY_STANCE + organ_categories = @"['" + ORGAN_CATEGORY_STANCE + "']" /obj/item/organ/external/foot/get_natural_attacks() var/static/list/unarmed_attacks = list( @@ -141,6 +142,7 @@ arterial_bleed_severity = 0.5 limb_flags = ORGAN_FLAG_CAN_AMPUTATE | ORGAN_FLAG_FINGERPRINT | ORGAN_FLAG_HAS_TENDON | ORGAN_FLAG_CAN_BREAK | ORGAN_FLAG_CAN_DISLOCATE is_washable = TRUE + organ_categories = @"['" + ORGAN_CATEGORY_MANIPLE + "']" var/gripper_type = /datum/inventory_slot/gripper/left_hand /obj/item/organ/external/hand/get_natural_attacks() diff --git a/code/modules/organs/internal/heart.dm b/code/modules/organs/internal/heart.dm index 371c957ffc26..4617c8b74a22 100644 --- a/code/modules/organs/internal/heart.dm +++ b/code/modules/organs/internal/heart.dm @@ -147,7 +147,7 @@ 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) + var/bleed_amount = floor((REAGENT_TOTAL_VOLUME(owner.vessel) / (temp.applied_pressure || !open_wound ? 400 : 250))*temp.arterial_bleed_severity) if(bleed_amount) if(open_wound) blood_max += bleed_amount diff --git a/code/modules/organs/internal/lungs.dm b/code/modules/organs/internal/lungs.dm index 0fc0f1ea4945..fa5cbde82863 100644 --- a/code/modules/organs/internal/lungs.dm +++ b/code/modules/organs/internal/lungs.dm @@ -37,20 +37,19 @@ /obj/item/organ/internal/lungs/initialize_reagents(populate) if(!inhaled) inhaled = new/datum/reagents/metabolism(240, (owner || src), CHEM_INHALE) - if(!inhaled.my_atom) - inhaled.my_atom = src + REAGENT_SET_ATOM(inhaled, src) . = ..() /obj/item/organ/internal/lungs/do_install(mob/living/human/target, obj/item/organ/external/affected, in_place) if(!(. = ..())) return - inhaled.my_atom = owner + REAGENT_SET_ATOM(inhaled, owner) inhaled.parent = owner /obj/item/organ/internal/lungs/do_uninstall(in_place, detach, ignore_children) . = ..() if(inhaled) - inhaled.my_atom = src + REAGENT_SET_ATOM(inhaled, src) inhaled.parent = null /obj/item/organ/internal/lungs/proc/can_drown() @@ -376,5 +375,5 @@ last_cough = world.time // Coughing clears out 1-2 reagents from the lungs. - if(lung.inhaled.total_volume > 0 && loc) + if(REAGENT_TOTAL_VOLUME(lung.inhaled) > 0 && loc) lung.inhaled.splash(loc, rand(1, 2)) \ No newline at end of file diff --git a/code/modules/organs/internal/stomach.dm b/code/modules/organs/internal/stomach.dm index 4cbde4e21255..5c98aeea901d 100644 --- a/code/modules/organs/internal/stomach.dm +++ b/code/modules/organs/internal/stomach.dm @@ -24,26 +24,25 @@ /obj/item/organ/internal/stomach/initialize_reagents(populate) if(!ingested) ingested = new/datum/reagents/metabolism(240, (owner || src), CHEM_INGEST) - if(!ingested.my_atom) - ingested.my_atom = src + REAGENT_SET_ATOM(ingested, src) . = ..() +/obj/item/organ/internal/stomach/do_install() + . = ..() + REAGENT_SET_ATOM(ingested, owner) + ingested.parent = owner + /obj/item/organ/internal/stomach/do_uninstall(in_place, detach, ignore_children) . = ..() if(ingested) //Don't bother if we're destroying - ingested.my_atom = src + REAGENT_SET_ATOM(ingested, src) ingested.parent = null -/obj/item/organ/internal/stomach/do_install() - . = ..() - ingested.my_atom = owner - ingested.parent = owner - /obj/item/organ/internal/stomach/proc/can_eat_atom(var/atom/movable/food) return !isnull(get_devour_time(food)) /obj/item/organ/internal/stomach/proc/is_full(var/atom/movable/food) - var/total = floor(ingested.total_volume / 10) + var/total = floor(REAGENT_TOTAL_VOLUME(ingested) / 10) for(var/a in contents + food) if(ismob(a)) var/mob/M = a @@ -123,7 +122,7 @@ owner.seizure() // Alcohol counts as double volume for the purposes of vomit probability - var/effective_volume = ingested.total_volume + alcohol_volume + var/effective_volume = REAGENT_TOTAL_VOLUME(ingested) + alcohol_volume // Just over the limit, the probability will be low. It rises a lot such that at double ingested it's 64% chance. var/vomit_probability = (effective_volume / STOMACH_VOLUME) ** 6 diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 1320a48c919b..8933d9788482 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -13,15 +13,15 @@ // Strings. /// 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 + /// Identifiers for use in organ collections, unused if unset. Must be formatted as a JSON list string. + var/organ_categories /// Organ holding this object. var/parent_organ = BP_CHEST // Status tracking. /// 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.. + /// 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 @@ -129,7 +129,7 @@ if(bodytype) reagent_to_add = bodytype.edible_reagent // can set this to null and skip the next block if(reagent_to_add) - add_to_reagents(reagent_to_add, reagents.maximum_volume) + add_to_reagents(reagent_to_add, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/organ/proc/copy_from_mob_snapshot(var/datum/mob_snapshot/supplied_appearance) if(supplied_appearance != organ_appearance) // Hacky. Is this ever used? Do any organs ever have DNA set before setup_as_organic? @@ -236,7 +236,7 @@ return if(!owner && reagents) - if(prob(40) && reagents.total_volume >= 0.1) + if(prob(40) && REAGENT_TOTAL_VOLUME(reagents) >= 0.1) if(reagents.has_reagent(/decl/material/liquid/blood)) blood_splatter(get_turf(src), src, 1) remove_any_reagents(0.1) @@ -261,8 +261,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/decl/material/reagent as anything in source.reagent_volumes) - if(ailment.treated_by_medication(reagent.type, source.reagent_volumes[reagent])) + var/source_volumes = REAGENT_VOLUMES(source) + for(var/decl/material/reagent as anything in source_volumes) + if(ailment.treated_by_medication(reagent.type, source_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)) @@ -423,8 +424,8 @@ var/obj/item/food/organ/yum = new(get_turf(src)) yum.SetName(name) yum.appearance = src - if(reagents && reagents.total_volume) - reagents.trans_to(yum, reagents.total_volume) + if(reagents && REAGENT_TOTAL_VOLUME(reagents)) + reagents.trans_to(yum, REAGENT_TOTAL_VOLUME(reagents)) transfer_fingerprints_to(yum) if(user) user.put_in_active_hand(yum) diff --git a/code/modules/overmap/ships/machines/fusion_thruster.dm b/code/modules/overmap/ships/machines/fusion_thruster.dm index 3e4ac6748728..f3da75287c27 100644 --- a/code/modules/overmap/ships/machines/fusion_thruster.dm +++ b/code/modules/overmap/ships/machines/fusion_thruster.dm @@ -31,7 +31,7 @@ if(lan) var/list/fusion_cores = lan.get_devices(/obj/machinery/fusion_core) - if(fusion_cores && fusion_cores.len) + if(LAZYLEN(fusion_cores)) harvest_from = fusion_cores[1] return harvest_from diff --git a/code/modules/paperwork/handlabeler.dm b/code/modules/paperwork/handlabeler.dm index 9121d00b60e3..23df3cdf036e 100644 --- a/code/modules/paperwork/handlabeler.dm +++ b/code/modules/paperwork/handlabeler.dm @@ -131,7 +131,7 @@ if(HAND_LABELER_MODE_ADD_NAME) to_chat(user, SPAN_NOTICE("You switch to labeling mode.")) var/str = sanitize_safe(input(user,"Label text?", "Set label", label), MAX_LNAME_LEN) - if(!str || !length(str)) + if(!length(str)) return label = str mode = HAND_LABELER_MODE_ADD diff --git a/code/modules/paperwork/pen/quill_and_ink.dm b/code/modules/paperwork/pen/quill_and_ink.dm index 7cb3ba4a1dc1..c6cda0c11177 100644 --- a/code/modules/paperwork/pen/quill_and_ink.dm +++ b/code/modules/paperwork/pen/quill_and_ink.dm @@ -88,7 +88,7 @@ if(current_uses >= quill.max_uses) to_chat(user, SPAN_WARNING("\The [quill] doesn't need any more ink!")) return TRUE - if(reagents?.total_liquid_volume <= 0) + if(REAGENT_TOTAL_LIQUID_VOLUME(reagents) <= 0) to_chat(user, SPAN_WARNING("\The [src] is empty!")) return TRUE to_chat(user, SPAN_NOTICE("You dip \the [quill] into \the [src].")) diff --git a/code/modules/paperwork/pen/reagent_pen.dm b/code/modules/paperwork/pen/reagent_pen.dm index dfd52e06b040..cc0c50f51bed 100644 --- a/code/modules/paperwork/pen/reagent_pen.dm +++ b/code/modules/paperwork/pen/reagent_pen.dm @@ -16,7 +16,7 @@ to_chat(user, SPAN_NOTICE("You begin hunting for an injection port on your suit.")) if(!user.do_skilled(INJECTION_PORT_DELAY, SKILL_MEDICAL, target)) return TRUE - if(reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) if(target.reagents) var/contained_reagents = reagents.get_reagents() var/trans = reagents.trans_to_mob(target, 30, CHEM_INJECT) @@ -35,4 +35,4 @@ desc = "It's \a [stroke_color_name] [medium_name] pen with a sharp point and a carefully engraved \"Waffle Co.\"." /obj/item/pen/reagent/sleepy/populate_reagents() - add_to_reagents(/decl/material/liquid/paralytics, round(reagents.maximum_volume/2)) + add_to_reagents(/decl/material/liquid/paralytics, round(REAGENT_MAXIMUM_VOLUME(reagents)/2)) diff --git a/code/modules/paperwork/toner_cartridge.dm b/code/modules/paperwork/toner_cartridge.dm index 8e4e6155f479..7c1eedfb5991 100644 --- a/code/modules/paperwork/toner_cartridge.dm +++ b/code/modules/paperwork/toner_cartridge.dm @@ -18,12 +18,12 @@ /obj/item/chems/toner_cartridge/populate_reagents() //Normally this would be toner powder, but probably not worth making a material for that. - add_to_reagents(/decl/material/liquid/paint, reagents.maximum_volume/2) - add_to_reagents(/decl/material/liquid/pigment/black, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/paint, REAGENT_MAXIMUM_VOLUME(reagents)/2) + add_to_reagents(/decl/material/liquid/pigment/black, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/toner_cartridge/dump_contents(atom/forced_loc = loc, mob/user) . = ..() - reagents?.splash(get_turf(forced_loc), reagents.total_volume) + reagents?.splash(get_turf(forced_loc), REAGENT_TOTAL_VOLUME(reagents)) /obj/item/chems/toner_cartridge/physically_destroyed(skip_qdel) material.place_shards(get_turf(src), 2) @@ -40,7 +40,7 @@ /obj/item/chems/toner_cartridge/proc/get_amount_toner_max() //Since ink is paint + pigment in a 1:1 ratio, only half the volume is actually usable - return round(reagents.maximum_volume / 2, 0.01) + return round(REAGENT_MAXIMUM_VOLUME(reagents) / 2, 0.01) /obj/item/chems/toner_cartridge/proc/use_toner(var/amount) if(!reagents) diff --git a/code/modules/pointdefense/pointdefense.dm b/code/modules/pointdefense/pointdefense.dm index ce55afe2f299..9c23c78e1360 100644 --- a/code/modules/pointdefense/pointdefense.dm +++ b/code/modules/pointdefense/pointdefense.dm @@ -93,7 +93,7 @@ var/datum/local_network/lan = pointdefense.get_local_network() if(lan) var/list/pointdefense_controllers = lan.get_devices(/obj/machinery/pointdefense_control) - if(pointdefense_controllers && pointdefense_controllers.len > 1) + if(LAZYLEN(pointdefense_controllers) > 1) lan.remove_device(src) return TRUE return ..() diff --git a/code/modules/power/apc/apc_frame.dm b/code/modules/power/apc/apc_frame.dm index 897401051961..7241115768a1 100644 --- a/code/modules/power/apc/apc_frame.dm +++ b/code/modules/power/apc/apc_frame.dm @@ -11,7 +11,7 @@ /obj/item/frame/apc/try_build(turf/on_wall) var/area/A = get_area(src) - if (A.requires_power == 0 || istype(A, /area/space)) + if (A.requires_power == 0 || A.always_unpowered) to_chat(usr, SPAN_WARNING("An APC cannot be placed in this area.")) return if (A.get_apc()) diff --git a/code/modules/power/debug_items.dm b/code/modules/power/debug_items.dm index 3c725c6dd430..dcb428ebdf8e 100644 --- a/code/modules/power/debug_items.dm +++ b/code/modules/power/debug_items.dm @@ -1,4 +1,5 @@ -/obj/machinery/power/debug_items/ +/obj/machinery/power/debug_items + abstract_type = /obj/machinery/power/debug_items icon = 'icons/obj/power.dmi' icon_state = "tracker" anchored = TRUE diff --git a/code/modules/power/fuel_assembly/fuel_compressor.dm b/code/modules/power/fuel_assembly/fuel_compressor.dm index d07651603a4a..77e506b3883f 100644 --- a/code/modules/power/fuel_assembly/fuel_compressor.dm +++ b/code/modules/power/fuel_assembly/fuel_compressor.dm @@ -120,8 +120,8 @@ 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/decl/material/reagent as anything in thing.reagents.reagent_volumes) + if(istype(thing) && thing.reagents && REAGENT_TOTAL_VOLUME(thing.reagents) && ATOM_IS_OPEN_CONTAINER(thing)) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(thing.reagents)) var/taking_reagent = REAGENT_VOLUME(thing.reagents, reagent) thing.remove_from_reagents(reagent, taking_reagent) stored_material[reagent.type] += taking_reagent diff --git a/code/modules/power/fusion/kinetic_harvester.dm b/code/modules/power/fusion/kinetic_harvester.dm index 34f832bf13fa..f9273dc7850c 100644 --- a/code/modules/power/fusion/kinetic_harvester.dm +++ b/code/modules/power/fusion/kinetic_harvester.dm @@ -47,7 +47,7 @@ if(lan) var/list/fusion_cores = lan.get_devices(/obj/machinery/fusion_core) - if(fusion_cores && fusion_cores.len) + if(LAZYLEN(fusion_cores)) harvest_from = fusion_cores[1] return harvest_from diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm deleted file mode 100644 index fa8764e8dc6d..000000000000 --- a/code/modules/power/gravitygenerator.dm +++ /dev/null @@ -1,109 +0,0 @@ -// It... uses a lot of power. Everything under power is engineering stuff, at least. - -/obj/machinery/computer/gravity_control_computer - name = "Gravity Generator Control" - desc = "A computer to control a local gravity generator. Qualified personnel only." - icon = 'icons/obj/computer.dmi' - icon_state = "airtunnel0e" - anchored = TRUE - density = TRUE - var/obj/machinery/gravity_generator/gravity_generator - -/obj/machinery/gravity_generator/ - name = "Gravitational Generator" - desc = "A device which produces a graviton field when set up." - icon = 'icons/obj/singularity.dmi' - icon_state = "TheSingGen" - anchored = TRUE - density = TRUE - idle_power_usage = 200 - active_power_usage = 1000 - var/on = 1 - var/list/localareas = list() - var/effectiverange = 25 - - // Borrows code from cloning computer -/obj/machinery/computer/gravity_control_computer/Initialize() - . = ..() - updatemodules() - -/obj/machinery/gravity_generator/Initialize() - . = ..() - locatelocalareas() - -/obj/machinery/computer/gravity_control_computer/proc/updatemodules() - for(dir in list(NORTH,EAST,SOUTH,WEST)) - gravity_generator = locate(/obj/machinery/gravity_generator/, get_step(src, dir)) - if (gravity_generator) - return - -/obj/machinery/gravity_generator/proc/locatelocalareas() - for(var/area/A in range(src,effectiverange)) - if(istype(A,/area/space)) - continue // No (de)gravitizing space. - localareas |= A - -/obj/machinery/computer/gravity_control_computer/interface_interact(mob/user) - interact(user) - return TRUE - -/obj/machinery/computer/gravity_control_computer/interact(mob/user) - user.set_machine(src) - - updatemodules() - - var/dat = "

Generator Control System

" - //dat += "Refresh" - if(gravity_generator) - if(gravity_generator.on) - dat += "
Gravity Status: ON

" - else - dat += "
Gravity Status: OFF

" - - dat += "
Currently Supplying Gravitons To:
" - - for(var/area/A in gravity_generator.localareas) - if(A.has_gravity && gravity_generator.on) - dat += "[A]
" - - else if (A.has_gravity) - dat += "[A]
" - - else - dat += "[A]
" - - dat += "
Maintainence Functions:
" - if(gravity_generator.on) - dat += " TURN GRAVITY GENERATOR OFF. " - else - dat += " TURN GRAVITY GENERATOR ON. " - - else - dat += "No local gravity generator detected!" - - show_browser(user, dat, "window=gravgen") - onclose(user, "gravgen") - - -/obj/machinery/computer/gravity_control_computer/OnTopic(user, href_list) - if((. = ..())) - return - - if(href_list["gentoggle"]) - . = TOPIC_REFRESH - if(gravity_generator.on) - gravity_generator.on = 0 - - for(var/area/A in gravity_generator.localareas) - var/obj/machinery/gravity_generator/G - for(G in SSmachines.machinery) - if((A in G.localareas) && (G.on)) - break - if(!G) - A.gravitychange(0) - CHECK_TICK - else - for(var/area/A in gravity_generator.localareas) - gravity_generator.on = 1 - A.gravitychange(1) - CHECK_TICK diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 7d2788d0ca3a..82591b2c3d4d 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -366,8 +366,8 @@ data["fuel_type"] = capitalize(sheet_name) data["uses_coolant"] = !!reagents - data["coolant_stored"] = reagents?.total_volume - data["coolant_capacity"] = reagents?.maximum_volume + data["coolant_stored"] = REAGENT_TOTAL_VOLUME(reagents) + data["coolant_capacity"] = REAGENT_MAXIMUM_VOLUME(reagents) ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) @@ -461,7 +461,7 @@ /obj/machinery/port_gen/pacman/super/potato/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - . += "Auxilary tank shows [reagents.total_volume]u of liquid in it." + . += "Auxilary tank shows [REAGENT_TOTAL_VOLUME(reagents)]u of liquid in it." /obj/machinery/port_gen/pacman/super/potato/UseFuel() if(reagents.has_reagent(/decl/material/liquid/alcohol/vodka)) diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index b88f26c3fe64..ff6d5274e982 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -9,6 +9,7 @@ ///////////////////////////// /obj/machinery/power + abstract_type = /obj/machinery/power name = null icon = 'icons/obj/power.dmi' anchored = TRUE diff --git a/code/modules/power/powernet.dm b/code/modules/power/powernet.dm index 10a8d5488a99..6220dc117d20 100644 --- a/code/modules/power/powernet.dm +++ b/code/modules/power/powernet.dm @@ -101,7 +101,7 @@ if(problem > 0) problem = max(problem - 1, 0) - if(nodes && nodes.len) // Added to fix a bad list bug -- TLE + if(LAZYLEN(nodes)) // Added to fix a bad list bug -- TLE for(var/obj/machinery/power/terminal/term in nodes) if( istype( term.master_machine(), /obj/machinery/apc ) ) numapc++ diff --git a/code/modules/projectiles/ammunition/chemdart.dm b/code/modules/projectiles/ammunition/chemdart.dm index 97ce9edf74ef..bc6423ac6aab 100644 --- a/code/modules/projectiles/ammunition/chemdart.dm +++ b/code/modules/projectiles/ammunition/chemdart.dm @@ -10,10 +10,10 @@ chem_volume = 15 /obj/item/projectile/bullet/chemdart/on_hit(var/atom/target, var/blocked = 0, var/def_zone = null) - if(reagents?.total_volume && blocked < 100 && isliving(target)) + if(REAGENT_TOTAL_VOLUME(reagents) && blocked < 100 && isliving(target)) var/mob/living/L = target if(L.can_inject(null, def_zone) == CAN_INJECT) - reagents.trans_to_mob(L, reagents.total_volume, CHEM_INJECT) + reagents.trans_to_mob(L, REAGENT_TOTAL_VOLUME(reagents), CHEM_INJECT) /obj/item/ammo_casing/chemdart name = "chemical dart" diff --git a/code/modules/projectiles/guns/launcher/syringe_gun.dm b/code/modules/projectiles/guns/launcher/syringe_gun.dm index 3d1d65ad2847..ea57b6b0f4a1 100644 --- a/code/modules/projectiles/guns/launcher/syringe_gun.dm +++ b/code/modules/projectiles/guns/launcher/syringe_gun.dm @@ -60,7 +60,7 @@ //unfortuately we don't know where the dart will actually hit, since that's done by the parent. if(L.can_inject(null, ran_zone(TT.target_zone, 30, L)) == CAN_INJECT && syringe.reagents) var/reagent_log = syringe.reagents.get_reagents() - syringe.reagents.trans_to_mob(L, syringe.reagents.total_volume, CHEM_INJECT) + syringe.reagents.trans_to_mob(L, REAGENT_TOTAL_VOLUME(syringe.reagents), CHEM_INJECT) admin_inject_log(TT.thrower? TT.thrower : null, L, src, reagent_log, 15, violent=1) syringe.break_syringe(ishuman(hit_atom)? hit_atom : null) diff --git a/code/modules/projectiles/guns/projectile/dartgun.dm b/code/modules/projectiles/guns/projectile/dartgun.dm index 8b46af8c094a..ddf20a47a306 100644 --- a/code/modules/projectiles/guns/projectile/dartgun.dm +++ b/code/modules/projectiles/guns/projectile/dartgun.dm @@ -57,10 +57,11 @@ if (beakers.len) . += 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/decl/material/reagent as anything in B.reagents.liquid_volumes) + var/reagent_volumes = REAGENT_VOLUMES(B.reagents) + if(B.reagents && LAZYLEN(reagent_volumes)) + for(var/decl/material/reagent as anything in REAGENT_LIQUID_VOLUMES(B.reagents)) . += 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) + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(B.reagents)) . += 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) @@ -90,7 +91,7 @@ //fills the given dart with reagents /obj/item/gun/projectile/dartgun/proc/fill_dart(var/obj/item/projectile/bullet/chemdart/dart) if(length(mixing)) - var/mix_amount = dart.reagents?.total_volume/length(mixing) + var/mix_amount = REAGENT_TOTAL_VOLUME(dart.reagents)/length(mixing) for(var/obj/item/chems/glass/beaker/B in mixing) B.reagents.trans_to_obj(dart, mix_amount) @@ -109,8 +110,9 @@ if(!istype(B)) continue dat += "Beaker [i] contains: " - if(B.reagents && LAZYLEN(B.reagents.reagent_volumes)) - for(var/decl/material/reagent as anything in B.reagents.reagent_volumes) + var/reagent_volumes = REAGENT_VOLUMES(B.reagents) + if(LAZYLEN(reagent_volumes)) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(B.reagents)) dat += "
[REAGENT_VOLUME(B.reagents, reagent)] unit\s of [reagent.get_reagent_name(B.reagents)], " if(B in mixing) dat += "Mixing " diff --git a/code/modules/pronouns/_pronouns.dm b/code/modules/pronouns/_pronouns.dm index 83f899499b0e..174e9edb8c03 100644 --- a/code/modules/pronouns/_pronouns.dm +++ b/code/modules/pronouns/_pronouns.dm @@ -1,8 +1,10 @@ /decl/pronouns + uid = "pronouns_plural" + decl_flags = DECL_FLAG_MANDATORY_UID var/name = PLURAL - var/bureaucratic_term = "other" - var/informal_term = "hoopy frood" - var/honorific = "Mx." + var/bureaucratic_term = "others" + var/informal_term = "hoopy froods" + var/honorific = "Mxes." var/pronoun_string var/He = "They" @@ -16,6 +18,14 @@ var/self = "themselves" var/s = "" var/es = "" + /// Never inflect verbs with this pronoun set, for both nouns ("The bats spin around.") and pronouns ("They spin around.") + var/const/PLURALIZE_NONE = 0 + /// Inflect only verbs after nouns ("Unknown (as David Hasselhoff) spins around.") but not after pronouns ("They spin around.") + var/const/PLURALIZE_PSEUDO = 1 + /// Inflect verbs after both nouns and pronouns, e.g. "David Hasselhoff spins around." and "He spins around." + var/const/PLURALIZE_ALL = 2 + /// When should we give verbs plural inflections? Valid values: PLURALIZE_NONE, PLURALIZE_PSEUDO, PLURALIZE_ALL. + var/pluralize_verb = PLURALIZE_NONE /decl/pronouns/Initialize() pronoun_string = "[He]/[him]/[his]" @@ -84,7 +94,7 @@ var/global/list/byond_genders = list(MALE, FEMALE, NEUTER, PLURAL) var/obj/item/suit = get_equipped_item(slot_wear_suit_str) var/obj/item/head = get_equipped_item(slot_head_str) if(suit && (suit.flags_inv & HIDEJUMPSUIT) && ((head && head.flags_inv & HIDEMASK) || get_equipped_item(slot_wear_mask_str))) - return GET_DECL(/decl/pronouns) + return GET_DECL(/decl/pronouns/pseudoplural) if(!pronouns) pronouns = get_pronouns_by_gender(get_gender()) - return pronouns || GET_DECL(/decl/pronouns) + return pronouns || GET_DECL(/decl/pronouns/pseudoplural) diff --git a/code/modules/pronouns/pronouns_female.dm b/code/modules/pronouns/pronouns_female.dm index 41a90f3cabae..5127c3742b4d 100644 --- a/code/modules/pronouns/pronouns_female.dm +++ b/code/modules/pronouns/pronouns_female.dm @@ -1,4 +1,5 @@ /decl/pronouns/female + uid = "pronouns_female" name = FEMALE bureaucratic_term = "female" informal_term = "lady" @@ -15,3 +16,4 @@ self = "herself" s = "s" es = "es" + pluralize_verb = PLURALIZE_ALL diff --git a/code/modules/pronouns/pronouns_male.dm b/code/modules/pronouns/pronouns_male.dm index 47ea51748d06..ef1a15d413c2 100644 --- a/code/modules/pronouns/pronouns_male.dm +++ b/code/modules/pronouns/pronouns_male.dm @@ -1,5 +1,6 @@ /decl/pronouns/male name = MALE + uid = "pronouns_male" bureaucratic_term = "male" informal_term = "guy" honorific = "Mr." @@ -15,6 +16,7 @@ self = "himself" s = "s" es = "es" + pluralize_verb = PLURALIZE_ALL // Thanks oldcoders. var/static/list/weird_euphemisms_for_your_balls = list( diff --git a/code/modules/pronouns/pronouns_neuter.dm b/code/modules/pronouns/pronouns_neuter.dm index faccf5a25893..a9f32b216e06 100644 --- a/code/modules/pronouns/pronouns_neuter.dm +++ b/code/modules/pronouns/pronouns_neuter.dm @@ -1,4 +1,5 @@ /decl/pronouns/neuter + uid = "pronouns_neuter" name = NEUTER He = "It" he = "it" @@ -11,10 +12,12 @@ self = "itself" s = "s" es = "es" + pluralize_verb = PLURALIZE_ALL // Alternative to plural neuter. // With thanks to https://tib.cjcs.com/genderless-pronouns-ey-em-and-eir-2/ /decl/pronouns/neuter/person + uid = "pronouns_neuter_animate" name = NEUTER_ANIMATE He = "Ey" he = "ey" diff --git a/code/modules/pronouns/pronouns_pseudoplural.dm b/code/modules/pronouns/pronouns_pseudoplural.dm new file mode 100644 index 000000000000..f7cbb29e4625 --- /dev/null +++ b/code/modules/pronouns/pronouns_pseudoplural.dm @@ -0,0 +1,19 @@ +/decl/pronouns/pseudoplural + uid = "pronouns_pseudoplural" + name = PSEUDOPLURAL + bureaucratic_term = "other" + informal_term = "hoopy frood" + honorific = "Mx." + + He = "They" + he = "they" + His = "Their" + his = "their" + him = "them" + has = "have" + is = "are" + does = "do" + self = "themself" + pluralize_verb = PLURALIZE_PSEUDO + s = "" + es = "" \ No newline at end of file diff --git a/code/modules/pronouns/pronouns_second_person.dm b/code/modules/pronouns/pronouns_second_person.dm index 4860a1afaaa5..239f4e99d7f0 100644 --- a/code/modules/pronouns/pronouns_second_person.dm +++ b/code/modules/pronouns/pronouns_second_person.dm @@ -1,4 +1,5 @@ -/decl/pronouns/self +/decl/pronouns/second_person_singular + uid = "pronouns_second_person_singular" name = SECOND_PERSON_SINGULAR He = "You" he = "you" diff --git a/code/modules/random_map/dungeon/room_generation.dm b/code/modules/random_map/dungeon/room_generation.dm index fd62477f6f43..c480fac04ec1 100644 --- a/code/modules/random_map/dungeon/room_generation.dm +++ b/code/modules/random_map/dungeon/room_generation.dm @@ -18,7 +18,7 @@ return 1 /datum/random_room/proc/apply_loot(var/xorigin = 1,var/yorigin = 1,var/zorigin = 1, var/type) - if(!item_spawns || !item_spawns.len) + if(!LAZYLEN(item_spawns)) return 0 var/place = pick(item_spawns) if(istype(place,/obj)) //we assume what object we get is some sort of container. diff --git a/code/modules/random_map/dungeon/winding_dungeon.dm b/code/modules/random_map/dungeon/winding_dungeon.dm index 1ecf9649028e..762213b7640b 100644 --- a/code/modules/random_map/dungeon/winding_dungeon.dm +++ b/code/modules/random_map/dungeon/winding_dungeon.dm @@ -73,10 +73,10 @@ /datum/random_map/winding_dungeon/proc/get_appropriate_list(var/list/common, var/list/uncommon, var/list/rare, var/x, var/y) var/distance = sqrt((x - round(first_room_x+first_room_width/2)) ** 2 + (y - round(first_room_y+first_room_height/2)) ** 2) if(prob(distance)) - if(prob(distance/100) && rare && rare.len) + if(prob(distance/100) && LAZYLEN(rare)) logging("Returning rare list.") return rare - else if(uncommon && uncommon.len) + else if(LAZYLEN(uncommon)) logging("Returning uncommon list.") return uncommon logging("Returning common list.") @@ -92,12 +92,12 @@ var/num_of_loot = round(limit_x * limit_y * loot_multiplier) logging("Attempting to add [num_of_loot] # of loot") var/sanity = 0 - if((loot_common && loot_common.len) || (loot_uncommon && loot_uncommon.len) || (loot_rare && loot_rare.len)) //no monsters no problem + if((LAZYLEN(loot_common)) || (LAZYLEN(loot_uncommon)) || (LAZYLEN(loot_rare))) //no monsters no problem while(rooms.len && num_of_loot > 0) CHECK_TICK var/datum/room/R = pick(rooms) var/list/loot_list = get_appropriate_list(loot_common, loot_uncommon, loot_rare, round(R.x+R.width/2), round(R.y+R.height/2)) - if(!loot_list || !loot_list.len || R.add_loot(origin_x,origin_y,origin_z,pickweight(loot_list))) + if(!LAZYLEN(loot_list) || R.add_loot(origin_x,origin_y,origin_z,pickweight(loot_list))) num_of_loot-- sanity -= 10 //we hahve success so more tries continue @@ -110,7 +110,7 @@ rooms -= R qdel(R) - if((!monsters_common || !monsters_common.len) && (!monsters_uncommon || !monsters_uncommon.len) && (!monsters_rare || !monsters_rare.len)) //no monsters no problem + if(!LAZYLEN(monsters_common) && !LAZYLEN(monsters_uncommon) && !LAZYLEN(monsters_rare)) //no monsters no problem logging("No monster lists detected. Not spawning monsters.") return @@ -119,14 +119,14 @@ while(num_of_monsters > 0) CHECK_TICK - if(!monster_available || !monster_available.len) + if(!LAZYLEN(monster_available)) logging("There are no available turfs left.") num_of_monsters = 0 continue var/turf/T = pick(monster_available) monster_available -= T var/list/monster_list = get_appropriate_list(monsters_common, monsters_uncommon, monsters_rare, T.x, T.y) - if(monster_list && monster_list.len) + if(LAZYLEN(monster_list)) var/type = pickweight(monster_list) logging("Generating a monster of type [type] at position ([T.x],[T.y],[origin_z])") var/mob/M = new type(T) diff --git a/code/modules/random_map/noise/ore.dm b/code/modules/random_map/noise/ore.dm index 474ccc3687ab..3f61d35d3b1e 100644 --- a/code/modules/random_map/noise/ore.dm +++ b/code/modules/random_map/noise/ore.dm @@ -75,7 +75,6 @@ var/tx = ((origin_x-1)+x)*chunk_size var/ty = ((origin_y-1)+y)*chunk_size - for(var/T in range(locate(tx, ty, origin_z))) for(var/i=0,i= beaker.reagents.maximum_volume)) + if (!beaker || (REAGENT_TOTAL_VOLUME(beaker.reagents) >= REAGENT_MAXIMUM_VOLUME(beaker.reagents))) return FALSE attempt_skill_effect(user) @@ -197,7 +197,7 @@ // Process. for (var/obj/item/thing in holdingitems) - var/remaining_volume = beaker.reagents.maximum_volume - beaker.reagents.total_volume + var/remaining_volume = REAGENT_MAXIMUM_VOLUME(beaker.reagents) - REAGENT_TOTAL_VOLUME(beaker.reagents) if(remaining_volume <= 0) break @@ -216,7 +216,7 @@ continue else if(thing.reagents) - thing.reagents.trans_to(beaker, thing.reagents.total_volume, skill_factor) + thing.reagents.trans_to(beaker, REAGENT_TOTAL_VOLUME(thing.reagents), skill_factor) holdingitems -= thing qdel(thing) @@ -274,4 +274,4 @@ return visible_message(SPAN_NOTICE("\The [src] whirrs violently and spills its contents all over \the [user]!")) if(beaker?.reagents) - beaker.reagents.splash(user, beaker.reagents.total_volume) \ No newline at end of file + beaker.reagents.splash(user, REAGENT_TOTAL_VOLUME(beaker.reagents)) \ No newline at end of file diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index a1e484aa57e4..629091fd1096 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -11,9 +11,9 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new return reagents?.remove_any(amount, defer_update, removed_phases, skip_reagents) /atom/proc/get_reagent_space() - if(!reagents?.maximum_volume) + if(!REAGENT_MAXIMUM_VOLUME(reagents)) return 0 - return reagents.maximum_volume - reagents.total_volume + return REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(reagents) /atom/proc/get_reagents() return reagents @@ -55,23 +55,21 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new vapor?.update_values() liquids?.update_total() +// These vars are privated due to the potential for reagents to be either null, a list, or a datum. +// Always use the REAGENT_FOO macros! /datum/reagents - var/primary_reagent - var/primary_solid - var/primary_liquid - var/list/reagent_volumes - - var/list/liquid_volumes - var/list/solid_volumes // This should be taken as powders/flakes, rather than large solid pieces of material. - - var/list/reagent_data - var/total_volume = 0 - var/maximum_volume = 120 - - var/total_liquid_volume // Used to determine when to create fluids in the world and the like. - - var/atom/my_atom - var/cached_color + VAR_PRIVATE/list/reagent_volumes + VAR_PRIVATE/list/liquid_volumes + VAR_PRIVATE/list/solid_volumes // This should be taken as powders/flakes, rather than large solid pieces of material. + VAR_PRIVATE/list/reagent_data + VAR_PRIVATE/atom/my_atom + VAR_PRIVATE/cached_color + VAR_PRIVATE/primary_reagent + VAR_PRIVATE/primary_solid + VAR_PRIVATE/primary_liquid + VAR_PRIVATE/total_volume = 0 + VAR_PRIVATE/total_liquid_volume // Used to determine when to create fluids in the world and the like. + VAR_PRIVATE/maximum_volume = 120 /datum/reagents/New(var/maximum_volume = 120, var/atom/my_atom) src.maximum_volume = maximum_volume @@ -112,7 +110,7 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new return clone /datum/reagents/proc/get_reaction_loc(chemical_reaction_flags) - if((chemical_reaction_flags & CHEM_REACTION_FLAG_OVERFLOW_CONTAINER) && ATOM_IS_OPEN_CONTAINER(my_atom)) + if((chemical_reaction_flags & CHEM_REACTION_FLAG_OVERFLOW_CONTAINER) && my_atom.reaction_can_overflow()) return get_turf(my_atom) return my_atom @@ -910,7 +908,7 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new . = trans_to_holder(target.reagents, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) // Deferred updates are presumably being done by SSfluids. // Do an immediate fluid_act call rather than waiting for SSfluids to proc. - if(!defer_update && target.reagents.total_volume >= FLUID_PUDDLE) + if(!defer_update && REAGENT_TOTAL_VOLUME(target.reagents) >= FLUID_PUDDLE) target.fluid_act(target.reagents) // Objects may or may not have reagents; if they do, it's probably a beaker or something and we need to transfer properly; otherwise, just touch. @@ -979,22 +977,25 @@ var/global/datum/reagents/sink/infinite_reagent_sink = new /* Atom reagent creation - use it all the time */ /atom/proc/create_reagents(var/max_vol) - if(reagents) + if(istype(reagents)) log_debug("Attempted to create a new reagents holder when already referencing one: [log_info_line(src)]") - reagents.maximum_volume = max(reagents.maximum_volume, max_vol) - else + REAGENT_SET_MAX_VOL(reagents, max(REAGENT_MAXIMUM_VOLUME(reagents), max_vol)) + else if(!reagents) reagents = new/datum/reagents(max_vol, src) + else + return return reagents /atom/proc/create_or_update_reagents(_vol, override_volume) - if(reagents) + if(isnull(reagents)) + return create_reagents(_vol) + if(istype(reagents)) if(override_volume) - reagents.maximum_volume = _vol // should we remove excess reagents here? + REAGENT_SET_MAX_VOL(reagents, _vol) // should we remove excess reagents here? else - reagents.maximum_volume = max(reagents.maximum_volume, _vol) + REAGENT_SET_MAX_VOL(reagents, max(REAGENT_MAXIMUM_VOLUME(reagents), _vol)) reagents.update_total() return reagents - return create_reagents(_vol) /// Infinite reagent sink: nothing is ever actually added to it, useful for complex, filtered deletion of reagents without holder churn. /datum/reagents/sink diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index af6fa27d09f8..eb852d575ccf 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -32,7 +32,7 @@ var/bottle_lid_color = COLOR_OFF_WHITE /obj/machinery/chem_master/proc/get_remaining_volume() - return reagents ? clamp(reagents.maximum_volume - reagents.total_volume, 0, reagents.maximum_volume) : 0 + return reagents ? clamp(REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(reagents), 0, REAGENT_MAXIMUM_VOLUME(reagents)) : 0 /obj/machinery/chem_master/attackby(var/obj/item/used_item, var/mob/user) @@ -167,7 +167,7 @@ else if (href_list["createpill"] || href_list["createpill_multiple"]) var/count = 1 - if(reagents.total_volume/count < 1) //Sanity checking. + if(REAGENT_TOTAL_VOLUME(reagents)/count < 1) //Sanity checking. return TOPIC_HANDLED if (href_list["createpill_multiple"]) @@ -176,14 +176,14 @@ return TOPIC_HANDLED count = clamp(count, 1, max_pill_count) - var/amount_per_pill = min(reagents.total_volume/count, 30) + var/amount_per_pill = min(REAGENT_TOTAL_VOLUME(reagents)/count, 30) if(amount_per_pill < 1) // Sanity checking. return TOPIC_HANDLED var/name = sanitize_safe(input(usr,"Name:","Name your pill!","[reagents.get_primary_reagent_name()] ([amount_per_pill]u)"), MAX_NAME_LEN) if(!CanInteract(user, state)) return TOPIC_HANDLED - if(reagents.total_volume/count < 1) //Sanity checking. + if(REAGENT_TOTAL_VOLUME(reagents)/count < 1) //Sanity checking. return TOPIC_HANDLED while (count-- && count >= 0) var/obj/item/chems/pill/dispensed/P = new(loc) @@ -219,7 +219,7 @@ /obj/machinery/chem_master/proc/fetch_contaminants(mob/user, datum/reagents/reagents, decl/material/main_reagent) . = list() - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent != main_reagent && prob(user.skill_fail_chance(core_skill, 100))) . += reagent @@ -282,11 +282,11 @@ dat += "Eject Pill Bottle \[[loaded_pill_bottle.contents.len]/[loaded_pill_bottle.storage.max_storage_space]\]

" else dat += "No pill bottle inserted.

" - if(!R.total_volume) + if(!REAGENT_TOTAL_VOLUME(R)) dat += "Beaker is empty." else dat += "Add to buffer:
" - for(var/decl/material/reagent as anything in R.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(R)) dat += "[reagent.use_name], [REAGENT_VOLUME(R, reagent)] Units - " dat += "(Analyze) " dat += "(1) " @@ -296,8 +296,8 @@ dat += "(Custom)
" dat += "
Transfer to [(!mode ? "disposal" : "beaker")]:
" - if(reagents.total_volume) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + if(REAGENT_TOTAL_VOLUME(reagents)) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) dat += "[reagent.use_name], [REAGENT_VOLUME(reagents, reagent)] Units - " dat += "(Analyze) " dat += "(1) " diff --git a/code/modules/reagents/chems/chems_blood.dm b/code/modules/reagents/chems/chems_blood.dm index c4396a07c04f..b4a6f089ba82 100644 --- a/code/modules/reagents/chems/chems_blood.dm +++ b/code/modules/reagents/chems/chems_blood.dm @@ -52,7 +52,7 @@ 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) + blood_splatter(touching_turf, donor?.resolve() || REAGENT_GET_ATOM(holder), 1) /decl/material/liquid/blood/affect_ingest(var/mob/living/M, var/removed, var/datum/reagents/holder) . = ..() diff --git a/code/modules/reagents/chems/chems_compounds.dm b/code/modules/reagents/chems/chems_compounds.dm index 7467842c66e9..cb305d78e23c 100644 --- a/code/modules/reagents/chems/chems_compounds.dm +++ b/code/modules/reagents/chems/chems_compounds.dm @@ -30,8 +30,9 @@ H.update_eyes() /decl/material/liquid/glowsap/on_leaving_metabolism(datum/reagents/metabolism/holder) - if(ishuman(holder?.my_atom)) - var/mob/living/human/H = holder.my_atom + var/my_atom = REAGENT_GET_ATOM(holder) + if(ishuman(my_atom)) + var/mob/living/human/H = my_atom addtimer(CALLBACK(H, TYPE_PROC_REF(/mob/living/human, update_eyes)), 5 SECONDS) . = ..() @@ -382,7 +383,7 @@ 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) + REAGENT_SET_DATA(holder, 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_drugs.dm b/code/modules/reagents/chems/chems_drugs.dm index 7a998e6981d0..05a13fe3670c 100644 --- a/code/modules/reagents/chems/chems_drugs.dm +++ b/code/modules/reagents/chems/chems_drugs.dm @@ -66,7 +66,7 @@ if(update_data) LAZYSET(data, DATA_COOLDOWN_TIME, world.time) - LAZYSET(holder.reagent_data, type, data) + REAGENT_SET_DATA(holder, type, data) /decl/material/liquid/nicotine/affect_overdose(mob/living/victim, total_dose) ..() @@ -256,7 +256,7 @@ /decl/material/liquid/glowsap/gleam/on_leaving_metabolism(datum/reagents/metabolism/holder) . = ..() - var/mob/M = holder?.my_atom + var/mob/M = REAGENT_GET_ATOM(holder) if(istype(M)) M.remove_client_color(/datum/client_color/noir/thirdeye) diff --git a/code/modules/reagents/chems/chems_medicines.dm b/code/modules/reagents/chems/chems_medicines.dm index fac296caebb6..6578646b9e28 100644 --- a/code/modules/reagents/chems/chems_medicines.dm +++ b/code/modules/reagents/chems/chems_medicines.dm @@ -133,12 +133,12 @@ var/removing = (4 * removed * antitoxin_strength) var/datum/reagents/ingested = M.get_ingested_reagents() - for(var/decl/material/reagent as anything in ingested?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(ingested)) if((remove_generic && reagent.toxicity) || (reagent.type in remove_toxins)) ingested.remove_reagent(reagent, removing) return - for(var/decl/material/reagent as anything in M.reagents?.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(M.reagents)) if((remove_generic && reagent.toxicity) || (reagent.type in remove_toxins)) M.remove_from_reagents(reagent, removing) return @@ -368,7 +368,7 @@ var/charges = removed * DETOXIFIER_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/decl/material/reagent as anything in container.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(container)) var/decl/material/liquid/painkillers/painkiller = reagent if(!istype(painkiller) || !painkiller.narcotic) continue diff --git a/code/modules/reagents/chems/chems_painkillers.dm b/code/modules/reagents/chems/chems_painkillers.dm index f6185712f460..5f35447a5538 100644 --- a/code/modules/reagents/chems/chems_painkillers.dm +++ b/code/modules/reagents/chems/chems_painkillers.dm @@ -130,7 +130,7 @@ return var/datum/reagents/ingested = M.get_ingested_reagents() if(ingested) - var/list/pool = M.reagents.reagent_volumes | ingested.reagent_volumes + var/list/pool = REAGENT_VOLUMES(M.reagents) | REAGENT_VOLUMES(ingested) 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 diff --git a/code/modules/reagents/chems/chems_psychiatric.dm b/code/modules/reagents/chems/chems_psychiatric.dm index e81e3c6eba49..a6f64a93262c 100644 --- a/code/modules/reagents/chems/chems_psychiatric.dm +++ b/code/modules/reagents/chems/chems_psychiatric.dm @@ -27,7 +27,7 @@ if(update_data) LAZYSET(data, DATA_COOLDOWN_TIME, world.time) - LAZYSET(holder.reagent_data, type, data) + REAGENT_SET_DATA(holder, 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) diff --git a/code/modules/reagents/cocktails.dm b/code/modules/reagents/cocktails.dm index 1815fa6e998b..fd688adbcd92 100644 --- a/code/modules/reagents/cocktails.dm +++ b/code/modules/reagents/cocktails.dm @@ -68,17 +68,17 @@ . = length(ratios) /decl/cocktail/proc/matches(var/obj/item/prop) - if(length(ratios) > length(prop.reagents.reagent_volumes)) + if(length(ratios) > length(REAGENT_VOLUMES(prop.reagents))) return FALSE var/list/check_ratios var/i = 0 for(var/rtype in ratios) i++ - if(!prop.reagents.has_reagent(rtype) || (order_specific && prop.reagents.reagent_volumes[i] != rtype)) + if(!prop.reagents.has_reagent(rtype) || (order_specific && REAGENT_VOLUME(prop.reagents, i) != rtype)) return FALSE if(isnum(ratios[rtype])) LAZYSET(check_ratios, rtype, ratios[rtype]) - var/effective_volume = prop.reagents.total_volume + var/effective_volume = REAGENT_TOTAL_VOLUME(prop.reagents) if(!(/decl/material/solid/ice in ratios)) effective_volume -= REAGENT_VOLUME(prop.reagents, /decl/material/solid/ice) for(var/rtype in check_ratios) diff --git a/code/modules/reagents/dispenser/cartridge.dm b/code/modules/reagents/dispenser/cartridge.dm index 96dbb3859411..35300fc4310a 100644 --- a/code/modules/reagents/dispenser/cartridge.dm +++ b/code/modules/reagents/dispenser/cartridge.dm @@ -13,18 +13,19 @@ /obj/item/chems/chem_disp_cartridge/Initialize() . = ..() - if(reagents?.primary_reagent && !_reagent_label) - _reagent_label = reagents.get_primary_reagent_name() + var/decl/material/primary_reagent = istype(reagents) && reagents.get_primary_reagent_decl() + if(primary_reagent && !_reagent_label) + _reagent_label = primary_reagent.name if(_reagent_label) setLabel(_reagent_label) /obj/item/chems/chem_disp_cartridge/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - . += "It has a capacity of [reagents?.maximum_volume || 0] unit\s." - if(reagents?.total_volume <= 0) + . += "It has a capacity of [REAGENT_MAXIMUM_VOLUME(reagents)] unit\s." + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) . += "It is empty." else - . += "It contains [reagents?.total_volume || 0] unit\s of reagents." + . += "It contains [REAGENT_TOTAL_VOLUME(reagents)] unit\s of reagents." if(!ATOM_IS_OPEN_CONTAINER(src)) . += "The cap is sealed." @@ -72,8 +73,9 @@ if(user.check_intent(I_FLAG_HARM)) if(standard_splash_mob(user,target)) return TRUE - if(reagents && reagents.total_volume) + var/total_vol = REAGENT_TOTAL_VOLUME(reagents) + if(reagents && total_vol) to_chat(user, SPAN_DANGER("You splash the contents of \the [src] onto \the [target].")) - reagents.splash(target, reagents.total_volume) //FIXME: probably shouldn't throw the whole 500 units at the mob, since the bottle neck is a bottle neck. + reagents.splash(target, total_vol) //FIXME: probably shouldn't throw the whole 500 units at the mob, since the bottle neck is a bottle neck. return TRUE return ..() diff --git a/code/modules/reagents/dispenser/cartridge_presets.dm b/code/modules/reagents/dispenser/cartridge_presets.dm index 553e42ba766f..bb0cf4c89422 100644 --- a/code/modules/reagents/dispenser/cartridge_presets.dm +++ b/code/modules/reagents/dispenser/cartridge_presets.dm @@ -9,7 +9,7 @@ * CART_TYPE: the type suffix to append to the cartridge type path. * REAGENT_TYPE: The reagent decl path to fill the cartridge with. */ -#define DEFINE_CARTRIDGE_FOR_CHEM(CART_TYPE, REAGENT_TYPE) /obj/item/chems/chem_disp_cartridge/##CART_TYPE/populate_reagents(){add_to_reagents(REAGENT_TYPE, reagents.maximum_volume);} +#define DEFINE_CARTRIDGE_FOR_CHEM(CART_TYPE, REAGENT_TYPE) /obj/item/chems/chem_disp_cartridge/##CART_TYPE/populate_reagents(){add_to_reagents(REAGENT_TYPE, REAGENT_MAXIMUM_VOLUME(reagents));} // Multiple DEFINE_CARTRIDGE_FOR_CHEM(water, /decl/material/liquid/water) diff --git a/code/modules/reagents/dispenser/cartridge_spawn.dm b/code/modules/reagents/dispenser/cartridge_spawn.dm index 50b6f7e7454d..d601f2ae2dd6 100644 --- a/code/modules/reagents/dispenser/cartridge_spawn.dm +++ b/code/modules/reagents/dispenser/cartridge_spawn.dm @@ -8,7 +8,7 @@ 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.reagents?.maximum_volume) + cartridge.add_to_reagents(reagent_type, REAGENT_MAXIMUM_VOLUME(cartridge.reagents)) 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 2c6882d9e60f..3ad90fe93db7 100644 --- a/code/modules/reagents/dispenser/dispenser2.dm +++ b/code/modules/reagents/dispenser/dispenser2.dm @@ -146,14 +146,15 @@ data["isBeakerLoaded"] = container ? 1 : 0 data["glass"] = accept_drinking var beakerD[0] - if(LAZYLEN(container?.reagents?.reagent_volumes)) - for(var/decl/material/reagent as anything in container.reagents.reagent_volumes) + var/beaker_volumes = REAGENT_VOLUMES(container?.reagents) + if(LAZYLEN(beaker_volumes)) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(container.reagents)) 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. - data["beakerCurrentVolume"] = container.reagents?.total_volume || 0 - data["beakerMaxVolume"] = container.reagents?.maximum_volume || 0 + data["beakerCurrentVolume"] = REAGENT_TOTAL_VOLUME(container.reagents) + data["beakerMaxVolume"] = REAGENT_MAXIMUM_VOLUME(container.reagents) else data["beakerCurrentVolume"] = null data["beakerMaxVolume"] = null @@ -161,7 +162,7 @@ var chemicals[0] for(var/label in cartridges) var/obj/item/chems/chem_disp_cartridge/C = cartridges[label] - chemicals[++chemicals.len] = list("label" = label, "amount" = C.reagents.total_volume) + chemicals[++chemicals.len] = list("label" = label, "amount" = REAGENT_TOTAL_VOLUME(C.reagents)) data["chemicals"] = chemicals // update the ui if it exists, returns null if no ui is passed/found diff --git a/code/modules/reagents/reactions/_reaction.dm b/code/modules/reagents/reactions/_reaction.dm index 3a4b41044b5c..7a89aba6dd4c 100644 --- a/code/modules/reagents/reactions/_reaction.dm +++ b/code/modules/reagents/reactions/_reaction.dm @@ -52,7 +52,7 @@ /decl/chemical_reaction/proc/process(var/datum/reagents/holder, var/limit) var/data = send_data(holder) - var/reaction_volume = holder.maximum_volume + var/reaction_volume = REAGENT_GET_MAX_VOL(holder) for(var/reactant in required_reagents) var/A = CHEMS_QUANTIZE(REAGENT_VOLUME(holder, reactant) / required_reagents[reactant] / limit) // How much of this reagent we are allowed to use if(reaction_volume > A) diff --git a/code/modules/reagents/reactions/reaction_grenade_reaction.dm b/code/modules/reagents/reactions/reaction_grenade_reaction.dm index 4483f376e33b..6c55a14c4c4f 100644 --- a/code/modules/reagents/reactions/reaction_grenade_reaction.dm +++ b/code/modules/reagents/reactions/reaction_grenade_reaction.dm @@ -132,16 +132,15 @@ /decl/chemical_reaction/grenade_reaction/metalfoam/on_reaction(datum/reagents/holder, created_volume, list/reaction_data) ..() var/atom/location = holder.get_reaction_loc(chemical_reaction_flags) - if(location) - if(istype(location, /obj/item/sealant_tank) && location.reagents?.maximum_volume) - location.reagents.add_reagent(/decl/material/liquid/foam, created_volume) - return - location = get_turf(location) - if(location) - location.visible_message(SPAN_WARNING("The solution spews out a metallic foam!"), range = 5) - var/datum/effect/effect/system/foam_spread/s = new() - s.set_up(created_volume, location, holder, 1) - s.start() + // This will overflow the container if it's open and create it in the turf + if(isturf(location)) + location.visible_message(SPAN_WARNING("The solution spews out a metallic foam!"), range = 5) + var/datum/effect/effect/system/foam_spread/s = new() + s.set_up(created_volume, location, holder, 1) + s.start() + // We failed to overflow the container, try to add it as a reagent + else if(location && REAGENT_MAXIMUM_VOLUME(location.reagents)) + location.reagents.add_reagent(/decl/material/liquid/foam, created_volume) /decl/chemical_reaction/grenade_reaction/ironfoam name = "Iron Foam" @@ -152,9 +151,13 @@ /decl/chemical_reaction/grenade_reaction/ironfoam/on_reaction(datum/reagents/holder, created_volume, list/reaction_data) ..() - var/turf/location = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) - if(location) + var/atom/location = holder.get_reaction_loc(chemical_reaction_flags) + // This will overflow the container if it's open and create it in the turf + if(isturf(location)) location.visible_message(SPAN_WARNING("The solution spews out a metallic foam!"), range = 5) var/datum/effect/effect/system/foam_spread/s = new() s.set_up(created_volume, location, holder, 2) s.start() + // We failed to overflow the container, try to add it as a reagent + else if(location && REAGENT_MAXIMUM_VOLUME(location.reagents)) + location.reagents.add_reagent(/decl/material/liquid/foam, created_volume) \ No newline at end of file diff --git a/code/modules/reagents/reactions/reaction_recipe_food.dm b/code/modules/reagents/reactions/reaction_recipe_food.dm index 0ece0daefd2a..29f4e8824b35 100644 --- a/code/modules/reagents/reactions/reaction_recipe_food.dm +++ b/code/modules/reagents/reactions/reaction_recipe_food.dm @@ -33,7 +33,7 @@ /decl/chemical_reaction/recipe/food/dairy/send_data(var/datum/reagents/holder, var/reaction_limit) . = ..() for(var/reagent in required_reagents) - var/list/data = LAZYACCESS(holder.reagent_data, reagent) + var/list/data = REAGENT_DATA(holder, reagent) if(!islist(data)) continue for(var/milk_key in milk_data_keys) diff --git a/code/modules/reagents/reactions/reaction_synthesis.dm b/code/modules/reagents/reactions/reaction_synthesis.dm index fcbe27b4dfb5..59458d2f0d39 100644 --- a/code/modules/reagents/reactions/reaction_synthesis.dm +++ b/code/modules/reagents/reactions/reaction_synthesis.dm @@ -37,10 +37,11 @@ ) // Interferes with resin globules. /decl/chemical_reaction/synthesis/crystalization/can_happen(datum/reagents/holder) - . = ..() && length(holder.reagent_volumes) > 1 + var/holder_volumes = REAGENT_VOLUMES(holder) + . = ..() && length(holder_volumes) > 1 if(.) . = FALSE - for(var/decl/material/reagent as anything in holder.reagent_volumes) + for(var/decl/material/reagent as anything in holder_volumes) if(reagent.type != /decl/material/liquid/crystal_agent && REAGENT_VOLUME(holder, reagent) >= REAGENT_UNITS_PER_MATERIAL_SHEET) return TRUE @@ -48,7 +49,7 @@ var/location = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) if(location) var/list/removing_reagents = list() - for(var/decl/material/reagent as anything in holder.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(holder)) if(reagent.type != /decl/material/liquid/crystal_agent) var/solidifying = floor(REAGENT_VOLUME(holder, reagent) / REAGENT_UNITS_PER_MATERIAL_SHEET) if(solidifying) @@ -67,10 +68,11 @@ inhibitors = list(/decl/material/liquid/crystal_agent) /decl/chemical_reaction/synthesis/aerogel/can_happen(datum/reagents/holder) - . = ..() && length(holder.reagent_volumes) > 1 + var/holder_volumes = REAGENT_VOLUMES(holder) + . = ..() && length(holder_volumes) > 1 if(.) . = FALSE - for(var/decl/material/reagent as anything in holder.reagent_volumes) + for(var/decl/material/reagent as anything in holder_volumes) if(REAGENT_VOLUME(holder, reagent) < REAGENT_UNITS_PER_MATERIAL_SHEET) continue if(reagent.default_solid_form != /obj/item/stack/material/aerogel) @@ -81,7 +83,7 @@ var/location = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) if(location) var/list/removing_reagents = list() - for(var/decl/material/reagent as anything in holder.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(holder)) if(reagent.default_solid_form == /obj/item/stack/material/aerogel) var/solidifying = floor(REAGENT_VOLUME(holder, reagent) / REAGENT_UNITS_PER_MATERIAL_SHEET) if(solidifying) diff --git a/code/modules/reagents/reagent_container_edibility.dm b/code/modules/reagents/reagent_container_edibility.dm index f052809413c6..83d485d0c13f 100644 --- a/code/modules/reagents/reagent_container_edibility.dm +++ b/code/modules/reagents/reagent_container_edibility.dm @@ -1,5 +1,5 @@ /obj/item/chems/get_edible_material_amount(var/mob/eater) - return ATOM_IS_OPEN_CONTAINER(src) && reagents?.total_volume + return ATOM_IS_OPEN_CONTAINER(src) && REAGENT_TOTAL_VOLUME(reagents) /obj/item/chems/get_food_default_transfer_amount(mob/eater) return eater?.get_eaten_transfer_amount(amount_per_transfer_from_this) diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 639b4a2b87fe..89c9ecc84b34 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -99,16 +99,16 @@ // Skimming off cream, repurposed from crucibles. // TODO: potentially make this an alt interaction and unify with slag skimming. - if(istype(used_item, /obj/item/chems) && ATOM_IS_OPEN_CONTAINER(used_item) && used_item.reagents?.maximum_volume && reagents?.total_volume && length(reagents.reagent_volumes) > 1) + if(istype(used_item, /obj/item/chems) && ATOM_IS_OPEN_CONTAINER(used_item) && REAGENT_MAXIMUM_VOLUME(used_item.reagents) && REAGENT_TOTAL_VOLUME(reagents) && length(REAGENT_VOLUMES(reagents)) > 1) var/list/skimmable_reagents = reagents.get_skimmable_reagents() if(length(skimmable_reagents)) var/removing = min(amount_per_transfer_from_this, REAGENTS_FREE_SPACE(used_item.reagents)) if(removing <= 0) to_chat(user, SPAN_WARNING("\The [used_item] is full.")) else - var/old_amt = used_item.reagents.total_volume - reagents.trans_to_holder(used_item.reagents, removing, skip_reagents = (reagents.reagent_volumes - skimmable_reagents)) - to_chat(user, SPAN_NOTICE("You skim [used_item.reagents.total_volume-old_amt] unit\s of [used_item.reagents.get_primary_reagent_name()] from the top of \the [reagents.get_primary_reagent_name()].")) + var/old_amt = REAGENT_TOTAL_VOLUME(used_item.reagents) + reagents.trans_to_holder(used_item.reagents, removing, skip_reagents = (REAGENT_VOLUMES(reagents) - skimmable_reagents)) + to_chat(user, SPAN_NOTICE("You skim [REAGENT_TOTAL_VOLUME(used_item.reagents)-old_amt] unit\s of [used_item.reagents.get_primary_reagent_name()] from the top of \the [reagents.get_primary_reagent_name()].")) return TRUE if(used_item.user_can_attack_with(user, silent = TRUE)) @@ -147,7 +147,7 @@ /obj/item/chems/shatter(consumed) //Skip splashing if we are in nullspace, since splash isn't null guarded if(loc) - reagents.splash(get_turf(src), reagents.total_volume) + reagents.splash(get_turf(src), REAGENT_TOTAL_VOLUME(reagents)) . = ..() /obj/item/chems/proc/set_detail_color(var/new_color) @@ -161,17 +161,17 @@ . = ..() - if(QDELETED(src) || !reagents?.total_volume || !ATOM_IS_OPEN_CONTAINER(src) || !isatom(loc)) + if(QDELETED(src) || !REAGENT_TOTAL_VOLUME(reagents) || !ATOM_IS_OPEN_CONTAINER(src) || !isatom(loc)) return // Vaporize anything over its boiling point. var/update_reagents = FALSE var/datum/gas_mixture/environment = loc?.return_air() var/ambient_pressure = environment ? environment.return_pressure() : ONE_ATMOSPHERE - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.can_boil_to_gas && reagent.phase_at_temperature(temperature, ambient_pressure) == MAT_PHASE_GAS) // TODO: reduce atom temperature? - var/removing = min(reagent.boil_evaporation_per_run, reagents.reagent_volumes[reagent]) + var/removing = min(reagent.boil_evaporation_per_run, REAGENT_VOLUME(reagents, reagent)) reagents.remove_reagent(reagent, removing, defer_update = TRUE, removed_phases = MAT_PHASE_LIQUID) update_reagents = TRUE loc.take_vaporized_reagent(reagent, removing) @@ -179,7 +179,7 @@ reagents.update_total() /obj/item/chems/take_vaporized_reagent(reagent, amount) - if(!reagents?.maximum_volume) + if(!REAGENT_MAXIMUM_VOLUME(reagents)) return ..() var/take_reagent = min(amount, REAGENTS_FREE_SPACE(reagents)) if(take_reagent > 0) @@ -228,4 +228,4 @@ var/turf/T = get_turf(user) if(T) to_chat(user, SPAN_NOTICE("You empty \the [target] onto the floor.")) - target.reagents.trans_to(T, target.reagents.total_volume) + target.reagents.trans_to(T, REAGENT_TOTAL_VOLUME(target.reagents)) diff --git a/code/modules/reagents/reagent_containers/_glass.dm b/code/modules/reagents/reagent_containers/_glass.dm index 8fd812e2cc78..dde3d1891c02 100644 --- a/code/modules/reagents/reagent_containers/_glass.dm +++ b/code/modules/reagents/reagent_containers/_glass.dm @@ -47,8 +47,8 @@ . = ..() if(distance > 2) return - if(reagents?.total_volume) - . += SPAN_NOTICE("It contains [reagents.total_volume] units of reagents.") + if(REAGENT_TOTAL_VOLUME(reagents)) + . += SPAN_NOTICE("It contains [REAGENT_TOTAL_VOLUME(reagents)] units of reagents.") else . += SPAN_NOTICE("It is empty.") if(!ATOM_IS_OPEN_CONTAINER(src)) @@ -58,7 +58,7 @@ return TRUE /obj/item/chems/glass/proc/should_drink_from(mob/drinker) - . = reagents?.total_volume > 0 + . = REAGENT_TOTAL_VOLUME(reagents) > 0 if(.) var/decl/material/drinking = reagents.get_primary_reagent_decl() return drinking ? !drinking.is_unsafe_to_drink(drinker) : FALSE @@ -125,22 +125,23 @@ var/global/list/lid_check_glass_types = list() return TRUE if(handle_eaten_by_mob(user, target) != EATEN_INVALID) return TRUE + var/total_vol = REAGENT_TOTAL_VOLUME(reagents) if(user.check_intent(I_FLAG_HARM)) if(standard_splash_mob(user,target)) return TRUE - if(reagents && reagents.total_volume) + if(reagents && total_vol) to_chat(user, SPAN_DANGER("You splash the contents of \the [src] onto \the [target].")) - reagents.splash(target, reagents.total_volume) + reagents.splash(target, total_vol) return TRUE - else if(reagents && reagents.total_volume) + else if(reagents && total_vol) to_chat(user, SPAN_NOTICE("You splash a small amount of the contents of \the [src] onto \the [target].")) - reagents.splash(target, min(reagents.total_volume, 5)) + reagents.splash(target, min(total_vol, 5)) return TRUE . = ..() // Drinking out of bowls. /obj/item/chems/glass/get_edible_material_amount(mob/eater) - return reagents?.total_volume + return REAGENT_TOTAL_VOLUME(reagents) /obj/item/chems/glass/get_utensil_food_type() return /obj/item/food/lump @@ -157,11 +158,11 @@ var/global/list/lid_check_glass_types = list() if(utensil.loaded_food) to_chat(user, SPAN_WARNING("You already have something on \the [utensil].")) return TRUE - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_WARNING("\The [src] is empty.")) return TRUE separate_food_chunk(utensil, user) - if(utensil.loaded_food?.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(utensil.loaded_food?.reagents)) to_chat(user, SPAN_NOTICE("You scoop up some of \the [utensil.loaded_food.reagents.get_primary_reagent_name()] with \the [utensil].")) return TRUE @@ -169,7 +170,7 @@ var/global/list/lid_check_glass_types = list() /obj/item/chems/glass/get_alt_interactions(mob/user) . = ..() - if(reagents?.total_volume >= FLUID_PUDDLE) + if(REAGENT_TOTAL_VOLUME(reagents) >= FLUID_PUDDLE) LAZYADD(., /decl/interaction_handler/dip_item) LAZYADD(., /decl/interaction_handler/fill_from) if(user?.get_active_held_item()) diff --git a/code/modules/reagents/reagent_containers/beaker.dm b/code/modules/reagents/reagent_containers/beaker.dm index f8f844a21c0e..5df1a2aaf168 100644 --- a/code/modules/reagents/reagent_containers/beaker.dm +++ b/code/modules/reagents/reagent_containers/beaker.dm @@ -15,7 +15,7 @@ /obj/item/chems/glass/beaker/get_examine_strings(mob/user, distance, infix, suffix) . = ..() - . += "It can hold up to [reagents?.maximum_volume] units." + . += "It can hold up to [REAGENT_MAXIMUM_VOLUME(reagents)] units." /obj/item/chems/glass/beaker/on_picked_up(mob/user, atom/old_loc) . = ..() @@ -31,9 +31,9 @@ /obj/item/chems/glass/beaker/update_overlays() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) var/image/filling = mutable_appearance(icon, "[icon_state]1", reagents.get_color()) - var/percent = round((reagents.total_volume / reagents.maximum_volume) * 100) + var/percent = round((REAGENT_TOTAL_VOLUME(reagents) / REAGENT_MAXIMUM_VOLUME(reagents)) * 100) switch(percent) if(0 to 9) filling.icon_state = "[icon_state]1" if(10 to 24) filling.icon_state = "[icon_state]10" @@ -60,7 +60,7 @@ /obj/item/chems/glass/beaker/throw_impact(atom/hit_atom) . = ..() if(ATOM_IS_OPEN_CONTAINER(src)) - reagents.splash(hit_atom, rand(reagents.total_volume*0.25,reagents.total_volume), min_spill = 60, max_spill = 100) + reagents.splash(hit_atom, rand(REAGENT_TOTAL_VOLUME(reagents)*0.25,REAGENT_TOTAL_VOLUME(reagents)), min_spill = 60, max_spill = 100) take_damage(rand(4,8)) /obj/item/chems/glass/beaker/large @@ -181,4 +181,4 @@ chem_volume = 120 /obj/item/chems/glass/beaker/sulfuric/populate_reagents() - add_to_reagents(/decl/material/liquid/acid, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/acid, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 4368f1486288..593d6e37a74e 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -27,14 +27,14 @@ /obj/item/chems/ivbag/on_reagent_change() if(!(. = ..())) return - if(reagents?.total_volume > reagents?.maximum_volume / 2) + if(REAGENT_TOTAL_VOLUME(reagents) > REAGENT_MAXIMUM_VOLUME(reagents) / 2) w_class = ITEM_SIZE_NORMAL else w_class = ITEM_SIZE_SMALL /obj/item/chems/ivbag/on_update_icon() . = ..() - var/percent = round(reagents?.total_volume / reagents?.maximum_volume * 100) + var/percent = round(REAGENT_TOTAL_VOLUME(reagents) / REAGENT_MAXIMUM_VOLUME(reagents) * 100) if(percent) add_overlay(overlay_image(icon, "[round(percent,25)]", reagents.get_color())) add_overlay(attached? "dongle" : "top") @@ -68,7 +68,7 @@ if(!(src in M.get_held_items())) return - if(!reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) return reagents.trans_to_mob(attached, amount_per_transfer_from_this, CHEM_INJECT) @@ -88,7 +88,7 @@ /obj/item/chems/ivbag/blood/populate_reagents() if(blood_fill_type) - add_to_reagents(blood_fill_type, reagents.maximum_volume, get_initial_blood_data()) + add_to_reagents(blood_fill_type, REAGENT_MAXIMUM_VOLUME(reagents), get_initial_blood_data()) /obj/item/chems/ivbag/blood/nanoblood label_text = "synthetic" diff --git a/code/modules/reagents/reagent_containers/borghypo.dm b/code/modules/reagents/reagent_containers/borghypo.dm index 468176dbde93..a84c183b2bd2 100644 --- a/code/modules/reagents/reagent_containers/borghypo.dm +++ b/code/modules/reagents/reagent_containers/borghypo.dm @@ -44,7 +44,7 @@ . = ..() var/list/reagent_ids = get_generated_reagents() for(var/decl/material/reagent in decls_repository.get_decls_unassociated(reagent_ids)) - reagents.add_reagent(reagent.type, round(reagents.maximum_volume / length(reagent_ids))) + reagents.add_reagent(reagent.type, round(REAGENT_MAXIMUM_VOLUME(reagents) / length(reagent_ids))) START_PROCESSING(SSobj, src) /obj/item/chems/borghypo/Destroy() @@ -61,7 +61,7 @@ if(!robot?.cell) return var/list/reagent_ids = get_generated_reagents() - var/max_per_reagent = round(reagents.maximum_volume / length(reagent_ids)) + var/max_per_reagent = round(REAGENT_MAXIMUM_VOLUME(reagents) / length(reagent_ids)) for(var/reagent in reagent_ids) var/has_reagent = REAGENT_VOLUME(reagents, GET_DECL(reagent)) if(has_reagent < max_per_reagent) @@ -128,7 +128,7 @@ return var/list/reagent_ids = get_generated_reagents() var/decl/material/reagent = GET_DECL(reagent_ids[mode]) - . += SPAN_NOTICE("It is currently producing [reagent.use_name] and has [REAGENT_VOLUME(reagents, reagent)] out of [round(reagents.maximum_volume / length(reagent_ids))] units left.") + . += SPAN_NOTICE("It is currently producing [reagent.use_name] and has [REAGENT_VOLUME(reagents, reagent)] out of [round(REAGENT_MAXIMUM_VOLUME(reagents) / length(reagent_ids))] units left.") /obj/item/chems/borghypo/service name = "cyborg drink synthesizer" diff --git a/code/modules/reagents/reagent_containers/bowl.dm b/code/modules/reagents/reagent_containers/bowl.dm index c7ad55d990e6..41dd9943d960 100644 --- a/code/modules/reagents/reagent_containers/bowl.dm +++ b/code/modules/reagents/reagent_containers/bowl.dm @@ -155,18 +155,18 @@ add_to_reagents(filling, fillings[filling]) /obj/item/chems/glass/bowl/mystery/update_name() - if(!drained && reagents?.total_volume) + if(!drained && REAGENT_TOTAL_VOLUME(reagents)) SetName("mystery soup") else ..() /obj/item/chems/glass/bowl/mystery/on_reagent_change() - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) drained = TRUE . = ..() /obj/item/chems/glass/bowl/mystery/update_container_desc() - if(!drained && reagents?.total_volume) + if(!drained && REAGENT_TOTAL_VOLUME(reagents)) desc = "The mystery is, why aren't you eating it?" else ..() diff --git a/code/modules/reagents/reagent_containers/bucket.dm b/code/modules/reagents/reagent_containers/bucket.dm index 2f950c3dd9af..228bfb78d19e 100644 --- a/code/modules/reagents/reagent_containers/bucket.dm +++ b/code/modules/reagents/reagent_containers/bucket.dm @@ -30,7 +30,7 @@ /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) + if(REAGENT_TOTAL_VOLUME(reagents) < 1) to_chat(user, SPAN_WARNING("\The [src] is empty!")) else if(REAGENTS_FREE_SPACE(used_item.reagents) >= 5) reagents.trans_to_obj(used_item, 5) @@ -44,7 +44,7 @@ /obj/item/chems/glass/bucket/get_reagents_overlay(state_prefix) if(!ATOM_IS_OPEN_CONTAINER(src)) return null // no overlay while closed! - if(!reagents || (reagents.total_volume / reagents.maximum_volume) < 0.8) + if(!reagents || (REAGENT_TOTAL_VOLUME(reagents) / REAGENT_MAXIMUM_VOLUME(reagents)) < 0.8) return null // must be at least 80% full to show return ..() diff --git a/code/modules/reagents/reagent_containers/condiments/__condiment.dm b/code/modules/reagents/reagent_containers/condiments/__condiment.dm index 18fe2ee33785..bd3c1e2666d8 100644 --- a/code/modules/reagents/reagent_containers/condiments/__condiment.dm +++ b/code/modules/reagents/reagent_containers/condiments/__condiment.dm @@ -17,7 +17,7 @@ . = ..() var/decl/condiment_appearance/condiment = GET_DECL(initial_condiment_type) if(condiment?.condiment_type) - add_to_reagents(condiment.condiment_type, reagents.maximum_volume) + add_to_reagents(condiment.condiment_type, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/condiment/attackby(var/obj/item/used_item, var/mob/user) if(IS_PEN(used_item)) @@ -51,7 +51,8 @@ /obj/item/chems/condiment/proc/get_current_condiment_appearance() if(!morphic_container) return GET_DECL(initial_condiment_type) - switch(LAZYLEN(reagents?.reagent_volumes)) + var/reagent_volumes = REAGENT_VOLUMES(reagents) + switch(LAZYLEN(reagent_volumes)) if(0) return GET_DECL(/decl/condiment_appearance/empty) if(1) diff --git a/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm b/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm index 5be3c085609c..e82429d67e9d 100644 --- a/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm +++ b/code/modules/reagents/reagent_containers/drinkingglass/drinkingglass.dm @@ -46,38 +46,41 @@ var/global/const/DRINK_ICON_NOISY = "noise" . /= HOLLOW_OBJECT_MATTER_MULTIPLIER /obj/item/chems/drinks/glass2/proc/has_ice() - if(LAZYLEN(reagents.reagent_volumes)) + var/reagent_volumes = REAGENT_VOLUMES(reagents) + if(LAZYLEN(reagent_volumes)) var/decl/material/R = reagents.get_primary_reagent_decl() if(!((R.type == /decl/material/solid/ice) || ("ice" in R.glass_special))) // if it's not a cup of ice, and it's not already supposed to have ice in, see if the bartender's put ice in it - if(reagents.has_reagent(/decl/material/solid/ice, reagents.total_volume / 10)) // 10% ice by volume + if(reagents.has_reagent(/decl/material/solid/ice, REAGENT_TOTAL_VOLUME(reagents) / 10)) // 10% ice by volume return 1 return 0 /obj/item/chems/drinks/glass2/proc/has_fizz() - if(LAZYLEN(reagents.reagent_volumes)) + var/reagent_volumes = REAGENT_VOLUMES(reagents) + if(LAZYLEN(reagent_volumes)) var/decl/material/primary_reagent = reagents.get_primary_reagent_decl() if(("fizz" in primary_reagent.glass_special)) return 1 var/totalfizzy = 0 - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if("fizz" in reagent.glass_special) totalfizzy += REAGENT_VOLUME(reagents, reagent) - if(totalfizzy >= reagents.total_volume / 5) // 20% fizzy by volume + if(totalfizzy >= REAGENT_TOTAL_VOLUME(reagents) / 5) // 20% fizzy by volume return 1 return 0 /obj/item/chems/drinks/glass2/proc/has_vapor() - if(LAZYLEN(reagents.reagent_volumes) > 0) + var/reagent_volumes = REAGENT_VOLUMES(reagents) + if(LAZYLEN(reagent_volumes) > 0) if(temperature > T0C + 40) return 1 var/decl/material/primary_reagent = reagents.get_primary_reagent_decl() if(!("vapor" in primary_reagent.glass_special)) var/totalvape = 0 - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if("vapor" in reagent.glass_special) totalvape += REAGENT_VOLUME(reagents, reagent) - if(totalvape >= reagents.maximum_volume * 0.6) // 60% vapor by container volume + if(totalvape >= REAGENT_MAXIMUM_VOLUME(reagents) * 0.6) // 60% vapor by container volume return 1 return 0 @@ -134,7 +137,8 @@ var/global/const/DRINK_ICON_NOISY = "noise" underlays.Cut() icon_state = base_icon - if (LAZYLEN(reagents?.reagent_volumes) > 0) + var/reagent_volumes = REAGENT_VOLUMES(reagents) + if (LAZYLEN(reagent_volumes) > 0) var/decl/material/R = reagents.get_primary_reagent_decl() if(R.cocktail_ingredient) for(var/decl/cocktail/cocktail in SSmaterials.get_cocktails_by_primary_ingredient(R.type)) @@ -204,7 +208,7 @@ var/global/const/DRINK_ICON_NOISY = "noise" playsound(src, "shatter", 30, 1) if(reagents) user.visible_message("The contents of \the [src] splash all over [user]!") - reagents.splash(user, reagents.total_volume) + reagents.splash(user, REAGENT_TOTAL_VOLUME(reagents)) qdel(src) return TRUE user.visible_message("[user] gently strikes \the [src] with a spoon, calling the room to attention.") @@ -220,7 +224,7 @@ var/global/const/DRINK_ICON_NOISY = "noise" update_icon() /obj/item/chems/drinks/glass2/physically_destroyed(var/skip_qdel) - reagents.splash(loc, reagents.total_volume) + reagents.splash(loc, REAGENT_TOTAL_VOLUME(reagents)) if(istype(material)) playsound(src, "shatter", 30, 1) material.place_shards(get_turf(src), w_class) diff --git a/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm b/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm index 79a18bcae309..2691cea39a9c 100644 --- a/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm +++ b/code/modules/reagents/reagent_containers/drinkingglass/glass_types.dm @@ -160,7 +160,7 @@ base_name = "#1 monkey cup" /obj/item/chems/drinks/glass2/coffeecup/punitelli/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/banana, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/banana, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/glass2/coffeecup/rainbow name = "rainbow coffee cup" diff --git a/code/modules/reagents/reagent_containers/drinks.dm b/code/modules/reagents/reagent_containers/drinks.dm index acf8e61b283e..852d1ee3c400 100644 --- a/code/modules/reagents/reagent_containers/drinks.dm +++ b/code/modules/reagents/reagent_containers/drinks.dm @@ -67,29 +67,30 @@ . = ..() if(distance > 1) return - if(!reagents || reagents.total_volume == 0) + var/total_volume = REAGENT_TOTAL_VOLUME(reagents) + var/max_volume = REAGENT_MAXIMUM_VOLUME(reagents) + if(total_volume <= 0) . += SPAN_NOTICE("\The [src] is empty!") - else if (reagents.total_volume <= reagents.maximum_volume * 0.25) + else if (total_volume <= max_volume * 0.25) . += SPAN_NOTICE("\The [src] is almost empty!") - else if (reagents.total_volume <= reagents.maximum_volume * 0.66) + else if (total_volume <= max_volume * 0.66) . += SPAN_NOTICE("\The [src] is half full!") - else if (reagents.total_volume <= reagents.maximum_volume * 0.90) + else if (total_volume <= max_volume * 0.90) . += SPAN_NOTICE("\The [src] is almost full!") else . += SPAN_NOTICE("\The [src] is full!") /obj/item/chems/drinks/proc/get_filling_state() - var/percent = round((reagents.total_volume / reagents.maximum_volume) * 100) + var/percent = round((REAGENT_TOTAL_VOLUME(reagents) / REAGENT_MAXIMUM_VOLUME(reagents)) * 100) for(var/k in cached_json_decode(filling_states)) if(percent <= k) return k /obj/item/chems/drinks/on_update_icon() . = ..() - if(LAZYLEN(reagents?.reagent_volumes) && filling_states) + if(REAGENT_TOTAL_VOLUME(reagents) && filling_states) add_overlay(overlay_image(icon, "[base_icon][get_filling_state()]", reagents.get_color())) - //////////////////////////////////////////////////////////////////////////////// /// Drinks. END //////////////////////////////////////////////////////////////////////////////// @@ -120,7 +121,7 @@ center_of_mass = @'{"x":16,"y":9}' /obj/item/chems/drinks/milk/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/milk, reagents.maximum_volume, data = list(DATA_MILK_DONOR = "cow")) + add_to_reagents(/decl/material/liquid/drink/milk, REAGENT_MAXIMUM_VOLUME(reagents), data = list(DATA_MILK_DONOR = "cow")) /obj/item/chems/drinks/soymilk name = "soymilk carton" @@ -130,7 +131,7 @@ center_of_mass = @'{"x":16,"y":9}' /obj/item/chems/drinks/soymilk/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/milk/soymilk, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/milk/soymilk, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/milk/smallcarton name = "small milk carton" @@ -138,14 +139,14 @@ icon_state = "mini-milk" /obj/item/chems/drinks/milk/smallcarton/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/milk, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/milk, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/milk/smallcarton/chocolate name = "small chocolate milk carton" desc = "It's milk! This one is in delicious chocolate flavour." /obj/item/chems/drinks/milk/smallcarton/chocolate/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/milk/chocolate, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/milk/chocolate, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/coffee name = "cup of coffee" @@ -154,7 +155,7 @@ center_of_mass = @'{"x":15,"y":10}' /obj/item/chems/drinks/coffee/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/coffee, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/coffee, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/ice name = "cup of ice" @@ -163,7 +164,7 @@ center_of_mass = @'{"x":15,"y":10}' /obj/item/chems/drinks/ice/populate_reagents() - add_to_reagents(/decl/material/solid/ice, reagents.maximum_volume) + add_to_reagents(/decl/material/solid/ice, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/h_chocolate name = "cup of hot cocoa" @@ -173,7 +174,7 @@ center_of_mass = @'{"x":15,"y":13}' /obj/item/chems/drinks/h_chocolate/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/hot_coco, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/hot_coco, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/dry_ramen name = "cup ramen" @@ -183,7 +184,7 @@ center_of_mass = @'{"x":16,"y":11}' /obj/item/chems/drinks/dry_ramen/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/dry_ramen, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/dry_ramen, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/sillycup name = "paper cup" @@ -195,7 +196,7 @@ /obj/item/chems/drinks/sillycup/on_update_icon() . = ..() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) icon_state = "water_cup" else icon_state = "water_cup_e" @@ -283,19 +284,19 @@ desc = "A tall plastic cup of hot black tea." /obj/item/chems/drinks/tea/black/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/tea/black, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/tea/black, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/tea/green name = "cup of green tea" desc = "A tall plastic cup of hot green tea." /obj/item/chems/drinks/tea/green/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/tea/green, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/tea/green, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/tea/chai name = "cup of chai tea" desc = "A tall plastic cup of hot chai tea." /obj/item/chems/drinks/tea/chai/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/tea/chai, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/tea/chai, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/modules/reagents/reagent_containers/drinks/bottle.dm b/code/modules/reagents/reagent_containers/drinks/bottle.dm index f6a7161ed3c4..e0bd34a5b01e 100644 --- a/code/modules/reagents/reagent_containers/drinks/bottle.dm +++ b/code/modules/reagents/reagent_containers/drinks/bottle.dm @@ -55,9 +55,9 @@ // Dump reagents onto the turf. var/turf/T = against ? get_turf(against) : get_turf(newloc) - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) visible_message(SPAN_DANGER("The contents of \the [src] splash all over \the [against || T]!")) - reagents.splash(against || T, reagents.total_volume) + reagents.splash(against || T, REAGENT_TOTAL_VOLUME(reagents)) if(!T) qdel(src) return @@ -124,9 +124,9 @@ // bottle contents will be tainted by having the rag dipped // in it. if(rag && rag.reagents) - rag.reagents.trans_to(src, rag.reagents.total_volume) + rag.reagents.trans_to(src, REAGENT_TOTAL_VOLUME(rag.reagents)) if(reagents) - reagents.trans_to(rag, min(reagents.total_volume, rag.reagents.maximum_volume)) + reagents.trans_to(rag, min(REAGENT_TOTAL_VOLUME(reagents), REAGENT_MAXIMUM_VOLUME(rag.reagents))) rag.update_name() atom_flags &= ~ATOM_FLAG_OPEN_CONTAINER @@ -177,7 +177,7 @@ //The reagents in the bottle splash all over the target, thanks for the idea Nodrak if(reagents) user.visible_message(SPAN_NOTICE("The contents of \the [src] splash all over [target]!")) - reagents.splash(target, reagents.total_volume) + reagents.splash(target, REAGENT_TOTAL_VOLUME(reagents)) if(rag?.is_on_fire() && istype(target)) target.ignite_fire() @@ -250,7 +250,7 @@ center_of_mass = @'{"x":16,"y":4}' /obj/item/chems/drinks/bottle/gin/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/gin, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/gin, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/whiskey name = "Uncle Git's Special Reserve" @@ -259,7 +259,7 @@ center_of_mass = @'{"x":16,"y":3}' /obj/item/chems/drinks/bottle/whiskey/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/whiskey, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/whiskey, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/agedwhiskey name = "aged whiskey" @@ -268,7 +268,7 @@ center_of_mass = @'{"x":16,"y":3}' /obj/item/chems/drinks/bottle/agedwhiskey/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/aged_whiskey, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/aged_whiskey, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/vodka name = "Tunguska Triple Distilled" @@ -277,7 +277,7 @@ center_of_mass = @'{"x":17,"y":3}' /obj/item/chems/drinks/bottle/vodka/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/vodka, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/vodka, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/tequila name = "Caccavo Guaranteed Quality tequila" @@ -286,7 +286,7 @@ center_of_mass = @'{"x":16,"y":3}' /obj/item/chems/drinks/bottle/tequila/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/tequila, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/tequila, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/patron name = "Wrapp Artiste Patron" @@ -295,7 +295,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/patron/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/tequila, reagents.maximum_volume - 5) + add_to_reagents(/decl/material/liquid/alcohol/tequila, REAGENT_MAXIMUM_VOLUME(reagents) - 5) add_to_reagents(/decl/material/solid/metal/silver, 5) /obj/item/chems/drinks/bottle/rum @@ -305,7 +305,7 @@ center_of_mass = @'{"x":16,"y":8}' /obj/item/chems/drinks/bottle/rum/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/rum, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/rum, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/holywater name = "Flask of Holy Water" @@ -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(DATA_WATER_HOLINESS = TRUE)) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents), list(DATA_WATER_HOLINESS = TRUE)) /obj/item/chems/drinks/bottle/vermouth name = "Goldeneye Vermouth" @@ -323,7 +323,7 @@ center_of_mass = @'{"x":17,"y":3}' /obj/item/chems/drinks/bottle/vermouth/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/vermouth, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/vermouth, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/kahlua name = "Robert Robust's Coffee Liqueur" @@ -332,7 +332,7 @@ center_of_mass = @'{"x":17,"y":3}' /obj/item/chems/drinks/bottle/kahlua/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/coffee, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/coffee, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/goldschlager name = "College Girl Goldschlager" @@ -341,7 +341,7 @@ center_of_mass = @'{"x":15,"y":3}' /obj/item/chems/drinks/bottle/goldschlager/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/vodka, reagents.maximum_volume - 5) + add_to_reagents(/decl/material/liquid/alcohol/vodka, REAGENT_MAXIMUM_VOLUME(reagents) - 5) add_to_reagents(/decl/material/solid/metal/gold, 5) /obj/item/chems/drinks/bottle/cognac @@ -351,7 +351,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/cognac/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/cognac, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/cognac, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/wine name = "Doublebeard Bearded Special Wine" @@ -360,7 +360,7 @@ center_of_mass = @'{"x":16,"y":4}' /obj/item/chems/drinks/bottle/wine/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/wine, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/wine, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/absinthe name = "Jailbreaker Verte" @@ -369,7 +369,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/absinthe/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/absinthe, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/absinthe, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/melonliquor name = "Emeraldine Melon Liquor" @@ -378,7 +378,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/melonliquor/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/melonliquor, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/melonliquor, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/bluecuracao name = "Miss Blue Curacao" @@ -387,7 +387,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/bluecuracao/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/bluecuracao, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/bluecuracao, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/herbal name = "Liqueur d'Herbe" @@ -396,7 +396,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/herbal/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/herbal, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/herbal, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/grenadine name = "Briar Rose Grenadine Syrup" @@ -405,7 +405,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/grenadine/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/grenadine, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/grenadine, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/cola name = "\improper Space Cola" @@ -414,7 +414,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/cola/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/cola, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/cola, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/space_up name = "\improper Space-Up" @@ -423,7 +423,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/space_up/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/lemonade, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/lemonade, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/space_mountain_wind name = "\improper Space Mountain Wind" @@ -432,7 +432,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/space_mountain_wind/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/citrussoda, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/citrussoda, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/pwine name = "Warlock's Velvet" @@ -441,7 +441,7 @@ center_of_mass = @'{"x":16,"y":4}' /obj/item/chems/drinks/bottle/pwine/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/pwine, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/pwine, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/sake name = "Takeo Sadow's Combined Sake" @@ -450,7 +450,7 @@ center_of_mass = @'{"x":16,"y":4}' /obj/item/chems/drinks/bottle/sake/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/sake, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/sake, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/champagne @@ -462,7 +462,7 @@ var/opening /obj/item/chems/drinks/bottle/champagne/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/champagne, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/champagne, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/champagne/open(mob/user) if(ATOM_IS_OPEN_CONTAINER(src)) @@ -497,7 +497,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/bottle/jagermeister/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/jagermeister, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/jagermeister, REAGENT_MAXIMUM_VOLUME(reagents)) //////////////////////////PREMIUM ALCOHOL /////////////////////// /obj/item/chems/drinks/bottle/premiumvodka @@ -512,7 +512,7 @@ /obj/item/chems/drinks/bottle/premiumvodka/populate_reagents() make_random_name() - add_to_reagents(/decl/material/liquid/alcohol/vodka/premium, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/vodka/premium, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/premiumwine name = "Uve De Blanc" @@ -530,7 +530,7 @@ var/agedyear = rand(global.using_map.game_year - aged_max, global.using_map.game_year - aged_min) set_custom_name(make_random_name()) desc += " This bottle is marked as [agedyear] Vintage." - add_to_reagents(/decl/material/liquid/alcohol/wine/premium, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/wine/premium, REAGENT_MAXIMUM_VOLUME(reagents)) //////////////////////////JUICES AND STUFF /////////////////////// @@ -548,7 +548,7 @@ pickup_sound = 'sound/foley/paperpickup2.ogg' /obj/item/chems/drinks/bottle/orangejuice/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/orange, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/orange, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/cream name = "Milk Cream" @@ -564,7 +564,7 @@ pickup_sound = 'sound/foley/paperpickup2.ogg' /obj/item/chems/drinks/bottle/cream/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/milk/cream, reagents.maximum_volume, data = list(DATA_MILK_DONOR = "cow")) + add_to_reagents(/decl/material/liquid/drink/milk/cream, REAGENT_MAXIMUM_VOLUME(reagents), data = list(DATA_MILK_DONOR = "cow")) /obj/item/chems/drinks/bottle/tomatojuice name = "Tomato Juice" @@ -580,7 +580,7 @@ pickup_sound = 'sound/foley/paperpickup2.ogg' /obj/item/chems/drinks/bottle/tomatojuice/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/tomato, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/tomato, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/limejuice name = "Lime Juice" @@ -596,7 +596,7 @@ pickup_sound = 'sound/foley/paperpickup2.ogg' /obj/item/chems/drinks/bottle/limejuice/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/lime, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/lime, REAGENT_MAXIMUM_VOLUME(reagents)) //Small bottles /obj/item/chems/drinks/bottle/small @@ -613,7 +613,7 @@ center_of_mass = @'{"x":16,"y":12}' /obj/item/chems/drinks/bottle/small/beer/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/beer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/beer, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/small/ale name = "\improper Magm-Ale" @@ -623,7 +623,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/bottle/small/ale/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/ale, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/ale, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/bottle/small/gingerbeer name = "Ginger Beer" @@ -632,4 +632,4 @@ center_of_mass = @'{"x":16,"y":12}' /obj/item/chems/drinks/bottle/small/gingerbeer/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/gingerbeer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/gingerbeer, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/modules/reagents/reagent_containers/drinks/cans.dm b/code/modules/reagents/reagent_containers/drinks/cans.dm index c59761ee3e1e..88e6633f2d04 100644 --- a/code/modules/reagents/reagent_containers/drinks/cans.dm +++ b/code/modules/reagents/reagent_containers/drinks/cans.dm @@ -17,7 +17,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/cola/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/cola, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/cola, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/waterbottle name = "bottled water" @@ -27,7 +27,7 @@ material = /decl/material/solid/organic/plastic /obj/item/chems/drinks/cans/waterbottle/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/waterbottle/open(mob/user) playsound(loc,'sound/effects/bonebreak1.ogg', rand(10,50), 1) @@ -41,7 +41,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/space_mountain_wind/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/citrussoda, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/citrussoda, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/thirteenloko name = "\improper Thirteen Loko" @@ -50,7 +50,7 @@ center_of_mass = @'{"x":16,"y":8}' /obj/item/chems/drinks/cans/thirteenloko/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/thirteenloko, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/thirteenloko, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/dr_gibb name = "\improper Dr. Gibb" @@ -59,7 +59,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/dr_gibb/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/cherrycola, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/cherrycola, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/starkist name = "\improper Star-Kist" @@ -68,7 +68,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/starkist/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/orangecola, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/orangecola, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/space_up name = "\improper Space-Up" @@ -77,7 +77,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/space_up/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/lemonade, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/lemonade, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/lemon_lime name = "\improper Lemon-Lime" @@ -86,7 +86,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/lemon_lime/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/lemon_lime, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/lemon_lime, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/iced_tea name = "\improper Vrisk Serket Iced Tea" @@ -95,7 +95,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/iced_tea/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/tea/black, reagents.maximum_volume - 5) + add_to_reagents(/decl/material/liquid/drink/tea/black, REAGENT_MAXIMUM_VOLUME(reagents) - 5) add_to_reagents(/decl/material/solid/ice, 5) /obj/item/chems/drinks/cans/grape_juice @@ -105,7 +105,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/grape_juice/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/grape, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/grape, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/tonic name = "\improper T-Borg's Tonic Water" @@ -114,7 +114,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/tonic/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/tonic, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/tonic, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/sodawater name = "soda water" @@ -123,7 +123,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/sodawater/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/sodawater, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/sodawater, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/beastenergy name = "Beast Energy" @@ -132,7 +132,7 @@ center_of_mass = @'{"x":16,"y":6}' /obj/item/chems/drinks/cans/beastenergy/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/beastenergy, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/beastenergy, REAGENT_MAXIMUM_VOLUME(reagents)) //Items exclusive to the BODA machine on deck 4 and wherever else it pops up. First two are a bit jokey. Second two are genuine article. @@ -143,7 +143,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/syndicolax/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/potato, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/potato, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/artbru name = "\improper Arstotzka Bru" @@ -152,7 +152,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/artbru/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/turnip, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/turnip, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/syndicola name = "\improper TerraCola" @@ -161,7 +161,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/syndicola/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume - 5) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents) - 5) add_to_reagents(/decl/material/solid/metal/iron, 5) /obj/item/chems/drinks/glass2/square/boda @@ -170,7 +170,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/glass2/square/boda/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/sodawater, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/sodawater, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/glass2/square/bodaplus name = "tri kopeiki sirop boda" @@ -189,8 +189,9 @@ /decl/material/liquid/drink/juice/banana, /decl/material/liquid/drink/juice/berry, /decl/material/liquid/drink/juice/watermelon)) - add_to_reagents(/decl/material/liquid/drink/sodawater, reagents.maximum_volume / 2) - add_to_reagents(reag, reagents.maximum_volume / 2) + var/half_max_vol = REAGENT_MAXIMUM_VOLUME(reagents) / 2 + add_to_reagents(/decl/material/liquid/drink/sodawater, half_max_vol) + add_to_reagents(reag, half_max_vol) //Canned alcohols. @@ -202,7 +203,7 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/speer/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/beer/good, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/beer/good, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/cans/ale name = "\improper Magm-Ale" @@ -211,4 +212,4 @@ center_of_mass = @'{"x":16,"y":10}' /obj/item/chems/drinks/cans/ale/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/ale, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/ale, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/modules/reagents/reagent_containers/drinks/cocktailshaker.dm b/code/modules/reagents/reagent_containers/drinks/cocktailshaker.dm index 4b503ded567a..232146b1208c 100644 --- a/code/modules/reagents/reagent_containers/drinks/cocktailshaker.dm +++ b/code/modules/reagents/reagent_containers/drinks/cocktailshaker.dm @@ -19,14 +19,14 @@ return else user.visible_message(SPAN_NOTICE("\The [user] shakes \the [src] gingerly."), SPAN_NOTICE("You shake \the [src] gingerly.")) - if(prob(15) && (reagents && reagents.total_volume)) + if(prob(15) && (reagents && REAGENT_TOTAL_VOLUME(reagents))) user.visible_message(SPAN_WARNING("\The [user] spills the contents of \the [src] over themselves!"), SPAN_WARNING("You spill the contents of \the [src] over yourself!")) - reagents.splash(user, reagents.total_volume) + reagents.splash(user, REAGENT_TOTAL_VOLUME(reagents)) else mix() /obj/item/chems/drinks/shaker/proc/mix() - if(reagents && reagents.total_volume) + if(reagents && REAGENT_TOTAL_VOLUME(reagents)) atom_flags &= ~ATOM_FLAG_NO_REACT HANDLE_REACTIONS(reagents) addtimer(CALLBACK(src, PROC_REF(stop_react)), SSmaterials.wait) diff --git a/code/modules/reagents/reagent_containers/drinks/juicebox.dm b/code/modules/reagents/reagent_containers/drinks/juicebox.dm index cc01e61767ae..c18ff521f4b3 100644 --- a/code/modules/reagents/reagent_containers/drinks/juicebox.dm +++ b/code/modules/reagents/reagent_containers/drinks/juicebox.dm @@ -70,7 +70,7 @@ desc = "A small cardboard juicebox with a cartoon apple on it." /obj/item/chems/drinks/juicebox/apple/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/apple, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/apple, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/juicebox/apple/Initialize() . = ..() @@ -81,7 +81,7 @@ desc = "A small cardboard juicebox with a cartoon orange on it." /obj/item/chems/drinks/juicebox/orange/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/orange, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/orange, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/juicebox/orange/Initialize() . = ..() @@ -92,7 +92,7 @@ desc = "A small cardboard juicebox with some cartoon grapes on it." /obj/item/chems/drinks/juicebox/grape/populate_reagents() - add_to_reagents(/decl/material/liquid/drink/juice/grape, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/drink/juice/grape, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/drinks/juicebox/grape/Initialize() . = ..() @@ -114,7 +114,7 @@ var/decl/material/J = pick(drinktypes) add_to_reagents(J, 20) add_to_reagents(pick(drinktypes - J), 5) - return reagents.reagent_volumes + return REAGENT_VOLUMES(reagents) /obj/item/chems/drinks/juicebox/sensible_random/populate_reagents() var/list/chosen_reagents = juice_it() diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 3686618113bd..3efb2501163f 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -18,7 +18,7 @@ if(!target.reagents || !proximity) return - if(reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) if(!REAGENTS_FREE_SPACE(target.reagents)) to_chat(user, SPAN_WARNING("\The [target] is full.")) @@ -52,12 +52,12 @@ return var/mob/living/M = target - var/contained = REAGENT_LIST(src) + var/contained = REAGENT_LIST(reagents) admin_attack_log(user, M, "Squirted their victim with \a [src] (Reagents: [contained])", "Were squirted with \a [src] (Reagents: [contained])", "used \a [src] (Reagents: [contained]) to squirt at") var/spill_amt = M.incapacitated()? 0 : 30 - trans += reagents.splash(M, reagents.total_volume/2, max_spill = spill_amt) - trans += reagents.trans_to_mob(M, reagents.total_volume/2, CHEM_INJECT) //I guess it gets into the bloodstream through the eyes or something + trans += reagents.splash(M, REAGENT_TOTAL_VOLUME(reagents)/2, max_spill = spill_amt) + trans += reagents.trans_to_mob(M, REAGENT_TOTAL_VOLUME(reagents)/2, CHEM_INJECT) //I guess it gets into the bloodstream through the eyes or something user.visible_message(SPAN_DANGER("[user] squirts something into \the [target]'s eyes!"), SPAN_DANGER("You squirt [trans] unit\s into \the [target]'s eyes!")) return else @@ -70,7 +70,7 @@ to_chat(user, SPAN_NOTICE("You cannot directly remove reagents from [target].")) return - if(!target.reagents || !target.reagents.total_volume) + if(!target.reagents || !REAGENT_TOTAL_VOLUME(target.reagents)) to_chat(user, SPAN_NOTICE("[target] is empty.")) return @@ -86,7 +86,7 @@ /obj/item/chems/dropper/on_update_icon() . = ..() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) icon_state = "dropper1" else icon_state = "dropper0" diff --git a/code/modules/reagents/reagent_containers/food.dm b/code/modules/reagents/reagent_containers/food.dm index 661eed567e3b..31266aba67e5 100644 --- a/code/modules/reagents/reagent_containers/food.dm +++ b/code/modules/reagents/reagent_containers/food.dm @@ -69,7 +69,7 @@ /obj/item/food/lump/on_reagent_change() . = ..() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) SetName(reagents.get_primary_reagent_name()) filling_color = reagents.get_color() else @@ -86,7 +86,7 @@ // Does not rely on ATOM_IS_OPEN_CONTAINER because we want to be able to pour in but not out. /obj/item/food/can_be_poured_into(atom/source) - return (reagents?.maximum_volume > 0) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) /obj/item/food/attack_self(mob/user) if(is_edible(user) && handle_eaten_by_mob(user, user) != EATEN_INVALID) @@ -191,9 +191,8 @@ .[DATA_INGREDIENT_FLAGS] |= allergen_flags /obj/item/food/proc/set_nutriment_data(list/newdata) - if(reagents?.total_volume && reagents.has_reagent(nutriment_type, 1)) - LAZYINITLIST(reagents.reagent_data) - reagents.reagent_data[nutriment_type] = newdata + if(REAGENT_TOTAL_VOLUME(reagents) && reagents.has_reagent(nutriment_type, 1)) + REAGENT_SET_DATA(reagents, nutriment_type, newdata) /obj/item/food/get_utensil_food_type() return _utensil_food_type @@ -205,8 +204,8 @@ bitecount++ /obj/item/food/proc/add_allergen_flags(new_flags) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) var/list/newdata = reagent.mix_data(reagents, list(DATA_INGREDIENT_FLAGS = new_flags)) if(newdata) - LAZYSET(reagents.reagent_data, reagent, newdata) + REAGENT_SET_DATA(reagents, reagent, newdata) diff --git a/code/modules/reagents/reagent_containers/food/burgers.dm b/code/modules/reagents/reagent_containers/food/burgers.dm index 728d89478596..9945c504f4a0 100644 --- a/code/modules/reagents/reagent_containers/food/burgers.dm +++ b/code/modules/reagents/reagent_containers/food/burgers.dm @@ -114,7 +114,7 @@ /obj/item/food/roburgerbig/populate_reagents() . = ..() - add_to_reagents(/decl/material/liquid/nanitefluid, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/nanitefluid, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/food/xenoburger name = "xenoburger" diff --git a/code/modules/reagents/reagent_containers/food/canned/_canned.dm b/code/modules/reagents/reagent_containers/food/canned/_canned.dm index 28c53e81f5cd..6b7c35f23dff 100644 --- a/code/modules/reagents/reagent_containers/food/canned/_canned.dm +++ b/code/modules/reagents/reagent_containers/food/canned/_canned.dm @@ -63,7 +63,7 @@ return //Bypass searching through the whole icon file for a filling icon /obj/item/food/can/can_be_poured_into(atom/source) - return (reagents?.maximum_volume > 0) && ATOM_IS_OPEN_CONTAINER(src) + return (REAGENT_MAXIMUM_VOLUME(reagents) > 0) && ATOM_IS_OPEN_CONTAINER(src) //Just a short line of Canned Consumables, great for treasure in faraway abandoned outposts diff --git a/code/modules/reagents/reagent_containers/food/dairy/_dairy.dm b/code/modules/reagents/reagent_containers/food/dairy/_dairy.dm index 02de63c6a72f..4265d7079e22 100644 --- a/code/modules/reagents/reagent_containers/food/dairy/_dairy.dm +++ b/code/modules/reagents/reagent_containers/food/dairy/_dairy.dm @@ -19,11 +19,11 @@ . = ..() - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) return - var/list/data = LAZYACCESS(reagents?.reagent_data, nutriment_type) - var/milk_name = LAZYACCESS(data, data_name_field) + var/list/data = REAGENT_DATA(reagents, nutriment_type) + var/milk_name = LAZYACCESS(data, data_name_field) if(milk_name) set_dairy_name(milk_name) set_color(LAZYACCESS(data, data_color_field) || get_default_dairy_color()) diff --git a/code/modules/reagents/reagent_containers/food/eggs.dm b/code/modules/reagents/reagent_containers/food/eggs.dm index 5c3b600079ce..a5a762da21bd 100644 --- a/code/modules/reagents/reagent_containers/food/eggs.dm +++ b/code/modules/reagents/reagent_containers/food/eggs.dm @@ -22,7 +22,7 @@ if(!(proximity && ATOM_IS_OPEN_CONTAINER(O))) // Must be adjacent and open. return to_chat(user, "You crack \the [src] into \the [O].") - reagents.trans_to(O, reagents.total_volume) + reagents.trans_to(O, REAGENT_TOTAL_VOLUME(reagents)) qdel(src) /obj/item/food/egg/throw_impact(atom/hit_atom) @@ -30,7 +30,7 @@ if(QDELETED(src)) return // Could potentially happen with unscupulous atoms on hitby() throwing again, etc. new/obj/effect/decal/cleanable/egg_smudge(src.loc) - reagents.splash(hit_atom, reagents.total_volume) + reagents.splash(hit_atom, REAGENT_TOTAL_VOLUME(reagents)) visible_message("\The [src] has been squashed!","You hear a smack.") qdel(src) diff --git a/code/modules/reagents/reagent_containers/food/sandwich.dm b/code/modules/reagents/reagent_containers/food/sandwich.dm index 0b68fb355dad..3b53ba0c7262 100644 --- a/code/modules/reagents/reagent_containers/food/sandwich.dm +++ b/code/modules/reagents/reagent_containers/food/sandwich.dm @@ -40,7 +40,7 @@ return TRUE 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) + F.reagents.trans_to_obj(src, REAGENT_TOTAL_VOLUME(F.reagents)) ingredients += used_item update_icon() return TRUE diff --git a/code/modules/reagents/reagent_containers/food/sliceable/_sliceable.dm b/code/modules/reagents/reagent_containers/food/sliceable/_sliceable.dm index 1e25fdc14ef3..83dc713862a8 100644 --- a/code/modules/reagents/reagent_containers/food/sliceable/_sliceable.dm +++ b/code/modules/reagents/reagent_containers/food/sliceable/_sliceable.dm @@ -35,7 +35,7 @@ if(filled) var/obj/item/food/whole = new whole_path() if(whole && whole.slice_num) - var/reagent_amount = whole.reagents.total_volume/whole.slice_num + var/reagent_amount = REAGENT_TOTAL_VOLUME(whole.reagents)/whole.slice_num whole.reagents.trans_to_obj(src, reagent_amount) qdel(whole) diff --git a/code/modules/reagents/reagent_containers/food/sushi.dm b/code/modules/reagents/reagent_containers/food/sushi.dm index afb648168a04..e840beb60e33 100644 --- a/code/modules/reagents/reagent_containers/food/sushi.dm +++ b/code/modules/reagents/reagent_containers/food/sushi.dm @@ -26,7 +26,7 @@ fish_type = "tofu" if(topping.reagents) - topping.reagents.trans_to(src, topping.reagents.total_volume) + topping.reagents.trans_to(src, REAGENT_TOTAL_VOLUME(topping.reagents)) var/mob/M = topping.loc if(istype(M)) M.drop_from_inventory(topping) @@ -35,7 +35,7 @@ if(istype(rice)) if(rice.reagents) rice.reagents.trans_to(src, 1) - if(!rice.reagents || !rice.reagents.total_volume) + if(!rice.reagents || !REAGENT_TOTAL_VOLUME(rice.reagents)) var/mob/M = rice.loc if(istype(M)) M.drop_from_inventory(rice) qdel(rice) @@ -98,7 +98,7 @@ bitesize = slices update_icon() if(used_item.reagents) - used_item.reagents.trans_to(src, used_item.reagents.total_volume) + used_item.reagents.trans_to(src, REAGENT_TOTAL_VOLUME(used_item.reagents)) qdel(used_item) return TRUE diff --git a/code/modules/reagents/reagent_containers/food_edibility.dm b/code/modules/reagents/reagent_containers/food_edibility.dm index 6b9a4db8d4e7..85113627dc92 100644 --- a/code/modules/reagents/reagent_containers/food_edibility.dm +++ b/code/modules/reagents/reagent_containers/food_edibility.dm @@ -1,5 +1,5 @@ /obj/item/food/get_edible_material_amount(mob/eater) - return reagents?.total_volume + return REAGENT_TOTAL_VOLUME(reagents) /obj/item/food/get_food_consumption_method(mob/eater) return EATING_METHOD_EAT diff --git a/code/modules/reagents/reagent_containers/glass/bottle.dm b/code/modules/reagents/reagent_containers/glass/bottle.dm index 13c52ae77249..8b954cb90d07 100644 --- a/code/modules/reagents/reagent_containers/glass/bottle.dm +++ b/code/modules/reagents/reagent_containers/glass/bottle.dm @@ -38,8 +38,8 @@ update_icon() /obj/item/chems/glass/bottle/update_overlays() - if(reagents?.total_volume) - var/percent = round(reagents.total_volume / reagents.maximum_volume * 100, 25) + if(REAGENT_TOTAL_VOLUME(reagents)) + var/percent = round(REAGENT_TOTAL_VOLUME(reagents) / REAGENT_MAXIMUM_VOLUME(reagents) * 100, 25) add_overlay(mutable_appearance(icon, "[icon_state]_filling_[percent]", reagents.get_color())) var/image/overglass = mutable_appearance(icon, "[icon_state]_over", color) overglass.alpha = alpha * ((alpha/255) ** 3) @@ -59,7 +59,7 @@ /obj/item/chems/glass/bottle/populate_reagents() SHOULD_CALL_PARENT(TRUE) . = ..() - if(reagents?.total_volume > 0 && autolabel && !label_text) // don't override preset labels + if(REAGENT_TOTAL_VOLUME(reagents) > 0 && autolabel && !label_text) // don't override preset labels label_text = reagents.get_primary_reagent_name() update_name() @@ -67,46 +67,46 @@ desc = "A small bottle. Contains stabilizer - used to stabilize patients." /obj/item/chems/glass/bottle/stabilizer/populate_reagents() - add_to_reagents(/decl/material/liquid/stabilizer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/stabilizer, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/bromide desc = "A small bottle of bromide. Do not drink, it is poisonous." /obj/item/chems/glass/bottle/bromide/populate_reagents() - add_to_reagents(/decl/material/liquid/bromide, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/bromide, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/cyanide desc = "A small bottle of cyanide. Bitter almonds?" /obj/item/chems/glass/bottle/cyanide/populate_reagents() - add_to_reagents(/decl/material/liquid/cyanide, reagents.maximum_volume / 2) //volume changed to match chloral + add_to_reagents(/decl/material/liquid/cyanide, REAGENT_MAXIMUM_VOLUME(reagents) / 2) //volume changed to match chloral . = ..() /obj/item/chems/glass/bottle/sedatives desc = "A small bottle of soporific medication. Just the fumes make you sleepy." /obj/item/chems/glass/bottle/sedatives/populate_reagents() - add_to_reagents(/decl/material/liquid/sedatives, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/sedatives, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/antitoxin desc = "A small bottle of antitoxins. Counters poisons, and repairs damage. A wonder drug." /obj/item/chems/glass/bottle/antitoxin/populate_reagents() - add_to_reagents(/decl/material/liquid/antitoxins, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antitoxins, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/mutagenics desc = "A small bottle of unstable mutagen. Randomly changes the DNA structure of whoever comes in contact." /obj/item/chems/glass/bottle/mutagenics/populate_reagents() - add_to_reagents(/decl/material/liquid/mutagenics, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/mutagenics, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/ammonia/populate_reagents() - add_to_reagents(/decl/material/gas/ammonia, reagents.maximum_volume) + add_to_reagents(/decl/material/gas/ammonia, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/eznutrient @@ -117,7 +117,7 @@ material = /decl/material/solid/organic/plastic /obj/item/chems/glass/bottle/eznutrient/populate_reagents() - add_to_reagents(/decl/material/liquid/fertilizer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/fertilizer, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/left4zed @@ -128,8 +128,8 @@ material = /decl/material/solid/organic/plastic /obj/item/chems/glass/bottle/left4zed/populate_reagents() - var/mutagen_amount = round(reagents.maximum_volume / 6) - add_to_reagents(/decl/material/liquid/fertilizer, reagents.maximum_volume - mutagen_amount) + var/mutagen_amount = round(REAGENT_MAXIMUM_VOLUME(reagents) / 6) + add_to_reagents(/decl/material/liquid/fertilizer, REAGENT_MAXIMUM_VOLUME(reagents) - mutagen_amount) add_to_reagents(/decl/material/liquid/mutagenics, mutagen_amount) . = ..() @@ -141,13 +141,13 @@ material = /decl/material/solid/organic/plastic /obj/item/chems/glass/bottle/robustharvest/populate_reagents() - var/amonia_amount = round(reagents.maximum_volume / 6) - add_to_reagents(/decl/material/liquid/fertilizer, reagents.maximum_volume - amonia_amount) + var/amonia_amount = round(REAGENT_MAXIMUM_VOLUME(reagents) / 6) + add_to_reagents(/decl/material/liquid/fertilizer, REAGENT_MAXIMUM_VOLUME(reagents) - amonia_amount) add_to_reagents(/decl/material/gas/ammonia, amonia_amount) . = ..() /obj/item/chems/glass/bottle/pacid/populate_reagents() - add_to_reagents(/decl/material/liquid/acid/polyacid, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/acid/polyacid, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/adminordrazine desc = "A small bottle. Contains the liquid essence of the gods." @@ -156,19 +156,19 @@ label_color = COLOR_CYAN_BLUE /obj/item/chems/glass/bottle/adminordrazine/populate_reagents() - add_to_reagents(/decl/material/liquid/adminordrazine, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/adminordrazine, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/capsaicin desc = "A small bottle. Contains hot sauce." /obj/item/chems/glass/bottle/capsaicin/populate_reagents() - add_to_reagents(/decl/material/liquid/capsaicin, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/capsaicin, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/frostoil desc = "A small bottle. Contains cold sauce." /obj/item/chems/glass/bottle/frostoil/populate_reagents() - add_to_reagents(/decl/material/liquid/frostoil, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/frostoil, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() diff --git a/code/modules/reagents/reagent_containers/glass/bottle/robot.dm b/code/modules/reagents/reagent_containers/glass/bottle/robot.dm index 530cbf5362c2..501c6017362e 100644 --- a/code/modules/reagents/reagent_containers/glass/bottle/robot.dm +++ b/code/modules/reagents/reagent_containers/glass/bottle/robot.dm @@ -16,7 +16,7 @@ desc = "A small bottle. Contains stabilizer - used to stabilize patients." /obj/item/chems/glass/bottle/robot/stabilizer/populate_reagents() - add_to_reagents(/decl/material/liquid/stabilizer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/stabilizer, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/glass/bottle/robot/antitoxin @@ -26,5 +26,5 @@ icon_state = "bottle-4" /obj/item/chems/glass/bottle/robot/antitoxin/populate_reagents() - add_to_reagents(/decl/material/liquid/antitoxins, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antitoxins, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index 3353a13f981f..572561fc288b 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -38,7 +38,7 @@ /obj/item/chems/hypospray/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_WARNING("\The [src] is empty.")) return TRUE @@ -62,7 +62,7 @@ if(!user.do_skilled(time, SKILL_MEDICAL, target)) return TRUE - if(single_use && reagents.total_volume <= 0) // currently only applies to autoinjectors + if(single_use && REAGENT_TOTAL_VOLUME(reagents) <= 0) // currently only applies to autoinjectors atom_flags &= ~ATOM_FLAG_OPEN_CONTAINER // Prevents autoinjectors to be refilled. to_chat(user, SPAN_NOTICE("You inject [target] with [src].")) @@ -71,10 +71,10 @@ user.visible_message(SPAN_WARNING("[user] injects [target] with [src].")) if(target.reagents) - var/contained = REAGENT_LIST(src) + var/contained = REAGENT_LIST(reagents) var/trans = reagents.trans_to_mob(target, amount_per_transfer_from_this, CHEM_INJECT) admin_inject_log(user, target, src, contained, trans) - to_chat(user, SPAN_NOTICE("[trans] unit\s injected. [reagents.total_volume] unit\s remaining in \the [src].")) + to_chat(user, SPAN_NOTICE("[trans] unit\s injected. [REAGENT_TOTAL_VOLUME(reagents)] unit\s remaining in \the [src].")) return TRUE @@ -115,8 +115,8 @@ V.update_icon() loaded_vial = V - create_or_update_reagents(loaded_vial.reagents.maximum_volume, override_volume = TRUE) - loaded_vial.reagents.trans_to_holder(reagents, reagents.maximum_volume) + create_or_update_reagents(REAGENT_MAXIMUM_VOLUME(loaded_vial.reagents), override_volume = TRUE) + loaded_vial.reagents.trans_to_holder(reagents, REAGENT_MAXIMUM_VOLUME(reagents)) if(user) user.visible_message(SPAN_NOTICE("[user] has loaded [V] into \the [src]."), SPAN_NOTICE("[usermessage]")) @@ -126,10 +126,10 @@ return TRUE /obj/item/chems/hypospray/vial/proc/remove_vial(var/mob/user, var/swap_mode, var/should_update_icon = TRUE) - if(!loaded_vial) + if(!loaded_vial || !istype(reagents)) return - reagents.trans_to_holder(loaded_vial.reagents, reagents.maximum_volume) - reagents.maximum_volume = 0 + reagents.trans_to_holder(loaded_vial.reagents, REAGENT_MAXIMUM_VOLUME(reagents)) + REAGENT_SET_MAX_VOL(reagents, 0) loaded_vial.update_icon() if(user) user.put_in_hands(loaded_vial) @@ -190,8 +190,8 @@ /obj/item/chems/hypospray/autoinjector/populate_reagents() SHOULD_CALL_PARENT(TRUE) . = ..() - if(reagents?.total_volume > 0 && autolabel && !label_text) // don't override preset labels - label_text = "[reagents.get_primary_reagent_name()], [reagents.total_volume]u" + if(REAGENT_TOTAL_VOLUME(reagents) > 0 && autolabel && !label_text) // don't override preset labels + label_text = "[reagents.get_primary_reagent_name()], [REAGENT_TOTAL_VOLUME(reagents)]u" /obj/item/chems/hypospray/autoinjector/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) . = ..() @@ -200,12 +200,12 @@ /obj/item/chems/hypospray/autoinjector/on_update_icon() . = ..() - if(reagents?.total_volume <= 0) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0) icon_state = "[icon_state]_used" /obj/item/chems/hypospray/autoinjector/get_examine_strings(mob/user, distance, infix, suffix) . = ..(user) - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) . += SPAN_NOTICE("It is currently loaded.") else . += SPAN_NOTICE("It is spent.") @@ -214,14 +214,14 @@ // Autoinjector - Stabilizer //////////////////////////////////////////////////////////////////////////////// /obj/item/chems/hypospray/autoinjector/stabilizer/populate_reagents() - add_to_reagents(/decl/material/liquid/stabilizer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/stabilizer, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() //////////////////////////////////////////////////////////////////////////////// // Autoinjector - Adrenaline //////////////////////////////////////////////////////////////////////////////// /obj/item/chems/hypospray/autoinjector/adrenaline/populate_reagents() - add_to_reagents(/decl/material/liquid/adrenaline, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/adrenaline, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() //////////////////////////////////////////////////////////////////////////////// @@ -231,7 +231,7 @@ detail_color = COLOR_GREEN /obj/item/chems/hypospray/autoinjector/detox/populate_reagents() - add_to_reagents(/decl/material/liquid/antitoxins, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antitoxins, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() //////////////////////////////////////////////////////////////////////////////// @@ -241,7 +241,7 @@ detail_color = COLOR_PURPLE /obj/item/chems/hypospray/autoinjector/pain/populate_reagents() - add_to_reagents(/decl/material/liquid/painkillers, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/painkillers, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() //////////////////////////////////////////////////////////////////////////////// @@ -251,7 +251,7 @@ detail_color = COLOR_AMBER /obj/item/chems/hypospray/autoinjector/antirad/populate_reagents() - add_to_reagents(/decl/material/liquid/antirads, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antirads, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() //////////////////////////////////////////////////////////////////////////////// @@ -261,7 +261,7 @@ detail_color = COLOR_DARK_GRAY /obj/item/chems/hypospray/autoinjector/hallucinogenics/populate_reagents() - add_to_reagents(/decl/material/liquid/hallucinogenics, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/hallucinogenics, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() //////////////////////////////////////////////////////////////////////////////// @@ -274,9 +274,9 @@ /obj/item/chems/hypospray/autoinjector/clotting/populate_reagents() . = ..() - var/amt = round(reagents.maximum_volume*0.5) + var/amt = round(REAGENT_MAXIMUM_VOLUME(reagents)*0.5) add_to_reagents(/decl/material/liquid/stabilizer, amt) - add_to_reagents(/decl/material/liquid/clotting_agent, (reagents.maximum_volume - amt)) + add_to_reagents(/decl/material/liquid/clotting_agent, (REAGENT_MAXIMUM_VOLUME(reagents) - amt)) //////////////////////////////////////////////////////////////////////////////// // Autoinjector - Empty diff --git a/code/modules/reagents/reagent_containers/inhaler.dm b/code/modules/reagents/reagent_containers/inhaler.dm index 6ed443810914..ef51bccc8e99 100644 --- a/code/modules/reagents/reagent_containers/inhaler.dm +++ b/code/modules/reagents/reagent_containers/inhaler.dm @@ -28,7 +28,7 @@ . = ..() for(var/T in starts_with) add_to_reagents(T, starts_with[T]) - if(ATOM_IS_OPEN_CONTAINER(src) && reagents.total_volume > 0) + if(ATOM_IS_OPEN_CONTAINER(src) && REAGENT_TOTAL_VOLUME(reagents) > 0) atom_flags &= ~ATOM_FLAG_OPEN_CONTAINER update_icon() @@ -37,7 +37,7 @@ . = ..() if(ATOM_IS_OPEN_CONTAINER(src)) add_overlay("[icon_state]_loaded") - if(reagents?.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(reagents) > 0) add_overlay("[icon_state]_reagents") /obj/item/chems/inhaler/use_on_mob(mob/living/target, mob/living/user, animate = TRUE) @@ -49,7 +49,7 @@ to_chat(user, SPAN_NOTICE("You must secure the reagents inside \the [src] before using it!")) return FALSE - if(!reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_WARNING("\The [src] is empty.")) return TRUE @@ -78,12 +78,12 @@ SPAN_NOTICE("You stick \the [src] in \the [target]'s mouth and press the injection button.") ) - var/contained = REAGENT_LIST(src) + var/contained = REAGENT_LIST(reagents) var/trans = reagents.trans_to_mob(target, amount_per_transfer_from_this, CHEM_INHALE) if(trans) admin_inject_log(user, target, src, contained, trans) playsound(src.loc, 'sound/effects/hypospray.ogg', 50, 1) - to_chat(user, SPAN_NOTICE("[trans] units administered. [reagents.total_volume] units remaining in \the [src].")) + to_chat(user, SPAN_NOTICE("[trans] units administered. [REAGENT_TOTAL_VOLUME(reagents)] units remaining in \the [src].")) used = TRUE update_icon() @@ -91,7 +91,7 @@ /obj/item/chems/inhaler/attack_self(mob/user) if(ATOM_IS_OPEN_CONTAINER(src)) - if(reagents.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(reagents) > 0) to_chat(user, SPAN_NOTICE("With a quick twist of \the [src]'s lid, you secure the reagents inside.")) atom_flags &= ~ATOM_FLAG_OPEN_CONTAINER update_icon() @@ -112,7 +112,7 @@ /obj/item/chems/inhaler/get_examine_strings(mob/user, distance, infix, suffix) . = ..(user) if(distance <= 1) - if(reagents.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(reagents) > 0) . += SPAN_NOTICE("It is currently loaded.") else . += SPAN_WARNING("It is spent.") diff --git a/code/modules/reagents/reagent_containers/mortar.dm b/code/modules/reagents/reagent_containers/mortar.dm index 6af747cd6a1d..e1c415a1ecdd 100644 --- a/code/modules/reagents/reagent_containers/mortar.dm +++ b/code/modules/reagents/reagent_containers/mortar.dm @@ -37,11 +37,11 @@ if(attacking_material.hardness <= crushing_material.hardness) 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) + if(REAGENTS_FREE_SPACE(reagents) < REAGENT_TOTAL_VOLUME(crushing_item.reagents)) to_chat(user, SPAN_WARNING("\The [src] is too full to grind \the [crushing_item], it'd spill everywhere!")) return TRUE - if(crushing_item.reagents?.total_volume) // if it has no reagents, skip all the fluff and destroy it instantly - var/stamina_to_consume = max(crushing_item.reagents.total_volume * (1 + user.get_stamina_skill_mod()/2), 5) + if(REAGENT_TOTAL_VOLUME(crushing_item.reagents)) // if it has no reagents, skip all the fluff and destroy it instantly + var/stamina_to_consume = max(REAGENT_TOTAL_VOLUME(crushing_item.reagents) * (1 + user.get_stamina_skill_mod()/2), 5) if(stamina_to_consume > 100) // TODO: add user.get_max_stamina()? to_chat(user, SPAN_WARNING("\The [crushing_item] is too large for you to grind in \the [src]!")) return TRUE @@ -58,7 +58,7 @@ if(QDELETED(crushing_item)) return TRUE // already been ground! user.adjust_stamina(-stamina_to_consume) - crushing_item.reagents.trans_to(src, crushing_item.reagents.total_volume, skill_factor) + crushing_item.reagents.trans_to(src, REAGENT_TOTAL_VOLUME(crushing_item.reagents), skill_factor) 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 diff --git a/code/modules/reagents/reagent_containers/packets.dm b/code/modules/reagents/reagent_containers/packets.dm index 6b417f2254ea..c8f453ddf521 100644 --- a/code/modules/reagents/reagent_containers/packets.dm +++ b/code/modules/reagents/reagent_containers/packets.dm @@ -29,7 +29,7 @@ icon = 'icons/obj/food/condiments/packets/packet_white.dmi' /obj/item/chems/packet/salt/populate_reagents() - add_to_reagents(/decl/material/solid/sodiumchloride, reagents.maximum_volume/2) + add_to_reagents(/decl/material/solid/sodiumchloride, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/pepper name = "pepper packet" @@ -37,7 +37,7 @@ icon = 'icons/obj/food/condiments/packets/packet_black.dmi' /obj/item/chems/packet/pepper/populate_reagents() - add_to_reagents(/decl/material/solid/blackpepper, reagents.maximum_volume/2) + add_to_reagents(/decl/material/solid/blackpepper, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/sugar name = "sugar packet" @@ -45,7 +45,7 @@ icon = 'icons/obj/food/condiments/packets/packet_white.dmi' /obj/item/chems/packet/sugar/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/sugar, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/sugar, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/jelly name = "jelly packet" @@ -53,7 +53,7 @@ icon = 'icons/obj/food/condiments/packets/packet_medium.dmi' /obj/item/chems/packet/jelly/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/cherryjelly, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/nutriment/cherryjelly, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/honey name = "honey packet" @@ -61,7 +61,7 @@ icon = 'icons/obj/food/condiments/packets/packet_medium.dmi' /obj/item/chems/packet/honey/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/honey, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/nutriment/honey, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/honey_fake name = "'honey' packet" @@ -69,7 +69,7 @@ icon = 'icons/obj/food/condiments/packets/packet_medium.dmi' /obj/item/chems/packet/honey_fake/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/sugar, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/nutriment/sugar, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/capsaicin name = "hot sauce packet" @@ -77,7 +77,7 @@ icon = 'icons/obj/food/condiments/packets/packet_red.dmi' /obj/item/chems/packet/capsaicin/populate_reagents() - add_to_reagents(/decl/material/liquid/capsaicin, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/capsaicin, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/ketchup name = "ketchup packet" @@ -85,7 +85,7 @@ icon = 'icons/obj/food/condiments/packets/packet_red.dmi' /obj/item/chems/packet/ketchup/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/ketchup, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/ketchup, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/mayo name = "mayonnaise packet" @@ -93,7 +93,7 @@ icon = 'icons/obj/food/condiments/packets/packet_white.dmi' /obj/item/chems/packet/mayo/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/mayo, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/mayo, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/soy name = "soy sauce packet" @@ -101,56 +101,56 @@ icon = 'icons/obj/food/condiments/packets/packet_black.dmi' /obj/item/chems/packet/soy/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/soysauce, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/soysauce, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/coffee name = "instant coffee powder packet" desc = "Contains 5u of instant coffee powder. Mix with 25u of water." /obj/item/chems/packet/coffee/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/coffee/instant, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/coffee/instant, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/tea name = "instant tea powder packet" desc = "Contains 5u of instant black tea powder. Mix with 25u of water." /obj/item/chems/packet/tea/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/tea/instant, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/tea/instant, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/cocoa name = "cocoa powder packet" desc = "Contains 5u of cocoa powder. Mix with 25u of water and heat." /obj/item/chems/packet/cocoa/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/coco, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/coco, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/grape name = "grape juice powder packet" desc = "Contains 5u of powdered grape juice. Mix with 15u of water." /obj/item/chems/packet/grape/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/instantjuice/grape, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/instantjuice/grape, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/orange name = "orange juice powder packet" desc = "Contains 5u of powdered orange juice. Mix with 15u of water." /obj/item/chems/packet/orange/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/instantjuice/orange, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/instantjuice/orange, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/watermelon name = "watermelon juice powder packet" desc = "Contains 5u of powdered watermelon juice. Mix with 15u of water." /obj/item/chems/packet/watermelon/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/instantjuice/watermelon, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/instantjuice/watermelon, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/apple name = "apple juice powder packet" desc = "Contains 5u of powdered apple juice. Mix with 15u of water." /obj/item/chems/packet/apple/populate_reagents() - add_to_reagents(/decl/material/liquid/nutriment/instantjuice/apple, reagents.maximum_volume/2) + add_to_reagents(/decl/material/liquid/nutriment/instantjuice/apple, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/protein name = "protein powder packet" @@ -158,35 +158,35 @@ icon = 'icons/obj/food/condiments/packets/packet_medium.dmi' /obj/item/chems/packet/protein/populate_reagents() - add_to_reagents(/decl/material/solid/organic/meat, reagents.maximum_volume/2) + add_to_reagents(/decl/material/solid/organic/meat, REAGENT_MAXIMUM_VOLUME(reagents)/2) /obj/item/chems/packet/crayon name = "crayon powder packet" desc = "Contains 10u of powdered crayon. Mix with 30u of water." /obj/item/chems/packet/crayon/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/red/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/red, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/red, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/orange/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/orange, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/orange, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/yellow/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/yellow, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/yellow, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/green/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/green, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/green, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/blue/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/blue, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/blue, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/purple/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/purple, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/purple, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/grey/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/grey, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/grey, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/packet/crayon/brown/populate_reagents() - add_to_reagents(/decl/material/liquid/pigment/brown, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/pigment/brown, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 3fe3c69ad6f0..74b6bdb129a0 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -36,8 +36,8 @@ /obj/item/chems/pill/populate_reagents() SHOULD_CALL_PARENT(TRUE) . = ..() - if(reagents?.total_volume > 0 && autolabel && !label_text) // don't override preset labels - label_text = "[reagents.get_primary_reagent_name()], [reagents.total_volume]u" + if(REAGENT_TOTAL_VOLUME(reagents) > 0 && autolabel && !label_text) // don't override preset labels + label_text = "[reagents.get_primary_reagent_name()], [REAGENT_TOTAL_VOLUME(reagents)]u" /obj/item/chems/pill/on_update_icon() . = ..() @@ -55,13 +55,13 @@ /obj/item/chems/pill/afterattack(obj/target, mob/user, proximity) if(proximity && ATOM_IS_OPEN_CONTAINER(target) && target.reagents) - if(!target.reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(target.reagents)) to_chat(user, SPAN_WARNING("\The [target] is empty. You can't dissolve \the [src] in it.")) return to_chat(user, SPAN_NOTICE("You dissolve \the [src] in \the [target].")) user.visible_message(SPAN_NOTICE("\The [user] puts something in \the [target]."), range = 2) - admin_attacker_log(user, "spiked \a [target] with a pill. Reagents: [REAGENT_LIST(src)]") - reagents.trans_to(target, reagents.total_volume) + admin_attacker_log(user, "spiked \a [target] with a pill. Reagents: [REAGENT_LIST(reagents)]") + reagents.trans_to(target, REAGENT_TOTAL_VOLUME(reagents)) qdel(src) return return ..() @@ -77,7 +77,7 @@ chem_volume = 50 /obj/item/chems/pill/bromide/populate_reagents() - add_to_reagents(/decl/material/liquid/bromide, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/bromide, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/pill/cyanide @@ -88,7 +88,7 @@ autolabel = FALSE /obj/item/chems/pill/cyanide/populate_reagents() - add_to_reagents(/decl/material/liquid/cyanide, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/cyanide, REAGENT_MAXIMUM_VOLUME(reagents)) . = ..() /obj/item/chems/pill/adminordrazine diff --git a/code/modules/reagents/reagent_containers/pill_edibility.dm b/code/modules/reagents/reagent_containers/pill_edibility.dm index 02034687bb8f..20b43f905702 100644 --- a/code/modules/reagents/reagent_containers/pill_edibility.dm +++ b/code/modules/reagents/reagent_containers/pill_edibility.dm @@ -2,10 +2,10 @@ return EATING_METHOD_EAT /obj/item/chems/pill/get_edible_material_amount(var/mob/eater) - return reagents?.total_volume + return REAGENT_TOTAL_VOLUME(reagents) /obj/item/chems/pill/get_food_default_transfer_amount(mob/eater) - return reagents?.total_volume // Always eat it in one bite. + return REAGENT_TOTAL_VOLUME(reagents) // Always eat it in one bite. /obj/item/chems/pill/show_feed_message_start(mob/user, mob/target, consumption_method = EATING_METHOD_EAT) target = target || user diff --git a/code/modules/reagents/reagent_containers/retort.dm b/code/modules/reagents/reagent_containers/retort.dm index 6605adad776d..2dfaf930e349 100644 --- a/code/modules/reagents/reagent_containers/retort.dm +++ b/code/modules/reagents/reagent_containers/retort.dm @@ -18,10 +18,10 @@ material = /decl/material/solid/stone/pottery /obj/item/chems/glass/retort/update_overlays() - if(reagents?.total_volume && (!material || material.opacity < 1)) + if(REAGENT_TOTAL_VOLUME(reagents) && (!material || material.opacity < 1)) var/datum/gas_mixture/environment = loc?.return_air() var/ambient_pressure = environment ? environment.return_pressure() : ONE_ATMOSPHERE - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(reagent.phase_at_temperature(temperature, ambient_pressure) == MAT_PHASE_GAS) add_overlay(overlay_image(icon, "[icon_state]-fill-boil", reagents.get_color(), (RESET_ALPHA|RESET_COLOR))) return diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 390eff88e405..dcea23312bde 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -40,7 +40,7 @@ if(standard_dispenser_refill(user, A)) return - if(reagents.total_volume < amount_per_transfer_from_this) + if(REAGENT_TOTAL_VOLUME(reagents) < amount_per_transfer_from_this) to_chat(user, SPAN_WARNING("\The [src] is empty!")) return @@ -101,7 +101,7 @@ /obj/item/chems/spray/get_examine_strings(mob/user, distance, infix, suffix) . = ..() if(loc == user) - . += "[round(reagents.total_volume)] unit\s left." + . += "[round(REAGENT_TOTAL_VOLUME(reagents))] unit\s left." if(has_safety() && distance <= 1) . += "The safety is [safety ? "on" : "off"]." @@ -137,21 +137,21 @@ particle_move_delay = 6 /obj/item/chems/spray/cleaner/populate_reagents() - add_to_reagents(/decl/material/liquid/cleaner, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/cleaner, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/spray/antiseptic name = "antiseptic spray" desc = "Great for hiding incriminating bloodstains and sterilizing scalpels." /obj/item/chems/spray/antiseptic/populate_reagents() - add_to_reagents(/decl/material/liquid/antiseptic, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antiseptic, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/spray/hair_remover name = "hair remover" desc = "Very effective at removing hair, feathers, spines and horns." /obj/item/chems/spray/hair_remover/populate_reagents() - add_to_reagents(/decl/material/liquid/hair_remover, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/hair_remover, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/spray/pepper name = "pepperspray" @@ -164,7 +164,7 @@ safety = TRUE /obj/item/chems/spray/pepper/populate_reagents() - add_to_reagents(/decl/material/liquid/capsaicin/condensed, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/capsaicin/condensed, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/spray/pepper/has_safety() return TRUE @@ -180,7 +180,7 @@ chem_volume = 10 /obj/item/chems/spray/waterflower/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/spray/chemsprayer name = "chem sprayer" @@ -204,7 +204,7 @@ var/list/the_targets = list(T, T1, T2) for(var/a = 1 to 3) - if(reagents.total_volume < 1) + if(REAGENT_TOTAL_VOLUME(reagents) < 1) break create_chempuff(the_targets[a], rand(6, 8)) return @@ -218,7 +218,7 @@ chem_volume = 100 /obj/item/chems/spray/plantbgone/populate_reagents() - add_to_reagents(/decl/material/liquid/weedkiller, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/weedkiller, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/spray/cleaner/deodorant name = "deodorant" diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 713453cb5b5e..bca089ca6fdd 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -33,7 +33,7 @@ /obj/item/chems/syringe/populate_reagents() SHOULD_CALL_PARENT(TRUE) . = ..() - if(reagents.total_volume > 0 && autolabel && !label_text) // don't override preset labels + if(REAGENT_TOTAL_VOLUME(reagents) > 0 && autolabel && !label_text) // don't override preset labels label_text = reagents.get_primary_reagent_name() update_name() @@ -99,12 +99,12 @@ icon_state = "[icon_state]_broken" return var/rounded_vol = 0 - if (reagents?.total_volume > 0) - rounded_vol = clamp(round((reagents.total_volume / max(1, reagents.maximum_volume * 15)),5), 5, 15) + if (REAGENT_TOTAL_VOLUME(reagents) > 0) + rounded_vol = clamp(round((REAGENT_TOTAL_VOLUME(reagents) / max(1, REAGENT_MAXIMUM_VOLUME(reagents) * 15)),5), 5, 15) if(ismob(loc)) add_overlay((mode == SYRINGE_DRAW)? "[icon_state]_draw" : "[icon_state]_inject") icon_state = "[icon_state]_[rounded_vol]" - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) var/image/filling = image(icon, "[icon_state]_underlay") filling.color = reagents.get_color() filling.appearance_flags |= RESET_COLOR @@ -125,13 +125,13 @@ return if(ismob(target))//Blood! - if(reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_NOTICE("There is already a blood sample in this syringe.")) return if(ishuman(target)) var/amount = REAGENTS_FREE_SPACE(reagents) var/mob/living/human/T = target - if(!T.vessel?.total_volume) + if(!REAGENT_TOTAL_VOLUME(T.vessel)) to_chat(user, SPAN_WARNING("You are unable to locate any blood.")) return @@ -168,7 +168,7 @@ user.visible_message(SPAN_NOTICE("\The [user] takes a blood sample from \the [target].")) else //if not mob - if(!target.reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(target.reagents)) to_chat(user, SPAN_NOTICE("[target] is empty.")) return @@ -190,7 +190,7 @@ syringestab(target, user) return - if(!reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) to_chat(user, SPAN_NOTICE("The syringe is empty.")) mode = SYRINGE_DRAW return @@ -211,8 +211,8 @@ return var/trans = reagents.trans_to(target, amount_per_transfer_from_this) - to_chat(user, SPAN_NOTICE("You inject \the [target] with [trans] units of the solution. \The [src] now contains [src.reagents.total_volume] units.")) - if(reagents.total_volume <= 0 && mode == SYRINGE_INJECT) + to_chat(user, SPAN_NOTICE("You inject \the [target] with [trans] units of the solution. \The [src] now contains [REAGENT_TOTAL_VOLUME(src.reagents)] units.")) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0 && mode == SYRINGE_INJECT) mode = SYRINGE_DRAW update_icon() @@ -257,11 +257,11 @@ var/trans = reagents.trans_to_mob(target, amount_per_transfer_from_this, CHEM_INJECT) if(target != user) - user.visible_message(SPAN_WARNING("\the [user] injects \the [target] with [visible_name]!"), SPAN_NOTICE("You inject \the [target] with [trans] units of the solution. \The [src] now contains [src.reagents.total_volume] units.")) + user.visible_message(SPAN_WARNING("\the [user] injects \the [target] with [visible_name]!"), SPAN_NOTICE("You inject \the [target] with [trans] units of the solution. \The [src] now contains [REAGENT_TOTAL_VOLUME(src.reagents)] units.")) else - to_chat(user, SPAN_NOTICE("You inject yourself with [trans] units of the solution. \The [src] now contains [src.reagents.total_volume] units.")) + to_chat(user, SPAN_NOTICE("You inject yourself with [trans] units of the solution. \The [src] now contains [REAGENT_TOTAL_VOLUME(src.reagents)] units.")) - if(reagents.total_volume <= 0 && mode == SYRINGE_INJECT) + if(REAGENT_TOTAL_VOLUME(reagents) <= 0 && mode == SYRINGE_INJECT) mode = SYRINGE_DRAW update_icon() @@ -297,7 +297,7 @@ user.visible_message(SPAN_DANGER("[user] stabs [target] with [src.name]!")) target.apply_damage(3, BRUTE) - var/syringestab_amount_transferred = rand(0, (reagents.total_volume - 5)) //nerfed by popular demand + var/syringestab_amount_transferred = rand(0, (REAGENT_TOTAL_VOLUME(reagents) - 5)) //nerfed by popular demand var/contained_reagents = reagents.get_reagents() var/trans = reagents.trans_to_mob(target, syringestab_amount_transferred, CHEM_INJECT) if(isnull(trans)) trans = 0 @@ -326,7 +326,7 @@ /obj/item/chems/syringe/ld50_syringe/populate_reagents() SHOULD_CALL_PARENT(FALSE) - add_to_reagents(/decl/material/liquid/heartstopper, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/heartstopper, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/syringe/ld50_syringe/drawReagents(var/target, var/mob/user) if(ismob(target)) // No drawing 60 units of blood at once @@ -343,7 +343,7 @@ mode = SYRINGE_INJECT /obj/item/chems/syringe/stabilizer/populate_reagents() - add_to_reagents(/decl/material/liquid/stabilizer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/stabilizer, REAGENT_MAXIMUM_VOLUME(reagents)) return ..() /obj/item/chems/syringe/antitoxin @@ -351,7 +351,7 @@ mode = SYRINGE_INJECT /obj/item/chems/syringe/antitoxin/populate_reagents() - add_to_reagents(/decl/material/liquid/antitoxins, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antitoxins, REAGENT_MAXIMUM_VOLUME(reagents)) return ..() /obj/item/chems/syringe/antibiotic @@ -359,7 +359,7 @@ mode = SYRINGE_INJECT /obj/item/chems/syringe/antibiotic/populate_reagents() - add_to_reagents(/decl/material/liquid/antibiotics, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/antibiotics, REAGENT_MAXIMUM_VOLUME(reagents)) return ..() /obj/item/chems/syringe/drugs @@ -367,7 +367,7 @@ mode = SYRINGE_INJECT /obj/item/chems/syringe/drugs/populate_reagents() - var/vol_each = round(reagents.maximum_volume / 3) + var/vol_each = round(REAGENT_MAXIMUM_VOLUME(reagents) / 3) add_to_reagents(/decl/material/liquid/psychoactives, vol_each) add_to_reagents(/decl/material/liquid/hallucinogenics, vol_each) add_to_reagents(/decl/material/liquid/presyncopics, vol_each) @@ -378,7 +378,7 @@ mode = SYRINGE_INJECT /obj/item/chems/syringe/steroid/populate_reagents() - var/vol_third = round(reagents.maximum_volume/3) + var/vol_third = round(REAGENT_MAXIMUM_VOLUME(reagents)/3) add_to_reagents(/decl/material/liquid/adrenaline, vol_third) add_to_reagents(/decl/material/liquid/amphetamines, 2 * vol_third) return ..() diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 8b2dc8e5dbab..3dd12396af68 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -30,7 +30,7 @@ /obj/structure/reagent_dispensers/on_reagent_change() if(!(. = ..())) return - if(reagents?.total_volume > 0) + if(REAGENT_TOTAL_VOLUME(reagents) > 0) tool_interaction_flags &= ~TOOL_INTERACTION_DECONSTRUCT else tool_interaction_flags |= TOOL_INTERACTION_DECONSTRUCT @@ -38,7 +38,7 @@ /obj/structure/reagent_dispensers/proc/leak() var/turf/T = get_turf(src) if(reagents && T) - reagents.trans_to_turf(T, min(reagents.total_volume, FLUID_PUDDLE)) + reagents.trans_to_turf(T, min(REAGENT_TOTAL_VOLUME(reagents), FLUID_PUDDLE)) /obj/structure/reagent_dispensers/Move() . = ..() @@ -85,7 +85,7 @@ movable_flags = MOVABLE_FLAG_WHEELED /obj/structure/reagent_dispensers/watertank/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/watertank/high name = "high-capacity water tank" @@ -116,7 +116,7 @@ var/obj/item/assembly_holder/rig /obj/structure/reagent_dispensers/fueltank/populate_reagents() - add_to_reagents(/decl/material/liquid/fuel, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/fuel, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/fueltank/get_examine_strings(mob/user, distance, infix, suffix) . = ..() @@ -198,7 +198,7 @@ amount_dispensed = 45 /obj/structure/reagent_dispensers/peppertank/populate_reagents() - add_to_reagents(/decl/material/liquid/capsaicin/condensed, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/capsaicin/condensed, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/water_cooler name = "water cooler" @@ -215,7 +215,7 @@ var/tmp/cup_type = /obj/item/chems/drinks/sillycup /obj/structure/reagent_dispensers/water_cooler/populate_reagents() - add_to_reagents(/decl/material/liquid/water, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/water, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/water_cooler/attack_hand(var/mob/user) if(user.check_dexterity(DEXTERITY_HOLD_ITEM, TRUE)) @@ -251,7 +251,7 @@ /obj/structure/reagent_dispensers/water_cooler/on_reagent_change() . = ..() // Bubbles in top of cooler. - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) var/vend_state = "[icon_state]-vend" if(check_state_in_icon(vend_state, icon)) flick(vend_state, src) @@ -266,7 +266,7 @@ matter = list(/decl/material/solid/metal/stainlesssteel = MATTER_AMOUNT_TRACE) /obj/structure/reagent_dispensers/beerkeg/populate_reagents() - add_to_reagents(/decl/material/liquid/alcohol/beer, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/alcohol/beer, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/reagent_dispensers/acid name = "sulfuric acid dispenser" @@ -277,7 +277,7 @@ density = FALSE /obj/structure/reagent_dispensers/acid/populate_reagents() - add_to_reagents(/decl/material/liquid/acid, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/acid, REAGENT_MAXIMUM_VOLUME(reagents)) //Interactions /obj/structure/reagent_dispensers/get_alt_interactions(var/mob/user) diff --git a/code/modules/scanners/breath.dm b/code/modules/scanners/breath.dm index 24d83b582c71..0c596e83f7f6 100644 --- a/code/modules/scanners/breath.dm +++ b/code/modules/scanners/breath.dm @@ -100,9 +100,9 @@ print_reagent_default_message = FALSE var/datum/reagents/inhaled = target.get_inhaled_reagents() - if(inhaled && inhaled.total_volume) + if(inhaled && REAGENT_TOTAL_VOLUME(inhaled)) var/unknown = 0 - for(var/decl/material/reagent as anything in inhaled.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(inhaled)) if(reagent.scannable) print_reagent_default_message = FALSE . += "[capitalize(reagent.gas_name)] found in subject's breath." diff --git a/code/modules/scanners/health.dm b/code/modules/scanners/health.dm index 487327777b42..99d49d6bb72c 100644 --- a/code/modules/scanners/health.dm +++ b/code/modules/scanners/health.dm @@ -241,10 +241,10 @@ . += "[b]Reagent scan:[endb]" var/print_reagent_default_message = TRUE - if(H.reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(H.reagents)) var/unknown = 0 var/reagentdata[0] - for(var/decl/material/reagent as anything in H.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(H.reagents)) if(reagent.scannable) print_reagent_default_message = FALSE reagentdata[reagent.type] = "[round(REAGENT_VOLUME(H.reagents, reagent), 1)]u [reagent.use_name]" @@ -260,10 +260,10 @@ . += "Warning: Unknown substance[(unknown>1)?"s":""] detected in subject's blood." var/datum/reagents/touching_reagents = H.get_contact_reagents() - if(touching_reagents && touching_reagents.total_volume) + if(touching_reagents && REAGENT_TOTAL_VOLUME(touching_reagents)) var/unknown = 0 var/reagentdata[0] - for(var/decl/material/reagent as anything in touching_reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(touching_reagents)) if(reagent.scannable) print_reagent_default_message = FALSE reagentdata[reagent.type] = "[round(REAGENT_VOLUME(H.reagents, reagent), 1)]u [reagent.name]" @@ -279,9 +279,9 @@ . += "Warning: Unknown substance[(unknown>1)?"s":""] detected on subject's body." var/datum/reagents/ingested = H.get_ingested_reagents() - if(ingested && ingested.total_volume) + if(ingested && REAGENT_TOTAL_VOLUME(ingested)) var/unknown = 0 - for(var/decl/material/reagent as anything in ingested.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(ingested)) if(reagent.scannable) print_reagent_default_message = FALSE . += "[capitalize(reagent.use_name)] found in subject's stomach." @@ -292,9 +292,9 @@ . += "Non-medical reagent[(unknown > 1)?"s":""] found in subject's stomach." var/datum/reagents/inhaled = H.get_inhaled_reagents() - if(inhaled && inhaled.total_volume) + if(inhaled && REAGENT_TOTAL_VOLUME(inhaled)) var/unknown = 0 - for(var/decl/material/reagent as anything in inhaled.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(inhaled)) if(reagent.scannable) print_reagent_default_message = FALSE . += "[capitalize(reagent.use_name)] found in subject's lungs." diff --git a/code/modules/scanners/mass_spectrometer.dm b/code/modules/scanners/mass_spectrometer.dm index b1b194944993..6d66cacddbe4 100644 --- a/code/modules/scanners/mass_spectrometer.dm +++ b/code/modules/scanners/mass_spectrometer.dm @@ -17,11 +17,11 @@ /obj/item/scanner/spectrometer/on_update_icon() . = ..() icon_state = get_world_inventory_state() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) icon_state += "_loaded" /obj/item/scanner/spectrometer/is_valid_scan_target(atom/O) - if(!O.reagents || !O.reagents.total_volume) + if(!O.reagents || !REAGENT_TOTAL_VOLUME(O.reagents)) return FALSE return (O.atom_flags & ATOM_FLAG_OPEN_CONTAINER) || istype(O, /obj/item/chems/syringe) @@ -38,22 +38,22 @@ /obj/item/scanner/spectrometer/attack_self(mob/user) if(!can_use(user)) return - if(reagents.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) scan(src, user) else ..() /proc/mass_spectrometer_scan(var/datum/reagents/reagents, mob/user, var/details) - if(!reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(reagents)) return SPAN_WARNING("No sample to scan.") var/list/blood_traces = list() var/list/blood_doses = list() - if(length(reagents.reagent_volumes) == 1 && istype(reagents.primary_reagent, /decl/material/liquid/random)) - var/decl/material/liquid/random/random = reagents.primary_reagent + var/decl/material/liquid/random/random = reagents.get_primary_reagent_decl() + if(length(REAGENT_VOLUMES(reagents)) == 1 && istype(random)) return random.get_scan_data(user) - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) if(!istype(reagent, /decl/material/liquid/blood)) return SPAN_WARNING("The sample was contaminated! Please insert another sample.") var/data = REAGENT_DATA(reagents, reagent) diff --git a/code/modules/scanners/plant.dm b/code/modules/scanners/plant.dm index e2768e691db6..fc532715c6ad 100644 --- a/code/modules/scanners/plant.dm +++ b/code/modules/scanners/plant.dm @@ -78,12 +78,13 @@ dat += "
" dat += "
Other Roles
Other Roles
[entry]
[uppertext(trait_name)][general_data[trait_name]]
" - if(LAZYLEN(grown_reagents?.reagent_volumes)) + var/grown_volumes = REAGENT_VOLUMES(grown_reagents) + if(LAZYLEN(grown_volumes)) dat += "

Reagent Data

" dat += "
This sample contains: " - for(var/decl/material/reagent as anything in grown_reagents.liquid_volumes) + for(var/decl/material/reagent as anything in REAGENT_LIQUID_VOLUMES(grown_reagents)) 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) + for(var/decl/material/reagent as anything in REAGENT_SOLID_VOLUMES(grown_reagents)) dat += "
- [reagent.get_reagent_name(grown_reagents, MAT_PHASE_SOLID)], [SOLID_VOLUME(grown_reagents, reagent)] unit(s)" dat += "

Other Data

" diff --git a/code/modules/scanners/reagents.dm b/code/modules/scanners/reagents.dm index 079117f25885..3252aea81854 100644 --- a/code/modules/scanners/reagents.dm +++ b/code/modules/scanners/reagents.dm @@ -17,11 +17,12 @@ /proc/reagent_scan_results(obj/O, details = 0) if(isnull(O.reagents)) return list("No significant chemical agents found in [O].") - if(!LAZYLEN(O.reagents.reagent_volumes)) + var/chem_volumes = REAGENT_VOLUMES(O.reagents) + if(!LAZYLEN(chem_volumes)) return list("No active chemical agents found in [O].") . = list("Chemicals found in [O]:") - var/one_percent = O.reagents.total_volume / 100 - for (var/decl/material/reagent as anything in O.reagents.reagent_volumes) + var/one_percent = REAGENT_TOTAL_VOLUME(O.reagents) / 100 + for (var/decl/material/reagent as anything in REAGENT_VOLUMES(O.reagents)) . += "[reagent.name][details ? ": [REAGENT_VOLUME(O.reagents, reagent) / one_percent]%" : ""]" /obj/item/scanner/reagent/adv diff --git a/code/modules/scent/_scent.dm b/code/modules/scent/_scent.dm index 68a96e3aa0b8..9af54db56df2 100644 --- a/code/modules/scent/_scent.dm +++ b/code/modules/scent/_scent.dm @@ -125,9 +125,9 @@ To add a scent extension to an atom using a reagent's info, where reagent. is th /proc/get_smelliest_reagent(var/datum/reagents/holder) var/decl/material/smelliest var/scent_intensity - if(!holder || !holder.total_volume) + if(!holder || !REAGENT_TOTAL_VOLUME(holder)) return - for(var/decl/material/reagent as anything in holder.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(holder)) if(!reagent.scent) continue var/decl/scent_intensity/scent = GET_DECL(reagent.scent_intensity) diff --git a/code/modules/species/species.dm b/code/modules/species/species.dm index 799a656f84dc..b9e342c4225d 100644 --- a/code/modules/species/species.dm +++ b/code/modules/species/species.dm @@ -161,7 +161,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 var/decl/pronouns/default_pronouns var/list/available_pronouns = list( - /decl/pronouns, + /decl/pronouns/pseudoplural, /decl/pronouns/neuter/person, /decl/pronouns/female, /decl/pronouns/male @@ -591,7 +591,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 return var/randn = rand(1, 100) - skill_mod + state_mod - if(!target.can_slip() && randn <= 25) + if(target.can_slip() && randn <= 25) var/armor_check = 100 * target.get_blocked_ratio(affecting, BRUTE, damage = 20) target.apply_effect(push_mod, WEAKEN, armor_check) playsound(target.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) @@ -664,8 +664,9 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 // This assumes that if a pain-level has been defined it also has a list of emotes to go with it return pick(pain_emotes) -/decl/species/proc/handle_post_move(var/mob/living/human/H) - handle_exertion(H) +/decl/species/proc/handle_post_move(var/mob/living/human/H, exertion = TRUE) + if(exertion) + handle_exertion(H) /decl/species/proc/handle_exertion(mob/living/human/H) if (!exertion_effect_chance) diff --git a/code/modules/species/station/monkey.dm b/code/modules/species/station/monkey.dm index 60c0c3d97c74..8b49d6ffabfe 100644 --- a/code/modules/species/station/monkey.dm +++ b/code/modules/species/station/monkey.dm @@ -16,7 +16,6 @@ dusted_anim = "dust-m" death_message = "lets out a faint chimper as it collapses and stops moving..." - inherent_verbs = list(/mob/living/proc/ventcrawl) species_hud = /datum/hud_data/monkey butchery_data = /decl/butchery_data/humanoid/monkey diff --git a/code/modules/submaps/submap_join.dm b/code/modules/submaps/submap_join.dm index 4b1b6d3a4420..6698813bdd5e 100644 --- a/code/modules/submaps/submap_join.dm +++ b/code/modules/submaps/submap_join.dm @@ -29,10 +29,6 @@ to_chat(joining, SPAN_WARNING("You are banned from playing offstation roles.")) return FALSE - if(job.is_semi_antagonist && jobban_isbanned(joining, /decl/special_role/provocateur)) - to_chat(joining, SPAN_WARNING("You are banned from playing semi-antagonist roles.")) - return FALSE - if(job.is_restricted(joining.client.prefs, joining)) return FALSE @@ -112,7 +108,8 @@ global.universe.OnPlayerLatejoin(character) log_and_message_admins("has joined the round as offsite role [character.mind.assigned_role].", character) RAISE_EVENT(/decl/observ/submap_join, src, character, job) - if(character.cannot_stand()) equip_wheelchair(character) + if(character.cannot_stand()) + equip_wheelchair(character) job.post_equip_job_title(character, job.title) qdel(joining) diff --git a/code/modules/surgery/necrotic.dm b/code/modules/surgery/necrotic.dm index 32b74e3f5082..1a1ac046fccf 100644 --- a/code/modules/surgery/necrotic.dm +++ b/code/modules/surgery/necrotic.dm @@ -170,7 +170,7 @@ C.reagents.trans_to_holder(temp_reagents, amount) var/usable_amount = temp_reagents.has_reagent(/decl/material/liquid/regenerator) temp_reagents.clear_reagent(/decl/material/liquid/regenerator) //We'll manually calculate how much it should heal - temp_reagents.trans_to_mob(target, temp_reagents.total_volume, CHEM_INJECT) //And if there was something else, toss it in + temp_reagents.trans_to_mob(target, REAGENT_TOTAL_VOLUME(temp_reagents), CHEM_INJECT) //And if there was something else, toss it in if (usable_amount > 1) var/obj/item/organ/O = target.get_organ(target_organ) diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm index 684694d1406d..f172fa0e5999 100644 --- a/code/modules/surgery/other.dm +++ b/code/modules/surgery/other.dm @@ -207,7 +207,7 @@ var/temp_holder = new/obj() var/datum/reagents/temp_reagents = new(amount, temp_holder) container.reagents.trans_to_holder(temp_reagents, amount) - var/trans = temp_reagents.trans_to_mob(target, temp_reagents.total_volume, CHEM_INJECT) //technically it's contact, but the reagents are being applied to internal tissue + var/trans = temp_reagents.trans_to_mob(target, REAGENT_TOTAL_VOLUME(temp_reagents), CHEM_INJECT) //technically it's contact, but the reagents are being applied to internal tissue if (trans > 0) user.visible_message("[user] rubs [target]'s [affected.name] down with \the [tool]'s contents.", \ "You rub [target]'s [affected.name] down with \the [tool]'s contents.") @@ -240,15 +240,15 @@ if(!valid_container) return FALSE - if(!container.reagents?.total_volume) + if(!REAGENT_TOTAL_VOLUME(container.reagents)) return FALSE // This check means it's impure. - if(length(container.reagents.reagent_volumes) > length(sterilizing_reagents)) + if(length(REAGENT_VOLUMES(container.reagents)) > length(sterilizing_reagents)) return FALSE // Check if we have sterilizing reagents and -only- sterilizing reagents. - for(var/decl/material/reagent as anything in container.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(container.reagents)) if(!(reagent in sterilizing_reagents)) return FALSE . = TRUE diff --git a/code/modules/tools/archetypes/tool_item.dm b/code/modules/tools/archetypes/tool_item.dm index 31496c04010a..51f0d6ed62a2 100644 --- a/code/modules/tools/archetypes/tool_item.dm +++ b/code/modules/tools/archetypes/tool_item.dm @@ -89,4 +89,5 @@ LAZYADD(tool_strings, tool_string) if(length(tool_strings)) - . += "[gender == PLURAL ? "They look" : "It looks"] like [english_list(tool_strings)]." + var/decl/pronouns/tool_pronouns = get_pronouns() + . += "[tool_pronouns.He] [verb_agree_with_pronouns("look", tool_pronouns)] like [english_list(tool_strings)]." diff --git a/code/modules/turbolift/turbolift.dm b/code/modules/turbolift/turbolift.dm index 8f7e12a7c2e1..f343dce1d988 100644 --- a/code/modules/turbolift/turbolift.dm +++ b/code/modules/turbolift/turbolift.dm @@ -81,7 +81,7 @@ var/current_floor_index = floors.Find(current_floor) if(!target_floor) - if(!queued_floors || !queued_floors.len) + if(!LAZYLEN(queued_floors)) return 0 target_floor = queued_floors[1] queued_floors -= target_floor diff --git a/code/modules/vehicles/engine.dm b/code/modules/vehicles/engine.dm index 423db9ca032e..12b97929377a 100644 --- a/code/modules/vehicles/engine.dm +++ b/code/modules/vehicles/engine.dm @@ -98,14 +98,14 @@ /// 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) + if(!reagents || REAGENT_TOTAL_VOLUME(reagents) <= 0 || broken) return FALSE - reagents.trans_to_holder(combustion_chamber, min(reagents.total_volume, 15)) + reagents.trans_to_holder(combustion_chamber, min(REAGENT_TOTAL_VOLUME(reagents), 15)) var/multiplier = 0 var/actually_flammable = FALSE - for(var/decl/material/reagent as anything in temp_reagents_holder.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(temp_reagents_holder.reagents)) var/new_multiplier = 1 - var/reagent_volume = combustion_chamber.reagent_volumes[reagent] + var/reagent_volume = REAGENT_VOLUME(combustion_chamber, 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 diff --git a/code/modules/xenoarcheaology/artifacts/artifact.dm b/code/modules/xenoarcheaology/artifacts/artifact.dm index 96f468938b7b..333048a96932 100644 --- a/code/modules/xenoarcheaology/artifacts/artifact.dm +++ b/code/modules/xenoarcheaology/artifacts/artifact.dm @@ -136,7 +136,7 @@ /obj/structure/artifact/fluid_act(datum/reagents/fluids) ..() - if(!QDELETED(src) && fluids?.total_volume) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids)) check_triggers(/datum/artifact_trigger/proc/on_fluid_act, fluids) // Premade subtypes for mapping or testing. diff --git a/code/modules/xenoarcheaology/machinery/geosample_scanner.dm b/code/modules/xenoarcheaology/machinery/geosample_scanner.dm index 28ec8b72504c..e79e3137f854 100644 --- a/code/modules/xenoarcheaology/machinery/geosample_scanner.dm +++ b/code/modules/xenoarcheaology/machinery/geosample_scanner.dm @@ -78,14 +78,14 @@ //#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 = used_item - var/amount_transferred = min(src.reagents.maximum_volume - src.reagents.total_volume, G.reagents.total_volume) + var/amount_transferred = min(REAGENT_MAXIMUM_VOLUME(reagents) - REAGENT_TOTAL_VOLUME(src.reagents), REAGENT_TOTAL_VOLUME(G.reagents)) 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 = used_item - var/amount_transferred = min(G.reagents.maximum_volume - G.reagents.total_volume, src.reagents.total_volume) + var/amount_transferred = min(REAGENT_MAXIMUM_VOLUME(G.reagents) - REAGENT_TOTAL_VOLUME(G.reagents), REAGENT_TOTAL_VOLUME(src.reagents)) src.reagents.trans_to(G, amount_transferred) to_chat(user, SPAN_INFO("You remove [amount_transferred]u of coolant from [src].")) update_coolant() @@ -112,7 +112,7 @@ fresh_coolant = 0 coolant_purity = 0 var/num_reagent_types = 0 - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) var/cur_purity = coolant_reagents_purity[reagent.type] if(!cur_purity) cur_purity = 0.1 @@ -144,7 +144,7 @@ // data["coolant_usage_rate"] = "[coolant_usage_rate]" data["unused_coolant_abs"] = round(fresh_coolant) - data["unused_coolant_per"] = round(fresh_coolant / reagents.maximum_volume * 100) + data["unused_coolant_per"] = round(fresh_coolant / REAGENT_MAXIMUM_VOLUME(reagents) * 100) data["coolant_purity"] = "[coolant_purity * 100]" // data["optimal_wavelength"] = round(optimal_wavelength) diff --git a/code/unit_tests/chemistry_tests.dm b/code/unit_tests/chemistry_tests.dm index 666048b0a0b4..83aedc6ed755 100644 --- a/code/unit_tests/chemistry_tests.dm +++ b/code/unit_tests/chemistry_tests.dm @@ -62,13 +62,13 @@ var/datum/reagents/checking = get_first_reagent_holder(from) if(!checking) return "first holder is null." - if(checking?.total_volume != from_remaining_target) - return "first holder should have [from_remaining_target]u remaining but has [checking.total_volume]u." + if(REAGENT_TOTAL_VOLUME(checking) != from_remaining_target) + return "first holder should have [from_remaining_target]u remaining but has [REAGENT_TOTAL_VOLUME(checking)]u." checking = get_second_reagent_holder(target) if(!checking) return "second holder is null." - if(checking?.total_volume != to_holding_target) - return "second holder should hold [to_holding_target]u but has [checking.total_volume]u." + if(REAGENT_TOTAL_VOLUME(checking) != to_holding_target) + return "second holder should hold [to_holding_target]u but has [REAGENT_TOTAL_VOLUME(checking)]u." /datum/unit_test/chemistry/proc/validate_holders(var/atom/from, var/atom/target) if(QDELETED(from)) @@ -219,7 +219,7 @@ // Cleanup pt. 2 chem_refs.Cut() - if(spawn_spot.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(spawn_spot.reagents)) spawn_spot.reagents.clear_reagents() failures += "- spawn turf had fluids post-test" diff --git a/code/unit_tests/codex.dm b/code/unit_tests/codex.dm index 2130edd1f887..5ce1cca35035 100644 --- a/code/unit_tests/codex.dm +++ b/code/unit_tests/codex.dm @@ -1,5 +1,5 @@ /datum/unit_test/codex_string_uniqueness - name = "CODEX: All Codex Associated Strings Shall Be Unique" + name = "CODEX: All Codex Associated Strings Shall Be Unique" /datum/unit_test/codex_string_uniqueness/start_test() var/list/failures = list() diff --git a/html/changelog.html b/html/changelog.html index b68d6c828dd7..6e4661c68847 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -52,16 +52,16 @@ -->
-

02 November 2025

-

MistakeNot4892 updated:

+

30 December 2025

+

Penelope Haze updated:

-

20 October 2025

+

02 November 2025

MistakeNot4892 updated:

diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml index c6ca91572aca..235786373a59 100644 --- a/html/changelogs/.all_changelog.yml +++ b/html/changelogs/.all_changelog.yml @@ -15048,3 +15048,7 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py. 2025-11-02: MistakeNot4892: - tweak: Drakes can no longer farm, but they can mine (in dirt). +2025-12-30: + Penelope Haze: + - tweak: Iron can now optionally be used instead of aluminum when filling sealant + tanks for sealant guns. diff --git a/html/changelogs/AutoChangeLog-pr-5223.yml b/html/changelogs/AutoChangeLog-pr-5223.yml new file mode 100644 index 000000000000..4a934dba46d3 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-5223.yml @@ -0,0 +1,5 @@ +author: Penelope Haze +changes: + - {admin: 'Kharmaan nymph jobbans now use the "Mantid Nymph" role in the jobban + menu, rather than the Semi-Antagonist role.'} +delete-after: true diff --git a/maps/exodus/exodus.dm b/maps/exodus/exodus.dm index 5a5d207d3c62..4308072cd477 100644 --- a/maps/exodus/exodus.dm +++ b/maps/exodus/exodus.dm @@ -14,8 +14,10 @@ #include "../../mods/content/mouse_highlights/_mouse_highlight.dme" #include "../../mods/content/pheromones/_pheromones.dme" #include "../../mods/content/psionics/_psionics.dme" + #include "../../mods/content/sealant_gun/_sealant_gun.dme" #include "../../mods/content/standard_jobs/_standard_jobs.dme" #include "../../mods/content/supermatter/_supermatter.dme" + #include "../../mods/content/ventcrawl/_ventcrawl.dme" #include "../../mods/content/xenobiology/_xenobiology.dme" #include "../../mods/content/tabloids/_tabloids.dme" diff --git a/maps/exodus/exodus_areas.dm b/maps/exodus/exodus_areas.dm index 29ba42a4e778..336403c6218d 100644 --- a/maps/exodus/exodus_areas.dm +++ b/maps/exodus/exodus_areas.dm @@ -86,8 +86,8 @@ req_access = list(access_engine) /area/exodus/solar - requires_power = 1 - always_unpowered = 1 + requires_power = TRUE + always_unpowered = TRUE has_gravity = FALSE base_turf = /turf/space diff --git a/maps/ministation/ministation-0.dmm b/maps/ministation/ministation-0.dmm index ac11d915541d..fc9f404b88e2 100644 --- a/maps/ministation/ministation-0.dmm +++ b/maps/ministation/ministation-0.dmm @@ -7267,7 +7267,7 @@ /turf/floor/laminate, /area/ministation/engine) "EM" = ( -/obj/item/boombox, +/obj/item/music_player/boombox, /obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ dir = 4 }, diff --git a/maps/ministation/ministation.dm b/maps/ministation/ministation.dm index 87ebbd49b8d8..f4aafdce3206 100644 --- a/maps/ministation/ministation.dm +++ b/maps/ministation/ministation.dm @@ -30,8 +30,10 @@ Twice... #include "../../mods/content/mouse_highlights/_mouse_highlight.dme" #include "../../mods/content/pheromones/_pheromones.dme" #include "../../mods/content/psionics/_psionics.dme" + #include "../../mods/content/sealant_gun/_sealant_gun.dme" #include "../../mods/content/standard_jobs/_standard_jobs.dme" #include "../../mods/content/supermatter/_supermatter.dme" + #include "../../mods/content/ventcrawl/_ventcrawl.dme" #include "../../mods/content/xenobiology/_xenobiology.dme" #include "../../mods/gamemodes/cult/_cult.dme" diff --git a/maps/ministation/space.dmm b/maps/ministation/space.dmm index 54f8c3513fd8..f97b25e1675d 100644 --- a/maps/ministation/space.dmm +++ b/maps/ministation/space.dmm @@ -47,7 +47,7 @@ /turf/floor/shuttle/blue, /area/shuttle/escape_shuttle) "am" = ( -/obj/item/boombox, +/obj/item/music_player/boombox, /obj/structure/table/steel_reinforced, /turf/floor/shuttle/blue, /area/shuttle/escape_shuttle) diff --git a/maps/modpack_testing/modpack_testing.dm b/maps/modpack_testing/modpack_testing.dm index 646040cda09e..28b2618475fe 100644 --- a/maps/modpack_testing/modpack_testing.dm +++ b/maps/modpack_testing/modpack_testing.dm @@ -3,6 +3,7 @@ #include "modpack_testing_lobby.dm" #include "blank.dmm" + #include "../../mods/content/actors.dm" #include "../../mods/content/mundane.dm" #include "../../mods/content/scaling_descriptors.dm" @@ -27,11 +28,13 @@ #include "../../mods/content/pheromones/_pheromones.dme" #include "../../mods/content/plant_dissection/_plant_dissection.dme" #include "../../mods/content/psionics/_psionics.dme" + #include "../../mods/content/sealant_gun/_sealant_gun.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/undead/_undead.dme" + #include "../../mods/content/ventcrawl/_ventcrawl.dme" #include "../../mods/content/xenobiology/_xenobiology.dme" #include "../../mods/content/blacksmithy/_blacksmithy.dme" #include "../../mods/content/item_sharpening/_item_sharpening.dme" @@ -63,6 +66,8 @@ #include "../../mods/species/utility_frames/_utility_frames.dme" #include "../../mods/species/vox/_vox.dme" + #include "../../mods/utility/prometheus_metrics/_prometheus_metrics.dme" + #define USING_MAP_DATUM /datum/map/modpack_testing #elif !defined(MAP_OVERRIDE) diff --git a/maps/tradeship/tradeship-2.dmm b/maps/tradeship/tradeship-2.dmm index 9285dbee4c68..3e2abcf9d90a 100644 --- a/maps/tradeship/tradeship-2.dmm +++ b/maps/tradeship/tradeship-2.dmm @@ -5429,7 +5429,7 @@ /obj/item/backpack/dufflebag/syndie, /obj/item/box/ammo/shotgunshells, /obj/item/handcuffs, -/obj/item/boombox, +/obj/item/music_player/boombox, /obj/item/stack/tape_roll/barricade_tape/bureaucracy, /obj/machinery/keycard_auth, /turf/floor/laminate, @@ -6623,7 +6623,7 @@ }, /obj/random/powercell, /obj/random/powercell, -/obj/item/boombox, +/obj/item/music_player/boombox, /turf/floor/tiled/techfloor/grid, /area/ship/trade/maintenance/power) "Jg" = ( diff --git a/maps/tradeship/tradeship.dm b/maps/tradeship/tradeship.dm index acaaf113f919..542a6dcb22f4 100644 --- a/maps/tradeship/tradeship.dm +++ b/maps/tradeship/tradeship.dm @@ -29,8 +29,10 @@ #include "../../mods/content/mouse_highlights/_mouse_highlight.dme" #include "../../mods/content/pheromones/_pheromones.dme" #include "../../mods/content/psionics/_psionics.dme" + #include "../../mods/content/sealant_gun/_sealant_gun.dme" #include "../../mods/content/standard_jobs/_standard_jobs.dme" #include "../../mods/content/supermatter/_supermatter.dme" + #include "../../mods/content/ventcrawl/_ventcrawl.dme" #include "../../mods/content/xenobiology/_xenobiology.dme" #include "../../mods/gamemodes/cult/_cult.dme" diff --git a/maps/~mapsystem/maps.dm b/maps/~mapsystem/maps.dm index c09d5bc24880..04ce37b278c6 100644 --- a/maps/~mapsystem/maps.dm +++ b/maps/~mapsystem/maps.dm @@ -157,14 +157,15 @@ var/global/const/MAP_HAS_RANK = 2 //Rank system, also toggleable /decl/background_category/religion = /decl/background_detail/religion/other ) + // Order must conform to ACCESS_REGION_FOO defines. var/access_modify_region = list( - ACCESS_REGION_SECURITY = list(access_hos, access_change_ids), - ACCESS_REGION_MEDBAY = list(access_cmo, access_change_ids), - ACCESS_REGION_RESEARCH = list(access_rd, access_change_ids), - ACCESS_REGION_ENGINEERING = list(access_ce, access_change_ids), - ACCESS_REGION_COMMAND = list(access_change_ids), - ACCESS_REGION_GENERAL = list(access_change_ids), - ACCESS_REGION_SUPPLY = list(access_change_ids) + list(access_hos, access_change_ids), + list(access_cmo, access_change_ids), + list(access_rd, access_change_ids), + list(access_ce, access_change_ids), + list(access_change_ids), + list(access_change_ids), + list(access_change_ids) ) var/secrets_directory diff --git a/code/game/antagonist/outsider/actors.dm b/mods/content/actors.dm similarity index 82% rename from code/game/antagonist/outsider/actors.dm rename to mods/content/actors.dm index c18e449a882d..fbb88bad4975 100644 --- a/code/game/antagonist/outsider/actors.dm +++ b/mods/content/actors.dm @@ -1,3 +1,10 @@ +#ifndef MODPACK_ACTORS +#define MODPACK_ACTORS +#endif + +/decl/modpack/actors + name = "Actor Special Role" + /decl/special_role/actor name = "Actor" name_plural = "Actors" @@ -8,12 +15,15 @@ hard_cap_round = 10 initial_spawn_req = 1 initial_spawn_target = 1 - show_objectives_on_creation = 0 //actors are not antagonists and do not need the antagonist greet text + show_objectives_on_creation = FALSE //actors are not antagonists and do not need the antagonist greet text required_language = /decl/language/human/common default_outfit = /decl/outfit/actor default_access = list() id_title = "Actor" +/obj/abstract/landmark/actor_spawn + name = "ActorSpawn" + /decl/outfit/actor name = "Special Role - Actor" uniform = /obj/item/clothing/jumpsuit/chameleon @@ -37,6 +47,10 @@ if(!MayRespawn(1) || !actors.can_become_antag(usr.mind, 1)) return + if(!LAZYLEN(actors.starting_locations)) + to_chat(usr, "Actors do not have a spawn location on this map, and are unavailable.") + return + var/choice = alert("Are you sure you'd like to join as an actor?", "Confirmation","Yes", "No") if(choice != "Yes") return diff --git a/mods/content/beekeeping/hive_frame.dm b/mods/content/beekeeping/hive_frame.dm index e126ec1a7fa2..35ffd429777c 100644 --- a/mods/content/beekeeping/hive_frame.dm +++ b/mods/content/beekeeping/hive_frame.dm @@ -8,7 +8,7 @@ /obj/item/hive_frame/on_reagent_change() . = ..() - if(reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(reagents)) SetName("filled [initial(name)] ([reagents.get_primary_reagent_name()])") else SetName(initial(name)) @@ -19,7 +19,7 @@ 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) + if(REAGENT_TOTAL_VOLUME(reagents)) 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)) @@ -28,8 +28,8 @@ /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) + if(REAGENT_TOTAL_VOLUME(reagents)) + reagents.trans_to_holder(centrifuge.loaded_beaker.reagents, REAGENT_TOTAL_VOLUME(reagents)) for(var/obj/item/thing in contents) thing.dropInto(centrifuge.loc) if(destroy_on_centrifuge) @@ -52,4 +52,4 @@ /obj/item/hive_frame/crafted/filled/populate_reagents() . = ..() - reagents.add_reagent(/decl/material/liquid/nutriment/honey, reagents?.maximum_volume) + reagents.add_reagent(/decl/material/liquid/nutriment/honey, REAGENT_MAXIMUM_VOLUME(reagents)) diff --git a/mods/content/beekeeping/hives/_hive.dm b/mods/content/beekeeping/hives/_hive.dm index 1ace43bbe1cf..990d148a16f9 100644 --- a/mods/content/beekeeping/hives/_hive.dm +++ b/mods/content/beekeeping/hives/_hive.dm @@ -71,7 +71,7 @@ to_chat(user, "There is no place for an another frame.") return TRUE var/obj/item/hive_frame/crafted/H = used_item - if(H.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(H.reagents)) to_chat(user, "\The [used_item] is full with beeswax and honey, empty it in the extractor first.") return TRUE ++frames diff --git a/mods/content/bigpharma/extension.dm b/mods/content/bigpharma/extension.dm index 81ed07f56055..04c672fa51af 100644 --- a/mods/content/bigpharma/extension.dm +++ b/mods/content/bigpharma/extension.dm @@ -35,7 +35,7 @@ /datum/extension/obfuscated_medication/pill_bottle/get_original_reagent(var/obj/item/donor) for(var/obj/item/chems/pill/pill in donor?.contents) - if(pill.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(pill.reagents)) return pill.reagents.get_primary_reagent_name(codex = TRUE) /datum/extension/obfuscated_medication/pill_bottle/update_appearance() @@ -48,7 +48,7 @@ /datum/extension/obfuscated_medication/foil_pack/get_original_reagent(var/obj/item/donor) for(var/obj/item/chems/pill/pill in donor?.contents) - if(pill.reagents?.total_volume) + if(REAGENT_TOTAL_VOLUME(pill.reagents)) return pill.reagents.get_primary_reagent_name(codex = TRUE) /datum/extension/obfuscated_medication/foil_pack/update_appearance() diff --git a/mods/content/blacksmithy/barrel_rim.dm b/mods/content/blacksmithy/barrel_rim.dm index 4dca740435dc..0175a04d3e02 100644 --- a/mods/content/blacksmithy/barrel_rim.dm +++ b/mods/content/blacksmithy/barrel_rim.dm @@ -36,7 +36,7 @@ /obj/structure/reagent_dispensers/barrel/on_reagent_change() . = ..() - if(!metal_material && reagents?.total_volume) + if(!metal_material && REAGENT_TOTAL_VOLUME(reagents)) physically_destroyed() // Adding a rim to a crafted barrel. diff --git a/mods/content/dungeon_loot/loot_pile.dm b/mods/content/dungeon_loot/loot_pile.dm index 5289e4ea5aa2..7944fbcb6986 100644 --- a/mods/content/dungeon_loot/loot_pile.dm +++ b/mods/content/dungeon_loot/loot_pile.dm @@ -28,7 +28,7 @@ /obj/structure/loot_pile/Initialize() var/list/icon_states_to_use = get_icon_states_to_use() - if(icon_states_to_use && icon_states_to_use.len) + if(LAZYLEN(icon_states_to_use)) icon_state = pick(icon_states_to_use) . = ..() diff --git a/mods/content/integrated_electronics/components/input.dm b/mods/content/integrated_electronics/components/input.dm index 8d4d8995f115..f39d70cfb867 100644 --- a/mods/content/integrated_electronics/components/input.dm +++ b/mods/content/integrated_electronics/components/input.dm @@ -351,8 +351,8 @@ var/mr = 0 var/tr = 0 if(H.reagents) - mr = H.reagents.maximum_volume - tr = H.reagents.total_volume + mr = REAGENT_MAXIMUM_VOLUME(H.reagents) + tr = REAGENT_TOTAL_VOLUME(H.reagents) set_pin_data(IC_OUTPUT, 6, mr) set_pin_data(IC_OUTPUT, 7, tr) set_pin_data(IC_OUTPUT, 8, H.density) diff --git a/mods/content/integrated_electronics/components/power_passive.dm b/mods/content/integrated_electronics/components/power_passive.dm index 7a855c5a366d..5dd6cf487560 100644 --- a/mods/content/integrated_electronics/components/power_passive.dm +++ b/mods/content/integrated_electronics/components/power_passive.dm @@ -121,7 +121,7 @@ /obj/item/integrated_circuit/passive/power/chemical_cell/on_reagent_change(changetype) if(!(. = ..())) return - set_pin_data(IC_OUTPUT, 1, reagents?.total_volume || 0) + set_pin_data(IC_OUTPUT, 1, REAGENT_TOTAL_VOLUME(reagents)) push_data() /obj/item/integrated_circuit/passive/power/chemical_cell/make_energy() diff --git a/mods/content/integrated_electronics/components/reagents.dm b/mods/content/integrated_electronics/components/reagents.dm index 3cce58ca5c6a..4a28e7772bb2 100644 --- a/mods/content/integrated_electronics/components/reagents.dm +++ b/mods/content/integrated_electronics/components/reagents.dm @@ -13,11 +13,11 @@ /obj/item/integrated_circuit/reagent/Initialize() . = ..() - if(reagents?.maximum_volume) + if(REAGENT_MAXIMUM_VOLUME(reagents)) push_vol() /obj/item/integrated_circuit/reagent/proc/push_vol() - set_pin_data(IC_OUTPUT, 1, reagents?.total_volume || 0) + set_pin_data(IC_OUTPUT, 1, REAGENT_TOTAL_VOLUME(reagents)) push_data() /obj/item/integrated_circuit/reagent/smoke @@ -54,7 +54,7 @@ /obj/item/integrated_circuit/reagent/smoke/do_work(ord) switch(ord) if(1) - if(!reagents || (reagents.total_volume < IC_SMOKE_REAGENTS_MINIMUM_UNITS)) + if(!reagents || (REAGENT_TOTAL_VOLUME(reagents) < IC_SMOKE_REAGENTS_MINIMUM_UNITS)) return var/location = get_turf(src) var/datum/effect/effect/system/smoke_spread/chem/S = new @@ -115,7 +115,7 @@ else direction_mode = IC_REAGENTS_INJECT if(isnum(new_amount)) - new_amount = clamp(new_amount, 0, reagents.maximum_volume) + new_amount = clamp(new_amount, 0, REAGENT_MAXIMUM_VOLUME(reagents)) transfer_amount = new_amount @@ -175,7 +175,7 @@ return if(direction_mode == IC_REAGENTS_INJECT) - if(!reagents.total_volume || !AM.reagents || !REAGENTS_FREE_SPACE(AM.reagents)) + if(!REAGENT_TOTAL_VOLUME(reagents) || !REAGENTS_FREE_SPACE(AM?.reagents)) activate_pin(3) return @@ -204,7 +204,7 @@ reagents.trans_to(AM, transfer_amount) else if(direction_mode == IC_REAGENTS_DRAW) - if(reagents.total_volume >= reagents.maximum_volume) + if(REAGENT_TOTAL_VOLUME(reagents) >= REAGENT_MAXIMUM_VOLUME(reagents)) acting_object.visible_message("\The [acting_object] tries to draw from [AM], but the injector is full.") activate_pin(3) return @@ -217,7 +217,7 @@ var/injection_delay = 3 SECONDS if(injection_status == INJECTION_PORT) injection_delay += INJECTION_PORT_DELAY - if(!H.vessel?.total_volume || !injection_status) + if(!REAGENT_TOTAL_VOLUME(H.vessel) || !injection_status) activate_pin(3) return H.visible_message( @@ -228,7 +228,7 @@ return else - if(!AM.reagents.total_volume) + if(!REAGENT_TOTAL_VOLUME(AM.reagents)) acting_object.visible_message("\The [acting_object] tries to draw from [AM], but it is empty!") activate_pin(3) return @@ -236,7 +236,7 @@ if(!ATOM_IS_OPEN_CONTAINER(AM)) activate_pin(3) return - tramount = min(tramount, AM.reagents.total_volume) + tramount = min(tramount, REAGENT_TOTAL_VOLUME(AM.reagents)) AM.reagents.trans_to(src, tramount) activate_pin(2) @@ -372,7 +372,7 @@ push_data() /obj/item/integrated_circuit/reagent/storage/grinder/proc/grind() - if(reagents.total_volume >= reagents.maximum_volume) + if(REAGENT_TOTAL_VOLUME(reagents) >= REAGENT_MAXIMUM_VOLUME(reagents)) activate_pin(3) return FALSE var/obj/item/I = get_pin_data_as_type(IC_INPUT, 1, /obj/item) @@ -380,12 +380,12 @@ if(isnull(I)) return FALSE - if(!I.reagents || !I.reagents.total_volume) + if(!I.reagents || !REAGENT_TOTAL_VOLUME(I.reagents)) activate_pin(3) return FALSE - I.reagents.trans_to(src,I.reagents.total_volume) - if(!I.reagents.total_volume) + I.reagents.trans_to(src,REAGENT_TOTAL_VOLUME(I.reagents)) + if(!REAGENT_TOTAL_VOLUME(I.reagents)) qdel(I) activate_pin(2) @@ -415,7 +415,7 @@ switch(ord) if(1) var/cont[0] - for(var/decl/material/reagent as anything in reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(reagents)) cont += reagent.name set_pin_data(IC_OUTPUT, 3, cont) push_data() @@ -478,10 +478,10 @@ if(!ATOM_IS_OPEN_CONTAINER(source) || ismob(source)) return - if(target.reagents.maximum_volume - target.reagents.total_volume <= 0) + if(REAGENT_MAXIMUM_VOLUME(target.reagents) - REAGENT_TOTAL_VOLUME(target.reagents) <= 0) return - for(var/decl/material/reagent as anything in source.reagents.reagent_volumes) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(source.reagents)) if(!direction_mode) if(reagent.name in demand) source.reagents.trans_type_to(target, reagent, transfer_amount) diff --git a/mods/content/plant_dissection/grown.dm b/mods/content/plant_dissection/grown.dm index f4c6ea359e00..30e778599fbc 100644 --- a/mods/content/plant_dissection/grown.dm +++ b/mods/content/plant_dissection/grown.dm @@ -93,7 +93,7 @@ if(!can_dissect || !(segment in segments)) return - if(reagents?.total_volume && segment.contributes_to_reagents) + if(REAGENT_TOTAL_VOLUME(reagents) && segment.contributes_to_reagents) for(var/rid in segment.reagents) reagents.remove_reagent(rid, segment.reagents[rid]) diff --git a/mods/content/psionics/_psionics.dme b/mods/content/psionics/_psionics.dme index d52fd0955164..523544804011 100644 --- a/mods/content/psionics/_psionics.dme +++ b/mods/content/psionics/_psionics.dme @@ -11,6 +11,7 @@ #include "datum\security_state.dm" #include "datum\surgery.dm" #include "datum\uplink.dm" +#include "datum\antagonists\beguiled.dm" #include "datum\antagonists\foundation.dm" #include "datum\antagonists\paramount.dm" #include "items\_items.dm" diff --git a/code/game/antagonist/station/thrall.dm b/mods/content/psionics/datum/antagonists/beguiled.dm similarity index 100% rename from code/game/antagonist/station/thrall.dm rename to mods/content/psionics/datum/antagonists/beguiled.dm diff --git a/mods/content/sealant_gun/_sealant_gun.dm b/mods/content/sealant_gun/_sealant_gun.dm new file mode 100644 index 000000000000..567a8cb4e5b7 --- /dev/null +++ b/mods/content/sealant_gun/_sealant_gun.dm @@ -0,0 +1,3 @@ +/decl/modpack/sealant_gun + name = "Sealant Gun" + desc = "Adds a sealant gun that can be used to launch globs of metal foam to immobilize enemies and seal hull breaches." \ No newline at end of file diff --git a/mods/content/sealant_gun/_sealant_gun.dme b/mods/content/sealant_gun/_sealant_gun.dme new file mode 100644 index 000000000000..1531c31d431f --- /dev/null +++ b/mods/content/sealant_gun/_sealant_gun.dme @@ -0,0 +1,11 @@ +#ifndef CONTENT_PACK_SEALANT +#define CONTENT_PACK_SEALANT +// BEGIN_INCLUDE +#include "_sealant_gun.dm" +#include "sealant_glob.dm" +#include "sealant_gun.dm" +#include "sealant_injector.dm" +#include "sealant_rack.dm" +#include "sealant_tank.dm" +// END_INCLUDE +#endif \ No newline at end of file diff --git a/icons/effects/sealant.dmi b/mods/content/sealant_gun/icons/sealant_glob.dmi similarity index 100% rename from icons/effects/sealant.dmi rename to mods/content/sealant_gun/icons/sealant_glob.dmi diff --git a/icons/obj/guns/sealant_gun.dmi b/mods/content/sealant_gun/icons/sealant_gun.dmi similarity index 100% rename from icons/obj/guns/sealant_gun.dmi rename to mods/content/sealant_gun/icons/sealant_gun.dmi diff --git a/icons/obj/structures/sealant_props.dmi b/mods/content/sealant_gun/icons/sealant_props.dmi similarity index 100% rename from icons/obj/structures/sealant_props.dmi rename to mods/content/sealant_gun/icons/sealant_props.dmi diff --git a/icons/obj/sealant_tank.dmi b/mods/content/sealant_gun/icons/sealant_tank.dmi similarity index 100% rename from icons/obj/sealant_tank.dmi rename to mods/content/sealant_gun/icons/sealant_tank.dmi diff --git a/code/modules/sealant_gun/sealant.dm b/mods/content/sealant_gun/sealant_glob.dm similarity index 92% rename from code/modules/sealant_gun/sealant.dm rename to mods/content/sealant_gun/sealant_glob.dm index 5a043f836a45..261bec5ee814 100644 --- a/code/modules/sealant_gun/sealant.dm +++ b/mods/content/sealant_gun/sealant_glob.dm @@ -1,7 +1,7 @@ /obj/item/sealant name = "glob of sealant" desc = "A blob of metal foam sealant." - icon = 'icons/effects/sealant.dmi' + icon = 'mods/content/sealant_gun/icons/sealant_glob.dmi' icon_state = ICON_STATE_WORLD color = "#cccdcc" slowdown_general = 3 @@ -31,6 +31,9 @@ to_chat(user, SPAN_DANGER("Hardened globs of metal foam stick to you!")) hardened = TRUE +/obj/item/sealant/blocks_speech_in_mouth(mob/wearer) + return TRUE + /obj/item/sealant/attack_hand(mob/user) SHOULD_CALL_PARENT(FALSE) break_apart(user) @@ -83,7 +86,7 @@ /obj/effect/sealant name = "sealant glob" desc = "A blob of metal foam sealant." - icon = 'icons/effects/sealant.dmi' + icon = 'mods/content/sealant_gun/icons/sealant_glob.dmi' icon_state = "blank" layer = PROJECTILE_LAYER color = "#cccdcc" diff --git a/code/modules/sealant_gun/sealant_gun.dm b/mods/content/sealant_gun/sealant_gun.dm similarity index 97% rename from code/modules/sealant_gun/sealant_gun.dm rename to mods/content/sealant_gun/sealant_gun.dm index cbe34aa3cb74..23a753cc0102 100644 --- a/code/modules/sealant_gun/sealant_gun.dm +++ b/mods/content/sealant_gun/sealant_gun.dm @@ -1,7 +1,7 @@ /obj/item/gun/launcher/sealant name = "sealant gun" desc = "A heavy, unwieldy device used to spray metal foam sealant onto hull breaches or damaged flooring." - icon = 'icons/obj/guns/sealant_gun.dmi' + icon = 'mods/content/sealant_gun/icons/sealant_gun.dmi' icon_state = ICON_STATE_WORLD autofire_enabled = TRUE has_safety = FALSE diff --git a/code/modules/sealant_gun/sealant_injector.dm b/mods/content/sealant_gun/sealant_injector.dm similarity index 84% rename from code/modules/sealant_gun/sealant_injector.dm rename to mods/content/sealant_gun/sealant_injector.dm index 6485f401a8f2..f5ad42b6ee86 100644 --- a/code/modules/sealant_gun/sealant_injector.dm +++ b/mods/content/sealant_gun/sealant_injector.dm @@ -1,12 +1,12 @@ /obj/item/chems/chem_disp_cartridge/foaming_agent/populate_reagents() - add_to_reagents(/decl/material/liquid/foaming_agent, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/foaming_agent, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/chem_disp_cartridge/polyacid/populate_reagents() - add_to_reagents(/decl/material/liquid/acid/polyacid, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/acid/polyacid, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/structure/sealant_injector name = "sealant tank injector" - icon = 'icons/obj/structures/sealant_props.dmi' + icon = 'mods/content/sealant_gun/icons/sealant_props.dmi' icon_state = "injector" density = TRUE anchored = TRUE @@ -63,18 +63,18 @@ to_chat(user, SPAN_WARNING("There is no tank loaded.")) return TRUE - var/fill_space = floor(loaded_tank.reagents?.maximum_volume - loaded_tank.reagents?.total_volume) / 5 + var/fill_space = floor(REAGENT_MAXIMUM_VOLUME(loaded_tank.reagents) - REAGENT_TOTAL_VOLUME(loaded_tank.reagents)) / 5 if(fill_space <= 0) to_chat(user, SPAN_WARNING("\The [loaded_tank] is full.")) return TRUE var/injected = FALSE for(var/obj/item/chems/chem_disp_cartridge/cart in cartridges) - if(cart.reagents?.total_volume <= cartridges[cart]) + if(REAGENT_TOTAL_VOLUME(cart.reagents) <= cartridges[cart]) visible_message("\The [src] flashes a red 'empty' light above \the [cart].") continue injected = TRUE - cart.reagents.trans_to_holder(loaded_tank.reagents, min(cart.reagents.total_volume, cartridges[cart] * fill_space)) + cart.reagents.trans_to_holder(loaded_tank.reagents, min(REAGENT_TOTAL_VOLUME(cart.reagents), cartridges[cart] * fill_space)) if(injected) playsound(loc, 'sound/effects/refill.ogg', 50, 1) diff --git a/code/modules/sealant_gun/sealant_rack.dm b/mods/content/sealant_gun/sealant_rack.dm similarity index 96% rename from code/modules/sealant_gun/sealant_rack.dm rename to mods/content/sealant_gun/sealant_rack.dm index 84e925a7acdc..776591fc94da 100644 --- a/code/modules/sealant_gun/sealant_rack.dm +++ b/mods/content/sealant_gun/sealant_rack.dm @@ -1,6 +1,6 @@ /obj/structure/sealant_rack name = "sealant tank rack" - icon = 'icons/obj/structures/sealant_props.dmi' + icon = 'mods/content/sealant_gun/icons/sealant_props.dmi' icon_state = "rack" density = TRUE anchored = TRUE diff --git a/code/modules/sealant_gun/sealant_tank.dm b/mods/content/sealant_gun/sealant_tank.dm similarity index 80% rename from code/modules/sealant_gun/sealant_tank.dm rename to mods/content/sealant_gun/sealant_tank.dm index 7dce9db17401..0356c7e24a8c 100644 --- a/code/modules/sealant_gun/sealant_tank.dm +++ b/mods/content/sealant_gun/sealant_tank.dm @@ -1,14 +1,14 @@ /obj/item/sealant_tank name = "sealant tank" desc = "A sealed tank used to keep hull sealant foam contained under pressure." - icon = 'icons/obj/sealant_tank.dmi' + icon = 'mods/content/sealant_gun/icons/sealant_tank.dmi' icon_state = "tank" material = /decl/material/solid/metal/steel chem_volume = 60 /obj/item/sealant_tank/on_update_icon() . = ..() - add_overlay("fill_[floor((reagents.total_volume/reagents.maximum_volume) * 5)]") + add_overlay("fill_[floor((REAGENT_TOTAL_VOLUME(reagents)/REAGENT_MAXIMUM_VOLUME(reagents)) * 5)]") /obj/item/sealant_tank/get_examine_strings(mob/user, distance, infix, suffix) . = ..() @@ -16,7 +16,7 @@ . += SPAN_NOTICE("\The [src] has about [REAGENT_VOLUME(reagents, /decl/material/liquid/foam) || 0] charge\s of sealant left.") /obj/item/sealant_tank/mapped/populate_reagents() - reagents.add_reagent(/decl/material/liquid/foam, reagents.maximum_volume) + reagents.add_reagent(/decl/material/liquid/foam, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/sealant_tank/physically_destroyed(var/skip_qdel) var/turf/my_turf = get_turf(src) diff --git a/mods/content/shackles/laws_pref.dm b/mods/content/shackles/laws_pref.dm index 23fcfa6a6e2a..b92cbe5cc8d2 100644 --- a/mods/content/shackles/laws_pref.dm +++ b/mods/content/shackles/laws_pref.dm @@ -3,7 +3,7 @@ var/is_shackled = FALSE /datum/preferences/proc/get_lawset() - if(!laws || !laws.len) + if(!LAZYLEN(laws)) return var/datum/ai_laws/custom_lawset = new for(var/law in laws) diff --git a/mods/content/undead/mobs/undead_zombie.dm b/mods/content/undead/mobs/undead_zombie.dm index 8d98b7919d0b..e5be4b3f4064 100644 --- a/mods/content/undead/mobs/undead_zombie.dm +++ b/mods/content/undead/mobs/undead_zombie.dm @@ -52,7 +52,7 @@ limb.createwound(BURN, rand(limb.max_damage * 0.25, limb.max_damage * 0.5)) set_max_health(round(species.total_health / 2)) - vessel.remove_any(vessel.total_volume * rand(0.2, 0.5)) + vessel.remove_any(REAGENT_TOTAL_VOLUME(vessel) * rand(0.2, 0.5)) update_body() /mob/living/human/zombie diff --git a/mods/content/ventcrawl/_ventcrawl.dm b/mods/content/ventcrawl/_ventcrawl.dm new file mode 100644 index 000000000000..39e8885300d7 --- /dev/null +++ b/mods/content/ventcrawl/_ventcrawl.dm @@ -0,0 +1,3 @@ +/decl/modpack/ventcrawl + name = "Ventcrawling" + desc = "Adds the ability for certain mobs to crawl through vents and scrubbers and travel through pipe networks." \ No newline at end of file diff --git a/mods/content/ventcrawl/_ventcrawl.dme b/mods/content/ventcrawl/_ventcrawl.dme new file mode 100644 index 000000000000..4427041cd805 --- /dev/null +++ b/mods/content/ventcrawl/_ventcrawl.dme @@ -0,0 +1,12 @@ +#ifndef CONTENT_PACK_VENTCRAWL +#define CONTENT_PACK_VENTCRAWL +// BEGIN_INCLUDE +#include "_ventcrawl.dm" +#include "mob_overrides.dm" +#include "species_overrides.dm" +#include "ventcrawl_atmospherics.dm" +#include "ventcrawl_mob.dm" +#include "ventcrawl_multiz.dm" +#include "ventcrawl_verb.dm" +// END_INCLUDE +#endif diff --git a/mods/content/ventcrawl/mob_overrides.dm b/mods/content/ventcrawl/mob_overrides.dm new file mode 100644 index 000000000000..f75b523b1798 --- /dev/null +++ b/mods/content/ventcrawl/mob_overrides.dm @@ -0,0 +1,11 @@ +/mob/living/simple_animal/alien/Initialize() + . = ..() + verbs += /mob/living/proc/ventcrawl + +/mob/living/simple_animal/opossum/Initialize() + . = ..() + verbs += /mob/living/proc/ventcrawl + +/mob/living/simple_animal/passive/mouse/Initialize() + . = ..() + verbs += /mob/living/proc/ventcrawl diff --git a/mods/content/ventcrawl/species_overrides.dm b/mods/content/ventcrawl/species_overrides.dm new file mode 100644 index 000000000000..6516ab3f9e24 --- /dev/null +++ b/mods/content/ventcrawl/species_overrides.dm @@ -0,0 +1,2 @@ +/decl/species/monkey + inherent_verbs = list(/mob/living/proc/ventcrawl) \ No newline at end of file diff --git a/code/modules/ventcrawl/ventcrawl_atmospherics.dm b/mods/content/ventcrawl/ventcrawl_atmospherics.dm similarity index 100% rename from code/modules/ventcrawl/ventcrawl_atmospherics.dm rename to mods/content/ventcrawl/ventcrawl_atmospherics.dm diff --git a/code/modules/ventcrawl/ventcrawl.dm b/mods/content/ventcrawl/ventcrawl_mob.dm similarity index 96% rename from code/modules/ventcrawl/ventcrawl.dm rename to mods/content/ventcrawl/ventcrawl_mob.dm index b9548f48bb91..c5df94dd2da4 100644 --- a/code/modules/ventcrawl/ventcrawl.dm +++ b/mods/content/ventcrawl/ventcrawl_mob.dm @@ -67,7 +67,7 @@ var/global/list/ventcrawl_machinery = list( for(var/obj/machinery/atmospherics/unary/U in range(1)) if(is_type_in_list(U,ventcrawl_machinery) && Adjacent(U) && U.can_crawl_through()) pipes |= U - if(!pipes || !pipes.len) + if(!LAZYLEN(pipes)) to_chat(src, "There are no pipes that you can ventcrawl into within range!") return if(pipes.len == 1) @@ -152,3 +152,10 @@ var/global/list/ventcrawl_machinery = list( client.images -= current_image client.eye = src LAZYCLEARLIST(pipes_shown) + +/mob/living/Login() + . = ..() + //login during ventcrawl + if(is_ventcrawling && istype(loc, /obj/machinery/atmospherics)) //attach us back into the pipes + remove_ventcrawl() + add_ventcrawl(loc) \ No newline at end of file diff --git a/code/modules/ventcrawl/ventcrawl_multiz.dm b/mods/content/ventcrawl/ventcrawl_multiz.dm similarity index 100% rename from code/modules/ventcrawl/ventcrawl_multiz.dm rename to mods/content/ventcrawl/ventcrawl_multiz.dm diff --git a/code/modules/ventcrawl/ventcrawl_verb.dm b/mods/content/ventcrawl/ventcrawl_verb.dm similarity index 100% rename from code/modules/ventcrawl/ventcrawl_verb.dm rename to mods/content/ventcrawl/ventcrawl_verb.dm diff --git a/mods/content/xenobiology/colours/_colour.dm b/mods/content/xenobiology/colours/_colour.dm index 24a08bb42159..c5de84b8fbe1 100644 --- a/mods/content/xenobiology/colours/_colour.dm +++ b/mods/content/xenobiology/colours/_colour.dm @@ -25,12 +25,13 @@ if(!istype(core) || core.Uses <= 0) return - for(var/decl/material/reagent as anything in holder.reagent_volumes) - if(holder.reagent_volumes[reagent] < 1) + var/holder_volumes = REAGENT_VOLUMES(holder) + for(var/decl/material/reagent as anything in holder_volumes) + if(holder_volumes[reagent] < 1) continue var/call_proc = reaction_procs[reagent] if(call_proc && call(src, call_proc)(holder)) - holder.remove_reagent(reagent, holder.reagent_volumes[reagent]) + holder.remove_reagent(reagent, holder_volumes[reagent]) . = TRUE break diff --git a/mods/content/xenobiology/slime/_slime.dm b/mods/content/xenobiology/slime/_slime.dm index 37c5ebfb51bc..62197258a3bf 100644 --- a/mods/content/xenobiology/slime/_slime.dm +++ b/mods/content/xenobiology/slime/_slime.dm @@ -67,7 +67,6 @@ reagents = new /datum/reagents/metabolism(240, src, CHEM_TOUCH) render_target = "slime_\ref[src]" - verbs += /mob/living/proc/ventcrawl slime_type = _stype if(!ispath(slime_type, /decl/slime_colour)) @@ -322,12 +321,6 @@ ..() mind.assigned_role = "slime" -/mob/living/slime/can_ventcrawl() - if(feeding_on) - to_chat(src, SPAN_WARNING("You cannot ventcrawl while feeding.")) - return FALSE - . = ..() - /mob/living/slime/handle_airflow(differential, list/connecting_turfs, repelled) return FALSE diff --git a/mods/content/xenobiology/slime/items.dm b/mods/content/xenobiology/slime/items.dm index 3235d8b0c1b6..26304f3e971b 100644 --- a/mods/content/xenobiology/slime/items.dm +++ b/mods/content/xenobiology/slime/items.dm @@ -45,7 +45,7 @@ add_to_reagents(/decl/material/liquid/slimejelly, 30) /obj/item/slime_extract/on_reagent_change() - if((. = ..()) && reagents?.total_volume) + if((. = ..()) && REAGENT_TOTAL_VOLUME(reagents)) var/decl/slime_colour/slime_data = GET_DECL(slime_type) slime_data.handle_reaction(reagents) diff --git a/mods/content/xenobiology/slime/life.dm b/mods/content/xenobiology/slime/life.dm index d71a1d3edd4c..6cdecb39d6cc 100644 --- a/mods/content/xenobiology/slime/life.dm +++ b/mods/content/xenobiology/slime/life.dm @@ -51,7 +51,7 @@ /mob/living/slime/fluid_act(datum/reagents/fluids) . = ..() - if(!QDELETED(src) && fluids?.total_volume >= FLUID_SHALLOW && stat == DEAD) + if(!QDELETED(src) && REAGENT_TOTAL_VOLUME(fluids) >= FLUID_SHALLOW && stat == DEAD) var/turf/T = get_turf(src) if(T) T.add_to_reagents(/decl/material/liquid/slimejelly, (is_adult ? rand(30, 40) : rand(10, 30))) @@ -66,7 +66,7 @@ /mob/living/slime/fluid_act(datum/reagents/fluids) . = ..() - if(stat == DEAD && fluids?.total_volume && REAGENT_VOLUME(fluids, /decl/material/liquid/water) >= FLUID_SHALLOW) + if(stat == DEAD && REAGENT_TOTAL_VOLUME(fluids) && REAGENT_VOLUME(fluids, /decl/material/liquid/water) >= FLUID_SHALLOW) fluids.add_reagent(/decl/material/liquid/slimejelly, (is_adult ? rand(30, 40) : rand(10, 30))) visible_message(SPAN_DANGER("\The [src] melts away...")) // Slimes are water soluble. qdel(src) diff --git a/mods/gamemodes/cult/overrides.dm b/mods/gamemodes/cult/overrides.dm index 2d822d252c77..15029601185d 100644 --- a/mods/gamemodes/cult/overrides.dm +++ b/mods/gamemodes/cult/overrides.dm @@ -21,16 +21,6 @@ /mob/living/silicon/ai shouldnt_see = list(/obj/effect/rune) -// Vent crawling whitelisted items, whoo -/mob/living/Initialize() - . = ..() - can_enter_vent_with += list( - /obj/item/clothing/head/culthood, - /obj/item/clothing/suit/cultrobes, - /obj/item/book/tome, - /obj/item/sword/cultblade - ) - /obj/item/vampiric material = /decl/material/solid/stone/cult diff --git a/mods/gamemodes/cult/ritual.dm b/mods/gamemodes/cult/ritual.dm index 27c5390851a4..5d07ea311482 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(DATA_WATER_HOLINESS = FALSE)) + REAGENT_SET_DATA(A.reagents, /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 @@ -100,7 +100,7 @@ return 0 /mob/living/human/make_rune(var/rune, var/cost, var/tome_required) - if(should_have_organ(BP_HEART) && vessel && vessel.total_volume < species.blood_volume * 0.7) + if(should_have_organ(BP_HEART) && REAGENT_TOTAL_VOLUME(vessel) < species.blood_volume * 0.7) to_chat(src, "You are too weak to draw runes.") return ..() diff --git a/mods/gamemodes/cult/runes.dm b/mods/gamemodes/cult/runes.dm index 32cc1f3024f6..8b6ca53d09f8 100644 --- a/mods/gamemodes/cult/runes.dm +++ b/mods/gamemodes/cult/runes.dm @@ -519,7 +519,7 @@ victim = M if(!victim) return fizzle(user) - if(victim.vessel.total_volume < 20) + if(REAGENT_TOTAL_VOLUME(victim.vessel) < 20) to_chat(user, SPAN_WARNING("This body has no blood in it.")) return fizzle(user) victim.vessel.remove_any(20) @@ -534,7 +534,7 @@ var/list/statuses = list() var/charges = 20 var/use - use = min(charges, user.species.blood_volume - user.vessel.total_volume) + use = min(charges, user.species.blood_volume - REAGENT_TOTAL_VOLUME(user.vessel)) if(use > 0) user.adjust_blood(use) charges -= use diff --git a/mods/mobs/borers/mob/borer/borer.dm b/mods/mobs/borers/mob/borer/borer.dm index 379bbca678cc..344d5a07e231 100644 --- a/mods/mobs/borers/mob/borer/borer.dm +++ b/mods/mobs/borers/mob/borer/borer.dm @@ -88,7 +88,6 @@ . = ..() add_language(/decl/language/corticalborer) - verbs += /mob/living/proc/ventcrawl verbs += /mob/living/proc/hide generation = gen diff --git a/mods/mobs/dionaea/mob/gestalt/_gestalt.dm b/mods/mobs/dionaea/mob/gestalt/_gestalt.dm index d4216b018272..e57e20ef1918 100644 --- a/mods/mobs/dionaea/mob/gestalt/_gestalt.dm +++ b/mods/mobs/dionaea/mob/gestalt/_gestalt.dm @@ -26,7 +26,7 @@ /obj/structure/diona_gestalt/on_update_icon() ..() add_overlay(eyes_overlay) - if(nymphs && nymphs.len) + if(LAZYLEN(nymphs)) var/matrix/M = matrix() M.Scale(clamp(nymphs.len * 0.1, 1, 2)) transform = M diff --git a/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm b/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm index 4ec0c9cf890a..fea9e8e64f4c 100644 --- a/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm +++ b/mods/mobs/dionaea/mob/gestalt/gestalt_attacks.dm @@ -16,7 +16,7 @@ /obj/structure/diona_gestalt/explosion_act() SHOULD_CALL_PARENT(FALSE) var/shed_count = rand(1,3) - while(shed_count && nymphs && nymphs.len) + while(shed_count && LAZYLEN(nymphs)) shed_count-- shed_atom(forcefully = TRUE) diff --git a/mods/pyrelight/plants/plants_fruit.dm b/mods/pyrelight/plants/plants_fruit.dm index c68bfeb162cd..f6ac60541a6e 100644 --- a/mods/pyrelight/plants/plants_fruit.dm +++ b/mods/pyrelight/plants/plants_fruit.dm @@ -99,7 +99,7 @@ LAZYINITLIST(removed_segments) removed_segments[remove_comp]++ - if(reagents?.total_volume && remove_comp.contributes_to_fruit_reagents) + if(REAGENT_TOTAL_VOLUME(reagents) && remove_comp.contributes_to_fruit_reagents) for(var/rid in remove_comp.reagents) reagents.remove_reagent(rid, remove_comp.reagents[rid]) diff --git a/mods/species/adherent/datum/species.dm b/mods/species/adherent/datum/species.dm index a63f58ceaee3..89913e40651c 100644 --- a/mods/species/adherent/datum/species.dm +++ b/mods/species/adherent/datum/species.dm @@ -25,7 +25,7 @@ blood_types = list(/decl/blood_type/coolant) - available_pronouns = list(/decl/pronouns) + available_pronouns = list(/decl/pronouns/pseudoplural) available_bodytypes = list( /decl/bodytype/crystalline/adherent, /decl/bodytype/crystalline/adherent/emerald, diff --git a/mods/species/adherent/organs/organs_internal.dm b/mods/species/adherent/organs/organs_internal.dm index fc4c73332911..8719fee20b9b 100644 --- a/mods/species/adherent/organs/organs_internal.dm +++ b/mods/species/adherent/organs/organs_internal.dm @@ -61,7 +61,8 @@ var/obj/item/organ/internal/cell/cell = owner.get_organ(BP_CELL, /obj/item/organ/internal/cell) if(active && !(cell && cell.use(maintenance_cost))) active = FALSE - to_chat(owner, SPAN_DANGER("Your [name] [gender == PLURAL ? "are" : "is"] out of power!")) + var/decl/pronouns/pronouns = get_pronouns() + to_chat(owner, SPAN_DANGER("Your [name] [pronouns.is] out of power!")) refresh_action_button() /obj/item/organ/internal/powered/refresh_action_button() @@ -75,7 +76,8 @@ if(.) sound_to(user, sound('mods/species/adherent/sound/ding.ogg')) if(is_broken()) - to_chat(owner, "\The [src] [gender == PLURAL ? "are" : "is"] too damaged to function.") + var/decl/pronouns/pronouns = get_pronouns() + to_chat(owner, SPAN_WARNING("\The [src] [pronouns.is] too damaged to function.")) active = FALSE else active = !active diff --git a/mods/species/ascent/ascent.dm b/mods/species/ascent/ascent.dm index 611b84f81fc8..5678832ba712 100644 --- a/mods/species/ascent/ascent.dm +++ b/mods/species/ascent/ascent.dm @@ -4,7 +4,10 @@ #define BODY_EQUIP_FLAG_ALATE BITFLAG(4) #define BODY_EQUIP_FLAG_GYNE BITFLAG(5) -#define BP_SYSTEM_CONTROLLER "system controller" +#define BP_SYSTEM_CONTROLLER "system controller" +#define BP_EGG "egg sac" + +#define MANTID_NYMPH_BAN "Mantid Nymph" #define MANTIDIFY(_thing, _name, _desc) \ ##_thing/ascent/name = _name; \ @@ -13,3 +16,7 @@ /decl/modpack/ascent name = "The Ascent" + +/decl/modpack/ascent/pre_initialize() + global.misc_jobban_roles += MANTID_NYMPH_BAN + . = ..() \ No newline at end of file diff --git a/mods/species/ascent/machines/ship_machines.dm b/mods/species/ascent/machines/ship_machines.dm index 9b9da51a4acf..447467987067 100644 --- a/mods/species/ascent/machines/ship_machines.dm +++ b/mods/species/ascent/machines/ship_machines.dm @@ -53,10 +53,10 @@ MANTIDIFY(/obj/machinery/door/airlock/external/bolted, "mantid airlock", "door") MANTIDIFY(/obj/item/chems/chem_disp_cartridge, "canister", "chemical storage") /obj/item/chems/chem_disp_cartridge/ascent/crystal/populate_reagents() - add_to_reagents(/decl/material/liquid/crystal_agent, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/crystal_agent, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/item/chems/chem_disp_cartridge/ascent/bromide/populate_reagents() - add_to_reagents(/decl/material/liquid/bromide, reagents.maximum_volume) + add_to_reagents(/decl/material/liquid/bromide, REAGENT_MAXIMUM_VOLUME(reagents)) /obj/machinery/sleeper/ascent name = "mantid sleeper" diff --git a/mods/species/ascent/mobs/insectoid_egg.dm b/mods/species/ascent/mobs/insectoid_egg.dm index 5a9fba0cd993..f66efcbc97db 100644 --- a/mods/species/ascent/mobs/insectoid_egg.dm +++ b/mods/species/ascent/mobs/insectoid_egg.dm @@ -2,7 +2,7 @@ var/global/default_gyne /decl/ghosttrap/kharmaani_egg name = "mantid nymph" - ban_checks = list(/decl/special_role/provocateur) + ban_checks = list(MANTID_NYMPH_BAN) ghost_trap_message = "They are hatching from a kharmaan egg now." /decl/ghosttrap/kharmaani_egg/forced(var/mob/user) diff --git a/mods/species/drakes/drake_organs.dm b/mods/species/drakes/drake_organs.dm index 988fb597c48e..a1c6cab31cdf 100644 --- a/mods/species/drakes/drake_organs.dm +++ b/mods/species/drakes/drake_organs.dm @@ -20,16 +20,17 @@ /obj/item/organ/internal/drake_gizzard/Process() . = ..() - if(owner && owner.stat != DEAD && !is_broken() && sap_crop && sap_crop.total_volume < 10) + if(owner && owner.stat != DEAD && !is_broken() && sap_crop && REAGENT_TOTAL_VOLUME(sap_crop) < 10) sap_crop.add_reagent(/decl/material/liquid/sifsap, 0.5) /obj/item/organ/internal/drake_gizzard/do_uninstall(in_place, detach, ignore_children, update_icon) . = ..() - if(sap_crop?.total_volume) + var/sap_vol = REAGENT_TOTAL_VOLUME(sap_crop) + if(sap_vol) if(reagents) - sap_crop.trans_to_holder(reagents, sap_crop.total_volume) + sap_crop.trans_to_holder(reagents, sap_vol) else if(isatom(loc)) - sap_crop.splash(loc, sap_crop.total_volume) + sap_crop.splash(loc, sap_vol) sap_crop.clear_reagents() /obj/item/organ/internal/drake_gizzard/Destroy() @@ -37,4 +38,4 @@ . = ..() /obj/item/organ/internal/drake_gizzard/get_stat_info() - return list("Sap reserve", num2text(round((sap_crop?.total_volume || 0), 0.1))) + return list("Sap reserve", num2text(round((REAGENT_TOTAL_VOLUME(sap_crop) || 0), 0.1))) diff --git a/mods/species/drakes/sifsap.dm b/mods/species/drakes/sifsap.dm index 75f0315b71e9..a178721e6e89 100644 --- a/mods/species/drakes/sifsap.dm +++ b/mods/species/drakes/sifsap.dm @@ -1,6 +1,6 @@ /proc/drake_spend_sap(mob/living/user, amount) var/obj/item/organ/internal/drake_gizzard/gizzard = user.get_organ(BP_DRAKE_GIZZARD) - if(!gizzard?.sap_crop?.total_volume) + if(!REAGENT_TOTAL_VOLUME(gizzard?.sap_crop)) return FALSE if(!gizzard.sap_crop.has_reagent(/decl/material/liquid/sifsap, amount)) return FALSE @@ -9,13 +9,14 @@ /proc/drake_has_sap(mob/living/user, amount) var/obj/item/organ/internal/drake_gizzard/gizzard = user.get_organ(BP_DRAKE_GIZZARD) - return gizzard?.sap_crop?.total_volume >= amount + return REAGENT_TOTAL_VOLUME(gizzard?.sap_crop) >= amount /proc/drake_add_sap(mob/living/user, amount) var/obj/item/organ/internal/drake_gizzard/gizzard = user.get_organ(BP_DRAKE_GIZZARD) - if(!gizzard?.sap_crop?.maximum_volume) + var/max_volume = REAGENT_MAXIMUM_VOLUME(gizzard?.sap_crop) + if(!max_volume) return FALSE - if(LAZYACCESS(gizzard.sap_crop.reagent_volumes, /decl/material/liquid/sifsap) >= gizzard.sap_crop.maximum_volume) + if(REAGENT_VOLUME(gizzard.sap_crop, /decl/material/liquid/sifsap) >= max_volume) return FALSE gizzard.sap_crop.add_reagent(/decl/material/liquid/sifsap, amount) return TRUE diff --git a/mods/species/drakes/species.dm b/mods/species/drakes/species.dm index 6b0398df1865..2fb5e78536b1 100644 --- a/mods/species/drakes/species.dm +++ b/mods/species/drakes/species.dm @@ -16,7 +16,7 @@ snow_slowdown_mod = -0.5 gluttonous = GLUT_TINY available_pronouns = list( - /decl/pronouns, + /decl/pronouns/pseudoplural, /decl/pronouns/neuter, /decl/pronouns/male, /decl/pronouns/female diff --git a/mods/species/random_species/random_species_species.dm b/mods/species/random_species/random_species_species.dm index 3db442f8b108..841303920e65 100644 --- a/mods/species/random_species/random_species_species.dm +++ b/mods/species/random_species/random_species_species.dm @@ -67,7 +67,8 @@ //Misc traits if(prob(40)) - available_pronouns = list(/decl/pronouns) + // 50% chance of pseudoplural or actually plural + available_pronouns = list(pick(/decl/pronouns/pseudoplural, /decl/pronouns)) if(prob(10)) species_flags |= SPECIES_FLAG_NO_SLIP if(prob(10)) diff --git a/mods/species/serpentid/serpentid.dm b/mods/species/serpentid/serpentid.dm index 627bca7da6b1..84d299d55140 100644 --- a/mods/species/serpentid/serpentid.dm +++ b/mods/species/serpentid/serpentid.dm @@ -1,2 +1,6 @@ #define BODYTYPE_SNAKE "snakelike body" #define BODY_EQUIP_FLAG_SNAKE BITFLAG(12) +#define BP_TRACH "tracheae" + +/decl/modpack/serpentid + name = "Serpentid Species" \ No newline at end of file diff --git a/mods/species/skrell/datum/pronouns_skrell.dm b/mods/species/skrell/datum/pronouns_skrell.dm index 8fc3fd80c6f9..19b3ffc04f55 100644 --- a/mods/species/skrell/datum/pronouns_skrell.dm +++ b/mods/species/skrell/datum/pronouns_skrell.dm @@ -1,4 +1,5 @@ /decl/pronouns/skrell + uid = "pronouns_skrell" name = "Skrell" bureaucratic_term = "Skrell" informal_term = "Skrell" @@ -14,3 +15,4 @@ self = "vilself" s = "s" es = "es" + pluralize_verb = PLURALIZE_ALL diff --git a/mods/species/utility_frames/species.dm b/mods/species/utility_frames/species.dm index 7201f13c3cb5..367ddeccad7f 100644 --- a/mods/species/utility_frames/species.dm +++ b/mods/species/utility_frames/species.dm @@ -32,7 +32,7 @@ preview_outfit = null available_pronouns = list( - /decl/pronouns, + /decl/pronouns/pseudoplural, /decl/pronouns/neuter ) available_background_info = list( diff --git a/mods/species/vox/_vox.dm b/mods/species/vox/_vox.dm index 70f65067b0b4..dcf6527797dd 100644 --- a/mods/species/vox/_vox.dm +++ b/mods/species/vox/_vox.dm @@ -1,7 +1,10 @@ -#define BODYTYPE_VOX "reptoavian body" -#define BODYTYPE_VOX_LARGE "large reptoavian body" -#define BP_HINDTONGUE "hindtongue" -#define BODY_EQUIP_FLAG_VOX BITFLAG(8) +#define BODYTYPE_VOX "reptoavian body" +#define BODYTYPE_VOX_LARGE "large reptoavian body" +// Internal organs +#define BP_HINDTONGUE "hindtongue" +#define BP_VOXSTACK "vox stack" +// Bodytype equip flags +#define BODY_EQUIP_FLAG_VOX BITFLAG(8) /decl/modpack/vox name = "Vox Content" diff --git a/mods/species/vox/datum/species.dm b/mods/species/vox/datum/species.dm index ec9468a13420..e5f6c03faf25 100644 --- a/mods/species/vox/datum/species.dm +++ b/mods/species/vox/datum/species.dm @@ -79,7 +79,7 @@ available_pronouns = list( /decl/pronouns/neuter, /decl/pronouns/neuter/person, - /decl/pronouns, + /decl/pronouns/pseudoplural, /decl/pronouns/male, /decl/pronouns/female ) @@ -155,7 +155,7 @@ var/global/list/vox_current_pressure_toggle = list() /decl/species/vox/handle_death(var/mob/living/human/H) ..() - var/obj/item/organ/internal/voxstack/stack = H.get_organ(BP_STACK, /obj/item/organ/internal/voxstack) + var/obj/item/organ/internal/voxstack/stack = H.get_organ(BP_VOXSTACK, /obj/item/organ/internal/voxstack) if (stack) stack.do_backup() diff --git a/mods/species/vox/datum/species_bodytypes.dm b/mods/species/vox/datum/species_bodytypes.dm index 6aca9f46c5cc..c74d02b11967 100644 --- a/mods/species/vox/datum/species_bodytypes.dm +++ b/mods/species/vox/datum/species_bodytypes.dm @@ -26,7 +26,7 @@ ) vital_organs = list( - BP_STACK, + BP_VOXSTACK, BP_BRAIN ) override_limb_types = list( @@ -45,7 +45,7 @@ BP_KIDNEYS = /obj/item/organ/internal/kidneys/vox, BP_BRAIN = /obj/item/organ/internal/brain, BP_EYES = /obj/item/organ/internal/eyes/vox, - BP_STACK = /obj/item/organ/internal/voxstack, + BP_VOXSTACK = /obj/item/organ/internal/voxstack, BP_HINDTONGUE = /obj/item/organ/internal/hindtongue ) default_sprite_accessories = list( diff --git a/mods/species/vox/organs_vox.dm b/mods/species/vox/organs_vox.dm index 6329e755d250..29b4e15191e6 100644 --- a/mods/species/vox/organs_vox.dm +++ b/mods/species/vox/organs_vox.dm @@ -97,8 +97,8 @@ if(is_usable()) // Handle some post-metabolism reagent processing for generally inedible foods. - if(ingested.total_volume > 0) - for(var/decl/material/reagent as anything in ingested.reagent_volumes) + if(REAGENT_TOTAL_VOLUME(ingested) > 0) + for(var/decl/material/reagent as anything in REAGENT_VOLUMES(ingested)) var/inedible_nutriment_amount = gains_nutriment_from_inedible_reagents[reagent.type] if(inedible_nutriment_amount > 0) owner.adjust_nutrition(inedible_nutriment_amount) @@ -166,7 +166,7 @@ name = "cortical stack" parent_organ = BP_HEAD icon_state = "cortical-stack" - organ_tag = BP_STACK + organ_tag = BP_VOXSTACK organ_properties = ORGAN_PROP_PROSTHETIC origin_tech = @'{"biotech":4,"materials":4,"magnets":2,"programming":3}' relative_size = 10 diff --git a/code/modules/prometheus_metrics/_defines.dm b/mods/utility/prometheus_metrics/_prometheus_metrics.dm similarity index 55% rename from code/modules/prometheus_metrics/_defines.dm rename to mods/utility/prometheus_metrics/_prometheus_metrics.dm index ed81bed1926e..20811d914d74 100644 --- a/code/modules/prometheus_metrics/_defines.dm +++ b/mods/utility/prometheus_metrics/_prometheus_metrics.dm @@ -4,3 +4,7 @@ var/global/list/prometheus_metric_names = list("counter", "gauge") #define PROMETHEUS_METRIC_GAUGE 1 #define PROMETHEUS_METRIC_NAME(m) global.prometheus_metric_names[m + 1] + +/decl/modpack/prometheus_metrics + name = "Prometheus Metrics" + desc = "A system for providing gameserver metrics polling via world/Topic, with a JSON protobuf payload." \ No newline at end of file diff --git a/mods/utility/prometheus_metrics/_prometheus_metrics.dme b/mods/utility/prometheus_metrics/_prometheus_metrics.dme new file mode 100644 index 000000000000..ed635b5d7585 --- /dev/null +++ b/mods/utility/prometheus_metrics/_prometheus_metrics.dme @@ -0,0 +1,11 @@ +#ifndef MODPACK_UTILITY_PROMETHEUS +#define MODPACK_UTILITY_PROMETHEUS +// BEGIN_INCLUDE +#include "_prometheus_metrics.dm" +#include "metric_family.dm" +#include "metric_topic.dm" +#include "metrics.dm" +#include "metrics\byond.dm" +#include "metrics\ss13.dm" +// END_INCLUDE +#endif \ No newline at end of file diff --git a/code/modules/prometheus_metrics/metric_family.dm b/mods/utility/prometheus_metrics/metric_family.dm similarity index 100% rename from code/modules/prometheus_metrics/metric_family.dm rename to mods/utility/prometheus_metrics/metric_family.dm diff --git a/mods/utility/prometheus_metrics/metric_topic.dm b/mods/utility/prometheus_metrics/metric_topic.dm new file mode 100644 index 000000000000..f5574e593deb --- /dev/null +++ b/mods/utility/prometheus_metrics/metric_topic.dm @@ -0,0 +1,7 @@ +/decl/topic_command/secure/prometheus_metrics + name = "prometheus_metrics" + uid = "topic_command_prometheus_metrics" + +/decl/topic_command/secure/prometheus_metrics/use() + var/static/decl/prometheus_metrics/prometheus_metrics = IMPLIED_DECL + return prometheus_metrics.collect() \ No newline at end of file diff --git a/code/modules/prometheus_metrics/metrics.dm b/mods/utility/prometheus_metrics/metrics.dm similarity index 100% rename from code/modules/prometheus_metrics/metrics.dm rename to mods/utility/prometheus_metrics/metrics.dm diff --git a/code/modules/prometheus_metrics/metrics/byond.dm b/mods/utility/prometheus_metrics/metrics/byond.dm similarity index 100% rename from code/modules/prometheus_metrics/metrics/byond.dm rename to mods/utility/prometheus_metrics/metrics/byond.dm diff --git a/code/modules/prometheus_metrics/metrics/ss13.dm b/mods/utility/prometheus_metrics/metrics/ss13.dm similarity index 100% rename from code/modules/prometheus_metrics/metrics/ss13.dm rename to mods/utility/prometheus_metrics/metrics/ss13.dm diff --git a/mods/~compatibility/patches/ventcrawl.dm b/mods/~compatibility/patches/ventcrawl.dm new file mode 100644 index 000000000000..93cdc598aaf6 --- /dev/null +++ b/mods/~compatibility/patches/ventcrawl.dm @@ -0,0 +1,12 @@ +// Add ventcrawling to slimes. +#ifdef CONTENT_PACK_XENOBIO +#include "ventcrawl/xenobio.dm" +#endif +// Add ventcrawling to borers. +#ifdef CONTENT_PACK_BORERS +#include "ventcrawl/borers.dm" +#endif +// Allow ventcrawling with cult gear. +#ifdef GAMEMODE_PACK_CULT +#include "ventcrawl/cult.dm" +#endif \ No newline at end of file diff --git a/mods/~compatibility/patches/ventcrawl/borers.dm b/mods/~compatibility/patches/ventcrawl/borers.dm new file mode 100644 index 000000000000..20b3be4126bf --- /dev/null +++ b/mods/~compatibility/patches/ventcrawl/borers.dm @@ -0,0 +1,3 @@ +/mob/living/simple_animal/borer/Initialize(var/mapload, var/gen=1) + . = ..() + verbs += /mob/living/proc/ventcrawl \ No newline at end of file diff --git a/mods/~compatibility/patches/ventcrawl/cult.dm b/mods/~compatibility/patches/ventcrawl/cult.dm new file mode 100644 index 000000000000..d24d4a8affcf --- /dev/null +++ b/mods/~compatibility/patches/ventcrawl/cult.dm @@ -0,0 +1,9 @@ +// Vent crawling whitelisted items, whoo +/mob/living/Initialize() + . = ..() + can_enter_vent_with += list( + /obj/item/clothing/head/culthood, + /obj/item/clothing/suit/cultrobes, + /obj/item/book/tome, + /obj/item/sword/cultblade + ) \ No newline at end of file diff --git a/mods/~compatibility/patches/ventcrawl/xenobio.dm b/mods/~compatibility/patches/ventcrawl/xenobio.dm new file mode 100644 index 000000000000..ac63b6114265 --- /dev/null +++ b/mods/~compatibility/patches/ventcrawl/xenobio.dm @@ -0,0 +1,9 @@ +/mob/living/slime/Initialize(mapload, var/_stype = /decl/slime_colour/grey) + . = ..() + verbs += /mob/living/proc/ventcrawl + +/mob/living/slime/can_ventcrawl() + if(feeding_on) + to_chat(src, SPAN_WARNING("You cannot ventcrawl while feeding.")) + return FALSE + . = ..() \ No newline at end of file diff --git a/mods/~compatibility/~compatibility.dm b/mods/~compatibility/~compatibility.dm index 971cba14f9d0..81c4f3403d12 100644 --- a/mods/~compatibility/~compatibility.dm +++ b/mods/~compatibility/~compatibility.dm @@ -34,3 +34,7 @@ #ifdef MODPACK_DRAKES #include "patches/drakes.dm" #endif + +#ifdef CONTENT_PACK_VENTCRAWL +#include "patches/ventcrawl.dm" +#endif \ No newline at end of file diff --git a/nebula.dme b/nebula.dme index 73e32e4b78ae..e36aa4201a37 100644 --- a/nebula.dme +++ b/nebula.dme @@ -775,10 +775,7 @@ #include "code\game\antagonist\antagonist_place.dm" #include "code\game\antagonist\antagonist_print.dm" #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\station\provocateur.dm" -#include "code\game\antagonist\station\thrall.dm" #include "code\game\area\area_abstract.dm" #include "code\game\area\area_access.dm" #include "code\game\area\area_fishing.dm" @@ -1184,6 +1181,7 @@ #include "code\game\objects\items\devices\megaphone.dm" #include "code\game\objects\items\devices\modkit.dm" #include "code\game\objects\items\devices\multitool.dm" +#include "code\game\objects\items\devices\music_player.dm" #include "code\game\objects\items\devices\oxycandle.dm" #include "code\game\objects\items\devices\paicard.dm" #include "code\game\objects\items\devices\paint_sprayer.dm" @@ -3423,7 +3421,6 @@ #include "code\modules\power\cell.dm" #include "code\modules\power\debug_items.dm" #include "code\modules\power\generator.dm" -#include "code\modules\power\gravitygenerator.dm" #include "code\modules\power\heavycable.dm" #include "code\modules\power\port_gen.dm" #include "code\modules\power\power.dm" @@ -3547,15 +3544,11 @@ #include "code\modules\projectiles\targeting\targeting_mob.dm" #include "code\modules\projectiles\targeting\targeting_overlay.dm" #include "code\modules\projectiles\targeting\targeting_triggers.dm" -#include "code\modules\prometheus_metrics\_defines.dm" -#include "code\modules\prometheus_metrics\metric_family.dm" -#include "code\modules\prometheus_metrics\metrics.dm" -#include "code\modules\prometheus_metrics\metrics\byond.dm" -#include "code\modules\prometheus_metrics\metrics\ss13.dm" #include "code\modules\pronouns\_pronouns.dm" #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_pseudoplural.dm" #include "code\modules\pronouns\pronouns_second_person.dm" #include "code\modules\radiation\radiation.dm" #include "code\modules\random_map\_random_map_setup.dm" @@ -3752,11 +3745,6 @@ #include "code\modules\scent\scent_candle.dm" #include "code\modules\scent\scent_decls.dm" #include "code\modules\scent\scent_misc.dm" -#include "code\modules\sealant_gun\sealant.dm" -#include "code\modules\sealant_gun\sealant_gun.dm" -#include "code\modules\sealant_gun\sealant_injector.dm" -#include "code\modules\sealant_gun\sealant_rack.dm" -#include "code\modules\sealant_gun\sealant_tank.dm" #include "code\modules\security_levels\_security_level.dm" #include "code\modules\security_levels\alarm_appearance.dm" #include "code\modules\security_levels\keycard_authentication.dm" @@ -3911,10 +3899,6 @@ #include "code\modules\vehicles\engine.dm" #include "code\modules\vehicles\train.dm" #include "code\modules\vehicles\vehicle.dm" -#include "code\modules\ventcrawl\ventcrawl.dm" -#include "code\modules\ventcrawl\ventcrawl_atmospherics.dm" -#include "code\modules\ventcrawl\ventcrawl_multiz.dm" -#include "code\modules\ventcrawl\ventcrawl_verb.dm" #include "code\modules\weather\_weather.dm" #include "code\modules\weather\weather_debug.dm" #include "code\modules\weather\weather_effects.dm"