From 420e8f8d9913fd7316bd22d521c7e7a506717690 Mon Sep 17 00:00:00 2001
From: KalevTait <107985691+KalevTait@users.noreply.github.com>
Date: Mon, 11 Jul 2022 20:28:19 +0100
Subject: [PATCH] Code Readability - Mobs (misc) (#18266)
* mobs misc
* remove implied src
---
code/modules/mob/camera/camera.dm | 4 +--
code/modules/mob/dead/observer/spells.dm | 4 +--
code/modules/mob/living/carbon/alien/alien.dm | 2 +-
.../mob/living/carbon/alien/larva/larva.dm | 2 +-
code/modules/mob/living/carbon/brain/brain.dm | 2 +-
code/modules/mob/living/carbon/carbon.dm | 28 +++++++++----------
code/modules/mob/living/carbon/human/human.dm | 1 +
.../mob/living/carbon/human/human_damage.dm | 4 +--
.../mob/living/carbon/human/human_defense.dm | 2 +-
.../mob/living/carbon/human/species/golem.dm | 6 ++--
code/modules/mob/living/logout.dm | 2 +-
code/modules/mob/living/stat_states.dm | 4 +--
code/modules/mob/new_player/login.dm | 2 +-
code/modules/mob/new_player/logout.dm | 2 +-
code/modules/mob/new_player/new_player.dm | 12 ++++----
15 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/code/modules/mob/camera/camera.dm b/code/modules/mob/camera/camera.dm
index 090e5ddac1e..e7497e58920 100644
--- a/code/modules/mob/camera/camera.dm
+++ b/code/modules/mob/camera/camera.dm
@@ -2,7 +2,7 @@
/mob/camera
name = "camera mob"
- density = 0
+ density = FALSE
move_force = INFINITY
move_resist = INFINITY
status_flags = GODMODE // You can't damage it.
@@ -10,7 +10,7 @@
see_in_dark = 8
invisibility = 101 // No one can see us
sight = SEE_SELF
- move_on_shuttle = 0
+ move_on_shuttle = FALSE
/mob/camera/experience_pressure_difference()
return
diff --git a/code/modules/mob/dead/observer/spells.dm b/code/modules/mob/dead/observer/spells.dm
index 9d3e0734739..95531e3063e 100644
--- a/code/modules/mob/dead/observer/spells.dm
+++ b/code/modules/mob/dead/observer/spells.dm
@@ -21,8 +21,8 @@ GLOBAL_LIST_INIT(boo_phrases, list(
school = "transmutation"
charge_max = 2 MINUTES
starts_charged = FALSE
- clothes_req = 0
- stat_allowed = 1
+ clothes_req = FALSE
+ stat_allowed = UNCONSCIOUS
invocation = ""
invocation_type = "none"
// no need to spam admins regarding boo casts
diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm
index 7c40f388332..7f7d04e4bb9 100644
--- a/code/modules/mob/living/carbon/alien/alien.dm
+++ b/code/modules/mob/living/carbon/alien/alien.dm
@@ -116,7 +116,7 @@
stat(null, "Move Mode: [m_intent]")
show_stat_emergency_shuttle_eta()
-/mob/living/carbon/alien/SetStunned(amount, updating = 1, force = 0)
+/mob/living/carbon/alien/SetStunned(amount, updating = TRUE, force = 0)
..()
if(!(status_flags & CANSTUN) && amount)
// add some movement delay
diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm
index 9620b1004d2..bcb1f4dd5de 100644
--- a/code/modules/mob/living/carbon/alien/larva/larva.dm
+++ b/code/modules/mob/living/carbon/alien/larva/larva.dm
@@ -7,7 +7,7 @@
maxHealth = 25
health = 25
- density = 0
+ density = FALSE
var/amount_grown = 0
var/max_grown = 200
diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm
index d1724d3abe7..3764870eb0c 100644
--- a/code/modules/mob/living/carbon/brain/brain.dm
+++ b/code/modules/mob/living/carbon/brain/brain.dm
@@ -2,7 +2,7 @@
var/obj/item/container = null
var/timeofhostdeath = 0
var/emp_damage = 0//Handles a type of MMI damage
- use_me = 0 //Can't use the me verb, it's a freaking immobile brain
+ use_me = FALSE //Can't use the me verb, it's a freaking immobile brain
icon = 'icons/obj/surgery.dmi'
icon_state = "brain1"
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index fb0b346fa3f..0201e4e23ee 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -178,13 +178,13 @@
Weaken(6 SECONDS)
/mob/living/carbon/swap_hand()
- var/obj/item/item_in_hand = src.get_active_hand()
+ var/obj/item/item_in_hand = get_active_hand()
if(item_in_hand) //this segment checks if the item in your hand is twohanded.
if(istype(item_in_hand,/obj/item/twohanded))
if(item_in_hand:wielded == 1)
to_chat(usr, "Your other hand is too busy holding the [item_in_hand.name]")
return
- src.hand = !( src.hand )
+ hand = !hand
if(hud_used && hud_used.inv_slots[slot_l_hand] && hud_used.inv_slots[slot_r_hand])
var/obj/screen/inventory/hand/H
H = hud_used.inv_slots[slot_l_hand]
@@ -204,7 +204,7 @@
if(selhand == "left" || selhand == "l")
selhand = 1
- if(selhand != src.hand)
+ if(selhand != hand)
swap_hand()
/mob/living/carbon/proc/help_shake_act(mob/living/carbon/M)
@@ -364,8 +364,8 @@
extra_damage = extra_darkview
var/light_amount = 10 // assume full brightness
- if(isturf(src.loc))
- var/turf/T = src.loc
+ if(isturf(loc))
+ var/turf/T = loc
light_amount = round(T.get_lumcount() * 10)
// a dark view of 8, in full darkness, will result in maximum 1st tier damage
@@ -612,14 +612,14 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
throw_mode_on()
/mob/living/carbon/proc/throw_mode_off()
- src.in_throw_mode = 0
- if(src.throw_icon) //in case we don't have the HUD and we use the hotkey
- src.throw_icon.icon_state = "act_throw_off"
+ in_throw_mode = FALSE
+ if(throw_icon) //in case we don't have the HUD and we use the hotkey
+ throw_icon.icon_state = "act_throw_off"
/mob/living/carbon/proc/throw_mode_on()
- src.in_throw_mode = 1
- if(src.throw_icon)
- src.throw_icon.icon_state = "act_throw_on"
+ in_throw_mode = TRUE
+ if(throw_icon)
+ throw_icon.icon_state = "act_throw_on"
/mob/proc/throw_item(atom/target)
return
@@ -629,7 +629,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
throw_mode_off()
return
- var/obj/item/I = src.get_active_hand()
+ var/obj/item/I = get_active_hand()
if(!I || I.override_throw(src, target) || (I.flags & NODROP))
throw_mode_off()
@@ -806,7 +806,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
//generates realistic-ish pulse output based on preset levels
/mob/living/carbon/proc/get_pulse(method) //method 0 is for hands, 1 is for machines, more accurate
var/temp = 0 //see setup.dm:694
- switch(src.pulse)
+ switch(pulse)
if(PULSE_NONE)
return "0"
if(PULSE_SLOW)
@@ -972,7 +972,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
drop_r_hand()
drop_l_hand()
stop_pulling()
- throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed)
+ throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = handcuffed)
ADD_TRAIT(src, TRAIT_RESTRAINED, "handcuffed")
else
REMOVE_TRAIT(src, TRAIT_RESTRAINED, "handcuffed")
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 8cd2177067b..96c48f37a53 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -948,6 +948,7 @@
var/obj/item/organ/internal/eyes/E = get_organ_slot("eyes")
if(E)
number += E.flash_protect
+ number = clamp(number, -1, 2)
return number
/mob/living/carbon/human/check_ear_prot()
diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm
index 029299edca6..bfbf2d4d894 100644
--- a/code/modules/mob/living/carbon/human/human_damage.dm
+++ b/code/modules/mob/living/carbon/human/human_damage.dm
@@ -234,7 +234,7 @@
//Damages ONE external organ, organ gets randomly selected from damagable ones.
//It automatically updates damage overlays if necesary
//It automatically updates health status
-/mob/living/carbon/human/take_organ_damage(brute, burn, updating_health = TRUE, sharp = 0, edge = 0)
+/mob/living/carbon/human/take_organ_damage(brute, burn, updating_health = TRUE, sharp = FALSE, edge = 0)
var/list/obj/item/organ/external/parts = get_damageable_organs()
if(!parts.len)
return
@@ -267,7 +267,7 @@
UpdateDamageIcon()
// damage MANY external organs, in random order
-/mob/living/carbon/human/take_overall_damage(brute, burn, updating_health = TRUE, used_weapon = null, sharp = 0, edge = 0)
+/mob/living/carbon/human/take_overall_damage(brute, burn, updating_health = TRUE, used_weapon = null, sharp = FALSE, edge = 0)
if(status_flags & GODMODE)
return //godmode
var/list/obj/item/organ/external/parts = get_damageable_organs()
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index fe354adf06c..05d5f620232 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -405,7 +405,7 @@ emp_act
to_chat(user, "[src]'s [affecting.name] is already sabotaged!")
else
to_chat(user, "You sneakily slide the card into the dataport on [src]'s [affecting.name] and short out the safeties.")
- affecting.sabotaged = 1
+ affecting.sabotaged = TRUE
return 1
/mob/living/carbon/human/grabbedby(mob/living/user)
diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm
index 6c9a0bd1599..b06cb23b2a3 100644
--- a/code/modules/mob/living/carbon/human/species/golem.dm
+++ b/code/modules/mob/living/carbon/human/species/golem.dm
@@ -568,7 +568,7 @@
var/honkooldown = 0
var/last_banana = 0
var/banana_cooldown = 100
- var/active = null
+ var/active = FALSE
/datum/species/golem/bananium/on_species_gain(mob/living/carbon/human/H)
..()
@@ -619,11 +619,11 @@
/datum/species/golem/bananium/handle_life(mob/living/carbon/human/H)
if(!active)
if(world.time > last_honk + honkooldown)
- active = 1
+ active = TRUE
playsound(get_turf(H), 'sound/items/bikehorn.ogg', 50, 1)
last_honk = world.time
honkooldown = rand(20, 80)
- active = null
+ active = FALSE
..()
/datum/species/golem/bananium/handle_death(gibbed, mob/living/carbon/human/H)
diff --git a/code/modules/mob/living/logout.dm b/code/modules/mob/living/logout.dm
index 5c97f466034..fa0d6f4e456 100644
--- a/code/modules/mob/living/logout.dm
+++ b/code/modules/mob/living/logout.dm
@@ -5,7 +5,7 @@
..()
if(mind)
if(!key) //key and mind have become seperated. I believe this is for when a staff member aghosts.
- mind.active = 0 //This is to stop say, a mind.transfer_to call on a corpse causing a ghost to re-enter its body.
+ mind.active = FALSE //This is to stop say, a mind.transfer_to call on a corpse causing a ghost to re-enter its body.
//This causes instant sleep and tags a player as SSD. See life.dm for furthering SSD.
if(mind.active)
Sleeping(4 SECONDS)
diff --git a/code/modules/mob/living/stat_states.dm b/code/modules/mob/living/stat_states.dm
index a204c0902a9..85602092349 100644
--- a/code/modules/mob/living/stat_states.dm
+++ b/code/modules/mob/living/stat_states.dm
@@ -1,6 +1,6 @@
// There, now `stat` is a proper state-machine
-/mob/living/proc/KnockOut(updating = 1)
+/mob/living/proc/KnockOut(updating = TRUE)
if(stat == DEAD)
log_runtime(EXCEPTION("KnockOut called on a dead mob."), src)
return 0
@@ -19,7 +19,7 @@
set_typing_indicator(FALSE)
return 1
-/mob/living/proc/WakeUp(updating = 1)
+/mob/living/proc/WakeUp(updating = TRUE)
if(stat == DEAD)
log_runtime(EXCEPTION("WakeUp called on a dead mob."), src)
return 0
diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm
index dc2bf083bfe..f2feaa91a3d 100644
--- a/code/modules/mob/new_player/login.dm
+++ b/code/modules/mob/new_player/login.dm
@@ -5,7 +5,7 @@
if(!mind)
mind = new /datum/mind(key)
- mind.active = 1
+ mind.active = TRUE
mind.current = src
if(length(GLOB.newplayer_start))
diff --git a/code/modules/mob/new_player/logout.dm b/code/modules/mob/new_player/logout.dm
index de6f38f337f..307cd6ab557 100644
--- a/code/modules/mob/new_player/logout.dm
+++ b/code/modules/mob/new_player/logout.dm
@@ -1,5 +1,5 @@
/mob/new_player/Logout()
- ready = 0
+ ready = FALSE
..()
if(!spawning)//Here so that if they are spawning and log out, the other procs can play out and they will have a mob to come back to.
key = null//We null their key before deleting the mob, so they are properly kicked out.
diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm
index 2e9ce9632de..186a161dd7c 100644
--- a/code/modules/mob/new_player/new_player.dm
+++ b/code/modules/mob/new_player/new_player.dm
@@ -1,13 +1,13 @@
/mob/new_player
- var/ready = 0
- var/spawning = 0 //Referenced when you want to delete the new_player later on in the code.
+ var/ready = FALSE
+ var/spawning = FALSE //Referenced when you want to delete the new_player later on in the code.
var/totalPlayers = 0 //Player counts for the Lobby tab
var/totalPlayersReady = 0
universal_speak = TRUE
invisibility = 101
- density = 0
+ density = FALSE
stat = DEAD
/mob/new_player/Initialize(mapload)
@@ -178,7 +178,7 @@
return 1
var/mob/dead/observer/observer = new(src)
src << browse(null, "window=playersetup")
- spawning = 1
+ spawning = TRUE
stop_sound_channel(CHANNEL_LOBBYMUSIC)
@@ -523,7 +523,7 @@
popup.open(0) // 0 is passed to open so that it doesn't use the onclose() proc
/mob/new_player/proc/create_character()
- spawning = 1
+ spawning = TRUE
close_spawn_windows()
check_prefs_are_sane()
@@ -539,7 +539,7 @@
if(mind)
- mind.active = 0 //we wish to transfer the key manually
+ mind.active = FALSE //we wish to transfer the key manually
if(mind.assigned_role == "Clown") //give them a clownname if they are a clown
new_character.real_name = pick(GLOB.clown_names) //I hate this being here of all places but unfortunately dna is based on real_name!
new_character.rename_self("clown")