diff --git a/code/__defines/chemistry.dm b/code/__defines/chemistry.dm index 69ff2142d55..57123aa56c7 100644 --- a/code/__defines/chemistry.dm +++ b/code/__defines/chemistry.dm @@ -55,6 +55,10 @@ #define REAGENTS_FREE_SPACE(R) (R?.maximum_volume - R?.total_volume) #define REAGENT_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.reagent_volumes && REAGENT_HOLDER.reagent_volumes[REAGENT_TYPE]) + +#define LIQUID_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.liquid_volumes && REAGENT_HOLDER.liquid_volumes[REAGENT_TYPE]) +#define SOLID_VOLUME(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.solid_volumes && REAGENT_HOLDER.solid_volumes[REAGENT_TYPE]) + #define REAGENT_DATA(REAGENT_HOLDER, REAGENT_TYPE) (REAGENT_HOLDER?.reagent_data && REAGENT_HOLDER.reagent_data[REAGENT_TYPE]) #define MAT_SOLVENT_NONE 0 @@ -74,3 +78,5 @@ #define DEFAULT_GAS_OXIDIZER /decl/material/gas/oxygen #define CHEM_REACTION_FLAG_OVERFLOW_CONTAINER BITFLAG(0) + +#define MAX_SCRAP_MATTER (SHEET_MATERIAL_AMOUNT * 5) // Maximum amount of matter in chemical scraps \ No newline at end of file diff --git a/code/__defines/fluids.dm b/code/__defines/fluids.dm index bae8f40cde6..96ebc2a9339 100644 --- a/code/__defines/fluids.dm +++ b/code/__defines/fluids.dm @@ -1,6 +1,7 @@ #define FLUID_QDEL_POINT 1 // Depth a fluid begins self-deleting #define FLUID_MINIMUM_TRANSFER 5 // Minimum amount that a flowing fluid will transfer from one turf to another. #define FLUID_PUDDLE 25 // Minimum total depth that a fluid needs before it will start spreading. +#define FLUID_SLURRY 50 // Mimimum depth before fluids will move solids as reagents. #define FLUID_SHALLOW 200 // Depth shallow icon is used #define FLUID_OVER_MOB_HEAD 300 // Depth icon layers over mobs. #define FLUID_DEEP 800 // Depth deep icon is used diff --git a/code/__defines/materials.dm b/code/__defines/materials.dm index f45f68e16dc..86a1090e7b3 100644 --- a/code/__defines/materials.dm +++ b/code/__defines/materials.dm @@ -64,10 +64,10 @@ #define ORE_EXOTIC "exotic matter" //Phase of matter placeholders -#define MAT_PHASE_SOLID "solid" -#define MAT_PHASE_LIQUID "liquid" -#define MAT_PHASE_GAS "gas" -#define MAT_PHASE_PLASMA "plasma" +#define MAT_PHASE_SOLID BITFLAG(0) +#define MAT_PHASE_LIQUID BITFLAG(1) +#define MAT_PHASE_GAS BITFLAG(2) +#define MAT_PHASE_PLASMA BITFLAG(3) // Fission interactions. // For these, associated value is ideal neutron energy for reaction. diff --git a/code/__defines/maths.dm b/code/__defines/maths.dm index 86b74e34174..3d61c50d443 100644 --- a/code/__defines/maths.dm +++ b/code/__defines/maths.dm @@ -1,18 +1,15 @@ // Macro functions. #define RAND_F(LOW, HIGH) (rand() * (HIGH - LOW) + LOW) -#define CEILING(x) (-round(-(x))) // Float-aware floor and ceiling since round() will round upwards when given a second arg. -#define NONUNIT_FLOOR(x, y) (round( (x) / (y)) * (y)) -#define NONUNIT_CEILING(x, y) (-round(-(x) / (y)) * (y)) +#define NONUNIT_FLOOR(x, y) (floor((x) / (y)) * (y)) +#define NONUNIT_CEILING(x, y) (ceil((x) / (y)) * (y)) // Special two-step rounding for reagents, to avoid floating point errors. #define CHEMS_QUANTIZE(x) NONUNIT_FLOOR(round(x, MINIMUM_CHEMICAL_VOLUME * 0.1), MINIMUM_CHEMICAL_VOLUME) #define MULT_BY_RANDOM_COEF(VAR,LO,HI) VAR = round((VAR * rand(LO * 100, HI * 100))/100, 0.1) -#define ROUND(x) (((x) >= 0) ? round((x)) : -round(-(x))) -#define FLOOR(x) (round(x)) #define EULER 2.7182818285 #define MODULUS_FLOAT(X, Y) ( (X) - (Y) * round((X) / (Y)) ) @@ -22,4 +19,4 @@ #define SIMPLIFY_DEGREES(degrees) (MODULUS_FLOAT((degrees), 360)) #define IS_POWER_OF_TWO(VAL) ((VAL & (VAL-1)) == 0) -#define ROUND_UP_TO_POWER_OF_TWO(VAL) (2 ** CEILING(log(2,VAL))) +#define ROUND_UP_TO_POWER_OF_TWO(VAL) (2 ** ceil(log(2,VAL))) diff --git a/code/__defines/turfs.dm b/code/__defines/turfs.dm index 2471b56efbd..4c5a9ba11ec 100644 --- a/code/__defines/turfs.dm +++ b/code/__defines/turfs.dm @@ -20,9 +20,9 @@ //Here are a few macros to help with people always forgetting to round the coordinates somewhere, and forgetting that not everything automatically rounds decimals. ///Helper macro for the x coordinate of the turf at the center of the world. Handles rounding. -#define WORLD_CENTER_X CEILING((1 + world.maxx) / 2) +#define WORLD_CENTER_X ceil((1 + world.maxx) / 2) ///Helper macro for the y coordinate of the turf at the center of the world. Handles rounding. -#define WORLD_CENTER_Y CEILING((1 + world.maxy) / 2) +#define WORLD_CENTER_Y ceil((1 + world.maxy) / 2) ///Helper macro for getting the center turf on a given z-level. Handles rounding. #define WORLD_CENTER_TURF(Z) locate(WORLD_CENTER_X, WORLD_CENTER_Y, Z) ///Helper macro to check if a position is within the world's bounds. diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index 4f56b508d6c..ac2ec4ff6fd 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -108,7 +108,7 @@ return dist /proc/get_dist_bounds(var/target, var/source) // Alternative to get_dist for multi-turf objects - return CEILING(bounds_dist(target, source)/world.icon_size) + 1 + return ceil(bounds_dist(target, source)/world.icon_size) + 1 /proc/circlerangeturfs(center=usr,radius=3) var/turf/centerturf = get_turf(center) diff --git a/code/_helpers/maths.dm b/code/_helpers/maths.dm index 71279cab879..f89d3049b81 100644 --- a/code/_helpers/maths.dm +++ b/code/_helpers/maths.dm @@ -1,7 +1,7 @@ // min is inclusive, max is exclusive /proc/Wrap(val, min, max) var/d = max - min - var/t = FLOOR((val - min) / d) + var/t = floor((val - min) / d) return val - (t * d) // Trigonometric functions. @@ -37,7 +37,7 @@ return (val >= min) && (val <= max) /proc/IsInteger(x) - return FLOOR(x) == x + return floor(x) == x /proc/IsMultiple(x, y) return x % y == 0 @@ -91,7 +91,7 @@ /proc/polar2turf(x, y, z, angle, distance) var/x_offset = POLAR_TO_BYOND_X(distance, angle) var/y_offset = POLAR_TO_BYOND_Y(distance, angle) - return locate(CEILING(x + x_offset), CEILING(y + y_offset), z) + return locate(ceil(x + x_offset), ceil(y + y_offset), z) /proc/get_turf_from_angle(x, y, z, angle, ideal_distance) do diff --git a/code/_helpers/medical_scans.dm b/code/_helpers/medical_scans.dm index c48ff1b6028..44979e17fb0 100644 --- a/code/_helpers/medical_scans.dm +++ b/code/_helpers/medical_scans.dm @@ -49,10 +49,18 @@ scan["reagents"] = list() if(H.reagents?.total_volume) - for(var/reagent_type in H.reagents.reagent_volumes) - var/decl/material/R = GET_DECL(reagent_type) + for(var/liquid_type in H.reagents.liquid_volumes) + var/decl/material/R = GET_DECL(liquid_type) var/list/reagent = list() - reagent["name"]= R.get_reagent_name(H.reagents) + reagent["name"]= R.get_reagent_name(H.reagents, MAT_PHASE_LIQUID) + reagent["quantity"] = round(REAGENT_VOLUME(H.reagents, R.type),1) + reagent["scannable"] = R.scannable + scan["reagents"] += list(reagent) + + for(var/solid_type in H.reagents.solid_volumes) + var/decl/material/R = GET_DECL(solid_type) + var/list/reagent = list() + reagent["name"]= R.get_reagent_name(H.reagents, MAT_PHASE_SOLID) reagent["quantity"] = round(REAGENT_VOLUME(H.reagents, R.type),1) reagent["scannable"] = R.scannable scan["reagents"] += list(reagent) diff --git a/code/_helpers/mobs.dm b/code/_helpers/mobs.dm index 2be61d45948..d0065d882d0 100644 --- a/code/_helpers/mobs.dm +++ b/code/_helpers/mobs.dm @@ -241,7 +241,7 @@ return val if(istext(val)) var/list/vals = splittext(val, "x") - return FLOOR(max(text2num(vals[1]), text2num(vals[2]))/2) + return floor(max(text2num(vals[1]), text2num(vals[2]))/2) return 0 // If all of these flags are present, it should come out at exactly 1. Yes, this diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm index 9efc84cdfd6..cc1728a65fe 100644 --- a/code/_onclick/hud/fullscreen.dm +++ b/code/_onclick/hud/fullscreen.dm @@ -66,7 +66,7 @@ screen.transform = null if(screen.screen_loc != ui_entire_screen && largest_bound > 7) var/matrix/M = matrix() - M.Scale(CEILING(client.last_view_x_dim/7), CEILING(client.last_view_y_dim/7)) + M.Scale(ceil(client.last_view_x_dim/7), ceil(client.last_view_y_dim/7)) screen.transform = M client.screen |= screen diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 5d240840b92..10b3ccf93c1 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -63,7 +63,7 @@ var/stamina = mymob.get_stamina() if(stamina < 100) stamina_bar.set_invisibility(INVISIBILITY_NONE) - stamina_bar.icon_state = "prog_bar_[FLOOR(stamina/5)*5][(stamina >= 5) && (stamina <= 25) ? "_fail" : null]" + stamina_bar.icon_state = "prog_bar_[floor(stamina/5)*5][(stamina >= 5) && (stamina <= 25) ? "_fail" : null]" /datum/hud/proc/hide_inventory() inventory_shown = FALSE diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index b7b7dce280e..83152b0de02 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -106,7 +106,7 @@ var/global/obj/screen/robot_inventory if(!R.robot_modules_background) return - var/display_rows = -round(-(R.module.equipment.len) / 8) + var/display_rows = ceil(R.module.equipment.len / 8) R.robot_modules_background.screen_loc = "CENTER-4:16,BOTTOM+1:7 to CENTER+3:16,BOTTOM+[display_rows]:7" R.client.screen += R.robot_modules_background diff --git a/code/_onclick/hud/skybox.dm b/code/_onclick/hud/skybox.dm index 3de900748eb..03cdfaf1dab 100644 --- a/code/_onclick/hud/skybox.dm +++ b/code/_onclick/hud/skybox.dm @@ -13,7 +13,7 @@ var/global/const/SKYBOX_DIMENSION = 736 // Largest measurement for icon sides, u /obj/skybox/Initialize() if(!max_view_dim) - max_view_dim = CEILING(SKYBOX_DIMENSION / world.icon_size) + max_view_dim = ceil(SKYBOX_DIMENSION / world.icon_size) . = ..() /client diff --git a/code/controllers/subsystems/fluids.dm b/code/controllers/subsystems/fluids.dm index 43d72c04b60..1e95a63bf46 100644 --- a/code/controllers/subsystems/fluids.dm +++ b/code/controllers/subsystems/fluids.dm @@ -121,6 +121,12 @@ SUBSYSTEM_DEF(fluids) if(current_depth <= FLUID_PUDDLE && prob(60)) current_fluid_holder.remove_fluids(min(current_depth, 1), defer_update = TRUE) 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) + current_fluid_holder.dump_solid_reagents() + current_depth = current_fluid_holder.get_fluid_depth() + if(current_depth <= FLUID_QDEL_POINT) current_fluid_holder.reagents?.clear_reagents() REMOVE_ACTIVE_FLUID(current_fluid_holder) @@ -134,6 +140,8 @@ SUBSYSTEM_DEF(fluids) if(removing > 0) current_fluid_holder.remove_fluids(removing, defer_update = TRUE) else + // Dump any solids in case there were any in slurry. + current_fluid_holder.dump_solid_reagents() reagent_holder.clear_reagents() current_depth = current_fluid_holder.get_fluid_depth() if(current_depth <= FLUID_QDEL_POINT) @@ -147,7 +155,7 @@ SUBSYSTEM_DEF(fluids) 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)) + current_fluid_holder.transfer_fluids_to(other_fluid_holder, min(floor(current_depth*0.5), FLUID_MAX_DEPTH - other_fluid_holder.reagents?.total_volume)) current_depth = current_fluid_holder.get_fluid_depth() // Flow into the lowest level neighbor. diff --git a/code/controllers/subsystems/timer.dm b/code/controllers/subsystems/timer.dm index 9a8a0850a96..30108f9171b 100644 --- a/code/controllers/subsystems/timer.dm +++ b/code/controllers/subsystems/timer.dm @@ -1,7 +1,7 @@ /// Controls how many buckets should be kept, each representing a tick. (1 minutes worth) #define BUCKET_LEN (world.fps*1*60) /// Helper for getting the correct bucket for a given timer -#define BUCKET_POS(timer) (((CEILING((timer.timeToRun - timer.timer_subsystem.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN) +#define BUCKET_POS(timer) (((ceil((timer.timeToRun - timer.timer_subsystem.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN) /// Gets the maximum time at which timers will be invoked from buckets, used for deferring to secondary queue #define TIMER_MAX(timer_ss) (timer_ss.head_offset + TICKS2DS(BUCKET_LEN + timer_ss.practical_offset - 1)) /// Max float with integer precision diff --git a/code/datums/beam.dm b/code/datums/beam.dm index c2cc3738f24..e636bc092c8 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -120,11 +120,11 @@ var/global/list/beam_icon_cache = list() // shut up chinsky I do not have a cach //Position the effect so the beam is one continous line var/a if(abs(Pixel_x)>32) - a = Pixel_x > 0 ? round(Pixel_x/32) : CEILING(Pixel_x/32) + a = Pixel_x > 0 ? round(Pixel_x/32) : ceil(Pixel_x/32) X.x += a Pixel_x %= 32 if(abs(Pixel_y)>32) - a = Pixel_y > 0 ? round(Pixel_y/32) : CEILING(Pixel_y/32) + a = Pixel_y > 0 ? round(Pixel_y/32) : ceil(Pixel_y/32) X.y += a Pixel_y %= 32 diff --git a/code/datums/extensions/lockable.dm b/code/datums/extensions/lockable.dm index d3c9aee3cb2..46dc9fbcc22 100644 --- a/code/datums/extensions/lockable.dm +++ b/code/datums/extensions/lockable.dm @@ -132,8 +132,8 @@ Returns null if there are no problems. Or a text string describing the problem otherwise. */ /datum/extension/lockable/proc/keycode_issues_text(code) - if(length(code) < FLOOR(max_code_length * 0.5) || length(code) > max_code_length) - return "Keycode must be between [FLOOR(max_code_length * 0.5)] and [max_code_length] numbers long." + if(length(code) < floor(max_code_length * 0.5) || length(code) > max_code_length) + return "Keycode must be between [floor(max_code_length * 0.5)] and [max_code_length] numbers long." return null //Return null, since we have no issues /** diff --git a/code/datums/extensions/storage/_storage_ui.dm b/code/datums/extensions/storage/_storage_ui.dm index 0426bcbe11b..6f4db924f32 100644 --- a/code/datums/extensions/storage/_storage_ui.dm +++ b/code/datums/extensions/storage/_storage_ui.dm @@ -285,10 +285,16 @@ user.client.screen -= storage_end user.client.screen += boxes +/// Returns a key (not necessarily a string) to group objects by. +/datum/storage_ui/default/produce_bin/proc/get_key_for_object(obj/item/food/grown/produce) + if(!istype(produce) || !produce.seed) + return produce // should never happen, but it's a fallback nonetheless + return produce.seed.product_name || produce.seed.name + /datum/storage_ui/default/produce_bin/proc/get_seed_counts() var/list/counts = list() for(var/obj/item/food/grown/produce in _storage.get_contents()) - counts[produce.seed.name]++ + counts[get_key_for_object(produce)]++ return counts //This proc determins the size of the inventory to be displayed. Please touch it only if you know what you're doing. @@ -308,13 +314,14 @@ var/list/counts = get_seed_counts() var/list/displayed = list() for(var/obj/item/food/grown/produce in _storage.get_contents()) - if(displayed[produce.seed.name]) + var/produce_key = get_key_for_object(produce) + if(displayed[produce_key]) continue - displayed[produce.seed.name] = TRUE + displayed[produce_key] = TRUE produce.screen_loc = "LEFT+[cx]:[SCREEN_LOC_MOD_DIVIDED],BOTTOM+[cy]:[SCREEN_LOC_MOD_DIVIDED]" produce.maptext_x = 2 produce.maptext_y = 2 - produce.maptext = STYLE_SMALLFONTS_OUTLINE(counts[produce.seed.name], 6, COLOR_WHITE, COLOR_BLACK) + produce.maptext = STYLE_SMALLFONTS_OUTLINE(counts[produce_key], 6, COLOR_WHITE, COLOR_BLACK) produce.hud_layerise() cx++ if (cx > (SCREEN_LOC_MOD_FIRST + cols)) diff --git a/code/datums/position_point_vector.dm b/code/datums/position_point_vector.dm index 477656fe51f..e33f91b83dd 100644 --- a/code/datums/position_point_vector.dm +++ b/code/datums/position_point_vector.dm @@ -112,11 +112,11 @@ AM.pixel_y = return_py() /datum/point/proc/return_turf() - var/turf/T = locate(CEILING(x / world.icon_size), CEILING(y / world.icon_size), z) + var/turf/T = locate(ceil(x / world.icon_size), ceil(y / world.icon_size), z) return T?.resolve_to_actual_turf() /datum/point/proc/return_coordinates() //[turf_x, turf_y, z] - return list(CEILING(x / world.icon_size), CEILING(y / world.icon_size), z) + return list(ceil(x / world.icon_size), ceil(y / world.icon_size), z) /datum/point/proc/return_position() return new /datum/position(src) diff --git a/code/datums/repositories/crew/vital.dm b/code/datums/repositories/crew/vital.dm index 5f57659490a..61775c647ba 100644 --- a/code/datums/repositories/crew/vital.dm +++ b/code/datums/repositories/crew/vital.dm @@ -74,7 +74,7 @@ crew_data["charge_span"] = "good" if(crew_data["true_oxygenation"] != -1) - crew_data["pressure"] = "[FLOOR(120+rand(-5,5))]/[FLOOR(80+rand(-5,5))]" + crew_data["pressure"] = "[floor(120+rand(-5,5))]/[floor(80+rand(-5,5))]" crew_data["true_oxygenation"] = 100 crew_data["oxygenation"] = "normal" crew_data["oxygenation_span"] = "good" @@ -91,7 +91,7 @@ crew_data["charge_span"] = "bad" if(crew_data["true_oxygenation"] != -1) - crew_data["pressure"] = "[FLOOR((120+rand(-5,5))*0.25)]/[FLOOR((80+rand(-5,5))*0.25)]" + crew_data["pressure"] = "[floor((120+rand(-5,5))*0.25)]/[floor((80+rand(-5,5))*0.25)]" crew_data["true_oxygenation"] = 25 crew_data["oxygenation"] = "extremely low" crew_data["oxygenation_span"] = "bad" diff --git a/code/datums/traits/prosthetics/prosthetic_limbs.dm b/code/datums/traits/prosthetics/prosthetic_limbs.dm index 2e60dea3e43..d7189c57705 100644 --- a/code/datums/traits/prosthetics/prosthetic_limbs.dm +++ b/code/datums/traits/prosthetics/prosthetic_limbs.dm @@ -24,7 +24,7 @@ . = ..() // Macro can generate float costs, round to closest point value. if(trait_cost) - trait_cost = CEILING(trait_cost) + trait_cost = ceil(trait_cost) if(bodypart_name) if(model) var/decl/bodytype/prosthetic/model_manufacturer = GET_DECL(model) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 2da0415b2b8..a397a0791ad 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -380,7 +380,7 @@ if(length(reagents?.reagent_volumes)) LAZYINITLIST(.) for(var/R in reagents.reagent_volumes) - .[R] += FLOOR(REAGENT_VOLUME(reagents, R) / REAGENT_UNITS_PER_MATERIAL_UNIT) + .[R] += floor(REAGENT_VOLUME(reagents, R) / 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()) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index f76288b60c9..ec74a374b1b 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -1,3 +1,11 @@ +/proc/despawn_character(mob/living/character) + if(character.client) + character.ghostize() + character.prepare_for_despawn() + character.key = null + character.ckey = null + qdel(character) + /* * Cryogenic refrigeration unit. Basically a despawner. * Stealing a lot of concepts/code from sleepers due to massive laziness. @@ -5,7 +13,6 @@ * since time_entered, which is world.time when the occupant moves in. */ - //Main cryopod console. /obj/machinery/computer/cryopod @@ -310,21 +317,6 @@ despawn_occupant() -// This function can not be undone; do not call this unless you are sure -// Also make sure there is a valid control computer -/obj/machinery/cryopod/robot/despawn_occupant() - var/mob/living/silicon/robot/R = occupant - if(istype(R)) - R.clear_brain() - if(R.module) - for(var/obj/item/I in R.module) // the tools the borg has; metal, glass, guns etc - for(var/obj/item/O in I.get_contained_external_atoms()) // the things inside the tools, if anything; mainly for janiborg trash bags - O.forceMove(R) - qdel(I) - qdel(R.module) - - . = ..() - // This function can not be undone; do not call this unless you are sure // Also make sure there is a valid control computer /obj/machinery/cryopod/proc/despawn_occupant() @@ -352,38 +344,9 @@ else frozen_item.forceMove(get_turf(src)) - //Update any existing objectives involving this mob. - for(var/datum/objective/objective in global.all_objectives) - // We don't want revs to get objectives that aren't for heads of staff. Letting - // them win or lose based on cryo is silly so we remove the objective. - if(objective.target == occupant.mind) - if(objective.owner?.current) - to_chat(objective.owner.current, SPAN_DANGER("You get the feeling your target, [occupant.real_name], is no longer within your reach...")) - qdel(objective) - - //Handle job slot/tater cleanup. - if(occupant.mind) - if(occupant.mind.assigned_job) - occupant.mind.assigned_job.clear_slot() - - if(occupant.mind.objectives.len) - occupant.mind.objectives = null - occupant.mind.assigned_special_role = null - - // Delete them from datacore. - var/sanitized_name = occupant.real_name - sanitized_name = sanitize(sanitized_name) - var/datum/computer_file/report/crew_record/record = get_crewmember_record(sanitized_name) - if(record) - qdel(record) - icon_state = base_icon_state - //TODO: Check objectives/mode, update new targets if this mob is the target, spawn new antags? - - //Make an announcement and log the person entering storage. - // Titles should really be fetched from data records // and records should not be fetched by name as there is no guarantee names are unique var/role_alt_title = occupant.mind ? occupant.mind.role_alt_title : "Unknown" @@ -394,12 +357,7 @@ log_and_message_admins("[key_name(occupant)] ([role_alt_title]) entered cryostorage.") do_telecomms_announcement(src, "[occupant.real_name], [role_alt_title], [on_store_message]", "[on_store_name]") - - //This should guarantee that ghosts don't spawn. - occupant.ckey = null - - // Delete the mob. - qdel(occupant) + despawn_character(occupant) set_occupant(null) /obj/machinery/cryopod/proc/attempt_enter(var/mob/target, var/mob/user) diff --git a/code/game/machinery/dehumidifier.dm b/code/game/machinery/dehumidifier.dm index 47ac27be620..c02f2972ddc 100644 --- a/code/game/machinery/dehumidifier.dm +++ b/code/game/machinery/dehumidifier.dm @@ -76,7 +76,7 @@ use_power_oneoff(drainage * 1000) return - T.remove_fluid(CEILING(fluid_here * drainage)) + T.remove_fluid(ceil(fluid_here * drainage)) T.show_bubbles() use_power_oneoff(drainage * 5000) diff --git a/code/game/machinery/doors/_door.dm b/code/game/machinery/doors/_door.dm index b5b1d909ff0..b6d34553d87 100644 --- a/code/game/machinery/doors/_door.dm +++ b/code/game/machinery/doors/_door.dm @@ -272,7 +272,7 @@ //figure out how much metal we need var/amount_needed = (current_max_health - current_health) / DOOR_REPAIR_AMOUNT - amount_needed = CEILING(amount_needed) + amount_needed = ceil(amount_needed) var/obj/item/stack/stack = I var/transfer diff --git a/code/game/machinery/doors/blast_door.dm b/code/game/machinery/doors/blast_door.dm index e4b1e99ebb7..c9e90db084e 100644 --- a/code/game/machinery/doors/blast_door.dm +++ b/code/game/machinery/doors/blast_door.dm @@ -159,7 +159,7 @@ to_chat(user, "[src]'s motors resist your effort.") return if(istype(C, /obj/item/stack/material) && C.get_material_type() == /decl/material/solid/metal/plasteel) - var/amt = CEILING((get_max_health() - current_health)/150) + var/amt = ceil((get_max_health() - current_health)/150) if(!amt) to_chat(user, "\The [src] is already fully functional.") return diff --git a/code/game/machinery/kitchen/cooking_machines/_cooker.dm b/code/game/machinery/kitchen/cooking_machines/_cooker.dm index bfdbb8357fe..f23bc0c2e86 100644 --- a/code/game/machinery/kitchen/cooking_machines/_cooker.dm +++ b/code/game/machinery/kitchen/cooking_machines/_cooker.dm @@ -163,7 +163,7 @@ cooking_obj = null else var/failed - var/overcook_period = max(FLOOR(cook_time/5),1) + var/overcook_period = max(floor(cook_time/5),1) cooking_obj = result while(1) sleep(overcook_period) diff --git a/code/game/machinery/kitchen/cooking_machines/_cooker_output.dm b/code/game/machinery/kitchen/cooking_machines/_cooker_output.dm index 37813bd8eda..766faee42b1 100644 --- a/code/game/machinery/kitchen/cooking_machines/_cooker_output.dm +++ b/code/game/machinery/kitchen/cooking_machines/_cooker_output.dm @@ -8,7 +8,7 @@ filling_color = COLOR_BROWN abstract_type = /obj/item/food/variable -/obj/item/food/variable/Initialize() +/obj/item/food/variable/Initialize(mapload, material_key, skip_plate = FALSE) . = ..() update_icon() diff --git a/code/game/machinery/kitchen/gibber.dm b/code/game/machinery/kitchen/gibber.dm index 0d8f4e632f0..1c0556890ab 100644 --- a/code/game/machinery/kitchen/gibber.dm +++ b/code/game/machinery/kitchen/gibber.dm @@ -187,7 +187,7 @@ slab_nutrition /= gib_products.len - var/drop_products = FLOOR(gib_products.len * 0.35) + var/drop_products = floor(gib_products.len * 0.35) for(var/atom/movable/thing in gib_products) if(drop_products) drop_products-- diff --git a/code/game/machinery/kitchen/icecream.dm b/code/game/machinery/kitchen/icecream.dm index e7cc752e423..fe1681e4c9d 100644 --- a/code/game/machinery/kitchen/icecream.dm +++ b/code/game/machinery/kitchen/icecream.dm @@ -100,10 +100,16 @@ dat += "Chocolate cones: Dispense Make x5 [product_types[CONE_CHOC]] cones left. (Ingredients: flour, sugar, coco powder)
" dat += "
" dat += "VAT CONTENT
" - for(var/reagent_type in reagents?.reagent_volumes) - var/decl/material/R = GET_DECL(reagent_type) - dat += "[R.get_reagent_name(reagents)]: [REAGENT_VOLUME(reagents, reagent_type)]" + for(var/liquid_type in reagents?.liquid_volumes) + var/decl/material/R = GET_DECL(liquid_type) + dat += "[R.get_reagent_name(reagents, MAT_PHASE_LIQUID)]: [LIQUID_VOLUME(reagents, liquid_type)]" dat += "Purge
" + + for(var/solid_type in reagents?.solid_volumes) + var/decl/material/R = GET_DECL(solid_type) + dat += "[R.get_reagent_name(reagents, MAT_PHASE_SOLID)]: [SOLID_VOLUME(reagents, solid_type)]" + dat += "Purge
" + dat += "Refresh Close" var/datum/browser/popup = new(user, "icecreamvat","Icecream Vat", 700, 500, src) @@ -204,7 +210,7 @@ var/ice_creamed var/cone_type -/obj/item/food/icecream/Initialize() +/obj/item/food/icecream/Initialize(mapload, material_key, skip_plate = FALSE) . = ..() update_icon() diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index 9faeee536ba..8d36ff0f131 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -214,7 +214,7 @@ return if (reagents.total_volume && prob(50)) // 50% chance a liquid recipe gets messy - dirty += CEILING(reagents.total_volume / 10) + dirty += ceil(reagents.total_volume / 10) var/decl/recipe/recipe = select_recipe(RECIPE_CATEGORY_MICROWAVE, src, cooking_temperature) if (!recipe) @@ -456,5 +456,5 @@ las_rating = total_component_rating_of_type(/obj/item/stock_parts/micro_laser) change_power_consumption(initial(active_power_usage) - (cap_rating * 25), POWER_USE_ACTIVE) - max_n_of_items = initial(max_n_of_items) + FLOOR(bin_rating) + max_n_of_items = initial(max_n_of_items) + floor(bin_rating) cooking_power = initial(cooking_power) + (las_rating / 3) diff --git a/code/game/machinery/vending/_vending.dm b/code/game/machinery/vending/_vending.dm index dcd978ded68..9bac9df3284 100644 --- a/code/game/machinery/vending/_vending.dm +++ b/code/game/machinery/vending/_vending.dm @@ -269,7 +269,7 @@ data["mode"] = 1 data["product"] = currently_vending.item_name data["price"] = cur.format_value(currently_vending.price) - data["price_num"] = FLOOR(currently_vending.price / cur.absolute_value) + data["price_num"] = floor(currently_vending.price / cur.absolute_value) data["message"] = status_message data["message_err"] = status_error else @@ -286,7 +286,7 @@ "key" = key, "name" = I.item_name, "price" = cur.format_value(I.price), - "price_num" = FLOOR(I.price / cur.absolute_value), + "price_num" = floor(I.price / cur.absolute_value), "color" = I.display_color, "amount" = I.get_amount()))) diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index 8c8f6637d12..a15e3a6a726 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -69,7 +69,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(reagents.total_volume / length(washing_atoms)) if(amount_per_atom > 0) var/decl/material/smelliest = get_smelliest_reagent(reagents) diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 5bb118ed596..d00967ac4cc 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -64,7 +64,7 @@ /obj/effect/decal/cleanable/fluid_act(var/datum/reagents/fluid) SHOULD_CALL_PARENT(FALSE) - if(fluid?.total_volume && !QDELETED(src)) + if(fluid?.total_liquid_volume && !QDELETED(src)) if(reagents?.total_volume) reagents.trans_to(fluid, reagents.total_volume) qdel(src) diff --git a/code/game/objects/effects/fake_fire.dm b/code/game/objects/effects/fake_fire.dm index 783ecd3ac62..5993628c76b 100644 --- a/code/game/objects/effects/fake_fire.dm +++ b/code/game/objects/effects/fake_fire.dm @@ -33,17 +33,25 @@ if(lifetime) QDEL_IN(src,lifetime) +/obj/effect/fake_fire/proc/can_affect_atom(atom/target) + if(target == src) + return FALSE + return target.simulated + +/obj/effect/fake_fire/proc/can_affect_mob(mob/living/victim) + return can_affect_atom(victim) + /obj/effect/fake_fire/Process() if(!loc) qdel(src) return PROCESS_KILL for(var/mob/living/victim in loc) - if(!victim.simulated) + if(!can_affect_mob(victim)) continue victim.FireBurn(firelevel, last_temperature, pressure) loc.fire_act(firelevel, last_temperature, pressure) for(var/atom/burned in loc) - if(!burned.simulated || burned == src) + if(!can_affect_atom(burned)) continue burned.fire_act(firelevel, last_temperature, pressure) @@ -53,4 +61,17 @@ /obj/effect/fake_fire/Destroy() STOP_PROCESSING(SSobj,src) - . = ..() \ No newline at end of file + return ..() + +// A subtype of fake_fire used for spells that shouldn't affect the caster. +/obj/effect/fake_fire/variable/owned + var/mob/living/owner + +/obj/effect/fake_fire/variable/owned/can_affect_atom(atom/target) + if(target == owner) + return FALSE + return ..() + +/obj/effect/fake_fire/variable/owned/Destroy() + owner = null + return ..() \ No newline at end of file diff --git a/code/game/objects/items/_item_damage.dm b/code/game/objects/items/_item_damage.dm index 71afac1af8d..18ec98fd55c 100644 --- a/code/game/objects/items/_item_damage.dm +++ b/code/game/objects/items/_item_damage.dm @@ -53,7 +53,7 @@ return (mult * (4 - severity)) + (severity != 1? rand(-(mult / severity), (mult / severity)) : 0 ) /obj/item/proc/explosion_severity_damage_multiplier() - return CEILING(get_max_health() / 3) + return ceil(get_max_health() / 3) /obj/item/is_burnable() return simulated diff --git a/code/game/objects/items/_item_reagents.dm b/code/game/objects/items/_item_reagents.dm index e8e161d2169..f9b0558a875 100644 --- a/code/game/objects/items/_item_reagents.dm +++ b/code/game/objects/items/_item_reagents.dm @@ -64,6 +64,11 @@ return TRUE var/trans = reagents.trans_to(target, amount) - playsound(src, 'sound/effects/pour.ogg', 25, 1) + + // Sounds more like pouring small pellets or dust. + if(!length(reagents.liquid_volumes)) + playsound(src, 'sound/effects/refill.ogg', 25, 1) + else + playsound(src, 'sound/effects/pour.ogg', 25, 1) to_chat(user, SPAN_NOTICE("You transfer [trans] unit\s of the solution to \the [target]. \The [src] now contains [src.reagents.total_volume] units.")) return TRUE \ No newline at end of file diff --git a/code/game/objects/items/contraband.dm b/code/game/objects/items/contraband.dm index 91b4109635f..601f8a9f3e8 100644 --- a/code/game/objects/items/contraband.dm +++ b/code/game/objects/items/contraband.dm @@ -48,7 +48,12 @@ add_to_reagents(reagent, picked_reagents[reagent]) var/list/names = new - for(var/reagent_type in reagents.reagent_volumes) - var/decl/material/R = GET_DECL(reagent_type) - names += R.liquid_name + for(var/liquid_type in reagents.liquid_volumes) + var/decl/material/liquid = GET_DECL(liquid_type) + names += liquid.get_reagent_name(reagents, MAT_PHASE_LIQUID) + + for(var/solid_type in reagents.solid_volumes) + var/decl/material/solid = GET_DECL(solid_type) + names += solid.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/flash.dm b/code/game/objects/items/devices/flash.dm index 11ebc03e9c9..a9c70bf721f 100644 --- a/code/game/objects/items/devices/flash.dm +++ b/code/game/objects/items/devices/flash.dm @@ -88,7 +88,7 @@ user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) do_flash_animation(user, target) - if(target.stat != DEAD && target.handle_flashed(src, rand(str_min,str_max))) + if(target.stat != DEAD && target.handle_flashed(rand(str_min,str_max))) admin_attack_log(user, target, "flashed their victim using \a [src].", "Was flashed by \a [src].", "used \a [src] to flash") if(!target.isSynthetic()) user.visible_message(SPAN_DANGER("\The [user] blinds \the [target] with \the [src]!")) @@ -105,7 +105,7 @@ user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) do_flash_animation(user) for(var/mob/living/M in oviewers(3, null)) - M.handle_flashed(src, rand(str_min,str_max)) + M.handle_flashed(rand(str_min,str_max)) return TRUE /obj/item/flash/emp_act(severity) @@ -113,7 +113,7 @@ return FALSE do_flash_animation() for(var/mob/living/M in oviewers(3, null)) - M.handle_flashed(src, rand(str_min,str_max)) + M.handle_flashed(rand(str_min,str_max)) /obj/item/flash/synthetic //not for regular use, weaker effects name = "modified flash" diff --git a/code/game/objects/items/devices/scanners/plant.dm b/code/game/objects/items/devices/scanners/plant.dm index b6f3fe631e8..dea3d5bd12d 100644 --- a/code/game/objects/items/devices/scanners/plant.dm +++ b/code/game/objects/items/devices/scanners/plant.dm @@ -81,9 +81,12 @@ if(LAZYLEN(grown_reagents?.reagent_volumes)) dat += "

Reagent Data

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

Other Data

" if(length(extended_trait_data)) diff --git a/code/game/objects/items/devices/suit_sensor_jammer.dm b/code/game/objects/items/devices/suit_sensor_jammer.dm index 980756bffec..62a947a27ad 100644 --- a/code/game/objects/items/devices/suit_sensor_jammer.dm +++ b/code/game/objects/items/devices/suit_sensor_jammer.dm @@ -113,7 +113,7 @@ "methods" = methods, "current_method" = "\ref[jammer_method]", "current_cost" = jammer_method.energy_cost, - "total_cost" = "[CEILING(JAMMER_POWER_CONSUMPTION(10))]" + "total_cost" = "[ceil(JAMMER_POWER_CONSUMPTION(10))]" ) ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index fc4f397ad3f..54166078d17 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -412,7 +412,7 @@ /obj/item/stack/get_storage_cost() //Scales storage cost to stack size . = ..() if (amount < max_amount) - . = CEILING(. * amount / max_amount) + . = ceil(. * amount / max_amount) /obj/item/stack/get_mass() // Scales mass to stack size . = ..() diff --git a/code/game/objects/items/stacks/telecrystal.dm b/code/game/objects/items/stacks/telecrystal.dm index f97c8b3af7b..0926f80cd80 100644 --- a/code/game/objects/items/stacks/telecrystal.dm +++ b/code/game/objects/items/stacks/telecrystal.dm @@ -21,7 +21,7 @@ to_chat(user, "You slot \the [src] into \the [I] and charge its internal uplink.") /obj/item/stack/telecrystal/attack_self(var/mob/user) - if(use(CEILING(DEFAULT_TELECRYSTAL_AMOUNT/20))) + if(use(ceil(DEFAULT_TELECRYSTAL_AMOUNT/20))) user.visible_message("\The [user] crushes a crystal!", "You crush \a [src]!", "You hear the sound of a crystal breaking just before a sudden crack of electricity.") var/turf/T = get_random_turf_in_range(user, 7, 3) if(T) diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 35bee56b109..03d265d1eb2 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -49,7 +49,7 @@ else add_overlay("[icon_state]-powered") if(bcell) - var/ratio = CEILING(bcell.percent()/25) * 25 + var/ratio = ceil(bcell.percent()/25) * 25 add_overlay("[icon_state]-charge[ratio]") else add_overlay("[icon_state]-nocell") diff --git a/code/game/objects/items/weapons/dice.dm b/code/game/objects/items/weapons/dice.dm index 6c1f32839b5..db8e711d562 100644 --- a/code/game/objects/items/weapons/dice.dm +++ b/code/game/objects/items/weapons/dice.dm @@ -86,4 +86,4 @@ . = res /obj/item/dice/d100/convert_result(var/res) - . = FLOOR(res/10) + . = floor(res/10) diff --git a/code/game/objects/items/weapons/grenades/decompiler.dm b/code/game/objects/items/weapons/grenades/decompiler.dm index 143341ed3f2..2f1ecc1d35f 100644 --- a/code/game/objects/items/weapons/grenades/decompiler.dm +++ b/code/game/objects/items/weapons/grenades/decompiler.dm @@ -56,7 +56,7 @@ if(dump_cubes) visible_message(SPAN_DANGER("\The [src] collapses!")) for(var/mat in decompiled_matter) - var/sheet_amount = FLOOR(decompiled_matter[mat]/SHEET_MATERIAL_AMOUNT) + var/sheet_amount = floor(decompiled_matter[mat]/SHEET_MATERIAL_AMOUNT) if(sheet_amount > 0) while(sheet_amount > 100) var/obj/item/stack/material/cubes/cubes = new (dump_cubes, 100, mat) diff --git a/code/game/objects/items/weapons/material/stick.dm b/code/game/objects/items/weapons/material/stick.dm index 6f4a31000c5..c26168ed294 100644 --- a/code/game/objects/items/weapons/material/stick.dm +++ b/code/game/objects/items/weapons/material/stick.dm @@ -10,6 +10,7 @@ material = /decl/material/solid/organic/wood attack_verb = list("poked", "jabbed") material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME + lock_picking_level = 3 /obj/item/stick/attack_self(mob/user) user.visible_message("\The [user] snaps [src].", "You snap [src].") diff --git a/code/game/objects/items/weapons/shields.dm b/code/game/objects/items/weapons/shields.dm index 52d00914113..fcdc0bbc193 100644 --- a/code/game/objects/items/weapons/shields.dm +++ b/code/game/objects/items/weapons/shields.dm @@ -37,12 +37,16 @@ /obj/item/shield/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack") if(user.incapacitated()) return 0 - //block as long as they are not directly behind us var/bad_arc = user.dir && global.reverse_dir[user.dir] //arc of directions from which we cannot block if(check_shield_arc(user, bad_arc, damage_source, attacker)) - if(prob(get_block_chance(user, damage, damage_source, attacker))) + var/block_chance = get_block_chance(user, damage, damage_source, attacker) + if(attacker) + block_chance = max(0, block_chance - 10 * attacker.get_skill_difference(SKILL_COMBAT, user)) + if(prob(block_chance)) user.visible_message("\The [user] blocks [attack_text] with \the [src]!") + if(max_health != ITEM_HEALTH_NO_DAMAGE) + take_damage(damage) return 1 return 0 @@ -126,6 +130,7 @@ material = /decl/material/solid/metal/steel matter = list(/decl/material/solid/organic/wood = MATTER_AMOUNT_REINFORCEMENT) attack_verb = list("shoved", "bashed") + max_health = 250 /obj/item/shield/buckler/handle_shield(mob/user) . = ..() diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index e645ef69eb2..752ecc416d2 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -55,7 +55,7 @@ . = ..() if(. || length(contents) || !ispath(foldable) || !istype(material)) return TRUE - var/sheet_amount = FLOOR(LAZYACCESS(matter, material.type) / SHEET_MATERIAL_AMOUNT) + var/sheet_amount = floor(LAZYACCESS(matter, material.type) / SHEET_MATERIAL_AMOUNT) if(sheet_amount <= 0 || !user.try_unequip(src)) return TRUE to_chat(user, SPAN_NOTICE("You fold \the [src] flat.")) diff --git a/code/game/objects/items/weapons/storage/fancy/vials.dm b/code/game/objects/items/weapons/storage/fancy/vials.dm index 9f571cbd078..23cbb2db06b 100644 --- a/code/game/objects/items/weapons/storage/fancy/vials.dm +++ b/code/game/objects/items/weapons/storage/fancy/vials.dm @@ -16,7 +16,7 @@ /obj/item/box/fancy/vials/on_update_icon() . = ..() var/key_count = count_by_type(contents, key_type) - icon_state = "[initial(icon_state)][FLOOR(key_count/2)]" + icon_state = "[initial(icon_state)][floor(key_count/2)]" /* * Not actually a "fancy" storage... @@ -38,7 +38,7 @@ /obj/item/lockbox/vials/on_update_icon() . = ..() var/total_contents = count_by_type(contents, /obj/item/chems/glass/beaker/vial) - icon_state = "vialbox[FLOOR(total_contents/2)]" + icon_state = "vialbox[floor(total_contents/2)]" if (!broken) add_overlay("led[locked]") if(locked) diff --git a/code/game/objects/structures/_structure_construction.dm b/code/game/objects/structures/_structure_construction.dm index a97fa4fdb52..5c0378c8196 100644 --- a/code/game/objects/structures/_structure_construction.dm +++ b/code/game/objects/structures/_structure_construction.dm @@ -105,7 +105,7 @@ /obj/structure/proc/handle_repair(mob/user, obj/item/tool) var/current_max_health = get_max_health() var/obj/item/stack/stack = tool - var/amount_needed = CEILING((current_max_health - current_health)/DOOR_REPAIR_AMOUNT) + var/amount_needed = ceil((current_max_health - current_health)/DOOR_REPAIR_AMOUNT) var/used = min(amount_needed,stack.amount) if(used) to_chat(user, SPAN_NOTICE("You fit [stack.get_string_for_amount(used)] to damaged areas of \the [src].")) diff --git a/code/game/objects/structures/_structure_materials.dm b/code/game/objects/structures/_structure_materials.dm index c5e91bb674a..33e4c24426b 100644 --- a/code/game/objects/structures/_structure_materials.dm +++ b/code/game/objects/structures/_structure_materials.dm @@ -70,7 +70,7 @@ placing = (matter[mat] / SHEET_MATERIAL_AMOUNT) * 0.75 if(parts_type) placing *= atom_info_repository.get_matter_multiplier_for(parts_type, mat, placing) - placing = FLOOR(placing) + placing = floor(placing) else placing = parts_amount if(placing > 0) diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 6cefbbf2dd6..25abc7a0369 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -66,7 +66,7 @@ effective_cover *= 2 if(!anchored) effective_cover *= 0.5 - effective_cover = clamp(FLOOR(effective_cover), 0, 100) + effective_cover = clamp(floor(effective_cover), 0, 100) if(Proj.original != src && !prob(effective_cover)) return PROJECTILE_CONTINUE var/damage = Proj.get_structure_damage() @@ -75,7 +75,7 @@ if(!istype(Proj, /obj/item/projectile/beam)) damage *= 0.4 if(reinf_material) - damage = FLOOR(damage * 0.75) + damage = floor(damage * 0.75) ..() if(damage) take_damage(damage, Proj.atom_damage_type) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index deb34524e6d..893cab95700 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -87,7 +87,7 @@ var/global/list/hygiene_props = list() if(fluid_here <= 0) return - T.remove_fluid(CEILING(fluid_here*drainage)) + T.remove_fluid(ceil(fluid_here*drainage)) T.show_bubbles() if(world.time > last_gurgle + 80) last_gurgle = world.time diff --git a/code/game/turfs/floors/natural/_natural.dm b/code/game/turfs/floors/natural/_natural.dm index 83cb54ebdc5..fa616749e33 100644 --- a/code/game/turfs/floors/natural/_natural.dm +++ b/code/game/turfs/floors/natural/_natural.dm @@ -99,7 +99,7 @@ // At best, you get about 5 pieces of clay or dirt from digging the // associated turfs. So we'll make it cost 5 to put some back. // TODO: maybe make this use the diggable loot list. - var/stack_depth = CEILING((abs(get_physical_height()) / TRENCH_DEPTH_PER_ACTION) * 5) + var/stack_depth = ceil((abs(get_physical_height()) / TRENCH_DEPTH_PER_ACTION) * 5) var/using_lumps = max(1, min(stack.amount, min(stack_depth, 5))) if(stack.use(using_lumps)) set_physical_height(min(0, get_physical_height() + ((using_lumps / 5) * TRENCH_DEPTH_PER_ACTION))) diff --git a/code/game/turfs/floors/natural/natural_mud.dm b/code/game/turfs/floors/natural/natural_mud.dm index ee17d449c2d..2f681c8d88b 100644 --- a/code/game/turfs/floors/natural/natural_mud.dm +++ b/code/game/turfs/floors/natural/natural_mud.dm @@ -36,7 +36,9 @@ return ..() /turf/floor/natural/mud/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) - if(!reagents?.total_volume) + // scaling taken from /turf/floor/natural/grass/wild/fire_act + // smoothly scale between 1/5 chance to scorch at the boiling point of water and 100% chance to scorch at boiling point * 4 + if(!reagents?.total_volume && temperature >= /decl/material/liquid/water::boiling_point && prob(20 + temperature * 80 / (/decl/material/liquid/water::boiling_point * 4))) ChangeTurf(/turf/floor/natural/dry, keep_air = TRUE, keep_height = TRUE) return return ..() diff --git a/code/game/turfs/turf_enter.dm b/code/game/turfs/turf_enter.dm index db413ef99db..a0cc300474d 100644 --- a/code/game/turfs/turf_enter.dm +++ b/code/game/turfs/turf_enter.dm @@ -73,7 +73,7 @@ M.reset_layer() else // arbitrary timing value that feels good in practice. it sucks and is inconsistent:( - addtimer(CALLBACK(M, TYPE_PROC_REF(/atom, reset_layer)), max(0, CEILING(M.next_move - world.time)) + 1 SECOND) + addtimer(CALLBACK(M, TYPE_PROC_REF(/atom, reset_layer)), max(0, ceil(M.next_move - world.time)) + 1 SECOND) if(simulated) A.OnSimulatedTurfEntered(src, old_loc) diff --git a/code/game/turfs/turf_fluids.dm b/code/game/turfs/turf_fluids.dm index 3d77fb726a3..8779313e061 100644 --- a/code/game/turfs/turf_fluids.dm +++ b/code/game/turfs/turf_fluids.dm @@ -69,7 +69,7 @@ /turf/proc/get_fluid_name() var/decl/material/mat = reagents?.get_primary_reagent_decl() - return mat?.liquid_name || "liquid" + return mat.get_reagent_name(reagents, MAT_PHASE_LIQUID) || "liquid" /turf/get_fluid_depth() if(is_flooded(absolute=1)) @@ -121,17 +121,20 @@ AM.fluid_act(fluids) /turf/proc/remove_fluids(var/amount, var/defer_update) - if(!reagents?.total_volume) + if(!reagents?.total_liquid_volume) return - remove_any_reagents(amount, defer_update = defer_update) + remove_any_reagents(amount, defer_update = defer_update, removed_phases = MAT_PHASE_LIQUID) if(defer_update && !QDELETED(reagents)) SSfluids.holders_to_update[reagents] = TRUE /turf/proc/transfer_fluids_to(var/turf/target, var/amount, var/defer_update = TRUE) - if(!reagents?.total_volume) + // No flowing of reagents without liquids, but this proc should not be called if liquids are not present regardless. + if(!reagents?.total_liquid_volume) return if(!target.reagents) target.create_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) if(defer_update) if(!QDELETED(reagents)) @@ -166,6 +169,9 @@ if(!(. = ..())) return + if(reagents?.total_liquid_volume < FLUID_SLURRY) + dump_solid_reagents() + if(reagents?.total_volume > FLUID_QDEL_POINT) ADD_ACTIVE_FLUID(src) var/decl/material/primary_reagent = reagents.get_primary_reagent_decl() @@ -177,6 +183,7 @@ unwet_floor(FALSE) else QDEL_NULL(fluid_overlay) + reagents?.clear_reagents() REMOVE_ACTIVE_FLUID(src) SSfluids.pending_flows -= src if(last_slipperiness > 0) @@ -186,3 +193,25 @@ var/turf/neighbor = get_step_resolving_mimic(src, checkdir) if(neighbor?.reagents?.total_volume > 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/list/matter_list = list() + for(var/reagent_type in solids.solid_volumes) + var/reagent_amount = solids.solid_volumes[reagent_type] + matter_list[reagent_type] = round(reagent_amount/REAGENT_UNITS_PER_MATERIAL_UNIT) + solids.remove_reagent(reagent_type, reagent_amount, defer_update = TRUE, removed_phases = MAT_PHASE_SOLID) + + var/obj/item/debris/scraps/chemical/scraps = locate() in contents + if(!istype(scraps) || scraps.get_total_matter() >= MAX_SCRAP_MATTER) + scraps = new(src) + if(!LAZYLEN(scraps.matter)) + scraps.matter = matter_list + else + for(var/mat_type in matter_list) + scraps.matter[mat_type] += matter_list[mat_type] + + scraps.update_primary_material() + solids.handle_update() \ No newline at end of file diff --git a/code/modules/butchery/butchery_data.dm b/code/modules/butchery/butchery_data.dm index 91d76e88983..daca4b45c06 100644 --- a/code/modules/butchery/butchery_data.dm +++ b/code/modules/butchery/butchery_data.dm @@ -36,6 +36,9 @@ blood_splatter(product_loc, donor, large = TRUE) if(ispath(product_type, /obj/item/stack)) LAZYADD(., new product_type(product_loc, product_amount, product_material, donor)) + else if(ispath(product_type, /obj/item/food)) + for(var/i = 1 to product_amount) + LAZYADD(., new product_type(product_loc, product_material, TRUE, donor)) else for(var/i = 1 to product_amount) LAZYADD(., new product_type(product_loc, product_material, donor)) diff --git a/code/modules/butchery/butchery_products.dm b/code/modules/butchery/butchery_products.dm index 4b67e4269a9..a7533c84eb5 100644 --- a/code/modules/butchery/butchery_products.dm +++ b/code/modules/butchery/butchery_products.dm @@ -16,7 +16,7 @@ var/fat_material = /decl/material/solid/organic/meat/gut var/meat_name = "meat" -/obj/item/food/butchery/Initialize(ml, material_key, mob/living/donor) +/obj/item/food/butchery/Initialize(mapload, material_key, skip_plate = FALSE, mob/living/donor) var/decl/butchery_data/butchery_decl = GET_DECL(donor?.butchery_data) if(butchery_decl) if(butchery_decl.meat_material) @@ -159,7 +159,7 @@ w_class = ITEM_SIZE_HUGE var/bone_material = /decl/material/solid/organic/bone -/obj/item/food/butchery/haunch/Initialize(ml, material_key, mob/living/donor) +/obj/item/food/butchery/haunch/Initialize(mapload, material_key, skip_plate = FALSE, mob/living/donor) var/decl/butchery_data/butchery_decl = GET_DECL(donor?.butchery_data) if(butchery_decl) bone_material = butchery_decl.bone_material @@ -187,7 +187,7 @@ icon = 'icons/obj/items/butchery/side.dmi' w_class = ITEM_SIZE_GARGANTUAN -/obj/item/food/butchery/haunch/side/Initialize(ml, material_key, mob/living/donor) +/obj/item/food/butchery/haunch/side/Initialize(mapload, material_key, skip_plate = FALSE, mob/living/donor) . = ..() if(donor && !isnull(slice_num)) slice_num = max(1, round(slice_num/2)) diff --git a/code/modules/butchery/butchery_products_chopped.dm b/code/modules/butchery/butchery_products_chopped.dm index 95bfb1451cd..ccf600683ef 100644 --- a/code/modules/butchery/butchery_products_chopped.dm +++ b/code/modules/butchery/butchery_products_chopped.dm @@ -6,7 +6,7 @@ nutriment_amt = 1 w_class = ITEM_SIZE_TINY -/obj/item/food/butchery/chopped/Initialize() +/obj/item/food/butchery/chopped/Initialize(mapload, material_key, skip_plate = FALSE) . = ..() slice_path = null slice_num = null diff --git a/code/modules/butchery/butchery_products_meat.dm b/code/modules/butchery/butchery_products_meat.dm index 89a20bffb4b..1960f4c0778 100644 --- a/code/modules/butchery/butchery_products_meat.dm +++ b/code/modules/butchery/butchery_products_meat.dm @@ -25,7 +25,7 @@ ) return meat_icons -/obj/item/food/butchery/meat/Initialize(ml, material_key, mob/living/donor) +/obj/item/food/butchery/meat/Initialize(mapload, material_key, skip_plate = FALSE, mob/living/donor) icon = pick(get_meat_icons()) return ..() diff --git a/code/modules/butchery/butchery_products_meat_fish.dm b/code/modules/butchery/butchery_products_meat_fish.dm index d1694333145..f280fe61e1b 100644 --- a/code/modules/butchery/butchery_products_meat_fish.dm +++ b/code/modules/butchery/butchery_products_meat_fish.dm @@ -30,7 +30,7 @@ food.remove_from_reagents(/decl/material/liquid/carpotoxin, REAGENT_VOLUME(reagents, /decl/material/liquid/carpotoxin)) /obj/item/food/butchery/meat/fish/create_slice() - return new slice_path(loc, material?.type, meat_name) // pass fish name to sashimi + return new slice_path(loc, material?.type, TRUE, meat_name) // pass fish name to sashimi /obj/item/food/butchery/meat/fish/grilled desc = "A lightly grilled fish fillet." diff --git a/code/modules/character_info/comment_mood.dm b/code/modules/character_info/comment_mood.dm index 4c89f76da74..7a7f2b47116 100644 --- a/code/modules/character_info/comment_mood.dm +++ b/code/modules/character_info/comment_mood.dm @@ -5,7 +5,7 @@ var/global/_comment_mood_legend if(!global._comment_mood_legend) var/legend_width = 500 var/legend_per_row = 5 - var/legend_cell_width = FLOOR(legend_width/legend_per_row) + var/legend_cell_width = floor(legend_width/legend_per_row) global._comment_mood_legend = list("") var/list/all_moods = decls_repository.get_decls_of_type(/decl/comment_mood) var/counter = 0 diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 1a28566ee10..2890ca812d7 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -501,8 +501,8 @@ var/global/const/MAX_VIEW = 41 return // Some kind of malformed winget(), do not proceed. // Rescale as needed. - var/res_x = get_config_value(/decl/config/num/clients/lock_client_view_x) || CEILING(text2num(view_components[1]) / divisor) - var/res_y = get_config_value(/decl/config/num/clients/lock_client_view_y) || CEILING(text2num(view_components[2]) / divisor) + var/res_x = get_config_value(/decl/config/num/clients/lock_client_view_x) || ceil(text2num(view_components[1]) / divisor) + var/res_y = get_config_value(/decl/config/num/clients/lock_client_view_y) || ceil(text2num(view_components[2]) / divisor) var/max_view = get_config_value(/decl/config/num/clients/max_client_view_x) || MAX_VIEW last_view_x_dim = clamp(res_x, MIN_VIEW, max_view) diff --git a/code/modules/clothing/_clothing.dm b/code/modules/clothing/_clothing.dm index 49632611a30..41adae68cdd 100644 --- a/code/modules/clothing/_clothing.dm +++ b/code/modules/clothing/_clothing.dm @@ -89,7 +89,7 @@ return TRUE // Sort of a placeholder for proper tailoring. -#define RAG_COUNT(X) CEILING((LAZYACCESS(X.matter, /decl/material/solid/organic/cloth) * 0.65) / SHEET_MATERIAL_AMOUNT) +#define RAG_COUNT(X) ceil((LAZYACCESS(X.matter, /decl/material/solid/organic/cloth) * 0.65) / SHEET_MATERIAL_AMOUNT) /obj/item/clothing/attackby(obj/item/I, mob/user) var/rags = RAG_COUNT(src) diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 04750cf3b59..19581a797e4 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -166,7 +166,7 @@ SPAN_NOTICE("You slice \the [src]!") ) for(var/i = 1 to slice_amount) - new /obj/item/food/processed_grown/chopped(loc, material?.type, plant) + new /obj/item/food/processed_grown/chopped(loc, null, TRUE, plant) qdel(src) return TRUE return ..() diff --git a/code/modules/clothing/masks/cig_crafting.dm b/code/modules/clothing/masks/cig_crafting.dm index 9952aa7645b..db5cbb42db7 100644 --- a/code/modules/clothing/masks/cig_crafting.dm +++ b/code/modules/clothing/masks/cig_crafting.dm @@ -45,7 +45,7 @@ seed = "tobacco" w_class = ITEM_SIZE_TINY -/obj/item/food/grown/dried_tobacco/Initialize() +/obj/item/food/grown/dried_tobacco/Initialize(mapload, material_key, skip_plate = FALSE) . = ..() dry = TRUE SetName("dried [name]") diff --git a/code/modules/clothing/spacesuits/breaches.dm b/code/modules/clothing/spacesuits/breaches.dm index a7cb2233567..16689040470 100644 --- a/code/modules/clothing/spacesuits/breaches.dm +++ b/code/modules/clothing/spacesuits/breaches.dm @@ -244,7 +244,7 @@ return var/obj/item/stack/tape_roll/duct_tape/D = W - var/amount_needed = CEILING(target_breach.class * 2) + var/amount_needed = ceil(target_breach.class * 2) if(!D.can_use(amount_needed)) to_chat(user, SPAN_WARNING("There's not enough [D.plural_name] in your [src] to seal \the [target_breach.descriptor] on \the [src]! You need at least [amount_needed] [D.plural_name].")) return diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index 71bf19f0fb0..ae9c36cb3cf 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -498,7 +498,7 @@ data["charge"] = cell ? round(cell.charge,1) : 0 data["maxcharge"] = cell ? cell.maxcharge : 0 - data["chargestatus"] = cell ? FLOOR(cell.percent()/2) : 0 + data["chargestatus"] = cell ? floor(cell.percent()/2) : 0 data["emagged"] = subverted data["coverlock"] = locked diff --git a/code/modules/codex/categories/category_recipes.dm b/code/modules/codex/categories/category_recipes.dm index 197377a9bd1..050fe7bf7de 100644 --- a/code/modules/codex/categories/category_recipes.dm +++ b/code/modules/codex/categories/category_recipes.dm @@ -95,13 +95,13 @@ ingredients += "[recipe.fruit[thing]] [thing]\s" mechanics_text += "" var/atom/recipe_product = recipe.result - mechanics_text += "
This recipe takes [CEILING(recipe.cooking_time/10)] second\s to cook and creates \a [initial(recipe_product.name)]." + mechanics_text += "
This recipe takes [ceil(recipe.cooking_time/10)] second\s to cook and creates \a [initial(recipe_product.name)]." var/lore_text = recipe.lore_text if(!lore_text) lore_text = initial(recipe_product.desc) var/recipe_name = recipe.display_name || sanitize(initial(recipe_product.name)) - guide_html += "

[capitalize(recipe_name)]

Cook [english_list(ingredients)] for [CEILING(recipe.cooking_time/10)] second\s." + guide_html += "

[capitalize(recipe_name)]

Cook [english_list(ingredients)] for [ceil(recipe.cooking_time/10)] second\s." entries_to_register += new /datum/codex_entry( \ _display_name = "[recipe_name] (cooking recipe)", \ diff --git a/code/modules/crafting/pottery/pottery_moulds.dm b/code/modules/crafting/pottery/pottery_moulds.dm index 07fd0155ffd..7f256ce8737 100644 --- a/code/modules/crafting/pottery/pottery_moulds.dm +++ b/code/modules/crafting/pottery/pottery_moulds.dm @@ -45,7 +45,7 @@ var/list/matter_for_product = atom_info_repository.get_matter_for(product_type, /decl/material/placeholder, 1) for(var/mat in matter_for_product) required_volume += matter_for_product[mat] - required_volume = CEILING(required_volume * REAGENT_UNITS_PER_MATERIAL_UNIT) + required_volume = ceil(required_volume * REAGENT_UNITS_PER_MATERIAL_UNIT) if(required_volume > 0) if(reagents) reagents.maximum_volume = required_volume diff --git a/code/modules/crafting/stack_recipes/_recipe.dm b/code/modules/crafting/stack_recipes/_recipe.dm index 4c0f2dc3001..aeff6c2fb2c 100644 --- a/code/modules/crafting/stack_recipes/_recipe.dm +++ b/code/modules/crafting/stack_recipes/_recipe.dm @@ -154,14 +154,14 @@ . += "[stack_type] is in both forbidden and craftable stack types" /decl/stack_recipe/proc/get_required_stack_amount(obj/item/stack/stack) - return max(1, CEILING(req_amount / max(1, (SHEET_MATERIAL_AMOUNT * stack?.matter_multiplier)))) + return max(1, ceil(req_amount / max(1, (SHEET_MATERIAL_AMOUNT * stack?.matter_multiplier)))) /decl/stack_recipe/proc/get_list_display(mob/user, obj/item/stack/stack, datum/stack_recipe_list/sublist) - var/sheets_per_product = req_amount / CEILING(FLOOR(SHEET_MATERIAL_AMOUNT * stack.matter_multiplier)) - var/products_per_sheet = CEILING(FLOOR(SHEET_MATERIAL_AMOUNT * stack.matter_multiplier)) / req_amount - var/clamp_sheets = max(1, CEILING(sheets_per_product)) - var/max_multiplier = FLOOR(stack.get_amount() / clamp_sheets) + var/sheets_per_product = req_amount / ceil(floor(SHEET_MATERIAL_AMOUNT * stack.matter_multiplier)) + var/products_per_sheet = ceil(floor(SHEET_MATERIAL_AMOUNT * stack.matter_multiplier)) / req_amount + var/clamp_sheets = max(1, ceil(sheets_per_product)) + var/max_multiplier = floor(stack.get_amount() / clamp_sheets) // Stacks can have a max bound that will cause us to waste material on crafting an impossible amount. if(ispath(result_type, /obj/item/stack)) @@ -177,7 +177,7 @@ . = list("") . += "" . += "" . += "" @@ -314,7 +314,7 @@ materials = atom_info_repository.get_matter_for((test_result_type || result_type), (ispath(required_material) ? required_material : null)) for(var/mat in materials) req_amount += round(materials[mat]) - req_amount = CEILING(req_amount*crafting_extra_cost_factor) + req_amount = ceil(req_amount*crafting_extra_cost_factor) if(!ispath(result_type, /obj/item/stack)) // Due to matter calc, without this clamping, one sheet can make 32x grenade casings. Not ideal. req_amount = max(req_amount, SHEET_MATERIAL_AMOUNT) diff --git a/code/modules/crafting/textiles/loom.dm b/code/modules/crafting/textiles/loom.dm index b5e743a9df4..109248c8146 100644 --- a/code/modules/crafting/textiles/loom.dm +++ b/code/modules/crafting/textiles/loom.dm @@ -106,7 +106,7 @@ weaving_progress += loaded_thread.matter_per_piece[weaving_type] var/obj/item/stack/material/product_ref = product_type - var/matter_per_product = CEILING(initial(product_ref.matter_multiplier) * SHEET_MATERIAL_AMOUNT) + var/matter_per_product = ceil(initial(product_ref.matter_multiplier) * SHEET_MATERIAL_AMOUNT) if(weaving_progress > matter_per_product) var/produced = round(weaving_progress / matter_per_product) processed += produced diff --git a/code/modules/economy/worth_cash.dm b/code/modules/economy/worth_cash.dm index 14024b3c9d3..91203dbd7ef 100644 --- a/code/modules/economy/worth_cash.dm +++ b/code/modules/economy/worth_cash.dm @@ -55,7 +55,7 @@ /obj/item/cash/proc/get_worth() var/decl/currency/cur = GET_DECL(currency) - . = FLOOR(absolute_worth / cur.absolute_value) + . = floor(absolute_worth / cur.absolute_value) /obj/item/cash/attackby(obj/item/W, mob/user) if(istype(W, /obj/item/cash)) @@ -138,12 +138,12 @@ return TRUE var/amount = input(usr, "How many [cur.name] do you want to take? (0 to [get_worth() - 1])", "Take Money", 20) as num - amount = round(clamp(amount, 0, FLOOR(get_worth() - 1))) + amount = round(clamp(amount, 0, floor(get_worth() - 1))) if(!amount || QDELETED(src) || get_worth() <= 1 || user.incapacitated() || loc != user) return TRUE - amount = FLOOR(amount * cur.absolute_value) + amount = floor(amount * cur.absolute_value) adjust_worth(-(amount)) var/obj/item/cash/cash = new(get_turf(src)) cash.set_currency(currency) @@ -238,7 +238,7 @@ else to_chat(user, SPAN_NOTICE("Id: [id].")) var/decl/currency/cur = GET_DECL(currency) - to_chat(user, SPAN_NOTICE("[capitalize(cur.name)] remaining: [FLOOR(loaded_worth / cur.absolute_value)].")) + to_chat(user, SPAN_NOTICE("[capitalize(cur.name)] remaining: [floor(loaded_worth / cur.absolute_value)].")) /obj/item/charge_stick/get_base_value() . = holographic ? 0 : loaded_worth diff --git a/code/modules/economy/worth_currency.dm b/code/modules/economy/worth_currency.dm index 7d15b7d7514..ed12b938e92 100644 --- a/code/modules/economy/worth_currency.dm +++ b/code/modules/economy/worth_currency.dm @@ -100,7 +100,7 @@ . += "missing coin crafting recipes: [english_list(validating_denominations)]" /decl/currency/proc/format_value(var/amt) - . = "[name_prefix][FLOOR(amt / absolute_value)][name_suffix]" + . = "[name_prefix][floor(amt / absolute_value)][name_suffix]" /decl/currency/proc/build_denominations() denominations = sortTim(denominations, /proc/cmp_currency_denomination_des) diff --git a/code/modules/economy/worth_items.dm b/code/modules/economy/worth_items.dm index bcea92fe798..a5d25c5c649 100644 --- a/code/modules/economy/worth_items.dm +++ b/code/modules/economy/worth_items.dm @@ -43,7 +43,7 @@ var/shock_protection = ((1-siemens_coefficient) * 20) * total_coverage var/gas_leak_value = ((1-gas_transfer_coefficient) * 20) * total_coverage var/permeability_value = ((1-permeability_coefficient) * 20) * total_coverage - var/pressure_protection = FLOOR(abs(max_pressure_protection - min_pressure_protection)/ONE_ATMOSPHERE) + var/pressure_protection = floor(abs(max_pressure_protection - min_pressure_protection)/ONE_ATMOSPHERE) additional_value += shock_protection + gas_leak_value + permeability_value + pressure_protection diff --git a/code/modules/economy/worth_obj.dm b/code/modules/economy/worth_obj.dm index c7871c833c1..04b75a13fed 100644 --- a/code/modules/economy/worth_obj.dm +++ b/code/modules/economy/worth_obj.dm @@ -24,7 +24,7 @@ . = 0 for(var/mat in matter) . += matter[mat] - . = FLOOR(. * REAGENT_UNITS_PER_MATERIAL_UNIT) + . = floor(. * REAGENT_UNITS_PER_MATERIAL_UNIT) else . = clamp(w_class, ITEM_SIZE_MIN, ITEM_SIZE_MAX) . = max(1, round(.)) \ No newline at end of file diff --git a/code/modules/fabrication/designs/general/designs_general.dm b/code/modules/fabrication/designs/general/designs_general.dm index b2c800b46e2..47eebe2b454 100644 --- a/code/modules/fabrication/designs/general/designs_general.dm +++ b/code/modules/fabrication/designs/general/designs_general.dm @@ -112,8 +112,8 @@ /datum/fabricator_recipe/fiberglass/get_resources() resources = list( - /decl/material/solid/glass = CEILING((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)/2), - /decl/material/solid/organic/plastic = CEILING((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)/2) + /decl/material/solid/glass = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)/2), + /decl/material/solid/organic/plastic = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)/2) ) /datum/fabricator_recipe/struts @@ -122,7 +122,7 @@ /datum/fabricator_recipe/struts/get_resources() resources = list( - /decl/material/solid/metal/steel = CEILING((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), + /decl/material/solid/metal/steel = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), ) /datum/fabricator_recipe/struts/plastic @@ -131,7 +131,7 @@ /datum/fabricator_recipe/struts/plastic/get_resources() resources = list( - /decl/material/solid/organic/plastic = CEILING((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), + /decl/material/solid/organic/plastic = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), ) /datum/fabricator_recipe/struts/aluminium @@ -141,7 +141,7 @@ /datum/fabricator_recipe/struts/aluminium/get_resources() resources = list( - /decl/material/solid/metal/aluminium = CEILING((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), + /decl/material/solid/metal/aluminium = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), ) /datum/fabricator_recipe/struts/titanium @@ -151,7 +151,7 @@ /datum/fabricator_recipe/struts/titanium/get_resources() resources = list( - /decl/material/solid/metal/titanium = CEILING((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), + /decl/material/solid/metal/titanium = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)), ) /datum/fabricator_recipe/umbrella diff --git a/code/modules/fabrication/fabricator_intake.dm b/code/modules/fabrication/fabricator_intake.dm index 5af01117dbe..420e31c5bc1 100644 --- a/code/modules/fabrication/fabricator_intake.dm +++ b/code/modules/fabrication/fabricator_intake.dm @@ -9,7 +9,7 @@ for(var/R in thing.reagents.reagent_volumes) if(!base_storage_capacity[R]) continue - var/taking_reagent = min(REAGENT_VOLUME(thing.reagents, R), FLOOR((storage_capacity[R] - stored_material[R]) * REAGENT_UNITS_PER_MATERIAL_UNIT)) + var/taking_reagent = min(REAGENT_VOLUME(thing.reagents, R), floor((storage_capacity[R] - stored_material[R]) * REAGENT_UNITS_PER_MATERIAL_UNIT)) if(taking_reagent <= 0) continue var/reagent_matter = round(taking_reagent / REAGENT_UNITS_PER_MATERIAL_UNIT) @@ -34,7 +34,7 @@ . = SUBSTANCE_TAKEN_NONE var/obj/item/stack/stack_ref = istype(thing, /obj/item/stack) && thing - var/stack_matter_div = stack_ref ? max(1, CEILING(SHEET_MATERIAL_AMOUNT * stack_ref.matter_multiplier)) : 1 + var/stack_matter_div = stack_ref ? max(1, ceil(SHEET_MATERIAL_AMOUNT * stack_ref.matter_multiplier)) : 1 var/stacks_used = 0 var/mat_colour = thing.color @@ -53,7 +53,7 @@ stored_material[material_def.type] += taking_material if(stack_ref) - stacks_used = max(stacks_used, CEILING(taking_material/stack_matter_div)) + stacks_used = max(stacks_used, ceil(taking_material/stack_matter_div)) if(storage_capacity[material_def.type] == stored_material[material_def.type]) . = SUBSTANCE_TAKEN_FULL diff --git a/code/modules/fabrication/fabricator_topic.dm b/code/modules/fabrication/fabricator_topic.dm index 957edd9a6ca..3d852b0f4bf 100644 --- a/code/modules/fabrication/fabricator_topic.dm +++ b/code/modules/fabrication/fabricator_topic.dm @@ -70,7 +70,7 @@ if(mat?.phase_at_temperature() != MAT_PHASE_SOLID) stored_material[mat_path] = 0 else - var/sheet_count = FLOOR(stored_material[mat_path]/SHEET_MATERIAL_AMOUNT) + var/sheet_count = floor(stored_material[mat_path]/SHEET_MATERIAL_AMOUNT) if(sheet_count >= 1) stored_material[mat_path] -= sheet_count * SHEET_MATERIAL_AMOUNT SSmaterials.create_object(mat_path, get_turf(src), sheet_count) diff --git a/code/modules/fabrication/fabricator_ui.dm b/code/modules/fabrication/fabricator_ui.dm index 20b07816989..78069693e74 100644 --- a/code/modules/fabrication/fabricator_ui.dm +++ b/code/modules/fabrication/fabricator_ui.dm @@ -123,7 +123,7 @@ var/list/multiplier if(R.max_amount >= PRINT_MULTIPLIER_DIVISOR && max_sheets >= PRINT_MULTIPLIER_DIVISOR) multiplier = list() - for(var/i = 1 to FLOOR(min(R.max_amount, max_sheets)/PRINT_MULTIPLIER_DIVISOR)) + for(var/i = 1 to floor(min(R.max_amount, max_sheets)/PRINT_MULTIPLIER_DIVISOR)) var/mult = i * PRINT_MULTIPLIER_DIVISOR multiplier += list(list("label" = "x[mult]", "multiplier" = mult)) return multiplier diff --git a/code/modules/fabrication/recycler.dm b/code/modules/fabrication/recycler.dm index 6aa876385aa..aa2dc4ccd05 100644 --- a/code/modules/fabrication/recycler.dm +++ b/code/modules/fabrication/recycler.dm @@ -88,7 +88,7 @@ // Dump the material out as a stack. var/obj/item/stack/material/cubestack = created_stack_type var/max_stack = initial(cubestack.max_amount) - var/stack_amount = FLOOR(munched_matter[mat] / SHEET_MATERIAL_AMOUNT) + var/stack_amount = floor(munched_matter[mat] / SHEET_MATERIAL_AMOUNT) // Keep track of any trace matter for the next run. munched_matter[mat] -= stack_amount * SHEET_MATERIAL_AMOUNT diff --git a/code/modules/fluids/_fluid.dm b/code/modules/fluids/_fluid.dm index f68f74d9b67..9f15d141fe8 100644 --- a/code/modules/fluids/_fluid.dm +++ b/code/modules/fluids/_fluid.dm @@ -43,7 +43,7 @@ var/decl/material/main_reagent = loc_reagents?.get_primary_reagent_decl() var/new_alpha if(main_reagent) // TODO: weighted alpha from all reagents, not just primary - new_alpha = clamp(CEILING(255*(reagent_volume/FLUID_DEEP)) * main_reagent.opacity, main_reagent.min_fluid_opacity, main_reagent.max_fluid_opacity) + new_alpha = clamp(ceil(255*(reagent_volume/FLUID_DEEP)) * main_reagent.opacity, main_reagent.min_fluid_opacity, main_reagent.max_fluid_opacity) else new_alpha = FLUID_MIN_ALPHA if(new_alpha != alpha) diff --git a/code/modules/food/assembled.dm b/code/modules/food/assembled.dm index c2c426c431a..d11f3e9805b 100644 --- a/code/modules/food/assembled.dm +++ b/code/modules/food/assembled.dm @@ -65,7 +65,27 @@ // TODO: move reagents/matter into produced food object. if(ispath(create_type) && user.canUnEquip(src)) - var/obj/item/food/result = new create_type() + var/obj/item/food/result + if(ispath(create_type, /obj/item/food)) + + // Create the food with no plate, and move over any existing plate. + result = new create_type(null, null, TRUE) // Skip plate creation. + + if(istype(W, /obj/item/food)) + var/obj/item/food/other_food = W + result.plate = other_food.plate + other_food.plate = null + + if(!result.plate && plate) + result.plate = plate + plate = null + + if(istype(result.plate) && result.plate.loc != result) + result.plate.forceMove(result) + + else + result = new create_type + //If the snack was in your hands, the result will be too if (src in user.get_held_item_slots()) user.drop_from_inventory(src) diff --git a/code/modules/food/cooking/_recipe.dm b/code/modules/food/cooking/_recipe.dm index 05988240f34..037207dcc84 100644 --- a/code/modules/food/cooking/_recipe.dm +++ b/code/modules/food/cooking/_recipe.dm @@ -157,7 +157,11 @@ var/global/list/_cooking_recipe_cache = list() continue container_contents -= thing if(isnum(needed_items[itype])) - --needed_items[itype] + if(istype(thing, /obj/item/stack)) + var/obj/item/stack/stack = thing + needed_items[itype] -= stack.amount + else + --needed_items[itype] if(needed_items[itype] <= 0) needed_items -= itype break @@ -199,6 +203,8 @@ var/global/list/_cooking_recipe_cache = list() // Create the actual result atom. Handled by a proc to allow for recipes to override it. /decl/recipe/proc/create_result_atom(atom/container, list/used_ingredients) + if(ispath(result, /obj/item/food)) + return new result(container, null, TRUE) // Supply argument to skip plate creation. return new result(container) /// Return a data list to pass to a reagent creation proc. Allows for overriding/mutation based on ingredients. @@ -228,6 +234,23 @@ var/global/list/_cooking_recipe_cache = list() var/list/container_contents = container.get_contained_external_atoms() if(LAZYLEN(items)) for(var/item_type in items) + if(ispath(item_type, /obj/item/stack)) + var/needed_amount = max(1, items[item_type]) + var/obj/item/stack/stack + while(needed_amount > 0 && (stack = locate(item_type) in container_contents)) + if(QDELETED(stack)) + container_contents -= stack + continue + var/amount_to_take = min(stack.amount, needed_amount) + var/obj/item/stack/used + if(stack.amount <= amount_to_take) // We're using the whole stack. + used = stack + container_contents -= stack + else + used = stack.split(amount_to_take) + used_ingredients["items"] += used + needed_amount -= used.amount + continue for(var/item_count in 1 to max(1, items[item_type])) var/obj/item/item = locate(item_type) in container_contents container_contents -= item diff --git a/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm b/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm index e31087d3ced..3a06b08ca56 100644 --- a/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm +++ b/code/modules/food/cooking/cooking_vessels/_cooking_vessel.dm @@ -71,13 +71,18 @@ . += "\the [thing]" if(reagents?.total_volume) - for(var/reagent_type in reagents.reagent_volumes) - var/decl/material/reagent = GET_DECL(reagent_type) - var/reagent_name = reagent.get_reagent_name(reagents) + for(var/solid_type in reagents.solid_volumes) + var/decl/material/reagent = GET_DECL(solid_type) + var/reagent_name = reagent.get_reagent_name(reagents, MAT_PHASE_SOLID) + . += "[reagents.solid_volumes[solid_type]]u of [reagent_name]" + + for(var/liquid_type in reagents.liquid_volumes) + var/decl/material/reagent = GET_DECL(liquid_type) + var/reagent_name = reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID) if(!isnull(reagent.boiling_point) && temperature >= reagent.boiling_point && reagent.soup_hot_desc) - . += "[reagents.reagent_volumes[reagent_type]]u of [reagent.soup_hot_desc] [reagent_name]" + . += "[reagents.liquid_volumes[liquid_type]]u of [reagent.soup_hot_desc] [reagent_name]" else - . += "[reagents.reagent_volumes[reagent_type]]u of [reagent_name]" + . += "[reagents.liquid_volumes[liquid_type]]u of [reagent_name]" /obj/item/chems/cooking_vessel/examine(mob/user, distance) . = ..() diff --git a/code/modules/food/utensils/_utensil.dm b/code/modules/food/utensils/_utensil.dm index d59010a231d..9d39eb9a4ea 100644 --- a/code/modules/food/utensils/_utensil.dm +++ b/code/modules/food/utensils/_utensil.dm @@ -62,19 +62,6 @@ if(check_state_in_icon(loaded_state, icon)) add_overlay(overlay_image(icon, loaded_state, loaded_food.reagents?.get_color() || loaded_food.filling_color || get_color(), RESET_COLOR)) -/obj/item/food - /// A type used when cloning this food item for utensils. - var/utensil_type - /// A set of utensil flags determining which utensil interactions are valid with this food. - var/utensil_flags = UTENSIL_FLAG_SCOOP | UTENSIL_FLAG_COLLECT - -/obj/item/food/Initialize() - . = ..() - if(isnull(utensil_type)) - utensil_type = type - if(slice_path && slice_num) - utensil_flags |= UTENSIL_FLAG_SLICE - // TODO: generalize this for edible non-food items somehow? /obj/item/food/proc/seperate_chunk(obj/item/utensil/utensil, mob/user) if(!istype(utensil)) @@ -84,7 +71,7 @@ // Create a dummy copy of the target food item. // This ensures we keep all food behavior, strings, sounds, etc. - utensil.loaded_food = new utensil_type(utensil) + utensil.loaded_food = new utensil_food_type(utensil, material?.type, TRUE) QDEL_NULL(utensil.loaded_food.trash) QDEL_NULL(utensil.loaded_food.plate) utensil.loaded_food.color = color @@ -160,7 +147,7 @@ return . || TRUE /obj/item/food/proc/create_slice() - return new slice_path(loc, material?.type) + return new slice_path(loc, material?.type, TRUE) /obj/item/food/proc/do_utensil_interaction(obj/item/tool, mob/user) diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index 530125d0dec..883fe8c7db1 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -367,7 +367,7 @@ var/global/list/card_decks = list() overlays += I return - var/offset = FLOOR(20/cards.len) + var/offset = floor(20/cards.len) var/matrix/M = matrix() if(direction) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 85fe6a343e1..40e3fe78958 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -23,7 +23,7 @@ else if(!seeds_extracted && seed.min_seed_extracted) to_chat(user, SPAN_NOTICE("With a knife, you could extract at least [seed.min_seed_extracted] seed\s.")) -/obj/item/food/grown/Initialize(mapload, material_key, _seed) +/obj/item/food/grown/Initialize(mapload, material_key, skip_plate = FALSE, _seed) if(isnull(seed) && _seed) seed = _seed @@ -65,7 +65,7 @@ if(!dried_type) dried_type = type - . = ..(mapload) //Init reagents + . = ..(mapload, material_key, skip_plate) //Init reagents /obj/item/food/grown/initialize_reagents(populate) if(reagents) @@ -287,7 +287,7 @@ var/global/list/_wood_materials = list( . = dry ? "dried [seed.grown_tag]" : seed.grown_tag /obj/item/food/grown/create_slice() - return new slice_path(loc, material?.type, seed) + return new slice_path(loc, material?.type, TRUE, seed) /obj/item/food/grown/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone) . = ..() diff --git a/code/modules/hydroponics/processed_grown.dm b/code/modules/hydroponics/processed_grown.dm index 62587587fa6..02503337e9d 100644 --- a/code/modules/hydroponics/processed_grown.dm +++ b/code/modules/hydroponics/processed_grown.dm @@ -18,7 +18,7 @@ /// Used in recipes to distinguish between general types. var/processed_grown_tag -/obj/item/food/processed_grown/Initialize(mapload, material_key, _seed) +/obj/item/food/processed_grown/Initialize(mapload, material_key, skip_plate = FALSE, _seed) if(isnull(seed) && _seed) seed = _seed @@ -43,7 +43,7 @@ . = dry ? "dried [seed.grown_tag] [processed_grown_tag]" : "[seed.grown_tag] [processed_grown_tag]" /obj/item/food/processed_grown/create_slice() - return new slice_path(loc, material?.type, seed) + return new slice_path(loc, material?.type, TRUE, seed) /obj/item/food/processed_grown/proc/update_strings() return diff --git a/code/modules/hydroponics/seed.dm b/code/modules/hydroponics/seed.dm index 12a962062f9..d39e744c1c5 100644 --- a/code/modules/hydroponics/seed.dm +++ b/code/modules/hydroponics/seed.dm @@ -624,7 +624,11 @@ . += new product_type(get_turf(user), using_yield) else for(var/i = 1 to total_yield) - var/obj/item/product = new product_type(get_turf(user), null, src) + var/obj/item/product + if(ispath(product_type, /obj/item/food)) + product = new product_type(get_turf(user), null, TRUE, src) + else + product = new product_type(get_turf(user), null, src) . += product if(get_trait(TRAIT_PRODUCT_COLOUR) && istype(product, /obj/item/food)) diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index e55388d3e86..d3d4b5be43d 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -196,7 +196,7 @@ if(length(assembly_components) > components_per_page) HTML += "
\[" - for(var/i = 1 to CEILING(length(assembly_components)/components_per_page)) + for(var/i = 1 to ceil(length(assembly_components)/components_per_page)) if((i-1) == interact_page) HTML += " [i]" else @@ -384,7 +384,7 @@ add_allowed_scanner(user.ckey) // Make sure we're not on an invalid page - interact_page = clamp(interact_page, 0, CEILING(length(assembly_components)/components_per_page)-1) + interact_page = clamp(interact_page, 0, ceil(length(assembly_components)/components_per_page)-1) return TRUE diff --git a/code/modules/integrated_electronics/core/printer.dm b/code/modules/integrated_electronics/core/printer.dm index 71b69011ced..0499326aaad 100644 --- a/code/modules/integrated_electronics/core/printer.dm +++ b/code/modules/integrated_electronics/core/printer.dm @@ -69,7 +69,7 @@ var/obj/item/stack/material/M = O var/amt = M.amount if(amt * SHEET_MATERIAL_AMOUNT + materials[M.material.type] > metal_max) - amt = -round(-(metal_max - materials[M.material.type]) / SHEET_MATERIAL_AMOUNT) //round up + amt = ceil((metal_max - materials[M.material.type]) / SHEET_MATERIAL_AMOUNT) if(M.use(amt)) materials[M.material.type] = min(metal_max, materials[M.material.type] + amt * SHEET_MATERIAL_AMOUNT) to_chat(user, "You insert [M.material.solid_name] into \the [src].") diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index dc0320fe7c7..5ebc210383e 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -148,7 +148,6 @@ #define POLAR_TO_CART_X(R,T) ((R) * cos(T)) #define POLAR_TO_CART_Y(R,T) ((R) * sin(T)) #define DETERMINANT(A_X,A_Y,B_X,B_Y) ((A_X)*(B_Y) - (A_Y)*(B_X)) -#define MINMAX(NUM) ((NUM) < 0 ? -round(-(NUM)) : round(NUM)) #define ARBITRARY_NUMBER 10 /datum/light_source/proc/regenerate_angle(ndir) @@ -190,16 +189,15 @@ // Convert our angle + range into a vector. limit_a_x = POLAR_TO_CART_X(light_range + ARBITRARY_NUMBER, limit_a_t) - limit_a_x = MINMAX(limit_a_x) + limit_a_x = trunc(limit_a_x) limit_a_y = POLAR_TO_CART_Y(light_range + ARBITRARY_NUMBER, limit_a_t) - limit_a_y = MINMAX(limit_a_y) + limit_a_y = trunc(limit_a_y) limit_b_x = POLAR_TO_CART_X(light_range + ARBITRARY_NUMBER, limit_b_t) - limit_b_x = MINMAX(limit_b_x) + limit_b_x = trunc(limit_b_x) limit_b_y = POLAR_TO_CART_Y(light_range + ARBITRARY_NUMBER, limit_b_t) - limit_b_y = MINMAX(limit_b_y) + limit_b_y = trunc(limit_b_y) #undef ARBITRARY_NUMBER -#undef MINMAX #undef POLAR_TO_CART_Y #undef POLAR_TO_CART_X diff --git a/code/modules/locks/lock.dm b/code/modules/locks/lock.dm index 9084a65d3db..ea97b1cad5b 100644 --- a/code/modules/locks/lock.dm +++ b/code/modules/locks/lock.dm @@ -84,8 +84,8 @@ unlock(lock_data) return TRUE else if(prob(5 * unlock_power)) - to_chat(user, SPAN_WARNING("You accidentally break \the [holder]'s lock with your [I.name]!")) - status |= LOCK_BROKEN + to_chat(user, SPAN_WARNING("You accidentally break \the [I]!")) + I.physically_destroyed() else to_chat(user, SPAN_WARNING("You fail to pick open \the [holder].")) return FALSE \ No newline at end of file diff --git a/code/modules/maps/_map_template.dm b/code/modules/maps/_map_template.dm index 447f6d8acea..98b9f3a5c94 100644 --- a/code/modules/maps/_map_template.dm +++ b/code/modules/maps/_map_template.dm @@ -152,8 +152,8 @@ /// * If centered is TRUE, the template's center will be aligned to the world's center. Otherwise, the template will load at pos 1,1. /datum/map_template/proc/load_new_z(no_changeturf = TRUE, centered = TRUE) //When we're set to centered we're aligning the center of the template to the center of the map - var/x = max(CEILING((WORLD_CENTER_X - width/2)), 1) - var/y = max(CEILING((WORLD_CENTER_Y - height/2)), 1) + var/x = max(ceil((WORLD_CENTER_X - width/2)), 1) + var/y = max(ceil((WORLD_CENTER_Y - height/2)), 1) if(!centered) x = 1 y = 1 @@ -193,7 +193,7 @@ /datum/map_template/proc/load(turf/T, centered=FALSE) if(centered) - T = locate(CEILING(T.x - width/2), CEILING(T.y - height/2), T.z) + T = locate(ceil(T.x - width/2), ceil(T.y - height/2), T.z) if(!T) CRASH("Can't load '[src]' (size: [width]x[height]) onto a null turf! Current world size ([WORLD_SIZE_TO_STRING]).") if(!IS_WITHIN_WORLD((T.x + width - 1), (T.y + height - 1))) // the first row/column begins with T, so subtract 1 diff --git a/code/modules/maps/template_types/random_exoplanet/random_planet.dm b/code/modules/maps/template_types/random_exoplanet/random_planet.dm index 9fc56448312..78d7baa47f2 100644 --- a/code/modules/maps/template_types/random_exoplanet/random_planet.dm +++ b/code/modules/maps/template_types/random_exoplanet/random_planet.dm @@ -246,7 +246,7 @@ var/list/places var/attempts = 10 * amount_shuttle_landing_points var/points_left = amount_shuttle_landing_points - var/landing_radius = CEILING(max_shuttle_radius / 2) + var/landing_radius = ceil(max_shuttle_radius / 2) var/border_padding = landing_radius + 3 while(points_left) diff --git a/code/modules/materials/_material_stack.dm b/code/modules/materials/_material_stack.dm index 4ea3840e334..bf7a3e2d576 100644 --- a/code/modules/materials/_material_stack.dm +++ b/code/modules/materials/_material_stack.dm @@ -175,12 +175,12 @@ if(convert_type) var/product_per_sheet = matter_multiplier / initial(convert_type.matter_multiplier) - var/minimum_per_one_product = CEILING(1 / product_per_sheet) + var/minimum_per_one_product = ceil(1 / product_per_sheet) if(get_amount() < minimum_per_one_product) to_chat(user, SPAN_WARNING("You will need [minimum_per_one_product] [minimum_per_one_product == 1 ? singular_name : plural_name] to produce [product_per_sheet] [product_per_sheet == 1 ? initial(convert_type.singular_name) : initial(convert_type.plural_name)].")) else if(W.do_tool_interaction(convert_tool, user, src, 1 SECOND, set_cooldown = TRUE) && !QDELETED(src) && get_amount() >= minimum_per_one_product) - var/obj/item/stack/product = new convert_type(get_turf(src), CEILING(product_per_sheet), material?.type, reinf_material?.type) + var/obj/item/stack/product = new convert_type(get_turf(src), ceil(product_per_sheet), material?.type, reinf_material?.type) use(minimum_per_one_product) if(product.add_to_stacks(user, TRUE)) user.put_in_hands(product) diff --git a/code/modules/materials/_materials.dm b/code/modules/materials/_materials.dm index 45d32f23904..e5ddc832fb5 100644 --- a/code/modules/materials/_materials.dm +++ b/code/modules/materials/_materials.dm @@ -64,6 +64,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) var/solid_name var/gas_name var/liquid_name + var/solution_name // Name for the material in solution. var/use_name var/wall_name = "wall" // Name given to walls of this material var/flags = 0 // Various status modifiers. @@ -73,7 +74,6 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) var/antag_text var/default_solid_form = /obj/item/stack/material/sheet - var/soup_name var/soup_hot_desc = "simmering" var/affect_blood_on_ingest = TRUE @@ -355,8 +355,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) gas_name ||= use_name // Use solid_name for adjective_name so that we get "ice bracelet" instead of "water bracelet" for things made of water below 0C. adjective_name ||= solid_name - // Default soup_name to liquid_name if unset. - soup_name ||= liquid_name + adjective_name ||= use_name // Null/clear a bunch of physical vars as this material is fake. if(holographic) @@ -597,7 +596,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) // General wall debris product placement. // Not particularly necessary aside from snowflakey cult girders. /decl/material/proc/place_dismantled_product(var/turf/target, var/is_devastated, var/amount = 2, var/drop_type) - amount = is_devastated ? FLOOR(amount * 0.5) : amount + amount = is_devastated ? floor(amount * 0.5) : amount if(amount > 0) return create_object(target, amount, object_type = drop_type) @@ -678,7 +677,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) // This doesn't apply to skin contact - this is for, e.g. extinguishers and sprays. The difference is that reagent is not directly on the mob's skin - it might just be on their clothing. /decl/material/proc/touch_mob(var/mob/living/M, var/amount, var/datum/reagents/holder) if(accelerant_value != FUEL_VALUE_NONE && amount && istype(M)) - M.fire_stacks += FLOOR((amount * accelerant_value)/FLAMMABLE_LIQUID_DIVISOR) + M.fire_stacks += floor((amount * accelerant_value)/FLAMMABLE_LIQUID_DIVISOR) #undef FLAMMABLE_LIQUID_DIVISOR /decl/material/proc/touch_turf(var/turf/T, var/amount, var/datum/reagents/holder) // Cleaner cleaning, lube lubbing, etc, all go here @@ -1005,14 +1004,31 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay) if(!isnull(boiling_point) && burn_temperature >= boiling_point) LAZYSET(., type, amount) -/decl/material/proc/get_reagent_name(datum/reagents/holder) +/decl/material/proc/get_reagent_name(datum/reagents/holder, phase = MAT_PHASE_LIQUID) + if(istype(holder) && holder.reagent_data) var/list/rdata = holder.reagent_data[type] if(rdata) var/data_name = rdata["mask_name"] if(data_name) return data_name - return soup_name + + if(phase == MAT_PHASE_SOLID) + return solid_name + + // Check if the material is in solution. This is a much simpler check than normal solubility. + if(phase == MAT_PHASE_LIQUID) + if(!istype(holder)) + return liquid_name + var/atom/location = holder.get_reaction_loc() + var/temperature = location?.temperature || T20C + + if(melting_point > temperature) + return solution_name + else + return liquid_name + + return "something" /decl/material/proc/get_reagent_color(datum/reagents/holder) if(istype(holder) && holder.reagent_data) diff --git a/code/modules/materials/definitions/gasses/_mat_gas.dm b/code/modules/materials/definitions/gasses/_mat_gas.dm index 8d3cfb0c300..6c0703bda43 100644 --- a/code/modules/materials/definitions/gasses/_mat_gas.dm +++ b/code/modules/materials/definitions/gasses/_mat_gas.dm @@ -21,4 +21,6 @@ liquid_name = "liquid [name]" if(!solid_name) solid_name = "frozen [name]" + if(!solution_name) + solution_name = "[name] solution" . = ..() diff --git a/code/modules/materials/definitions/solids/_mat_solid.dm b/code/modules/materials/definitions/solids/_mat_solid.dm index 84d739d5b92..5e7797cd07d 100644 --- a/code/modules/materials/definitions/solids/_mat_solid.dm +++ b/code/modules/materials/definitions/solids/_mat_solid.dm @@ -18,6 +18,8 @@ liquid_name = "molten [name]" if(!gas_name) gas_name = "vaporized [name]" + if(!solution_name) + solution_name = "[name] solution" if(!ore_compresses_to) ore_compresses_to = type . = ..() \ No newline at end of file diff --git a/code/modules/materials/definitions/solids/materials_solid_mineral.dm b/code/modules/materials/definitions/solids/materials_solid_mineral.dm index 2aed6694130..cd7cbd733d9 100644 --- a/code/modules/materials/definitions/solids/materials_solid_mineral.dm +++ b/code/modules/materials/definitions/solids/materials_solid_mineral.dm @@ -160,7 +160,7 @@ dissolves_into = list( /decl/material/solid/sodium = 1 ) - soup_name = "salt" + solid_name = "salt" soup_hot_desc = null /decl/material/solid/potash diff --git a/code/modules/materials/material_debris.dm b/code/modules/materials/material_debris.dm index 2f842f7c08d..8c4844a8124 100644 --- a/code/modules/materials/material_debris.dm +++ b/code/modules/materials/material_debris.dm @@ -14,11 +14,31 @@ var/list/mat_names = list() var/highest_mat + + var/total_matter = 0 + for(var/mat in matter) - if(!highest_mat || matter[highest_mat] < matter[mat]) + var/mat_amt = matter[mat] + if(!highest_mat || matter[highest_mat] < mat_amt) highest_mat = mat var/decl/material/material_decl = GET_DECL(mat) mat_names += material_decl.solid_name + total_matter += mat_amt + + // Safety check, although this should be prevented for player side interactions + if(total_matter > MAX_SCRAP_MATTER) + var/divisor = ceil(total_matter / MAX_SCRAP_MATTER) + var/list/matter_per_pile = list() + + for(var/mat in matter) + matter_per_pile[mat] = round(matter[mat] / divisor) + + for(var/i in 1 to (divisor - 1)) + var/obj/item/debris/scraps/pile = new type(get_turf(src)) + pile.matter = matter_per_pile.Copy() + pile.update_primary_material() + + matter = matter_per_pile if(!highest_mat) qdel(src) @@ -27,6 +47,11 @@ name = "[english_list(mat_names)] [initial(name)]" color = material.color +/obj/item/debris/scraps/proc/get_total_matter() + . = 0 + for(var/mat in matter) + . += matter[mat] + /obj/item/debris/scraps/attack_self(mob/user) // We can only split up scraps that are pure. @@ -48,16 +73,40 @@ /obj/item/debris/scraps/attackby(obj/item/W, mob/user) if(istype(W, type) && user.try_unequip(W)) + var/obj/item/debris/scraps/other = W + var/space_remaining = MAX_SCRAP_MATTER - get_total_matter() + var/other_total_matter = other.get_total_matter() LAZYINITLIST(matter) - for(var/mat in W.matter) - matter[mat] += W.matter[mat] + + if(space_remaining <= 0) + to_chat(user, SPAN_WARNING("You can't add any more material to \the [src]!")) + user.put_in_hands(other) + return TRUE + + else if(space_remaining >= other_total_matter) + for(var/mat in other.matter) + matter[mat] += other.matter[mat] + + other.matter = null + other.material = null + to_chat(user, SPAN_NOTICE("You combine \the [src] and \the [other].")) + qdel(other) + update_primary_material() + user.put_in_hands(src) + else + for(var/mat in other.matter) + var/ratio = other.matter[mat] / other_total_matter + matter[mat] += round(space_remaining*ratio) + other.matter[mat] -= round(space_remaining*ratio) + + to_chat(user, SPAN_NOTICE("You partially combine \the [src] and \the [other].")) + update_primary_material() + other.update_primary_material() + if(!QDELETED(other)) + user.put_in_hands(other) + UNSETEMPTY(matter) - W.matter = null - W.material = null - to_chat(user, SPAN_NOTICE("You combine \the [src] and \the [W].")) - qdel(W) - update_primary_material() - user.put_in_hands(src) + return TRUE . = ..() @@ -65,6 +114,75 @@ /obj/item/debris/scraps/squash_item(skip_qdel = FALSE) return +// Physical object for holding solid reagents which are out of solution or slurry. +/obj/item/debris/scraps/chemical + desc = "A pile of dust and small filings." + + // Track this to stop endless creation and deletion while fluids settle. + var/time_created + +/obj/item/debris/scraps/chemical/Initialize(ml, material_key) + . = ..() + time_created = REALTIMEOFDAY + +/obj/item/debris/scraps/chemical/fluid_act(datum/reagents/fluids) + SHOULD_CALL_PARENT(FALSE) + + if(!istype(loc, /turf)) + return + if((REALTIMEOFDAY - time_created) < 5 SECONDS) + return + if(!QDELETED(src) && fluids?.total_liquid_volume >= FLUID_SLURRY) + var/free_space = REAGENTS_FREE_SPACE(fluids) + for(var/matter_type in matter) + if(free_space <= MINIMUM_CHEMICAL_VOLUME) + break + var/reagents_added = min(free_space, MATERIAL_UNITS_TO_REAGENTS_UNITS(matter[matter_type])) + fluids.add_reagent(matter_type, reagents_added, defer_update = TRUE, phase = MAT_PHASE_SOLID) + matter[matter_type] -= reagents_added/REAGENT_UNITS_PER_MATERIAL_UNIT + if(matter[matter_type] <= 0) + matter -= matter_type + + free_space -= reagents_added + + fluids.handle_update() + update_primary_material() + +/obj/item/debris/scraps/chemical/afterattack(atom/target, mob/user, proximity) + if(!ATOM_IS_OPEN_CONTAINER(target) || !proximity || !target.reagents) + return ..() + + var/free_space = target.get_reagent_space() + if(free_space <= 0) + to_chat(user, SPAN_WARNING("\The [target] is full!")) + return FALSE + + var/total_matter = get_total_matter() + + for(var/matter_type in matter) + if(free_space <= MINIMUM_CHEMICAL_VOLUME) + break + + var/adj_mat_amt = min(1, (free_space/REAGENT_UNITS_PER_MATERIAL_UNIT)/total_matter)*matter[matter_type] + var/reagents_added = max(min(free_space, MATERIAL_UNITS_TO_REAGENTS_UNITS(adj_mat_amt)), MINIMUM_CHEMICAL_VOLUME) + target.reagents.add_reagent(matter_type, reagents_added, defer_update = TRUE, phase = MAT_PHASE_SOLID) + matter[matter_type] -= reagents_added/REAGENT_UNITS_PER_MATERIAL_UNIT + if(matter[matter_type] <= 0) + matter -= matter_type + + free_space -= reagents_added + + if(!length(matter)) + to_chat(user, SPAN_NOTICE("You carefully dump \the [src] into \the [target].")) + user?.drop_from_inventory(src) + qdel(src) + else + to_chat(user, SPAN_NOTICE("You carefully dump some of \the [src] into \the [target].")) + update_primary_material() + + playsound(src, 'sound/effects/refill.ogg', 25, 1) + return TRUE + // This object is sort of a placeholder for a more nuanced melting and item damage system. // The idea is if your gun is half-melted it should not function as a gun anymore. /obj/item/debris/melted @@ -96,4 +214,4 @@ // If we've melted all our matter, destroy the object. if(!LAZYLEN(matter) && !QDELETED(src)) material = null - physically_destroyed() + physically_destroyed() \ No newline at end of file diff --git a/code/modules/mining/machinery/material_compressor.dm b/code/modules/mining/machinery/material_compressor.dm index 20d359bea1d..a899178e234 100644 --- a/code/modules/mining/machinery/material_compressor.dm +++ b/code/modules/mining/machinery/material_compressor.dm @@ -17,7 +17,7 @@ if(!O.simulated || O.anchored) continue for(var/mat in O.reagents?.reagent_volumes) - stored[mat] = stored[mat] + FLOOR((O.reagents.reagent_volumes[mat] / REAGENT_UNITS_PER_MATERIAL_UNIT) * 0.75) // liquid reagents, lossy + stored[mat] = stored[mat] + floor((O.reagents.reagent_volumes[mat] / 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) @@ -40,13 +40,13 @@ if(output_turf) var/produced = 0 for(var/mat in stored) - var/sheets = min(FLOOR((stored[mat] / SHEET_MATERIAL_AMOUNT) / 2), (MAX_COMPRESS_ORE_PER_TICK - produced)) + var/sheets = min(floor((stored[mat] / SHEET_MATERIAL_AMOUNT) / 2), (MAX_COMPRESS_ORE_PER_TICK - produced)) if(sheets <= 0) continue var/decl/material/source = GET_DECL(mat) var/decl/material/product = source.ore_compresses_to ? GET_DECL(source.ore_compresses_to) : source product.create_object(output_turf, sheets) - stored[mat] -= CEILING(sheets * SHEET_MATERIAL_AMOUNT * 2) + stored[mat] -= ceil(sheets * SHEET_MATERIAL_AMOUNT * 2) if(stored[mat] <= 0) stored -= mat produced += sheets diff --git a/code/modules/mining/machinery/material_extractor.dm b/code/modules/mining/machinery/material_extractor.dm index 10b759facec..bd6e33dc6a4 100644 --- a/code/modules/mining/machinery/material_extractor.dm +++ b/code/modules/mining/machinery/material_extractor.dm @@ -88,7 +88,7 @@ if(eating.reagents?.total_volume) eating.reagents.trans_to_obj(src, eating.reagents.total_volume) for(var/mtype in eating.matter) - add_to_reagents(mtype, FLOOR(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) + add_to_reagents(mtype, floor(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) qdel(eating) if(eaten >= MAX_INTAKE_ORE_PER_TICK) break @@ -143,7 +143,7 @@ if(MAT_PHASE_SOLID) if(!can_process_material_name(mtype)) var/removing = REAGENT_VOLUME(reagents, mtype) || 0 - var/sheets = FLOOR((removing / REAGENT_UNITS_PER_MATERIAL_UNIT) / SHEET_MATERIAL_AMOUNT) + var/sheets = floor((removing / REAGENT_UNITS_PER_MATERIAL_UNIT) / SHEET_MATERIAL_AMOUNT) if(sheets > 0) // If we can't process any sheets at all, leave it for manual processing. adjusted_reagents = TRUE SSmaterials.create_object(mtype, output_turf, sheets) @@ -244,6 +244,8 @@ for(var/mtype in reagents.reagent_volumes) index += 1 var/decl/material/mat = GET_DECL(mtype) + + // TODO: Must be revised once state changes are in. Reagent names might be a litle odd in the meantime. var/is_liquid = mat.phase_at_temperature(temperature, ONE_ATMOSPHERE) == MAT_PHASE_LIQUID data["reagents"] += list(list("label" = "[mat.liquid_name] ([reagents.reagent_volumes[mtype]] U)", "index" = index, "liquid" = is_liquid)) diff --git a/code/modules/mining/machinery/material_smelter.dm b/code/modules/mining/machinery/material_smelter.dm index 6066a293e42..263e0f797c7 100644 --- a/code/modules/mining/machinery/material_smelter.dm +++ b/code/modules/mining/machinery/material_smelter.dm @@ -70,9 +70,9 @@ continue eaten++ if(eating.reagents?.total_volume) - eating.reagents.trans_to_obj(src, FLOOR(eating.reagents.total_volume * 0.75)) // liquid reagents, lossy + eating.reagents.trans_to_obj(src, floor(eating.reagents.total_volume * 0.75)) // liquid reagents, lossy for(var/mtype in eating.matter) - add_to_reagents(mtype, FLOOR(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) + add_to_reagents(mtype, floor(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) qdel(eating) if(eaten >= MAX_INTAKE_ORE_PER_TICK) break @@ -83,7 +83,7 @@ continue visible_message(SPAN_DANGER("\The [src] rips \the [H]'s [eating.name] clean off!")) for(var/mtype in eating.matter) - add_to_reagents(mtype, FLOOR(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) + add_to_reagents(mtype, floor(eating.matter[mtype] * REAGENT_UNITS_PER_MATERIAL_UNIT)) eating.dismember(silent = TRUE) qdel(eating) break @@ -91,7 +91,7 @@ if(output_turf) for(var/mtype in casting) var/ramt = REAGENT_VOLUME(reagents, mtype) || 0 - var/samt = FLOOR((ramt / REAGENT_UNITS_PER_MATERIAL_UNIT) / SHEET_MATERIAL_AMOUNT) + var/samt = floor((ramt / REAGENT_UNITS_PER_MATERIAL_UNIT) / SHEET_MATERIAL_AMOUNT) if(samt > 0) SSmaterials.create_object(mtype, output_turf, samt) remove_from_reagents(mtype, ramt) @@ -130,7 +130,7 @@ var/ramt = REAGENT_VOLUME(reagents, mtype) || 0 if(ramt <= 0 && !show_all_materials && !(mtype in always_show_materials)) continue - var/samt = FLOOR((ramt / REAGENT_UNITS_PER_MATERIAL_UNIT) / SHEET_MATERIAL_AMOUNT) + var/samt = floor((ramt / REAGENT_UNITS_PER_MATERIAL_UNIT) / SHEET_MATERIAL_AMOUNT) var/obj/item/stack/material/sheet = mat.default_solid_form materials += list(list("label" = "[mat.liquid_name]
[ramt]u ([samt] [samt == 1 ? initial(sheet.singular_name) : initial(sheet.plural_name)])", "casting" = (mtype in casting), "key" = "\ref[mat]")) data["materials"] = materials diff --git a/code/modules/mob/grab/grab_object.dm b/code/modules/mob/grab/grab_object.dm index b29b36e75ca..8eb8e907970 100644 --- a/code/modules/mob/grab/grab_object.dm +++ b/code/modules/mob/grab/grab_object.dm @@ -297,7 +297,7 @@ return current_grab.force_danger /obj/item/grab/proc/grab_slowdown() - . = CEILING(affecting?.get_object_size() * current_grab.grab_slowdown) + . = ceil(affecting?.get_object_size() * current_grab.grab_slowdown) . /= (affecting?.movable_flags & MOVABLE_FLAG_WHEELED) ? 2 : 1 . = max(.,1) diff --git a/code/modules/mob/language/language.dm b/code/modules/mob/language/language.dm index 0f3858aa97e..10b36cdd444 100644 --- a/code/modules/mob/language/language.dm +++ b/code/modules/mob/language/language.dm @@ -68,7 +68,7 @@ var/possible_syllables = allow_repeated_syllables ? syllables : syllables.Copy() for(var/i = 0;i0;x--) + for(var/x = rand(floor(syllable_count/syllable_divisor),syllable_count);x>0;x--) if(!length(possible_syllables)) break new_name += allow_repeated_syllables ? pick(possible_syllables) : pick_n_take(possible_syllables) diff --git a/code/modules/mob/living/brain/brain.dm b/code/modules/mob/living/brain/brain.dm index a65d3b1c050..35b97e4880b 100644 --- a/code/modules/mob/living/brain/brain.dm +++ b/code/modules/mob/living/brain/brain.dm @@ -107,7 +107,7 @@ if(emp_damage <= 0) return emp_damage -= 1 - var/msg_threshold = clamp(CEILING(emp_damage / (max_emp_damage / length(emp_reboot_strings))), 1, length(emp_reboot_strings)) + var/msg_threshold = clamp(ceil(emp_damage / (max_emp_damage / length(emp_reboot_strings))), 1, length(emp_reboot_strings)) if(last_emp_message != msg_threshold) last_emp_message = msg_threshold to_chat(src, emp_reboot_strings[msg_threshold]) diff --git a/code/modules/mob/living/human/descriptors/_descriptors.dm b/code/modules/mob/living/human/descriptors/_descriptors.dm index 2d4a57aa138..1cb122a1c05 100644 --- a/code/modules/mob/living/human/descriptors/_descriptors.dm +++ b/code/modules/mob/living/human/descriptors/_descriptors.dm @@ -59,7 +59,7 @@ ..(null) /datum/appearance_descriptor/proc/set_default_value() - default_value = CEILING(LAZYLEN(standalone_value_descriptors) * 0.5) + default_value = ceil(LAZYLEN(standalone_value_descriptors) * 0.5) /datum/appearance_descriptor/proc/get_mob_scale_adjustments(decl/bodytype/bodytype, offset_value) return @@ -134,12 +134,12 @@ /datum/appearance_descriptor/proc/get_comparative_value_string_smaller(value, decl/pronouns/my_gender, decl/pronouns/other_gender) var/maxval = LAZYLEN(comparative_value_descriptors_smaller) - value = clamp(CEILING(value * maxval), 1, maxval) + value = clamp(ceil(value * maxval), 1, maxval) return comparative_value_descriptors_smaller[value] /datum/appearance_descriptor/proc/get_comparative_value_string_larger(value, decl/pronouns/my_gender, decl/pronouns/other_gender) var/maxval = LAZYLEN(comparative_value_descriptors_larger) - value = clamp(CEILING(value * maxval), 1, maxval) + value = clamp(ceil(value * maxval), 1, maxval) return comparative_value_descriptors_larger[value] /datum/appearance_descriptor/proc/has_custom_value() diff --git a/code/modules/mob/living/human/human.dm b/code/modules/mob/living/human/human.dm index 696dbd34a07..f200ab697df 100644 --- a/code/modules/mob/living/human/human.dm +++ b/code/modules/mob/living/human/human.dm @@ -852,9 +852,9 @@ //Get fluffy numbers /mob/living/human/proc/get_blood_pressure() if(status_flags & FAKEDEATH) - return "[FLOOR(120+rand(-5,5))*0.25]/[FLOOR(80+rand(-5,5)*0.25)]" + return "[floor(120+rand(-5,5))*0.25]/[floor(80+rand(-5,5)*0.25)]" var/blood_result = get_blood_circulation() - return "[FLOOR((120+rand(-5,5))*(blood_result/100))]/[FLOOR((80+rand(-5,5))*(blood_result/100))]" + return "[floor((120+rand(-5,5))*(blood_result/100))]/[floor((80+rand(-5,5))*(blood_result/100))]" //Point at which you dun breathe no more. Separate from asystole crit, which is heart-related. /mob/living/human/nervous_system_failure() @@ -1024,7 +1024,7 @@ /mob/living/human/proc/post_setup(species_name, datum/mob_snapshot/supplied_appearance) try_refresh_visible_overlays() //Do this exactly once per setup -/mob/living/human/handle_flashed(var/obj/item/flash/flash, var/flash_strength) +/mob/living/human/handle_flashed(var/flash_strength) var/safety = eyecheck() if(safety < FLASH_PROTECTION_MODERATE) flash_strength = round(get_flash_mod() * flash_strength) diff --git a/code/modules/mob/living/human/human_attackhand.dm b/code/modules/mob/living/human/human_attackhand.dm index 047da4f956b..ab27dd51e90 100644 --- a/code/modules/mob/living/human/human_attackhand.dm +++ b/code/modules/mob/living/human/human_attackhand.dm @@ -113,6 +113,10 @@ to_chat(user, SPAN_WARNING("You can't attack while incapacitated.")) return TRUE + // AI driven mobs have a melee telegraph that needs to be handled here. + if(user.a_intent == I_HURT && !user.do_attack_windup_checking(src)) + return TRUE + if(!ishuman(user)) attack_generic(user, rand(1,3), "punched") return TRUE @@ -231,7 +235,7 @@ // Should this all be in Touch()? var/mob/living/human/H = user if(istype(H)) - if(H != src && check_shields(0, null, H, H.get_target_zone(), H.name)) + if(H != src && check_shields(0, null, H, H.get_target_zone(), H)) H.do_attack_animation(src) return TRUE diff --git a/code/modules/mob/living/human/human_blood.dm b/code/modules/mob/living/human/human_blood.dm index 7e8d636e51f..2f9e09a2249 100644 --- a/code/modules/mob/living/human/human_blood.dm +++ b/code/modules/mob/living/human/human_blood.dm @@ -66,7 +66,7 @@ if(amt <= 0 || !istype(sprayloc)) return var/spraydir = pick(global.alldirs) - amt = CEILING(amt/BLOOD_SPRAY_DISTANCE) + amt = ceil(amt/BLOOD_SPRAY_DISTANCE) var/bled = 0 spawn(0) for(var/i = 1 to BLOOD_SPRAY_DISTANCE) diff --git a/code/modules/mob/living/human/human_defense.dm b/code/modules/mob/living/human/human_defense.dm index 0d127c8afaf..9871f609d7a 100644 --- a/code/modules/mob/living/human/human_defense.dm +++ b/code/modules/mob/living/human/human_defense.dm @@ -14,7 +14,7 @@ meteor_act return PROJECTILE_FORCE_MISS //if they don't have the organ in question then the projectile just passes by. //Shields - var/shield_check = check_shields(P.damage, P, null, def_zone, "the [P.name]") + var/shield_check = check_shields(P.damage, P, null, def_zone, P) if(shield_check) if(shield_check < 0) return shield_check @@ -119,7 +119,7 @@ meteor_act visible_message("\The [user] misses [src] with \the [I]!") return null - if(check_shields(I.force, I, user, target_zone, "the [I.name]")) + if(check_shields(I.force, I, user, target_zone, I)) return null var/obj/item/organ/external/affecting = GET_EXTERNAL_ORGAN(src, hit_zone) diff --git a/code/modules/mob/living/human/life.dm b/code/modules/mob/living/human/life.dm index b084a03d85b..542ef84b19f 100644 --- a/code/modules/mob/living/human/life.dm +++ b/code/modules/mob/living/human/life.dm @@ -526,7 +526,7 @@ if(isSynthetic()) var/obj/item/organ/internal/cell/C = get_organ(BP_CELL, /obj/item/organ/internal/cell) if(C) - var/chargeNum = clamp(CEILING(C.percent()/25), 0, 4) //0-100 maps to 0-4, but give it a paranoid clamp just in case. + var/chargeNum = clamp(ceil(C.percent()/25), 0, 4) //0-100 maps to 0-4, but give it a paranoid clamp just in case. cells.icon_state = "charge[chargeNum]" else cells.icon_state = "charge-empty" diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 2f972b3ac31..3a60b9b2408 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -194,7 +194,7 @@ radiation -= 4 * RADIATION_SPEED_COEFFICIENT var/decl/species/my_species = get_species() - damage = FLOOR(damage * (my_species ? my_species.get_radiation_mod(src) : 1)) + damage = floor(damage * (my_species ? my_species.get_radiation_mod(src) : 1)) if(damage) immunity = max(0, immunity - damage * 15 * RADIATION_SPEED_COEFFICIENT) take_damage(damage * RADIATION_SPEED_COEFFICIENT, TOX) @@ -633,7 +633,7 @@ // Calculate the expected and actual number of functioning legs we have. var/has_sufficient_working_legs = TRUE var/list/root_limb_tags = root_bodytype.organ_tags_by_category[ORGAN_CATEGORY_STANCE_ROOT] - var/minimum_working_legs = CEILING(length(root_limb_tags) * 0.5) + var/minimum_working_legs = ceil(length(root_limb_tags) * 0.5) if(minimum_working_legs > 0) var/leg_count = 0 has_sufficient_working_legs = FALSE diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index f210da24a6c..baf503ebba7 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1116,7 +1116,7 @@ default behaviour is: A.alert_on_fall(src) /mob/living/proc/apply_fall_damage(var/turf/landing) - take_damage(rand(max(1, CEILING(mob_size * 0.33)), max(1, CEILING(mob_size * 0.66))) * get_fall_height()) + take_damage(rand(max(1, ceil(mob_size * 0.33)), max(1, ceil(mob_size * 0.66))) * get_fall_height()) /mob/living/proc/get_toxin_resistance() var/decl/species/species = get_species() @@ -1632,7 +1632,7 @@ default behaviour is: return range * range - 0.333 return range -/mob/living/handle_flashed(var/obj/item/flash/flash, var/flash_strength) +/mob/living/handle_flashed(var/flash_strength) var/safety = eyecheck() if(safety >= FLASH_PROTECTION_MODERATE || flash_strength <= 0) // May be modified by human proc. @@ -1800,3 +1800,25 @@ default behaviour is: return FALSE return TRUE + +/mob/living/proc/prepare_for_despawn() + //Update any existing objectives involving this mob. + for(var/datum/objective/objective in global.all_objectives) + // We don't want revs to get objectives that aren't for heads of staff. Letting + // them win or lose based on cryo is silly so we remove the objective. + if(objective.target == mind) + if(objective.owner?.current) + to_chat(objective.owner.current, SPAN_DANGER("You get the feeling your target, [real_name], is no longer within your reach...")) + qdel(objective) + //Handle job slot/tater cleanup. + if(mind) + if(mind.assigned_job) + mind.assigned_job.clear_slot() + if(mind.objectives.len) + mind.objectives = null + mind.assigned_special_role = null + // Delete them from datacore. + var/datum/computer_file/report/crew_record/record = get_crewmember_record(sanitize(real_name)) + if(record) + qdel(record) + return TRUE diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index a50387d4cbe..0d4b52b8a4f 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -175,7 +175,7 @@ zone = get_zone_with_miss_chance(zone, src, miss_chance, ranged_attack=1) if(zone && TT?.thrower && TT.thrower != src) - var/shield_check = check_shields(throw_damage, O, TT.thrower, zone, "[O]") + var/shield_check = check_shields(throw_damage, O, TT.thrower, zone, O) if(shield_check == PROJECTILE_FORCE_MISS) zone = null else if(shield_check) @@ -436,6 +436,8 @@ var/obj/item/suit = get_equipped_item(slot_wear_suit_str) if(suit) LAZYDISTINCTADD(checking_slots, suit) + if(isatom(attack_text)) + attack_text = "\the [attack_text]" for(var/obj/item/shield in checking_slots) if(shield.handle_shield(src, damage, damage_source, attacker, def_zone, attack_text)) return TRUE diff --git a/code/modules/mob/living/living_maneuvers.dm b/code/modules/mob/living/living_maneuvers.dm index 89a47a1f63b..697aeb13022 100644 --- a/code/modules/mob/living/living_maneuvers.dm +++ b/code/modules/mob/living/living_maneuvers.dm @@ -7,7 +7,7 @@ return if(!can_fall(location_override = lastloc) && prepared_maneuver && prepared_maneuver.can_be_used_by(src, silent = TRUE)) var/turf/check = get_turf(lastloc) - for(var/i = 1 to CEILING((get_jump_distance() * get_acrobatics_multiplier()) * prepared_maneuver.reflexive_modifier)) + for(var/i = 1 to ceil((get_jump_distance() * get_acrobatics_multiplier()) * prepared_maneuver.reflexive_modifier)) var/turf/next_check = get_step(check, dir) if(!next_check || next_check.density) break diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 1a49f4fb985..df64014bb4f 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -147,7 +147,7 @@ if (src.cells) if (src.cell) - var/chargeNum = clamp(CEILING(cell.percent()/25), 0, 4) //0-100 maps to 0-4, but give it a paranoid clamp just in case. + var/chargeNum = clamp(ceil(cell.percent()/25), 0, 4) //0-100 maps to 0-4, but give it a paranoid clamp just in case. src.cells.icon_state = "charge[chargeNum]" else src.cells.icon_state = "charge-empty" diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index e3eeeee6c46..4baee39246d 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -679,7 +679,7 @@ //Robots take half damage from basic attacks. /mob/living/silicon/robot/attack_generic(var/mob/user, var/damage, var/attack_message) - return ..(user,FLOOR(damage/2),attack_message) + return ..(user,floor(damage/2),attack_message) /mob/living/silicon/robot/get_req_access() return req_access @@ -1125,3 +1125,13 @@ to_chat(src, SPAN_WARNING("You have already grabbed something!")) return FALSE return TRUE + +/mob/living/silicon/robot/prepare_for_despawn() + clear_brain() + if(module) + for(var/obj/item/I in module) // the tools the borg has; metal, glass, guns etc + for(var/obj/item/O in I.get_contained_external_atoms()) // the things inside the tools, if anything; mainly for janiborg trash bags + O.forceMove(src) + qdel(I) + QDEL_NULL(module) + return ..() diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 49bbe726058..71d49f92a03 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -424,7 +424,7 @@ if(os) os.Process() -/mob/living/silicon/handle_flashed(var/obj/item/flash/flash, var/flash_strength) +/mob/living/silicon/handle_flashed(var/flash_strength) SET_STATUS_MAX(src, STAT_PARA, flash_strength) SET_STATUS_MAX(src, STAT_WEAK, flash_strength) return TRUE diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 51d29ab7fa4..e1fb929142b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1027,7 +1027,7 @@ if(braindamage) var/brainloss_threshold = get_config_value(/decl/config/num/dex_malus_brainloss_threshold) if(braindamage > brainloss_threshold) ///brainloss shouldn't instantly cripple you, so the effects only start once past the threshold and escalate from there. - dex_malus = clamp(CEILING((braindamage-brainloss_threshold)/10), 0, length(global.dexterity_levels)) + dex_malus = clamp(ceil((braindamage-brainloss_threshold)/10), 0, length(global.dexterity_levels)) if(dex_malus > 0) dex_malus = global.dexterity_levels[dex_malus] @@ -1192,7 +1192,7 @@ return FALSE -/mob/proc/handle_flashed(var/obj/item/flash/flash, var/flash_strength) +/mob/proc/handle_flashed(var/flash_strength) return FALSE /mob/proc/do_flash_animation() diff --git a/code/modules/mob/mob_eating.dm b/code/modules/mob/mob_eating.dm index 17155f71569..2c146225666 100644 --- a/code/modules/mob/mob_eating.dm +++ b/code/modules/mob/mob_eating.dm @@ -6,7 +6,7 @@ /mob/proc/get_eaten_transfer_amount(var/default) . = default if(issmall(src)) - . = CEILING(.*0.5) + . = ceil(.*0.5) /mob/proc/can_eat_food_currently(obj/eating, mob/user) return TRUE diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 6a805fe5520..4705e758951 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -261,7 +261,7 @@ var/global/list/global/organ_rel_size = list( return M.shakecamera = current_time + max(TICKS_PER_RECOIL_ANIM, duration) strength = abs(strength)*PIXELS_PER_STRENGTH_VAL - var/steps = min(1, FLOOR(duration/TICKS_PER_RECOIL_ANIM))-1 + var/steps = min(1, floor(duration/TICKS_PER_RECOIL_ANIM))-1 animate(M.client, pixel_x = rand(-(strength), strength), pixel_y = rand(-(strength), strength), time = TICKS_PER_RECOIL_ANIM, easing = JUMP_EASING|EASE_IN) if(steps) for(var/i = 1 to steps) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 49db20116bf..123d40762e6 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -263,7 +263,7 @@ if (!BP_IS_PROSTHETIC(organ)) organ.rejuvenate(1) organ.max_damage *= 3 - organ.min_broken_damage = FLOOR(organ.max_damage * 0.75) + organ.min_broken_damage = floor(organ.max_damage * 0.75) verbs += /mob/living/proc/breath_death verbs += /mob/living/proc/consume playsound(get_turf(src), 'sound/hallucinations/wail.ogg', 20, 1) \ No newline at end of file diff --git a/code/modules/modular_computers/terminal/terminal_commands.dm b/code/modules/modular_computers/terminal/terminal_commands.dm index bc534225e0e..65240209931 100644 --- a/code/modules/modular_computers/terminal/terminal_commands.dm +++ b/code/modules/modular_computers/terminal/terminal_commands.dm @@ -79,7 +79,7 @@ var/global/list/terminal_commands // Prints data out, split by page number. /datum/terminal_command/proc/print_as_page(list/data, value_name, selected_page, pg_length) . = list() - var/max_pages = CEILING(length(data)/pg_length) + var/max_pages = ceil(length(data)/pg_length) var/pg = clamp(selected_page, 1, max_pages) var/start_index = (pg - 1)*pg_length + 1 diff --git a/code/modules/multiz/ladder.dm b/code/modules/multiz/ladder.dm index 0db85e1cd01..f63a730dc6c 100644 --- a/code/modules/multiz/ladder.dm +++ b/code/modules/multiz/ladder.dm @@ -228,7 +228,7 @@ var/can_carry = can_pull_size if(loc?.has_gravity()) - can_carry = FLOOR(can_carry * 0.75) + can_carry = floor(can_carry * 0.75) for(var/obj/item/grab/G in get_active_grabs()) can_carry -= G.affecting.get_object_size() if(can_carry < 0) diff --git a/code/modules/multiz/level_data.dm b/code/modules/multiz/level_data.dm index 91d5965818d..3b3ed133b6d 100644 --- a/code/modules/multiz/level_data.dm +++ b/code/modules/multiz/level_data.dm @@ -243,8 +243,8 @@ //Get the origin of the lower left corner where the level's edge begins at on the world. //#FIXME: This is problematic when dealing with an even width/height - var/x_origin = origin_is_world_center? max(FLOOR((world.maxx - level_max_width) / 2), 1) : 1 - var/y_origin = origin_is_world_center? max(FLOOR((world.maxy - level_max_height) / 2), 1) : 1 + var/x_origin = origin_is_world_center? max(floor((world.maxx - level_max_width) / 2), 1) : 1 + var/y_origin = origin_is_world_center? max(floor((world.maxy - level_max_height) / 2), 1) : 1 //The first x/y that's past the edge and within the accessible level level_inner_min_x = x_origin + TRANSITIONEDGE diff --git a/code/modules/organs/external/_external.dm b/code/modules/organs/external/_external.dm index fa8149ab4cf..c0ed45b9017 100644 --- a/code/modules/organs/external/_external.dm +++ b/code/modules/organs/external/_external.dm @@ -659,7 +659,7 @@ This function completely restores a damaged organ to perfect condition. var/internal_damage if(prob(damage) && sever_artery()) internal_damage = TRUE - if(prob(CEILING(damage/4)) && sever_tendon()) + if(prob(ceil(damage/4)) && sever_tendon()) internal_damage = TRUE if(internal_damage) owner.custom_pain("You feel something rip in your [name]!", 50, affecting = src) @@ -1490,8 +1490,8 @@ Note that amputating the affected organ does in fact remove the infection from t . = SURGERY_ENCASED else var/total_health_coefficient = scale_max_damage_to_species_health ? (species.total_health / DEFAULT_SPECIES_HEALTH) : 1 - var/smol_threshold = max(1, FLOOR(min_broken_damage * 0.4 * total_health_coefficient)) - var/beeg_threshold = max(1, FLOOR(min_broken_damage * 0.6 * total_health_coefficient)) + var/smol_threshold = max(1, floor(min_broken_damage * 0.4 * total_health_coefficient)) + var/beeg_threshold = max(1, floor(min_broken_damage * 0.6 * total_health_coefficient)) if(!incision.autoheal_cutoff == 0) //not clean incision smol_threshold *= 1.5 beeg_threshold = max(beeg_threshold, min(beeg_threshold * 1.5, incision.damage_list[1])) //wounds can't achieve bigger diff --git a/code/modules/organs/external/_external_icons.dm b/code/modules/organs/external/_external_icons.dm index 55227fdc3d0..f424f16ae1b 100644 --- a/code/modules/organs/external/_external_icons.dm +++ b/code/modules/organs/external/_external_icons.dm @@ -342,7 +342,7 @@ var/global/list/robot_hud_colours = list("#ffffff","#cccccc","#aaaaaa","#888888" dam_state = min_dam_state // Apply colour and return product. var/list/hud_colours = !BP_IS_PROSTHETIC(src) ? flesh_hud_colours : robot_hud_colours - hud_damage_image.color = hud_colours[max(1,min(CEILING(dam_state*hud_colours.len),hud_colours.len))] + hud_damage_image.color = hud_colours[max(1,min(ceil(dam_state*hud_colours.len),hud_colours.len))] return hud_damage_image /obj/item/organ/external/proc/bandage_level() diff --git a/code/modules/organs/external/tail.dm b/code/modules/organs/external/tail.dm index 4ae67ad83e1..adaf2f2591d 100644 --- a/code/modules/organs/external/tail.dm +++ b/code/modules/organs/external/tail.dm @@ -42,11 +42,11 @@ // Set our onmob appearance. var/decl/sprite_accessory/tail/tail_data = get_sprite_accessory_by_category(SAC_TAIL) - if(tail_data.draw_accessory) + if(tail_data?.draw_accessory) icon = tail_data.icon icon_state = tail_data.icon_state - if(update_icon && !istype(H) && !QDELETED(H) && H != owner) + if(update_icon && istype(H) && !QDELETED(H) && H != owner) H.update_tail_showing(FALSE) /obj/item/organ/external/tail/do_install(mob/living/human/target, affected, in_place, update_icon, detached) diff --git a/code/modules/organs/internal/_internal.dm b/code/modules/organs/internal/_internal.dm index 217cd539aa3..ac00fcf30e5 100644 --- a/code/modules/organs/internal/_internal.dm +++ b/code/modules/organs/internal/_internal.dm @@ -106,8 +106,8 @@ /obj/item/organ/internal/set_max_damage(var/ndamage) . = ..() - min_broken_damage = FLOOR(0.75 * max_damage) - min_bruised_damage = FLOOR(0.25 * max_damage) + min_broken_damage = floor(0.75 * max_damage) + min_bruised_damage = floor(0.25 * max_damage) if(damage_threshold_count > 0) damage_threshold_value = round(max_damage / damage_threshold_count) @@ -208,7 +208,7 @@ if(damage > min_broken_damage) var/scarring = damage/max_damage scarring = 1 - 0.3 * scarring ** 2 // Between ~15 and 30 percent loss - var/new_max_dam = FLOOR(scarring * max_damage) + var/new_max_dam = floor(scarring * max_damage) if(new_max_dam < max_damage) to_chat(user, SPAN_WARNING("Not every part of [src] could be saved; some dead tissue had to be removed, making it more susceptible to damage in the future.")) set_max_damage(new_max_dam) diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm index d050a63716d..713ac0c0e2d 100644 --- a/code/modules/organs/internal/brain.dm +++ b/code/modules/organs/internal/brain.dm @@ -225,7 +225,7 @@ var/blood_volume = owner.get_blood_oxygenation() if(blood_volume < BLOOD_VOLUME_SURVIVE) to_chat(user, SPAN_DANGER("Parts of \the [src] didn't survive the procedure due to lack of air supply!")) - set_max_damage(FLOOR(max_damage - 0.25*damage)) + set_max_damage(floor(max_damage - 0.25*damage)) heal_damage(damage) /obj/item/organ/internal/brain/die() diff --git a/code/modules/organs/internal/heart.dm b/code/modules/organs/internal/heart.dm index 85f807eae8c..2cc637a076c 100644 --- a/code/modules/organs/internal/heart.dm +++ b/code/modules/organs/internal/heart.dm @@ -147,7 +147,7 @@ blood_max += W.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((owner.vessel.total_volume / (temp.applied_pressure || !open_wound ? 400 : 250))*temp.arterial_bleed_severity) if(bleed_amount) if(open_wound) blood_max += bleed_amount @@ -178,7 +178,7 @@ //AB occurs every heartbeat, this only throttles the visible effect next_blood_squirt = world.time + 80 var/turf/sprayloc = get_turf(owner) - blood_max -= owner.drip(CEILING(blood_max/3), sprayloc) + blood_max -= owner.drip(ceil(blood_max/3), sprayloc) if(blood_max > 0) blood_max -= owner.blood_squirt(blood_max, sprayloc) if(blood_max > 0) diff --git a/code/modules/organs/internal/stomach.dm b/code/modules/organs/internal/stomach.dm index 635a1e97619..cdc7df2fe4f 100644 --- a/code/modules/organs/internal/stomach.dm +++ b/code/modules/organs/internal/stomach.dm @@ -43,7 +43,7 @@ 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(ingested.total_volume / 10) for(var/a in contents + food) if(ismob(a)) var/mob/M = a diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 52955d2bdb4..e3a39c2ff45 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -160,7 +160,7 @@ // resets scarring, but ah well /obj/item/organ/proc/set_max_damage(var/ndamage) - absolute_max_damage = FLOOR(ndamage) + absolute_max_damage = floor(ndamage) max_damage = absolute_max_damage /obj/item/organ/proc/set_species(specie_name) @@ -183,11 +183,11 @@ min_broken_damage = initial(min_broken_damage) if(absolute_max_damage) - set_max_damage(max(1, FLOOR(absolute_max_damage * total_health_coefficient))) - min_broken_damage = max(1, FLOOR(absolute_max_damage * 0.5)) + set_max_damage(max(1, floor(absolute_max_damage * total_health_coefficient))) + min_broken_damage = max(1, floor(absolute_max_damage * 0.5)) else - min_broken_damage = max(1, FLOOR(min_broken_damage * total_health_coefficient)) - set_max_damage(max(1, FLOOR(min_broken_damage * 2))) + min_broken_damage = max(1, floor(min_broken_damage * total_health_coefficient)) + set_max_damage(max(1, floor(min_broken_damage * 2))) reset_status() diff --git a/code/modules/organs/pain.dm b/code/modules/organs/pain.dm index 12ab422d198..1f8f233fc7c 100644 --- a/code/modules/organs/pain.dm +++ b/code/modules/organs/pain.dm @@ -3,7 +3,7 @@ var/matrix/M if(client && max(client.last_view_x_dim, client.last_view_y_dim) > 7) M = matrix() - M.Scale(CEILING(client.last_view_x_dim/7), CEILING(client.last_view_y_dim/7)) + M.Scale(ceil(client.last_view_x_dim/7), ceil(client.last_view_y_dim/7)) pain.transform = M animate(pain, alpha = target, time = 15, easing = ELASTIC_EASING) animate(pain, alpha = 0, time = 20) @@ -24,9 +24,9 @@ // Excessive halloss is horrible, just give them enough to make it visible. if(!nohalloss && power) if(affecting) - affecting.add_pain(CEILING(power/2)) + affecting.add_pain(ceil(power/2)) else - take_damage(CEILING(power/2), PAIN) + take_damage(ceil(power/2), PAIN) flash_pain(min(round(2*power)+55, 255)) // Anti message spam checks diff --git a/code/modules/overmap/overmap_object.dm b/code/modules/overmap/overmap_object.dm index 102ac557de8..e2344487a1e 100644 --- a/code/modules/overmap/overmap_object.dm +++ b/code/modules/overmap/overmap_object.dm @@ -182,9 +182,9 @@ // Add speed to this dimension of our position. position[i] += clamp((speed[i] * OVERMAP_SPEED_CONSTANT) * (wait / (1 SECOND)), -1, 1) if(position[i] < 0) - deltas[i] = CEILING(position[i]) + deltas[i] = ceil(position[i]) else if(position[i] > 0) - deltas[i] = FLOOR(position[i]) + deltas[i] = floor(position[i]) moved = TRUE // Delta over 0 means we've moved a turf, so we adjust our position accordingly. if(deltas[i] != 0) diff --git a/code/modules/overmap/ships/ship.dm b/code/modules/overmap/ships/ship.dm index 10add4dbfae..f4f1a734c88 100644 --- a/code/modules/overmap/ships/ship.dm +++ b/code/modules/overmap/ships/ship.dm @@ -155,7 +155,7 @@ var/global/const/OVERMAP_SPEED_CONSTANT = (1 SECOND) for(var/i = 1 to 2) if(MOVING(speed[i], min_speed)) . = min(., ((speed[i] > 0 ? 1 : -1) - position[i]) / speed[i]) - . = max(CEILING(.),0) + . = max(ceil(.),0) /obj/effect/overmap/visitable/ship/proc/halt() adjust_speed(-speed[1], -speed[2]) diff --git a/code/modules/paperwork/handlabeler.dm b/code/modules/paperwork/handlabeler.dm index 210ef6465b3..e7294337f02 100644 --- a/code/modules/paperwork/handlabeler.dm +++ b/code/modules/paperwork/handlabeler.dm @@ -186,7 +186,7 @@ if(available_units > max_accepted_units) //Take only what's needed - var/needed_sheets = CEILING(max_accepted_units / SHEET_MATERIAL_AMOUNT) + var/needed_sheets = ceil(max_accepted_units / SHEET_MATERIAL_AMOUNT) var/leftover_units = max_accepted_units % SHEET_MATERIAL_AMOUNT ST.use(needed_sheets) //Drop the extra as shards @@ -199,10 +199,10 @@ else if(available_units > LABEL_MATERIAL_COST) //Take all that's available - ST.use(CEILING(available_units/SHEET_MATERIAL_AMOUNT)) + ST.use(ceil(available_units/SHEET_MATERIAL_AMOUNT)) added_labels = round(available_units / LABEL_MATERIAL_COST) add_paper_labels(added_labels) - to_chat(user, SPAN_NOTICE("You use [CEILING(available_units/SHEET_MATERIAL_AMOUNT)] [ST.plural_name] to refill \the [src] with [added_labels] label(s).")) + to_chat(user, SPAN_NOTICE("You use [ceil(available_units/SHEET_MATERIAL_AMOUNT)] [ST.plural_name] to refill \the [src] with [added_labels] label(s).")) else //Abort because not enough materials for even a single label to_chat(user, SPAN_WARNING("There's not enough [ST.plural_name] in \the [ST] to refil \the [src]!")) diff --git a/code/modules/paperwork/papershredder.dm b/code/modules/paperwork/papershredder.dm index 87e33c56b27..fa1bab08564 100644 --- a/code/modules/paperwork/papershredder.dm +++ b/code/modules/paperwork/papershredder.dm @@ -177,7 +177,7 @@ /obj/machinery/papershredder/on_update_icon() cut_overlays() var/ratio = ((cached_total_matter * 5) / max_total_matter) - icon_state = "papershredder[clamp(CEILING(ratio), 0, 5)]" + icon_state = "papershredder[clamp(ceil(ratio), 0, 5)]" if(!is_unpowered()) add_overlay("papershredder_power") if(is_broken() || is_bin_full()) diff --git a/code/modules/paperwork/pen/crayon_edibility.dm b/code/modules/paperwork/pen/crayon_edibility.dm index ba7666f17e4..88259e4920e 100644 --- a/code/modules/paperwork/pen/crayon_edibility.dm +++ b/code/modules/paperwork/pen/crayon_edibility.dm @@ -8,7 +8,7 @@ if(!eater_ingested) return if(pigment_type) - var/partial_amount = CEILING(amount * 0.4) + var/partial_amount = ceil(amount * 0.4) eater_ingested.add_reagent(pigment_type, partial_amount) eater_ingested.add_reagent(/decl/material/solid/organic/wax, amount - partial_amount) else diff --git a/code/modules/persistence/persistence_datum.dm b/code/modules/persistence/persistence_datum.dm index bc9ec852689..fc2a819e8b2 100644 --- a/code/modules/persistence/persistence_datum.dm +++ b/code/modules/persistence/persistence_datum.dm @@ -20,7 +20,7 @@ if(name) filename = "data/persistent/[ckey(global.using_map.name)]-[ckey(name)].json" if(!isnull(entries_decay_at) && !isnull(entries_expire_at)) - entries_decay_at = FLOOR(entries_expire_at * entries_decay_at) + entries_decay_at = floor(entries_expire_at * entries_decay_at) /decl/persistence_handler/proc/GetValidTurf(var/turf/T, var/list/tokens) if(T && isStationLevel(T.z) && CheckTurfContents(T, tokens)) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 434a96e50c1..bd26a2338c3 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -544,7 +544,7 @@ By design, d1 is the smallest direction and d2 is the highest if(BP_IS_BRITTLE(S)) to_chat(user, SPAN_WARNING("\The [H]'s [S.name] is hard and brittle - \the [src] cannot repair it.")) return TRUE - var/use_amt = min(src.amount, CEILING(S.burn_dam/3), 5) + var/use_amt = min(src.amount, ceil(S.burn_dam/3), 5) if(can_use(use_amt)) if(S.robo_repair(3*use_amt, BURN, "some damaged wiring", src, user)) use(use_amt) @@ -875,8 +875,8 @@ By design, d1 is the smallest direction and d2 is the highest /obj/item/stack/cable_coil/fabricator/get_amount() var/obj/item/cell/cell = get_cell() - . = (cell ? FLOOR(cell.charge / cost_per_cable) : 0) + . = (cell ? floor(cell.charge / cost_per_cable) : 0) /obj/item/stack/cable_coil/fabricator/get_max_amount() var/obj/item/cell/cell = get_cell() - . = (cell ? FLOOR(cell.maxcharge / cost_per_cable) : 0) + . = (cell ? floor(cell.maxcharge / cost_per_cable) : 0) diff --git a/code/modules/power/fuel_assembly/fuel_assembly.dm b/code/modules/power/fuel_assembly/fuel_assembly.dm index b472ca24078..6958f2431d2 100644 --- a/code/modules/power/fuel_assembly/fuel_assembly.dm +++ b/code/modules/power/fuel_assembly/fuel_assembly.dm @@ -74,7 +74,7 @@ return PROCESS_KILL if(istype(loc, /turf)) - SSradiation.radiate(src, max(1,CEILING(radioactivity/15))) + SSradiation.radiate(src, max(1,ceil(radioactivity/15))) /obj/item/fuel_assembly/Destroy() STOP_PROCESSING(SSobj, src) diff --git a/code/modules/power/fuel_assembly/fuel_compressor.dm b/code/modules/power/fuel_assembly/fuel_compressor.dm index 0516936ca40..f6c08c8e565 100644 --- a/code/modules/power/fuel_assembly/fuel_compressor.dm +++ b/code/modules/power/fuel_assembly/fuel_compressor.dm @@ -57,7 +57,7 @@ var/decl/material/mat = GET_DECL(mat_type) if(mat && stored_material[mat_type] >= SHEET_MATERIAL_AMOUNT) - var/sheet_count = FLOOR(stored_material[mat_type]/SHEET_MATERIAL_AMOUNT) + var/sheet_count = floor(stored_material[mat_type]/SHEET_MATERIAL_AMOUNT) stored_material[mat_type] -= sheet_count * SHEET_MATERIAL_AMOUNT SSmaterials.create_object(mat_type, get_turf(src), sheet_count) if(isnull(stored_material[mat_type])) diff --git a/code/modules/power/fusion/core/core_field.dm b/code/modules/power/fusion/core/core_field.dm index f1ac424ed41..f9c366bc496 100644 --- a/code/modules/power/fusion/core/core_field.dm +++ b/code/modules/power/fusion/core/core_field.dm @@ -154,8 +154,8 @@ alpha = 230 else var/temp_mod = ((plasma_temperature-5000)/20000) - use_range = light_min_range + CEILING((light_max_range-light_min_range)*temp_mod) - use_power = light_min_power + CEILING((light_max_power-light_min_power)*temp_mod) + use_range = light_min_range + ceil((light_max_range-light_min_range)*temp_mod) + use_power = light_min_power + ceil((light_max_power-light_min_power)*temp_mod) switch (plasma_temperature) if (1000 to 6000) light_color = COLOR_ORANGE @@ -233,7 +233,7 @@ set waitfor = FALSE visible_message("\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!") set_light(15, 15, "#ccccff") - empulse(get_turf(src), CEILING(plasma_temperature/1000), CEILING(plasma_temperature/300)) + empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300)) sleep(5) RadiateAll() explosion(get_turf(owned_core),-1,-1,8,10) // Blow out all the windows. @@ -307,8 +307,8 @@ /obj/effect/fusion_em_field/proc/Radiate() if(isturf(loc)) - var/empsev = max(1, min(3, CEILING(size/2))) - for(var/atom/movable/AM in range(max(1,FLOOR(size/2)), loc)) + var/empsev = max(1, min(3, ceil(size/2))) + for(var/atom/movable/AM in range(max(1,floor(size/2)), loc)) if(AM == src || AM == owned_core || !AM.simulated) continue @@ -366,7 +366,7 @@ //determine a random amount to actually react this cycle, and remove it from the standard pool //this is a hack, and quite nonrealistic :( for(var/reactant in react_pool) - react_pool[reactant] = rand(FLOOR(react_pool[reactant]/2),react_pool[reactant]) + react_pool[reactant] = rand(floor(react_pool[reactant]/2),react_pool[reactant]) reactants[reactant] -= react_pool[reactant] if(!react_pool[reactant]) react_pool -= reactant diff --git a/code/modules/power/fusion/kinetic_harvester.dm b/code/modules/power/fusion/kinetic_harvester.dm index 00a5b24a5ad..2f7a20b706e 100644 --- a/code/modules/power/fusion/kinetic_harvester.dm +++ b/code/modules/power/fusion/kinetic_harvester.dm @@ -45,7 +45,7 @@ var/datum/extension/local_network_member/lanm = get_extension(src, /datum/extension/local_network_member) var/datum/local_network/lan = lanm.get_local_network() - if(lan) + if(lan) var/list/fusion_cores = lan.get_devices(/obj/machinery/fusion_core) if(fusion_cores && fusion_cores.len) harvest_from = fusion_cores[1] @@ -66,7 +66,7 @@ data["materials"] = list() for(var/mat in stored) var/decl/material/material = GET_DECL(mat) - var/sheets = FLOOR(stored[mat]/(SHEET_MATERIAL_AMOUNT * 1.5)) + var/sheets = floor(stored[mat]/(SHEET_MATERIAL_AMOUNT * 1.5)) data["materials"] += list(list("name" = material.solid_name, "amount" = sheets, "harvest" = harvesting[mat], "mat_ref" = "\ref[material]")) ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) @@ -112,7 +112,7 @@ var/decl/material/material = locate(href_list["remove_mat"]) if(istype(material)) var/sheet_cost = (SHEET_MATERIAL_AMOUNT * 1.5) - var/sheets = FLOOR(stored[material.type]/sheet_cost) + var/sheets = floor(stored[material.type]/sheet_cost) if(sheets > 0) material.create_object(loc, sheets) stored[material.type] -= (sheets * sheet_cost) diff --git a/code/modules/projectiles/guns/energy/capacitor.dm b/code/modules/projectiles/guns/energy/capacitor.dm index f9ff12f7c38..d86af6a0e78 100644 --- a/code/modules/projectiles/guns/energy/capacitor.dm +++ b/code/modules/projectiles/guns/energy/capacitor.dm @@ -251,8 +251,8 @@ var/global/list/laser_wavelengths var/obj/item/projectile/P = new projectile_type(src) P.color = selected_wavelength.color P.set_light(l_color = selected_wavelength.light_color) - P.damage = FLOOR(sqrt(total_charge) * selected_wavelength.damage_multiplier) - P.armor_penetration = FLOOR(sqrt(total_charge) * selected_wavelength.armour_multiplier) + P.damage = floor(sqrt(total_charge) * selected_wavelength.damage_multiplier) + P.armor_penetration = floor(sqrt(total_charge) * selected_wavelength.armour_multiplier) . = P // Subtypes. diff --git a/code/modules/projectiles/guns/launcher/money_cannon.dm b/code/modules/projectiles/guns/launcher/money_cannon.dm index 8ef05876a4d..f540fc0fe29 100644 --- a/code/modules/projectiles/guns/launcher/money_cannon.dm +++ b/code/modules/projectiles/guns/launcher/money_cannon.dm @@ -19,7 +19,7 @@ emagged = 1 /obj/item/gun/launcher/money/proc/vomit_cash(var/mob/living/vomit_onto, var/projectile_vomit) - var/bundle_worth = FLOOR(receptacle_value / 10) + var/bundle_worth = floor(receptacle_value / 10) var/turf/T = get_turf(vomit_onto) for(var/i = 1 to 10) var/nv = bundle_worth diff --git a/code/modules/projectiles/guns/projectile/dartgun.dm b/code/modules/projectiles/guns/projectile/dartgun.dm index 9ce230085f7..4800bc5d3dd 100644 --- a/code/modules/projectiles/guns/projectile/dartgun.dm +++ b/code/modules/projectiles/guns/projectile/dartgun.dm @@ -58,9 +58,14 @@ to_chat(user, "\The [src] contains:") for(var/obj/item/chems/glass/beaker/B in beakers) if(B.reagents && LAZYLEN(B.reagents?.reagent_volumes)) - for(var/rtype in B.reagents.reagent_volumes) - var/decl/material/R = GET_DECL(rtype) - to_chat(user, "[REAGENT_VOLUME(B.reagents, rtype)] units of [R.get_reagent_name(B.reagents)]") + for(var/ltype in B.reagents.liquid_volumes) + var/decl/material/R = GET_DECL(ltype) + to_chat(user, "[LIQUID_VOLUME(B.reagents, ltype)] units of [R.get_reagent_name(B.reagents, MAT_PHASE_LIQUID)]") + + for(var/stype in B.reagents.solid_volumes) + var/decl/material/R = GET_DECL(stype) + to_chat(user, "[SOLID_VOLUME(B.reagents, stype)] units of [R.get_reagent_name(B.reagents, MAT_PHASE_SOLID)]") + /obj/item/gun/projectile/dartgun/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/chems/glass)) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index b0f57d7741c..27db3cb6a61 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -583,7 +583,7 @@ time_offset = 0 var/required_moves = 0 if(speed > 0) - required_moves = FLOOR(elapsed_time_deciseconds / speed) + required_moves = floor(elapsed_time_deciseconds / speed) if(required_moves > SSprojectiles.global_max_tick_moves) var/overrun = required_moves - SSprojectiles.global_max_tick_moves required_moves = SSprojectiles.global_max_tick_moves diff --git a/code/modules/projectiles/projectile/beams.dm b/code/modules/projectiles/projectile/beams.dm index 09774614695..d9cde61e7df 100644 --- a/code/modules/projectiles/projectile/beams.dm +++ b/code/modules/projectiles/projectile/beams.dm @@ -61,8 +61,8 @@ P.light_color = color P.firer = firer P.shot_from = shot_from - P.damage = FLOOR(damage/split_count) - P.armor_penetration = FLOOR(armor_penetration/split_count) + P.damage = floor(damage/split_count) + P.armor_penetration = floor(armor_penetration/split_count) P.launch(pick_n_take(targets), def_zone) . = ..() diff --git a/code/modules/random_map/drop/droppod.dm b/code/modules/random_map/drop/droppod.dm index 1701c7e77fe..ac23a7b14e8 100644 --- a/code/modules/random_map/drop/droppod.dm +++ b/code/modules/random_map/drop/droppod.dm @@ -41,8 +41,8 @@ /datum/random_map/droppod/generate_map() // No point calculating these 200 times. - var/x_midpoint = CEILING(limit_x / 2) - var/y_midpoint = CEILING(limit_y / 2) + var/x_midpoint = ceil(limit_x / 2) + var/y_midpoint = ceil(limit_y / 2) // Draw walls/floors/doors. for(var/x = 1, x <= limit_x, x++) @@ -80,7 +80,7 @@ /datum/random_map/droppod/apply_to_map() if(placement_explosion_dev || placement_explosion_heavy || placement_explosion_light || placement_explosion_flash) - var/turf/T = locate((origin_x + CEILING(limit_x / 2)-1), (origin_y + CEILING(limit_y / 2)-1), origin_z) + var/turf/T = locate((origin_x + ceil(limit_x / 2)-1), (origin_y + ceil(limit_y / 2)-1), origin_z) if(istype(T)) explosion(T, placement_explosion_dev, placement_explosion_heavy, placement_explosion_light, placement_explosion_flash) sleep(15) // Let the explosion finish proccing before we ChangeTurf(), otherwise it might destroy our spawned objects. @@ -97,8 +97,8 @@ // Pods are circular. Get the direction this object is facing from the center of the pod. /datum/random_map/droppod/get_spawn_dir(var/x, var/y) - var/x_midpoint = CEILING(limit_x / 2) - var/y_midpoint = CEILING(limit_y / 2) + var/x_midpoint = ceil(limit_x / 2) + var/y_midpoint = ceil(limit_y / 2) if(x == x_midpoint && y == y_midpoint) return null var/turf/target = locate(origin_x+x-1, origin_y+y-1, origin_z) diff --git a/code/modules/reagents/Chemistry-Grinder.dm b/code/modules/reagents/Chemistry-Grinder.dm index dfdacb1d755..987f641fa24 100644 --- a/code/modules/reagents/Chemistry-Grinder.dm +++ b/code/modules/reagents/Chemistry-Grinder.dm @@ -208,7 +208,7 @@ if(!material) break - var/amount_to_take = max(0,min(stack.amount, FLOOR(remaining_volume / REAGENT_UNITS_PER_MATERIAL_SHEET))) + var/amount_to_take = max(0,min(stack.amount, floor(remaining_volume / REAGENT_UNITS_PER_MATERIAL_SHEET))) if(amount_to_take) stack.use(amount_to_take) if(QDELETED(stack)) diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 7c1e6e2a686..4384eed1458 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -6,8 +6,8 @@ var/global/obj/temp_reagents_holder = new /atom/proc/remove_from_reagents(reagent_type, amount, safety = FALSE, defer_update = FALSE) return reagents?.remove_reagent(reagent_type, amount, safety, defer_update) -/atom/proc/remove_any_reagents(amount = 1, defer_update = FALSE) - return reagents?.remove_any(amount, defer_update) +/atom/proc/remove_any_reagents(amount = 1, defer_update = FALSE, removed_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) + return reagents?.remove_any(amount, defer_update, removed_phases) /atom/proc/get_reagent_space() if(!reagents?.maximum_volume) @@ -57,9 +57,16 @@ var/global/obj/temp_reagents_holder = new /datum/reagents var/primary_reagent 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 @@ -74,6 +81,10 @@ var/global/obj/temp_reagents_holder = new if(SSfluids.holders_to_update[src]) SSfluids.holders_to_update -= src reagent_volumes = null + + liquid_volumes = null + solid_volumes = null + reagent_data = null if(my_atom) if(my_atom.reagents == src) @@ -89,6 +100,8 @@ var/global/obj/temp_reagents_holder = new /datum/reagents/PopulateClone(datum/reagents/clone) clone.primary_reagent = primary_reagent clone.reagent_volumes = reagent_volumes?.Copy() + clone.liquid_volumes = liquid_volumes?.Copy() + clone.solid_volumes = solid_volumes?.Copy() clone.reagent_data = listDeepClone(reagent_data, TRUE) clone.total_volume = total_volume clone.maximum_volume = maximum_volume @@ -106,27 +119,59 @@ var/global/obj/temp_reagents_holder = new if(codex && reagent.codex_name) . = reagent.codex_name else - . = reagent.get_reagent_name(src) + if(LIQUID_VOLUME(src, reagent.type) >= SOLID_VOLUME(src, reagent.type)) + return reagent.get_reagent_name(src, MAT_PHASE_LIQUID) + else + return reagent.get_reagent_name(src, MAT_PHASE_SOLID) /datum/reagents/proc/get_primary_reagent_decl() . = GET_DECL(primary_reagent) /datum/reagents/proc/update_total() // Updates volume. total_volume = 0 + total_liquid_volume = 0 primary_reagent = null - for(var/R in reagent_volumes) - var/vol = CHEMS_QUANTIZE(reagent_volumes[R]) + + reagent_volumes = list() + var/primary_liquid = null + for(var/R in liquid_volumes) + var/vol = CHEMS_QUANTIZE(liquid_volumes[R]) if(vol < MINIMUM_CHEMICAL_VOLUME) clear_reagent(R, defer_update = TRUE, force = TRUE) // defer_update is important to avoid infinite recursion else - reagent_volumes[R] = vol + LAZYSET(liquid_volumes, R, vol) + LAZYSET(reagent_volumes, R, vol) + total_volume += vol + total_liquid_volume += vol + if(!primary_liquid || liquid_volumes[primary_liquid] < vol) + primary_liquid = R + + var/primary_solid = null + for(var/R in solid_volumes) + var/vol = CHEMS_QUANTIZE(solid_volumes[R]) + if(vol < MINIMUM_CHEMICAL_VOLUME) + clear_reagent(R, defer_update = TRUE, force = TRUE) + else + LAZYSET(solid_volumes, R, vol) + if(!reagent_volumes?[R]) + LAZYSET(reagent_volumes, R, vol) + else + reagent_volumes[R] += vol total_volume += vol - if(!primary_reagent || reagent_volumes[primary_reagent] < vol) - primary_reagent = R + if(!primary_solid || (solid_volumes[primary_solid] < vol)) + primary_solid = R + + if(solid_volumes?[primary_solid] > liquid_volumes?[primary_liquid]) + primary_reagent = primary_solid + else // By default, take the primary_liquid as the primary_reagent. + primary_reagent = primary_liquid + + UNSETEMPTY(reagent_volumes) if(total_volume > maximum_volume) remove_any(total_volume-maximum_volume) + /datum/reagents/proc/process_reactions() var/atom/location = get_reaction_loc() @@ -245,7 +290,7 @@ var/global/obj/temp_reagents_holder = new my_atom?.try_on_reagent_change() handle_update() -/datum/reagents/proc/add_reagent(var/reagent_type, var/amount, var/data = null, var/safety = 0, var/defer_update = FALSE) +/datum/reagents/proc/add_reagent(var/reagent_type, var/amount, var/data = null, var/safety = 0, var/defer_update = FALSE, var/phase) amount = CHEMS_QUANTIZE(min(amount, REAGENTS_FREE_SPACE(src))) if(amount <= 0) @@ -255,6 +300,26 @@ var/global/obj/temp_reagents_holder = new if(!istype(newreagent)) return FALSE + if(!phase) + // By default, assume the reagent phase at STP. + phase = newreagent.phase_at_temperature() + // Assume it's in solution, somehow. + if(phase == MAT_PHASE_GAS) + phase = MAT_PHASE_LIQUID + + var/list/phase_volumes + if(phase == MAT_PHASE_LIQUID) + LAZYINITLIST(liquid_volumes) + phase_volumes = liquid_volumes + else + LAZYINITLIST(solid_volumes) + phase_volumes = solid_volumes + + if(!phase_volumes[reagent_type]) + phase_volumes[reagent_type] = amount + else + phase_volumes[reagent_type] += amount + LAZYINITLIST(reagent_volumes) if(!reagent_volumes[reagent_type]) reagent_volumes[reagent_type] = amount @@ -269,7 +334,9 @@ var/global/obj/temp_reagents_holder = new LAZYSET(reagent_data, reagent_type, newreagent.mix_data(src, data, amount)) if(reagent_volumes.len > 1) // otherwise if we have a mix of reagents, uncache as well cached_color = null + UNSETEMPTY(reagent_volumes) + UNSETEMPTY(phase_volumes) if(defer_update) total_volume = clamp(total_volume + amount, 0, maximum_volume) // approximation, call update_total() if deferring @@ -277,23 +344,45 @@ var/global/obj/temp_reagents_holder = new handle_update(safety) return TRUE -/datum/reagents/proc/remove_reagent(var/reagent_type, var/amount, var/safety = 0, var/defer_update = FALSE) +/datum/reagents/proc/remove_reagent(var/reagent_type, var/amount, var/safety = 0, var/defer_update = FALSE, var/removed_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) amount = CHEMS_QUANTIZE(amount) if(!isnum(amount) || amount <= 0 || REAGENT_VOLUME(src, reagent_type) <= 0) return FALSE - reagent_volumes[reagent_type] -= amount - if(reagent_volumes.len > 1 || reagent_volumes[reagent_type] <= 0) + + var/removed = 0 + if((removed_phases & MAT_PHASE_LIQUID) && LIQUID_VOLUME(src, reagent_type) > 0) + + removed += min(liquid_volumes[reagent_type], amount) + liquid_volumes[reagent_type] -= removed + + // If both liquid and solid reagents are being removed, we prioritize the liquid reagents. + if((removed < amount) && (removed_phases & MAT_PHASE_SOLID) && SOLID_VOLUME(src, reagent_type) > 0) + + var/solid_removed = min(solid_volumes[reagent_type], amount - removed) + solid_volumes[reagent_type] -= solid_removed + + removed += solid_removed + + if(removed == 0) + return FALSE + + // If removed < amount, a reagent has been removed completely from a state, so uncache the color. + if((LAZYLEN(liquid_volumes) > 1 || LAZYLEN(solid_volumes) > 1) || (removed < amount)) cached_color = null if(defer_update) - total_volume = clamp(total_volume - amount, 0, maximum_volume) // approximation, call update_total() if deferring + total_volume = clamp(total_volume - removed, 0, maximum_volume) // approximation, call update_total() if deferring else handle_update(safety) return TRUE /datum/reagents/proc/clear_reagent(var/reagent_type, var/defer_update = FALSE, var/force = FALSE) - . = force || !!(REAGENT_VOLUME(src, reagent_type) || REAGENT_DATA(src, reagent_type)) + . = force || !!REAGENT_DATA(src, reagent_type) || !!REAGENT_VOLUME(src, reagent_type) if(.) + var/amount = LAZYACCESS(reagent_volumes, reagent_type) + LAZYREMOVE(liquid_volumes, reagent_type) + LAZYREMOVE(solid_volumes, reagent_type) + LAZYREMOVE(reagent_volumes, reagent_type) LAZYREMOVE(reagent_data, reagent_type) if(primary_reagent == reagent_type) @@ -305,29 +394,37 @@ var/global/obj/temp_reagents_holder = new else handle_update() -/datum/reagents/proc/has_reagent(var/reagent_type, var/amount) - . = REAGENT_VOLUME(src, reagent_type) +/datum/reagents/proc/has_reagent(var/reagent_type, var/amount, var/phases) + . = 0 + if(phases) + if(phases & MAT_PHASE_SOLID) + . += SOLID_VOLUME(src, reagent_type) + if(phases & MAT_PHASE_LIQUID) + . += LIQUID_VOLUME(src, reagent_type) + else + . = REAGENT_VOLUME(src, reagent_type) if(. && amount) . = (. >= amount) -/datum/reagents/proc/has_any_reagent(var/list/check_reagents) +/datum/reagents/proc/has_any_reagent(var/list/check_reagents, var/phases) for(var/check in check_reagents) - var/vol = REAGENT_VOLUME(src, check) - if(vol > 0 && vol >= check_reagents[check]) + if(has_reagent(check, check_reagents[check], phases)) return TRUE return FALSE -/datum/reagents/proc/has_all_reagents(var/list/check_reagents) - if(LAZYLEN(reagent_volumes) < LAZYLEN(check_reagents)) - return FALSE +/datum/reagents/proc/has_all_reagents(var/list/check_reagents, var/phases) + . = TRUE for(var/check in check_reagents) - if(REAGENT_VOLUME(src, check) < check_reagents[check]) - return FALSE - return TRUE + . = min(., has_reagent(check, check_reagents[check], phases)) + if(!.) + return /datum/reagents/proc/clear_reagents() for(var/reagent in reagent_volumes) clear_reagent(reagent, defer_update = TRUE) + + LAZYCLEARLIST(liquid_volumes) + LAZYCLEARLIST(solid_volumes) LAZYCLEARLIST(reagent_volumes) LAZYCLEARLIST(reagent_data) total_volume = 0 @@ -340,7 +437,16 @@ var/global/obj/temp_reagents_holder = new /datum/reagents/proc/get_reagents(scannable_only = 0, precision) . = list() - for(var/rtype in reagent_volumes) + for(var/rtype in liquid_volumes) + var/decl/material/current= GET_DECL(rtype) + if(scannable_only && !current.scannable) + continue + var/volume = REAGENT_VOLUME(src, rtype) + if(precision) + volume = round(volume, precision) + if(volume) + . += "[current.get_reagent_name(src, MAT_PHASE_LIQUID)] ([volume])" + for(var/rtype in solid_volumes) var/decl/material/current= GET_DECL(rtype) if(scannable_only && !current.scannable) continue @@ -348,7 +454,7 @@ var/global/obj/temp_reagents_holder = new if(precision) volume = round(volume, precision) if(volume) - . += "[current.get_reagent_name(src)] ([volume])" + . += "[current.get_reagent_name(src, MAT_PHASE_SOLID)] ([volume])" return english_list(., "EMPTY", "", ", ", ", ") /datum/reagents/proc/get_dirtiness() @@ -358,15 +464,39 @@ var/global/obj/temp_reagents_holder = new return . / length(reagent_volumes) /* Holder-to-holder and similar procs */ -/datum/reagents/proc/remove_any(var/amount = 1, var/defer_update = FALSE) // Removes up to [amount] of reagents from [src]. Returns actual amount removed. +/datum/reagents/proc/remove_any(var/amount = 1, var/defer_update = FALSE, var/removed_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) // Removes up to [amount] of reagents from [src]. Returns actual amount removed. if(amount <= 0) return 0 - if(amount >= total_volume) - . = total_volume - clear_reagents() - return + // The list we're iterating over to remove reagents. + var/list/removing_volumes + var/removing_volumes_total + // Shortcut if we're removing both liquids and solids (most cases). + if((removed_phases & MAT_PHASE_LIQUID) && (removed_phases & MAT_PHASE_SOLID)) + if(amount >= total_volume) + . = total_volume + clear_reagents() + return + + removing_volumes = reagent_volumes + removing_volumes_total = total_volume + + else if(removed_phases & MAT_PHASE_LIQUID) + if(!LAZYLEN(liquid_volumes)) + return 0 + + removing_volumes = liquid_volumes + removing_volumes_total = total_liquid_volume + + else if(removed_phases & MAT_PHASE_SOLID) + if(!LAZYLEN(solid_volumes)) + return 0 + + removing_volumes = solid_volumes + removing_volumes_total = total_volume - total_liquid_volume + else + return 0 var/removing = clamp(CHEMS_QUANTIZE(amount), 0, total_volume) // not ideal but something is making total_volume become NaN if(!removing || total_volume <= 0) @@ -376,18 +506,18 @@ var/global/obj/temp_reagents_holder = new // Some reagents may be too low to remove from, so do multiple passes. . = 0 - var/part = removing / total_volume + var/part = removing / removing_volumes_total var/failed_remove = FALSE while(removing >= MINIMUM_CHEMICAL_VOLUME && total_volume >= MINIMUM_CHEMICAL_VOLUME && !failed_remove) failed_remove = TRUE - for(var/current in reagent_volumes) - var/removing_amt = min(CHEMS_QUANTIZE(REAGENT_VOLUME(src, current) * part), removing) + for(var/current in removing_volumes) + var/removing_amt = min(CHEMS_QUANTIZE(removing_volumes[current] * part), removing) if(removing_amt <= 0) continue failed_remove = FALSE removing -= removing_amt . += removing_amt - remove_reagent(current, removing_amt, TRUE, TRUE) + remove_reagent(current, removing_amt, TRUE, TRUE, removed_phases = removed_phases) if(!defer_update) handle_update() @@ -395,7 +525,8 @@ var/global/obj/temp_reagents_holder = new // Transfers [amount] reagents from [src] to [target], multiplying them by [multiplier]. // Returns actual amount removed from [src] (not amount transferred to [target]). // Use safety = 1 for temporary targets to avoid queuing them up for processing. -/datum/reagents/proc/trans_to_holder(var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/safety = 0, var/defer_update = FALSE, list/skip_reagents) +// Reagent phases are preserved. +/datum/reagents/proc/trans_to_holder(var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/safety = 0, var/defer_update = FALSE, var/list/skip_reagents, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) if(!target || !istype(target)) return @@ -418,20 +549,51 @@ var/global/obj/temp_reagents_holder = new . = 0 for(var/rtype in reagent_volumes - skip_reagents) var/amount_to_transfer = CHEMS_QUANTIZE(REAGENT_VOLUME(src, rtype) * part) - target.add_reagent(rtype, amount_to_transfer * multiplier, REAGENT_DATA(src, rtype), TRUE, TRUE) // We don't react until everything is in place - . += amount_to_transfer - if(!copy) - remove_reagent(rtype, amount_to_transfer, TRUE, TRUE) + + // Prioritize liquid transfers + if(transferred_phases & MAT_PHASE_LIQUID) + var/liquid_transferred = min(amount_to_transfer, CHEMS_QUANTIZE(LIQUID_VOLUME(src, rtype))) + target.add_reagent(rtype, liquid_transferred * multiplier, REAGENT_DATA(src, rtype), TRUE, TRUE, MAT_PHASE_LIQUID) // We don't react until everything is in place + . += liquid_transferred + amount_to_transfer -= liquid_transferred + + if(!copy) + remove_reagent(rtype, liquid_transferred, TRUE, TRUE, MAT_PHASE_LIQUID) + + if(transferred_phases & MAT_PHASE_SOLID) + var/solid_transferred = (min(amount_to_transfer, CHEMS_QUANTIZE(SOLID_VOLUME(src, rtype)))) + target.add_reagent(rtype, solid_transferred * multiplier, REAGENT_DATA(src, rtype), TRUE, TRUE, MAT_PHASE_SOLID) // Ditto + . += solid_transferred + amount_to_transfer -= solid_transferred + + if(!copy) + remove_reagent(rtype, solid_transferred, TRUE, TRUE, MAT_PHASE_SOLID) + // Due to rounding, we may have taken less than we wanted. // If we're up short, add the remainder taken from the primary reagent. // If we're skipping the primary reagent we just don't do this step. if(. < amount && primary_reagent && !(primary_reagent in skip_reagents) && REAGENT_VOLUME(src, primary_reagent) > 0) var/remainder = min(REAGENT_VOLUME(src, primary_reagent), CHEMS_QUANTIZE(amount - .)) - target.add_reagent(primary_reagent, remainder * multiplier, REAGENT_DATA(src, primary_reagent), TRUE, TRUE) - . += remainder + + var/liquid_remainder + var/solid_remainder + + if(LIQUID_VOLUME(src, primary_reagent)) + liquid_remainder = min(remainder, LIQUID_VOLUME(src, primary_reagent)) + target.add_reagent(primary_reagent, remainder * multiplier, REAGENT_DATA(src, primary_reagent), TRUE, TRUE, MAT_PHASE_LIQUID) + . += liquid_remainder + remainder -= liquid_remainder + if(remainder >= 0 && SOLID_VOLUME(src, primary_reagent)) + solid_remainder = min(remainder, SOLID_VOLUME(src, primary_reagent)) + target.add_reagent(primary_reagent, solid_remainder * multiplier, REAGENT_DATA(src, primary_reagent), TRUE, TRUE, MAT_PHASE_SOLID) + . += solid_remainder + remainder -= solid_remainder if(!copy) - remove_reagent(primary_reagent, remainder, TRUE, TRUE) + if(liquid_remainder >= 0) + remove_reagent(primary_reagent, liquid_remainder, TRUE, TRUE, MAT_PHASE_LIQUID) + if(solid_remainder >= 0) + remove_reagent(primary_reagent, solid_remainder, TRUE, TRUE, MAT_PHASE_SOLID) if(!defer_update) target.handle_update(safety) @@ -445,22 +607,22 @@ var/global/obj/temp_reagents_holder = new //not directly injected into the contents. It first calls touch, then the appropriate trans_to_*() or splash_mob(). //If for some reason touch effects are bypassed (e.g. injecting stuff directly into a reagent container or person), //call the appropriate trans_to_*() proc. -/datum/reagents/proc/trans_to(var/atom/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE) +/datum/reagents/proc/trans_to(var/atom/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) if(ismob(target)) touch_mob(target) if(QDELETED(target)) return 0 return splash_mob(target, amount, copy, defer_update = defer_update) if(isturf(target)) - return trans_to_turf(target, amount, multiplier, copy, defer_update = defer_update) + return trans_to_turf(target, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) if(isobj(target)) touch_obj(target) if(!QDELETED(target) && target.can_be_poured_into(my_atom)) - return trans_to_obj(target, amount, multiplier, copy, defer_update = defer_update) + return trans_to_obj(target, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) return 0 return 0 -//Splashing reagents is messier than trans_to, the target's loc gets some of the reagents as well. +//Splashing reagents is messier than trans_to, the target's loc gets some of the reagents as well. All phases are transferred by default /datum/reagents/proc/splash(var/atom/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/min_spill=0, var/max_spill=60, var/defer_update = FALSE) if(!istype(target)) @@ -471,7 +633,7 @@ var/global/obj/temp_reagents_holder = new return if(isturf(target.loc) && min_spill && max_spill) - var/spill = FLOOR(amount*(rand(min_spill, max_spill)/100)) + var/spill = floor(amount*(rand(min_spill, max_spill)/100)) if(spill) amount -= spill trans_to_turf(target.loc, spill, multiplier, copy, defer_update) @@ -540,8 +702,8 @@ var/global/obj/temp_reagents_holder = new if (total_volume <= 0) qdel(src) -/datum/reagents/proc/trans_type_to(var/atom/target, var/type, var/amount = 1, var/multiplier = 1, var/defer_update = FALSE) - if (!target || !target.reagents || !target.simulated) +/datum/reagents/proc/trans_type_to(var/atom/target, var/type, var/amount = 1, var/multiplier = 1, var/defer_update = FALSE, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) + if (!target || !target.reagents || !target.simulated || !transferred_phases) return amount = max(0, min(amount, REAGENT_VOLUME(src, type), REAGENTS_FREE_SPACE(target.reagents) / multiplier)) @@ -549,13 +711,40 @@ var/global/obj/temp_reagents_holder = new if(!amount) return + // Small check for optimization. + if (!(transferred_phases & MAT_PHASE_LIQUID)) + if(!SOLID_VOLUME(src, type)) + return + + if (!(transferred_phases & MAT_PHASE_SOLID)) + if(!LIQUID_VOLUME(src, type)) + return + var/datum/reagents/F = new(amount, global.temp_reagents_holder) - F.add_reagent(type, amount, REAGENT_DATA(src, type)) - remove_reagent(type, amount, defer_update = defer_update) - . = F.trans_to(target, amount, multiplier, defer_update = defer_update) // Let this proc check the atom's type + + var/amount_remaining = amount + + // Prioritize liquid transfers. + if(transferred_phases & MAT_PHASE_LIQUID) + var/liquid_transferred = NONUNIT_FLOOR(min(amount_remaining, LIQUID_VOLUME(src, type)), MINIMUM_CHEMICAL_VOLUME) + F.add_reagent(type, liquid_transferred, REAGENT_DATA(src, type), defer_update = TRUE, phase = MAT_PHASE_LIQUID) + remove_reagent(type, liquid_transferred, defer_update = TRUE, removed_phases = MAT_PHASE_LIQUID) + amount_remaining -= liquid_transferred + + if(transferred_phases & MAT_PHASE_SOLID) + var/solid_transferred = NONUNIT_FLOOR(min(amount_remaining, SOLID_VOLUME(src, type)), MINIMUM_CHEMICAL_VOLUME) + F.add_reagent(type, solid_transferred, REAGENT_DATA(src, type), defer_update = TRUE, phase = MAT_PHASE_SOLID) + remove_reagent(type, solid_transferred, defer_update = TRUE, removed_phases = MAT_PHASE_LIQUID) + amount_remaining -= solid_transferred + + // Now that both liquid and solid components are removed, we can update if necessary. + if(!defer_update) + handle_update() + + . = F.trans_to(target, amount, multiplier, defer_update = defer_update, transferred_phases = transferred_phases) // Let this proc check the atom's type qdel(F) -/datum/reagents/proc/trans_type_to_holder(var/datum/reagents/target, var/type, var/amount = 1, var/multiplier = 1, var/defer_update = FALSE) +/datum/reagents/proc/trans_type_to_holder(var/datum/reagents/target, var/type, var/amount = 1, var/multiplier = 1, var/defer_update = FALSE, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) if (!target) return @@ -564,11 +753,17 @@ var/global/obj/temp_reagents_holder = new if(!amount) return - var/datum/reagents/F = new(amount, global.temp_reagents_holder) - F.add_reagent(type, amount, REAGENT_DATA(src, type)) - remove_reagent(type, amount, defer_update = defer_update) - . = F.trans_to_holder(target, amount, multiplier, defer_update = defer_update) // Let this proc check the atom's type - qdel(F) + // Small check for optimization. + if (!(transferred_phases & MAT_PHASE_LIQUID)) + if(!SOLID_VOLUME(src, type)) + return + + if (!(transferred_phases & MAT_PHASE_SOLID)) + if(!LIQUID_VOLUME(src, type)) + return + + var/filtered_types = reagent_volumes - type + return trans_to_holder(target, amount, multiplier, skip_reagents = filtered_types, defer_update = defer_update, transferred_phases = transferred_phases) // Let this proc check the atom's type // When applying reagents to an atom externally, touch procs are called to trigger any on-touch effects of the reagent. // Options are touch_turf(), touch_mob() and touch_obj(). This does not handle transferring reagents to things. @@ -626,7 +821,7 @@ var/global/obj/temp_reagents_holder = new perm = L.reagent_permeability() return trans_to_mob(target, amount * perm, CHEM_TOUCH, 1, copy, defer_update = defer_update) -/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_INJECT, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE) // Transfer after checking into which holder... +/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_INJECT, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) // Transfer after checking into which holder... if(!target || !istype(target) || !target.simulated) return if(isliving(target)) @@ -634,7 +829,7 @@ var/global/obj/temp_reagents_holder = new if(type == CHEM_INJECT) var/datum/reagents/R = L.get_injected_reagents() if(R) - return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update) + return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) if(type == CHEM_INGEST) var/datum/reagents/R = L.get_ingested_reagents() if(R) @@ -642,39 +837,51 @@ var/global/obj/temp_reagents_holder = new if(type == CHEM_TOUCH) var/datum/reagents/R = L.get_contact_reagents() if(R) - return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update) + return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) if(type == CHEM_INHALE) var/datum/reagents/R = L.get_inhaled_reagents() if(R) - return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update) + return trans_to_holder(R, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) var/datum/reagents/R = new /datum/reagents(amount, global.temp_reagents_holder) - . = trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update) + . = trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = transferred_phases) R.touch_mob(target) qdel(R) -/datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE) +/datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) if(!target?.simulated) return + + // If we're only dumping solids, and there's not enough liquid present on the turf to make a slurry, we dump the solids directly. + // This avoids creating an unnecessary reagent holder that won't be immediately deleted. + if((!(transferred_phases & MAT_PHASE_LIQUID) || !total_liquid_volume) && (target.reagents?.total_liquid_volume < FLUID_SLURRY)) + var/datum/reagents/R = new /datum/reagents(amount, global.temp_reagents_holder) + trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = MAT_PHASE_SOLID) + R.touch_turf(target) + target.dump_solid_reagents(R) + qdel(R) + return + if(!target.reagents) target.create_reagents(FLUID_MAX_DEPTH) - trans_to_holder(target.reagents, amount, multiplier, copy, defer_update = defer_update) + 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.fluid_act(target.reagents) -/datum/reagents/proc/trans_to_obj(var/obj/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE) // Objects may or may not; if they do, it's probably a beaker or something and we need to transfer properly; otherwise, just touch. + // 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. +/datum/reagents/proc/trans_to_obj(var/obj/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/defer_update = FALSE, var/transferred_phases = (MAT_PHASE_LIQUID | MAT_PHASE_SOLID)) if(!target || !target.simulated) return if(!target.reagents) var/datum/reagents/R = new /datum/reagents(amount * multiplier, global.temp_reagents_holder) - . = trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update) + . = trans_to_holder(R, amount, multiplier, copy, TRUE, defer_update = defer_update, transferred_phases = transferred_phases) R.touch_obj(target) qdel(R) return - return trans_to_holder(target.reagents, amount, multiplier, copy, defer_update = defer_update) + return trans_to_holder(target.reagents, amount, multiplier, copy, defer_update = defer_update, transferred_phases = transferred_phases) /* Atom reagent creation - use it all the time */ diff --git a/code/modules/reagents/dispenser/cartridge.dm b/code/modules/reagents/dispenser/cartridge.dm index d34a0361704..924c00ea958 100644 --- a/code/modules/reagents/dispenser/cartridge.dm +++ b/code/modules/reagents/dispenser/cartridge.dm @@ -21,7 +21,7 @@ if(reagents.total_volume <= 0) to_chat(user, "It is empty.") else - to_chat(user, "It contains [reagents.total_volume] units of liquid.") + to_chat(user, "It contains [reagents.total_volume] units of reagents.") if(!ATOM_IS_OPEN_CONTAINER(src)) to_chat(user, "The cap is sealed.") diff --git a/code/modules/reagents/heat_sources/_heat_source.dm b/code/modules/reagents/heat_sources/_heat_source.dm index dfc9f92aa5d..b9295313707 100644 --- a/code/modules/reagents/heat_sources/_heat_source.dm +++ b/code/modules/reagents/heat_sources/_heat_source.dm @@ -150,10 +150,10 @@ dat += "" - dat += "" + dat += "" dat += "" - dat += "" + dat += "" dat += "" dat += "
Legend
" - . += get_display_name(max(1, FLOOR(products_per_sheet)), apply_article = FALSE) + . += get_display_name(max(1, floor(products_per_sheet)), apply_article = FALSE) . += "" @@ -206,7 +206,7 @@ else if(allow_multiple_craft && !one_per_turf && clamp_sheets <= max_multiplier) var/new_row = 5 for(var/i = clamp_sheets to max_multiplier step clamp_sheets) - var/producing = FLOOR(i * products_per_sheet) + var/producing = floor(i * products_per_sheet) . += "[producing]x" if(new_row == 0) new_row = 5 @@ -214,7 +214,7 @@ else new_row-- else - . += "1x" + . += "1x" . += "
Current temperature:[FLOOR(temperature - T0C)]C
Current temperature:[floor(temperature - T0C)]C
Loaded container:[container ? "[container.name] ([FLOOR(container.temperature - T0C)]C) Remove" : "None."]
[container ? "[container.name] ([floor(container.temperature - T0C)]C) Remove" : "None."]
Switched:[use_power == POWER_USE_ACTIVE ? "On" : "Off"]
" diff --git a/code/modules/reagents/reactions/reaction_synthesis.dm b/code/modules/reagents/reactions/reaction_synthesis.dm index 79d2ebd8e06..7020eb34076 100644 --- a/code/modules/reagents/reactions/reaction_synthesis.dm +++ b/code/modules/reagents/reactions/reaction_synthesis.dm @@ -14,8 +14,8 @@ /decl/chemical_reaction/synthesis/fiberglass/Initialize() required_reagents = list( - /decl/material/solid/glass = CEILING(REAGENT_UNITS_PER_MATERIAL_SHEET/2), - /decl/material/solid/organic/plastic = CEILING(REAGENT_UNITS_PER_MATERIAL_SHEET/2) + /decl/material/solid/glass = ceil(REAGENT_UNITS_PER_MATERIAL_SHEET/2), + /decl/material/solid/organic/plastic = ceil(REAGENT_UNITS_PER_MATERIAL_SHEET/2) ) . = ..() @@ -23,7 +23,7 @@ ..() var/location = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) if(location) - created_volume = CEILING(created_volume) + created_volume = ceil(created_volume) if(created_volume > 0) var/decl/material/mat = GET_DECL(/decl/material/solid/fiberglass) mat.create_object(location, created_volume) @@ -53,7 +53,7 @@ var/list/removing_reagents = list() for(var/rtype in holder.reagent_volumes) if(rtype != /decl/material/liquid/crystal_agent) - var/solidifying = FLOOR(REAGENT_VOLUME(holder, rtype) / REAGENT_UNITS_PER_MATERIAL_SHEET) + var/solidifying = floor(REAGENT_VOLUME(holder, rtype) / REAGENT_UNITS_PER_MATERIAL_SHEET) if(solidifying) SSmaterials.create_object(rtype, location, solidifying, /obj/item/stack/material/cubes) removing_reagents[rtype] = solidifying * REAGENT_UNITS_PER_MATERIAL_SHEET @@ -88,7 +88,7 @@ for(var/rtype in holder.reagent_volumes) var/decl/material/mat = GET_DECL(rtype) if(mat.default_solid_form == /obj/item/stack/material/aerogel) - var/solidifying = FLOOR(REAGENT_VOLUME(holder, rtype) / REAGENT_UNITS_PER_MATERIAL_SHEET) + var/solidifying = floor(REAGENT_VOLUME(holder, rtype) / REAGENT_UNITS_PER_MATERIAL_SHEET) if(solidifying) SSmaterials.create_object(rtype, location, solidifying) removing_reagents[rtype] = solidifying * REAGENT_UNITS_PER_MATERIAL_SHEET @@ -120,7 +120,7 @@ var/turf/T = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) if(!istype(T)) return - var/create_stacks = FLOOR(created_volume) + var/create_stacks = floor(created_volume) if(create_stacks <= 0) return new /obj/item/stack/medical/resin/crafted(T, create_stacks) @@ -141,7 +141,7 @@ var/turf/T = get_turf(holder.get_reaction_loc(chemical_reaction_flags)) if(!istype(T)) return - var/create_soap = FLOOR(created_volume) + var/create_soap = floor(created_volume) if(create_soap <= 0) return for(var/i = 1 to create_soap) diff --git a/code/modules/reagents/reagent_containers/food.dm b/code/modules/reagents/reagent_containers/food.dm index b2ed15e9a73..98537736dfd 100644 --- a/code/modules/reagents/reagent_containers/food.dm +++ b/code/modules/reagents/reagent_containers/food.dm @@ -40,17 +40,28 @@ var/filling_color = "#ffffff" //Used by sandwiches. var/trash var/obj/item/plate/plate + /// A type used when cloning this food item for utensils. + var/utensil_food_type + /// A set of utensil flags determining which utensil interactions are valid with this food. + var/utensil_flags = UTENSIL_FLAG_SCOOP | UTENSIL_FLAG_COLLECT -/obj/item/food/Initialize() +/obj/item/food/Initialize(ml, material_key, skip_plate = FALSE) . = ..() if(cooked_food == FOOD_RAW) name = "raw [name]" - if(ispath(plate)) + + if(skip_plate) + plate = null + else if(ispath(plate)) plate = new plate(src) + else if(!istype(plate)) + plate = null -/obj/item/food/Initialize(ml, material_key) - . = ..() initialize_reagents() + if(isnull(utensil_food_type)) + utensil_food_type = type + if(slice_path && slice_num) + utensil_flags |= UTENSIL_FLAG_SLICE /obj/item/food/initialize_reagents(populate = TRUE) if(!reagents) diff --git a/code/modules/reagents/reagent_containers/food/canned.dm b/code/modules/reagents/reagent_containers/food/canned.dm index 294a78c5306..7835a689442 100644 --- a/code/modules/reagents/reagent_containers/food/canned.dm +++ b/code/modules/reagents/reagent_containers/food/canned.dm @@ -13,7 +13,7 @@ var/sealed = TRUE var/open_complexity = OPEN_HARD -/obj/item/food/can/Initialize() +/obj/item/food/can/Initialize(mapload, material_key, skip_plate = FALSE) . = ..() if(!sealed) unseal() diff --git a/code/modules/reagents/reagent_containers/food/jerky.dm b/code/modules/reagents/reagent_containers/food/jerky.dm index acb73c74036..d774c5fbddb 100644 --- a/code/modules/reagents/reagent_containers/food/jerky.dm +++ b/code/modules/reagents/reagent_containers/food/jerky.dm @@ -8,7 +8,7 @@ nutriment_amt = 5 var/meat_name = "meat" -/obj/item/food/jerky/Initialize() +/obj/item/food/jerky/Initialize(mapload, material_key, skip_plate = FALSE) . = ..() if(meat_name) set_meat_name(meat_name) diff --git a/code/modules/reagents/reagent_containers/food/sandwich.dm b/code/modules/reagents/reagent_containers/food/sandwich.dm index 84a5b5c99f5..ef42abb3df0 100644 --- a/code/modules/reagents/reagent_containers/food/sandwich.dm +++ b/code/modules/reagents/reagent_containers/food/sandwich.dm @@ -72,7 +72,7 @@ SetName(lowertext("[fullname] sandwich")) if(length(name) > 80) SetName("[pick(list("absurd","colossal","enormous","ridiculous"))] sandwich") - w_class = CEILING(clamp((ingredients.len/2),2,4)) + w_class = ceil(clamp((ingredients.len/2),2,4)) /obj/item/food/csandwich/Destroy() for(var/obj/item/O in ingredients) diff --git a/code/modules/reagents/reagent_containers/food/sliceable.dm b/code/modules/reagents/reagent_containers/food/sliceable.dm index a73465376e3..833ec916719 100644 --- a/code/modules/reagents/reagent_containers/food/sliceable.dm +++ b/code/modules/reagents/reagent_containers/food/sliceable.dm @@ -28,7 +28,7 @@ * whole item, transferring the reagents and deleting the whole item, which may * have performance implications. */ -/obj/item/food/slice/Initialize() +/obj/item/food/slice/Initialize(mapload, material_key, skip_plate = FALSE) . = ..() if(filled) var/obj/item/food/whole = new whole_path() diff --git a/code/modules/reagents/reagent_containers/food/sushi.dm b/code/modules/reagents/reagent_containers/food/sushi.dm index d38a71e1318..eda69171d58 100644 --- a/code/modules/reagents/reagent_containers/food/sushi.dm +++ b/code/modules/reagents/reagent_containers/food/sushi.dm @@ -6,8 +6,8 @@ bitesize = 1 var/fish_type = "fish" -/obj/item/food/sushi/Initialize(mapload, var/obj/item/food/rice, var/obj/item/food/topping) - . = ..(mapload) +/obj/item/food/sushi/Initialize(mapload, material_key, skip_plate = FALSE, obj/item/food/rice, obj/item/food/topping) + . = ..(mapload, material_key, skip_plate) if(istype(topping)) for(var/taste_thing in topping.nutriment_desc) @@ -61,9 +61,10 @@ var/fish_type = "fish" var/slices = 1 -/obj/item/food/sashimi/Initialize(mapload, material_key, var/_fish_type) - . = ..(mapload) - if(_fish_type) fish_type = _fish_type +/obj/item/food/sashimi/Initialize(mapload, material_key, skip_plate = FALSE, _fish_type) + . = ..(mapload, material_key, skip_plate) + if(_fish_type) + fish_type = _fish_type name = "[fish_type] sashimi" update_icon() @@ -104,7 +105,7 @@ else if(!user.try_unequip(I)) return - new /obj/item/food/sushi(get_turf(src), I, src) + new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) return . = ..() @@ -116,36 +117,39 @@ if(sashimi.slices > 1) to_chat(user, "Putting more than one slice of fish on your sushi is just greedy.") else - new /obj/item/food/sushi(get_turf(src), src, I) + new /obj/item/food/sushi(get_turf(src), null, TRUE, src, I) return - if(istype(I, /obj/item/food/friedegg) || \ - istype(I, /obj/item/food/tofu) || \ - istype(I, /obj/item/food/butchery/cutlet) || \ - istype(I, /obj/item/food/butchery/cutlet/raw) || \ - istype(I, /obj/item/food/spider) || \ - istype(I, /obj/item/food/butchery/meat/chicken)) - new /obj/item/food/sushi(get_turf(src), src, I) + var/static/list/sushi_types = list( + /obj/item/food/friedegg, + /obj/item/food/tofu, + /obj/item/food/butchery/cutlet, + /obj/item/food/butchery/cutlet/raw, + /obj/item/food/spider, + /obj/item/food/butchery/meat/chicken + ) + if(is_type_in_list(I, sushi_types)) + new /obj/item/food/sushi(get_turf(src), null, TRUE, src, I) return . = ..() // Used for turning other food into sushi. /obj/item/food/friedegg/attackby(var/obj/item/I, var/mob/user) if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), I, src) + new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) return . = ..() /obj/item/food/tofu/attackby(var/obj/item/I, var/mob/user) if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), I, src) + new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) return . = ..() /obj/item/food/butchery/cutlet/raw/attackby(var/obj/item/I, var/mob/user) if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), I, src) + new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) return . = ..() /obj/item/food/butchery/cutlet/attackby(var/obj/item/I, var/mob/user) if((locate(/obj/structure/table) in loc) && istype(I, /obj/item/food/boiledrice)) - new /obj/item/food/sushi(get_turf(src), I, src) + new /obj/item/food/sushi(get_turf(src), null, TRUE, I, src) return . = ..() -// End non-fish sushi. \ No newline at end of file +// End non-fish sushi. diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index 92ebdc04212..af28f1286df 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -46,7 +46,7 @@ return if(reagents?.total_volume) - to_chat(user, SPAN_NOTICE("It contains [reagents.total_volume] units of liquid.")) + to_chat(user, SPAN_NOTICE("It contains [reagents.total_volume] units of reagents.")) else to_chat(user, SPAN_NOTICE("It is empty.")) if(!ATOM_IS_OPEN_CONTAINER(src)) diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 0f766804599..fd422e1fdd5 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -280,7 +280,7 @@ var/hit_area = affecting.name - if((user != target) && H.check_shields(7, src, user, "\the [src]")) + if((user != target) && H.check_shields(7, src, user, target_zone, src)) return if (target != user && H.get_blocked_ratio(target_zone, BRUTE, damage_flags=DAM_SHARP) > 0.1 && prob(50)) diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index cbe0dda9c57..294df2cd33c 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -73,9 +73,12 @@ to_chat(user, SPAN_NOTICE("It contains:")) if(LAZYLEN(reagents?.reagent_volumes)) - for(var/rtype in reagents.reagent_volumes) + for(var/rtype in reagents.liquid_volumes) var/decl/material/R = GET_DECL(rtype) - to_chat(user, SPAN_NOTICE("[REAGENT_VOLUME(reagents, rtype)] unit\s of [R.liquid_name].")) + to_chat(user, SPAN_NOTICE("[LIQUID_VOLUME(reagents, rtype)] unit\s of [R.get_reagent_name(reagents, MAT_PHASE_LIQUID)].")) + for(var/rtype in reagents.solid_volumes) + var/decl/material/R = GET_DECL(rtype) + to_chat(user, SPAN_NOTICE("[SOLID_VOLUME(reagents, rtype)] unit\s of [R.get_reagent_name(reagents, MAT_PHASE_SOLID)].")) else to_chat(user, SPAN_NOTICE("Nothing.")) diff --git a/code/modules/research/design_database_analyzer.dm b/code/modules/research/design_database_analyzer.dm index b0c3c4150bb..b4b8b587365 100644 --- a/code/modules/research/design_database_analyzer.dm +++ b/code/modules/research/design_database_analyzer.dm @@ -60,7 +60,7 @@ var/list/dump_matter for(var/mat in cached_materials) - var/amt = FLOOR(cached_materials[mat]/SHEET_MATERIAL_AMOUNT) + var/amt = floor(cached_materials[mat]/SHEET_MATERIAL_AMOUNT) if(amt > 0) LAZYSET(dump_matter, mat, amt) if(length(dump_matter)) diff --git a/code/modules/sealant_gun/sealant_injector.dm b/code/modules/sealant_gun/sealant_injector.dm index d48d47109e3..7a04a9fd098 100644 --- a/code/modules/sealant_gun/sealant_injector.dm +++ b/code/modules/sealant_gun/sealant_injector.dm @@ -63,7 +63,7 @@ to_chat(user, SPAN_WARNING("There is no tank loaded.")) return TRUE - var/fill_space = FLOOR(loaded_tank.max_foam_charges - loaded_tank.foam_charges) / 5 + var/fill_space = floor(loaded_tank.max_foam_charges - loaded_tank.foam_charges) / 5 if(fill_space <= 0) to_chat(user, SPAN_WARNING("\The [loaded_tank] is full.")) return TRUE diff --git a/code/modules/sealant_gun/sealant_tank.dm b/code/modules/sealant_gun/sealant_tank.dm index fb8ca497c38..d9c3a1f6fef 100644 --- a/code/modules/sealant_gun/sealant_tank.dm +++ b/code/modules/sealant_gun/sealant_tank.dm @@ -9,7 +9,7 @@ /obj/item/sealant_tank/on_update_icon() . = ..() - add_overlay("fill_[FLOOR((foam_charges/max_foam_charges) * 5)]") + add_overlay("fill_[floor((foam_charges/max_foam_charges) * 5)]") /obj/item/sealant_tank/examine(mob/user, distance) . = ..() diff --git a/code/modules/spells/targeted/shapeshift.dm b/code/modules/spells/targeted/shapeshift.dm index 8d32f265038..24e92093ea1 100644 --- a/code/modules/spells/targeted/shapeshift.dm +++ b/code/modules/spells/targeted/shapeshift.dm @@ -75,7 +75,7 @@ if(share_damage) var/transformer_max_health = transformer.get_max_health() var/damage = transformer.set_max_health(transformer_max_health-round(transformer_max_health*(transformer.get_health_ratio()))) - for(var/i in 1 to CEILING(damage/10)) + for(var/i in 1 to ceil(damage/10)) transformer.take_damage(10) if(target.mind) target.mind.transfer_to(transformer) diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm index 95445f2e47c..78f9c9cbfea 100644 --- a/code/modules/surgery/generic.dm +++ b/code/modules/surgery/generic.dm @@ -50,7 +50,7 @@ var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone) user.visible_message("[user] has made [access_string] on [target]'s [affected.name] with \the [tool].", \ "You have made [access_string] on [target]'s [affected.name] with \the [tool].",) - affected.createwound(CUT, CEILING(affected.min_broken_damage/2), TRUE) + affected.createwound(CUT, ceil(affected.min_broken_damage/2), TRUE) if(tool.atom_damage_type == BURN) affected.clamp_organ() playsound(target, 'sound/items/Welder.ogg', 15, 1) diff --git a/code/modules/synthesized_instruments/song_editor.dm b/code/modules/synthesized_instruments/song_editor.dm index 68bb358ec3c..bdab416d5fd 100644 --- a/code/modules/synthesized_instruments/song_editor.dm +++ b/code/modules/synthesized_instruments/song_editor.dm @@ -13,11 +13,11 @@ /datum/nano_module/song_editor/proc/pages() - return CEILING(src.song.lines.len / global.musical_config.song_editor_lines_per_page) + return ceil(src.song.lines.len / global.musical_config.song_editor_lines_per_page) /datum/nano_module/song_editor/proc/current_page() - return src.song.current_line > 0 ? CEILING(src.song.current_line / global.musical_config.song_editor_lines_per_page) : src.page + return src.song.current_line > 0 ? ceil(src.song.current_line / global.musical_config.song_editor_lines_per_page) : src.page /datum/nano_module/song_editor/proc/page_bounds(page_num) diff --git a/code/modules/tools/archetypes/tool_extension.dm b/code/modules/tools/archetypes/tool_extension.dm index e61e4314221..82d19f3934e 100644 --- a/code/modules/tools/archetypes/tool_extension.dm +++ b/code/modules/tools/archetypes/tool_extension.dm @@ -64,7 +64,7 @@ return LAZYACCESS(tool_use_sounds, archetype) || get_tool_property(archetype, TOOL_PROP_SOUND) || tool_archetype.tool_sound /datum/extension/tool/proc/get_expected_tool_use_delay(archetype, delay, mob/user, check_skill = SKILL_CONSTRUCTION) - . = CEILING(delay * get_tool_speed(archetype)) + . = ceil(delay * get_tool_speed(archetype)) if(user && check_skill) . *= user.skill_delay_mult(check_skill, 0.3) . = max(round(.), 5) diff --git a/code/modules/turbolift/turbolift_map.dm b/code/modules/turbolift/turbolift_map.dm index 7c411f5dca0..60bfb09ae82 100644 --- a/code/modules/turbolift/turbolift_map.dm +++ b/code/modules/turbolift/turbolift_map.dm @@ -76,7 +76,7 @@ INITIALIZE_IMMEDIATE(/obj/abstract/turbolift_spawner) if(NORTH) - int_panel_x = ux + FLOOR(lift_size_x/2) + int_panel_x = ux + floor(lift_size_x/2) int_panel_y = uy + 1 ext_panel_x = ux ext_panel_y = ey + 2 @@ -93,7 +93,7 @@ INITIALIZE_IMMEDIATE(/obj/abstract/turbolift_spawner) if(SOUTH) - int_panel_x = ux + FLOOR(lift_size_x/2) + int_panel_x = ux + floor(lift_size_x/2) int_panel_y = ey - 1 ext_panel_x = ex ext_panel_y = uy - 2 @@ -111,7 +111,7 @@ INITIALIZE_IMMEDIATE(/obj/abstract/turbolift_spawner) if(EAST) int_panel_x = ux+1 - int_panel_y = uy + FLOOR(lift_size_y/2) + int_panel_y = uy + floor(lift_size_y/2) ext_panel_x = ex+2 ext_panel_y = ey @@ -128,7 +128,7 @@ INITIALIZE_IMMEDIATE(/obj/abstract/turbolift_spawner) if(WEST) int_panel_x = ex-1 - int_panel_y = uy + FLOOR(lift_size_y/2) + int_panel_y = uy + floor(lift_size_y/2) ext_panel_x = ux-2 ext_panel_y = uy diff --git a/code/unit_tests/materials.dm b/code/unit_tests/materials.dm index afd6b31a586..27f46bbd25b 100644 --- a/code/unit_tests/materials.dm +++ b/code/unit_tests/materials.dm @@ -67,9 +67,9 @@ if(length(product_obj.matter)) failed = "unsupplied material types" else if(material && (product_obj.matter[material.type]) > recipe.req_amount) - failed = "excessive base material ([recipe.req_amount]/[CEILING(product_obj.matter[material.type])])" + failed = "excessive base material ([recipe.req_amount]/[ceil(product_obj.matter[material.type])])" else if(reinforced && (product_obj.matter[reinforced.type]) > recipe.req_amount) - failed = "excessive reinf material ([recipe.req_amount]/[CEILING(product_obj.matter[reinforced.type])])" + failed = "excessive reinf material ([recipe.req_amount]/[ceil(product_obj.matter[reinforced.type])])" else for(var/mat in product_obj.matter) if(mat != material?.type && mat != reinforced?.type) diff --git a/html/changelog.html b/html/changelog.html index 819476597af..cdde547893d 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -52,6 +52,12 @@ -->
+

11 August 2024

+

Penelope Haze updated:

+ +

09 August 2024

Penelope Haze updated:

diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml index 1d893a8d03e..b7bee7d2da7 100644 --- a/html/changelogs/.all_changelog.yml +++ b/html/changelogs/.all_changelog.yml @@ -14804,3 +14804,7 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py. Penelope Haze: - imageadd: added better compost bin sprites, based on those from Sunset Wasteland - imageadd: added produce bin sprites, modified from Sunset Wasteland's +2024-08-11: + Penelope Haze: + - tweak: Mortars (for grinding) are now capable of holding more than one item at + a time. diff --git a/html/changelogs/AutoChangeLog-pr-4267.yml b/html/changelogs/AutoChangeLog-pr-4267.yml new file mode 100644 index 00000000000..789365e75e7 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-4267.yml @@ -0,0 +1,4 @@ +author: NataKilar +changes: + - {tweak: Solid state reagents now behave mostly like solid state reagents.} +delete-after: true diff --git a/html/changelogs/AutoChangeLog-pr-4310.yml b/html/changelogs/AutoChangeLog-pr-4310.yml deleted file mode 100644 index 72c2f4c8fa1..00000000000 --- a/html/changelogs/AutoChangeLog-pr-4310.yml +++ /dev/null @@ -1,5 +0,0 @@ -author: Penelope Haze -changes: - - {tweak: Mortars (for grinding) are now capable of holding more than one item at - a time.} -delete-after: true diff --git a/html/changelogs/AutoChangeLog-pr-4328.yml b/html/changelogs/AutoChangeLog-pr-4328.yml new file mode 100644 index 00000000000..24c6dbe3f00 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-4328.yml @@ -0,0 +1,5 @@ +author: MistakeNot4892 +changes: + - {tweak: 'Blocking with a shield now uses close combat skill, and bucklers will + not survive forever.'} +delete-after: true diff --git a/maps/shaded_hills/jobs/visitors.dm b/maps/shaded_hills/jobs/visitors.dm index b126418ce55..24b40e60cd8 100644 --- a/maps/shaded_hills/jobs/visitors.dm +++ b/maps/shaded_hills/jobs/visitors.dm @@ -49,17 +49,20 @@ total_positions = 2 outfit_type = /decl/hierarchy/outfit/job/shaded_hills/beggar_knight min_skill = list( + SKILL_COMBAT = SKILL_ADEPT, SKILL_WEAPONS = SKILL_ADEPT, - SKILL_ATHLETICS = SKILL_ADEPT, + SKILL_ATHLETICS = SKILL_ADEPT ) max_skill = list( - SKILL_FINANCE = SKILL_NONE, + SKILL_COMBAT = SKILL_MAX, + SKILL_WEAPONS = SKILL_MAX, SKILL_CARPENTRY = SKILL_BASIC, SKILL_METALWORK = SKILL_BASIC, SKILL_TEXTILES = SKILL_BASIC, SKILL_STONEMASONRY = SKILL_BASIC, SKILL_SCULPTING = SKILL_BASIC, SKILL_ARTIFICE = SKILL_BASIC, + SKILL_FINANCE = SKILL_NONE ) /obj/abstract/landmark/start/shaded_hills/beggar_knight @@ -74,15 +77,17 @@ total_positions = 2 outfit_type = /decl/hierarchy/outfit/job/shaded_hills/traveller/cleric min_skill = list( + SKILL_COMBAT = SKILL_ADEPT, SKILL_WEAPONS = SKILL_ADEPT, SKILL_ATHLETICS = SKILL_ADEPT, SKILL_MEDICAL = SKILL_ADEPT, - SKILL_ANATOMY = SKILL_ADEPT, + SKILL_ANATOMY = SKILL_ADEPT ) max_skill = list( + SKILL_COMBAT = SKILL_MAX, SKILL_WEAPONS = SKILL_MAX, SKILL_MEDICAL = SKILL_MAX, - SKILL_ANATOMY = SKILL_MAX, + SKILL_ANATOMY = SKILL_MAX ) skill_points = 22 diff --git a/maps/shaded_hills/shaded_hills-inn.dmm b/maps/shaded_hills/shaded_hills-inn.dmm index a6c2610a6ca..022abf8b760 100644 --- a/maps/shaded_hills/shaded_hills-inn.dmm +++ b/maps/shaded_hills/shaded_hills-inn.dmm @@ -1136,6 +1136,10 @@ "Rl" = ( /turf/floor/natural/mud, /area/shaded_hills/outside/downlands) +"Rz" = ( +/obj/effect/departure_signpost/east, +/turf/floor/natural/dirt, +/area/shaded_hills/outside/downlands) "RC" = ( /obj/structure/railing/mapped/wooden/walnut, /turf/floor/natural/grass, @@ -22945,7 +22949,7 @@ HI HI HI TR -TR +Rz EV Gq Ic diff --git a/maps/shaded_hills/shaded_hills-woods.dmm b/maps/shaded_hills/shaded_hills-woods.dmm index 3f266a6434c..f5f3aa3f0d2 100644 --- a/maps/shaded_hills/shaded_hills-woods.dmm +++ b/maps/shaded_hills/shaded_hills-woods.dmm @@ -181,6 +181,10 @@ /obj/structure/table/woodentable/ebony, /turf/floor/wood/walnut, /area/shaded_hills/forester_hut) +"Uz" = ( +/obj/effect/departure_signpost/north, +/turf/floor/natural/dirt, +/area/shaded_hills/outside/woods) "VA" = ( /obj/abstract/landmark/start/shaded_hills/traveller, /turf/floor/natural/path/basalt, @@ -1740,7 +1744,7 @@ lC lC lC YB -lU +Uz HA HA HA diff --git a/maps/~mapsystem/maps_currency.dm b/maps/~mapsystem/maps_currency.dm index f3169147c27..e83f0c01093 100644 --- a/maps/~mapsystem/maps_currency.dm +++ b/maps/~mapsystem/maps_currency.dm @@ -18,7 +18,7 @@ var/obj/item/charge_stick/credstick = new credstick.creator = owner.real_name credstick.currency = owner_account.currency - credstick.loaded_worth = min(credstick.max_worth, FLOOR(owner_account.money * transfer_mult)) + credstick.loaded_worth = min(credstick.max_worth, floor(owner_account.money * transfer_mult)) owner_account.money -= credstick.loaded_worth return list(credstick) @@ -34,7 +34,7 @@ /decl/starting_cash_choice/cash/get_cash_objects(var/mob/living/human/owner, var/datum/money_account/owner_account) var/obj/item/cash/cash = new cash.set_currency(owner_account.currency) - cash.adjust_worth(FLOOR(owner_account.money * transfer_mult)) + cash.adjust_worth(floor(owner_account.money * transfer_mult)) owner_account.money -= cash.absolute_worth return list(cash) @@ -52,12 +52,12 @@ . = list() var/obj/item/cash/cash = new cash.set_currency(owner_account.currency) - cash.adjust_worth(FLOOR(owner_account.money * transfer_mult)) + cash.adjust_worth(floor(owner_account.money * transfer_mult)) . += cash var/obj/item/charge_stick/credstick = new credstick.creator = owner.real_name credstick.currency = owner_account.currency - credstick.loaded_worth = min(credstick.max_worth, FLOOR(owner_account.money * transfer_mult)) + credstick.loaded_worth = min(credstick.max_worth, floor(owner_account.money * transfer_mult)) . += credstick owner_account.money -= cash.absolute_worth owner_account.money -= credstick.loaded_worth diff --git a/mods/content/fantasy/_fantasy.dme b/mods/content/fantasy/_fantasy.dme index e6fdf59a879..16545f73799 100644 --- a/mods/content/fantasy/_fantasy.dme +++ b/mods/content/fantasy/_fantasy.dme @@ -30,5 +30,6 @@ #include "items\clothing\loincloth.dm" #include "items\clothing\overrides.dm" #include "items\clothing\trousers.dm" +#include "props\signpost.dm" // END_INCLUDE #endif diff --git a/mods/content/fantasy/icons/structures/signpost.dmi b/mods/content/fantasy/icons/structures/signpost.dmi new file mode 100644 index 00000000000..377e82ef5f5 Binary files /dev/null and b/mods/content/fantasy/icons/structures/signpost.dmi differ diff --git a/mods/content/fantasy/props/signpost.dm b/mods/content/fantasy/props/signpost.dm new file mode 100644 index 00000000000..328a37b986b --- /dev/null +++ b/mods/content/fantasy/props/signpost.dm @@ -0,0 +1,67 @@ +/obj/effect/departure_signpost + name = "border post" + desc = "A tall lamplit signpost marking the edge of the region. Beyond lies distant kingdoms." + icon = 'mods/content/fantasy/icons/structures/signpost.dmi' + icon_state = ICON_STATE_WORLD + color = /decl/material/solid/organic/wood/walnut::color + density = TRUE + opacity = FALSE + anchored = TRUE + simulated = FALSE + pixel_z = 12 + + var/lit_light_power = /obj/item/flame/fuelled/lantern::lit_light_power + var/lit_light_range = /obj/item/flame/fuelled/lantern::lit_light_range + var/lit_light_color = /obj/item/flame/fuelled/lantern::lit_light_color + +/obj/effect/departure_signpost/Initialize() + . = ..() + set_light(lit_light_range, lit_light_power, lit_light_color) + update_icon() + +/obj/effect/departure_signpost/on_update_icon() + . = ..() + add_overlay(overlay_image(icon, "[icon_state]-lamp", /decl/material/solid/metal/copper::color, RESET_COLOR)) + var/image/glow = emissive_overlay(icon, "[icon_state]-lamp-glow", color = lit_light_color) + glow.appearance_flags |= RESET_COLOR + add_overlay(glow) + +/obj/effect/departure_signpost/attackby(obj/item/used_item, mob/user) + SHOULD_CALL_PARENT(FALSE) + return TRUE + +/obj/effect/departure_signpost/attack_hand(mob/user) + SHOULD_CALL_PARENT(FALSE) + var/choice = alert(user, "Are you sure you wish to depart? This will permanently remove your character from the round.", "Venture Forth?", "No", "Yes") + if(choice != "Yes" || QDELETED(user) || user.incapacitated() || QDELETED(src) || !user.Adjacent(src)) + return TRUE + var/obj/effect/dummy/fadeout = new(get_turf(user)) + fadeout.set_dir(dir) + fadeout.appearance = user // grab appearance before ghostizing in case they fall over etc + switch(dir) + if(NORTH) + animate(fadeout, pixel_z = 32, alpha = 0, time = 1 SECOND) + if(SOUTH) + animate(fadeout, pixel_z = -32, alpha = 0, time = 1 SECOND) + if(EAST) + animate(fadeout, pixel_w = 32, alpha = 0, time = 1 SECOND) + if(WEST) + animate(fadeout, pixel_w = -32, alpha = 0, time = 1 SECOND) + else + animate(fadeout, alpha = 0, time = 1 SECOND) + QDEL_IN(fadeout, 1 SECOND) + despawn_character(user) + return TRUE + +// Premade types for mapping. +/obj/effect/departure_signpost/north + dir = NORTH + +/obj/effect/departure_signpost/south + dir = SOUTH + +/obj/effect/departure_signpost/east + dir = EAST + +/obj/effect/departure_signpost/west + dir = WEST diff --git a/mods/content/psionics/items/implant.dm b/mods/content/psionics/items/implant.dm index d80839f176e..e4a7bece611 100644 --- a/mods/content/psionics/items/implant.dm +++ b/mods/content/psionics/items/implant.dm @@ -73,7 +73,7 @@ // If we're disrupting psionic attempts at the moment, we might overload. if(disrupts_psionics()) - var/overload_amount = FLOOR(stress/10) + var/overload_amount = floor(stress/10) if(overload_amount > 0) overload += overload_amount if(overload >= max_overload) diff --git a/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm b/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm index bf810cba7f9..0519216447d 100644 --- a/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm +++ b/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm @@ -42,7 +42,7 @@ if(isnull(check_incapacitated)) check_incapacitated = (INCAPACITATION_STUNNED|INCAPACITATION_KNOCKOUT) if(can_use(check_incapacitated)) - value = max(1, CEILING(value * cost_modifier)) + value = max(1, ceil(value * cost_modifier)) if(value <= stamina) stamina -= value ui.update_icon() diff --git a/mods/content/psionics/system/psionics/complexus/complexus_process.dm b/mods/content/psionics/system/psionics/complexus/complexus_process.dm index 13c6b7492a9..d8a3a2a3f5c 100644 --- a/mods/content/psionics/system/psionics/complexus/complexus_process.dm +++ b/mods/content/psionics/system/psionics/complexus/complexus_process.dm @@ -21,7 +21,7 @@ UNSETEMPTY(latencies) var/rank_count = max(1, LAZYLEN(ranks)) - if(force || last_rating != CEILING(combined_rank/rank_count)) + if(force || last_rating != ceil(combined_rank/rank_count)) if(highest_rank <= 1) if(highest_rank == 0) qdel(src) @@ -29,7 +29,7 @@ else rebuild_power_cache = TRUE sound_to(owner, 'sound/effects/psi/power_unlock.ogg') - rating = CEILING(combined_rank/rank_count) + rating = ceil(combined_rank/rank_count) cost_modifier = 1 if(rating > 1) cost_modifier -= min(1, max(0.1, (rating-1) / 10)) @@ -74,7 +74,7 @@ var/update_hud if(armor_cost) - var/value = max(1, CEILING(armor_cost * cost_modifier)) + var/value = max(1, ceil(armor_cost * cost_modifier)) if(value <= stamina) stamina -= value else diff --git a/mods/content/psionics/system/psionics/mob/mob.dm b/mods/content/psionics/system/psionics/mob/mob.dm index e51d5aeedae..0fb2b21df35 100644 --- a/mods/content/psionics/system/psionics/mob/mob.dm +++ b/mods/content/psionics/system/psionics/mob/mob.dm @@ -33,7 +33,7 @@ var/obj/item/projectile/P = damage_source var/datum/ability_handler/psionics/psi = get_ability_handler(/datum/ability_handler/psionics) if(istype(P) && !P.disrupts_psionics() && psi && P.starting && prob(psi.get_armour(SSmaterials.get_armor_key(P.atom_damage_type, P.damage_flags())) * 0.5) && psi.spend_power(round(damage/10))) - visible_message("\The [src] deflects [attack_text]!") + visible_message(SPAN_DANGER("\The [src] deflects [isatom(attack_text) ? "\the [attack_text]" : attack_text]!")) P.redirect(P.starting.x + rand(-2,2), P.starting.y + rand(-2,2), get_turf(src), src) return PROJECTILE_FORCE_MISS . = ..() diff --git a/mods/content/xenobiology/slime/feeding.dm b/mods/content/xenobiology/slime/feeding.dm index 48b7fdd01bc..fff739f7369 100644 --- a/mods/content/xenobiology/slime/feeding.dm +++ b/mods/content/xenobiology/slime/feeding.dm @@ -100,7 +100,7 @@ ate_victim = TRUE if(drained) gain_nutrition(drained) - var/heal_amt = FLOOR(drained*0.5) + var/heal_amt = floor(drained*0.5) if(heal_amt > 0) heal_damage(OXY, heal_amt, do_update_health = FALSE) heal_damage(BRUTE, heal_amt, do_update_health = FALSE) diff --git a/mods/mobs/dionaea/mob/nymph_attacks.dm b/mods/mobs/dionaea/mob/nymph_attacks.dm index 6ce80750d19..fdfce5f87cb 100644 --- a/mods/mobs/dionaea/mob/nymph_attacks.dm +++ b/mods/mobs/dionaea/mob/nymph_attacks.dm @@ -83,7 +83,7 @@ return TRUE if(tray.waterlevel < 100) - var/nutrition_cost = FLOOR((100-tray.nutrilevel)/10) * 5 + var/nutrition_cost = floor((100-tray.nutrilevel)/10) * 5 if(nutrition >= nutrition_cost) visible_message(SPAN_NOTICE("\The [src] secretes a trickle of clear liquid, refilling [tray]."),SPAN_NOTICE("You secrete some water into \the [tray].")) tray.waterlevel = 100 diff --git a/mods/mobs/dionaea/mob/nymph_life.dm b/mods/mobs/dionaea/mob/nymph_life.dm index f81006029a8..20cc36480db 100644 --- a/mods/mobs/dionaea/mob/nymph_life.dm +++ b/mods/mobs/dionaea/mob/nymph_life.dm @@ -22,7 +22,7 @@ set_light((5 * mult), mult, "#55ff55") last_glow = mult - set_nutrition(clamp(nutrition + FLOOR(radiation/100) + light_amount, 0, 500)) + set_nutrition(clamp(nutrition + floor(radiation/100) + light_amount, 0, 500)) if(radiation >= 50 || light_amount > 2) //if there's enough light, heal var/update_health = FALSE diff --git a/mods/species/ascent/items/guns.dm b/mods/species/ascent/items/guns.dm index 3ca058e0f93..17ed497b0d8 100644 --- a/mods/species/ascent/items/guns.dm +++ b/mods/species/ascent/items/guns.dm @@ -46,7 +46,7 @@ var/datum/firemode/current_mode = firemodes[sel_mode] set_overlays(list( "[get_world_inventory_state()]-[istype(current_mode) ? current_mode.name : "lethal"]", - "[get_world_inventory_state()]-charge-[istype(power_supply) ? FLOOR(power_supply.percent()/20) : 0]" + "[get_world_inventory_state()]-charge-[istype(power_supply) ? floor(power_supply.percent()/20) : 0]" )) /obj/item/gun/magnetic/railgun/flechette/ascent @@ -62,7 +62,7 @@ /obj/item/gun/magnetic/railgun/flechette/ascent/show_ammo(var/mob/user) var/obj/item/cell/cell = get_cell() - to_chat(user, "There are [cell ? FLOOR(cell.charge/charge_per_shot) : 0] shot\s remaining.") + to_chat(user, "There are [cell ? floor(cell.charge/charge_per_shot) : 0] shot\s remaining.") /obj/item/gun/magnetic/railgun/flechette/ascent/check_ammo() var/obj/item/cell/cell = get_cell() diff --git a/mods/species/vox/organs_vox.dm b/mods/species/vox/organs_vox.dm index 33230c896f8..ebc0f3cbaed 100644 --- a/mods/species/vox/organs_vox.dm +++ b/mods/species/vox/organs_vox.dm @@ -109,7 +109,7 @@ // Process it. if(can_digest_matter[mat]) - owner.adjust_nutrition(max(1, FLOOR(digested/100))) + owner.adjust_nutrition(max(1, floor(digested/100))) updated_stacks = TRUE else if(can_process_matter[mat]) LAZYDISTINCTADD(check_materials, mat) @@ -121,7 +121,7 @@ if(M && stored_matter[mat] >= SHEET_MATERIAL_AMOUNT) // Remove as many sheets as possible from the gizzard. - var/sheets = FLOOR(stored_matter[mat]/SHEET_MATERIAL_AMOUNT) + var/sheets = floor(stored_matter[mat]/SHEET_MATERIAL_AMOUNT) stored_matter[mat] -= SHEET_MATERIAL_AMOUNT * sheets if(stored_matter[mat] <= 0) stored_matter -= mat