From baad3135c9a48cd7b0793dca7cc49b7e282727ce Mon Sep 17 00:00:00 2001 From: Vi3trice <80771500+Vi3trice@users.noreply.github.com> Date: Wed, 12 Feb 2025 08:19:06 -0500 Subject: [PATCH] I question some people (#28208) --- code/__DEFINES/_math.dm | 4 ++-- code/__DEFINES/hud.dm | 2 +- code/__HELPERS/text.dm | 2 +- code/__HELPERS/unsorted.dm | 2 +- code/datums/components/footstep.dm | 2 +- code/game/objects/effects/spawners/airlock_spawner.dm | 4 ++-- code/game/objects/structures/safe.dm | 4 ++-- code/modules/antagonists/traitor/datum_traitor.dm | 2 +- code/modules/mob/living/carbon/carbon_life.dm | 2 +- code/modules/procedural_mapping/mapGenerator.dm | 2 +- code/modules/ruins/lavalandruin_code/puzzle.dm | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/code/__DEFINES/_math.dm b/code/__DEFINES/_math.dm index cd6c152f06d..45dc7d6c82c 100644 --- a/code/__DEFINES/_math.dm +++ b/code/__DEFINES/_math.dm @@ -63,9 +63,9 @@ #define ISABOUTEQUAL(a, b, deviation) (deviation ? abs((a) - (b)) <= deviation : abs((a) - (b)) <= 0.1) -#define ISEVEN(x) (x % 2 == 0) +#define ISEVEN(x) (!((x) & 1)) -#define ISODD(x) (x % 2 != 0) +#define ISODD(x) ((x) & 1) // Returns true if val is from min to max, inclusive. #define ISINRANGE(val, min, max) (min <= val && val <= max) diff --git a/code/__DEFINES/hud.dm b/code/__DEFINES/hud.dm index 59ab3c75e31..3515901c679 100644 --- a/code/__DEFINES/hud.dm +++ b/code/__DEFINES/hud.dm @@ -77,7 +77,7 @@ /proc/ui_hand_position(i) // values based on old hand ui positions (CENTER:-/+16,SOUTH:5) - var/x_off = i % 2 ? 0 : -1 + var/x_off = ISODD(i) ? 0 : -1 var/y_off = round((i-1) / 2) return"CENTER+[x_off]:16,SOUTH+[y_off]:5" diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index d42d688eed8..eed0db379b5 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -293,7 +293,7 @@ return copytext(new_message, 1, length + 1) if(delta == 1) return new_message + " " - if(delta % 2) + if(ISODD(delta)) new_message = " " + new_message delta-- var/spaces = add_lspace("",delta/2-1) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 6e5ca9e91ba..c6933b4aad0 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -268,7 +268,7 @@ f = round(f) f = max(low, f) f = min(high, f) - if((f % 2) == 0) //Ensure the last digit is an odd number + if(ISEVEN(f)) //Ensure the last digit is an odd number f += 1 return f diff --git a/code/datums/components/footstep.dm b/code/datums/components/footstep.dm index 1784f8f05fa..a31603db062 100644 --- a/code/datums/components/footstep.dm +++ b/code/datums/components/footstep.dm @@ -61,7 +61,7 @@ if(steps >= 6) steps = 0 - if(steps % 2) + if(ISODD(steps)) return if(steps != 0 && !has_gravity(LM, T)) // don't need to step as often when you hop around diff --git a/code/game/objects/effects/spawners/airlock_spawner.dm b/code/game/objects/effects/spawners/airlock_spawner.dm index 5a3c24419c1..592a7b58404 100644 --- a/code/game/objects/effects/spawners/airlock_spawner.dm +++ b/code/game/objects/effects/spawners/airlock_spawner.dm @@ -83,12 +83,12 @@ This spawner places pipe leading up to the interior door, you will need to finis var/obj/machinery/access_button/the_button = spawn_button(T, is_this_an_interior_airlock ? interior_direction : exterior_direction, is_this_an_interior_airlock) if(one_door_only == DOOR_NORMAL_PLACEMENT) //We only need one door, we are done return - if(!(tiles_in_x_direction % 2) && (is_this_an_interior_airlock && north_or_south_interior || !is_this_an_interior_airlock && north_or_south_exterior)) //Handle extra airlock for aesthetics + if(ISEVEN(tiles_in_x_direction) && (is_this_an_interior_airlock && north_or_south_interior || !is_this_an_interior_airlock && north_or_south_exterior)) //Handle extra airlock for aesthetics A = new door_type(get_step(T, EAST)) handle_door_stuff(A, is_this_an_interior_airlock) if(one_door_only == DOOR_FLIPPED_PLACEMENT) the_button.forceMove(get_step(the_button, EAST)) - else if(!(tiles_in_y_direction % 2) && (is_this_an_interior_airlock && !north_or_south_interior || !is_this_an_interior_airlock && !north_or_south_exterior)) //Handle extra airlock for aesthetics + else if(ISEVEN(tiles_in_y_direction) && (is_this_an_interior_airlock && !north_or_south_interior || !is_this_an_interior_airlock && !north_or_south_exterior)) //Handle extra airlock for aesthetics A = new door_type(get_step(T, NORTH)) handle_door_stuff(A, is_this_an_interior_airlock) if(one_door_only == DOOR_FLIPPED_PLACEMENT) diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 38a9aa0796a..70ea095f962 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -293,7 +293,7 @@ GLOBAL_LIST_EMPTY(safes) for(var/i = 1 to ticks) dial = WRAP(dial - 1, 0, 100) - var/invalid_turn = current_tumbler_index % 2 == 0 || current_tumbler_index > number_of_tumblers + var/invalid_turn = ISEVEN(current_tumbler_index) || current_tumbler_index > number_of_tumblers if(invalid_turn) // The moment you turn the wrong way or go too far, the tumblers reset current_tumbler_index = 1 @@ -313,7 +313,7 @@ GLOBAL_LIST_EMPTY(safes) for(var/i = 1 to ticks) dial = WRAP(dial + 1, 0, 100) - var/invalid_turn = current_tumbler_index % 2 != 0 || current_tumbler_index > number_of_tumblers + var/invalid_turn = ISODD(current_tumbler_index) || current_tumbler_index > number_of_tumblers if(invalid_turn) // The moment you turn the wrong way or go too far, the tumblers reset current_tumbler_index = 1 diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index cc709d5fe20..12c9d0527ca 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -234,7 +234,7 @@ RESTRICT_TYPE(/datum/antagonist/traitor) if(freq < 1451 || freq > 1459) freqlist += freq freq += 2 - if((freq % 2) == 0) + if(ISEVEN(freq)) freq += 1 freq = pick(freqlist) diff --git a/code/modules/mob/living/carbon/carbon_life.dm b/code/modules/mob/living/carbon/carbon_life.dm index 07445456db5..5a37d6f7a62 100644 --- a/code/modules/mob/living/carbon/carbon_life.dm +++ b/code/modules/mob/living/carbon/carbon_life.dm @@ -46,7 +46,7 @@ //Start of a breath chain, calls breathe() /mob/living/carbon/handle_breathing(times_fired) - if(times_fired % 2 == 1) + if(ISODD(times_fired)) var/datum/milla_safe/carbon_breathe/milla = new() milla.invoke_async(src) else diff --git a/code/modules/procedural_mapping/mapGenerator.dm b/code/modules/procedural_mapping/mapGenerator.dm index c51a43809c6..e2e2b0c865b 100644 --- a/code/modules/procedural_mapping/mapGenerator.dm +++ b/code/modules/procedural_mapping/mapGenerator.dm @@ -44,7 +44,7 @@ //Even sphere correction engage var/offByOneOffset = 1 - if(bigZ % 2 == 0) + if(ISEVEN(bigZ)) offByOneOffset = 0 for(var/i = lilZ, i <= bigZ+offByOneOffset, i++) diff --git a/code/modules/ruins/lavalandruin_code/puzzle.dm b/code/modules/ruins/lavalandruin_code/puzzle.dm index 0905ee6975d..3986eaa8130 100644 --- a/code/modules/ruins/lavalandruin_code/puzzle.dm +++ b/code/modules/ruins/lavalandruin_code/puzzle.dm @@ -104,7 +104,7 @@ if(current_ordering[j] < checked_value) swap_tally++ - return swap_tally % 2 == 0 + return ISEVEN(swap_tally) //swap two tiles in same row /obj/effect/sliding_puzzle/proc/make_solvable()