"
var/mob/pref_mob = preference_mob()
- for(var/cp in get_client_preferences())
- var/datum/client_preference/client_pref = cp
+ for(var/datum/client_preference/client_pref as anything in get_client_preferences())
if(!client_pref.may_toggle(pref_mob))
continue
diff --git a/code/modules/client/preference_setup/global/setting_datums.dm b/code/modules/client/preference_setup/global/setting_datums.dm
index 24ce8f1d33..7138d28626 100644
--- a/code/modules/client/preference_setup/global/setting_datums.dm
+++ b/code/modules/client/preference_setup/global/setting_datums.dm
@@ -5,8 +5,7 @@ var/list/_client_preferences_by_type
/proc/get_client_preferences()
if(!_client_preferences)
_client_preferences = list()
- for(var/ct in subtypesof(/datum/client_preference))
- var/datum/client_preference/client_type = ct
+ for(var/datum/client_preference/client_type as anything in subtypesof(/datum/client_preference))
if(initial(client_type.description))
_client_preferences += new client_type()
return _client_preferences
@@ -21,16 +20,14 @@ var/list/_client_preferences_by_type
/proc/get_client_preference_by_key(var/preference)
if(!_client_preferences_by_key)
_client_preferences_by_key = list()
- for(var/ct in get_client_preferences())
- var/datum/client_preference/client_pref = ct
+ for(var/datum/client_preference/client_pref as anything in get_client_preferences())
_client_preferences_by_key[client_pref.key] = client_pref
return _client_preferences_by_key[preference]
/proc/get_client_preference_by_type(var/preference)
if(!_client_preferences_by_type)
_client_preferences_by_type = list()
- for(var/ct in get_client_preferences())
- var/datum/client_preference/client_pref = ct
+ for(var/datum/client_preference/client_pref as anything in get_client_preferences())
_client_preferences_by_type[client_pref.type] = client_pref
return _client_preferences_by_type[preference]
diff --git a/code/modules/client/preference_setup/loadout/loadout.dm b/code/modules/client/preference_setup/loadout/loadout.dm
index e01d5f0b24..f16815d356 100644
--- a/code/modules/client/preference_setup/loadout/loadout.dm
+++ b/code/modules/client/preference_setup/loadout/loadout.dm
@@ -12,9 +12,8 @@ var/list/gear_datums = list()
/hook/startup/proc/populate_gear_list()
//create a list of gear datums to sort
- for(var/geartype in typesof(/datum/gear)-/datum/gear)
- var/datum/gear/G = geartype
- if(initial(G.type_category) == geartype)
+ for(var/datum/gear/G as anything in subtypesof(/datum/gear))
+ if(initial(G.type_category) == G)
continue
var/use_name = initial(G.display_name)
var/use_category = initial(G.sort_category)
@@ -32,7 +31,7 @@ var/list/gear_datums = list()
if(!loadout_categories[use_category])
loadout_categories[use_category] = new /datum/loadout_category(use_category)
var/datum/loadout_category/LC = loadout_categories[use_category]
- gear_datums[use_name] = new geartype
+ gear_datums[use_name] = new G
LC.gear[use_name] = gear_datums[use_name]
loadout_categories = sortAssoc(loadout_categories)
diff --git a/code/modules/client/preference_setup/loadout/loadout_accessories.dm b/code/modules/client/preference_setup/loadout/loadout_accessories.dm
index b9c446fb87..07c1b7f1be 100644
--- a/code/modules/client/preference_setup/loadout/loadout_accessories.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_accessories.dm
@@ -13,8 +13,7 @@
/datum/gear/accessory/armband/New()
..()
var/list/armbands = list()
- for(var/armband in (typesof(/obj/item/clothing/accessory/armband) - typesof(/obj/item/clothing/accessory/armband/med/color)))
- var/obj/item/clothing/accessory/armband_type = armband
+ for(var/obj/item/clothing/accessory/armband_type as anything in (typesof(/obj/item/clothing/accessory/armband) - typesof(/obj/item/clothing/accessory/armband/med/color)))
armbands[initial(armband_type.name)] = armband_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(armbands))
@@ -71,8 +70,7 @@
/datum/gear/accessory/wcoat/New()
..()
var/list/wcoats = list()
- for(var/wcoat in typesof(/obj/item/clothing/accessory/wcoat))
- var/obj/item/clothing/accessory/wcoat_type = wcoat
+ for(var/obj/item/clothing/accessory/wcoat_type as anything in typesof(/obj/item/clothing/accessory/wcoat))
wcoats[initial(wcoat_type.name)] = wcoat_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(wcoats))
@@ -84,8 +82,7 @@
/datum/gear/accessory/holster/New()
..()
var/list/holsters = list()
- for(var/holster in typesof(/obj/item/clothing/accessory/holster))
- var/obj/item/clothing/accessory/holster_type = holster
+ for(var/obj/item/clothing/accessory/holster_type as anything in typesof(/obj/item/clothing/accessory/holster))
holsters[initial(holster_type.name)] = holster_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(holsters))
@@ -97,8 +94,7 @@
/datum/gear/accessory/tie/New()
..()
var/list/ties = list()
- for(var/tie in typesof(/obj/item/clothing/accessory/tie))
- var/obj/item/clothing/accessory/tie_type = tie
+ for(var/obj/item/clothing/accessory/tie_type as anything in typesof(/obj/item/clothing/accessory/tie))
ties[initial(tie_type.name)] = tie_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(ties))
@@ -110,8 +106,7 @@
/datum/gear/accessory/scarf/New()
..()
var/list/scarfs = list()
- for(var/scarf in typesof(/obj/item/clothing/accessory/scarf))
- var/obj/item/clothing/accessory/scarf_type = scarf
+ for(var/obj/item/clothing/accessory/scarf_type as anything in typesof(/obj/item/clothing/accessory/scarf))
scarfs[initial(scarf_type.name)] = scarf_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(scarfs))
@@ -132,8 +127,7 @@
/datum/gear/accessory/jacket/New()
..()
var/list/jackets = list()
- for(var/jacket in typesof(/obj/item/clothing/accessory/jacket))
- var/obj/item/clothing/accessory/jacket_type = jacket
+ for(var/obj/item/clothing/accessory/jacket_type as anything in typesof(/obj/item/clothing/accessory/jacket))
jackets[initial(jacket_type.name)] = jacket_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(jackets))
@@ -179,8 +173,7 @@
/datum/gear/accessory/fannypack/New()
..()
var/list/fannys = list()
- for(var/fanny in typesof(/obj/item/weapon/storage/belt/fannypack))
- var/obj/item/weapon/storage/belt/fannypack/fanny_type = fanny
+ for(var/obj/item/weapon/storage/belt/fannypack/fanny_type as anything in typesof(/obj/item/weapon/storage/belt/fannypack))
fannys[initial(fanny_type.name)] = fanny_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(fannys))
@@ -280,8 +273,7 @@
/datum/gear/accessory/asym/New()
..()
var/list/asyms = list()
- for(var/asym in typesof(/obj/item/clothing/accessory/asymmetric))
- var/obj/item/clothing/accessory/asymmetric_type = asym
+ for(var/obj/item/clothing/accessory/asymmetric_type as anything in typesof(/obj/item/clothing/accessory/asymmetric))
asyms[initial(asymmetric_type.name)] = asymmetric_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(asyms))
diff --git a/code/modules/client/preference_setup/loadout/loadout_general.dm b/code/modules/client/preference_setup/loadout/loadout_general.dm
index 719eb6fcfc..8b566fe3c9 100644
--- a/code/modules/client/preference_setup/loadout/loadout_general.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_general.dm
@@ -53,8 +53,7 @@
/datum/gear/plushie/New()
..()
var/list/plushies = list()
- for(var/plushie in subtypesof(/obj/item/toy/plushie/) - /obj/item/toy/plushie/therapy)
- var/obj/item/toy/plushie/plushie_type = plushie
+ for(var/obj/item/toy/plushie/plushie_type as anything in subtypesof(/obj/item/toy/plushie) - /obj/item/toy/plushie/therapy)
plushies[initial(plushie_type.name)] = plushie_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(plushies))
@@ -66,8 +65,7 @@
/datum/gear/figure/New()
..()
var/list/figures = list()
- for(var/figure in typesof(/obj/item/toy/figure/) - /obj/item/toy/figure)
- var/obj/item/toy/figure/figure_type = figure
+ for(var/obj/item/toy/figure/figure_type as anything in subtypesof(/obj/item/toy/figure))
figures[initial(figure_type.name)] = figure_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(figures))
diff --git a/code/modules/client/preference_setup/loadout/loadout_general_vr.dm b/code/modules/client/preference_setup/loadout/loadout_general_vr.dm
index 94739c56bb..9b72d27aba 100644
--- a/code/modules/client/preference_setup/loadout/loadout_general_vr.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_general_vr.dm
@@ -6,8 +6,7 @@
/datum/gear/ball/New()
..()
var/list/balls = list()
- for(var/ball in typesof(/obj/item/toy/tennis/))
- var/obj/item/toy/tennis/ball_type = ball
+ for(var/obj/item/toy/tennis/ball_type as anything in typesof(/obj/item/toy/tennis/))
balls[initial(ball_type.name)] = ball_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(balls))
@@ -19,8 +18,7 @@
/datum/gear/character/New()
..()
var/list/characters = list()
- for(var/character in typesof(/obj/item/toy/character/) - /obj/item/toy/character)
- var/obj/item/toy/character/character_type = character
+ for(var/obj/item/toy/character/character_type as anything in subtypesof(/obj/item/toy/character))
characters[initial(character_type.name)] = character_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(characters))
@@ -32,8 +30,7 @@
/datum/gear/mechtoy/New()
..()
var/list/mechs = list()
- for(var/mech in typesof(/obj/item/toy/mecha/) - /obj/item/toy/mecha/)
- var/obj/item/toy/mecha/mech_type = mech
+ for(var/obj/item/toy/mecha/mech_type as anything in subtypesof(/obj/item/toy/mecha))
mechs[initial(mech_type.name)] = mech_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(mechs))
diff --git a/code/modules/client/preference_setup/loadout/loadout_head.dm b/code/modules/client/preference_setup/loadout/loadout_head.dm
index ee161f598d..ba7d818dbd 100644
--- a/code/modules/client/preference_setup/loadout/loadout_head.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_head.dm
@@ -169,8 +169,7 @@
/datum/gear/head/pin/New()
..()
var/list/pins = list()
- for(var/pin in typesof(/obj/item/clothing/head/pin))
- var/obj/item/clothing/head/pin/pin_type = pin
+ for(var/obj/item/clothing/head/pin/pin_type as anything in typesof(/obj/item/clothing/head/pin))
pins[initial(pin_type.name)] = pin_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(pins))
@@ -182,8 +181,7 @@
/datum/gear/head/hardhat/New()
..()
var/list/hardhats = list()
- for(var/hardhat in typesof(/obj/item/clothing/head/hardhat))
- var/obj/item/clothing/head/hardhat/hardhat_type = hardhat
+ for(var/obj/item/clothing/head/hardhat/hardhat_type as anything in typesof(/obj/item/clothing/head/hardhat))
hardhats[initial(hardhat_type.name)] = hardhat_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(hardhats))
@@ -223,8 +221,7 @@
/datum/gear/head/santahat/New()
..()
var/list/santahats = list()
- for(var/santahat in typesof(/obj/item/clothing/head/santa))
- var/obj/item/clothing/head/santa/santahat_type = santahat
+ for(var/obj/item/clothing/head/santa/santahat_type as anything in typesof(/obj/item/clothing/head/santa))
santahats[initial(santahat_type.name)] = santahat_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(santahats))
diff --git a/code/modules/client/preference_setup/loadout/loadout_smoking.dm b/code/modules/client/preference_setup/loadout/loadout_smoking.dm
index 96db8bf2fe..f9442518b2 100644
--- a/code/modules/client/preference_setup/loadout/loadout_smoking.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_smoking.dm
@@ -48,7 +48,6 @@
/datum/gear/cigarettes/New()
..()
var/list/cigarettes = list()
- for(var/cigarette in (typesof(/obj/item/weapon/storage/fancy/cigarettes) - typesof(/obj/item/weapon/storage/fancy/cigarettes/killthroat)))
- var/obj/item/weapon/storage/fancy/cigarettes/cigarette_brand = cigarette
+ for(var/obj/item/weapon/storage/fancy/cigarettes/cigarette_brand as anything in (typesof(/obj/item/weapon/storage/fancy/cigarettes) - typesof(/obj/item/weapon/storage/fancy/cigarettes/killthroat)))
cigarettes[initial(cigarette_brand.name)] = cigarette_brand
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(cigarettes))
diff --git a/code/modules/client/preference_setup/loadout/loadout_uniform.dm b/code/modules/client/preference_setup/loadout/loadout_uniform.dm
index 4d9e530992..5b7bc83757 100644
--- a/code/modules/client/preference_setup/loadout/loadout_uniform.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_uniform.dm
@@ -16,8 +16,7 @@
/datum/gear/uniform/cheongsam/New()
..()
var/list/cheongasms = list()
- for(var/cheongasm in typesof(/obj/item/clothing/under/cheongsam))
- var/obj/item/clothing/under/cheongsam/cheongasm_type = cheongasm
+ for(var/obj/item/clothing/under/cheongsam/cheongasm_type as anything in typesof(/obj/item/clothing/under/cheongsam))
cheongasms[initial(cheongasm_type.name)] = cheongasm_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(cheongasms))
@@ -28,8 +27,7 @@
/datum/gear/uniform/croptop/New()
..()
var/list/croptops = list()
- for(var/croptop in typesof(/obj/item/clothing/under/croptop))
- var/obj/item/clothing/under/croptop/croptop_type = croptop
+ for(var/obj/item/clothing/under/croptop/croptop_type as anything in typesof(/obj/item/clothing/under/croptop))
croptops[initial(croptop_type.name)] = croptop_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(croptops))
@@ -52,8 +50,7 @@
/datum/gear/uniform/jumpsuit/New()
..()
var/list/jumpclothes = list()
- for(var/jump in typesof(/obj/item/clothing/under/color))
- var/obj/item/clothing/under/color/jumps = jump
+ for(var/obj/item/clothing/under/color/jumps as anything in typesof(/obj/item/clothing/under/color))
jumpclothes[initial(jumps.name)] = jumps
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(jumpclothes))
@@ -78,8 +75,7 @@
/datum/gear/uniform/pants/New()
..()
var/list/pants = list()
- for(var/pant in typesof(/obj/item/clothing/under/pants))
- var/obj/item/clothing/under/pants/pant_type = pant
+ for(var/obj/item/clothing/under/pants/pant_type as anything in typesof(/obj/item/clothing/under/pants))
pants[initial(pant_type.name)] = pant_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(pants))
@@ -90,8 +86,7 @@
/datum/gear/uniform/shorts/New()
..()
var/list/shorts = list()
- for(var/short in typesof(/obj/item/clothing/under/shorts))
- var/obj/item/clothing/under/pants/short_type = short
+ for(var/obj/item/clothing/under/pants/short_type as anything in typesof(/obj/item/clothing/under/shorts))
shorts[initial(short_type.name)] = short_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(shorts))
@@ -212,8 +207,7 @@
/datum/gear/uniform/suit/lawyer/New()
..()
var/list/lsuits = list()
- for(var/lsuit in typesof(/obj/item/clothing/under/lawyer))
- var/obj/item/clothing/suit/lsuit_type = lsuit
+ for(var/obj/item/clothing/suit/lsuit_type as anything in typesof(/obj/item/clothing/under/lawyer))
lsuits[initial(lsuit_type.name)] = lsuit_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(lsuits))
@@ -273,8 +267,7 @@
/datum/gear/uniform/scrub/New()
..()
var/list/scrubs = list()
- for(var/scrub in typesof(/obj/item/clothing/under/rank/medical/scrubs))
- var/obj/item/clothing/under/rank/medical/scrubs/scrub_type = scrub
+ for(var/obj/item/clothing/under/rank/medical/scrubs/scrub_type as anything in typesof(/obj/item/clothing/under/rank/medical/scrubs))
scrubs[initial(scrub_type.name)] = scrub_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(scrubs))
@@ -396,8 +389,7 @@
/datum/gear/uniform/dresses/maid/New()
..()
var/list/maids = list()
- for(var/maid in typesof(/obj/item/clothing/under/dress/maid))
- var/obj/item/clothing/under/dress/maid/maid_type = maid
+ for(var/obj/item/clothing/under/dress/maid/maid_type as anything in typesof(/obj/item/clothing/under/dress/maid))
maids[initial(maid_type.name)] = maid_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(maids))
diff --git a/code/modules/client/preference_setup/loadout/loadout_uniform_vr.dm b/code/modules/client/preference_setup/loadout/loadout_uniform_vr.dm
index a165232e1a..448b7747e4 100644
--- a/code/modules/client/preference_setup/loadout/loadout_uniform_vr.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_uniform_vr.dm
@@ -183,8 +183,7 @@ Swimsuits
/datum/gear/uniform/swimsuits/New()
..()
var/list/swimsuits = list()
- for(var/swimsuit in typesof(/obj/item/weapon/storage/box/fluff/swimsuit))
- var/obj/item/weapon/storage/box/fluff/swimsuit/swimsuit_type = swimsuit
+ for(var/obj/item/weapon/storage/box/fluff/swimsuit/swimsuit_type as anything in typesof(/obj/item/weapon/storage/box/fluff/swimsuit))
swimsuits[initial(swimsuit_type.name)] = swimsuit_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(swimsuits))
diff --git a/code/modules/client/preference_setup/loadout/loadout_utility.dm b/code/modules/client/preference_setup/loadout/loadout_utility.dm
index 4798a4b994..d185ca2608 100644
--- a/code/modules/client/preference_setup/loadout/loadout_utility.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_utility.dm
@@ -21,8 +21,7 @@
/datum/gear/utility/communicator/New()
..()
var/list/communicators = list()
- for(var/communicator in typesof(/obj/item/device/communicator) - list(/obj/item/device/communicator/integrated,/obj/item/device/communicator/commlink)) //VOREStation Edit - Remove Commlink
- var/obj/item/device/communicator_type = communicator
+ for(var/obj/item/device/communicator_type as anything in typesof(/obj/item/device/communicator) - list(/obj/item/device/communicator/integrated,/obj/item/device/communicator/commlink)) //VOREStation Edit - Remove Commlink
communicators[initial(communicator_type.name)] = communicator_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(communicators))
diff --git a/code/modules/client/preferences_spawnpoints.dm b/code/modules/client/preferences_spawnpoints.dm
index 06f7aa5e06..455be8a8b8 100644
--- a/code/modules/client/preferences_spawnpoints.dm
+++ b/code/modules/client/preferences_spawnpoints.dm
@@ -2,7 +2,7 @@ var/list/spawntypes = list()
/proc/populate_spawn_points()
spawntypes = list()
- for(var/type in typesof(/datum/spawnpoint)-/datum/spawnpoint)
+ for(var/type in subtypesof(/datum/spawnpoint))
var/datum/spawnpoint/S = new type()
spawntypes[S.display_name] = S
diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm
index c0cde563a8..a69eee2e7f 100644
--- a/code/modules/clothing/chameleon.dm
+++ b/code/modules/clothing/chameleon.dm
@@ -24,15 +24,14 @@
. = list()
var/i = 1 //in case there is a collision with both name AND icon_state
- for(var/typepath in typesof(basetype) - blacklist)
- var/obj/O = typepath
+ for(var/obj/O as anything in typesof(basetype) - blacklist)
if(initial(O.icon) && initial(O.icon_state))
var/name = initial(O.name)
if(name in .)
name += " ([initial(O.icon_state)])"
if(name in .)
name += " \[[i++]\]"
- .[name] = typepath
+ .[name] = O
/obj/item/clothing/under/chameleon
//starts off as black
diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm
index d7415c4a75..c67d63e6a8 100644
--- a/code/modules/clothing/clothing_accessories.dm
+++ b/code/modules/clothing/clothing_accessories.dm
@@ -9,8 +9,7 @@
//Find all consumed slots
var/consumed_slots = 0
- for(var/thing in accessories)
- var/obj/item/clothing/accessory/AC = thing
+ for(var/obj/item/clothing/accessory/AC as anything in accessories)
consumed_slots |= AC.slot
//Mask to just consumed restricted
diff --git a/code/modules/clothing/head/pilot_helmet.dm b/code/modules/clothing/head/pilot_helmet.dm
index f2c3956e47..590cba4dd1 100644
--- a/code/modules/clothing/head/pilot_helmet.dm
+++ b/code/modules/clothing/head/pilot_helmet.dm
@@ -166,8 +166,7 @@
I.color = newcolor
/obj/item/clothing/head/pilot/Destroy()
- for(var/img in raw_images)
- var/image/I = img
+ for(var/image/I as anything in raw_images)
I.loc = null
shuttle_comp = null
qdel(pilot_hud)
diff --git a/code/modules/economy/economy_misc.dm b/code/modules/economy/economy_misc.dm
index a44c7c03fd..1b029ac74a 100644
--- a/code/modules/economy/economy_misc.dm
+++ b/code/modules/economy/economy_misc.dm
@@ -60,7 +60,7 @@ var/global/economy_init = 0
news_network.CreateFeedChannel("The Gibson Gazette", "Editor Mike Hammers", 1, 1)
news_network.CreateFeedChannel("Oculum Content Aggregator", "Oculus v6rev7", 1, 1)
- for(var/loc_type in typesof(/datum/trade_destination) - /datum/trade_destination)
+ for(var/loc_type in subtypesof(/datum/trade_destination))
var/datum/trade_destination/D = new loc_type
weighted_randomevent_locations[D] = D.viable_random_events.len
weighted_mundaneevent_locations[D] = D.mundane_probability
diff --git a/code/modules/emotes/emote_mob.dm b/code/modules/emotes/emote_mob.dm
index 2003fac6d6..7516be2eff 100644
--- a/code/modules/emotes/emote_mob.dm
+++ b/code/modules/emotes/emote_mob.dm
@@ -194,8 +194,7 @@
var/list/m_viewers = in_range["mobs"]
var/list/o_viewers = in_range["objs"]
- for(var/mob in m_viewers)
- var/mob/M = mob
+ for(var/mob/M as anything in m_viewers)
spawn(0) // It's possible that it could be deleted in the meantime, or that it runtimes.
if(M)
if(isobserver(M))
@@ -203,8 +202,7 @@
M.show_message(message, m_type)
M.create_chat_message(src, "[runemessage]", FALSE, list("emote"), (m_type == AUDIBLE_MESSAGE))
- for(var/obj in o_viewers)
- var/obj/O = obj
+ for(var/obj/O as anything in o_viewers)
spawn(0)
if(O)
O.see_emote(src, message, m_type)
diff --git a/code/modules/entopics_vr/alternate_appearance.dm b/code/modules/entopics_vr/alternate_appearance.dm
index 4fd7d31ed0..42b6d697f9 100644
--- a/code/modules/entopics_vr/alternate_appearance.dm
+++ b/code/modules/entopics_vr/alternate_appearance.dm
@@ -24,8 +24,7 @@
/datum/alternate_appearance/proc/display_to(list/displayTo)
if(!displayTo || !displayTo.len)
return
- for(var/m in displayTo)
- var/mob/M = m
+ for(var/mob/M as anything in displayTo)
if(!M.viewing_alternate_appearances)
M.viewing_alternate_appearances = list()
viewers |= M
@@ -42,8 +41,7 @@
if(hideFrom)
hiding = hideFrom
- for(var/m in hiding)
- var/mob/M = m
+ for(var/mob/M as anything in hiding)
if(M.client)
M.client.images -= img
if(M.viewing_alternate_appearances && M.viewing_alternate_appearances.len)
diff --git a/code/modules/entopics_vr/entopics.dm b/code/modules/entopics_vr/entopics.dm
index 1e146e0c05..a3ea9e35ab 100644
--- a/code/modules/entopics_vr/entopics.dm
+++ b/code/modules/entopics_vr/entopics.dm
@@ -77,8 +77,7 @@ var/global/list/alt_farmanimals = list()
registered = TRUE
entopic_images += my_image
- for(var/m in entopic_users)
- var/mob/M = m
+ for(var/mob/M as anything in entopic_users)
if(M.client)
M.client.images += my_image
@@ -88,8 +87,7 @@ var/global/list/alt_farmanimals = list()
registered = FALSE
entopic_images -= my_image
- for(var/m in entopic_users)
- var/mob/M = m
+ for(var/mob/M as anything in entopic_users)
if(M.client)
M.client.images -= my_image
diff --git a/code/modules/events/carp_migration.dm b/code/modules/events/carp_migration.dm
index 77612bbd25..fcbd1d951b 100644
--- a/code/modules/events/carp_migration.dm
+++ b/code/modules/events/carp_migration.dm
@@ -79,8 +79,7 @@
// Counts living carp spawned by this event.
/datum/event/carp_migration/proc/count_spawned_carps()
. = 0
- for(var/I in spawned_carp)
- var/mob/living/simple_mob/animal/M = I
+ for(var/mob/living/simple_mob/animal/M as anything in spawned_carp)
if(!QDELETED(M) && M.stat != DEAD)
. += 1
diff --git a/code/modules/events/grubinfestation_vr.dm b/code/modules/events/grubinfestation_vr.dm
index 685d59f3f2..8dcf1a20b1 100644
--- a/code/modules/events/grubinfestation_vr.dm
+++ b/code/modules/events/grubinfestation_vr.dm
@@ -32,8 +32,7 @@
/datum/event/grub_infestation/end()
var/list/area_names = list()
- for(var/grub in existing_solargrubs)
- var/mob/living/G = grub
+ for(var/mob/living/G as anything in existing_solargrubs)
if(!G || G.stat == DEAD)
continue
var/area/grub_area = get_area(G)
diff --git a/code/modules/events/supply_demand_vr.dm b/code/modules/events/supply_demand_vr.dm
index 64d402c443..6e229e1b48 100644
--- a/code/modules/events/supply_demand_vr.dm
+++ b/code/modules/events/supply_demand_vr.dm
@@ -252,7 +252,7 @@
//
/datum/event/supply_demand/proc/choose_food_items(var/differentTypes)
- var/list/types = typesof(/datum/recipe) - /datum/recipe
+ var/list/types = subtypesof(/datum/recipe)
for(var/i in 1 to differentTypes)
var/datum/recipe/R = pick(types)
types -= R // Don't pick the same thing twice
@@ -262,7 +262,7 @@
return
/datum/event/supply_demand/proc/choose_research_items(var/differentTypes)
- var/list/types = typesof(/datum/design) - /datum/design
+ var/list/types = subtypesof(/datum/design)
for(var/i in 1 to differentTypes)
var/datum/design/D = pick(types)
types -= D // Don't pick the same thing twice
@@ -327,7 +327,7 @@
return
/datum/event/supply_demand/proc/choose_alloy_items(var/differentTypes)
- var/list/types = typesof(/datum/alloy) - /datum/alloy
+ var/list/types = subtypesof(/datum/alloy)
for(var/i in 1 to differentTypes)
var/datum/alloy/A = pick(types)
types -= A // Don't pick the same thing twice
diff --git a/code/modules/food/food/lunch.dm b/code/modules/food/food/lunch.dm
index 6bbd434e43..81e75fa254 100644
--- a/code/modules/food/food/lunch.dm
+++ b/code/modules/food/food/lunch.dm
@@ -106,9 +106,8 @@ var/list/lunchables_ethanol_reagents_ = list(/datum/reagent/ethanol/acid_spit,
/proc/init_lunchable_list(var/list/lunches)
. = list()
- for(var/lunch in lunches)
- var/obj/O = lunch
- .[initial(O.name)] = lunch
+ for(var/obj/O as anything in lunches)
+ .[initial(O.name)] = O
return sortAssoc(.)
/proc/init_lunchable_reagent_list(var/list/banned_reagents, var/reagent_types)
diff --git a/code/modules/food/food/snacks.dm b/code/modules/food/food/snacks.dm
index d1ef64d081..4b78169387 100644
--- a/code/modules/food/food/snacks.dm
+++ b/code/modules/food/food/snacks.dm
@@ -4155,8 +4155,7 @@
//Calculate the reagents of the coating needed
var/req = 0
- for (var/r in reagents.reagent_list)
- var/datum/reagent/R = r
+ for(var/datum/reagent/R as anything in reagents.reagent_list)
if (istype(R, /datum/reagent/nutriment))
req += R.volume * 0.2
else
@@ -4238,8 +4237,7 @@
if (do_coating_prefix == 1)
name = "[coating.coated_adj] [name]"
- for (var/r in reagents.reagent_list)
- var/datum/reagent/R = r
+ for(var/datum/reagent/R as anything in reagents.reagent_list)
if (istype(R, /datum/reagent/nutriment/coating))
var/datum/reagent/nutriment/coating/C = R
C.data["cooked"] = 1
diff --git a/code/modules/food/kitchen/cooking_machines/_appliance.dm b/code/modules/food/kitchen/cooking_machines/_appliance.dm
index db3025f961..8847e99580 100644
--- a/code/modules/food/kitchen/cooking_machines/_appliance.dm
+++ b/code/modules/food/kitchen/cooking_machines/_appliance.dm
@@ -53,14 +53,12 @@
if (!available_recipes)
available_recipes = new
- for(var/type in subtypesof(/datum/recipe))
- var/datum/recipe/test = type
+ for(var/datum/recipe/test as anything in subtypesof(/datum/recipe))
if((appliancetype & initial(test.appliance)))
available_recipes += new test
/obj/machinery/appliance/Destroy()
- for (var/a in cooking_objs)
- var/datum/cooking_item/CI = a
+ for(var/datum/cooking_item/CI as anything in cooking_objs)
qdel(CI.container)//Food is fragile, it probably doesnt survive the destruction of the machine
cooking_objs -= CI
qdel(CI)
@@ -74,8 +72,7 @@
/obj/machinery/appliance/proc/list_contents(var/mob/user)
if (cooking_objs.len)
var/string = "Contains..."
- for (var/a in cooking_objs)
- var/datum/cooking_item/CI = a
+ for(var/datum/cooking_item/CI as anything in cooking_objs)
string += "-\a [CI.container.label(null, CI.combine_target)], [report_progress(CI)]"
return string
else
@@ -343,8 +340,7 @@
for (var/obj/item/J in CI.container)
cookwork_by_item(J, CI)
- for (var/r in CI.container.reagents.reagent_list)
- var/datum/reagent/R = r
+ for(var/datum/reagent/R as anything in CI.container.reagents.reagent_list)
if (istype(R, /datum/reagent/nutriment))
CI.max_cookwork += R.volume *2//Added reagents contribute less than those in food items due to granular form
@@ -373,8 +369,7 @@
var/work = 0
if (istype(S))
if (S.reagents)
- for (var/r in S.reagents.reagent_list)
- var/datum/reagent/R = r
+ for(var/datum/reagent/R as anything in S.reagents.reagent_list)
if (istype(R, /datum/reagent/nutriment))
work += R.volume *3//Core nutrients contribute much more than peripheral chemicals
@@ -463,8 +458,7 @@
results += TR
- for (var/r in results)
- var/obj/item/weapon/reagent_containers/food/snacks/R = r
+ for(var/obj/item/weapon/reagent_containers/food/snacks/R as anything in results)
R.forceMove(C) //Move everything from the buffer back to the container
R.cooked |= cook_type
@@ -608,8 +602,7 @@
/obj/machinery/appliance/proc/removal_menu(var/mob/user)
if (can_remove_items(user))
var/list/menuoptions = list()
- for (var/a in cooking_objs)
- var/datum/cooking_item/CI = a
+ for(var/datum/cooking_item/CI as anything in cooking_objs)
if (CI.container)
menuoptions[CI.container.label(menuoptions.len)] = CI
diff --git a/code/modules/food/kitchen/cooking_machines/_mixer.dm b/code/modules/food/kitchen/cooking_machines/_mixer.dm
index 24b0371cfd..7d18865167 100644
--- a/code/modules/food/kitchen/cooking_machines/_mixer.dm
+++ b/code/modules/food/kitchen/cooking_machines/_mixer.dm
@@ -80,8 +80,7 @@ fundamental differences
/obj/machinery/appliance/mixer/removal_menu(var/mob/user)
if (can_remove_items(user))
var/list/menuoptions = list()
- for (var/a in cooking_objs)
- var/datum/cooking_item/CI = a
+ for(var/datum/cooking_item/CI as anything in cooking_objs)
if (CI.container)
if (!CI.container.check_contents())
to_chat(user, "There's nothing in [src] you can remove!")
diff --git a/code/modules/food/kitchen/microwave.dm b/code/modules/food/kitchen/microwave.dm
index bb9ef2a255..b781c4473b 100644
--- a/code/modules/food/kitchen/microwave.dm
+++ b/code/modules/food/kitchen/microwave.dm
@@ -43,8 +43,7 @@
if(!available_recipes)
available_recipes = new
- for(var/T in (typesof(/datum/recipe)-/datum/recipe))
- var/datum/recipe/type = T
+ for(var/datum/recipe/type as anything in subtypesof(/datum/recipe))
if((initial(type.appliance) & appliancetype))
available_recipes += new type
@@ -423,8 +422,7 @@
valid = 1
sleep(2)
- for(var/r in cooked_items)
- var/atom/movable/R = r
+ for(var/atom/movable/R as anything in cooked_items)
R.forceMove(src) //Move everything from the buffer back to the container
QDEL_NULL(temp)//Delete buffer object
diff --git a/code/modules/food/recipe_dump.dm b/code/modules/food/recipe_dump.dm
index 63dc510eb9..dffce315e4 100644
--- a/code/modules/food/recipe_dump.dm
+++ b/code/modules/food/recipe_dump.dm
@@ -15,7 +15,7 @@
"Catalysts" = CR.catalysts)
//////////////////////// FOOD
- var/list/food_recipes = typesof(/datum/recipe) - /datum/recipe
+ var/list/food_recipes = subtypesof(/datum/recipe)
//Build a useful list
for(var/Rp in food_recipes)
//Lists don't work with datum-stealing no-instance initial() so we have to.
diff --git a/code/modules/gamemaster/event2/event.dm b/code/modules/gamemaster/event2/event.dm
index 4432be40ab..b9f1d92648 100644
--- a/code/modules/gamemaster/event2/event.dm
+++ b/code/modules/gamemaster/event2/event.dm
@@ -88,8 +88,7 @@ This allows for events that have their announcement happen after the end itself.
if(!LAZYLEN(grand_list_of_areas))
return list()
- for(var/thing in grand_list_of_areas)
- var/list/A = thing
+ for(var/list/A as anything in grand_list_of_areas)
var/list/turfs = list()
for(var/turf/T in A)
if(!T.check_density())
@@ -107,8 +106,7 @@ This allows for events that have their announcement happen after the end itself.
var/list/area/grand_list_of_areas = get_all_existing_areas_of_types(specific_areas)
. = list()
- for(var/thing in shuffle(grand_list_of_areas))
- var/area/A = thing
+ for(var/area/A as anything in shuffle(grand_list_of_areas))
if(A.forbid_events)
continue
if(!(A.z in get_location_z_levels()))
diff --git a/code/modules/gamemaster/event2/events/engineering/blob.dm b/code/modules/gamemaster/event2/events/engineering/blob.dm
index 3ace8f0894..f3b8a16f8d 100644
--- a/code/modules/gamemaster/event2/events/engineering/blob.dm
+++ b/code/modules/gamemaster/event2/events/engineering/blob.dm
@@ -111,16 +111,14 @@
log_debug("Spawned [new_blob.overmind.blob_type.name] blob at [get_area(new_blob)].")
/datum/event2/event/blob/should_end()
- for(var/WR in blobs)
- var/weakref/weakref = WR
+ for(var/weakref/weakref as anything in blobs)
if(weakref.resolve()) // If the weakref is resolvable, that means the blob hasn't been deleted yet.
return FALSE
return TRUE // Only end if all blobs die.
// Normally this does nothing, but is useful if aborted by an admin.
/datum/event2/event/blob/end()
- for(var/WR in blobs)
- var/weakref/weakref = WR
+ for(var/weakref/weakref as anything in blobs)
var/obj/structure/blob/core/B = weakref.resolve()
if(istype(B))
qdel(B)
@@ -130,8 +128,7 @@
var/danger_level = 0
var/list/blob_type_names = list()
var/multiblob = FALSE
- for(var/WR in blobs)
- var/weakref/weakref = WR
+ for(var/weakref/weakref as anything in blobs)
var/obj/structure/blob/core/B = weakref.resolve()
if(!istype(B))
continue
diff --git a/code/modules/gamemaster/event2/events/engineering/grid_check.dm b/code/modules/gamemaster/event2/events/engineering/grid_check.dm
index 8b081f29e2..b4ae7976b6 100644
--- a/code/modules/gamemaster/event2/events/engineering/grid_check.dm
+++ b/code/modules/gamemaster/event2/events/engineering/grid_check.dm
@@ -15,8 +15,7 @@
// Having the turbines be way over their rated limit makes grid checks more likely.
/datum/event2/meta/grid_check/proc/get_overpower()
var/highest_overpower = 0
- for(var/T in GLOB.all_turbines)
- var/obj/machinery/power/generator/turbine = T
+ for(var/obj/machinery/power/generator/turbine as anything in GLOB.all_turbines)
var/overpower = max((turbine.effective_gen / turbine.max_power) - 1, 0)
if(overpower > highest_overpower)
highest_overpower = overpower
@@ -35,8 +34,7 @@
/datum/event2/event/grid_check/set_up()
// Find the turbine being pushed the most.
var/obj/machinery/power/generator/most_stressed_turbine = null
- for(var/T in GLOB.all_turbines)
- var/obj/machinery/power/generator/turbine = T
+ for(var/obj/machinery/power/generator/turbine as anything in GLOB.all_turbines)
if(!most_stressed_turbine)
most_stressed_turbine = turbine
else if(turbine.effective_gen > most_stressed_turbine.effective_gen)
diff --git a/code/modules/gamemaster/event2/events/mob_spawning.dm b/code/modules/gamemaster/event2/events/mob_spawning.dm
index 78b1eac69c..4f3bcffa02 100644
--- a/code/modules/gamemaster/event2/events/mob_spawning.dm
+++ b/code/modules/gamemaster/event2/events/mob_spawning.dm
@@ -66,10 +66,9 @@
// In the future, a new AI stance that handles long distance travel using getline() could work.
var/max_distance = 8
var/turf/spawn_turf = null
- for(var/P in space_line)
- var/turf/point = P
+ for(var/turf/point as anything in space_line)
if(get_dist(point, edge_of_station) <= max_distance)
- spawn_turf = P
+ spawn_turf = point
break
if(spawn_turf)
@@ -88,8 +87,7 @@
// Counts living simple_mobs spawned by this event.
/datum/event2/event/mob_spawning/proc/count_spawned_mobs()
. = 0
- for(var/I in spawned_mobs)
- var/mob/living/simple_mob/M = I
+ for(var/mob/living/simple_mob/M as anything in spawned_mobs)
if(!QDELETED(M) && M.stat != DEAD)
. += 1
diff --git a/code/modules/genetics/side_effects.dm b/code/modules/genetics/side_effects.dm
index 498aff20d0..958f05d5ac 100644
--- a/code/modules/genetics/side_effects.dm
+++ b/code/modules/genetics/side_effects.dm
@@ -67,7 +67,7 @@
/proc/trigger_side_effect(mob/living/carbon/human/H)
spawn
if(!istype(H)) return
- var/tp = pick(typesof(/datum/genetics/side_effect) - /datum/genetics/side_effect)
+ var/tp = pick(subtypesof(/datum/genetics/side_effect))
var/datum/genetics/side_effect/S = new tp
S.start(H)
diff --git a/code/modules/holomap/mapper.dm b/code/modules/holomap/mapper.dm
index b99d2928c1..40a8f433bb 100644
--- a/code/modules/holomap/mapper.dm
+++ b/code/modules/holomap/mapper.dm
@@ -280,8 +280,7 @@
extras_holder.pixel_y = bgmap.pixel_y = -1*T_y + offset_y
// Populate other mapper icons
- for(var/hc in mapping_units)
- var/obj/item/device/mapping_unit/HC = hc
+ for(var/obj/item/device/mapping_unit/HC as anything in mapping_units)
if(HC.mapper_filter != mapper_filter)
continue
var/mob_indicator = HOLOMAP_ERROR
@@ -340,8 +339,7 @@
extras += mark
// Marker beacon items
- for(var/hb in mapping_beacons)
- var/obj/item/device/holomap_beacon/HB = hb
+ for(var/obj/item/device/holomap_beacon/HB as anything in mapping_beacons)
if(HB.mapper_filter != mapper_filter)
continue
diff --git a/code/modules/hydroponics/spreading/spreading_growth.dm b/code/modules/hydroponics/spreading/spreading_growth.dm
index 99929ea360..b8f8701205 100644
--- a/code/modules/hydroponics/spreading/spreading_growth.dm
+++ b/code/modules/hydroponics/spreading/spreading_growth.dm
@@ -74,8 +74,7 @@
plant.layer = layer + 0.1
if(has_buckled_mobs())
- for(var/A in buckled_mobs)
- var/mob/living/L = A
+ for(var/mob/living/L as anything in buckled_mobs)
seed.do_sting(L,src)
if(seed.get_trait(TRAIT_CARNIVOROUS))
seed.do_thorns(L,src)
diff --git a/code/modules/hydroponics/spreading/spreading_response.dm b/code/modules/hydroponics/spreading/spreading_response.dm
index ab22ae15df..b9e64b8d32 100644
--- a/code/modules/hydroponics/spreading/spreading_response.dm
+++ b/code/modules/hydroponics/spreading/spreading_response.dm
@@ -49,8 +49,7 @@
/obj/effect/plant/proc/unbuckle()
if(has_buckled_mobs())
- for(var/A in buckled_mobs)
- var/mob/living/L = A
+ for(var/mob/living/L as anything in buckled_mobs)
if(L.buckled == src)
L.buckled = null
L.anchored = initial(L.anchored)
@@ -64,8 +63,7 @@
if(seed)
chance = round(100/(20*seed.get_trait(TRAIT_POTENCY)/100))
if(prob(chance))
- for(var/A in buckled_mobs)
- var/mob/living/L = A
+ for(var/mob/living/L as anything in buckled_mobs)
if(!(user in buckled_mobs))
L.visible_message(\
"\The [user] frees \the [L] from \the [src].",\
diff --git a/code/modules/identification/identification.dm b/code/modules/identification/identification.dm
index 6ddcdbb075..99ed8bc633 100644
--- a/code/modules/identification/identification.dm
+++ b/code/modules/identification/identification.dm
@@ -97,8 +97,7 @@
return "unidentified object"
var/list/new_name = list()
- for(var/i in naming_lists)
- var/list/current_list = i
+ for(var/list/current_list as anything in naming_lists)
new_name += pick(current_list)
return new_name.Join(" ")
diff --git a/code/modules/instruments/instrument_data/_instrument_data.dm b/code/modules/instruments/instrument_data/_instrument_data.dm
index 39d16e499f..7cede360a2 100644
--- a/code/modules/instruments/instrument_data/_instrument_data.dm
+++ b/code/modules/instruments/instrument_data/_instrument_data.dm
@@ -70,8 +70,7 @@
/datum/instrument/Destroy()
SSinstruments.instrument_data -= id
- for(var/i in songs_using)
- var/datum/song/S = i
+ for(var/datum/song/S as anything in songs_using)
S.set_instrument(null)
real_samples = null
samples = null
diff --git a/code/modules/instruments/items.dm b/code/modules/instruments/items.dm
index 455c10e5cb..31d4c396cc 100644
--- a/code/modules/instruments/items.dm
+++ b/code/modules/instruments/items.dm
@@ -296,8 +296,7 @@
/obj/item/instrument/harmonica,
/obj/item/instrument/piano_synth/headphones
)
- for(var/V in templist)
- var/atom/A = V
+ for(var/atom/A as anything in templist)
instruments[initial(A.name)] = A
return instruments
*/
diff --git a/code/modules/instruments/songs/play_legacy.dm b/code/modules/instruments/songs/play_legacy.dm
index e8666f7867..9d7ba493d4 100644
--- a/code/modules/instruments/songs/play_legacy.dm
+++ b/code/modules/instruments/songs/play_legacy.dm
@@ -80,8 +80,7 @@
if((world.time - MUSICIAN_HEARCHECK_MINDELAY) > last_hearcheck)
do_hearcheck()
var/sound/music_played = sound(soundfile)
- for(var/i in hearing_mobs)
- var/mob/M = i
+ for(var/mob/M as anything in hearing_mobs)
/* Would be nice
if(user && HAS_TRAIT(user, TRAIT_MUSICIAN) && isliving(M))
var/mob/living/L = M
diff --git a/code/modules/instruments/songs/play_synthesized.dm b/code/modules/instruments/songs/play_synthesized.dm
index d8b10654d5..63369228aa 100644
--- a/code/modules/instruments/songs/play_synthesized.dm
+++ b/code/modules/instruments/songs/play_synthesized.dm
@@ -61,8 +61,7 @@
channels_playing[channel_text] = 100
last_channel_played = channel_text
var/turf/source = get_turf(parent)
- for(var/i in hearing_mobs)
- var/mob/M = i
+ for(var/mob/M as anything in hearing_mobs)
/* Maybe someday
if(user && HAS_TRAIT(user, TRAIT_MUSICIAN) && isliving(M))
var/mob/living/L = M
@@ -142,10 +141,8 @@
if(dead)
channels_playing -= channel
channels_idle += channel
- for(var/i in hearing_mobs)
- var/mob/M = i
+ for(var/mob/M as anything in hearing_mobs)
M.stop_sound_channel(channelnumber)
else
- for(var/i in hearing_mobs)
- var/mob/M = i
+ for(var/mob/M as anything in hearing_mobs)
M.set_sound_channel_volume(channelnumber, (current_volume * 0.01) * volume * using_instrument.volume_multiplier)
diff --git a/code/modules/looking_glass/lg_area.dm b/code/modules/looking_glass/lg_area.dm
index b17c67449f..25d3bd7a3d 100644
--- a/code/modules/looking_glass/lg_area.dm
+++ b/code/modules/looking_glass/lg_area.dm
@@ -38,8 +38,7 @@
/area/looking_glass/proc/begin_program(var/image/newimage)
if(!active)
- for(var/trf in our_turfs)
- var/turf/simulated/floor/looking_glass/lgt = trf
+ for(var/turf/simulated/floor/looking_glass/lgt as anything in our_turfs)
lgt.activate()
our_landmark.take_image(newimage)
@@ -47,8 +46,7 @@
/area/looking_glass/proc/end_program()
if(active)
- for(var/trf in our_turfs)
- var/turf/simulated/floor/looking_glass/lgt = trf
+ for(var/turf/simulated/floor/looking_glass/lgt as anything in our_turfs)
lgt.deactivate()
active = FALSE
@@ -57,8 +55,7 @@
our_landmark.drop_image()
/area/looking_glass/proc/toggle_optional(var/transparent)
- for(var/trf in our_optional_turfs)
- var/turf/simulated/floor/looking_glass/lgt = trf
+ for(var/turf/simulated/floor/looking_glass/lgt as anything in our_optional_turfs)
lgt.center = !transparent
if(active)
lgt.deactivate()
diff --git a/code/modules/maps/tg/map_template.dm b/code/modules/maps/tg/map_template.dm
index 8cc742c508..3e530206a4 100644
--- a/code/modules/maps/tg/map_template.dm
+++ b/code/modules/maps/tg/map_template.dm
@@ -49,8 +49,7 @@
var/list/obj/machinery/atmospherics/atmos_machines = list()
var/list/turf/turfs = block(locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]),
locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ]))
- for(var/L in turfs)
- var/turf/B = L
+ for(var/turf/B as anything in turfs)
atoms += B
areas |= B.loc
for(var/A in B)
@@ -71,8 +70,7 @@
SSmachines.setup_powernets_for_cables(cables)
// Ensure all machines in loaded areas get notified of power status
- for(var/I in areas)
- var/area/A = I
+ for(var/area/A as anything in areas)
A.power_change()
if(machinery_was_awake)
diff --git a/code/modules/media/media_machinery.dm b/code/modules/media/media_machinery.dm
index 3957ff9005..bbde62a347 100644
--- a/code/modules/media/media_machinery.dm
+++ b/code/modules/media/media_machinery.dm
@@ -48,8 +48,7 @@
// Update Media Source.
A.media_source = null
// Clients
- for(var/m in mobs_in_area(A))
- var/mob/M = m
+ for(var/mob/M as anything in mobs_in_area(A))
M.update_music()
master_area = null
diff --git a/code/modules/mining/abandonedcrates.dm b/code/modules/mining/abandonedcrates.dm
index 199b1ed0d0..2896f7feea 100644
--- a/code/modules/mining/abandonedcrates.dm
+++ b/code/modules/mining/abandonedcrates.dm
@@ -58,7 +58,7 @@
if(53 to 54)
new/obj/item/latexballon(src)
if(55 to 56)
- var/newitem = pick(typesof(/obj/item/toy/mecha) - /obj/item/toy/mecha)
+ var/newitem = pick(subtypesof(/obj/item/toy/mecha))
new newitem(src)
if(57 to 58)
new/obj/item/toy/syndicateballoon(src)
@@ -77,7 +77,7 @@
if(67 to 68)
var/t = rand(4,7)
for(var/i = 0, i < t, ++i)
- var/newitem = pick(typesof(/obj/item/weapon/stock_parts) - /obj/item/weapon/stock_parts - /obj/item/weapon/stock_parts/subspace)
+ var/newitem = pick(subtypesof(/obj/item/weapon/stock_parts) - /obj/item/weapon/stock_parts/subspace)
new newitem(src)
if(69 to 70)
new/obj/item/weapon/pickaxe/silver(src)
diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm
index f5c74a2f8b..c5c939b2f1 100644
--- a/code/modules/mining/fulton.dm
+++ b/code/modules/mining/fulton.dm
@@ -18,8 +18,7 @@ var/global/list/total_extraction_beacons = list()
/obj/item/extraction_pack/attack_self(mob/user)
var/list/possible_beacons = list()
- for(var/B in global.total_extraction_beacons)
- var/obj/structure/extraction_point/EP = B
+ for(var/obj/structure/extraction_point/EP as anything in global.total_extraction_beacons)
if(EP.beacon_network in beacon_networks)
possible_beacons += EP
diff --git a/code/modules/mining/machinery/machine_stacking.dm b/code/modules/mining/machinery/machine_stacking.dm
index 030c52f764..b0b2a7890e 100644
--- a/code/modules/mining/machinery/machine_stacking.dm
+++ b/code/modules/mining/machinery/machine_stacking.dm
@@ -89,11 +89,10 @@
/obj/machinery/mineral/stacking_machine/New()
..()
- for(var/stacktype in (subtypesof(/obj/item/stack/material) - typesof(/obj/item/stack/material/cyborg)))
- var/obj/item/stack/material/S = stacktype
+ for(var/obj/item/stack/material/S as anything in (subtypesof(/obj/item/stack/material) - typesof(/obj/item/stack/material/cyborg)))
var/s_matname = initial(S.default_type)
stack_storage[s_matname] = 0
- stack_paths[s_matname] = stacktype
+ stack_paths[s_matname] = S
spawn( 5 )
for (var/dir in cardinal)
diff --git a/code/modules/mob/animations.dm b/code/modules/mob/animations.dm
index 9b9ce3957f..fe64242795 100644
--- a/code/modules/mob/animations.dm
+++ b/code/modules/mob/animations.dm
@@ -237,8 +237,7 @@ note dizziness decrements automatically in the mob's Life() proc.
//Check for clients with pref enabled
var/list/viewing = list()
- for(var/m in viewers(A))
- var/mob/M = m
+ for(var/mob/M as anything in viewers(A))
var/client/C = M.client
if(C && C.is_preference_enabled(/datum/client_preference/attack_icons))
viewing += M.client
diff --git a/code/modules/mob/freelook/ai/chunk.dm b/code/modules/mob/freelook/ai/chunk.dm
index 2a689c1473..ebd68a6206 100644
--- a/code/modules/mob/freelook/ai/chunk.dm
+++ b/code/modules/mob/freelook/ai/chunk.dm
@@ -7,8 +7,7 @@
var/list/cameras = list()
/datum/chunk/camera/acquireVisibleTurfs(var/list/visible)
- for(var/camera in cameras)
- var/obj/machinery/camera/c = camera
+ for(var/obj/machinery/camera/c as anything in cameras)
if(!istype(c))
cameras -= c
diff --git a/code/modules/mob/freelook/chunk.dm b/code/modules/mob/freelook/chunk.dm
index da2d84701c..4ae5d3a590 100644
--- a/code/modules/mob/freelook/chunk.dm
+++ b/code/modules/mob/freelook/chunk.dm
@@ -86,20 +86,17 @@
visibleTurfs = newVisibleTurfs
obscuredTurfs = turfs - newVisibleTurfs
- for(var/turf in visAdded)
- var/turf/t = turf
+ for(var/turf/t as anything in visAdded)
if(LAZYLEN(t.obfuscations) && t.obfuscations[obfuscation.type])
obscured -= t.obfuscations[obfuscation.type]
- for(var/eye in seenby)
- var/mob/observer/eye/m = eye
+ for(var/mob/observer/eye/m as anything in seenby)
if(!m)
continue
var/client/client = m.GetViewerClient()
if(client)
client.images -= t.obfuscations[obfuscation.type]
- for(var/turf in visRemoved)
- var/turf/t = turf
+ for(var/turf/t as anything in visRemoved)
if(obscuredTurfs[t])
LAZYINITLIST(t.obfuscations)
if(!t.obfuscations[obfuscation.type])
@@ -108,8 +105,7 @@
t.obfuscations[obfuscation.type] = ob_image
obscured += t.obfuscations[obfuscation.type]
- for(var/eye in seenby)
- var/mob/observer/eye/m = eye
+ for(var/mob/observer/eye/m as anything in seenby)
if(!m)
seenby -= m
continue
@@ -142,8 +138,7 @@
obscuredTurfs = turfs - visibleTurfs
- for(var/turf in obscuredTurfs)
- var/turf/t = turf
+ for(var/turf/t as anything in obscuredTurfs)
LAZYINITLIST(t.obfuscations)
if(!t.obfuscations[obfuscation.type])
var/image/ob_image = image(obfuscation.icon, t, obfuscation.icon_state, OBFUSCATION_LAYER)
diff --git a/code/modules/mob/freelook/visualnet.dm b/code/modules/mob/freelook/visualnet.dm
index 44cd9278cc..1508a30133 100644
--- a/code/modules/mob/freelook/visualnet.dm
+++ b/code/modules/mob/freelook/visualnet.dm
@@ -49,8 +49,7 @@
var/list/chunks_pre_seen = list()
var/list/chunks_post_seen = list()
- for(var/V in moved_eyes)
- var/mob/observer/eye/eye = V
+ for(var/mob/observer/eye/eye as anything in moved_eyes)
if(C)
chunks_pre_seen |= eye.visibleChunks
// 0xf = 15
@@ -69,31 +68,26 @@
var/list/remove = eye.visibleChunks - visibleChunks
var/list/add = visibleChunks - eye.visibleChunks
- for(var/chunk in remove)
- var/datum/chunk/c = chunk
+ for(var/datum/chunk/c as anything in remove)
c.remove(eye, FALSE)
- for(var/chunk in add)
- var/datum/chunk/c = chunk
+ for(var/datum/chunk/c as anything in add)
c.add(eye, FALSE)
if(C)
chunks_post_seen |= eye.visibleChunks
if(C)
- for(var/V in other_eyes)
- var/mob/observer/eye/eye = V
+ for(var/mob/observer/eye/eye as anything in other_eyes)
chunks_post_seen |= eye.visibleChunks
var/list/remove = chunks_pre_seen - chunks_post_seen
var/list/add = chunks_post_seen - chunks_pre_seen
- for(var/chunk in remove)
- var/datum/chunk/c = chunk
+ for(var/datum/chunk/c as anything in remove)
C.images -= c.obscured
- for(var/chunk in add)
- var/datum/chunk/c = chunk
+ for(var/datum/chunk/c as anything in add)
C.images += c.obscured
// Updates the chunks that the turf is located in. Use this when obstacles are destroyed or when doors open.
diff --git a/code/modules/mob/living/carbon/human/MedicalSideEffects.dm b/code/modules/mob/living/carbon/human/MedicalSideEffects.dm
index 9af2957074..6946f26a80 100644
--- a/code/modules/mob/living/carbon/human/MedicalSideEffects.dm
+++ b/code/modules/mob/living/carbon/human/MedicalSideEffects.dm
@@ -56,7 +56,7 @@
if(life_tick % 15 != 0)
return 0
- var/list/L = typesof(/datum/medical_effect)-/datum/medical_effect
+ var/list/L = subtypesof(/datum/medical_effect)
for(var/T in L)
var/datum/medical_effect/M = new T
if (M.manifest(src))
diff --git a/code/modules/mob/living/carbon/human/chem_side_effects.dm b/code/modules/mob/living/carbon/human/chem_side_effects.dm
index 9af2957074..6946f26a80 100644
--- a/code/modules/mob/living/carbon/human/chem_side_effects.dm
+++ b/code/modules/mob/living/carbon/human/chem_side_effects.dm
@@ -56,7 +56,7 @@
if(life_tick % 15 != 0)
return 0
- var/list/L = typesof(/datum/medical_effect)-/datum/medical_effect
+ var/list/L = subtypesof(/datum/medical_effect)
for(var/T in L)
var/datum/medical_effect/M = new T
if (M.manifest(src))
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index c61b4724d5..1ed1ad847d 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -751,7 +751,7 @@
update_eyes()
// hair
- var/list/all_hairs = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair
+ var/list/all_hairs = subtypesof(/datum/sprite_accessory/hair)
var/list/hairs = list()
// loop through potential hairs
@@ -767,7 +767,7 @@
h_style = new_style
// facial hair
- var/list/all_fhairs = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair
+ var/list/all_fhairs = subtypesof(/datum/sprite_accessory/facial_hair)
var/list/fhairs = list()
for(var/x in all_fhairs)
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 62fef2744d..e43a1de6b6 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -135,8 +135,7 @@ emp_act
siemens_coefficient *= C.siemens_coefficient
// Modifiers.
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
if(!isnull(M.siemens_coefficient))
siemens_coefficient *= M.siemens_coefficient
@@ -181,8 +180,7 @@ emp_act
for(var/obj/item/clothing/gear in protective_gear)
protection += gear.armor[type]
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
var/modifier_armor = LAZYACCESS(M.armor_percent, type)
if(modifier_armor)
protection += modifier_armor
@@ -197,8 +195,7 @@ emp_act
for(var/obj/item/clothing/gear in protective_gear)
soaked += gear.armorsoak[type]
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
var/modifier_armor = LAZYACCESS(M.armor_flat, type)
if(modifier_armor)
soaked += modifier_armor
diff --git a/code/modules/mob/living/carbon/human/human_modular_limbs.dm b/code/modules/mob/living/carbon/human/human_modular_limbs.dm
index 81d4af05ce..4010a2d487 100644
--- a/code/modules/mob/living/carbon/human/human_modular_limbs.dm
+++ b/code/modules/mob/living/carbon/human/human_modular_limbs.dm
@@ -58,8 +58,7 @@
// Checks the organ list for limbs meeting a predicate. Way overengineered for such a limited use
// case but I can see it being expanded in the future if meat limbs or doona limbs use it.
/mob/living/carbon/human/proc/get_modular_limbs(var/return_first_found = FALSE, var/validate_proc)
- for(var/bp in organs)
- var/obj/item/organ/external/E = bp
+ for(var/obj/item/organ/external/E as anything in organs)
if(!validate_proc || call(E, validate_proc)(src) > MODULAR_BODYPART_INVALID)
LAZYADD(., E)
if(return_first_found)
@@ -67,8 +66,7 @@
// Prune children so we can't remove every individual component of an entire prosthetic arm
// piece by piece. Technically a circular dependency here would remove the limb entirely but
// if there's a parent whose child is also its parent, there's something wrong regardless.
- for(var/bp in .)
- var/obj/item/organ/external/E = bp
+ for(var/obj/item/organ/external/E as anything in .)
if(length(E.children))
. -= E.children
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index d091f43298..cc5ad6f2ff 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -846,8 +846,7 @@
. = 1 - . // Invert from 1 = immunity to 0 = immunity.
// Doing it this way makes multiplicative stacking not get out of hand, so two modifiers that give 0.5 protection will be combined to 0.75 in the end.
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
if(!isnull(M.heat_protection))
. *= 1 - M.heat_protection
@@ -866,8 +865,7 @@
. = 1 - . // Invert from 1 = immunity to 0 = immunity.
// Doing it this way makes multiplicative stacking not get out of hand, so two modifiers that give 0.5 protection will be combined to 0.75 in the end.
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
if(!isnull(M.cold_protection))
// Invert the modifier values so they align with the current working value.
. *= 1 - M.cold_protection
diff --git a/code/modules/mob/living/carbon/human/species/shadekin/shadekin_abilities.dm b/code/modules/mob/living/carbon/human/species/shadekin/shadekin_abilities.dm
index 6f81a53f6b..b26d57a82b 100644
--- a/code/modules/mob/living/carbon/human/species/shadekin/shadekin_abilities.dm
+++ b/code/modules/mob/living/carbon/human/species/shadekin/shadekin_abilities.dm
@@ -91,8 +91,7 @@
ability_flags &= ~AB_PHASE_SHIFTED
mouse_opacity = 1
name = real_name
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = initial(B.escapable)
//cut_overlays()
@@ -140,8 +139,7 @@
custom_emote(1,"phases out!")
name = "Something"
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = FALSE
var/obj/effect/temp_visual/shadekin/phase_out/phaseanim = new /obj/effect/temp_visual/shadekin/phase_out(src.loc)
diff --git a/code/modules/mob/living/carbon/human/species/species_shapeshift_vr.dm b/code/modules/mob/living/carbon/human/species/species_shapeshift_vr.dm
index aab6fdd40b..fbd1921c55 100644
--- a/code/modules/mob/living/carbon/human/species/species_shapeshift_vr.dm
+++ b/code/modules/mob/living/carbon/human/species/species_shapeshift_vr.dm
@@ -171,8 +171,7 @@
last_special = world.time + 50
- for(var/limb in src.organs)
- var/obj/item/organ/external/L = limb
+ for(var/obj/item/organ/external/L as anything in src.organs)
L.transparent = !L.transparent
visible_message("\The [src]'s interal composition seems to change.")
update_icons_body()
diff --git a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm
index 0830d10e83..252008d25b 100644
--- a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm
+++ b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm
@@ -420,8 +420,7 @@ var/global/list/disallowed_protean_accessories = list(
//Transfer vore organs
blob.vore_organs = vore_organs
blob.vore_selected = vore_selected
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.forceMove(blob)
B.owner = blob
@@ -524,8 +523,7 @@ var/global/list/disallowed_protean_accessories = list(
//Transfer vore organs
vore_selected = blob.vore_selected
- for(var/belly in blob.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in blob.vore_organs)
B.forceMove(src)
B.owner = src
diff --git a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_species.dm b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_species.dm
index 2a208e43c7..1130918ed5 100755
--- a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_species.dm
+++ b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_species.dm
@@ -236,8 +236,7 @@ CHOMP Station removal end*/
stat(null, "- -- --- REFACTORY ERROR! --- -- -")
stat(null, "- -- --- Abilities (Shift+LMB Examines) --- -- -")
- for(var/ability in abilities)
- var/obj/effect/protean_ability/A = ability
+ for(var/obj/effect/protean_ability/A as anything in abilities)
stat("[A.ability_name]",A.atom_button_text())
// Various modifiers
@@ -330,8 +329,7 @@ CHOMP Removal end*/
holder.adjustBruteLoss(-1,include_robo = TRUE) //Modified by species resistances
holder.adjustFireLoss(-0.5,include_robo = TRUE) //Modified by species resistances
var/mob/living/carbon/human/H = holder
- for(var/organ in H.internal_organs)
- var/obj/item/organ/O = organ
+ for(var/obj/item/organ/O as anything in H.internal_organs)
// Fix internal damage
if(O.damage > 0)
O.damage = max(0,O.damage-0.1)
diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm
index b33a5d3945..94776d570e 100644
--- a/code/modules/mob/living/death.dm
+++ b/code/modules/mob/living/death.dm
@@ -17,11 +17,9 @@
//VOREStation Edit End
nest = null
- for(var/s in owned_soul_links)
- var/datum/soul_link/S = s
+ for(var/datum/soul_link/S as anything in owned_soul_links)
S.owner_died(gibbed)
- for(var/s in shared_soul_links)
- var/datum/soul_link/S = s
+ for(var/datum/soul_link/S as anything in shared_soul_links)
S.sharer_died(gibbed)
. = ..()
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 592d7d0db2..622c3965c4 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -868,9 +868,8 @@
update_transform()
//VOREStation Add
if(lying && LAZYLEN(buckled_mobs))
- for(var/rider in buckled_mobs)
- var/mob/living/L = rider
- if(buckled_mobs[rider] != "riding")
+ for(var/mob/living/L as anything in buckled_mobs)
+ if(buckled_mobs[L] != "riding")
continue // Only boot off riders
if(riding_datum)
riding_datum.force_dismount(L)
diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm
index fc7d08677b..cc66172f43 100644
--- a/code/modules/mob/living/say.dm
+++ b/code/modules/mob/living/say.dm
@@ -387,11 +387,9 @@ var/list/channel_to_radio_key = new
//Remove all those images. At least it's just ONE spawn this time.
spawn(30)
- for(var/img in images_to_clients)
- var/image/I = img
+ for(var/image/I as anything in images_to_clients)
var/list/clients_from_image = images_to_clients[I]
- for(var/client in clients_from_image)
- var/client/C = client
+ for(var/client/C as anything in clients_from_image)
if(C) //Could have disconnected after message sent, before removing bubble.
C.images -= I
qdel(I)
@@ -416,12 +414,10 @@ var/list/channel_to_radio_key = new
else
var/list/potentials = get_mobs_and_objs_in_view_fast(T, world.view)
var/list/mobs = potentials["mobs"]
- for(var/hearer in mobs)
- var/mob/M = hearer
+ for(var/mob/M as anything in mobs)
M.hear_signlang(message, verb, language, src)
var/list/objs = potentials["objs"]
- for(var/hearer in objs)
- var/obj/O = hearer
+ for(var/obj/O as anything in objs)
O.hear_signlang(message, verb, language, src)
return 1
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 2a0a307818..38f59adbc5 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -32,8 +32,7 @@ var/list/ai_verbs_default = list(
/proc/AutoUpdateAI(obj/subject)
var/is_in_use = 0
if (subject!=null)
- for(var/A in ai_list)
- var/mob/living/silicon/ai/M = A
+ for(var/mob/living/silicon/ai/M as anything in ai_list)
if ((M.client && M.machine == subject))
is_in_use = 1
subject.attack_ai(M)
diff --git a/code/modules/mob/living/silicon/ai/ai_remote_control.dm b/code/modules/mob/living/silicon/ai/ai_remote_control.dm
index 768aba02f5..ac092ed693 100644
--- a/code/modules/mob/living/silicon/ai/ai_remote_control.dm
+++ b/code/modules/mob/living/silicon/ai/ai_remote_control.dm
@@ -25,8 +25,7 @@
var/list/possible = list()
- for(var/borgie in GLOB.available_ai_shells)
- var/mob/living/silicon/robot/R = borgie
+ for(var/mob/living/silicon/robot/R as anything in GLOB.available_ai_shells)
if(R.shell && !R.deployed && (R.stat != DEAD) && (!R.connected_ai || (R.connected_ai == src) ) && !(using_map.ai_shell_restricted && !(R.z in using_map.ai_shell_allowed_levels)) ) //VOREStation Edit: shell restrictions
possible += R
diff --git a/code/modules/mob/living/silicon/ai/multicam.dm b/code/modules/mob/living/silicon/ai/multicam.dm
index 7f84eebf6e..1a69c5f5f3 100644
--- a/code/modules/mob/living/silicon/ai/multicam.dm
+++ b/code/modules/mob/living/silicon/ai/multicam.dm
@@ -202,10 +202,8 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room)
var/list/obj/machinery/camera/add = list()
var/list/obj/machinery/camera/remove = list()
var/list/obj/machinery/camera/visible = list()
- for(var/VV in visibleChunks)
- var/datum/chunk/camera/CC = VV
- for(var/V in CC.cameras)
- var/obj/machinery/camera/C = V
+ for(var/datum/chunk/camera/CC as anything in visibleChunks)
+ for(var/obj/machinery/camera/C as anything in CC.cameras)
if (!C.can_use() || (get_dist(C, src) > telegraph_range))
continue
visible |= C
@@ -213,15 +211,13 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room)
add = visible - cameras_telegraphed
remove = cameras_telegraphed - visible
- for(var/V in remove)
- var/obj/machinery/camera/C = V
+ for(var/obj/machinery/camera/C as anything in remove)
if(QDELETED(C))
continue
cameras_telegraphed -= C
C.in_use_lights--
C.update_icon()
- for(var/V in add)
- var/obj/machinery/camera/C = V
+ for(var/obj/machinery/camera/C as anything in add)
if(QDELETED(C))
continue
cameras_telegraphed |= C
@@ -230,8 +226,7 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room)
/mob/observer/eye/aiEye/pic_in_pic/proc/disable_camera_telegraphing()
telegraph_cameras = FALSE
- for(var/V in cameras_telegraphed)
- var/obj/machinery/camera/C = V
+ for(var/obj/machinery/camera/C as anything in cameras_telegraphed)
if(QDELETED(C))
continue
C.in_use_lights--
@@ -291,8 +286,7 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room)
/mob/living/silicon/ai/proc/refresh_multicam()
reset_view(GLOB.ai_camera_room_landmark)
if(client)
- for(var/V in multicam_screens)
- var/obj/screen/movable/pic_in_pic/P = V
+ for(var/obj/screen/movable/pic_in_pic/P as anything in multicam_screens)
P.show_to(client)
/mob/living/silicon/ai/proc/end_multicam()
@@ -301,8 +295,7 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room)
multicam_on = FALSE
select_main_multicam_window(null)
if(client)
- for(var/V in multicam_screens)
- var/obj/screen/movable/pic_in_pic/P = V
+ for(var/obj/screen/movable/pic_in_pic/P as anything in multicam_screens)
P.unshow_to(client)
reset_view()
to_chat(src, "Multiple-camera viewing mode deactivated.")
diff --git a/code/modules/mob/living/silicon/pai/pai_vr.dm b/code/modules/mob/living/silicon/pai/pai_vr.dm
index 59a0fad74d..c8ab1d7e07 100644
--- a/code/modules/mob/living/silicon/pai/pai_vr.dm
+++ b/code/modules/mob/living/silicon/pai/pai_vr.dm
@@ -17,8 +17,7 @@
/mob/living/silicon/pai/proc/update_fullness_pai() //Determines if they have something in their stomach. Copied and slightly modified.
var/new_people_eaten = 0
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
for(var/mob/living/M in B)
new_people_eaten += M.size_multiplier
people_eaten = min(1, new_people_eaten)
diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm
index cad5229097..3a98a5bea3 100644
--- a/code/modules/mob/living/silicon/pai/software.dm
+++ b/code/modules/mob/living/silicon/pai/software.dm
@@ -21,7 +21,7 @@ var/global/list/pai_software_by_key = list()
var/global/list/default_pai_software = list()
/hook/startup/proc/populate_pai_software_list()
var/r = 1 // I would use ., but it'd sacrifice runtime detection
- for(var/type in typesof(/datum/pai_software) - /datum/pai_software)
+ for(var/type in subtypesof(/datum/pai_software))
var/datum/pai_software/P = new type()
if(pai_software_by_key[P.id])
var/datum/pai_software/O = pai_software_by_key[P.id]
diff --git a/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm b/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm
index a15e2bf518..9e3bd95c86 100644
--- a/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm
+++ b/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm
@@ -567,8 +567,7 @@
'sound/vore/death10.ogg')
playsound(src, deathsound, vol = 100, vary = 1, falloff = 0.1, ignore_walls = TRUE, preference = /datum/client_preference/digestion_noises)
if(is_vore_predator(T))
- for(var/belly in T.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in T.vore_organs)
for(var/atom/movable/thing in B)
thing.forceMove(src)
if(ismob(thing))
diff --git a/code/modules/mob/living/silicon/robot/examine_vr.dm b/code/modules/mob/living/silicon/robot/examine_vr.dm
index 2bebab2665..84b960050d 100644
--- a/code/modules/mob/living/silicon/robot/examine_vr.dm
+++ b/code/modules/mob/living/silicon/robot/examine_vr.dm
@@ -1,8 +1,7 @@
/mob/living/silicon/robot/proc/examine_bellies_borg()
var/list/message_list = list()
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
var/bellymessage = B.get_examine_msg()
if(bellymessage) message_list += bellymessage
bellymessage = B.get_examine_msg_absorbed()
diff --git a/code/modules/mob/living/simple_mob/defense.dm b/code/modules/mob/living/simple_mob/defense.dm
index 09d6fc7335..af37f156c5 100644
--- a/code/modules/mob/living/simple_mob/defense.dm
+++ b/code/modules/mob/living/simple_mob/defense.dm
@@ -147,8 +147,7 @@
. = 1 - . // Invert from 1 = immunity to 0 = immunity.
// Doing it this way makes multiplicative stacking not get out of hand, so two modifiers that give 0.5 protection will be combined to 0.75 in the end.
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
if(!isnull(M.cold_protection))
. *= 1 - M.cold_protection
@@ -172,8 +171,7 @@
. = 1 - . // Invert from 1 = immunity to 0 = immunity.
// Doing it this way makes multiplicative stacking not get out of hand, so two modifiers that give 0.5 protection will be combined to 0.75 in the end.
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
if(!isnull(M.heat_protection))
. *= 1 - M.heat_protection
@@ -199,8 +197,7 @@
. = 1 - . // Invert from 1 = immunity to 0 = immunity.
// Doing it this way makes multiplicative stacking not get out of hand, so two modifiers that give 0.5 protection will be combined to 0.75 in the end.
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
if(!isnull(M.siemens_coefficient))
. *= M.siemens_coefficient
@@ -257,8 +254,7 @@
if(isnull(armorval))
armorval = 0
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
var/modifier_armor = LAZYACCESS(M.armor_percent, attack_flag)
if(modifier_armor)
armorval += modifier_armor
@@ -270,8 +266,7 @@
if(isnull(armorval))
armorval = 0
- for(var/thing in modifiers)
- var/datum/modifier/M = thing
+ for(var/datum/modifier/M as anything in modifiers)
var/modifier_armor = LAZYACCESS(M.armor_flat, attack_flag)
if(modifier_armor)
armorval += modifier_armor
diff --git a/code/modules/mob/living/simple_mob/simple_mob_vr.dm b/code/modules/mob/living/simple_mob/simple_mob_vr.dm
index 59cfa2850a..305ecf70fc 100644
--- a/code/modules/mob/living/simple_mob/simple_mob_vr.dm
+++ b/code/modules/mob/living/simple_mob/simple_mob_vr.dm
@@ -67,8 +67,7 @@
// Update fullness based on size & quantity of belly contents
/mob/living/simple_mob/proc/update_fullness()
var/new_fullness = 0
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
for(var/mob/living/M in B)
new_fullness += M.size_multiplier
new_fullness = new_fullness / size_multiplier //Divided by pred's size so a macro mob won't get macro belly from a regular prey.
diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm b/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm
index 3d8401b76d..8035fb2d80 100644
--- a/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm
@@ -240,8 +240,7 @@
var/static/alternative_targets = typecacheof(list(/obj/item, /obj/structure))
- for(var/AT in typecache_filter_list(range(vision_range, holder), alternative_targets))
- var/obj/O = AT
+ for(var/obj/O as anything in typecache_filter_list(range(vision_range, holder), alternative_targets))
if(can_see(holder, O, vision_range) && !O.anchored)
. += O
diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/demon/demon_abilities.dm b/code/modules/mob/living/simple_mob/subtypes/vore/demon/demon_abilities.dm
index 56214bf58c..e6c84387c8 100644
--- a/code/modules/mob/living/simple_mob/subtypes/vore/demon/demon_abilities.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/vore/demon/demon_abilities.dm
@@ -32,8 +32,7 @@
if(shifted_out)
shifted_out = FALSE
name = real_name
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = initial(B.escapable)
cut_overlays()
@@ -89,8 +88,7 @@
name = "Something"
health = maxHealth //Fullheal
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = FALSE
cut_overlays()
@@ -145,8 +143,7 @@
real_name = name
name = "Something"
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = FALSE
cut_overlays()
@@ -166,8 +163,7 @@
spawn(300)
shifted_out = FALSE
name = real_name
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = initial(B.escapable)
cut_overlays()
diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/lamia.dm b/code/modules/mob/living/simple_mob/subtypes/vore/lamia.dm
index 880008dff9..7f525c8310 100644
--- a/code/modules/mob/living/simple_mob/subtypes/vore/lamia.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/vore/lamia.dm
@@ -54,8 +54,7 @@
/mob/living/simple_mob/vore/lamia/update_fullness()
var/new_fullness = 0
// We only want to count our upper_stomach towards capacity
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
if(B.name == "upper stomach")
for(var/mob/living/M in B)
new_fullness += M.size_multiplier
@@ -76,8 +75,7 @@
var/upper_shows = FALSE
var/tail_shows = FALSE
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
if(!(B.name in list("upper stomach", "tail stomach")))
continue
var/belly_fullness = 0
diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/ability_procs.dm b/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/ability_procs.dm
index 208030125d..ec1161630a 100644
--- a/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/ability_procs.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/ability_procs.dm
@@ -21,8 +21,7 @@
ability_flags &= ~AB_PHASE_SHIFTED
mouse_opacity = 1
name = real_name
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = initial(B.escapable)
cut_overlays()
@@ -76,8 +75,7 @@
real_name = name
name = "Something"
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.escapable = FALSE
cut_overlays()
diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/shadekin.dm b/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/shadekin.dm
index 2f275db0f1..371fc8d241 100644
--- a/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/shadekin.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/vore/shadekin/shadekin.dm
@@ -215,8 +215,7 @@
abilities_stat()
/mob/living/simple_mob/shadekin/proc/abilities_stat()
- for(var/A in shadekin_abilities)
- var/obj/effect/shadekin_ability/ability = A
+ for(var/obj/effect/shadekin_ability/ability as anything in shadekin_abilities)
stat("[ability.ability_name]",ability.atom_button_text())
//They phase back to the dark when killed
diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/solargrub_larva.dm b/code/modules/mob/living/simple_mob/subtypes/vore/solargrub_larva.dm
index 72e2532792..f3c200410b 100644
--- a/code/modules/mob/living/simple_mob/subtypes/vore/solargrub_larva.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/vore/solargrub_larva.dm
@@ -205,8 +205,7 @@ var/global/list/grub_machine_overlays = list()
var/static/potential_targets = typecacheof(list(/obj/machinery))
var/list/actual_targets = list()
- for(var/AT in typecache_filter_list(range(vision_range, holder), potential_targets))
- var/obj/machinery/M = AT
+ for(var/obj/machinery/M as anything in typecache_filter_list(range(vision_range, holder), potential_targets))
if(istype(M, /obj/machinery/atmospherics/unary/vent_pump))
var/obj/machinery/atmospherics/unary/vent_pump/V = M
if(!V.welded && prob(50))
diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/zz_vore_overrides.dm b/code/modules/mob/living/simple_mob/subtypes/vore/zz_vore_overrides.dm
index 3ea220ef8d..e1c19a2dd4 100644
--- a/code/modules/mob/living/simple_mob/subtypes/vore/zz_vore_overrides.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/vore/zz_vore_overrides.dm
@@ -271,14 +271,12 @@
return
. = ..()
var/safe = (faction == "neutral")
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.digest_mode = safe ? DM_HOLD : vore_default_mode
/mob/living/simple_mob/animal/space/carp/holographic/set_safety(var/safe)
. = ..()
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.digest_mode = safe ? DM_HOLD : vore_default_mode
/mob/living/simple_mob/animal/passive/mouse
diff --git a/code/modules/mob/living/status_indicators.dm b/code/modules/mob/living/status_indicators.dm
index a3f386b9e6..4f61b7ad34 100644
--- a/code/modules/mob/living/status_indicators.dm
+++ b/code/modules/mob/living/status_indicators.dm
@@ -67,8 +67,7 @@
current_x_position -= (icon_expected_width / 2) * (get_icon_scale_y() - 1)
// Now the indicator row can actually be built.
- for(var/thing in status_indicators)
- var/image/I = thing
+ for(var/image/I as anything in status_indicators)
// This is a semi-HUD element, in a similar manner as medHUDs, in that they're 'above' everything else in the world,
// but don't pierce obfuscation layers such as blindness or darkness, unlike actual HUD elements like inventory slots.
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index af947a7b6e..3b52e76055 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
/mob/Destroy()//This makes sure that mobs withGLOB.clients/keys are not just deleted from the game.
mob_list -= src
dead_mob_list -= src
@@ -1232,3 +1233,2470 @@ GLOBAL_LIST_EMPTY_TYPED(living_players_by_zlevel, /list)
/mob/proc/grab_ghost(force)
if(mind)
return mind.grab_ghost(force = force)
+||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
+/mob/Destroy()//This makes sure that mobs withGLOB.clients/keys are not just deleted from the game.
+ mob_list -= src
+ dead_mob_list -= src
+ living_mob_list -= src
+ unset_machine()
+ qdel(hud_used)
+ clear_fullscreen()
+ if(client)
+ for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
+ qdel(spell_master)
+ remove_screen_obj_references()
+ client.screen = list()
+ if(mind && mind.current == src)
+ spellremove(src)
+ ghostize()
+ QDEL_NULL(plane_holder)
+ ..()
+ return QDEL_HINT_HARDDEL_NOW
+
+/mob/proc/remove_screen_obj_references()
+ hands = null
+ pullin = null
+ purged = null
+ internals = null
+ i_select = null
+ m_select = null
+ healths = null
+ throw_icon = null
+ pain = null
+ item_use_icon = null
+ gun_move_icon = null
+ gun_setting_icon = null
+ spell_masters = null
+ zone_sel = null
+
+/mob/Initialize()
+ mob_list += src
+ if(stat == DEAD)
+ dead_mob_list += src
+ else
+ living_mob_list += src
+ lastarea = get_area(src)
+ set_focus(src) // VOREStation Add - Key Handling
+ hook_vr("mob_new",list(src)) //VOREStation Code
+ update_transform() // Some mobs may start bigger or smaller than normal.
+ return ..()
+
+/mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
+
+ if(!client && !teleop) return
+
+ if (type)
+ if((type & VISIBLE_MESSAGE) && (is_blind() || paralysis) )//Vision related
+ if (!( alt ))
+ return
+ else
+ msg = alt
+ type = alt_type
+ if ((type & AUDIBLE_MESSAGE) && is_deaf())//Hearing related
+ if (!( alt ))
+ return
+ else
+ msg = alt
+ type = alt_type
+ if ((type & VISIBLE_MESSAGE) && (sdisabilities & BLIND))
+ return
+ // Added voice muffling for Issue 41.
+ if(stat == UNCONSCIOUS || sleeping > 0)
+ to_chat(src, "... You can almost hear someone talking ...")
+ else
+ to_chat(src,msg)
+ if(teleop)
+ to_chat(teleop, create_text_tag("body", "BODY:", teleop) + "[msg]")
+ return
+
+// Show a message to all mobs and objects in sight of this one
+// This would be for visible actions by the src mob
+// message is the message output to anyone who can see e.g. "[src] does something!"
+// self_message (optional) is what the src mob sees e.g. "You do something!"
+// blind_message (optional) is what blind people will hear e.g. "You hear something!"
+/mob/visible_message(var/message, var/self_message, var/blind_message, var/list/exclude_mobs = null, var/range = world.view, var/runemessage)
+ if(self_message)
+ if(LAZYLEN(exclude_mobs))
+ exclude_mobs |= src
+ else
+ exclude_mobs = list(src)
+ src.show_message(self_message, 1, blind_message, 2)
+ if(isnull(runemessage))
+ runemessage = -1
+ . = ..(message, blind_message, exclude_mobs, range, runemessage) // Really not ideal that atom/visible_message has different arg numbering :(
+
+// Returns an amount of power drawn from the object (-1 if it's not viable).
+// If drain_check is set it will not actually drain power, just return a value.
+// If surge is set, it will destroy/damage the recipient and not return any power.
+// Not sure where to define this, so it can sit here for the rest of time.
+/atom/proc/drain_power(var/drain_check,var/surge, var/amount = 0)
+ return -1
+
+// Show a message to all mobs and objects in earshot of this one
+// This would be for audible actions by the src mob
+// message is the message output to anyone who can hear.
+// self_message (optional) is what the src mob hears.
+// deaf_message (optional) is what deaf people will see.
+// hearing_distance (optional) is the range, how many tiles away the message can be heard.
+/mob/audible_message(var/message, var/deaf_message, var/hearing_distance, var/self_message, var/radio_message, var/runemessage)
+
+ var/range = hearing_distance || world.view
+ var/list/hear = get_mobs_and_objs_in_view_fast(get_turf(src),range,remote_ghosts = FALSE)
+
+ var/list/hearing_mobs = hear["mobs"]
+ var/list/hearing_objs = hear["objs"]
+
+ if(isnull(runemessage))
+ runemessage = -1 // Symmetry with mob/audible_message, despite the fact this one doesn't call parent. Maybe it should!
+
+ if(radio_message)
+ for(var/obj in hearing_objs)
+ var/obj/O = obj
+ O.hear_talk(src, list(new /datum/multilingual_say_piece(GLOB.all_languages["Noise"], radio_message)), null)
+ else
+ for(var/obj in hearing_objs)
+ var/obj/O = obj
+ O.show_message(message, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE)
+
+ for(var/mob in hearing_mobs)
+ var/mob/M = mob
+ var/msg = message
+ if(self_message && M==src)
+ msg = self_message
+ M.show_message(msg, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE)
+ if(runemessage != -1)
+ M.create_chat_message(src, "[runemessage || message]", FALSE, list("emote"), audible = FALSE)
+
+/mob/proc/findname(msg)
+ for(var/mob/M in mob_list)
+ if (M.real_name == text("[]", msg))
+ return M
+ return 0
+
+/mob/proc/Life()
+// if(organStructure)
+// organStructure.ProcessOrgans()
+ return
+
+#define UNBUCKLED 0
+#define PARTIALLY_BUCKLED 1
+#define FULLY_BUCKLED 2
+/mob/proc/buckled()
+ // Preliminary work for a future buckle rewrite,
+ // where one might be fully restrained (like an elecrical chair), or merely secured (shuttle chair, keeping you safe but not otherwise restrained from acting)
+ if(!buckled)
+ return UNBUCKLED
+ return restrained() ? FULLY_BUCKLED : PARTIALLY_BUCKLED
+
+/mob/proc/is_blind()
+ return ((sdisabilities & BLIND) || blinded || incapacitated(INCAPACITATION_KNOCKOUT))
+
+/mob/proc/is_deaf()
+ return ((sdisabilities & DEAF) || ear_deaf || incapacitated(INCAPACITATION_KNOCKOUT))
+
+/mob/proc/is_physically_disabled()
+ return incapacitated(INCAPACITATION_DISABLED)
+
+/mob/proc/cannot_stand()
+ return incapacitated(INCAPACITATION_KNOCKDOWN)
+
+/mob/proc/incapacitated(var/incapacitation_flags = INCAPACITATION_DEFAULT)
+ if ((incapacitation_flags & INCAPACITATION_STUNNED) && stunned)
+ return 1
+
+ if ((incapacitation_flags & INCAPACITATION_FORCELYING) && (weakened || resting))
+ return 1
+
+ if ((incapacitation_flags & INCAPACITATION_KNOCKOUT) && (stat || paralysis || sleeping || (status_flags & FAKEDEATH)))
+ return 1
+
+ if((incapacitation_flags & INCAPACITATION_RESTRAINED) && restrained())
+ return 1
+
+ if((incapacitation_flags & (INCAPACITATION_BUCKLED_PARTIALLY|INCAPACITATION_BUCKLED_FULLY)))
+ var/buckling = buckled()
+ if(buckling >= PARTIALLY_BUCKLED && (incapacitation_flags & INCAPACITATION_BUCKLED_PARTIALLY))
+ return 1
+ if(buckling == FULLY_BUCKLED && (incapacitation_flags & INCAPACITATION_BUCKLED_FULLY))
+ return 1
+
+ return 0
+
+#undef UNBUCKLED
+#undef PARTIALLY_BUCKLED
+#undef FULLY_BUCKLED
+
+/mob/proc/restrained()
+ return
+
+/mob/proc/reset_view(atom/A)
+ if (client)
+ if (istype(A, /atom/movable))
+ client.perspective = EYE_PERSPECTIVE
+ client.eye = A
+ else
+ if (isturf(loc))
+ client.eye = client.mob
+ client.perspective = MOB_PERSPECTIVE
+ else
+ client.perspective = EYE_PERSPECTIVE
+ client.eye = loc
+ return TRUE
+
+/mob/verb/pointed(atom/A as mob|obj|turf in view())
+ set name = "Point To"
+ set category = "Object"
+
+ if(!src || !isturf(src.loc) || !(A in view(src.loc)))
+ return 0
+ if(istype(A, /obj/effect/decal/point))
+ return 0
+
+ var/turf/tile = get_turf(A)
+ if (!tile)
+ return 0
+
+ var/turf/our_tile = get_turf(src)
+ var/obj/visual = new /obj/effect/decal/point(our_tile)
+ visual.invisibility = invisibility
+ visual.plane = ABOVE_PLANE
+ visual.layer = FLY_LAYER
+
+ animate(visual,
+ pixel_x = (tile.x - our_tile.x) * world.icon_size + A.pixel_x,
+ pixel_y = (tile.y - our_tile.y) * world.icon_size + A.pixel_y,
+ time = 1.7,
+ easing = EASE_OUT)
+
+ QDEL_IN(visual, 2 SECONDS) //Better qdel
+
+ face_atom(A)
+ return 1
+
+
+/mob/proc/ret_grab(list/L, flag)
+ return
+
+/mob/verb/mode()
+ set name = "Activate Held Object"
+ set category = "Object"
+ set src = usr
+
+ return
+
+/*
+/mob/verb/dump_source()
+
+ var/master = ""
+ for(var/t in typesof(/area))
+ master += text("[]\n", t)
+ //Foreach goto(26)
+ src << browse(master)
+ return
+*/
+
+/mob/verb/memory()
+ set name = "Notes"
+ set category = "IC"
+ if(mind)
+ mind.show_memory(src)
+ else
+ to_chat(src, "The game appears to have misplaced your mind datum, so we can't show you your notes.")
+
+/mob/verb/add_memory(msg as message)
+ set name = "Add Note"
+ set category = "IC"
+
+ msg = sanitize(msg)
+
+ if(mind)
+ mind.store_memory(msg)
+ else
+ to_chat(src, "The game appears to have misplaced your mind datum, so we can't show you your notes.")
+
+/mob/proc/store_memory(msg as message, popup, sane = 1)
+ msg = copytext(msg, 1, MAX_MESSAGE_LEN)
+
+ if (sane)
+ msg = sanitize(msg)
+
+ if (length(memory) == 0)
+ memory += msg
+ else
+ memory += "
[msg]"
+
+ if (popup)
+ memory()
+
+/mob/proc/update_flavor_text()
+ set src in usr
+ if(usr != src)
+ to_chat(usr, "No.")
+ var/msg = sanitize(input(usr,"Set the flavor text in your 'examine' verb.","Flavor Text",html_decode(flavor_text)) as message|null, extra = 0) //VOREStation Edit: separating out OOC notes
+
+ if(msg != null)
+ flavor_text = msg
+
+/mob/proc/warn_flavor_changed()
+ if(flavor_text && flavor_text != "") // don't spam people that don't use it!
+ to_chat(src, "OOC Warning:
")
+ to_chat(src, "Your flavor text is likely out of date! Change")
+
+/mob/proc/print_flavor_text()
+ if (flavor_text && flavor_text != "")
+ var/msg = replacetext(flavor_text, "\n", " ")
+ if(length(msg) <= 40)
+ return "[msg]"
+ else
+ return "[copytext_preserve_html(msg, 1, 37)]... More..."
+
+/*
+/mob/verb/help()
+ set name = "Help"
+ src << browse('html/help.html', "window=help")
+ return
+*/
+
+/mob/proc/set_respawn_timer(var/time)
+ // Try to figure out what time to use
+
+ // Special cases, can never respawn
+ if(ticker?.mode?.deny_respawn)
+ time = -1
+ else if(!config.abandon_allowed)
+ time = -1
+ else if(!config.respawn)
+ time = -1
+
+ // Special case for observing before game start
+ else if(ticker?.current_state <= GAME_STATE_SETTING_UP)
+ time = 1 MINUTE
+
+ // Wasn't given a time, use the config time
+ else if(!time)
+ time = config.respawn_time
+
+ var/keytouse = ckey
+ // Try harder to find a key to use
+ if(!keytouse && key)
+ keytouse = ckey(key)
+ else if(!keytouse && mind?.key)
+ keytouse = ckey(mind.key)
+
+ GLOB.respawn_timers[keytouse] = world.time + time
+
+/mob/observer/dead/set_respawn_timer()
+ if(config.antag_hud_restricted && has_enabled_antagHUD)
+ ..(-1)
+ else
+ return // Don't set it, no need
+
+/mob/verb/abandon_mob()
+ set name = "Return to Menu"
+ set category = "OOC"
+
+ if(stat != DEAD || !ticker)
+ to_chat(usr, "You must be dead to use this!")
+ return
+
+ // Final chance to abort "respawning"
+ if(mind && timeofdeath) // They had spawned before
+ var/choice = tgui_alert(usr, "Returning to the menu will prevent your character from being revived in-round. Are you sure?", "Confirmation", list("No, wait", "Yes, leave"))
+ if(choice == "No, wait")
+ return
+
+ // Beyond this point, you're going to respawn
+ to_chat(usr, config.respawn_message)
+
+ if(!client)
+ log_game("[usr.key] AM failed due to disconnect.")
+ return
+ client.screen.Cut()
+ client.screen += client.void
+ if(!client)
+ log_game("[usr.key] AM failed due to disconnect.")
+ return
+
+ announce_ghost_joinleave(client, 0)
+
+ var/mob/new_player/M = new /mob/new_player()
+ if(!client)
+ log_game("[usr.key] AM failed due to disconnect.")
+ qdel(M)
+ return
+
+ M.key = key
+ if(M.mind)
+ M.mind.reset()
+ return
+
+/client/verb/changes()
+ set name = "Changelog"
+ set category = "OOC"
+ src << browse('html/changelog.html', "window=changes;size=675x650")
+ if(prefs.lastchangelog != changelog_hash)
+ prefs.lastchangelog = changelog_hash
+ SScharacter_setup.queue_preferences_save(prefs)
+ winset(src, "rpane.changelog", "background-color=none;font-style=;")
+
+/mob/verb/observe()
+ set name = "Observe"
+ set category = "OOC"
+ var/is_admin = 0
+
+ if(client.holder && (client.holder.rights & R_ADMIN|R_EVENT))
+ is_admin = 1
+ else if(stat != DEAD || istype(src, /mob/new_player))
+ to_chat(usr, "You must be observing to use this!")
+ return
+
+ if(is_admin && stat == DEAD)
+ is_admin = 0
+
+ var/list/targets = list()
+
+
+ targets += observe_list_format(nuke_disks)
+ targets += observe_list_format(all_singularities)
+ targets += getmobs()
+ targets += observe_list_format(sortAtom(mechas_list))
+ targets += observe_list_format(SSshuttles.ships)
+
+ client.perspective = EYE_PERSPECTIVE
+
+ var/eye_name = null
+
+ var/ok = "[is_admin ? "Admin Observe" : "Observe"]"
+ eye_name = tgui_input_list(usr, "Select something to [ok]:", "Select Target", targets)
+
+ if (!eye_name)
+ return
+
+ var/mob/mob_eye = targets[eye_name]
+
+ if(client && mob_eye)
+ client.eye = mob_eye
+ if (is_admin)
+ client.adminobs = 1
+ if(mob_eye == client.mob || client.eye == client.mob)
+ client.adminobs = 0
+
+/mob/verb/cancel_camera()
+ set name = "Cancel Camera View"
+ set category = "OOC"
+ unset_machine()
+ reset_view(null)
+
+/mob/Topic(href, href_list)
+ if(href_list["mach_close"])
+ var/t1 = text("window=[href_list["mach_close"]]")
+ unset_machine()
+ src << browse(null, t1)
+
+ if(href_list["flavor_more"])
+ usr << browse(text("[][]", name, replacetext(flavor_text, "\n", "
")), text("window=[];size=500x200", name))
+ onclose(usr, "[name]")
+ if(href_list["flavor_change"])
+ update_flavor_text()
+// ..()
+ return
+
+
+/mob/proc/pull_damage()
+ return 0
+
+/mob/verb/stop_pulling()
+
+ set name = "Stop Pulling"
+ set category = "IC"
+
+ if(pulling)
+ if(ishuman(pulling))
+ var/mob/living/carbon/human/H = pulling
+ visible_message(SPAN_WARNING("\The [src] lets go of \the [H]."), SPAN_NOTICE("You let go of \the [H]."), exclude_mobs = list(H))
+ if(!H.stat)
+ to_chat(H, SPAN_WARNING("\The [src] lets go of you."))
+ pulling.pulledby = null
+ pulling = null
+ if(pullin)
+ pullin.icon_state = "pull0"
+
+/mob/proc/start_pulling(var/atom/movable/AM)
+
+ if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort!
+ return
+
+ if (AM.anchored)
+ to_chat(src, "It won't budge!")
+ return
+
+ var/mob/M = AM
+ if(ismob(AM))
+
+ if(!can_pull_mobs || !can_pull_size)
+ to_chat(src, "They won't budge!")
+ return
+
+ if((mob_size < M.mob_size) && (can_pull_mobs != MOB_PULL_LARGER))
+ to_chat(src, "[M] is too large for you to move!")
+ return
+
+ if((mob_size == M.mob_size) && (can_pull_mobs == MOB_PULL_SMALLER))
+ to_chat(src, "[M] is too heavy for you to move!")
+ return
+
+ // If your size is larger than theirs and you have some
+ // kind of mob pull value AT ALL, you will be able to pull
+ // them, so don't bother checking that explicitly.
+
+ if(M.grabbed_by.len)
+ // Only start pulling when nobody else has a grab on them
+ . = 1
+ for(var/obj/item/weapon/grab/G in M.grabbed_by)
+ if(G.assailant != usr)
+ . = 0
+ else
+ qdel(G)
+ if(!.)
+ to_chat(src, "Somebody has a grip on them!")
+ return
+
+ if(!iscarbon(src))
+ M.LAssailant = null
+ else
+ M.LAssailant = usr
+
+ else if(isobj(AM))
+ var/obj/I = AM
+ if(!can_pull_size || can_pull_size < I.w_class)
+ to_chat(src, "It won't budge!")
+ return
+
+ if(pulling)
+ var/pulling_old = pulling
+ stop_pulling()
+ // Are we pulling the same thing twice? Just stop pulling.
+ if(pulling_old == AM)
+ return
+
+ src.pulling = AM
+ AM.pulledby = src
+
+ if(pullin)
+ pullin.icon_state = "pull1"
+
+ if(ishuman(AM))
+ var/mob/living/carbon/human/H = AM
+ if(H.lying) // If they're on the ground we're probably dragging their arms to move them
+ visible_message(SPAN_WARNING("\The [src] leans down and grips \the [H]'s arms."), SPAN_NOTICE("You lean down and grip \the [H]'s arms."), exclude_mobs = list(H))
+ if(!H.stat)
+ to_chat(H, SPAN_WARNING("\The [src] leans down and grips your arms."))
+ else //Otherwise we're probably just holding their arm to lead them somewhere
+ visible_message(SPAN_WARNING("\The [src] grips \the [H]'s arm."), SPAN_NOTICE("You grip \the [H]'s arm."), exclude_mobs = list(H))
+ if(!H.stat)
+ to_chat(H, SPAN_WARNING("\The [src] grips your arm."))
+ playsound(src.loc, 'sound/weapons/thudswoosh.ogg', 25) //Quieter than hugging/grabbing but we still want some audio feedback
+
+ if(H.pull_damage())
+ to_chat(src, "Pulling \the [H] in their current condition would probably be a bad idea.")
+
+ //Attempted fix for people flying away through space when cuffed and dragged.
+ if(ismob(AM))
+ var/mob/pulled = AM
+ pulled.inertia_dir = 0
+
+/mob/proc/can_use_hands()
+ return
+
+/mob/proc/is_active()
+ return (0 >= usr.stat)
+
+/mob/proc/is_dead()
+ return stat == DEAD
+
+/mob/proc/is_mechanical()
+ if(mind && (mind.assigned_role == "Cyborg" || mind.assigned_role == "AI"))
+ return 1
+ return istype(src, /mob/living/silicon) || get_species() == "Machine"
+
+/mob/proc/is_ready()
+ return client && !!mind
+
+/mob/proc/get_gender()
+ return gender
+
+/mob/proc/see(message)
+ if(!is_active())
+ return 0
+ to_chat(src,message)
+ return 1
+
+/mob/proc/show_viewers(message)
+ for(var/mob/M in viewers())
+ M.see(message)
+
+/mob/Stat()
+ ..()
+ . = (is_client_active(10 MINUTES))
+
+ if(.)
+ if(statpanel("Status"))
+ stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
+ if(ticker && ticker.current_state != GAME_STATE_PREGAME)
+ stat("Station Time", stationtime2text())
+ stat("Station Date", stationdate2text())
+ stat("Round Duration", roundduration2text())
+
+ if(client.holder)
+ if(statpanel("Status"))
+ stat("Location:", "([x], [y], [z]) [loc]")
+ stat("CPU:","[world.cpu]")
+ stat("Instances:","[world.contents.len]")
+ stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
+ stat("Keys Held", keys2text(client.move_keys_held | client.mod_keys_held))
+ stat("Next Move ADD", dirs2text(client.next_move_dir_add))
+ stat("Next Move SUB", dirs2text(client.next_move_dir_sub))
+
+ if(statpanel("MC"))
+ stat("Location:", "([x], [y], [z]) [loc]")
+ stat("CPU:","[world.cpu]")
+ stat("Instances:","[world.contents.len]")
+ stat("World Time:", world.time)
+ stat("Real time of day:", REALTIMEOFDAY)
+ stat(null)
+ if(GLOB)
+ GLOB.stat_entry()
+ else
+ stat("Globals:", "ERROR")
+ if(Master)
+ Master.stat_entry()
+ else
+ stat("Master Controller:", "ERROR")
+ if(Failsafe)
+ Failsafe.stat_entry()
+ else
+ stat("Failsafe Controller:", "ERROR")
+ if(Master)
+ stat(null)
+ for(var/datum/controller/subsystem/SS in Master.subsystems)
+ SS.stat_entry()
+
+ if(statpanel("Tickets"))
+ GLOB.ahelp_tickets.stat_entry()
+
+
+ if(length(GLOB.sdql2_queries))
+ if(statpanel("SDQL2"))
+ stat("Access Global SDQL2 List", GLOB.sdql2_vv_statobj)
+ for(var/i in GLOB.sdql2_queries)
+ var/datum/SDQL2_query/Q = i
+ Q.generate_stat()
+
+ if(listed_turf && client)
+ if(!TurfAdjacent(listed_turf))
+ listed_turf = null
+ else
+ if(statpanel("Turf"))
+ stat(listed_turf)
+ for(var/atom/A in listed_turf)
+ if(!A.mouse_opacity)
+ continue
+ if(A.invisibility > see_invisible)
+ continue
+ if(is_type_in_list(A, shouldnt_see))
+ continue
+ if(A.plane > plane)
+ continue
+ stat(A)
+
+
+// facing verbs
+/mob/proc/canface()
+// if(!canmove) return 0 //VOREStation Edit. Redundant check that only affects conscious proning, actual inability to turn and shift around handled by actual inabilities.
+ if(stat) return 0
+ if(anchored) return 0
+ if(transforming) return 0
+ return 1
+
+// Not sure what to call this. Used to check if humans are wearing an AI-controlled exosuit and hence don't need to fall over yet.
+/mob/proc/can_stand_overridden()
+ return 0
+
+//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it.
+/mob/proc/update_canmove()
+ return canmove
+
+
+/mob/proc/facedir(var/ndir)
+ if(!canface() || (client && (client.moving || !checkMoveCooldown())))
+ DEBUG_INPUT("Denying Facedir for [src] (moving=[client?.moving])")
+ return 0
+ set_dir(ndir)
+ if(buckled && buckled.buckle_movable)
+ buckled.set_dir(ndir)
+ setMoveCooldown(movement_delay())
+ return 1
+
+
+/mob/verb/eastface()
+ set hidden = 1
+ return facedir(client.client_dir(EAST))
+
+
+/mob/verb/westface()
+ set hidden = 1
+ return facedir(client.client_dir(WEST))
+
+
+/mob/verb/northface()
+ set hidden = 1
+ return facedir(client.client_dir(NORTH))
+
+
+/mob/verb/southface()
+ set hidden = 1
+ return facedir(client.client_dir(SOUTH))
+
+
+//This might need a rename but it should replace the can this mob use things check
+/mob/proc/IsAdvancedToolUser()
+ return 0
+
+/mob/proc/Stun(amount)
+ if(status_flags & CANSTUN)
+ facing_dir = null
+ stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/SetStunned(amount) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned"
+ if(status_flags & CANSTUN)
+ stunned = max(amount,0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/AdjustStunned(amount)
+ if(status_flags & CANSTUN)
+ stunned = max(stunned + amount,0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/Weaken(amount)
+ if(status_flags & CANWEAKEN)
+ facing_dir = null
+ weakened = max(max(weakened,amount),0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/SetWeakened(amount)
+ if(status_flags & CANWEAKEN)
+ weakened = max(amount,0)
+ update_canmove() //can you guess what this does yet?
+ return
+
+/mob/proc/AdjustWeakened(amount)
+ if(status_flags & CANWEAKEN)
+ weakened = max(weakened + amount,0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/Paralyse(amount)
+ if(status_flags & CANPARALYSE)
+ facing_dir = null
+ paralysis = max(max(paralysis,amount),0)
+ return
+
+/mob/proc/SetParalysis(amount)
+ if(status_flags & CANPARALYSE)
+ paralysis = max(amount,0)
+ return
+
+/mob/proc/AdjustParalysis(amount)
+ if(status_flags & CANPARALYSE)
+ paralysis = max(paralysis + amount,0)
+ return
+
+/mob/proc/Sleeping(amount)
+ facing_dir = null
+ sleeping = max(max(sleeping,amount),0)
+ return
+
+/mob/proc/SetSleeping(amount)
+ sleeping = max(amount,0)
+ return
+
+/mob/proc/AdjustSleeping(amount)
+ sleeping = max(sleeping + amount,0)
+ return
+
+/mob/proc/Confuse(amount)
+ confused = max(max(confused,amount),0)
+ return
+
+/mob/proc/SetConfused(amount)
+ confused = max(amount,0)
+ return
+
+/mob/proc/AdjustConfused(amount)
+ confused = max(confused + amount,0)
+ return
+
+/mob/proc/Blind(amount)
+ eye_blind = max(max(eye_blind,amount),0)
+ return
+
+/mob/proc/SetBlinded(amount)
+ eye_blind = max(amount,0)
+ return
+
+/mob/proc/AdjustBlinded(amount)
+ eye_blind = max(eye_blind + amount,0)
+ return
+
+/mob/proc/Resting(amount)
+ facing_dir = null
+ resting = max(max(resting,amount),0)
+ update_canmove()
+ return
+
+/mob/proc/SetResting(amount)
+ resting = max(amount,0)
+ update_canmove()
+ return
+
+/mob/proc/AdjustResting(amount)
+ resting = max(resting + amount,0)
+ update_canmove()
+ return
+
+/mob/proc/AdjustLosebreath(amount)
+ losebreath = CLAMP(losebreath + amount, 0, 25)
+
+/mob/proc/SetLosebreath(amount)
+ losebreath = CLAMP(amount, 0, 25)
+
+/mob/proc/get_species()
+ return ""
+
+/mob/proc/flash_weak_pain()
+ flick("weak_pain",pain)
+
+/mob/proc/get_visible_implants(var/class = 0)
+ var/list/visible_implants = list()
+ for(var/obj/item/O in embedded)
+ if(O.w_class > class)
+ visible_implants += O
+ return visible_implants
+
+/mob/proc/embedded_needs_process()
+ return (embedded.len > 0)
+
+/mob/proc/yank_out_object()
+ set category = "Object"
+ set name = "Yank out object"
+ set desc = "Remove an embedded item at the cost of bleeding and pain."
+ set src in view(1)
+
+ if(!isliving(usr) || !usr.checkClickCooldown())
+ return
+ usr.setClickCooldown(20)
+
+ if(usr.stat == 1)
+ to_chat(usr, "You are unconcious and cannot do that!")
+ return
+
+ if(usr.restrained())
+ to_chat(usr, "You are restrained and cannot do that!")
+ return
+
+ var/mob/S = src
+ var/mob/U = usr
+ var/list/valid_objects = list()
+ var/self = null
+
+ if(S == U)
+ self = 1 // Removing object from yourself.
+
+ valid_objects = get_visible_implants(0)
+ if(!valid_objects.len)
+ if(self)
+ to_chat(src, "You have nothing stuck in your body that is large enough to remove.")
+ else
+ to_chat(U, "[src] has nothing stuck in their wounds that is large enough to remove.")
+ return
+
+ var/obj/item/weapon/selection = tgui_input_list(usr, "What do you want to yank out?", "Embedded objects", valid_objects)
+
+ if(self)
+ to_chat(src, "You attempt to get a good grip on [selection] in your body.")
+ else
+ to_chat(U, "You attempt to get a good grip on [selection] in [S]'s body.")
+
+ if(!do_after(U, 30))
+ return
+ if(!selection || !S || !U)
+ return
+
+ if(self)
+ visible_message("[src] rips [selection] out of their body.","You rip [selection] out of your body.")
+ else
+ visible_message("[usr] rips [selection] out of [src]'s body.","[usr] rips [selection] out of your body.")
+ valid_objects = get_visible_implants(0)
+ if(valid_objects.len == 1) //Yanking out last object - removing verb.
+ src.verbs -= /mob/proc/yank_out_object
+ clear_alert("embeddedobject")
+
+ if(ishuman(src))
+ var/mob/living/carbon/human/H = src
+ var/obj/item/organ/external/affected
+
+ for(var/obj/item/organ/external/organ in H.organs) //Grab the organ holding the implant.
+ for(var/obj/item/O in organ.implants)
+ if(O == selection)
+ affected = organ
+
+ affected.implants -= selection
+ H.shock_stage+=20
+ affected.take_damage((selection.w_class * 3), 0, 0, 1, "Embedded object extraction")
+
+ if(prob(selection.w_class * 5) && (affected.robotic < ORGAN_ROBOT)) //I'M SO ANEMIC I COULD JUST -DIE-.
+ var/datum/wound/internal_bleeding/I = new (min(selection.w_class * 5, 15))
+ affected.wounds += I
+ H.custom_pain("Something tears wetly in your [affected] as [selection] is pulled free!", 50)
+
+ if (ishuman(U))
+ var/mob/living/carbon/human/human_user = U
+ human_user.bloody_hands(H)
+
+ else if(issilicon(src))
+ var/mob/living/silicon/robot/R = src
+ R.embedded -= selection
+ R.adjustBruteLoss(5)
+ R.adjustFireLoss(10)
+
+ selection.forceMove(get_turf(src))
+ U.put_in_hands(selection)
+
+ for(var/obj/item/weapon/O in pinned)
+ if(O == selection)
+ pinned -= O
+ if(!pinned.len)
+ anchored = FALSE
+ return 1
+
+//Check for brain worms in head.
+/mob/proc/has_brain_worms()
+
+ for(var/I in contents)
+ if(istype(I,/mob/living/simple_mob/animal/borer))
+ return I
+
+ return 0
+
+/mob/proc/updateicon()
+ return
+
+// Please always use this proc, never just set the var directly.
+/mob/proc/set_stat(var/new_stat)
+ . = (stat != new_stat)
+ stat = new_stat
+
+/mob/verb/face_direction()
+
+ set name = "Face Direction"
+ set category = "IC"
+ set src = usr
+
+ set_face_dir()
+
+ if(!facing_dir)
+ to_chat(usr, "You are now not facing anything.")
+ else
+ to_chat(usr, "You are now facing [dir2text(facing_dir)].")
+
+/mob/proc/set_face_dir(var/newdir)
+ if(newdir == facing_dir)
+ facing_dir = null
+ else if(newdir)
+ set_dir(newdir)
+ facing_dir = newdir
+ else if(facing_dir)
+ facing_dir = null
+ else
+ set_dir(dir)
+ facing_dir = dir
+
+/mob/set_dir()
+ if(facing_dir)
+ if(!canface() || lying || buckled || restrained())
+ facing_dir = null
+ else if(dir != facing_dir)
+ return ..(facing_dir)
+ else
+ return ..()
+
+/mob/verb/northfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(NORTH))
+
+/mob/verb/southfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(SOUTH))
+
+/mob/verb/eastfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(EAST))
+
+/mob/verb/westfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(WEST))
+
+// Begin VOREstation edit
+/mob/verb/shiftnorth()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_y <= (default_pixel_y + 16))
+ pixel_y++
+ is_shifted = TRUE
+
+/mob/verb/shiftsouth()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_y >= (default_pixel_y - 16))
+ pixel_y--
+ is_shifted = TRUE
+
+/mob/verb/shiftwest()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_x >= (default_pixel_x - 16))
+ pixel_x--
+ is_shifted = TRUE
+
+/mob/verb/shifteast()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_x <= (default_pixel_x + 16))
+ pixel_x++
+ is_shifted = TRUE
+// End VOREstation edit
+
+/mob/proc/adjustEarDamage()
+ return
+
+/mob/proc/setEarDamage()
+ return
+
+// Set client view distance (size of client's screen). Returns TRUE if anything changed.
+/mob/proc/set_viewsize(var/new_view = world.view)
+ if (client && new_view != client.view)
+ client.view = new_view
+ return TRUE
+ return FALSE
+
+//Throwing stuff
+
+/mob/proc/toggle_throw_mode()
+ if (src.in_throw_mode)
+ throw_mode_off()
+ else
+ throw_mode_on()
+
+/mob/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"
+
+/mob/proc/throw_mode_on()
+ src.in_throw_mode = 1
+ if(src.throw_icon)
+ src.throw_icon.icon_state = "act_throw_on"
+
+/mob/proc/isSynthetic()
+ return 0
+
+/mob/proc/is_muzzled()
+ return 0
+
+//Exploitable Info Update
+
+/mob/proc/amend_exploitable(var/obj/item/I)
+ if(istype(I))
+ exploit_addons |= I
+ var/exploitmsg = html_decode("\n" + "Has " + I.name + ".")
+ exploit_record += exploitmsg
+
+/client/proc/check_has_body_select()
+ return mob && mob.hud_used && istype(mob.zone_sel, /obj/screen/zone_sel)
+
+/client/verb/body_toggle_head()
+ set name = "body-toggle-head"
+ set hidden = 1
+ toggle_zone_sel(list(BP_HEAD, O_EYES, O_MOUTH))
+
+/client/verb/body_r_arm()
+ set name = "body-r-arm"
+ set hidden = 1
+ toggle_zone_sel(list(BP_R_ARM,BP_R_HAND))
+
+/client/verb/body_l_arm()
+ set name = "body-l-arm"
+ set hidden = 1
+ toggle_zone_sel(list(BP_L_ARM,BP_L_HAND))
+
+/client/verb/body_chest()
+ set name = "body-chest"
+ set hidden = 1
+ toggle_zone_sel(list(BP_TORSO))
+
+/client/verb/body_groin()
+ set name = "body-groin"
+ set hidden = 1
+ toggle_zone_sel(list(BP_GROIN))
+
+/client/verb/body_r_leg()
+ set name = "body-r-leg"
+ set hidden = 1
+ toggle_zone_sel(list(BP_R_LEG,BP_R_FOOT))
+
+/client/verb/body_l_leg()
+ set name = "body-l-leg"
+ set hidden = 1
+ toggle_zone_sel(list(BP_L_LEG,BP_L_FOOT))
+
+/client/proc/toggle_zone_sel(list/zones)
+ if(!check_has_body_select())
+ return
+ var/obj/screen/zone_sel/selector = mob.zone_sel
+ selector.set_selected_zone(next_in_list(mob.zone_sel.selecting,zones))
+
+// This handles setting the client's color variable, which makes everything look a specific color.
+// This proc is here so it can be called without needing to check if the client exists, or if the client relogs.
+// This is for inheritence since /mob/living will serve most cases. If you need ghosts to use this you'll have to implement that yourself.
+/mob/proc/update_client_color()
+ if(client && client.color)
+ animate(client, color = null, time = 10)
+ return
+
+/mob/proc/swap_hand()
+ return
+
+//Throwing stuff
+/mob/proc/throw_item(atom/target)
+ return
+
+/mob/proc/will_show_tooltip()
+ if(alpha <= EFFECTIVE_INVIS)
+ return FALSE
+ return TRUE
+
+/mob/MouseEntered(location, control, params)
+ if(usr != src && usr.is_preference_enabled(/datum/client_preference/mob_tooltips) && src.will_show_tooltip())
+ openToolTip(user = usr, tip_src = src, params = params, title = get_nametag_name(usr), content = get_nametag_desc(usr))
+
+ ..()
+
+/mob/MouseDown()
+ closeToolTip(usr) //No reason not to, really
+
+ ..()
+
+/mob/MouseExited()
+ closeToolTip(usr) //No reason not to, really
+
+ ..()
+
+// Manages a global list of mobs with clients attached, indexed by z-level.
+/mob/proc/update_client_z(new_z) // +1 to register, null to unregister.
+ if(registered_z != new_z)
+ if(registered_z)
+ GLOB.players_by_zlevel[registered_z] -= src
+ if(client)
+ if(new_z)
+ GLOB.players_by_zlevel[new_z] += src
+ registered_z = new_z
+ else
+ registered_z = null
+
+GLOBAL_LIST_EMPTY_TYPED(living_players_by_zlevel, /list)
+/mob/living/update_client_z(new_z)
+ var/precall_reg_z = registered_z
+ . = ..() // will update registered_z if necessary
+ if(precall_reg_z != registered_z) // parent did work, let's do work too
+ if(precall_reg_z)
+ GLOB.living_players_by_zlevel[precall_reg_z] -= src
+ if(registered_z)
+ GLOB.living_players_by_zlevel[registered_z] += src
+
+/mob/onTransitZ(old_z, new_z)
+ ..()
+ update_client_z(new_z)
+
+/mob/cloak()
+ . = ..()
+ if(client && cloaked_selfimage)
+ client.images += cloaked_selfimage
+
+/mob/uncloak()
+ if(client && cloaked_selfimage)
+ client.images -= cloaked_selfimage
+ return ..()
+
+/mob/get_cloaked_selfimage()
+ var/icon/selficon = getCompoundIcon(src)
+ selficon.MapColors(0,0,0, 0,0,0, 0,0,0, 1,1,1) //White
+ var/image/selfimage = image(selficon)
+ selfimage.color = "#0000FF"
+ selfimage.alpha = 100
+ selfimage.layer = initial(layer)
+ selfimage.plane = initial(plane)
+ selfimage.loc = src
+
+ return selfimage
+
+/mob/proc/GetAltName()
+ return ""
+
+/mob/proc/get_ghost(even_if_they_cant_reenter = 0)
+ if(mind)
+ return mind.get_ghost(even_if_they_cant_reenter)
+
+/mob/proc/grab_ghost(force)
+ if(mind)
+ return mind.grab_ghost(force = force)
+=======
+/mob/Destroy()//This makes sure that mobs withGLOB.clients/keys are not just deleted from the game.
+ mob_list -= src
+ dead_mob_list -= src
+ living_mob_list -= src
+ unset_machine()
+ qdel(hud_used)
+ clear_fullscreen()
+ if(client)
+ for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
+ qdel(spell_master)
+ remove_screen_obj_references()
+ client.screen = list()
+ if(mind && mind.current == src)
+ spellremove(src)
+ ghostize()
+ QDEL_NULL(plane_holder)
+ ..()
+ return QDEL_HINT_HARDDEL_NOW
+
+/mob/proc/remove_screen_obj_references()
+ hands = null
+ pullin = null
+ purged = null
+ internals = null
+ i_select = null
+ m_select = null
+ healths = null
+ throw_icon = null
+ pain = null
+ item_use_icon = null
+ gun_move_icon = null
+ gun_setting_icon = null
+ spell_masters = null
+ zone_sel = null
+
+/mob/Initialize()
+ mob_list += src
+ if(stat == DEAD)
+ dead_mob_list += src
+ else
+ living_mob_list += src
+ lastarea = get_area(src)
+ set_focus(src) // VOREStation Add - Key Handling
+ hook_vr("mob_new",list(src)) //VOREStation Code
+ update_transform() // Some mobs may start bigger or smaller than normal.
+ return ..()
+
+/mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
+
+ if(!client && !teleop) return
+
+ if (type)
+ if((type & VISIBLE_MESSAGE) && (is_blind() || paralysis) )//Vision related
+ if (!( alt ))
+ return
+ else
+ msg = alt
+ type = alt_type
+ if ((type & AUDIBLE_MESSAGE) && is_deaf())//Hearing related
+ if (!( alt ))
+ return
+ else
+ msg = alt
+ type = alt_type
+ if ((type & VISIBLE_MESSAGE) && (sdisabilities & BLIND))
+ return
+ // Added voice muffling for Issue 41.
+ if(stat == UNCONSCIOUS || sleeping > 0)
+ to_chat(src, "... You can almost hear someone talking ...")
+ else
+ to_chat(src,msg)
+ if(teleop)
+ to_chat(teleop, create_text_tag("body", "BODY:", teleop) + "[msg]")
+ return
+
+// Show a message to all mobs and objects in sight of this one
+// This would be for visible actions by the src mob
+// message is the message output to anyone who can see e.g. "[src] does something!"
+// self_message (optional) is what the src mob sees e.g. "You do something!"
+// blind_message (optional) is what blind people will hear e.g. "You hear something!"
+/mob/visible_message(var/message, var/self_message, var/blind_message, var/list/exclude_mobs = null, var/range = world.view, var/runemessage)
+ if(self_message)
+ if(LAZYLEN(exclude_mobs))
+ exclude_mobs |= src
+ else
+ exclude_mobs = list(src)
+ src.show_message(self_message, 1, blind_message, 2)
+ if(isnull(runemessage))
+ runemessage = -1
+ . = ..(message, blind_message, exclude_mobs, range, runemessage) // Really not ideal that atom/visible_message has different arg numbering :(
+
+// Returns an amount of power drawn from the object (-1 if it's not viable).
+// If drain_check is set it will not actually drain power, just return a value.
+// If surge is set, it will destroy/damage the recipient and not return any power.
+// Not sure where to define this, so it can sit here for the rest of time.
+/atom/proc/drain_power(var/drain_check,var/surge, var/amount = 0)
+ return -1
+
+// Show a message to all mobs and objects in earshot of this one
+// This would be for audible actions by the src mob
+// message is the message output to anyone who can hear.
+// self_message (optional) is what the src mob hears.
+// deaf_message (optional) is what deaf people will see.
+// hearing_distance (optional) is the range, how many tiles away the message can be heard.
+/mob/audible_message(var/message, var/deaf_message, var/hearing_distance, var/self_message, var/radio_message, var/runemessage)
+
+ var/range = hearing_distance || world.view
+ var/list/hear = get_mobs_and_objs_in_view_fast(get_turf(src),range,remote_ghosts = FALSE)
+
+ var/list/hearing_mobs = hear["mobs"]
+ var/list/hearing_objs = hear["objs"]
+
+ if(isnull(runemessage))
+ runemessage = -1 // Symmetry with mob/audible_message, despite the fact this one doesn't call parent. Maybe it should!
+
+ if(radio_message)
+ for(var/obj/O as anything in hearing_objs)
+ O.hear_talk(src, list(new /datum/multilingual_say_piece(GLOB.all_languages["Noise"], radio_message)), null)
+ else
+ for(var/obj/O as anything in hearing_objs)
+ O.show_message(message, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE)
+
+ for(var/mob/M as anything in hearing_mobs)
+ var/msg = message
+ if(self_message && M==src)
+ msg = self_message
+ M.show_message(msg, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE)
+ if(runemessage != -1)
+ M.create_chat_message(src, "[runemessage || message]", FALSE, list("emote"), audible = FALSE)
+
+/mob/proc/findname(msg)
+ for(var/mob/M in mob_list)
+ if (M.real_name == text("[]", msg))
+ return M
+ return 0
+
+/mob/proc/Life()
+// if(organStructure)
+// organStructure.ProcessOrgans()
+ return
+
+#define UNBUCKLED 0
+#define PARTIALLY_BUCKLED 1
+#define FULLY_BUCKLED 2
+/mob/proc/buckled()
+ // Preliminary work for a future buckle rewrite,
+ // where one might be fully restrained (like an elecrical chair), or merely secured (shuttle chair, keeping you safe but not otherwise restrained from acting)
+ if(!buckled)
+ return UNBUCKLED
+ return restrained() ? FULLY_BUCKLED : PARTIALLY_BUCKLED
+
+/mob/proc/is_blind()
+ return ((sdisabilities & BLIND) || blinded || incapacitated(INCAPACITATION_KNOCKOUT))
+
+/mob/proc/is_deaf()
+ return ((sdisabilities & DEAF) || ear_deaf || incapacitated(INCAPACITATION_KNOCKOUT))
+
+/mob/proc/is_physically_disabled()
+ return incapacitated(INCAPACITATION_DISABLED)
+
+/mob/proc/cannot_stand()
+ return incapacitated(INCAPACITATION_KNOCKDOWN)
+
+/mob/proc/incapacitated(var/incapacitation_flags = INCAPACITATION_DEFAULT)
+ if ((incapacitation_flags & INCAPACITATION_STUNNED) && stunned)
+ return 1
+
+ if ((incapacitation_flags & INCAPACITATION_FORCELYING) && (weakened || resting))
+ return 1
+
+ if ((incapacitation_flags & INCAPACITATION_KNOCKOUT) && (stat || paralysis || sleeping || (status_flags & FAKEDEATH)))
+ return 1
+
+ if((incapacitation_flags & INCAPACITATION_RESTRAINED) && restrained())
+ return 1
+
+ if((incapacitation_flags & (INCAPACITATION_BUCKLED_PARTIALLY|INCAPACITATION_BUCKLED_FULLY)))
+ var/buckling = buckled()
+ if(buckling >= PARTIALLY_BUCKLED && (incapacitation_flags & INCAPACITATION_BUCKLED_PARTIALLY))
+ return 1
+ if(buckling == FULLY_BUCKLED && (incapacitation_flags & INCAPACITATION_BUCKLED_FULLY))
+ return 1
+
+ return 0
+
+#undef UNBUCKLED
+#undef PARTIALLY_BUCKLED
+#undef FULLY_BUCKLED
+
+/mob/proc/restrained()
+ return
+
+/mob/proc/reset_view(atom/A)
+ if (client)
+ if (istype(A, /atom/movable))
+ client.perspective = EYE_PERSPECTIVE
+ client.eye = A
+ else
+ if (isturf(loc))
+ client.eye = client.mob
+ client.perspective = MOB_PERSPECTIVE
+ else
+ client.perspective = EYE_PERSPECTIVE
+ client.eye = loc
+ return TRUE
+
+/mob/verb/pointed(atom/A as mob|obj|turf in view())
+ set name = "Point To"
+ set category = "Object"
+
+ if(!src || !isturf(src.loc) || !(A in view(src.loc)))
+ return 0
+ if(istype(A, /obj/effect/decal/point))
+ return 0
+
+ var/turf/tile = get_turf(A)
+ if (!tile)
+ return 0
+
+ var/turf/our_tile = get_turf(src)
+ var/obj/visual = new /obj/effect/decal/point(our_tile)
+ visual.invisibility = invisibility
+ visual.plane = ABOVE_PLANE
+ visual.layer = FLY_LAYER
+
+ animate(visual,
+ pixel_x = (tile.x - our_tile.x) * world.icon_size + A.pixel_x,
+ pixel_y = (tile.y - our_tile.y) * world.icon_size + A.pixel_y,
+ time = 1.7,
+ easing = EASE_OUT)
+
+ QDEL_IN(visual, 2 SECONDS) //Better qdel
+
+ face_atom(A)
+ return 1
+
+
+/mob/proc/ret_grab(list/L, flag)
+ return
+
+/mob/verb/mode()
+ set name = "Activate Held Object"
+ set category = "Object"
+ set src = usr
+
+ return
+
+/*
+/mob/verb/dump_source()
+
+ var/master = ""
+ for(var/t in typesof(/area))
+ master += text("[]\n", t)
+ //Foreach goto(26)
+ src << browse(master)
+ return
+*/
+
+/mob/verb/memory()
+ set name = "Notes"
+ set category = "IC"
+ if(mind)
+ mind.show_memory(src)
+ else
+ to_chat(src, "The game appears to have misplaced your mind datum, so we can't show you your notes.")
+
+/mob/verb/add_memory(msg as message)
+ set name = "Add Note"
+ set category = "IC"
+
+ msg = sanitize(msg)
+
+ if(mind)
+ mind.store_memory(msg)
+ else
+ to_chat(src, "The game appears to have misplaced your mind datum, so we can't show you your notes.")
+
+/mob/proc/store_memory(msg as message, popup, sane = 1)
+ msg = copytext(msg, 1, MAX_MESSAGE_LEN)
+
+ if (sane)
+ msg = sanitize(msg)
+
+ if (length(memory) == 0)
+ memory += msg
+ else
+ memory += "
[msg]"
+
+ if (popup)
+ memory()
+
+/mob/proc/update_flavor_text()
+ set src in usr
+ if(usr != src)
+ to_chat(usr, "No.")
+ var/msg = sanitize(input(usr,"Set the flavor text in your 'examine' verb.","Flavor Text",html_decode(flavor_text)) as message|null, extra = 0) //VOREStation Edit: separating out OOC notes
+
+ if(msg != null)
+ flavor_text = msg
+
+/mob/proc/warn_flavor_changed()
+ if(flavor_text && flavor_text != "") // don't spam people that don't use it!
+ to_chat(src, "OOC Warning:
")
+ to_chat(src, "Your flavor text is likely out of date! Change")
+
+/mob/proc/print_flavor_text()
+ if (flavor_text && flavor_text != "")
+ var/msg = replacetext(flavor_text, "\n", " ")
+ if(length(msg) <= 40)
+ return "[msg]"
+ else
+ return "[copytext_preserve_html(msg, 1, 37)]... More..."
+
+/*
+/mob/verb/help()
+ set name = "Help"
+ src << browse('html/help.html', "window=help")
+ return
+*/
+
+/mob/proc/set_respawn_timer(var/time)
+ // Try to figure out what time to use
+
+ // Special cases, can never respawn
+ if(ticker?.mode?.deny_respawn)
+ time = -1
+ else if(!config.abandon_allowed)
+ time = -1
+ else if(!config.respawn)
+ time = -1
+
+ // Special case for observing before game start
+ else if(ticker?.current_state <= GAME_STATE_SETTING_UP)
+ time = 1 MINUTE
+
+ // Wasn't given a time, use the config time
+ else if(!time)
+ time = config.respawn_time
+
+ var/keytouse = ckey
+ // Try harder to find a key to use
+ if(!keytouse && key)
+ keytouse = ckey(key)
+ else if(!keytouse && mind?.key)
+ keytouse = ckey(mind.key)
+
+ GLOB.respawn_timers[keytouse] = world.time + time
+
+/mob/observer/dead/set_respawn_timer()
+ if(config.antag_hud_restricted && has_enabled_antagHUD)
+ ..(-1)
+ else
+ return // Don't set it, no need
+
+/mob/verb/abandon_mob()
+ set name = "Return to Menu"
+ set category = "OOC"
+
+ if(stat != DEAD || !ticker)
+ to_chat(usr, "You must be dead to use this!")
+ return
+
+ // Final chance to abort "respawning"
+ if(mind && timeofdeath) // They had spawned before
+ var/choice = tgui_alert(usr, "Returning to the menu will prevent your character from being revived in-round. Are you sure?", "Confirmation", list("No, wait", "Yes, leave"))
+ if(choice == "No, wait")
+ return
+
+ // Beyond this point, you're going to respawn
+ to_chat(usr, config.respawn_message)
+
+ if(!client)
+ log_game("[usr.key] AM failed due to disconnect.")
+ return
+ client.screen.Cut()
+ client.screen += client.void
+ if(!client)
+ log_game("[usr.key] AM failed due to disconnect.")
+ return
+
+ announce_ghost_joinleave(client, 0)
+
+ var/mob/new_player/M = new /mob/new_player()
+ if(!client)
+ log_game("[usr.key] AM failed due to disconnect.")
+ qdel(M)
+ return
+
+ M.key = key
+ if(M.mind)
+ M.mind.reset()
+ return
+
+/client/verb/changes()
+ set name = "Changelog"
+ set category = "OOC"
+ src << browse('html/changelog.html', "window=changes;size=675x650")
+ if(prefs.lastchangelog != changelog_hash)
+ prefs.lastchangelog = changelog_hash
+ SScharacter_setup.queue_preferences_save(prefs)
+ winset(src, "rpane.changelog", "background-color=none;font-style=;")
+
+/mob/verb/observe()
+ set name = "Observe"
+ set category = "OOC"
+ var/is_admin = 0
+
+ if(client.holder && (client.holder.rights & R_ADMIN|R_EVENT))
+ is_admin = 1
+ else if(stat != DEAD || istype(src, /mob/new_player))
+ to_chat(usr, "You must be observing to use this!")
+ return
+
+ if(is_admin && stat == DEAD)
+ is_admin = 0
+
+ var/list/targets = list()
+
+
+ targets += observe_list_format(nuke_disks)
+ targets += observe_list_format(all_singularities)
+ targets += getmobs()
+ targets += observe_list_format(sortAtom(mechas_list))
+ targets += observe_list_format(SSshuttles.ships)
+
+ client.perspective = EYE_PERSPECTIVE
+
+ var/eye_name = null
+
+ var/ok = "[is_admin ? "Admin Observe" : "Observe"]"
+ eye_name = tgui_input_list(usr, "Select something to [ok]:", "Select Target", targets)
+
+ if (!eye_name)
+ return
+
+ var/mob/mob_eye = targets[eye_name]
+
+ if(client && mob_eye)
+ client.eye = mob_eye
+ if (is_admin)
+ client.adminobs = 1
+ if(mob_eye == client.mob || client.eye == client.mob)
+ client.adminobs = 0
+
+/mob/verb/cancel_camera()
+ set name = "Cancel Camera View"
+ set category = "OOC"
+ unset_machine()
+ reset_view(null)
+
+/mob/Topic(href, href_list)
+ if(href_list["mach_close"])
+ var/t1 = text("window=[href_list["mach_close"]]")
+ unset_machine()
+ src << browse(null, t1)
+
+ if(href_list["flavor_more"])
+ usr << browse(text("[][]", name, replacetext(flavor_text, "\n", "
")), text("window=[];size=500x200", name))
+ onclose(usr, "[name]")
+ if(href_list["flavor_change"])
+ update_flavor_text()
+// ..()
+ return
+
+
+/mob/proc/pull_damage()
+ return 0
+
+/mob/verb/stop_pulling()
+
+ set name = "Stop Pulling"
+ set category = "IC"
+
+ if(pulling)
+ if(ishuman(pulling))
+ var/mob/living/carbon/human/H = pulling
+ visible_message(SPAN_WARNING("\The [src] lets go of \the [H]."), SPAN_NOTICE("You let go of \the [H]."), exclude_mobs = list(H))
+ if(!H.stat)
+ to_chat(H, SPAN_WARNING("\The [src] lets go of you."))
+ pulling.pulledby = null
+ pulling = null
+ if(pullin)
+ pullin.icon_state = "pull0"
+
+/mob/proc/start_pulling(var/atom/movable/AM)
+
+ if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort!
+ return
+
+ if (AM.anchored)
+ to_chat(src, "It won't budge!")
+ return
+
+ var/mob/M = AM
+ if(ismob(AM))
+
+ if(!can_pull_mobs || !can_pull_size)
+ to_chat(src, "They won't budge!")
+ return
+
+ if((mob_size < M.mob_size) && (can_pull_mobs != MOB_PULL_LARGER))
+ to_chat(src, "[M] is too large for you to move!")
+ return
+
+ if((mob_size == M.mob_size) && (can_pull_mobs == MOB_PULL_SMALLER))
+ to_chat(src, "[M] is too heavy for you to move!")
+ return
+
+ // If your size is larger than theirs and you have some
+ // kind of mob pull value AT ALL, you will be able to pull
+ // them, so don't bother checking that explicitly.
+
+ if(M.grabbed_by.len)
+ // Only start pulling when nobody else has a grab on them
+ . = 1
+ for(var/obj/item/weapon/grab/G in M.grabbed_by)
+ if(G.assailant != usr)
+ . = 0
+ else
+ qdel(G)
+ if(!.)
+ to_chat(src, "Somebody has a grip on them!")
+ return
+
+ if(!iscarbon(src))
+ M.LAssailant = null
+ else
+ M.LAssailant = usr
+
+ else if(isobj(AM))
+ var/obj/I = AM
+ if(!can_pull_size || can_pull_size < I.w_class)
+ to_chat(src, "It won't budge!")
+ return
+
+ if(pulling)
+ var/pulling_old = pulling
+ stop_pulling()
+ // Are we pulling the same thing twice? Just stop pulling.
+ if(pulling_old == AM)
+ return
+
+ src.pulling = AM
+ AM.pulledby = src
+
+ if(pullin)
+ pullin.icon_state = "pull1"
+
+ if(ishuman(AM))
+ var/mob/living/carbon/human/H = AM
+ if(H.lying) // If they're on the ground we're probably dragging their arms to move them
+ visible_message(SPAN_WARNING("\The [src] leans down and grips \the [H]'s arms."), SPAN_NOTICE("You lean down and grip \the [H]'s arms."), exclude_mobs = list(H))
+ if(!H.stat)
+ to_chat(H, SPAN_WARNING("\The [src] leans down and grips your arms."))
+ else //Otherwise we're probably just holding their arm to lead them somewhere
+ visible_message(SPAN_WARNING("\The [src] grips \the [H]'s arm."), SPAN_NOTICE("You grip \the [H]'s arm."), exclude_mobs = list(H))
+ if(!H.stat)
+ to_chat(H, SPAN_WARNING("\The [src] grips your arm."))
+ playsound(src.loc, 'sound/weapons/thudswoosh.ogg', 25) //Quieter than hugging/grabbing but we still want some audio feedback
+
+ if(H.pull_damage())
+ to_chat(src, "Pulling \the [H] in their current condition would probably be a bad idea.")
+
+ //Attempted fix for people flying away through space when cuffed and dragged.
+ if(ismob(AM))
+ var/mob/pulled = AM
+ pulled.inertia_dir = 0
+
+/mob/proc/can_use_hands()
+ return
+
+/mob/proc/is_active()
+ return (0 >= usr.stat)
+
+/mob/proc/is_dead()
+ return stat == DEAD
+
+/mob/proc/is_mechanical()
+ if(mind && (mind.assigned_role == "Cyborg" || mind.assigned_role == "AI"))
+ return 1
+ return istype(src, /mob/living/silicon) || get_species() == "Machine"
+
+/mob/proc/is_ready()
+ return client && !!mind
+
+/mob/proc/get_gender()
+ return gender
+
+/mob/proc/see(message)
+ if(!is_active())
+ return 0
+ to_chat(src,message)
+ return 1
+
+/mob/proc/show_viewers(message)
+ for(var/mob/M in viewers())
+ M.see(message)
+
+/mob/Stat()
+ ..()
+ . = (is_client_active(10 MINUTES))
+
+ if(.)
+ if(statpanel("Status"))
+ stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
+ if(ticker && ticker.current_state != GAME_STATE_PREGAME)
+ stat("Station Time", stationtime2text())
+ stat("Station Date", stationdate2text())
+ stat("Round Duration", roundduration2text())
+
+ if(client.holder)
+ if(statpanel("Status"))
+ stat("Location:", "([x], [y], [z]) [loc]")
+ stat("CPU:","[world.cpu]")
+ stat("Instances:","[world.contents.len]")
+ stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
+ stat("Keys Held", keys2text(client.move_keys_held | client.mod_keys_held))
+ stat("Next Move ADD", dirs2text(client.next_move_dir_add))
+ stat("Next Move SUB", dirs2text(client.next_move_dir_sub))
+
+ if(statpanel("MC"))
+ stat("Location:", "([x], [y], [z]) [loc]")
+ stat("CPU:","[world.cpu]")
+ stat("Instances:","[world.contents.len]")
+ stat("World Time:", world.time)
+ stat("Real time of day:", REALTIMEOFDAY)
+ stat(null)
+ if(GLOB)
+ GLOB.stat_entry()
+ else
+ stat("Globals:", "ERROR")
+ if(Master)
+ Master.stat_entry()
+ else
+ stat("Master Controller:", "ERROR")
+ if(Failsafe)
+ Failsafe.stat_entry()
+ else
+ stat("Failsafe Controller:", "ERROR")
+ if(Master)
+ stat(null)
+ for(var/datum/controller/subsystem/SS in Master.subsystems)
+ SS.stat_entry()
+
+ if(statpanel("Tickets"))
+ GLOB.ahelp_tickets.stat_entry()
+
+
+ if(length(GLOB.sdql2_queries))
+ if(statpanel("SDQL2"))
+ stat("Access Global SDQL2 List", GLOB.sdql2_vv_statobj)
+ for(var/datum/SDQL2_query/Q as anything in GLOB.sdql2_queries)
+ Q.generate_stat()
+
+ if(listed_turf && client)
+ if(!TurfAdjacent(listed_turf))
+ listed_turf = null
+ else
+ if(statpanel("Turf"))
+ stat(listed_turf)
+ for(var/atom/A in listed_turf)
+ if(!A.mouse_opacity)
+ continue
+ if(A.invisibility > see_invisible)
+ continue
+ if(is_type_in_list(A, shouldnt_see))
+ continue
+ if(A.plane > plane)
+ continue
+ stat(A)
+
+
+// facing verbs
+/mob/proc/canface()
+// if(!canmove) return 0 //VOREStation Edit. Redundant check that only affects conscious proning, actual inability to turn and shift around handled by actual inabilities.
+ if(stat) return 0
+ if(anchored) return 0
+ if(transforming) return 0
+ return 1
+
+// Not sure what to call this. Used to check if humans are wearing an AI-controlled exosuit and hence don't need to fall over yet.
+/mob/proc/can_stand_overridden()
+ return 0
+
+//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it.
+/mob/proc/update_canmove()
+ return canmove
+
+
+/mob/proc/facedir(var/ndir)
+ if(!canface() || (client && (client.moving || !checkMoveCooldown())))
+ DEBUG_INPUT("Denying Facedir for [src] (moving=[client?.moving])")
+ return 0
+ set_dir(ndir)
+ if(buckled && buckled.buckle_movable)
+ buckled.set_dir(ndir)
+ setMoveCooldown(movement_delay())
+ return 1
+
+
+/mob/verb/eastface()
+ set hidden = 1
+ return facedir(client.client_dir(EAST))
+
+
+/mob/verb/westface()
+ set hidden = 1
+ return facedir(client.client_dir(WEST))
+
+
+/mob/verb/northface()
+ set hidden = 1
+ return facedir(client.client_dir(NORTH))
+
+
+/mob/verb/southface()
+ set hidden = 1
+ return facedir(client.client_dir(SOUTH))
+
+
+//This might need a rename but it should replace the can this mob use things check
+/mob/proc/IsAdvancedToolUser()
+ return 0
+
+/mob/proc/Stun(amount)
+ if(status_flags & CANSTUN)
+ facing_dir = null
+ stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/SetStunned(amount) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned"
+ if(status_flags & CANSTUN)
+ stunned = max(amount,0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/AdjustStunned(amount)
+ if(status_flags & CANSTUN)
+ stunned = max(stunned + amount,0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/Weaken(amount)
+ if(status_flags & CANWEAKEN)
+ facing_dir = null
+ weakened = max(max(weakened,amount),0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/SetWeakened(amount)
+ if(status_flags & CANWEAKEN)
+ weakened = max(amount,0)
+ update_canmove() //can you guess what this does yet?
+ return
+
+/mob/proc/AdjustWeakened(amount)
+ if(status_flags & CANWEAKEN)
+ weakened = max(weakened + amount,0)
+ update_canmove() //updates lying, canmove and icons
+ return
+
+/mob/proc/Paralyse(amount)
+ if(status_flags & CANPARALYSE)
+ facing_dir = null
+ paralysis = max(max(paralysis,amount),0)
+ return
+
+/mob/proc/SetParalysis(amount)
+ if(status_flags & CANPARALYSE)
+ paralysis = max(amount,0)
+ return
+
+/mob/proc/AdjustParalysis(amount)
+ if(status_flags & CANPARALYSE)
+ paralysis = max(paralysis + amount,0)
+ return
+
+/mob/proc/Sleeping(amount)
+ facing_dir = null
+ sleeping = max(max(sleeping,amount),0)
+ return
+
+/mob/proc/SetSleeping(amount)
+ sleeping = max(amount,0)
+ return
+
+/mob/proc/AdjustSleeping(amount)
+ sleeping = max(sleeping + amount,0)
+ return
+
+/mob/proc/Confuse(amount)
+ confused = max(max(confused,amount),0)
+ return
+
+/mob/proc/SetConfused(amount)
+ confused = max(amount,0)
+ return
+
+/mob/proc/AdjustConfused(amount)
+ confused = max(confused + amount,0)
+ return
+
+/mob/proc/Blind(amount)
+ eye_blind = max(max(eye_blind,amount),0)
+ return
+
+/mob/proc/SetBlinded(amount)
+ eye_blind = max(amount,0)
+ return
+
+/mob/proc/AdjustBlinded(amount)
+ eye_blind = max(eye_blind + amount,0)
+ return
+
+/mob/proc/Resting(amount)
+ facing_dir = null
+ resting = max(max(resting,amount),0)
+ update_canmove()
+ return
+
+/mob/proc/SetResting(amount)
+ resting = max(amount,0)
+ update_canmove()
+ return
+
+/mob/proc/AdjustResting(amount)
+ resting = max(resting + amount,0)
+ update_canmove()
+ return
+
+/mob/proc/AdjustLosebreath(amount)
+ losebreath = CLAMP(losebreath + amount, 0, 25)
+
+/mob/proc/SetLosebreath(amount)
+ losebreath = CLAMP(amount, 0, 25)
+
+/mob/proc/get_species()
+ return ""
+
+/mob/proc/flash_weak_pain()
+ flick("weak_pain",pain)
+
+/mob/proc/get_visible_implants(var/class = 0)
+ var/list/visible_implants = list()
+ for(var/obj/item/O in embedded)
+ if(O.w_class > class)
+ visible_implants += O
+ return visible_implants
+
+/mob/proc/embedded_needs_process()
+ return (embedded.len > 0)
+
+/mob/proc/yank_out_object()
+ set category = "Object"
+ set name = "Yank out object"
+ set desc = "Remove an embedded item at the cost of bleeding and pain."
+ set src in view(1)
+
+ if(!isliving(usr) || !usr.checkClickCooldown())
+ return
+ usr.setClickCooldown(20)
+
+ if(usr.stat == 1)
+ to_chat(usr, "You are unconcious and cannot do that!")
+ return
+
+ if(usr.restrained())
+ to_chat(usr, "You are restrained and cannot do that!")
+ return
+
+ var/mob/S = src
+ var/mob/U = usr
+ var/list/valid_objects = list()
+ var/self = null
+
+ if(S == U)
+ self = 1 // Removing object from yourself.
+
+ valid_objects = get_visible_implants(0)
+ if(!valid_objects.len)
+ if(self)
+ to_chat(src, "You have nothing stuck in your body that is large enough to remove.")
+ else
+ to_chat(U, "[src] has nothing stuck in their wounds that is large enough to remove.")
+ return
+
+ var/obj/item/weapon/selection = tgui_input_list(usr, "What do you want to yank out?", "Embedded objects", valid_objects)
+
+ if(self)
+ to_chat(src, "You attempt to get a good grip on [selection] in your body.")
+ else
+ to_chat(U, "You attempt to get a good grip on [selection] in [S]'s body.")
+
+ if(!do_after(U, 30))
+ return
+ if(!selection || !S || !U)
+ return
+
+ if(self)
+ visible_message("[src] rips [selection] out of their body.","You rip [selection] out of your body.")
+ else
+ visible_message("[usr] rips [selection] out of [src]'s body.","[usr] rips [selection] out of your body.")
+ valid_objects = get_visible_implants(0)
+ if(valid_objects.len == 1) //Yanking out last object - removing verb.
+ src.verbs -= /mob/proc/yank_out_object
+ clear_alert("embeddedobject")
+
+ if(ishuman(src))
+ var/mob/living/carbon/human/H = src
+ var/obj/item/organ/external/affected
+
+ for(var/obj/item/organ/external/organ in H.organs) //Grab the organ holding the implant.
+ for(var/obj/item/O in organ.implants)
+ if(O == selection)
+ affected = organ
+
+ affected.implants -= selection
+ H.shock_stage+=20
+ affected.take_damage((selection.w_class * 3), 0, 0, 1, "Embedded object extraction")
+
+ if(prob(selection.w_class * 5) && (affected.robotic < ORGAN_ROBOT)) //I'M SO ANEMIC I COULD JUST -DIE-.
+ var/datum/wound/internal_bleeding/I = new (min(selection.w_class * 5, 15))
+ affected.wounds += I
+ H.custom_pain("Something tears wetly in your [affected] as [selection] is pulled free!", 50)
+
+ if (ishuman(U))
+ var/mob/living/carbon/human/human_user = U
+ human_user.bloody_hands(H)
+
+ else if(issilicon(src))
+ var/mob/living/silicon/robot/R = src
+ R.embedded -= selection
+ R.adjustBruteLoss(5)
+ R.adjustFireLoss(10)
+
+ selection.forceMove(get_turf(src))
+ U.put_in_hands(selection)
+
+ for(var/obj/item/weapon/O in pinned)
+ if(O == selection)
+ pinned -= O
+ if(!pinned.len)
+ anchored = FALSE
+ return 1
+
+//Check for brain worms in head.
+/mob/proc/has_brain_worms()
+
+ for(var/I in contents)
+ if(istype(I,/mob/living/simple_mob/animal/borer))
+ return I
+
+ return 0
+
+/mob/proc/updateicon()
+ return
+
+// Please always use this proc, never just set the var directly.
+/mob/proc/set_stat(var/new_stat)
+ . = (stat != new_stat)
+ stat = new_stat
+
+/mob/verb/face_direction()
+
+ set name = "Face Direction"
+ set category = "IC"
+ set src = usr
+
+ set_face_dir()
+
+ if(!facing_dir)
+ to_chat(usr, "You are now not facing anything.")
+ else
+ to_chat(usr, "You are now facing [dir2text(facing_dir)].")
+
+/mob/proc/set_face_dir(var/newdir)
+ if(newdir == facing_dir)
+ facing_dir = null
+ else if(newdir)
+ set_dir(newdir)
+ facing_dir = newdir
+ else if(facing_dir)
+ facing_dir = null
+ else
+ set_dir(dir)
+ facing_dir = dir
+
+/mob/set_dir()
+ if(facing_dir)
+ if(!canface() || lying || buckled || restrained())
+ facing_dir = null
+ else if(dir != facing_dir)
+ return ..(facing_dir)
+ else
+ return ..()
+
+/mob/verb/northfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(NORTH))
+
+/mob/verb/southfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(SOUTH))
+
+/mob/verb/eastfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(EAST))
+
+/mob/verb/westfaceperm()
+ set hidden = 1
+ set_face_dir(client.client_dir(WEST))
+
+// Begin VOREstation edit
+/mob/verb/shiftnorth()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_y <= (default_pixel_y + 16))
+ pixel_y++
+ is_shifted = TRUE
+
+/mob/verb/shiftsouth()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_y >= (default_pixel_y - 16))
+ pixel_y--
+ is_shifted = TRUE
+
+/mob/verb/shiftwest()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_x >= (default_pixel_x - 16))
+ pixel_x--
+ is_shifted = TRUE
+
+/mob/verb/shifteast()
+ set hidden = TRUE
+ if(!canface())
+ return FALSE
+ if(pixel_x <= (default_pixel_x + 16))
+ pixel_x++
+ is_shifted = TRUE
+// End VOREstation edit
+
+/mob/proc/adjustEarDamage()
+ return
+
+/mob/proc/setEarDamage()
+ return
+
+// Set client view distance (size of client's screen). Returns TRUE if anything changed.
+/mob/proc/set_viewsize(var/new_view = world.view)
+ if (client && new_view != client.view)
+ client.view = new_view
+ return TRUE
+ return FALSE
+
+//Throwing stuff
+
+/mob/proc/toggle_throw_mode()
+ if (src.in_throw_mode)
+ throw_mode_off()
+ else
+ throw_mode_on()
+
+/mob/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"
+
+/mob/proc/throw_mode_on()
+ src.in_throw_mode = 1
+ if(src.throw_icon)
+ src.throw_icon.icon_state = "act_throw_on"
+
+/mob/proc/isSynthetic()
+ return 0
+
+/mob/proc/is_muzzled()
+ return 0
+
+//Exploitable Info Update
+
+/mob/proc/amend_exploitable(var/obj/item/I)
+ if(istype(I))
+ exploit_addons |= I
+ var/exploitmsg = html_decode("\n" + "Has " + I.name + ".")
+ exploit_record += exploitmsg
+
+/client/proc/check_has_body_select()
+ return mob && mob.hud_used && istype(mob.zone_sel, /obj/screen/zone_sel)
+
+/client/verb/body_toggle_head()
+ set name = "body-toggle-head"
+ set hidden = 1
+ toggle_zone_sel(list(BP_HEAD, O_EYES, O_MOUTH))
+
+/client/verb/body_r_arm()
+ set name = "body-r-arm"
+ set hidden = 1
+ toggle_zone_sel(list(BP_R_ARM,BP_R_HAND))
+
+/client/verb/body_l_arm()
+ set name = "body-l-arm"
+ set hidden = 1
+ toggle_zone_sel(list(BP_L_ARM,BP_L_HAND))
+
+/client/verb/body_chest()
+ set name = "body-chest"
+ set hidden = 1
+ toggle_zone_sel(list(BP_TORSO))
+
+/client/verb/body_groin()
+ set name = "body-groin"
+ set hidden = 1
+ toggle_zone_sel(list(BP_GROIN))
+
+/client/verb/body_r_leg()
+ set name = "body-r-leg"
+ set hidden = 1
+ toggle_zone_sel(list(BP_R_LEG,BP_R_FOOT))
+
+/client/verb/body_l_leg()
+ set name = "body-l-leg"
+ set hidden = 1
+ toggle_zone_sel(list(BP_L_LEG,BP_L_FOOT))
+
+/client/proc/toggle_zone_sel(list/zones)
+ if(!check_has_body_select())
+ return
+ var/obj/screen/zone_sel/selector = mob.zone_sel
+ selector.set_selected_zone(next_in_list(mob.zone_sel.selecting,zones))
+
+// This handles setting the client's color variable, which makes everything look a specific color.
+// This proc is here so it can be called without needing to check if the client exists, or if the client relogs.
+// This is for inheritence since /mob/living will serve most cases. If you need ghosts to use this you'll have to implement that yourself.
+/mob/proc/update_client_color()
+ if(client && client.color)
+ animate(client, color = null, time = 10)
+ return
+
+/mob/proc/swap_hand()
+ return
+
+//Throwing stuff
+/mob/proc/throw_item(atom/target)
+ return
+
+/mob/proc/will_show_tooltip()
+ if(alpha <= EFFECTIVE_INVIS)
+ return FALSE
+ return TRUE
+
+/mob/MouseEntered(location, control, params)
+ if(usr != src && usr.is_preference_enabled(/datum/client_preference/mob_tooltips) && src.will_show_tooltip())
+ openToolTip(user = usr, tip_src = src, params = params, title = get_nametag_name(usr), content = get_nametag_desc(usr))
+
+ ..()
+
+/mob/MouseDown()
+ closeToolTip(usr) //No reason not to, really
+
+ ..()
+
+/mob/MouseExited()
+ closeToolTip(usr) //No reason not to, really
+
+ ..()
+
+// Manages a global list of mobs with clients attached, indexed by z-level.
+/mob/proc/update_client_z(new_z) // +1 to register, null to unregister.
+ if(registered_z != new_z)
+ if(registered_z)
+ GLOB.players_by_zlevel[registered_z] -= src
+ if(client)
+ if(new_z)
+ GLOB.players_by_zlevel[new_z] += src
+ registered_z = new_z
+ else
+ registered_z = null
+
+GLOBAL_LIST_EMPTY_TYPED(living_players_by_zlevel, /list)
+/mob/living/update_client_z(new_z)
+ var/precall_reg_z = registered_z
+ . = ..() // will update registered_z if necessary
+ if(precall_reg_z != registered_z) // parent did work, let's do work too
+ if(precall_reg_z)
+ GLOB.living_players_by_zlevel[precall_reg_z] -= src
+ if(registered_z)
+ GLOB.living_players_by_zlevel[registered_z] += src
+
+/mob/onTransitZ(old_z, new_z)
+ ..()
+ update_client_z(new_z)
+
+/mob/cloak()
+ . = ..()
+ if(client && cloaked_selfimage)
+ client.images += cloaked_selfimage
+
+/mob/uncloak()
+ if(client && cloaked_selfimage)
+ client.images -= cloaked_selfimage
+ return ..()
+
+/mob/get_cloaked_selfimage()
+ var/icon/selficon = getCompoundIcon(src)
+ selficon.MapColors(0,0,0, 0,0,0, 0,0,0, 1,1,1) //White
+ var/image/selfimage = image(selficon)
+ selfimage.color = "#0000FF"
+ selfimage.alpha = 100
+ selfimage.layer = initial(layer)
+ selfimage.plane = initial(plane)
+ selfimage.loc = src
+
+ return selfimage
+
+/mob/proc/GetAltName()
+ return ""
+
+/mob/proc/get_ghost(even_if_they_cant_reenter = 0)
+ if(mind)
+ return mind.get_ghost(even_if_they_cant_reenter)
+
+/mob/proc/grab_ghost(force)
+ if(mind)
+ return mind.grab_ghost(force = force)
+>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
diff --git a/code/modules/mob/new_player/skill.dm b/code/modules/mob/new_player/skill.dm
index a24da0e4ba..e1a0b50b7f 100644
--- a/code/modules/mob/new_player/skill.dm
+++ b/code/modules/mob/new_player/skill.dm
@@ -159,7 +159,7 @@ var/global/list/SKILL_PRE = list("Engineer" = SKILL_ENGINEER, "Roboticist" = SKI
/proc/setup_skills()
if(SKILLS == null)
SKILLS = list()
- for(var/T in (typesof(/datum/skill)-/datum/skill))
+ for(var/T in subtypesof(/datum/skill))
var/datum/skill/S = new T
if(S.ID != "none")
if(!SKILLS.Find(S.field))
diff --git a/code/modules/mob/say_vr.dm b/code/modules/mob/say_vr.dm
index 64f65adfbb..8b06163590 100644
--- a/code/modules/mob/say_vr.dm
+++ b/code/modules/mob/say_vr.dm
@@ -49,8 +49,7 @@
var/list/vis_mobs = vis["mobs"]
var/list/vis_objs = vis["objs"]
- for(var/vismob in vis_mobs)
- var/mob/M = vismob
+ for(var/mob/M as anything in vis_mobs)
if(isobserver(M) && !is_preference_enabled(/datum/client_preference/whisubtle_vis) && !M.client?.holder)
spawn(0)
M.show_message(undisplayed_message, 2)
@@ -58,8 +57,7 @@
spawn(0)
M.show_message(message, 2)
- for(var/visobj in vis_objs)
- var/obj/O = visobj
+ for(var/obj/O as anything in vis_objs)
spawn(0)
O.see_emote(src, message, 2)
diff --git a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm
index f2466213f3..a9a1e3456d 100644
--- a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm
+++ b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm
@@ -83,8 +83,7 @@
return TRUE
var/mob/living/user = usr
if(can_run(user, TRUE, access_network))
- for(var/C in ntnet_global.chat_channels)
- var/datum/ntnet_conversation/chan = C
+ for(var/datum/ntnet_conversation/chan as anything in ntnet_global.chat_channels)
chan.remove_client(src)
netadmin_mode = TRUE
return TRUE
@@ -92,8 +91,7 @@
var/newname = sanitize(params["new_name"])
if(!newname)
return
- for(var/C in ntnet_global.chat_channels)
- var/datum/ntnet_conversation/chan = C
+ for(var/datum/ntnet_conversation/chan as anything in ntnet_global.chat_channels)
if(src in chan.clients)
chan.add_status_message("[username] is now known as [newname].")
username = newname
@@ -163,8 +161,7 @@
ui_header = "ntnrc_idle.gif"
/datum/computer_file/program/chatclient/kill_program(forced = FALSE)
- for(var/C in ntnet_global.chat_channels)
- var/datum/ntnet_conversation/channel = C
+ for(var/datum/ntnet_conversation/channel as anything in ntnet_global.chat_channels)
channel.remove_client(src)
..()
@@ -180,8 +177,7 @@
var/list/data = get_header_data()
var/list/all_channels = list()
- for(var/C in ntnet_global.chat_channels)
- var/datum/ntnet_conversation/conv = C
+ for(var/datum/ntnet_conversation/conv as anything in ntnet_global.chat_channels)
if(conv && conv.title)
all_channels.Add(list(list(
"chan" = conv.title,
diff --git a/code/modules/modular_computers/hardware/network_card.dm b/code/modules/modular_computers/hardware/network_card.dm
index 86af5d9ba0..7a3a4da632 100644
--- a/code/modules/modular_computers/hardware/network_card.dm
+++ b/code/modules/modular_computers/hardware/network_card.dm
@@ -106,8 +106,7 @@ var/global/ntnet_card_uid = 1
var/list/zlevels_in_range = using_map.get_map_levels(holderz, FALSE)
var/list/zlevels_in_long_range = using_map.get_map_levels(holderz, TRUE, om_range = DEFAULT_OVERMAP_RANGE) - zlevels_in_range
var/best = 0
- for(var/relay in ntnet_global.relays)
- var/obj/machinery/ntnet_relay/R = relay
+ for(var/obj/machinery/ntnet_relay/R as anything in ntnet_global.relays)
//Relay is down
if(!R.operable())
continue
diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm
index 8117293f90..cd2668f1d4 100644
--- a/code/modules/nifsoft/nif.dm
+++ b/code/modules/nifsoft/nif.dm
@@ -339,8 +339,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
//nif_hud.process_hud(human,1) //TODO VIS
//Process all the ones that want that
- for(var/S in nifsofts_life)
- var/datum/nifsoft/nifsoft = S
+ for(var/datum/nifsoft/nifsoft as anything in nifsofts_life)
nifsoft.life(human)
if(NIF_POWFAIL)
diff --git a/code/modules/nifsoft/nif_softshop.dm b/code/modules/nifsoft/nif_softshop.dm
index 9ba72f215e..3fb2f43684 100644
--- a/code/modules/nifsoft/nif_softshop.dm
+++ b/code/modules/nifsoft/nif_softshop.dm
@@ -60,8 +60,7 @@
if(!starting_legal_nifsoft)
starting_legal_nifsoft = list()
starting_illegal_nifsoft = list()
- for(var/P in (subtypesof(/datum/nifsoft) - typesof(/datum/nifsoft/package)))
- var/datum/nifsoft/NS = P
+ for(var/datum/nifsoft/NS as anything in (subtypesof(/datum/nifsoft) - typesof(/datum/nifsoft/package)))
if(initial(NS.vended))
switch(initial(NS.illegal))
if(TRUE)
@@ -80,8 +79,7 @@
for(var/current_list in all_products)
var/category = current_list[CAT_HIDDEN]
- for(var/entry in current_list[CAT_NORMAL])
- var/datum/nifsoft/NS = entry
+ for(var/datum/nifsoft/NS as anything in current_list[CAT_NORMAL])
var/applies_to = initial(NS.applies_to)
var/context = ""
if(!(applies_to & NIF_SYNTHETIC))
@@ -89,7 +87,7 @@
else if(!(applies_to & NIF_ORGANIC))
context = " (Syn Only)"
var/name = "[initial(NS.name)][context]"
- var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry, name)
+ var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, NS, name)
product.price = initial(NS.cost)
product.amount = 10
diff --git a/code/modules/nifsoft/software/05_health.dm b/code/modules/nifsoft/software/05_health.dm
index 7ceb260b6e..83503ee2f1 100644
--- a/code/modules/nifsoft/software/05_health.dm
+++ b/code/modules/nifsoft/software/05_health.dm
@@ -115,11 +115,23 @@
//Needs fixing W << 'sound/voice/nifmedsynth_injured.ogg' //CHOMP Add
activate()
+<<<<<<< HEAD
for(var/eo in nif.human.bad_external_organs)
var/obj/item/organ/external/EO = eo
for(var/w in EO.wounds)
var/datum/wound/W = w
if(W.damage <= 30) // Chomp Edit // The current limb break threshold.
+||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
+ for(var/eo in nif.human.bad_external_organs)
+ var/obj/item/organ/external/EO = eo
+ for(var/w in EO.wounds)
+ var/datum/wound/W = w
+ if(W.damage <= 5)
+=======
+ for(var/obj/item/organ/external/EO as anything in nif.human.bad_external_organs)
+ for(var/datum/wound/W as anything in EO.wounds)
+ if(W.damage <= 5)
+>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
W.heal_damage(0.1)
EO.update_damages()
if(EO.update_icon())
diff --git a/code/modules/nifsoft/software/13_soulcatcher.dm b/code/modules/nifsoft/software/13_soulcatcher.dm
index 6bb9536426..750f1b7df2 100644
--- a/code/modules/nifsoft/software/13_soulcatcher.dm
+++ b/code/modules/nifsoft/software/13_soulcatcher.dm
@@ -75,10 +75,9 @@
to_chat(nif.human,"\[[bicon(nif.big_icon)]NIF\] Soulcatcher displays, \"[message]\"")
nif.human << sound
- for(var/brainmob in brainmobs)
- var/mob/living/carbon/brain/caught_soul/CS = brainmob
+ for(var/mob/living/carbon/brain/caught_soul/CS as anything in brainmobs)
to_chat(CS,"\[[bicon(nif.big_icon)]NIF\] Soulcatcher displays, \"[message]\"")
- brainmob << sound
+ CS << sound
/datum/nifsoft/soulcatcher/proc/say_into(var/message, var/mob/living/sender, var/mob/eyeobj)
var/sender_name = eyeobj ? eyeobj.name : sender.name
@@ -90,8 +89,7 @@
//Not AR Projecting
else
to_chat(nif.human,"\[[bicon(nif.big_icon)]NIF\] [sender_name] speaks, \"[message]\"")
- for(var/brainmob in brainmobs)
- var/mob/living/carbon/brain/caught_soul/CS = brainmob
+ for(var/mob/living/carbon/brain/caught_soul/CS as anything in brainmobs)
to_chat(CS,"\[[bicon(nif.big_icon)]NIF\] [sender_name] speaks, \"[message]\"")
log_nsay(message,nif.human.real_name,sender)
@@ -106,8 +104,7 @@
//Not AR Projecting
else
to_chat(nif.human,"\[[bicon(nif.big_icon)]NIF\] [sender_name] [message]")
- for(var/brainmob in brainmobs)
- var/mob/living/carbon/brain/caught_soul/CS = brainmob
+ for(var/mob/living/carbon/brain/caught_soul/CS as anything in brainmobs)
to_chat(CS,"\[[bicon(nif.big_icon)]NIF\] [sender_name] [message]")
log_nme(message,nif.human.real_name,sender)
@@ -135,8 +132,7 @@
new_flavor = sanitize(new_flavor, MAX_MESSAGE_LEN*2)
inside_flavor = new_flavor
nif.notify("Updating VR environment...")
- for(var/brain in brainmobs)
- var/mob/living/carbon/brain/caught_soul/CS = brain
+ for(var/mob/living/carbon/brain/caught_soul/CS as anything in brainmobs)
to_chat(CS,"Your surroundings change to...\n[inside_flavor]")
save_settings()
return TRUE
@@ -179,24 +175,20 @@
nif.clear_flag(NIF_O_SCOTHERS,NIF_FLAGS_OTHER)
if(NIF_SC_ALLOW_EARS)
if(setting_flags & NIF_SC_ALLOW_EARS)
- for(var/brain in brainmobs)
- var/mob/living/carbon/brain/caught_soul/brainmob = brain
+ for(var/mob/living/carbon/brain/caught_soul/brainmob as anything in brainmobs)
brainmob.ext_deaf = FALSE
notify_message = "External audio input enabled."
else
- for(var/brain in brainmobs)
- var/mob/living/carbon/brain/caught_soul/brainmob = brain
+ for(var/mob/living/carbon/brain/caught_soul/brainmob as anything in brainmobs)
brainmob.ext_deaf = TRUE
notify_message = "External audio input disabled."
if(NIF_SC_ALLOW_EYES)
if(setting_flags & NIF_SC_ALLOW_EYES)
- for(var/brain in brainmobs)
- var/mob/living/carbon/brain/caught_soul/brainmob = brain
+ for(var/mob/living/carbon/brain/caught_soul/brainmob as anything in brainmobs)
brainmob.ext_blind = FALSE
notify_message = "External video input enabled."
else
- for(var/brain in brainmobs)
- var/mob/living/carbon/brain/caught_soul/brainmob = brain
+ for(var/mob/living/carbon/brain/caught_soul/brainmob as anything in brainmobs)
brainmob.ext_blind = TRUE
notify_message = "External video input disabled."
diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm
index 01b5a7f1ef..85f76d9aa0 100644
--- a/code/modules/organs/organ_external.dm
+++ b/code/modules/organs/organ_external.dm
@@ -106,8 +106,7 @@
while(null in owner.organs)
owner.organs -= null
- for(var/imp in implants)
- var/obj/item/weapon/implant/I = imp
+ for(var/obj/item/weapon/implant/I as anything in implants)
if(!istype(I))
continue
I.imp_in = I.part = null
diff --git a/code/modules/overmap/events/event_handler.dm b/code/modules/overmap/events/event_handler.dm
index 67785e95ac..2d9c2badda 100644
--- a/code/modules/overmap/events/event_handler.dm
+++ b/code/modules/overmap/events/event_handler.dm
@@ -14,8 +14,7 @@ GLOBAL_DATUM_INIT(overmap_event_handler, /decl/overmap_event_handler, new)
// Acquire the list of not-yet utilized overmap turfs on this Z-level
var/list/overmap_turfs = block(locate(OVERMAP_EDGE, OVERMAP_EDGE, z_level), locate(overmap_size - OVERMAP_EDGE, overmap_size - OVERMAP_EDGE, z_level))
var/list/candidate_turfs = list()
- for(var/Trf in overmap_turfs)
- var/turf/T = Trf
+ for(var/turf/T as anything in overmap_turfs)
if(!(locate(/obj/effect/overmap/visitable) in T))
candidate_turfs += T
diff --git a/code/modules/overmap/sectors.dm b/code/modules/overmap/sectors.dm
index 1b422c01d3..1e4cc23634 100644
--- a/code/modules/overmap/sectors.dm
+++ b/code/modules/overmap/sectors.dm
@@ -240,8 +240,7 @@
testing("Putting overmap on [global.using_map.overmap_z]")
var/area/overmap/A = new
- for (var/square in block(locate(1,1,global.using_map.overmap_z), locate(global.using_map.overmap_size,global.using_map.overmap_size,global.using_map.overmap_z)))
- var/turf/T = square
+ for(var/turf/T as anything in block(locate(1,1,global.using_map.overmap_z), locate(global.using_map.overmap_size,global.using_map.overmap_size,global.using_map.overmap_z)))
if(T.x == 1 || T.y == 1 || T.x == global.using_map.overmap_size || T.y == global.using_map.overmap_size)
T = T.ChangeTurf(/turf/unsimulated/map/edge)
else
diff --git a/code/modules/overmap/ships/engines/gas_thruster.dm b/code/modules/overmap/ships/engines/gas_thruster.dm
index 773ed97a64..5510a803de 100644
--- a/code/modules/overmap/ships/engines/gas_thruster.dm
+++ b/code/modules/overmap/ships/engines/gas_thruster.dm
@@ -86,8 +86,7 @@
controller = new(src)
update_nearby_tiles(need_rebuild=1)
- for(var/ship in SSshuttles.ships)
- var/obj/effect/overmap/visitable/ship/S = ship
+ for(var/obj/effect/overmap/visitable/ship/S as anything in SSshuttles.ships)
if(S.check_ownership(src))
S.engines |= controller
if(dir != S.fore_dir)
diff --git a/code/modules/overmap/ships/panicbutton.dm b/code/modules/overmap/ships/panicbutton.dm
index 4e819db642..dcbcbf500f 100644
--- a/code/modules/overmap/ships/panicbutton.dm
+++ b/code/modules/overmap/ships/panicbutton.dm
@@ -66,8 +66,7 @@
var/turf/us = get_turf(src)
for(var/hz in hear_z)
- for(var/m in GLOB.players_by_zlevel[hz])
- var/mob/M = m
+ for(var/mob/M as anything in GLOB.players_by_zlevel[hz])
var/sound/SND = sound('sound/misc/emergency_beacon_launched.ogg') // Inside the loop because playsound_local modifies it for each person, so, need separate instances
var/turf/them = get_turf(M)
var/volume = max(0.20, 1-(get_dist(us,them) / mapsize*0.8))*100
diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm
index 65c3bff6bf..a8cb28b873 100644
--- a/code/modules/paperwork/paperplane.dm
+++ b/code/modules/paperwork/paperplane.dm
@@ -40,8 +40,7 @@
if(!stamped)
stamped = new
else if(stamped)
- for(var/S in stamped)
- var/obj/item/weapon/stamp/ = S
+ for(var/obj/item/weapon/stamp/stamp as anything in stamped)
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi', "paperplane_[initial(stamp.icon_state)]")
add_overlay(stampoverlay)
diff --git a/code/modules/pda/cart.dm b/code/modules/pda/cart.dm
index d391419d91..596486f3df 100644
--- a/code/modules/pda/cart.dm
+++ b/code/modules/pda/cart.dm
@@ -69,11 +69,9 @@ var/list/civilian_cartridges = list(
return ..()
/obj/item/weapon/cartridge/proc/update_programs(obj/item/device/pda/pda)
- for(var/A in programs)
- var/datum/data/pda/P = A
+ for(var/datum/data/pda/P as anything in programs)
P.pda = pda
- for(var/A in messenger_plugins)
- var/datum/data/pda/messenger_plugin/P = A
+ for(var/datum/data/pda/messenger_plugin/P as anything in messenger_plugins)
P.pda = pda
/obj/item/weapon/cartridge/engineering
diff --git a/code/modules/pda/cart_apps.dm b/code/modules/pda/cart_apps.dm
index acd942aa93..857b7bbc04 100644
--- a/code/modules/pda/cart_apps.dm
+++ b/code/modules/pda/cart_apps.dm
@@ -136,8 +136,7 @@
records["general"] = general_records.fields
return records
else
- for(var/A in sortRecord(data_core.general))
- var/datum/data/record/R = A
+ for(var/datum/data/record/R as anything in sortRecord(data_core.general))
if(R)
records += list(list(Name = R.fields["name"], "ref" = "\ref[R]"))
data["recordsList"] = records
@@ -182,8 +181,7 @@
/datum/data/pda/app/crew_records/medical/load_records(datum/data/record/R)
..(R)
- for(var/A in data_core.medical)
- var/datum/data/record/E = A
+ for(var/datum/data/record/E as anything in data_core.medical)
if(E && (E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"]))
medical_records = E
break
@@ -208,8 +206,7 @@
/datum/data/pda/app/crew_records/security/load_records(datum/data/record/R)
..(R)
- for(var/A in data_core.security)
- var/datum/data/record/E = A
+ for(var/datum/data/record/E as anything in data_core.security)
if(E && (E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"]))
security_records = E
break
@@ -229,8 +226,7 @@
supplyData["shuttle_loc"] = shuttle.at_station() ? "Station" : "Dock"
var/supplyOrderCount = 0
var/supplyOrderData[0]
- for(var/S in SSsupply.shoppinglist)
- var/datum/supply_order/SO = S
+ for(var/datum/supply_order/SO as anything in SSsupply.shoppinglist)
supplyOrderCount++
supplyOrderData[++supplyOrderData.len] = list("Number" = SO.ordernum, "Name" = html_encode(SO.object.name), "ApprovedBy" = SO.ordered_by, "Comment" = html_encode(SO.comment))
@@ -240,8 +236,7 @@
var/requestCount = 0
var/requestData[0]
- for(var/S in SSsupply.order_history)
- var/datum/supply_order/SO = S
+ for(var/datum/supply_order/SO as anything in SSsupply.order_history)
if(SO.status != SUP_ORDER_REQUESTED)
continue
diff --git a/code/modules/pda/messenger.dm b/code/modules/pda/messenger.dm
index efb87577d5..03996dc35c 100644
--- a/code/modules/pda/messenger.dm
+++ b/code/modules/pda/messenger.dm
@@ -33,8 +33,7 @@
else
var/convopdas[0]
var/pdas[0]
- for(var/A in PDAs)
- var/obj/item/device/pda/P = A
+ for(var/obj/item/device/pda/P as anything in PDAs)
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
if(!P.owner || PM.toff || P == pda || PM.m_hidden)
@@ -49,8 +48,7 @@
var/list/plugins = list()
if(pda.cartridge)
- for(var/A in pda.cartridge.messenger_plugins)
- var/datum/data/pda/messenger_plugin/P = A
+ for(var/datum/data/pda/messenger_plugin/P as anything in pda.cartridge.messenger_plugins)
plugins += list(list(name = P.name, icon = P.icon, ref = "\ref[P]"))
data["plugins"] = plugins
@@ -148,8 +146,7 @@
//var/telecomms_intact = telecomms_process(P.owner, owner, t)
var/obj/machinery/message_server/useMS = null
if(message_servers)
- for(var/A in message_servers)
- var/obj/machinery/message_server/MS = A
+ for(var/obj/machinery/message_server/MS as anything in message_servers)
//PDAs are now dependent on the Message Server.
if(MS.active)
useMS = MS
@@ -194,8 +191,7 @@
to_chat(usr, "Turn on your receiver in order to send messages.")
return
- for(var/A in PDAs)
- var/obj/item/device/pda/P = A
+ for(var/obj/item/device/pda/P as anything in PDAs)
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
if(!P.owner || !PM || PM.hidden || P == pda || PM.toff)
diff --git a/code/modules/pda/pda.dm b/code/modules/pda/pda.dm
index 274a27857a..a237436974 100644
--- a/code/modules/pda/pda.dm
+++ b/code/modules/pda/pda.dm
@@ -197,8 +197,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
shortcut_cache.Cut()
/obj/item/device/pda/proc/update_programs()
- for(var/A in programs)
- var/datum/data/pda/P = A
+ for(var/datum/data/pda/P as anything in programs)
P.pda = src
/obj/item/device/pda/proc/detonate_act(var/obj/item/device/pda/P)
diff --git a/code/modules/pda/pda_tgui.dm b/code/modules/pda/pda_tgui.dm
index 6d57a6c25e..036ec1fbe4 100644
--- a/code/modules/pda/pda_tgui.dm
+++ b/code/modules/pda/pda_tgui.dm
@@ -22,8 +22,7 @@
if(cartridge)
prog_list |= cartridge.programs
- for(var/A in prog_list)
- var/datum/data/pda/P = A
+ for(var/datum/data/pda/P as anything in prog_list)
if(P.hidden)
continue
diff --git a/code/modules/planet/sif.dm b/code/modules/planet/sif.dm
index af6f632bdc..1d2e4b0af0 100644
--- a/code/modules/planet/sif.dm
+++ b/code/modules/planet/sif.dm
@@ -499,8 +499,7 @@ var/datum/planet/sif/planet_sif = null
/datum/weather/sif/ash_storm/process_effects()
..()
- for(var/thing in living_mob_list)
- var/mob/living/L = thing
+ for(var/mob/living/L as anything in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
if(!T.outdoors)
@@ -536,8 +535,7 @@ var/datum/planet/sif/planet_sif = null
/datum/weather/sif/fallout/process_effects()
..()
- for(var/thing in living_mob_list)
- var/mob/living/L = thing
+ for(var/mob/living/L as anything in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
irradiate_nearby_turf(L)
var/turf/T = get_turf(L)
diff --git a/code/modules/planet/virgo3b_vr.dm b/code/modules/planet/virgo3b_vr.dm
index ea441b6f38..d2faf2315d 100644
--- a/code/modules/planet/virgo3b_vr.dm
+++ b/code/modules/planet/virgo3b_vr.dm
@@ -471,8 +471,7 @@ var/datum/planet/virgo3b/planet_virgo3b = null
/datum/weather/virgo3b/ash_storm/process_effects()
..()
- for(var/thing in living_mob_list)
- var/mob/living/L = thing
+ for(var/mob/living/L as anything in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
if(!T.outdoors)
@@ -508,8 +507,7 @@ var/datum/planet/virgo3b/planet_virgo3b = null
/datum/weather/virgo3b/fallout/process_effects()
..()
- for(var/thing in living_mob_list)
- var/mob/living/L = thing
+ for(var/mob/living/L as anything in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
irradiate_nearby_turf(L)
var/turf/T = get_turf(L)
diff --git a/code/modules/planet/virgo4_vr.dm b/code/modules/planet/virgo4_vr.dm
index 6ac748f421..18f4298aa1 100644
--- a/code/modules/planet/virgo4_vr.dm
+++ b/code/modules/planet/virgo4_vr.dm
@@ -444,8 +444,7 @@ var/datum/planet/virgo4/planet_virgo4 = null
/datum/weather/virgo4/ash_storm/process_effects()
..()
- for(var/thing in living_mob_list)
- var/mob/living/L = thing
+ for(var/mob/living/L as anything in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
if(!T.outdoors)
@@ -481,8 +480,7 @@ var/datum/planet/virgo4/planet_virgo4 = null
/datum/weather/virgo4/fallout/process_effects()
..()
- for(var/thing in living_mob_list)
- var/mob/living/L = thing
+ for(var/mob/living/L as anything in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
irradiate_nearby_turf(L)
var/turf/T = get_turf(L)
diff --git a/code/modules/planet/weather.dm b/code/modules/planet/weather.dm
index 48953a97f1..bbe2318a27 100644
--- a/code/modules/planet/weather.dm
+++ b/code/modules/planet/weather.dm
@@ -202,8 +202,7 @@
return
for(var/z_level in 1 to world.maxz)
- for(var/a in GLOB.players_by_zlevel[z_level])
- var/mob/M = a
+ for(var/mob/M as anything in GLOB.players_by_zlevel[z_level])
// Check if the mob left the z-levels we control. If so, make the sounds stop for them.
if(!(z_level in holder.our_planet.expected_z_levels))
diff --git a/code/modules/power/fusion/fusion_reactions.dm b/code/modules/power/fusion/fusion_reactions.dm
index b49fa564bc..54d72b11e8 100644
--- a/code/modules/power/fusion/fusion_reactions.dm
+++ b/code/modules/power/fusion/fusion_reactions.dm
@@ -17,7 +17,8 @@ var/list/fusion_reactions
/proc/get_fusion_reaction(var/p_react, var/s_react, var/m_energy)
if(!fusion_reactions)
fusion_reactions = list()
- for(var/rtype in typesof(/decl/fusion_reaction) - /decl/fusion_reaction)
+ for(var/rtype in subtypesof(/decl/fusion_reaction)
+ )
var/decl/fusion_reaction/cur_reaction = new rtype()
if(!fusion_reactions[cur_reaction.p_react])
fusion_reactions[cur_reaction.p_react] = list()
diff --git a/code/modules/power/gravitygenerator_vr.dm b/code/modules/power/gravitygenerator_vr.dm
index cce22b705a..ae282b41ca 100644
--- a/code/modules/power/gravitygenerator_vr.dm
+++ b/code/modules/power/gravitygenerator_vr.dm
@@ -389,8 +389,7 @@ GLOBAL_LIST_EMPTY(gravity_generators)
// Shake everyone on the z level to let them know that gravity was enagaged/disenagaged.
/obj/machinery/gravity_generator/main/proc/shake_everyone()
var/sound/alert_sound = sound('sound/effects/alert.ogg')
- for(var/i in player_list)
- var/mob/M = i
+ for(var/mob/M as anything in player_list)
if(!(M.z in levels))
continue
M.update_gravity(M.mob_has_gravity())
diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm
index 3225030581..39d413677d 100644
--- a/code/modules/power/singularity/singularity.dm
+++ b/code/modules/power/singularity/singularity.dm
@@ -265,8 +265,7 @@ GLOBAL_LIST_BOILERPLATE(all_singularities, /obj/singularity)
return 1
/obj/singularity/proc/eat()
- for(var/T in orange(grav_pull, src))
- var/atom/X = T
+ for(var/atom/X as anything in orange(grav_pull, src))
if(!X.simulated)
continue
var/dist = get_dist(X, src)
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index 8a20c9e685..17bf6a400a 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -314,8 +314,7 @@ GLOBAL_LIST_EMPTY(solars_list)
// This would use LateInitialize(), however the powernet does not appear to exist during that time.
/hook/roundstart/proc/auto_start_solars()
- for(var/a in GLOB.solars_list)
- var/obj/machinery/power/solar_control/SC = a
+ for(var/obj/machinery/power/solar_control/SC as anything in GLOB.solars_list)
SC.auto_start()
return TRUE
diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm
index e3ccafa4cc..cf7aa9e2c1 100644
--- a/code/modules/power/tesla/energy_ball.dm
+++ b/code/modules/power/tesla/energy_ball.dm
@@ -40,8 +40,7 @@
var/obj/singularity/energy_ball/EB = orbiting.orbiting
EB.orbiting_balls -= src
- for(var/ball in orbiting_balls)
- var/obj/singularity/energy_ball/EB = ball
+ for(var/obj/singularity/energy_ball/EB as anything in orbiting_balls)
qdel(EB)
. = ..()
diff --git a/code/modules/projectiles/broken.dm b/code/modules/projectiles/broken.dm
index f46f7f34e5..57809fdbd1 100644
--- a/code/modules/projectiles/broken.dm
+++ b/code/modules/projectiles/broken.dm
@@ -31,20 +31,19 @@
if(do_after(user, 5 SECONDS))
to_chat(user, "\The [src] can possibly be restored with:")
- for(var/resource in material_needs)
- var/obj/item/res = resource
- if(material_needs[resource] > 0)
+ for(var/obj/item/res as anything in material_needs)
+ if(material_needs[res] > 0)
var/res_name = ""
if(ispath(res,/obj/item/stack/material))
var/obj/item/stack/material/mat_stack = res
var/datum/material/mat = get_material_by_name("[initial(mat_stack.default_type)]")
- if(material_needs[resource]>1)
+ if(material_needs[res]>1)
res_name = "[mat.use_name] [mat.sheet_plural_name]"
else
res_name = "[mat.use_name] [mat.sheet_singular_name]"
else
res_name = initial(res.name)
- to_chat(user, "- x [material_needs[resource]] [res_name]")
+ to_chat(user, "- x [material_needs[res]] [res_name]")
/obj/item/weapon/broken_gun/proc/setup_gun(var/obj/item/weapon/gun/path)
if(ispath(path))
diff --git a/code/modules/projectiles/guns/energy/cell_loaded_vr/cell_loaded.dm b/code/modules/projectiles/guns/energy/cell_loaded_vr/cell_loaded.dm
index c819e8c603..eaa3a2d9e8 100644
--- a/code/modules/projectiles/guns/energy/cell_loaded_vr/cell_loaded.dm
+++ b/code/modules/projectiles/guns/energy/cell_loaded_vr/cell_loaded.dm
@@ -34,8 +34,7 @@
if(batt.shots_left)
return new chambered.projectile_type()
else
- for(var/B in ammo_magazine.stored_ammo)
- var/obj/item/ammo_casing/microbattery/other_batt = B
+ for(var/obj/item/ammo_casing/microbattery/other_batt as anything in ammo_magazine.stored_ammo)
if(istype(other_batt,chambered.type) && other_batt.shots_left)
switch_to(other_batt)
return new chambered.projectile_type()
@@ -54,8 +53,7 @@
charge_left = batt.shots_left
max_charge = initial(batt.shots_left)
if(ammo_magazine) //Crawl to find more
- for(var/B in ammo_magazine.stored_ammo)
- var/obj/item/ammo_casing/microbattery/bullet = B
+ for(var/obj/item/ammo_casing/microbattery/bullet as anything in ammo_magazine.stored_ammo)
if(istype(bullet,batt.type))
charge_left += bullet.shots_left
max_charge += initial(bullet.shots_left)
@@ -179,8 +177,7 @@
return //Why bother
var/current = 0
- for(var/B in stored_ammo)
- var/obj/item/ammo_casing/microbattery/batt = B
+ for(var/obj/item/ammo_casing/microbattery/batt as anything in stored_ammo)
var/image/cap = image(icon, icon_state = "[capname]_cap")
cap.color = batt.type_color
cap.pixel_x = current * x_offset //Caps don't need a pixel_y offset
diff --git a/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm b/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm
index 043a353015..581e05d74d 100644
--- a/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm
+++ b/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm
@@ -25,8 +25,7 @@
. = ..()
if(Adjacent(user) && max_mod_capacity)
. += "[get_remaining_mod_capacity()]% mod capacity remaining."
- for(var/A in get_modkits())
- var/obj/item/borg/upgrade/modkit/M = A
+ for(var/obj/item/borg/upgrade/modkit/M as anything in get_modkits())
. += "There is a [M.name] mod installed, using [M.cost]% capacity."
/obj/item/weapon/gun/energy/kinetic_accelerator/attackby(obj/item/A, mob/user)
@@ -46,8 +45,7 @@
/obj/item/weapon/gun/energy/kinetic_accelerator/proc/get_remaining_mod_capacity()
var/current_capacity_used = 0
- for(var/A in get_modkits())
- var/obj/item/borg/upgrade/modkit/M = A
+ for(var/obj/item/borg/upgrade/modkit/M as anything in get_modkits())
current_capacity_used += M.cost
return max_mod_capacity - current_capacity_used
@@ -57,8 +55,7 @@
. += A
/obj/item/weapon/gun/energy/kinetic_accelerator/proc/modify_projectile(obj/item/projectile/kinetic/K)
- for(var/A in get_modkits())
- var/obj/item/borg/upgrade/modkit/M = A
+ for(var/obj/item/borg/upgrade/modkit/M as anything in get_modkits())
M.modify_projectile(K)
/obj/item/weapon/gun/energy/kinetic_accelerator/consume_next_projectile()
@@ -185,8 +182,7 @@
. = TRUE
if(denied_type)
var/number_of_denied = 0
- for(var/A in KA.get_modkits())
- var/obj/item/borg/upgrade/modkit/M = A
+ for(var/obj/item/borg/upgrade/modkit/M as anything in KA.get_modkits())
if(istype(M, denied_type))
number_of_denied++
if(number_of_denied >= maximum_of_type)
diff --git a/code/modules/random_map/drop/droppod.dm b/code/modules/random_map/drop/droppod.dm
index e63c31b1a5..31a575212c 100644
--- a/code/modules/random_map/drop/droppod.dm
+++ b/code/modules/random_map/drop/droppod.dm
@@ -158,7 +158,7 @@
var/mob/living/spawned_mob
var/list/spawned_mobs = list()
- var/spawn_path = tgui_input_list(usr, "Select a mob type.", "Drop Pod Selection", typesof(/mob/living)-/mob/living)
+ var/spawn_path = tgui_input_list(usr, "Select a mob type.", "Drop Pod Selection", subtypesof(/mob/living))
if(!spawn_path)
return
diff --git a/code/modules/random_map/drop/supply.dm b/code/modules/random_map/drop/supply.dm
index 912542d654..d1cc04211d 100644
--- a/code/modules/random_map/drop/supply.dm
+++ b/code/modules/random_map/drop/supply.dm
@@ -55,14 +55,14 @@
choice = tgui_alert(usr, "Do you wish to add structures or machines?","Supply Drop",list("No","Yes"))
if(choice == "Yes")
while(1)
- var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", typesof(/obj) - typesof(/obj/item))
+ var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", subtypesof(/obj))
if(!adding_loot_type)
break
chosen_loot_types |= adding_loot_type
choice = tgui_alert(usr, "Do you wish to add any non-weapon items?","Supply Drop",list("No","Yes"))
if(choice == "Yes")
while(1)
- var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", typesof(/obj/item) - typesof(/obj/item/weapon))
+ var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", subtypesof(/obj/item))
if(!adding_loot_type)
break
chosen_loot_types |= adding_loot_type
diff --git a/code/modules/random_map/noise/desert.dm b/code/modules/random_map/noise/desert.dm
index 0264d2a781..ccb768ce3a 100644
--- a/code/modules/random_map/noise/desert.dm
+++ b/code/modules/random_map/noise/desert.dm
@@ -24,14 +24,14 @@
switch(val)
if(2 to 3)
if(prob(60))
- var/grass_path = pick(typesof(/obj/structure/flora/grass)-/obj/structure/flora/grass)
+ var/grass_path = pick(subtypesof(/obj/structure/flora/grass))
new grass_path(T)
if(prob(5))
var/mob_type = pick(list(/mob/living/simple_mob/animal/passive/lizard, /mob/living/simple_mob/animal/passive/mouse))
new mob_type(T)
if(5 to 6)
if(prob(20))
- var/grass_path = pick(typesof(/obj/structure/flora/grass)-/obj/structure/flora/grass)
+ var/grass_path = pick(subtypesof(/obj/structure/flora/grass))
new grass_path(T)
if(7 to 9)
if(prob(60))
diff --git a/code/modules/random_map/random_map_verbs.dm b/code/modules/random_map/random_map_verbs.dm
index c4d572d23f..ff93b73b09 100644
--- a/code/modules/random_map/random_map_verbs.dm
+++ b/code/modules/random_map/random_map_verbs.dm
@@ -36,7 +36,7 @@
if(!holder) return
- var/map_datum = tgui_input_list(usr, "Choose a map to create.", "Map Choice", typesof(/datum/random_map)-/datum/random_map)
+ var/map_datum = tgui_input_list(usr, "Choose a map to create.", "Map Choice", subtypesof(/datum/random_map))
if(!map_datum)
return
diff --git a/code/modules/reagents/holder/distilling.dm b/code/modules/reagents/holder/distilling.dm
index 1599f395d9..9fb4867901 100644
--- a/code/modules/reagents/holder/distilling.dm
+++ b/code/modules/reagents/holder/distilling.dm
@@ -8,19 +8,16 @@
var/list/effect_reactions = list()
do
reaction_occurred = FALSE
- for(var/i in reagent_list)
- var/datum/reagent/R = i
+ for(var/datum/reagent/R as anything in reagent_list)
if(SSchemistry.distilled_reactions_by_reagent[R.id])
eligible_reactions |= SSchemistry.distilled_reactions_by_reagent[R.id]
- for(var/i in eligible_reactions)
- var/decl/chemical_reaction/C = i
+ for(var/decl/chemical_reaction/C as anything in eligible_reactions)
if(C.can_happen(src) && C.process(src))
effect_reactions |= C
reaction_occurred = TRUE
eligible_reactions.len = 0
while(reaction_occurred)
- for(var/i in effect_reactions)
- var/decl/chemical_reaction/C = i
+ for(var/decl/chemical_reaction/C as anything in effect_reactions)
C.post_reaction(src)
update_total()
\ No newline at end of file
diff --git a/code/modules/reagents/holder/holder.dm b/code/modules/reagents/holder/holder.dm
index 26ad557e98..6bde5e8508 100644
--- a/code/modules/reagents/holder/holder.dm
+++ b/code/modules/reagents/holder/holder.dm
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
#define PROCESS_REACTION_ITER 5 //when processing a reaction, iterate this many times
/datum/reagents
@@ -508,3 +509,1020 @@
for(var/datum/reagent/reagent as anything in cached_reagents)
reagent.on_update(A)
update_total()
+||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
+#define PROCESS_REACTION_ITER 5 //when processing a reaction, iterate this many times
+
+/datum/reagents
+ var/list/datum/reagent/reagent_list = list()
+ var/total_volume = 0
+ var/maximum_volume = 100
+ var/atom/my_atom = null
+
+/datum/reagents/New(var/max = 100, atom/A = null)
+ ..()
+ maximum_volume = max
+ my_atom = A
+
+ //I dislike having these here but map-objects are initialised before world/New() is called. >_>
+ if(!SSchemistry.chemical_reagents)
+ //Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
+ var/paths = subtypesof(/datum/reagent)
+ SSchemistry.chemical_reagents = list()
+ for(var/path in paths)
+ var/datum/reagent/D = new path()
+ if(!D.name)
+ continue
+ SSchemistry.chemical_reagents[D.id] = D
+
+/datum/reagents/Destroy()
+ for(var/datum/reagent/R in reagent_list)
+ qdel(R)
+ reagent_list = null
+ if(my_atom && my_atom.reagents == src)
+ my_atom.reagents = null
+ return ..()
+
+/* Internal procs */
+
+/datum/reagents/proc/get_free_space() // Returns free space.
+ return maximum_volume - total_volume
+
+/datum/reagents/proc/get_master_reagent() // Returns reference to the reagent with the biggest volume.
+ var/the_reagent = null
+ var/the_volume = 0
+
+ for(var/datum/reagent/A in reagent_list)
+ if(A.volume > the_volume)
+ the_volume = A.volume
+ the_reagent = A
+
+ return the_reagent
+
+/datum/reagents/proc/get_master_reagent_name() // Returns the name of the reagent with the biggest volume.
+ var/the_name = null
+ var/the_volume = 0
+ for(var/datum/reagent/A in reagent_list)
+ if(A.volume > the_volume)
+ the_volume = A.volume
+ the_name = A.name
+
+ return the_name
+
+/datum/reagents/proc/get_master_reagent_id() // Returns the id of the reagent with the biggest volume.
+ var/the_id = null
+ var/the_volume = 0
+ for(var/datum/reagent/A in reagent_list)
+ if(A.volume > the_volume)
+ the_volume = A.volume
+ the_id = A.id
+
+ return the_id
+
+/datum/reagents/proc/update_total() // Updates volume.
+ total_volume = 0
+ for(var/datum/reagent/R in reagent_list)
+ if(R.volume < MINIMUM_CHEMICAL_VOLUME)
+ del_reagent(R.id)
+ else
+ total_volume += R.volume
+ return
+
+/datum/reagents/proc/handle_reactions()
+ if(QDELETED(my_atom))
+ return FALSE
+ if(my_atom.flags & NOREACT)
+ return FALSE
+ var/reaction_occurred
+ var/list/eligible_reactions = list()
+ var/list/effect_reactions = list()
+ do
+ reaction_occurred = FALSE
+ for(var/i in reagent_list)
+ var/datum/reagent/R = i
+ if(SSchemistry.instant_reactions_by_reagent[R.id])
+ eligible_reactions |= SSchemistry.instant_reactions_by_reagent[R.id]
+
+ for(var/i in eligible_reactions)
+ var/decl/chemical_reaction/C = i
+ if(C.can_happen(src) && C.process(src))
+ effect_reactions |= C
+ reaction_occurred = TRUE
+ eligible_reactions.len = 0
+ while(reaction_occurred)
+ for(var/i in effect_reactions)
+ var/decl/chemical_reaction/C = i
+ C.post_reaction(src)
+ update_total()
+
+/* Holder-to-chemical */
+
+/datum/reagents/proc/add_reagent(var/id, var/amount, var/data = null, var/safety = 0)
+ if(!isnum(amount) || amount <= 0)
+ return 0
+
+ update_total()
+ amount = min(amount, get_free_space())
+
+
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ if(current.id == "blood")
+ if(LAZYLEN(data) && !isnull(data["species"]) && !isnull(current.data["species"]) && data["species"] != current.data["species"]) // Species bloodtypes are already incompatible, this just stops it from mixing into the one already in a container.
+ continue
+
+ current.volume += amount
+ if(!isnull(data)) // For all we know, it could be zero or empty string and meaningful
+ current.mix_data(data, amount)
+ update_total()
+ if(!safety)
+ handle_reactions()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 1
+ var/datum/reagent/D = SSchemistry.chemical_reagents[id]
+ if(D)
+ var/datum/reagent/R = new D.type()
+ reagent_list += R
+ R.holder = src
+ R.volume = amount
+ R.initialize_data(data)
+ update_total()
+ if(!safety)
+ handle_reactions()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 1
+ else
+ stack_trace("[my_atom] attempted to add a reagent called '[id]' which doesn't exist. ([usr])")
+ return 0
+
+/datum/reagents/proc/isolate_reagent(reagent)
+ for(var/A in reagent_list)
+ var/datum/reagent/R = A
+ if(R.id != reagent)
+ del_reagent(R.id)
+ update_total()
+
+/datum/reagents/proc/remove_reagent(var/id, var/amount, var/safety = 0)
+ if(!isnum(amount))
+ return 0
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ current.volume -= amount // It can go negative, but it doesn't matter
+ update_total() // Because this proc will delete it then
+ if(!safety)
+ handle_reactions()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 1
+ return 0
+
+/datum/reagents/proc/del_reagent(var/id)
+ for(var/datum/reagent/current in reagent_list)
+ if (current.id == id)
+ reagent_list -= current
+ qdel(current)
+ update_total()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 0
+
+/datum/reagents/proc/has_reagent(var/id, var/amount = 0)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ if(current.volume >= amount)
+ return 1
+ else
+ return 0
+ return 0
+
+/datum/reagents/proc/has_any_reagent(var/list/check_reagents)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id in check_reagents)
+ if(current.volume >= check_reagents[current.id])
+ return 1
+ else
+ return 0
+ return 0
+
+/datum/reagents/proc/has_all_reagents(var/list/check_reagents)
+ //this only works if check_reagents has no duplicate entries... hopefully okay since it expects an associative list
+ var/missing = check_reagents.len
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id in check_reagents)
+ if(current.volume >= check_reagents[current.id])
+ missing--
+ return !missing
+
+/datum/reagents/proc/clear_reagents()
+ for(var/datum/reagent/current in reagent_list)
+ del_reagent(current.id)
+ return
+
+/datum/reagents/proc/get_reagent_amount(var/id)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ return current.volume
+ return 0
+
+/datum/reagents/proc/get_data(var/id)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ return current.get_data()
+ return 0
+
+/datum/reagents/proc/get_reagents()
+ . = list()
+ for(var/datum/reagent/current in reagent_list)
+ . += "[current.id] ([current.volume])"
+ return english_list(., "EMPTY", "", ", ", ", ")
+
+/* Holder-to-holder and similar procs */
+
+/datum/reagents/proc/remove_any(var/amount = 1) // Removes up to [amount] of reagents from [src]. Returns actual amount removed.
+ amount = min(amount, total_volume)
+
+ if(!amount)
+ return
+
+ var/part = amount / total_volume
+
+ for(var/datum/reagent/current in reagent_list)
+ var/amount_to_remove = current.volume * part
+ remove_reagent(current.id, amount_to_remove, 1)
+
+ update_total()
+ handle_reactions()
+ return amount
+
+/datum/reagents/proc/trans_to_holder(var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Transfers [amount] reagents from [src] to [target], multiplying them by [multiplier]. Returns actual amount removed from [src] (not amount transferred to [target]).
+ if(!target || !istype(target))
+ return
+
+ amount = max(0, min(amount, total_volume, target.get_free_space() / multiplier))
+
+ if(!amount)
+ return
+
+ var/part = amount / total_volume
+
+ for(var/datum/reagent/current in reagent_list)
+ var/amount_to_transfer = current.volume * part
+ target.add_reagent(current.id, amount_to_transfer * multiplier, current.get_data(), safety = 1) // We don't react until everything is in place
+ if(!copy)
+ remove_reagent(current.id, amount_to_transfer, 1)
+
+ if(!copy)
+ handle_reactions()
+ target.handle_reactions()
+ return amount
+
+/* Holder-to-atom and similar procs */
+
+//The general proc for applying reagents to things. This proc assumes the reagents are being applied externally,
+//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)
+ touch(target) //First, handle mere touch effects
+
+ if(ismob(target))
+ return splash_mob(target, amount, copy)
+ if(isturf(target))
+ return trans_to_turf(target, amount, multiplier, copy)
+ if(isobj(target) && target.is_open_container())
+ return trans_to_obj(target, amount, multiplier, copy)
+ return 0
+
+//Splashing reagents is messier than trans_to, the target's loc gets some of the reagents as well.
+/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/spill = 0
+ if(!isturf(target) && target.loc)
+ spill = amount*(rand(min_spill, max_spill)/100)
+ amount -= spill
+ if(spill)
+ splash(target.loc, spill, multiplier, copy, min_spill, max_spill)
+
+ if(!trans_to(target, amount, multiplier, copy))
+ touch(target, amount)
+
+/datum/reagents/proc/trans_type_to(var/target, var/rtype, var/amount = 1)
+ if (!target)
+ return
+
+ var/datum/reagent/transfering_reagent = get_reagent(rtype)
+
+ if (istype(target, /atom))
+ var/atom/A = target
+ if (!A.reagents || !A.simulated)
+ return
+
+ amount = min(amount, transfering_reagent.volume)
+
+ if(!amount)
+ return
+
+
+ var/datum/reagents/F = new /datum/reagents(amount)
+ var/tmpdata = get_data(rtype)
+ F.add_reagent(rtype, amount, tmpdata)
+ remove_reagent(rtype, amount)
+
+
+ if (istype(target, /atom))
+ return F.trans_to(target, amount) // Let this proc check the atom's type
+ else if (istype(target, /datum/reagents))
+ return F.trans_to_holder(target, amount)
+
+/datum/reagents/proc/trans_id_to(var/atom/target, var/id, var/amount = 1)
+ if (!target || !target.reagents)
+ return
+
+ amount = min(amount, get_reagent_amount(id))
+
+ if(!amount)
+ return
+
+ var/datum/reagents/F = new /datum/reagents(amount)
+ var/tmpdata = get_data(id)
+ F.add_reagent(id, amount, tmpdata)
+ remove_reagent(id, amount)
+
+ return F.trans_to(target, amount) // Let this proc check the atom's type
+
+// When applying reagents to an atom externally, touch() is called to trigger any on-touch effects of the reagent.
+// This does not handle transferring reagents to things.
+// For example, splashing someone with water will get them wet and extinguish them if they are on fire,
+// even if they are wearing an impermeable suit that prevents the reagents from contacting the skin.
+/datum/reagents/proc/touch(var/atom/target, var/amount)
+ if(ismob(target))
+ touch_mob(target, amount)
+ if(isturf(target))
+ touch_turf(target, amount)
+ if(isobj(target))
+ touch_obj(target, amount)
+ return
+
+/datum/reagents/proc/touch_mob(var/mob/target)
+ if(!target || !istype(target))
+ return
+
+ for(var/datum/reagent/current in reagent_list)
+ current.touch_mob(target, current.volume)
+
+ update_total()
+
+/datum/reagents/proc/touch_turf(var/turf/target, var/amount)
+ if(!target || !istype(target))
+ return
+
+ for(var/datum/reagent/current in reagent_list)
+ current.touch_turf(target, amount)
+
+ update_total()
+
+/datum/reagents/proc/touch_obj(var/obj/target, var/amount)
+ if(!target || !istype(target))
+ return
+
+ for(var/datum/reagent/current in reagent_list)
+ current.touch_obj(target, amount)
+
+ update_total()
+
+// Attempts to place a reagent on the mob's skin.
+// Reagents are not guaranteed to transfer to the target.
+// Do not call this directly, call trans_to() instead.
+/datum/reagents/proc/splash_mob(var/mob/target, var/amount = 1, var/copy = 0)
+ var/perm = 1
+ if(isliving(target)) //will we ever even need to tranfer reagents to non-living mobs?
+ var/mob/living/L = target
+ if(ishuman(L))
+ var/mob/living/carbon/human/H = L
+ if(H.check_shields(0, null, null, null, "the spray") == 1) //If they block the spray, it does nothing.
+ amount = 0
+ perm = L.reagent_permeability()
+ return trans_to_mob(target, amount, CHEM_TOUCH, perm, copy)
+
+/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0) // Transfer after checking into which holder...
+ if(!target || !istype(target))
+ return
+ if(iscarbon(target))
+ var/mob/living/carbon/C = target
+ if(type == CHEM_BLOOD)
+ var/datum/reagents/R = C.reagents
+ return trans_to_holder(R, amount, multiplier, copy)
+ if(type == CHEM_INGEST)
+ var/datum/reagents/R = C.ingested
+ return C.ingest(src, R, amount, multiplier, copy)
+ if(type == CHEM_TOUCH)
+ var/datum/reagents/R = C.touching
+ return trans_to_holder(R, amount, multiplier, copy)
+ else
+ var/datum/reagents/R = new /datum/reagents(amount)
+ . = trans_to_holder(R, amount, multiplier, copy)
+ R.touch_mob(target)
+
+/datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Turfs don't have any reagents (at least, for now). Just touch it.
+ if(!target)
+ return
+
+ var/datum/reagents/R = new /datum/reagents(amount * multiplier)
+ . = trans_to_holder(R, amount, multiplier, copy)
+ R.touch_turf(target, amount)
+ return
+
+/datum/reagents/proc/trans_to_obj(var/obj/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Objects may or may not; if they do, it's probably a beaker or something and we need to transfer properly; otherwise, just touch.
+ if(!target)
+ return
+
+ if(!target.reagents)
+ var/datum/reagents/R = new /datum/reagents(amount * multiplier)
+ . = trans_to_holder(R, amount, multiplier, copy)
+ R.touch_obj(target, amount)
+ return
+
+ return trans_to_holder(target.reagents, amount, multiplier, copy)
+
+/* Atom reagent creation - use it all the time */
+
+/atom/proc/create_reagents(var/max_vol, var/reagents_type = /datum/reagents)
+ if(!ispath(reagents_type))
+ reagents_type = /datum/reagents
+ reagents = new reagents_type(max_vol, src)
+
+// Aurora Cooking Port
+/datum/reagents/proc/get_reagent(var/id) // Returns reference to reagent matching passed ID
+ for(var/datum/reagent/A in reagent_list)
+ if (A.id == id)
+ return A
+
+ return null
+
+//Spreads the contents of this reagent holder all over the vicinity of the target turf.
+/datum/reagents/proc/splash_area(var/turf/epicentre, var/range = 3, var/portion = 1.0, var/multiplier = 1, var/copy = 0)
+ var/list/things = dview(range, epicentre, INVISIBILITY_LIGHTING)
+ var/list/turfs = list()
+ for (var/turf/T in things)
+ turfs += T
+ if (!turfs.len)
+ return//Nowhere to splash to, somehow
+ //Create a temporary holder to hold all the amount that will be spread
+ var/datum/reagents/R = new /datum/reagents(total_volume * portion * multiplier)
+ trans_to_holder(R, total_volume * portion, multiplier, copy)
+ //The exact amount that will be given to each turf
+ var/turfportion = R.total_volume / turfs.len
+ for (var/turf/T in turfs)
+ var/datum/reagents/TR = new /datum/reagents(turfportion)
+ R.trans_to_holder(TR, turfportion, 1, 0)
+ TR.splash_turf(T)
+ qdel(R)
+
+
+//Spreads the contents of this reagent holder all over the target turf, dividing among things in it.
+//50% is divided between mobs, 20% between objects, and whatever is left on the turf itself
+/datum/reagents/proc/splash_turf(var/turf/T, var/amount = null, var/multiplier = 1, var/copy = 0)
+ if (isnull(amount))
+ amount = total_volume
+ else
+ amount = min(amount, total_volume)
+ if (amount <= 0)
+ return
+ var/list/mobs = list()
+ for (var/mob/M in T)
+ mobs += M
+ var/list/objs = list()
+ for (var/obj/O in T)
+ objs += O
+ if (objs.len)
+ var/objportion = (amount * 0.2) / objs.len
+ for (var/o in objs)
+ var/obj/O = o
+ trans_to(O, objportion, multiplier, copy)
+ amount = min(amount, total_volume)
+ if (mobs.len)
+ var/mobportion = (amount * 0.5) / mobs.len
+ for (var/m in mobs)
+ var/mob/M = m
+ trans_to(M, mobportion, multiplier, copy)
+ trans_to(T, total_volume, multiplier, copy)
+ if (total_volume <= 0)
+ qdel(src)
+
+/**
+ * Calls [/datum/reagent/proc/on_update] on every reagent in this holder
+ *
+ * Arguments:
+ * * atom/A - passed to on_update
+ */
+/datum/reagents/proc/conditional_update(atom/A)
+ var/list/cached_reagents = reagent_list
+ for(var/datum/reagent/reagent as anything in cached_reagents)
+ reagent.on_update(A)
+ update_total()
+=======
+#define PROCESS_REACTION_ITER 5 //when processing a reaction, iterate this many times
+
+/datum/reagents
+ var/list/datum/reagent/reagent_list = list()
+ var/total_volume = 0
+ var/maximum_volume = 100
+ var/atom/my_atom = null
+
+/datum/reagents/New(var/max = 100, atom/A = null)
+ ..()
+ maximum_volume = max
+ my_atom = A
+
+ //I dislike having these here but map-objects are initialised before world/New() is called. >_>
+ if(!SSchemistry.chemical_reagents)
+ //Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
+ var/paths = subtypesof(/datum/reagent)
+ SSchemistry.chemical_reagents = list()
+ for(var/path in paths)
+ var/datum/reagent/D = new path()
+ if(!D.name)
+ continue
+ SSchemistry.chemical_reagents[D.id] = D
+
+/datum/reagents/Destroy()
+ for(var/datum/reagent/R in reagent_list)
+ qdel(R)
+ reagent_list = null
+ if(my_atom && my_atom.reagents == src)
+ my_atom.reagents = null
+ return ..()
+
+/* Internal procs */
+
+/datum/reagents/proc/get_free_space() // Returns free space.
+ return maximum_volume - total_volume
+
+/datum/reagents/proc/get_master_reagent() // Returns reference to the reagent with the biggest volume.
+ var/the_reagent = null
+ var/the_volume = 0
+
+ for(var/datum/reagent/A in reagent_list)
+ if(A.volume > the_volume)
+ the_volume = A.volume
+ the_reagent = A
+
+ return the_reagent
+
+/datum/reagents/proc/get_master_reagent_name() // Returns the name of the reagent with the biggest volume.
+ var/the_name = null
+ var/the_volume = 0
+ for(var/datum/reagent/A in reagent_list)
+ if(A.volume > the_volume)
+ the_volume = A.volume
+ the_name = A.name
+
+ return the_name
+
+/datum/reagents/proc/get_master_reagent_id() // Returns the id of the reagent with the biggest volume.
+ var/the_id = null
+ var/the_volume = 0
+ for(var/datum/reagent/A in reagent_list)
+ if(A.volume > the_volume)
+ the_volume = A.volume
+ the_id = A.id
+
+ return the_id
+
+/datum/reagents/proc/update_total() // Updates volume.
+ total_volume = 0
+ for(var/datum/reagent/R in reagent_list)
+ if(R.volume < MINIMUM_CHEMICAL_VOLUME)
+ del_reagent(R.id)
+ else
+ total_volume += R.volume
+ return
+
+/datum/reagents/proc/handle_reactions()
+ if(QDELETED(my_atom))
+ return FALSE
+ if(my_atom.flags & NOREACT)
+ return FALSE
+ var/reaction_occurred
+ var/list/eligible_reactions = list()
+ var/list/effect_reactions = list()
+ do
+ reaction_occurred = FALSE
+ for(var/datum/reagent/R as anything in reagent_list)
+ if(SSchemistry.instant_reactions_by_reagent[R.id])
+ eligible_reactions |= SSchemistry.instant_reactions_by_reagent[R.id]
+
+ for(var/decl/chemical_reaction/C as anything in eligible_reactions)
+ if(C.can_happen(src) && C.process(src))
+ effect_reactions |= C
+ reaction_occurred = TRUE
+ eligible_reactions.len = 0
+ while(reaction_occurred)
+ for(var/decl/chemical_reaction/C as anything in effect_reactions)
+ C.post_reaction(src)
+ update_total()
+
+/* Holder-to-chemical */
+
+/datum/reagents/proc/add_reagent(var/id, var/amount, var/data = null, var/safety = 0)
+ if(!isnum(amount) || amount <= 0)
+ return 0
+
+ update_total()
+ amount = min(amount, get_free_space())
+
+
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ if(current.id == "blood")
+ if(LAZYLEN(data) && !isnull(data["species"]) && !isnull(current.data["species"]) && data["species"] != current.data["species"]) // Species bloodtypes are already incompatible, this just stops it from mixing into the one already in a container.
+ continue
+
+ current.volume += amount
+ if(!isnull(data)) // For all we know, it could be zero or empty string and meaningful
+ current.mix_data(data, amount)
+ update_total()
+ if(!safety)
+ handle_reactions()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 1
+ var/datum/reagent/D = SSchemistry.chemical_reagents[id]
+ if(D)
+ var/datum/reagent/R = new D.type()
+ reagent_list += R
+ R.holder = src
+ R.volume = amount
+ R.initialize_data(data)
+ update_total()
+ if(!safety)
+ handle_reactions()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 1
+ else
+ stack_trace("[my_atom] attempted to add a reagent called '[id]' which doesn't exist. ([usr])")
+ return 0
+
+/datum/reagents/proc/isolate_reagent(reagent)
+ for(var/datum/reagent/R as anything in reagent_list)
+ if(R.id != reagent)
+ del_reagent(R.id)
+ update_total()
+
+/datum/reagents/proc/remove_reagent(var/id, var/amount, var/safety = 0)
+ if(!isnum(amount))
+ return 0
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ current.volume -= amount // It can go negative, but it doesn't matter
+ update_total() // Because this proc will delete it then
+ if(!safety)
+ handle_reactions()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 1
+ return 0
+
+/datum/reagents/proc/del_reagent(var/id)
+ for(var/datum/reagent/current in reagent_list)
+ if (current.id == id)
+ reagent_list -= current
+ qdel(current)
+ update_total()
+ if(my_atom)
+ my_atom.on_reagent_change()
+ return 0
+
+/datum/reagents/proc/has_reagent(var/id, var/amount = 0)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ if(current.volume >= amount)
+ return 1
+ else
+ return 0
+ return 0
+
+/datum/reagents/proc/has_any_reagent(var/list/check_reagents)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id in check_reagents)
+ if(current.volume >= check_reagents[current.id])
+ return 1
+ else
+ return 0
+ return 0
+
+/datum/reagents/proc/has_all_reagents(var/list/check_reagents)
+ //this only works if check_reagents has no duplicate entries... hopefully okay since it expects an associative list
+ var/missing = check_reagents.len
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id in check_reagents)
+ if(current.volume >= check_reagents[current.id])
+ missing--
+ return !missing
+
+/datum/reagents/proc/clear_reagents()
+ for(var/datum/reagent/current in reagent_list)
+ del_reagent(current.id)
+ return
+
+/datum/reagents/proc/get_reagent_amount(var/id)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ return current.volume
+ return 0
+
+/datum/reagents/proc/get_data(var/id)
+ for(var/datum/reagent/current in reagent_list)
+ if(current.id == id)
+ return current.get_data()
+ return 0
+
+/datum/reagents/proc/get_reagents()
+ . = list()
+ for(var/datum/reagent/current in reagent_list)
+ . += "[current.id] ([current.volume])"
+ return english_list(., "EMPTY", "", ", ", ", ")
+
+/* Holder-to-holder and similar procs */
+
+/datum/reagents/proc/remove_any(var/amount = 1) // Removes up to [amount] of reagents from [src]. Returns actual amount removed.
+ amount = min(amount, total_volume)
+
+ if(!amount)
+ return
+
+ var/part = amount / total_volume
+
+ for(var/datum/reagent/current in reagent_list)
+ var/amount_to_remove = current.volume * part
+ remove_reagent(current.id, amount_to_remove, 1)
+
+ update_total()
+ handle_reactions()
+ return amount
+
+/datum/reagents/proc/trans_to_holder(var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Transfers [amount] reagents from [src] to [target], multiplying them by [multiplier]. Returns actual amount removed from [src] (not amount transferred to [target]).
+ if(!target || !istype(target))
+ return
+
+ amount = max(0, min(amount, total_volume, target.get_free_space() / multiplier))
+
+ if(!amount)
+ return
+
+ var/part = amount / total_volume
+
+ for(var/datum/reagent/current in reagent_list)
+ var/amount_to_transfer = current.volume * part
+ target.add_reagent(current.id, amount_to_transfer * multiplier, current.get_data(), safety = 1) // We don't react until everything is in place
+ if(!copy)
+ remove_reagent(current.id, amount_to_transfer, 1)
+
+ if(!copy)
+ handle_reactions()
+ target.handle_reactions()
+ return amount
+
+/* Holder-to-atom and similar procs */
+
+//The general proc for applying reagents to things. This proc assumes the reagents are being applied externally,
+//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)
+ touch(target) //First, handle mere touch effects
+
+ if(ismob(target))
+ return splash_mob(target, amount, copy)
+ if(isturf(target))
+ return trans_to_turf(target, amount, multiplier, copy)
+ if(isobj(target) && target.is_open_container())
+ return trans_to_obj(target, amount, multiplier, copy)
+ return 0
+
+//Splashing reagents is messier than trans_to, the target's loc gets some of the reagents as well.
+/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/spill = 0
+ if(!isturf(target) && target.loc)
+ spill = amount*(rand(min_spill, max_spill)/100)
+ amount -= spill
+ if(spill)
+ splash(target.loc, spill, multiplier, copy, min_spill, max_spill)
+
+ if(!trans_to(target, amount, multiplier, copy))
+ touch(target, amount)
+
+/datum/reagents/proc/trans_type_to(var/target, var/rtype, var/amount = 1)
+ if (!target)
+ return
+
+ var/datum/reagent/transfering_reagent = get_reagent(rtype)
+
+ if (istype(target, /atom))
+ var/atom/A = target
+ if (!A.reagents || !A.simulated)
+ return
+
+ amount = min(amount, transfering_reagent.volume)
+
+ if(!amount)
+ return
+
+
+ var/datum/reagents/F = new /datum/reagents(amount)
+ var/tmpdata = get_data(rtype)
+ F.add_reagent(rtype, amount, tmpdata)
+ remove_reagent(rtype, amount)
+
+
+ if (istype(target, /atom))
+ return F.trans_to(target, amount) // Let this proc check the atom's type
+ else if (istype(target, /datum/reagents))
+ return F.trans_to_holder(target, amount)
+
+/datum/reagents/proc/trans_id_to(var/atom/target, var/id, var/amount = 1)
+ if (!target || !target.reagents)
+ return
+
+ amount = min(amount, get_reagent_amount(id))
+
+ if(!amount)
+ return
+
+ var/datum/reagents/F = new /datum/reagents(amount)
+ var/tmpdata = get_data(id)
+ F.add_reagent(id, amount, tmpdata)
+ remove_reagent(id, amount)
+
+ return F.trans_to(target, amount) // Let this proc check the atom's type
+
+// When applying reagents to an atom externally, touch() is called to trigger any on-touch effects of the reagent.
+// This does not handle transferring reagents to things.
+// For example, splashing someone with water will get them wet and extinguish them if they are on fire,
+// even if they are wearing an impermeable suit that prevents the reagents from contacting the skin.
+/datum/reagents/proc/touch(var/atom/target, var/amount)
+ if(ismob(target))
+ touch_mob(target, amount)
+ if(isturf(target))
+ touch_turf(target, amount)
+ if(isobj(target))
+ touch_obj(target, amount)
+ return
+
+/datum/reagents/proc/touch_mob(var/mob/target)
+ if(!target || !istype(target))
+ return
+
+ for(var/datum/reagent/current in reagent_list)
+ current.touch_mob(target, current.volume)
+
+ update_total()
+
+/datum/reagents/proc/touch_turf(var/turf/target, var/amount)
+ if(!target || !istype(target))
+ return
+
+ for(var/datum/reagent/current in reagent_list)
+ current.touch_turf(target, amount)
+
+ update_total()
+
+/datum/reagents/proc/touch_obj(var/obj/target, var/amount)
+ if(!target || !istype(target))
+ return
+
+ for(var/datum/reagent/current in reagent_list)
+ current.touch_obj(target, amount)
+
+ update_total()
+
+// Attempts to place a reagent on the mob's skin.
+// Reagents are not guaranteed to transfer to the target.
+// Do not call this directly, call trans_to() instead.
+/datum/reagents/proc/splash_mob(var/mob/target, var/amount = 1, var/copy = 0)
+ var/perm = 1
+ if(isliving(target)) //will we ever even need to tranfer reagents to non-living mobs?
+ var/mob/living/L = target
+ if(ishuman(L))
+ var/mob/living/carbon/human/H = L
+ if(H.check_shields(0, null, null, null, "the spray") == 1) //If they block the spray, it does nothing.
+ amount = 0
+ perm = L.reagent_permeability()
+ return trans_to_mob(target, amount, CHEM_TOUCH, perm, copy)
+
+/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0) // Transfer after checking into which holder...
+ if(!target || !istype(target))
+ return
+ if(iscarbon(target))
+ var/mob/living/carbon/C = target
+ if(type == CHEM_BLOOD)
+ var/datum/reagents/R = C.reagents
+ return trans_to_holder(R, amount, multiplier, copy)
+ if(type == CHEM_INGEST)
+ var/datum/reagents/R = C.ingested
+ return C.ingest(src, R, amount, multiplier, copy)
+ if(type == CHEM_TOUCH)
+ var/datum/reagents/R = C.touching
+ return trans_to_holder(R, amount, multiplier, copy)
+ else
+ var/datum/reagents/R = new /datum/reagents(amount)
+ . = trans_to_holder(R, amount, multiplier, copy)
+ R.touch_mob(target)
+
+/datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Turfs don't have any reagents (at least, for now). Just touch it.
+ if(!target)
+ return
+
+ var/datum/reagents/R = new /datum/reagents(amount * multiplier)
+ . = trans_to_holder(R, amount, multiplier, copy)
+ R.touch_turf(target, amount)
+ return
+
+/datum/reagents/proc/trans_to_obj(var/obj/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Objects may or may not; if they do, it's probably a beaker or something and we need to transfer properly; otherwise, just touch.
+ if(!target)
+ return
+
+ if(!target.reagents)
+ var/datum/reagents/R = new /datum/reagents(amount * multiplier)
+ . = trans_to_holder(R, amount, multiplier, copy)
+ R.touch_obj(target, amount)
+ return
+
+ return trans_to_holder(target.reagents, amount, multiplier, copy)
+
+/* Atom reagent creation - use it all the time */
+
+/atom/proc/create_reagents(var/max_vol, var/reagents_type = /datum/reagents)
+ if(!ispath(reagents_type))
+ reagents_type = /datum/reagents
+ reagents = new reagents_type(max_vol, src)
+
+// Aurora Cooking Port
+/datum/reagents/proc/get_reagent(var/id) // Returns reference to reagent matching passed ID
+ for(var/datum/reagent/A in reagent_list)
+ if (A.id == id)
+ return A
+
+ return null
+
+//Spreads the contents of this reagent holder all over the vicinity of the target turf.
+/datum/reagents/proc/splash_area(var/turf/epicentre, var/range = 3, var/portion = 1.0, var/multiplier = 1, var/copy = 0)
+ var/list/things = dview(range, epicentre, INVISIBILITY_LIGHTING)
+ var/list/turfs = list()
+ for (var/turf/T in things)
+ turfs += T
+ if (!turfs.len)
+ return//Nowhere to splash to, somehow
+ //Create a temporary holder to hold all the amount that will be spread
+ var/datum/reagents/R = new /datum/reagents(total_volume * portion * multiplier)
+ trans_to_holder(R, total_volume * portion, multiplier, copy)
+ //The exact amount that will be given to each turf
+ var/turfportion = R.total_volume / turfs.len
+ for (var/turf/T in turfs)
+ var/datum/reagents/TR = new /datum/reagents(turfportion)
+ R.trans_to_holder(TR, turfportion, 1, 0)
+ TR.splash_turf(T)
+ qdel(R)
+
+
+//Spreads the contents of this reagent holder all over the target turf, dividing among things in it.
+//50% is divided between mobs, 20% between objects, and whatever is left on the turf itself
+/datum/reagents/proc/splash_turf(var/turf/T, var/amount = null, var/multiplier = 1, var/copy = 0)
+ if (isnull(amount))
+ amount = total_volume
+ else
+ amount = min(amount, total_volume)
+ if (amount <= 0)
+ return
+ var/list/mobs = list()
+ for (var/mob/M in T)
+ mobs += M
+ var/list/objs = list()
+ for (var/obj/O in T)
+ objs += O
+ if (objs.len)
+ var/objportion = (amount * 0.2) / objs.len
+ for(var/obj/O as anything in objs)
+ trans_to(O, objportion, multiplier, copy)
+ amount = min(amount, total_volume)
+ if (mobs.len)
+ var/mobportion = (amount * 0.5) / mobs.len
+ for(var/mob/M as anything in mobs)
+ trans_to(M, mobportion, multiplier, copy)
+ trans_to(T, total_volume, multiplier, copy)
+ if (total_volume <= 0)
+ qdel(src)
+
+/**
+ * Calls [/datum/reagent/proc/on_update] on every reagent in this holder
+ *
+ * Arguments:
+ * * atom/A - passed to on_update
+ */
+/datum/reagents/proc/conditional_update(atom/A)
+ var/list/cached_reagents = reagent_list
+ for(var/datum/reagent/reagent as anything in cached_reagents)
+ reagent.on_update(A)
+ update_total()
+>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
diff --git a/code/modules/reagents/machinery/grinder.dm b/code/modules/reagents/machinery/grinder.dm
index 014305a8f1..3b5ea9e4fd 100644
--- a/code/modules/reagents/machinery/grinder.dm
+++ b/code/modules/reagents/machinery/grinder.dm
@@ -56,8 +56,7 @@
. += "\The [src] contains:"
if(beaker)
. += "- \A [beaker]."
- for(var/i in holdingitems)
- var/obj/item/O = i
+ for(var/obj/item/O as anything in holdingitems)
. += "- \A [O.name]."
if(!(stat & (NOPOWER|BROKEN)))
diff --git a/code/modules/reagents/reactions/instant/instant_vr.dm b/code/modules/reagents/reactions/instant/instant_vr.dm
index a014c0d45f..4eef9c3492 100644
--- a/code/modules/reagents/reactions/instant/instant_vr.dm
+++ b/code/modules/reagents/reactions/instant/instant_vr.dm
@@ -208,7 +208,8 @@
result_amount = 1
/decl/chemical_reaction/instant/slime_food/on_reaction(var/datum/reagents/holder)
- var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - /obj/item/weapon/reagent_containers/food/snacks // BORK BORK BORK
+ var/list/borks = subtypesof(/obj/item/weapon/reagent_containers/food/snacks)
+
playsound(holder.my_atom, 'sound/effects/phasein.ogg', 100, 1)
diff --git a/code/modules/reagents/reagents/vore_vr.dm b/code/modules/reagents/reagents/vore_vr.dm
index 5bb366fbe4..0fb3a74b61 100644
--- a/code/modules/reagents/reagents/vore_vr.dm
+++ b/code/modules/reagents/reagents/vore_vr.dm
@@ -76,8 +76,7 @@
M.make_dizzy(1)
M.adjustHalLoss(2)
- for(var/belly in M.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in M.vore_organs)
for(var/atom/movable/A in B)
if(isliving(A))
var/mob/living/P = A
@@ -102,8 +101,7 @@
M.confused = max(M.confused, 20)
M.hallucination += 15
- for(var/belly in M.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in M.vore_organs)
if(B.digest_mode == DM_ABSORB) //Turn off absorbing on bellies
B.digest_mode = DM_HOLD
diff --git a/code/modules/research/research.dm b/code/modules/research/research.dm
index e8ad090e10..81ee392a8b 100644
--- a/code/modules/research/research.dm
+++ b/code/modules/research/research.dm
@@ -52,12 +52,12 @@ GLOBAL_LIST_INIT(design_datums, list())
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
if(!LAZYLEN(GLOB.design_datums))
- for(var/T in typesof(/datum/design) - /datum/design)
+ for(var/T in subtypesof(/datum/design))
GLOB.design_datums += new T
possible_designs = GLOB.design_datums
if(!LAZYLEN(known_tech))
- for(var/T in typesof(/datum/tech) - /datum/tech)
+ for(var/T in subtypesof(/datum/tech))
known_tech += new T
RefreshResearch()
@@ -120,8 +120,7 @@ GLOBAL_LIST_INIT(design_datums, list())
// A simple helper proc to find the name of a tech with a given ID.
/proc/CallTechName(var/ID)
- for(var/T in subtypesof(/datum/tech))
- var/datum/tech/check_tech = T
+ for(var/datum/tech/check_tech as anything in subtypesof(/datum/tech))
if(initial(check_tech.id) == ID)
return initial(check_tech.name)
diff --git a/code/modules/resleeving/infocore_records.dm b/code/modules/resleeving/infocore_records.dm
index 5f3cb027c5..0f16a2b3b7 100644
--- a/code/modules/resleeving/infocore_records.dm
+++ b/code/modules/resleeving/infocore_records.dm
@@ -182,8 +182,7 @@
organ_data[org] = I.robotic
//Genetic modifiers
- for(var/modifier in M.modifiers)
- var/datum/modifier/mod = modifier
+ for(var/datum/modifier/mod as anything in M.modifiers)
if(mod.flags & MODIFIER_GENETIC)
genetic_modifiers.Add(mod.type)
diff --git a/code/modules/resleeving/infomorph.dm b/code/modules/resleeving/infomorph.dm
index 7ba0858334..584ea22aac 100644
--- a/code/modules/resleeving/infomorph.dm
+++ b/code/modules/resleeving/infomorph.dm
@@ -447,7 +447,7 @@ var/global/list/infomorph_software_by_key = list()
var/global/list/default_infomorph_software = list()
/hook/startup/proc/populate_infomorph_software_list()
var/r = 1 // I would use ., but it'd sacrifice runtime detection
- for(var/type in typesof(/datum/infomorph_software) - /datum/infomorph_software)
+ for(var/type in subtypesof(/datum/infomorph_software))
var/datum/infomorph_software/P = new type()
if(infomorph_software_by_key[P.id])
var/datum/infomorph_software/O = infomorph_software_by_key[P.id]
diff --git a/code/modules/rogueminer_vr/zonemaster.dm b/code/modules/rogueminer_vr/zonemaster.dm
index 2b1f3728f5..15d1887803 100644
--- a/code/modules/rogueminer_vr/zonemaster.dm
+++ b/code/modules/rogueminer_vr/zonemaster.dm
@@ -191,8 +191,7 @@
return
var/farEnough = 1
- for(var/A in SSxenoarch.digsite_spawning_turfs)
- var/turf/T = A
+ for(var/turf/T as anything in SSxenoarch.digsite_spawning_turfs)
if(T in range(5, M))
farEnough = 0
break
diff --git a/code/modules/security levels/security levels.dm b/code/modules/security levels/security levels.dm
index aed060d18e..3ce724f87e 100644
--- a/code/modules/security levels/security levels.dm
+++ b/code/modules/security levels/security levels.dm
@@ -76,8 +76,7 @@
if(FA.z in using_map.contact_levels)
FA.on_alert_changed(newlevel)
//VOREStation Add
- for(var/hp in GLOB.holoposters)
- var/obj/machinery/holoposter/HP = hp
+ for(var/obj/machinery/holoposter/HP as anything in GLOB.holoposters)
HP.update_icon()
//VOREStation Add End
diff --git a/code/modules/shuttles/crashes.dm b/code/modules/shuttles/crashes.dm
index 6f6c66e177..a71ab5e07e 100644
--- a/code/modules/shuttles/crashes.dm
+++ b/code/modules/shuttles/crashes.dm
@@ -52,8 +52,7 @@
return // Lucky!
// Hide people
- for(var/living in victims)
- var/mob/living/L = living
+ for(var/mob/living/L as anything in victims)
victims[L] = get_turf(L)
L.Sleeping(rand(10,20))
L.Life()
@@ -70,8 +69,7 @@
command_announcement.Announce("[crash_message]", "Shuttle Alert")
// Put people back
- for(var/living in victims)
- var/mob/living/L = living
+ for(var/mob/living/L as anything in victims)
L.loc = victims[L]
L.adjustBruteLoss(5)
L.adjustBruteLoss(10)
diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm
index 9deff67d7d..7371fa71b9 100644
--- a/code/modules/shuttles/shuttle_console.dm
+++ b/code/modules/shuttles/shuttle_console.dm
@@ -151,8 +151,15 @@
GLOBAL_LIST_BOILERPLATE(papers_dockingcode, /obj/item/weapon/paper/dockingcodes)
/hook/roundstart/proc/populate_dockingcodes()
+<<<<<<< HEAD
for(var/paper in GLOB.papers_dockingcode)
var/obj/item/weapon/paper/dockingcodes/dcp = paper
+||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
+ for(var/paper in global.papers_dockingcode)
+ var/obj/item/weapon/paper/dockingcodes/dcp = paper
+=======
+ for(var/obj/item/weapon/paper/dockingcodes/dcp as anything in global.papers_dockingcode)
+>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
dcp.populate_info()
return TRUE
diff --git a/code/modules/shuttles/shuttles_web.dm b/code/modules/shuttles/shuttles_web.dm
index f871f49bdd..935b47ca72 100644
--- a/code/modules/shuttles/shuttles_web.dm
+++ b/code/modules/shuttles/shuttles_web.dm
@@ -112,8 +112,7 @@
web_master.process_autopath()
/datum/shuttle/autodock/web_shuttle/proc/update_helmets()
- for(var/helm in helmets)
- var/obj/item/clothing/head/pilot/H = helm
+ for(var/obj/item/clothing/head/pilot/H as anything in helmets)
if(QDELETED(H))
helmets -= H
continue
diff --git a/code/modules/shuttles/web_datums.dm b/code/modules/shuttles/web_datums.dm
index 6e34d3750b..d061ebe397 100644
--- a/code/modules/shuttles/web_datums.dm
+++ b/code/modules/shuttles/web_datums.dm
@@ -193,7 +193,7 @@
/datum/shuttle_web_master/proc/build_destinations()
// First, instantiate all the destination subtypes relevant to this datum.
- var/list/destination_types = typesof(destination_class) - destination_class
+ var/list/destination_types = subtypesof(destination_class)
for(var/new_type in destination_types)
var/datum/shuttle_destination/D = new_type
if(initial(D.skip_me))
diff --git a/code/modules/tgs/v3210/commands.dm b/code/modules/tgs/v3210/commands.dm
index 4ccfc1a8a6..25b171bb52 100644
--- a/code/modules/tgs/v3210/commands.dm
+++ b/code/modules/tgs/v3210/commands.dm
@@ -8,7 +8,7 @@
var/list/command_name_types = list()
var/list/warned_command_names = warnings_only ? list() : null
var/warned_about_the_dangers_of_robutussin = !warnings_only
- for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
+ for(var/I in subtypesof(/datum/tgs_chat_command))
if(!warned_about_the_dangers_of_robutussin)
TGS_ERROR_LOG("Custom chat commands in [ApiVersion()] lacks the /datum/tgs_chat_user/sender.channel field!")
warned_about_the_dangers_of_robutussin = TRUE
@@ -32,8 +32,7 @@
/datum/tgs_api/v3210/proc/HandleServiceCustomCommand(command, sender, params)
if(!cached_custom_tgs_chat_commands)
cached_custom_tgs_chat_commands = list()
- for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
- var/datum/tgs_chat_command/stc = I
+ for(var/datum/tgs_chat_command/stc as anything in subtypesof(/datum/tgs_chat_command))
cached_custom_tgs_chat_commands[lowertext(initial(stc.name))] = stc
var/command_type = cached_custom_tgs_chat_commands[command]
diff --git a/code/modules/tgs/v4/api.dm b/code/modules/tgs/v4/api.dm
index 0e37a7aa24..5e338aaa56 100644
--- a/code/modules/tgs/v4/api.dm
+++ b/code/modules/tgs/v4/api.dm
@@ -260,8 +260,7 @@
var/list/ids
if(length(channels))
ids = list()
- for(var/I in channels)
- var/datum/tgs_chat_channel/channel = I
+ for(var/datum/tgs_chat_channel/channel as anything in channels)
ids += channel.id
message = list("message" = message, "channelIds" = ids)
if(intercepted_message_queue)
@@ -271,8 +270,7 @@
/datum/tgs_api/v4/ChatTargetedBroadcast(message, admin_only)
var/list/channels = list()
- for(var/I in ChatChannelInfo())
- var/datum/tgs_chat_channel/channel = I
+ for(var/datum/tgs_chat_channel/channel as anything in ChatChannelInfo())
if (!channel.is_private_channel && ((channel.is_admin_channel && admin_only) || (!channel.is_admin_channel && !admin_only)))
channels += channel.id
message = list("message" = message, "channelIds" = channels)
diff --git a/code/modules/tgs/v4/commands.dm b/code/modules/tgs/v4/commands.dm
index 4ca1500167..770b4864b1 100644
--- a/code/modules/tgs/v4/commands.dm
+++ b/code/modules/tgs/v4/commands.dm
@@ -1,7 +1,7 @@
/datum/tgs_api/v4/proc/ListCustomCommands()
var/results = list()
custom_commands = list()
- for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
+ for(var/I in subtypesof(/datum/tgs_chat_command))
var/datum/tgs_chat_command/stc = new I
var/command_name = stc.name
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
diff --git a/code/modules/tgs/v5/api.dm b/code/modules/tgs/v5/api.dm
index 704ff873c0..0d5adf2fe5 100644
--- a/code/modules/tgs/v5/api.dm
+++ b/code/modules/tgs/v5/api.dm
@@ -302,8 +302,7 @@
channels = ChatChannelInfo()
var/list/ids = list()
- for(var/I in channels)
- var/datum/tgs_chat_channel/channel = I
+ for(var/datum/tgs_chat_channel/channel as anything in channels)
ids += channel.id
message = list(DMAPI5_CHAT_MESSAGE_TEXT = message, DMAPI5_CHAT_MESSAGE_CHANNEL_IDS = ids)
@@ -314,8 +313,7 @@
/datum/tgs_api/v5/ChatTargetedBroadcast(message, admin_only)
var/list/channels = list()
- for(var/I in ChatChannelInfo())
- var/datum/tgs_chat_channel/channel = I
+ for(var/datum/tgs_chat_channel/channel as anything in ChatChannelInfo())
if (!channel.is_private_channel && ((channel.is_admin_channel && admin_only) || (!channel.is_admin_channel && !admin_only)))
channels += channel.id
message = list(DMAPI5_CHAT_MESSAGE_TEXT = message, DMAPI5_CHAT_MESSAGE_CHANNEL_IDS = channels)
diff --git a/code/modules/tgs/v5/commands.dm b/code/modules/tgs/v5/commands.dm
index 6d31dd3422..e5b2562efe 100644
--- a/code/modules/tgs/v5/commands.dm
+++ b/code/modules/tgs/v5/commands.dm
@@ -1,7 +1,7 @@
/datum/tgs_api/v5/proc/ListCustomCommands()
var/results = list()
custom_commands = list()
- for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
+ for(var/I in subtypesof(/datum/tgs_chat_command))
var/datum/tgs_chat_command/stc = new I
var/command_name = stc.name
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
diff --git a/code/modules/tgui/modules/admin_shuttle_controller.dm b/code/modules/tgui/modules/admin_shuttle_controller.dm
index a40dec8fca..d03e78b32d 100644
--- a/code/modules/tgui/modules/admin_shuttle_controller.dm
+++ b/code/modules/tgui/modules/admin_shuttle_controller.dm
@@ -19,8 +19,7 @@
data["shuttles"] = shuttles
var/list/overmap_ships = list()
- for(var/ship in SSshuttles.ships)
- var/obj/effect/overmap/visitable/ship/S = ship
+ for(var/obj/effect/overmap/visitable/ship/S as anything in SSshuttles.ships)
overmap_ships.Add(list(list(
"name" = S.name,
"ref" = REF(S),
diff --git a/code/modules/tgui/modules/appearance_changer.dm b/code/modules/tgui/modules/appearance_changer.dm
index 3b84e95d53..fe7bb95440 100644
--- a/code/modules/tgui/modules/appearance_changer.dm
+++ b/code/modules/tgui/modules/appearance_changer.dm
@@ -45,8 +45,7 @@
cam_plane_masters = get_tgui_plane_masters()
- for(var/plane in cam_plane_masters)
- var/obj/screen/instance = plane
+ for(var/obj/screen/instance as anything in cam_plane_masters)
instance.assigned_map = map_name
instance.del_on_map_removal = FALSE
instance.screen_loc = "[map_name]:CENTER"
diff --git a/code/modules/tgui/modules/camera.dm b/code/modules/tgui/modules/camera.dm
index abfef14be1..fa67030d55 100644
--- a/code/modules/tgui/modules/camera.dm
+++ b/code/modules/tgui/modules/camera.dm
@@ -37,8 +37,7 @@
cam_plane_masters = get_tgui_plane_masters()
- for(var/plane in cam_plane_masters)
- var/obj/screen/instance = plane
+ for(var/obj/screen/instance as anything in cam_plane_masters)
instance.assigned_map = map_name
instance.del_on_map_removal = FALSE
instance.screen_loc = "[map_name]:CENTER"
diff --git a/code/modules/tgui/modules/ntos-only/cardmod.dm b/code/modules/tgui/modules/ntos-only/cardmod.dm
index fc77417996..8a8ace688f 100644
--- a/code/modules/tgui/modules/ntos-only/cardmod.dm
+++ b/code/modules/tgui/modules/ntos-only/cardmod.dm
@@ -49,8 +49,7 @@
data["target_name"] = id_card ? id_card.name : "-----"
var/list/departments = list()
- for(var/D in SSjob.get_all_department_datums())
- var/datum/department/dept = D
+ for(var/datum/department/dept as anything in SSjob.get_all_department_datums())
if(!dept.assignable) // No AI ID cards for you.
continue
if(dept.centcom_only && !is_centcom)
diff --git a/code/modules/tgui/modules/ntos-only/uav.dm b/code/modules/tgui/modules/ntos-only/uav.dm
index b9288457e5..54dcda1675 100644
--- a/code/modules/tgui/modules/ntos-only/uav.dm
+++ b/code/modules/tgui/modules/ntos-only/uav.dm
@@ -30,8 +30,7 @@
var/list/paired_map = list()
var/obj/item/modular_computer/mc_host = tgui_host()
if(istype(mc_host))
- for(var/puav in mc_host.paired_uavs)
- var/weakref/wr = puav
+ for(var/weakref/wr as anything in mc_host.paired_uavs)
var/obj/item/device/uav/U = wr.resolve()
paired_map.Add(list(list("name" = "[U ? U.nickname : "!!Missing!!"]", "uavref" = "\ref[U]")))
@@ -148,8 +147,7 @@
var/list/zlevels_in_long_range = using_map.get_map_levels(their_z, TRUE, om_range = DEFAULT_OVERMAP_RANGE) - zlevels_in_range
var/their_signal = 0
// Measure z-distance between the AM passed in and the nearest relay
- for(var/relay in ntnet_global.relays)
- var/obj/machinery/ntnet_relay/R = relay
+ for(var/obj/machinery/ntnet_relay/R as anything in ntnet_global.relays)
if(!R.operable())
continue
if(R.z == their_z)
diff --git a/code/modules/virus2/admin.dm b/code/modules/virus2/admin.dm
index b0e92139b4..dd9ae7ead7 100644
--- a/code/modules/virus2/admin.dm
+++ b/code/modules/virus2/admin.dm
@@ -57,10 +57,9 @@
var/list/L = list()
- for(var/e in (typesof(/datum/disease2/effect) - /datum/disease2/effect))
- var/datum/disease2/effect/f = e
+ for(var/datum/disease2/effect/f as anything in subtypesof(/datum/disease2/effect))
if(initial(f.stage) <= stage)
- L[initial(f.name)] = e
+ L[initial(f.name)] = f
var/datum/disease2/effect/Eff = s[stage]
diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm
index dd19e5e3f4..5e3e955574 100644
--- a/code/modules/virus2/effect.dm
+++ b/code/modules/virus2/effect.dm
@@ -15,9 +15,8 @@
/datum/disease2/effectholder/proc/getrandomeffect(var/badness = 1, exclude_types=list())
var/list/datum/disease2/effect/list = list()
- for(var/e in (typesof(/datum/disease2/effect) - /datum/disease2/effect))
- var/datum/disease2/effect/f = e
- if(e in exclude_types)
+ for(var/datum/disease2/effect/f as anything in subtypesof(/datum/disease2/effect))
+ if(f in exclude_types)
continue
if(initial(f.badness) > badness) //we don't want such strong effects
continue
diff --git a/code/modules/vore/eating/belly_obj_vr.dm b/code/modules/vore/eating/belly_obj_vr.dm
index 92724d0f86..16d1280b21 100644
--- a/code/modules/vore/eating/belly_obj_vr.dm
+++ b/code/modules/vore/eating/belly_obj_vr.dm
@@ -326,8 +326,7 @@
var/count = 0
//Iterate over contents and move them all
- for(var/thing in contents)
- var/atom/movable/AM = thing
+ for(var/atom/movable/AM as anything in contents)
if(isliving(AM))
var/mob/living/L = AM
if(L.absorbed && !include_absorbed)
@@ -639,8 +638,7 @@
//This in particular will recurse oddly because if there is absorbed prey of prey of prey...
//it will just move them up one belly. This should never happen though since... when they were
//absobred, they should have been absorbed as well!
- for(var/belly in M.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in M.vore_organs)
for(var/mob/living/Mm in B)
if(Mm.absorbed)
absorb_living(Mm)
@@ -777,8 +775,7 @@
else if(prob(transferchance) && transferlocation) //Next, let's have it see if they end up getting into an even bigger mess then when they started.
var/obj/belly/dest_belly
- for(var/belly in owner.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in owner.vore_organs)
if(B.name == transferlocation)
dest_belly = B
break
diff --git a/code/modules/vore/eating/bellymodes_vr.dm b/code/modules/vore/eating/bellymodes_vr.dm
index aec57913ee..4687fb30cc 100644
--- a/code/modules/vore/eating/bellymodes_vr.dm
+++ b/code/modules/vore/eating/bellymodes_vr.dm
@@ -85,11 +85,11 @@
///////////////////// Time to actually process mobs /////////////////////
- for(var/target in touchable_mobs)
- var/mob/living/L = target
+ for(var/mob/living/L as anything in touchable_mobs)
if(!istype(L))
+ stack_trace("Touchable mobs had a nonmob: [L]")
continue
- var/list/returns = DM.process_mob(src, target)
+ var/list/returns = DM.process_mob(src, L)
if(istype(returns) && returns["to_update"])
to_update = TRUE
if(istype(returns) && returns["soundToPlay"] && !play_sound)
diff --git a/code/modules/vore/eating/living_vr.dm b/code/modules/vore/eating/living_vr.dm
index d69ccb25b9..588d2ef503 100644
--- a/code/modules/vore/eating/living_vr.dm
+++ b/code/modules/vore/eating/living_vr.dm
@@ -251,8 +251,7 @@
var/list/serialized = list()
- for(var/belly in src.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in src.vore_organs)
serialized += list(B.serialize()) //Can't add a list as an object to another list in Byond. Thanks.
P.belly_prefs = serialized
@@ -305,8 +304,7 @@
// Release everything in every vore organ
//
/mob/living/proc/release_vore_contents(var/include_absorbed = TRUE, var/silent = FALSE)
- for(var/belly in vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in vore_organs)
B.release_all_contents(include_absorbed, silent)
//
@@ -317,10 +315,27 @@
return list()
var/list/message_list = list()
+<<<<<<< HEAD
for (var/belly in vore_organs)
var/obj/belly/B = belly
message_list += B.get_examine_msg()
message_list += B.get_examine_msg_absorbed()
+||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
+ for (var/belly in vore_organs)
+ var/obj/belly/B = belly
+ var/bellymessage = B.get_examine_msg()
+ if(bellymessage) message_list += bellymessage
+
+ bellymessage = B.get_examine_msg_absorbed()
+ if(bellymessage) message_list += bellymessage
+=======
+ for(var/obj/belly/B as anything in vore_organs)
+ var/bellymessage = B.get_examine_msg()
+ if(bellymessage) message_list += bellymessage
+
+ bellymessage = B.get_examine_msg_absorbed()
+ if(bellymessage) message_list += bellymessage
+>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt
return message_list
diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm
index c506ff98af..82133bf126 100644
--- a/code/modules/vore/eating/vorepanel_vr.dm
+++ b/code/modules/vore/eating/vorepanel_vr.dm
@@ -139,8 +139,7 @@
data["inside"] = inside
var/list/our_bellies = list()
- for(var/belly in host.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in host.vore_organs)
our_bellies.Add(list(list(
"selected" = (B == host.vore_selected),
"name" = B.name,
@@ -320,8 +319,7 @@
failure_msg = "Entered belly name length invalid (must be longer than [BELLIES_NAME_MIN], no more than than [BELLIES_NAME_MAX])."
// else if(whatever) //Next test here.
else
- for(var/belly in host.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in host.vore_organs)
if(lowertext(new_name) == lowertext(B.name))
failure_msg = "No duplicate belly names, please."
break
@@ -694,8 +692,7 @@
failure_msg = "Entered belly name length invalid (must be longer than [BELLIES_NAME_MIN], no more than than [BELLIES_NAME_MAX])."
// else if(whatever) //Next test here.
else
- for(var/belly in host.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in host.vore_organs)
if(lowertext(new_name) == lowertext(B.name))
failure_msg = "No duplicate belly names, please."
break
@@ -1034,8 +1031,7 @@
var/failure_msg = ""
var/dest_for //Check to see if it's the destination of another vore organ.
- for(var/belly in host.vore_organs)
- var/obj/belly/B = belly
+ for(var/obj/belly/B as anything in host.vore_organs)
if(B.transferlocation == host.vore_selected)
dest_for = B.name
failure_msg += "This is the destiantion for at least '[dest_for]' belly transfers. Remove it as the destination from any bellies before deleting it. "
diff --git a/code/modules/xenoarcheaology/artifacts/artifact.dm b/code/modules/xenoarcheaology/artifacts/artifact.dm
index bbf54ed469..e723561a73 100644
--- a/code/modules/xenoarcheaology/artifacts/artifact.dm
+++ b/code/modules/xenoarcheaology/artifacts/artifact.dm
@@ -33,11 +33,11 @@
secondary_effect.ToggleActivate(0)
else
- var/effecttype = pick(typesof(/datum/artifact_effect) - /datum/artifact_effect)
+ var/effecttype = pick(subtypesof(/datum/artifact_effect))
my_effect = new effecttype(src)
if(prob(75))
- effecttype = pick(typesof(/datum/artifact_effect) - /datum/artifact_effect)
+ effecttype = pick(subtypesof(/datum/artifact_effect))
secondary_effect = new effecttype(src)
if(prob(75))
secondary_effect.ToggleActivate(0)
@@ -85,11 +85,11 @@
secondary_effect.trigger = predefined_trig_secondary
/obj/machinery/artifact/proc/choose_effect()
- var/effect_type = tgui_input_list(usr, "What type do you want?", "Effect Type", typesof(/datum/artifact_effect) - /datum/artifact_effect)
+ var/effect_type = tgui_input_list(usr, "What type do you want?", "Effect Type", subtypesof(/datum/artifact_effect))
if(effect_type)
my_effect = new effect_type(src)
if(tgui_alert(usr, "Do you want a secondary effect?", "Second Effect", list("No", "Yes")) == "Yes")
- var/second_effect_type = tgui_input_list(usr, "What type do you want as well?", "Second Effect Type", typesof(/datum/artifact_effect) - list(/datum/artifact_effect, effect_type))
+ var/second_effect_type = tgui_input_list(usr, "What type do you want as well?", "Second Effect Type", subtypesof(/datum/artifact_effect) - effect_type)
secondary_effect = new second_effect_type(src)
else
secondary_effect = null
diff --git a/code/modules/xenoarcheaology/tools/tools.dm b/code/modules/xenoarcheaology/tools/tools.dm
index f16eae5458..14bda53ca2 100644
--- a/code/modules/xenoarcheaology/tools/tools.dm
+++ b/code/modules/xenoarcheaology/tools/tools.dm
@@ -58,8 +58,7 @@
var/turf/cur_turf = get_turf(src)
if(SSxenoarch) //Sanity check due to runtimes ~Z
- for(var/A in SSxenoarch.artifact_spawning_turfs)
- var/turf/simulated/mineral/T = A
+ for(var/turf/simulated/mineral/T as anything in SSxenoarch.artifact_spawning_turfs)
if(T.density && T.artifact_find)
if(T.z == cur_turf.z)
var/cur_dist = get_dist(cur_turf, T) * 2
@@ -69,8 +68,7 @@
else
SSxenoarch.artifact_spawning_turfs.Remove(T)
- for(var/A in SSxenoarch.digsite_spawning_turfs)
- var/turf/simulated/mineral/T = A
+ for(var/turf/simulated/mineral/T as anything in SSxenoarch.digsite_spawning_turfs)
if(T.density && T.finds && T.finds.len)
if(T.z == cur_turf.z)
var/cur_dist = get_dist(cur_turf, T) * 2
diff --git a/code/modules/xenobio2/mob/slime/slime.dm b/code/modules/xenobio2/mob/slime/slime.dm
index 3d52c053d8..a3fca442d5 100644
--- a/code/modules/xenobio2/mob/slime/slime.dm
+++ b/code/modules/xenobio2/mob/slime/slime.dm
@@ -82,7 +82,7 @@ Slime definitions, Life and New live here.
/mob/living/simple_mob/xeno/slime/New()
..()
- for(var/datum/language/L in (typesof(/datum/language) - /datum/language))
+ for(var/datum/language/L in subtypesof(/datum/language))
languages += L
speak += "[station_name()]?"
traitdat.source = "Slime"
diff --git a/code/modules/xgm/xgm_gas_data.dm b/code/modules/xgm/xgm_gas_data.dm
index 4ee3e1c501..42c508c4f6 100644
--- a/code/modules/xgm/xgm_gas_data.dm
+++ b/code/modules/xgm/xgm_gas_data.dm
@@ -29,7 +29,7 @@
/hook/startup/proc/generateGasData()
gas_data = new
- for(var/p in (typesof(/decl/xgm_gas) - /decl/xgm_gas))
+ for(var/p in subtypesof(/decl/xgm_gas))
var/decl/xgm_gas/gas = new p //avoid initial() because of potential New() actions
if(gas.id in gas_data.gases)
diff --git a/code/unit_tests/integrated_circuits/prefabs.dm b/code/unit_tests/integrated_circuits/prefabs.dm
index 04b3136640..1436e7d097 100644
--- a/code/unit_tests/integrated_circuits/prefabs.dm
+++ b/code/unit_tests/integrated_circuits/prefabs.dm
@@ -10,8 +10,7 @@
var/available_size = initial(assembly.max_components)
var/available_complexity = initial(assembly.max_complexity)
- for(var/ic in prefab.integrated_circuits)
- var/datum/ic_assembly_integrated_circuits/iaic = ic
+ for(var/datum/ic_assembly_integrated_circuits/iaic as anything in prefab.integrated_circuits)
var/obj/item/integrated_circuit/circuit = iaic.circuit_type
available_size -= initial(circuit.size)
available_complexity -= initial(circuit.complexity)
diff --git a/code/unit_tests/loadout_tests.dm b/code/unit_tests/loadout_tests.dm
index aba7184229..f6bfd19d5a 100644
--- a/code/unit_tests/loadout_tests.dm
+++ b/code/unit_tests/loadout_tests.dm
@@ -3,8 +3,7 @@
/datum/unit_test/loadout_test_shall_have_name_cost_path/start_test()
var/failed = 0
- for(var/geartype in typesof(/datum/gear) - /datum/gear)
- var/datum/gear/G = geartype
+ for(var/datum/gear/G as anything in subtypesof(/datum/gear))
if(!initial(G.display_name))
log_unit_test("[G]: Loadout - Missing display name.")
diff --git a/code/unit_tests/research_tests.dm b/code/unit_tests/research_tests.dm
index 9d0174cabe..09de5aaca6 100644
--- a/code/unit_tests/research_tests.dm
+++ b/code/unit_tests/research_tests.dm
@@ -47,7 +47,7 @@
/datum/unit_test/research_designs_have_valid_materials/start_test()
var/number_of_issues = 0
- for(var/design_type in typesof(/datum/design) - /datum/design)
+ for(var/design_type in subtypesof(/datum/design))
var/datum/design/design = design_type
if(initial(design.id) == "id")
continue
diff --git a/maps/tether/tether_shuttles.dm b/maps/tether/tether_shuttles.dm
index 0481ba9741..f8e126d024 100644
--- a/maps/tether/tether_shuttles.dm
+++ b/maps/tether/tether_shuttles.dm
@@ -94,8 +94,7 @@
/datum/shuttle/ferry/tether_backup/process_longjump(var/area/origin, var/area/intended_destination)
var/failures = engines.len
- for(var/engine in engines)
- var/obj/structure/shuttle/engine/E = engine
+ for(var/obj/structure/shuttle/engine/E as anything in engines)
failures -= E.jump()
#define MOVE_PER(x) move_time*(x/100) SECONDS
diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm
index 4a6b06fc77..67f4ea76a3 100644
--- a/maps/~map_system/maps.dm
+++ b/maps/~map_system/maps.dm
@@ -3,7 +3,7 @@ var/datum/map/using_map = new USING_MAP_DATUM
var/list/all_maps = list()
/hook/startup/proc/initialise_map_list()
- for(var/type in typesof(/datum/map) - /datum/map)
+ for(var/type in subtypesof(/datum/map))
var/datum/map/M
if(type == using_map.type)
M = using_map