Skip to content

Commit

Permalink
[MIRROR] null equality to isnull
Browse files Browse the repository at this point in the history
  • Loading branch information
Spookerton authored and SuhEugene committed Jan 14, 2024
1 parent 6f81c69 commit 7e0baaa
Show file tree
Hide file tree
Showing 58 changed files with 107 additions and 106 deletions.
2 changes: 1 addition & 1 deletion code/_helpers/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Turf and target are seperate in case you want to teleport some distance from a t


/proc/LinkBlocked(turf/A, turf/B)
if(A == null || B == null) return 1
if(isnull(A) || isnull(B)) return 1
var/adir = get_dir(A,B)
var/rdir = get_dir(B,A)
if((adir & (NORTH|SOUTH)) && (adir & (EAST|WEST))) // diagonal
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystems/ambient_lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ SUBSYSTEM_DEF(ambient_lighting) //A simple SS that handles updating ambient ligh
*/
/datum/controller/subsystem/ambient_lighting/proc/create_ambient_group(color, multiplier)

if(ambient_groups[SPACE_AMBIENT_GROUP] == null) //Something (probably a planet) wants to add an ambient group, add space first
if(isnull(ambient_groups[SPACE_AMBIENT_GROUP])) //Something (probably a planet) wants to add an ambient group, add space first
add_space_ambient_group()

// Find the first free index in the bitmap.
Expand Down Expand Up @@ -196,7 +196,7 @@ SUBSYSTEM_DEF(ambient_lighting) //A simple SS that handles updating ambient ligh

/datum/controller/subsystem/ambient_lighting/Initialize(start_timeofday)
//Create space ambient group if nothing created it until now.
if(ambient_groups[SPACE_AMBIENT_GROUP] == null)
if(isnull(ambient_groups[SPACE_AMBIENT_GROUP]))
add_space_ambient_group()

fire(FALSE, TRUE)
Expand Down
8 changes: 4 additions & 4 deletions code/controllers/subsystems/zcopy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ SUBSYSTEM_DEF(zcopy)
TO.plane = t_target
TO.mouse_opacity = initial(TO.mouse_opacity)

T.queue_ao(T.ao_neighbors_mimic == null) // If ao_neighbors hasn't been set yet, we need to do a rebuild
T.queue_ao(isnull(T.ao_neighbors_mimic)) // If ao_neighbors hasn't been set yet, we need to do a rebuild

// Explicitly copy turf delegates so they show up properly on below levels.
// I think it's possible to get this to work without discrete delegate copy objects, but I'd rather this just work.
Expand Down Expand Up @@ -495,7 +495,7 @@ SUBSYSTEM_DEF(zcopy)

if (mutated)
for (var/i in 1 to length(fixed_overlays))
if (fixed_overlays[i] == null)
if (isnull(fixed_overlays[i]))
fixed_overlays[i] = appearance:overlays[i]

// Scan & fix underlays
Expand All @@ -512,7 +512,7 @@ SUBSYSTEM_DEF(zcopy)

if (mutated)
for (var/i in 1 to length(fixed_overlays))
if (fixed_underlays[i] == null)
if (isnull(fixed_underlays[i]))
fixed_underlays[i] = appearance:underlays[i]

// If we did nothing (no violations), don't bother creating a new appearance
Expand All @@ -538,7 +538,7 @@ SUBSYSTEM_DEF(zcopy)

return MA

#define FMT_DEPTH(X) (X == null ? "(null)" : X)
#define FMT_DEPTH(X) (isnull(X) ? "(null)" : X)

// This is a dummy object used so overlays can be shown in the analyzer.
/atom/movable/openspace/debug
Expand Down
2 changes: 1 addition & 1 deletion code/game/antagonist/antagonist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
//so that they do not occupy regular job slots. All other antag roles should be spawned after jobs are
//assigned, so that job restrictions can be respected.
/datum/antagonist/proc/attempt_spawn(spawn_target = null)
if(spawn_target == null)
if(isnull(spawn_target))
spawn_target = initial_spawn_target

// Update our boundaries.
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/changeling/modularchangling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ var/global/list/datum/power/changeling/powerinstances = list()
break


if(Thepower == null)
if(isnull(Thepower))
to_chat(M.current, "This is awkward. Changeling power purchase failed, please report this bug to a coder!")
return

Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/computer/arcade_orion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

/obj/machinery/computer/arcade/orion_trail/interact(mob/user)
var/dat = ""
if(event == null)
if(isnull(event))
newgame()
user.set_machine(src)
switch(view)
Expand Down Expand Up @@ -201,7 +201,7 @@

if(!href_list["food"])
var/temp = supplies["5"] - travel/1000 * (href_list["slow"] ? 2 : 1)
if(temp < 0 && (distance-travel != 0) && next_event == null) //uh oh. Better start a fuel event.
if(temp < 0 && (distance-travel != 0) && isnull(next_event)) //uh oh. Better start a fuel event.
next_event = ORION_TRAIL_STUCK
travel -= (temp*-1)*1000/(href_list["slow"] ? 2 : 1)
temp = 0
Expand All @@ -219,7 +219,7 @@
event_desc = "You and your crew starved to death, never to reach Orion."
supplies["4"] = 0

if(distance == 0 && next_event == null) //POOORT!
if(distance == 0 && isnull(next_event)) //POOORT!
port++
event = ORION_TRAIL_SPACEPORT
distance = stop_distance[port]
Expand Down Expand Up @@ -294,7 +294,7 @@
if(!specific)
specific = rand(1,length(settlers))

event_info += "The crewmember, [settlers[specific]] [desc == null ? "has died!":"[desc]"]<BR>"
event_info += "The crewmember, [settlers[specific]] [isnull(desc) ? "has died!":"[desc]"]<BR>"
settlers -= settlers[specific]
if(num_traitors > 0 && prob(100/max(1,length(settlers)-1)))
num_traitors--
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/message.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@

//Request Console Logs - KEY REQUIRED
if(href_list["viewr"])
if(src.linkedServer == null || (src.linkedServer.inoperable()))
if(isnull(src.linkedServer) || (src.linkedServer.inoperable()))
message = noserver
else
if(auth)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/airlock_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
var/datum/gas_mixture/air_sample = return_air()
var/pressure = round(air_sample.return_pressure(),0.1)

if(abs(pressure - previousPressure) > 0.001 || previousPressure == null)
if(abs(pressure - previousPressure) > 0.001 || isnull(previousPressure))
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.data["tag"] = id_tag
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
o += "EAST: "
if(4)
o += "WEST: "
if(tile_info[index] == null)
if(isnull(tile_info[index]))
o += SPAN_WARNING("DATA UNAVAILABLE")
to_chat(user, o)
continue
Expand Down Expand Up @@ -343,7 +343,7 @@
var/old_alerts = dir_alerts
for(var/index = 1; index <= 4; index++)
var/list/tileinfo = tile_info[index]
if(tileinfo == null)
if(isnull(tileinfo))
continue // Bad data.
var/celsius = convert_k2c(tileinfo[1])

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/nuclear_bomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ var/global/bomb_set
code = null
else
lastentered = text("[]", href_list["type"])
if(text2num(lastentered) == null)
if(isnull(text2num_or_default(lastentered)))
log_and_message_admins("tried to exploit a nuclear bomb by entering non-numerical codes")
else
code += lastentered
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/teleporter/beacon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var/global/const/TELEBEACON_WIRE_SIGNALLER = 4
var/new_name = input(user, "What label would you like to set this beacon to? Leave empty to enable automatic naming based on area.", "Set Beacon Label", beacon_name) as text|null
if (QDELETED(src))
return TRUE
if (new_name == null)
if (isnull(new_name))
autoset_name = TRUE
generate_name()
user.visible_message(
Expand Down
6 changes: 3 additions & 3 deletions code/game/movietitles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GLOBAL_LIST(end_titles)

if(mob.get_preference_value(/datum/client_preference/play_lobby_music) == GLOB.PREF_YES)
sound_to(mob, sound(null, channel = GLOB.lobby_sound_channel))
if(GLOB.end_credits_song == null)
if(isnull(GLOB.end_credits_song))
var/title_song = pick('sound/music/THUNDERDOME.ogg', 'sound/music/europa/Chronox_-_03_-_In_Orbit.ogg', 'sound/music/europa/asfarasitgets.ogg')
sound_to(mob, sound(title_song, wait = 0, volume = 40, channel = GLOB.lobby_sound_channel))
else if(get_preference_value(/datum/client_preference/play_admin_midis) == GLOB.PREF_YES)
Expand Down Expand Up @@ -118,7 +118,7 @@ GLOBAL_LIST(end_titles)
continue
if(H.is_species(SPECIES_MONKEY) && findtext(H.real_name,"[lowertext(H.species.name)]")) //no monki
continue
if(H.last_ckey == null) //don't mention these losers (prespawned corpses mostly)
if(isnull(H.last_ckey)) //don't mention these losers (prespawned corpses mostly)
continue
if(!length(cast) && !chunksize)
chunk += "CAST:"
Expand Down Expand Up @@ -159,7 +159,7 @@ GLOBAL_LIST(end_titles)
var/list/corpses = list()
var/list/monkies = list()
for(var/mob/living/carbon/human/H in GLOB.dead_mobs)
if(H.last_ckey == null) //no prespawned corpses
if(isnull(H.last_ckey)) //no prespawned corpses
continue
if(H.is_species(SPECIES_MONKEY) && findtext(H.real_name,"[lowertext(H.species.name)]"))
monkies[H.species.name] += 1
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/fire/fire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
if(open_turf.turf_fire)
return INITIALIZE_HINT_QDEL

if(fire_color && ((color != fire_color) && color == null)) //Take colour from proc unless base colour was already custom
if(fire_color && ((color != fire_color) && isnull(color))) //Take colour from proc unless base colour was already custom
color = fire_color
if(color != null)
set_color(color)
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/effects/spawners/bombspawner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@
var/obj/spawner/newbomb/proto = /obj/spawner/newbomb/radio/custom

var/p = input("Enter phoron amount (mol):","Phoron", initial(proto.phoron_amt)) as num|null
if(p == null) return
if(isnull(p)) return

var/o = input("Enter oxygen amount (mol):","Oxygen", initial(proto.oxygen_amt)) as num|null
if(o == null) return
if(isnull(o)) return

var/c = input("Enter carbon dioxide amount (mol):","Carbon Dioxide", initial(proto.carbon_amt)) as num|null
if(c == null) return
if(isnull(c)) return

new /obj/spawner/newbomb/radio/custom(get_turf(mob), p, o, c)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
if(det_time > 1)
to_chat(user, "The timer is set to [det_time/10] seconds.")
return
if(det_time == null)
if(isnull(det_time))
return
to_chat(user, "\The [src] is set for instant detonation.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var/obj/item/scanned

/obj/item/implant/compressed/trigger(emote, mob/source)
if (src.scanned == null)
if (isnull(src.scanned))
return 0

if (emote == src.activation_emote)
Expand Down Expand Up @@ -53,7 +53,7 @@
var/obj/item/implant/compressed/c = imp
if (!c || !istype(M, /mob/living/carbon))
return FALSE
if (c.scanned == null)
if (isnull(c.scanned))
to_chat(user, "Please compress an object with the implanter first.")
return TRUE
else return ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/policetape.dm
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ var/global/list/tape_roll_applications = list()
var/turf/F = A
var/direction = user.loc == F ? user.dir : turn(user.dir, 180)
var/hazard_overlay = GLOB.hazard_overlays["[direction]"]
if(tape_roll_applications[F] == null)
if(isnull(tape_roll_applications[F]))
tape_roll_applications[F] = 0

if(tape_roll_applications[F] & direction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
//Creates the storage UI
/datum/storage_ui/default/prepare_ui()
//if storage slots is null then use the storage space UI, otherwise use the slots UI
if(storage.storage_slots == null)
if(isnull(storage.storage_slots))
space_orient_objs()
else
slot_orient_objs()
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/structures/transit_tubes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
/obj/structure/transit_tube/New(loc)
..(loc)

if(tube_dirs == null)
if(isnull(tube_dirs))
init_dirs()


Expand Down Expand Up @@ -314,7 +314,7 @@
current_tube = tube
break

if(current_tube == null)
if(isnull(current_tube))
set_dir(next_dir)
Move(get_step(loc, dir)) // Allow collisions when leaving the tubes.
break
Expand Down Expand Up @@ -446,7 +446,7 @@
for(var/direction in tube_dir_list)
var/location = get_step(loc, direction)
for(var/obj/structure/transit_tube/tube in location)
if(tube.directions() == null && tube.icon_state == "auto")
if(isnull(tube.directions()) && tube.icon_state == "auto")
connected_auto += direction
break

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ GLOBAL_VAR_INIT(skip_allow_lists, FALSE)
else
to_chat(usr, "<b>SOMETHING SILICON [key_name(S, usr)]'s laws:</b>")

if (S.laws == null)
if (isnull(S.laws))
to_chat(usr, "[key_name(S, usr)]'s laws are null?? Contact a coder.")
else
S.laws.show_laws(usr)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/SDQL_2/SDQL_2_parser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
do
tok = token(i)
if (tok == "," || tok == ":")
if (temp_expression_list == null)
if (isnull(temp_expression_list))
parse_error("Found ',' or ':' without expression in an array.")
return i + 1

Expand Down
10 changes: 5 additions & 5 deletions code/modules/admin/verbs/massmodvar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@

if("text")
var/new_value = input("Enter new text:","Text",O.vars[variable]) as text|null//todo: sanitize ???
if(new_value == null) return
if(isnull(new_value)) return
O.vars[variable] = new_value

if(method)
Expand Down Expand Up @@ -206,7 +206,7 @@
if("num")
var/new_value = input("Enter new number:","Num",\
O.vars[variable]) as num|null
if(new_value == null) return
if(isnull(new_value)) return
O.vars[variable] = new_value

if(method)
Expand Down Expand Up @@ -244,7 +244,7 @@
if("type")
var/new_value
new_value = select_subpath(within_scope = /datum)
if(new_value == null) return
if(isnull(new_value)) return
O.vars[variable] = new_value
if(method)
if(istype(O, /mob))
Expand Down Expand Up @@ -279,7 +279,7 @@

if("file")
var/new_value = input("Pick file:","File",O.vars[variable]) as null|file
if(new_value == null) return
if(isnull(new_value)) return
O.vars[variable] = new_value

if(method)
Expand Down Expand Up @@ -315,7 +315,7 @@

if("icon")
var/new_value = input("Pick icon:","Icon",O.vars[variable]) as null|icon
if(new_value == null) return
if(isnull(new_value)) return
O.vars[variable] = new_value
if(method)
if(istype(O, /mob))
Expand Down
Loading

0 comments on commit 7e0baaa

Please sign in to comment.