diff --git a/code/__DEFINES/_math.dm b/code/__DEFINES/_math.dm index cb0265ecc332..0f471ec70bad 100644 --- a/code/__DEFINES/_math.dm +++ b/code/__DEFINES/_math.dm @@ -12,9 +12,7 @@ #define LEFT 1 #define RIGHT 2 -#define CEILING(x, y) ( -round(-(x) / (y)) * (y) ) - -#define ROUND_UP(x) ( -round(-(x))) +#define CEILING(x, y) ( ceil((x) / (y)) * (y) ) // round() acts like floor(x, 1) by default but can't handle other values #define FLOOR(x, y) ( floor((x) / (y)) * (y) ) diff --git a/code/__HELPERS/#maths.dm b/code/__HELPERS/#maths.dm index a9b7a527d6cf..171988d0ddae 100644 --- a/code/__HELPERS/#maths.dm +++ b/code/__HELPERS/#maths.dm @@ -8,7 +8,6 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, // MATH DEFINES -#define Ceiling(x) (-round(-(x))) #define CLAMP01(x) (clamp((x), 0, 1)) // cotangent diff --git a/code/__HELPERS/_time.dm b/code/__HELPERS/_time.dm index 4caabf0ede3a..5ed4fbcb7d84 100644 --- a/code/__HELPERS/_time.dm +++ b/code/__HELPERS/_time.dm @@ -48,7 +48,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) return gameTimestamp("mm:ss", time) /proc/time_left_until(target_time, current_time, time_unit) - return Ceiling(target_time - current_time) / time_unit + return ceil(target_time - current_time) / time_unit /proc/text2duration(text = "00:00") // Attempts to convert time text back to time value var/split_text = splittext(text, ":") diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 7e4c5676c8d1..ab77ee753e31 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1059,7 +1059,7 @@ GLOBAL_DATUM(action_purple_power_up, /image) var/cur_user_zone_sel = busy_user.zone_selected var/cur_target_zone_sel - var/delayfraction = Ceiling(delay/numticks) + var/delayfraction = ceil(delay/numticks) var/user_orig_loc = busy_user.loc var/user_orig_turf = get_turf(busy_user) var/target_orig_loc @@ -1561,7 +1561,7 @@ GLOBAL_LIST_INIT(WALLITEMS, list( . = 0 var/i = DS2TICKS(initial_delay) do - . += Ceiling(i*DELTA_CALC) + . += ceil(i*DELTA_CALC) sleep(i*world.tick_lag*DELTA_CALC) i *= 2 while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit)) @@ -1664,7 +1664,7 @@ GLOBAL_LIST_INIT(WALLITEMS, list( // Redistribute the net displacement evenly on the side of the center line that needs it // Only half the points are gonna be affected. - var/to_redistribute = abs(Ceiling(net_displacement / (variances.len/2))) + var/to_redistribute = abs(ceil(net_displacement / (variances.len/2))) for(var/i in 1 to variances.len) if(!net_displacement) break diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index 47403f3379fb..069c9f50089b 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -583,7 +583,7 @@ SUBSYSTEM_DEF(timer) be supported and may refuse to run or run with a 0 wait") if (flags & TIMER_CLIENT_TIME) // REALTIMEOFDAY has a resolution of 1 decisecond - wait = max(Ceiling(wait), 1) // so if we use tick_lag timers may be inserted in the "past" + wait = max(ceil(wait), 1) // so if we use tick_lag timers may be inserted in the "past" else wait = max(CEILING(wait, world.tick_lag), world.tick_lag) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index 08b5ea9f9a64..3eb3e4eb46e8 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -125,11 +125,11 @@ //Position the effect so the beam is one continous line var/a if(abs(Pixel_x)>world.icon_size) - a = Pixel_x > 0 ? round(Pixel_x/32) : Ceiling(Pixel_x/world.icon_size) + a = Pixel_x > 0 ? round(Pixel_x/32) : ceil(Pixel_x/world.icon_size) X.x += a Pixel_x %= world.icon_size if(abs(Pixel_y)>world.icon_size) - a = Pixel_y > 0 ? round(Pixel_y/32) : Ceiling(Pixel_y/world.icon_size) + a = Pixel_y > 0 ? round(Pixel_y/32) : ceil(Pixel_y/world.icon_size) X.y += a Pixel_y %= world.icon_size diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 2868899dee3f..ddcf3364604c 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -340,7 +340,7 @@ turn_off() range = clamp(CEILING(new_range, 0.5), 1, 7) var/pixel_bounds = ((range - 1) * 64) + 32 - lumcount_range = Ceiling(range) + lumcount_range = ceil(range) if(current_holder && overlay_lighting_flags & LIGHTING_ON) current_holder.underlays -= visible_mask visible_mask.icon = light_overlays["[pixel_bounds]"] diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index 8b84513169e6..6ccbaa66e7de 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -205,7 +205,7 @@ GLOBAL_LIST_INIT(advance_cures, list( hidden = list( (properties["stealth"] > 2), (properties["stealth"] > 3) ) // The more symptoms we have, the less transmittable it is but some symptoms can make up for it. SetSpread(clamp(properties["transmittable"] - symptoms.len, BLOOD, AIRBORNE)) - permeability_mod = max(Ceiling(0.4 * properties["transmittable"]), 1) + permeability_mod = max(ceil(0.4 * properties["transmittable"]), 1) cure_chance = 15 - clamp(properties["resistance"], -5, 5) // can be between 10 and 20 stage_prob = max(properties["stage_rate"], 2) SetSeverity(properties["severity"]) diff --git a/code/game/objects/items/devices/motion_detector.dm b/code/game/objects/items/devices/motion_detector.dm index 7db2825deedf..d76d2e73af33 100644 --- a/code/game/objects/items/devices/motion_detector.dm +++ b/code/game/objects/items/devices/motion_detector.dm @@ -270,9 +270,9 @@ var/view_y_offset = 0 if(c_view > 7) if(user.client.pixel_x >= 0) view_x_offset = round(user.client.pixel_x/32) - else view_x_offset = Ceiling(user.client.pixel_x/32) + else view_x_offset = ceil(user.client.pixel_x/32) if(user.client.pixel_y >= 0) view_y_offset = round(user.client.pixel_y/32) - else view_y_offset = Ceiling(user.client.pixel_y/32) + else view_y_offset = ceil(user.client.pixel_y/32) var/diff_dir_x = 0 var/diff_dir_y = 0 diff --git a/code/game/objects/items/reagent_containers/food/sandwich.dm b/code/game/objects/items/reagent_containers/food/sandwich.dm index b3f68bd299a9..9370b643fc98 100644 --- a/code/game/objects/items/reagent_containers/food/sandwich.dm +++ b/code/game/objects/items/reagent_containers/food/sandwich.dm @@ -74,7 +74,7 @@ name = lowertext("[fullname] sandwich") if(length(name) > 80) name = "[pick(list("absurd","colossal","enormous","ridiculous"))] sandwich" - w_class = Ceiling(clamp((ingredients.len/2),1,3)) + w_class = ceil(clamp((ingredients.len/2),1,3)) /obj/item/reagent_container/food/snacks/csandwich/Destroy() QDEL_NULL_LIST(ingredients) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 6742e8b31700..93fe78e63d98 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -127,7 +127,7 @@ var/obj/item/explosive/plastic/P = I if(P.active) continue - var/item_size = Ceiling(I.w_class / 2) + var/item_size = ceil(I.w_class / 2) if(stored_units + item_size > storage_capacity) continue if(!I.anchored) diff --git a/code/game/turfs/walls/wall_types.dm b/code/game/turfs/walls/wall_types.dm index 7b26854737cc..21839d35af03 100644 --- a/code/game/turfs/walls/wall_types.dm +++ b/code/game/turfs/walls/wall_types.dm @@ -1036,7 +1036,7 @@ INITIALIZE_IMMEDIATE(/turf/closed/wall/indestructible/splashscreen) SPAN_XENONOTICE("You claw \the [src].")) playsound(src, "alien_resin_break", 25) if (M.hivenumber == hivenumber) - take_damage(Ceiling(HEALTH_WALL_XENO * 0.25)) //Four hits for a regular wall + take_damage(ceil(HEALTH_WALL_XENO * 0.25)) //Four hits for a regular wall else take_damage(M.melee_damage_lower*RESIN_XENO_DAMAGE_MULTIPLIER) return XENO_ATTACK_ACTION @@ -1252,7 +1252,7 @@ INITIALIZE_IMMEDIATE(/turf/closed/wall/indestructible/splashscreen) SPAN_XENONOTICE("We claw \the [src].")) playsound(src, "alien_resin_break", 25) if (M.hivenumber == hivenumber) - take_damage(Ceiling(HEALTH_WALL_XENO * 0.25)) //Four hits for a regular wall + take_damage(ceil(HEALTH_WALL_XENO * 0.25)) //Four hits for a regular wall else take_damage(M.melee_damage_lower*RESIN_XENO_DAMAGE_MULTIPLIER) return XENO_ATTACK_ACTION diff --git a/code/modules/clans/client.dm b/code/modules/clans/client.dm index 3450b7553c51..6e3e728fb1ee 100644 --- a/code/modules/clans/client.dm +++ b/code/modules/clans/client.dm @@ -440,7 +440,7 @@ return if(CLAN_LIMIT_SIZE) var/list/datum/view_record/clan_playerbase_view/clan_players = DB_VIEW(/datum/view_record/clan_playerbase_view/, DB_COMP("clan_id", DB_EQUALS, target.clan_id)) - var/available_slots = Ceiling(clan_players.len / chosen_rank.limit) + var/available_slots = ceil(clan_players.len / chosen_rank.limit) if(players_in_rank >= available_slots) to_chat(src, SPAN_DANGER("This slot is full! (Maximum of [chosen_rank.limit] per player in the clan, currently [available_slots])")) diff --git a/code/modules/cm_tech/techs/marine/tier4/nuke.dm b/code/modules/cm_tech/techs/marine/tier4/nuke.dm index 139fefef570c..794e61949320 100644 --- a/code/modules/cm_tech/techs/marine/tier4/nuke.dm +++ b/code/modules/cm_tech/techs/marine/tier4/nuke.dm @@ -36,10 +36,10 @@ return if(ROUND_TIME < NUKE_UNLOCK_TIME) - to_chat(unlocking_mob, SPAN_WARNING("You cannot purchase this node before [Ceiling((NUKE_UNLOCK_TIME + SSticker.round_start_time) / (1 MINUTES))] minutes into the operation.")) + to_chat(unlocking_mob, SPAN_WARNING("You cannot purchase this node before [ceil((NUKE_UNLOCK_TIME + SSticker.round_start_time) / (1 MINUTES))] minutes into the operation.")) return FALSE return TRUE /datum/tech/nuke/proc/handle_description() - desc = "Purchase a nuclear device. Only purchasable [Ceiling((NUKE_UNLOCK_TIME + SSticker.round_start_time) / (1 MINUTES))] minutes into the operation. It's the only way to be sure." + desc = "Purchase a nuclear device. Only purchasable [ceil((NUKE_UNLOCK_TIME + SSticker.round_start_time) / (1 MINUTES))] minutes into the operation. It's the only way to be sure." diff --git a/code/modules/cm_tech/techtree.dm b/code/modules/cm_tech/techtree.dm index d272c19ab5cf..689600fcc5f2 100644 --- a/code/modules/cm_tech/techtree.dm +++ b/code/modules/cm_tech/techtree.dm @@ -94,7 +94,7 @@ y_offset += 3 - entrance = locate(Ceiling((longest_tier*2 + 1)*0.5), 2, zlevel.z_value) + entrance = locate(ceil((longest_tier*2 + 1)*0.5), 2, zlevel.z_value) /datum/techtree/ui_status(mob/user, datum/ui_state/state) . = ..() diff --git a/code/modules/lighting/lighting_mask/shadow_calculator.dm b/code/modules/lighting/lighting_mask/shadow_calculator.dm index cfd4a86f5f3a..480b4d534fbb 100644 --- a/code/modules/lighting/lighting_mask/shadow_calculator.dm +++ b/code/modules/lighting/lighting_mask/shadow_calculator.dm @@ -95,7 +95,7 @@ SSlighting.total_shadow_calculations ++ //Ceiling the range since we need it in integer form - var/range = Ceiling(radius) + var/range = ceil(radius) DO_SOMETHING_IF_DEBUGGING_SHADOWS(var/timer = TICK_USAGE) //Work out our position diff --git a/code/modules/lighting/lighting_static/static_lighting_source.dm b/code/modules/lighting/lighting_static/static_lighting_source.dm index 26bc41d3cb02..872f37bce24d 100644 --- a/code/modules/lighting/lighting_static/static_lighting_source.dm +++ b/code/modules/lighting/lighting_static/static_lighting_source.dm @@ -223,8 +223,8 @@ var/list/turf/turfs = list() if (source_turf) var/oldlum = source_turf.luminosity - source_turf.luminosity = Ceiling(light_range) - for(var/turf/T in view(Ceiling(light_range), source_turf)) + source_turf.luminosity = ceil(light_range) + for(var/turf/T in view(ceil(light_range), source_turf)) if(!IS_OPAQUE_TURF(T)) if (!T.lighting_corners_initialised) T.static_generate_missing_corners() diff --git a/code/modules/mapping/reader.dm b/code/modules/mapping/reader.dm index 6b4675e3bade..95e75d2d487e 100644 --- a/code/modules/mapping/reader.dm +++ b/code/modules/mapping/reader.dm @@ -609,7 +609,7 @@ // We're gonna skip all the entries above the upper x, or maxx if cropMap is set var/x_target = line_len - key_len + 1 - var/x_step_count = ROUND_UP(x_target / key_len) + var/x_step_count = ceil(x_target / key_len) var/final_x = relative_x + (x_step_count - 1) var/x_delta_with = x_upper if(crop_map) diff --git a/code/modules/mob/living/carbon/xenomorph/hive_status.dm b/code/modules/mob/living/carbon/xenomorph/hive_status.dm index 19416e7af0aa..5b932550edc8 100644 --- a/code/modules/mob/living/carbon/xenomorph/hive_status.dm +++ b/code/modules/mob/living/carbon/xenomorph/hive_status.dm @@ -601,10 +601,10 @@ effective_total++ // Tier 3 slots are always 20% of the total xenos in the hive - slots[TIER_3][OPEN_SLOTS] = max(0, Ceiling(0.20*effective_total/tier_slot_multiplier) - used_tier_3_slots) + slots[TIER_3][OPEN_SLOTS] = max(0, ceil(0.20*effective_total/tier_slot_multiplier) - used_tier_3_slots) // Tier 2 slots are between 30% and 50% of the hive, depending // on how many T3s there are. - slots[TIER_2][OPEN_SLOTS] = max(0, Ceiling(0.5*effective_total/tier_slot_multiplier) - used_tier_2_slots - used_tier_3_slots) + slots[TIER_2][OPEN_SLOTS] = max(0, ceil(0.5*effective_total/tier_slot_multiplier) - used_tier_2_slots - used_tier_3_slots) return slots @@ -726,7 +726,7 @@ if(is_mainship_level(turf?.z)) shipside_humans_weighted_count += GLOB.RoleAuthority.calculate_role_weight(job) hijack_burrowed_surge = TRUE - hijack_burrowed_left = max(Ceiling(shipside_humans_weighted_count * 0.5) - xenos_count, 5) + hijack_burrowed_left = max(ceil(shipside_humans_weighted_count * 0.5) - xenos_count, 5) hivecore_cooldown = FALSE xeno_message(SPAN_XENOBOLDNOTICE("The weeds have recovered! A new hive core can be built!"),3,hivenumber) diff --git a/code/modules/mob/living/carbon/xenomorph/life.dm b/code/modules/mob/living/carbon/xenomorph/life.dm index 45d0d53a040a..a231ab817d9e 100644 --- a/code/modules/mob/living/carbon/xenomorph/life.dm +++ b/code/modules/mob/living/carbon/xenomorph/life.dm @@ -251,7 +251,7 @@ hud_used.alien_armor_display.icon_state = "armor_00" return TRUE - var/severity = HUD_PAIN_STATES_XENO - Ceiling(((max(health, 0) / maxHealth) * HUD_PAIN_STATES_XENO)) + var/severity = HUD_PAIN_STATES_XENO - ceil(((max(health, 0) / maxHealth) * HUD_PAIN_STATES_XENO)) if(severity) overlay_fullscreen("xeno_pain", /atom/movable/screen/fullscreen/xeno_pain, severity) else @@ -271,7 +271,7 @@ return TRUE if(hud_used.healths) - var/health_stacks = Ceiling((health / maxHealth) * HUD_HEALTH_STATES_XENO) + var/health_stacks = ceil((health / maxHealth) * HUD_HEALTH_STATES_XENO) hud_used.healths.icon_state = "health_[health_stacks]" if(health_stacks >= HUD_HEALTH_STATES_XENO) hud_used.healths.icon_state = "health_full" @@ -283,7 +283,7 @@ hud_used.alien_plasma_display.icon_state = "power_display_empty" else var/plasma_stacks = (get_plasma_percentage() * 0.01) * HUD_PLASMA_STATES_XENO - hud_used.alien_plasma_display.icon_state = "power_display_[Ceiling(plasma_stacks)]" + hud_used.alien_plasma_display.icon_state = "power_display_[ceil(plasma_stacks)]" if(plasma_stacks >= HUD_PLASMA_STATES_XENO) hud_used.alien_plasma_display.icon_state = "power_display_full" else if(plasma_stacks <= 0) diff --git a/code/modules/mob/living/carbon/xenomorph/update_icons.dm b/code/modules/mob/living/carbon/xenomorph/update_icons.dm index ac0c381f5ed4..3d3dc2133e63 100644 --- a/code/modules/mob/living/carbon/xenomorph/update_icons.dm +++ b/code/modules/mob/living/carbon/xenomorph/update_icons.dm @@ -327,7 +327,7 @@ return var/health_threshold - health_threshold = max(Ceiling((health * 4) / (maxHealth)), 0) //From 0 to 4, in 25% chunks + health_threshold = max(ceil((health * 4) / (maxHealth)), 0) //From 0 to 4, in 25% chunks if(health > HEALTH_THRESHOLD_DEAD) if(health_threshold > 3) wound_icon_holder.icon_state = "none" diff --git a/code/modules/mob/living/living_health_procs.dm b/code/modules/mob/living/living_health_procs.dm index 986d8740f11f..15cd243d6818 100644 --- a/code/modules/mob/living/living_health_procs.dm +++ b/code/modules/mob/living/living_health_procs.dm @@ -410,7 +410,7 @@ switch(client.prefs?.pain_overlay_pref_level) if(PAIN_OVERLAY_IMPAIR) - overlay_fullscreen("eye_blur", /atom/movable/screen/fullscreen/impaired, Ceiling(clamp(eye_blurry * 0.3, 1, 6))) + overlay_fullscreen("eye_blur", /atom/movable/screen/fullscreen/impaired, ceil(clamp(eye_blurry * 0.3, 1, 6))) if(PAIN_OVERLAY_LEGACY) overlay_fullscreen("eye_blur", /atom/movable/screen/fullscreen/blurry) else // PAIN_OVERLAY_BLURRY diff --git a/code/modules/mob/living/simple_animal/hostile/alien.dm b/code/modules/mob/living/simple_animal/hostile/alien.dm index ba7bf741f6c0..3f9a51355292 100644 --- a/code/modules/mob/living/simple_animal/hostile/alien.dm +++ b/code/modules/mob/living/simple_animal/hostile/alien.dm @@ -110,7 +110,7 @@ wound_icon_holder.layer = layer + 0.01 wound_icon_holder.dir = dir - var/health_threshold = max(Ceiling((health * 4) / (maxHealth)), 0) //From 0 to 4, in 25% chunks + var/health_threshold = max(ceil((health * 4) / (maxHealth)), 0) //From 0 to 4, in 25% chunks if(health > HEALTH_THRESHOLD_DEAD) if(health_threshold > 3) wound_icon_holder.icon_state = "none" diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index db6f9c120591..8c41e1149f35 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -224,7 +224,7 @@ GLOBAL_LIST_INIT(limb_types_by_name, list( if(strength < 1) return phrase else - strength = Ceiling(strength/5) + strength = ceil(strength/5) var/list/split_phrase = text2list(phrase," ") //Split it up into words. var/list/unstuttered_words = split_phrase.Copy() diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index dd7f008e47d2..42576bdeccd4 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -442,7 +442,7 @@ for(var/datum/chem_property/P in creation_template) creation_cost += max(abs(P.value), 1) * P.level if(P.level > 5) // a penalty is added at each level above 5 (+1 at 6, +2 at 7, +4 at 8, +5 at 9, +7 at 10) - creation_cost += P.level - 6 + Ceiling((P.level - 5) / 2) + creation_cost += P.level - 6 + ceil((P.level - 5) / 2) creation_cost += ((new_od_level - 10) / 5) * 3 //3 cost for every 5 units above 10 for(var/rarity in creation_complexity) switch(rarity) diff --git a/code/modules/vehicles/multitile/multitile_bump.dm b/code/modules/vehicles/multitile/multitile_bump.dm index 70416537ba99..2682c18a4282 100644 --- a/code/modules/vehicles/multitile/multitile_bump.dm +++ b/code/modules/vehicles/multitile/multitile_bump.dm @@ -494,7 +494,7 @@ /obj/vehicle/handle_vehicle_bump(obj/vehicle/multitile/V) V.take_damage_type(5, "blunt", V) - health = health - Ceiling(maxhealth/2.8) //we destroy any simple vehicle in 3 crushes + health = health - ceil(maxhealth/2.8) //we destroy any simple vehicle in 3 crushes healthcheck() visible_message(SPAN_DANGER("\The [V] crushes into \the [src]!")) diff --git a/code/modules/vehicles/multitile/multitile_movement.dm b/code/modules/vehicles/multitile/multitile_movement.dm index 58df8dbb9538..35e909cf7414 100644 --- a/code/modules/vehicles/multitile/multitile_movement.dm +++ b/code/modules/vehicles/multitile/multitile_movement.dm @@ -257,7 +257,7 @@ if(abs(move_momentum) <= 1) return - var/fling_distance = Ceiling(move_momentum/move_max_momentum) * 2 + var/fling_distance = ceil(move_momentum/move_max_momentum) * 2 var/turf/target = interior.get_middle_turf() for (var/x in 0 to fling_distance-1) @@ -275,7 +275,7 @@ if(isliving(A)) var/mob/living/M = A - shake_camera(M, 2, Ceiling(move_momentum/move_max_momentum) * 1) + shake_camera(M, 2, ceil(move_momentum/move_max_momentum) * 1) if(!M.buckled) M.apply_effect(1, STUN) M.apply_effect(2, WEAKEN)