diff --git a/code/ATMOSPHERICS/pipes/he_pipes.dm b/code/ATMOSPHERICS/pipes/he_pipes.dm index 8b1b800830..89ecf1e2bb 100644 --- a/code/ATMOSPHERICS/pipes/he_pipes.dm +++ b/code/ATMOSPHERICS/pipes/he_pipes.dm @@ -104,9 +104,7 @@ parent.radiate_heat_to_space(surface, 1) if(has_buckled_mobs()) - for(var/M in buckled_mobs) - var/mob/living/L = M - + for(var/mob/living/L as anything in buckled_mobs) var/hc = pipe_air.heat_capacity() var/avg_temp = (pipe_air.temperature * hc + L.bodytemperature * 3500) / (hc + 3500) pipe_air.temperature = avg_temp diff --git a/code/ZAS/Atom.dm b/code/ZAS/Atom.dm index 1953c58e9f..06305182b3 100644 --- a/code/ZAS/Atom.dm +++ b/code/ZAS/Atom.dm @@ -93,8 +93,7 @@ return AIR_BLOCKED var/result = 0 - for(var/mm in contents) - var/atom/movable/M = mm + for(var/atom/movable/M as anything in contents) switch(M.can_atmos_pass) if(ATMOS_PASS_YES) continue diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index 1f281d334a..e67d2ad3ac 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -71,8 +71,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin var/fuel_to_remove = used_liquid_fuel/(fuel_objs.len*LIQUIDFUEL_AMOUNT_TO_MOL) //convert back to liquid volume units - for(var/O in fuel_objs) - var/obj/effect/decal/cleanable/liquid_fuel/fuel = O + for(var/obj/effect/decal/cleanable/liquid_fuel/fuel as anything in fuel_objs) if(!istype(fuel)) fuel_objs -= fuel continue diff --git a/code/_helpers/_lists.dm b/code/_helpers/_lists.dm index d71897c466..c359227f05 100644 --- a/code/_helpers/_lists.dm +++ b/code/_helpers/_lists.dm @@ -127,22 +127,19 @@ //returns a new list with only atoms that are in typecache L /proc/typecache_filter_list(list/atoms, list/typecache) . = list() - for(var/thing in atoms) - var/atom/A = thing + for(var/atom/A as anything in atoms) if(typecache[A.type]) . += A /proc/typecache_filter_list_reverse(list/atoms, list/typecache) . = list() - for(var/thing in atoms) - var/atom/A = thing + for(var/atom/A as anything in atoms) if(!typecache[A.type]) . += A /proc/typecache_filter_multi_list_exclusion(list/atoms, list/typecache_include, list/typecache_exclude) . = list() - for(var/thing in atoms) - var/atom/A = thing + for(var/atom/A as anything in atoms) if(typecache_include[A.type] && !typecache_exclude[A.type]) . += A diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index 179f7251d9..ac38f40302 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -226,8 +226,7 @@ var/mobs_radio_range_fired = 1 //CHOMPEdit . = list() // Returns a list of mobs who can hear any of the radios given in @radios var/list/speaker_coverage = list() - for(var/r in radios) - var/obj/item/device/radio/R = r // You better fucking be a radio. + for(var/obj/item/device/radio/R as anything in radios) var/turf/speaker = get_turf(R) if(speaker) for(var/turf/T in R.can_broadcast_to()) //CHOMPEdit @@ -378,8 +377,7 @@ var/mobs_radio_range_fired = 1 //CHOMPEdit /proc/flick_overlay_view(image/I, atom/target, duration, gc_after) //wrapper for the above, flicks to everyone who can see the target atom var/list/viewing = list() - for(var/m in viewers(target)) - var/mob/M = m + for(var/mob/M as anything in viewers(target)) if(M.client) viewing += M.client flick_overlay(I, viewing, duration, gc_after) diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index fcb6554a5c..1a482e6d24 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -215,23 +215,20 @@ GLOBAL_LIST_EMPTY(mannequins) // Suit cyclers paths = subtypesof(/datum/suit_cycler_choice/department) - for(var/path in paths) - var/datum/suit_cycler_choice/SCC = path + for(var/datum/suit_cycler_choice/SCC as anything in paths) if(!initial(SCC.name)) continue - GLOB.suit_cycler_departments += new path() + GLOB.suit_cycler_departments += new SCC() paths = subtypesof(/datum/suit_cycler_choice/species) - for(var/path in paths) - var/datum/suit_cycler_choice/SCC = path + for(var/datum/suit_cycler_choice/SCC as anything in paths) if(!initial(SCC.name)) continue - GLOB.suit_cycler_species += new path() + GLOB.suit_cycler_species += new SCC() paths = subtypesof(/datum/suit_cycler_choice/department/emag) - for(var/path in paths) - var/datum/suit_cycler_choice/SCC = path + for(var/datum/suit_cycler_choice/SCC as anything in paths) if(!initial(SCC.name)) continue - GLOB.suit_cycler_emagged += new path() + GLOB.suit_cycler_emagged += new SCC() //Ores paths = subtypesof(/ore) @@ -273,7 +270,7 @@ GLOBAL_LIST_EMPTY(mannequins) /* // Custom species traits - paths = subtypesof(/datum/trait) - /datum/trait + paths = subtypesof(/datum/trait) for(var/path in paths) var/datum/trait/instance = new path() if(!instance.name) diff --git a/code/_helpers/global_lists_vr.dm b/code/_helpers/global_lists_vr.dm index 7224522352..0d982e65e8 100644 --- a/code/_helpers/global_lists_vr.dm +++ b/code/_helpers/global_lists_vr.dm @@ -534,7 +534,7 @@ var/global/list/remainless_species = list(SPECIES_PROMETHEAN, var/paths // Custom Hair Accessories - paths = typesof(/datum/sprite_accessory/hair_accessory) - /datum/sprite_accessory/hair_accessory + paths = subtypesof(/datum/sprite_accessory/hair_accessory) for(var/path in paths) var/datum/sprite_accessory/hair_accessory/instance = new path() hair_accesories_list[path] = instance @@ -568,14 +568,14 @@ var/global/list/remainless_species = list(SPECIES_PROMETHEAN, // Weaver recipe stuff - paths = typesof(/datum/weaver_recipe/structure) - /datum/weaver_recipe/structure + paths = subtypesof(/datum/weaver_recipe/structure) for(var/path in paths) var/datum/weaver_recipe/instance = new path() if(!instance.title) continue //A prototype or something weavable_structures[instance.title] = instance - paths = typesof(/datum/weaver_recipe/item) - /datum/weaver_recipe/item + paths = subtypesof(/datum/weaver_recipe/item) for(var/path in paths) var/datum/weaver_recipe/instance = new path() if(!instance.title) diff --git a/code/_helpers/icons.dm b/code/_helpers/icons.dm index 8e4de46935..53ad12d9b3 100644 --- a/code/_helpers/icons.dm +++ b/code/_helpers/icons.dm @@ -762,8 +762,7 @@ world // Dimensions of overlay being added var/list/add_size[4] - for(var/V in layers) - var/image/I = V + for(var/image/I as anything in layers) if(I.alpha == 0) continue @@ -897,8 +896,7 @@ world //For photo camera. /proc/build_composite_icon(atom/A) var/icon/composite = icon(A.icon, A.icon_state, A.dir, 1) - for(var/O in A.overlays) - var/image/I = O + for(var/image/I as anything in A.overlays) composite.Blend(icon(I.icon, I.icon_state, I.dir, 1), ICON_OVERLAY) return composite diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index cef24751a2..4772ebcdf4 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -1249,8 +1249,7 @@ var/mob/dview/dview_mob = new if(orange) turfs -= get_turf(center) . = list() - for(var/V in turfs) - var/turf/T = V + for(var/turf/T as anything in turfs) . += T . += T.contents if(areas) diff --git a/code/_helpers/visual_filters.dm b/code/_helpers/visual_filters.dm index 96f6871000..c02bbb6993 100644 --- a/code/_helpers/visual_filters.dm +++ b/code/_helpers/visual_filters.dm @@ -335,8 +335,7 @@ GLOBAL_LIST_INIT(master_filter_info, list( /obj/item/update_filters() . = ..() /* Will port this from TG - for(var/X in actions) - var/datum/action/A = X + for(var/datum/action/A as anything in actions) A.UpdateButtonIcon() */ diff --git a/code/_onclick/hud/minihud_rigmech.dm b/code/_onclick/hud/minihud_rigmech.dm index e54a733f80..b4d13f1c86 100644 --- a/code/_onclick/hud/minihud_rigmech.dm +++ b/code/_onclick/hud/minihud_rigmech.dm @@ -21,8 +21,7 @@ screenobjs += new /obj/screen/rig/deco1_f screenobjs += new /obj/screen/rig/deco2_f - for(var/scr in screenobjs) - var/obj/screen/S = scr + for(var/obj/screen/S as anything in screenobjs) S.master = owner_rig ..() @@ -71,8 +70,7 @@ screenobjs += new /obj/screen/mech/deco1_f screenobjs += new /obj/screen/mech/deco2_f - for(var/scr in screenobjs) - var/obj/screen/S = scr + for(var/obj/screen/S as anything in screenobjs) S.master = owner_mech ..() diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 037664027a..9a3e28e584 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD var/list/gamemode_cache = list() /datum/configuration @@ -1149,3 +1150,2292 @@ var/list/gamemode_cache = list() config.python_path = "/usr/bin/env python2" else //probably windows, if not this should work anyway config.python_path = "python" +||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt +var/list/gamemode_cache = list() + +/datum/configuration + var/static/server_name = null // server name (for world name / status) + var/static/server_suffix = 0 // generate numeric suffix based on server port + + var/static/nudge_script_path = "nudge.py" // where the nudge.py script is located + + var/static/log_ooc = 0 // log OOC channel + var/static/log_access = 0 // log login/logout + var/static/log_say = 0 // log client say + var/static/log_admin = 0 // log admin actions + var/static/log_debug = 1 // log debug output + var/static/log_game = 0 // log game events + var/static/log_vote = 0 // log voting + var/static/log_whisper = 0 // log client whisper + var/static/log_emote = 0 // log emotes + var/static/log_attack = 0 // log attack messages + var/static/log_adminchat = 0 // log admin chat messages + var/static/log_adminwarn = 0 // log warnings admins get about bomb construction and such + var/static/log_pda = 0 // log pda messages + var/static/log_hrefs = 0 // logs all links clicked in-game. Could be used for debugging and tracking down exploits + var/static/log_runtime = 0 // logs world.log to a file + var/static/log_world_output = 0 // log to_world_log(messages) + var/static/log_graffiti = 0 // logs graffiti + var/static/sql_enabled = 0 // for sql switching + var/static/allow_admin_ooccolor = 0 // Allows admins with relevant permissions to have their own ooc colour + var/static/allow_vote_restart = 0 // allow votes to restart + var/static/ert_admin_call_only = 0 + var/static/allow_vote_mode = 0 // allow votes to change mode + var/static/allow_admin_jump = 1 // allows admin jumping + var/static/allow_admin_spawning = 1 // allows admin item spawning + var/static/allow_admin_rev = 1 // allows admin revives + var/static/pregame_time = 180 // pregame time in seconds + var/static/vote_delay = 6000 // minimum time between voting sessions (deciseconds, 10 minute default) + var/static/vote_period = 600 // length of voting period (deciseconds, default 1 minute) + var/static/vote_autotransfer_initial = 108000 // Length of time before the first autotransfer vote is called + var/static/vote_autotransfer_interval = 36000 // length of time before next sequential autotransfer vote + var/static/vote_autogamemode_timeleft = 100 //Length of time before round start when autogamemode vote is called (in seconds, default 100). + var/static/vote_no_default = 0 // vote does not default to nochange/norestart (tbi) + var/static/vote_no_dead = 0 // dead people can't vote (tbi) +// var/static/enable_authentication = 0 // goon authentication + var/static/del_new_on_log = 1 // del's new players if they log before they spawn in + var/static/feature_object_spell_system = 0 //spawns a spellbook which gives object-type spells instead of verb-type spells for the wizard + var/static/traitor_scaling = 0 //if amount of traitors scales based on amount of players + var/static/objectives_disabled = 0 //if objectives are disabled or not + var/static/protect_roles_from_antagonist = 0// If security and such can be traitor/cult/other + var/static/continous_rounds = 0 // Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke. + var/static/allow_Metadata = 0 // Metadata is supported. + var/static/popup_admin_pm = 0 //adminPMs to non-admins show in a pop-up 'reply' window when set to 1. + var/static/fps = 20 + var/static/tick_limit_mc_init = TICK_LIMIT_MC_INIT_DEFAULT //SSinitialization throttling + var/static/Tickcomp = 0 + var/static/socket_talk = 0 // use socket_talk to communicate with other processes + var/static/list/resource_urls = null + var/static/antag_hud_allowed = 0 // Ghosts can turn on Antagovision to see a HUD of who is the bad guys this round. + var/static/antag_hud_restricted = 0 // Ghosts that turn on Antagovision cannot rejoin the round. + var/static/list/mode_names = list() + var/static/list/modes = list() // allowed modes + var/static/list/votable_modes = list() // votable modes + var/static/list/probabilities = list() // relative probability of each mode + var/static/list/player_requirements = list() // Overrides for how many players readied up a gamemode needs to start. + var/static/list/player_requirements_secret = list() // Same as above, but for the secret gamemode. + var/static/humans_need_surnames = 0 + var/static/allow_random_events = 0 // enables random events mid-round when set to 1 + var/static/enable_game_master = 0 // enables the 'smart' event system. + var/static/allow_ai = 1 // allow ai job + var/static/allow_ai_shells = FALSE // allow AIs to enter and leave special borg shells at will, and for those shells to be buildable. + var/static/give_free_ai_shell = FALSE // allows a specific spawner object to instantiate a premade AI Shell + var/static/hostedby = null + + var/static/respawn = 1 + var/static/respawn_time = 3000 // time before a dead player is allowed to respawn (in ds, though the config file asks for minutes, and it's converted below) + var/static/respawn_message = "Make sure to play a different character, and please roleplay correctly!" + + var/static/guest_jobban = 1 + var/static/usewhitelist = 0 + var/static/kick_inactive = 0 //force disconnect for inactive players after this many minutes, if non-0 + var/static/show_mods = 0 + var/static/show_devs = 0 + var/static/show_event_managers = 0 + var/static/mods_can_tempban = 0 + var/static/mods_can_job_tempban = 0 + var/static/mod_tempban_max = 1440 + var/static/mod_job_tempban_max = 1440 + var/static/load_jobs_from_txt = 0 + var/static/ToRban = 0 + var/static/automute_on = 0 //enables automuting/spam prevention + var/static/jobs_have_minimal_access = 0 //determines whether jobs use minimal access or expanded access. + + var/static/cult_ghostwriter = 1 //Allows ghosts to write in blood in cult rounds... + var/static/cult_ghostwriter_req_cultists = 10 //...so long as this many cultists are active. + + var/static/character_slots = 10 // The number of available character slots + var/static/loadout_slots = 3 // The number of loadout slots per character + + var/static/max_maint_drones = 5 //This many drones can spawn, + var/static/allow_drone_spawn = 1 //assuming the admin allow them to. + var/static/drone_build_time = 1200 //A drone will become available every X ticks since last drone spawn. Default is 2 minutes. + + var/static/disable_player_mice = 0 + var/static/uneducated_mice = 0 //Set to 1 to prevent newly-spawned mice from understanding human speech + + var/static/usealienwhitelist = 0 + var/static/limitalienplayers = 0 + var/static/alien_to_human_ratio = 0.5 + var/static/allow_extra_antags = 0 + var/static/guests_allowed = 1 + var/static/debugparanoid = 0 + var/static/panic_bunker = 0 + var/static/paranoia_logging = 0 + + var/static/ip_reputation = FALSE //Should we query IPs to get scores? Generates HTTP traffic to an API service. + var/static/ipr_email //Left null because you MUST specify one otherwise you're making the internet worse. + var/static/ipr_block_bad_ips = FALSE //Should we block anyone who meets the minimum score below? Otherwise we just log it (If paranoia logging is on, visibly in chat). + var/static/ipr_bad_score = 1 //The API returns a value between 0 and 1 (inclusive), with 1 being 'definitely VPN/Tor/Proxy'. Values equal/above this var are considered bad. + var/static/ipr_allow_existing = FALSE //Should we allow known players to use VPNs/Proxies? If the player is already banned then obviously they still can't connect. + var/static/ipr_minimum_age = 5 //How many days before a player is considered 'fine' for the purposes of allowing them to use VPNs. + + var/static/serverurl + var/static/server + var/static/banappeals + var/static/wikiurl + var/static/wikisearchurl + var/static/forumurl + var/static/githuburl + var/static/discordurl + var/static/rulesurl + var/static/mapurl + + //Alert level description + var/static/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced." + var/static/alert_desc_yellow_upto = "A minor security emergency has developed. Security personnel are to report to their supervisor for orders and may have weapons visible on their person. Privacy laws are still enforced." + var/static/alert_desc_yellow_downto = "Code yellow procedures are now in effect. Security personnel are to report to their supervisor for orders and may have weapons visible on their person. Privacy laws are still enforced." + var/static/alert_desc_violet_upto = "A major medical emergency has developed. Medical personnel are required to report to their supervisor for orders, and non-medical personnel are required to obey all relevant instructions from medical staff." + var/static/alert_desc_violet_downto = "Code violet procedures are now in effect; Medical personnel are required to report to their supervisor for orders, and non-medical personnel are required to obey relevant instructions from medical staff." + var/static/alert_desc_orange_upto = "A major engineering emergency has developed. Engineering personnel are required to report to their supervisor for orders, and non-engineering personnel are required to evacuate any affected areas and obey relevant instructions from engineering staff." + var/static/alert_desc_orange_downto = "Code orange procedures are now in effect; Engineering personnel are required to report to their supervisor for orders, and non-engineering personnel are required to evacuate any affected areas and obey relevant instructions from engineering staff." + var/static/alert_desc_blue_upto = "A major security emergency has developed. Security personnel are to report to their supervisor for orders, are permitted to search staff and facilities, and may have weapons visible on their person." + var/static/alert_desc_blue_downto = "Code blue procedures are now in effect. Security personnel are to report to their supervisor for orders, are permitted to search staff and facilities, and may have weapons visible on their person." + var/static/alert_desc_red_upto = "There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised." + var/static/alert_desc_red_downto = "The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised." + var/static/alert_desc_delta = "The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill." + + var/static/forbid_singulo_possession = 0 + + //game_options.txt configs + + var/static/health_threshold_softcrit = 0 + var/static/health_threshold_crit = 0 + var/static/health_threshold_dead = -100 + + var/static/organ_health_multiplier = 1 + var/static/organ_regeneration_multiplier = 1 + var/static/organs_decay + var/static/default_brain_health = 400 + var/static/allow_headgibs = FALSE + + //Paincrit knocks someone down once they hit 60 shock_stage, so by default make it so that close to 100 additional damage needs to be dealt, + //so that it's similar to HALLOSS. Lowered it a bit since hitting paincrit takes much longer to wear off than a halloss stun. + var/static/organ_damage_spillover_multiplier = 0.5 + + var/static/bones_can_break = 0 + var/static/limbs_can_break = 0 + + var/static/revival_pod_plants = 1 + var/static/revival_cloning = 1 + var/static/revival_brain_life = -1 + + var/static/use_loyalty_implants = 0 + + var/static/welder_vision = 1 + var/static/generate_map = 0 + var/static/no_click_cooldown = 0 + + //Used for modifying movement speed for mobs. + //Unversal modifiers + var/static/run_speed = 0 + var/static/walk_speed = 0 + + //Mob specific modifiers. NOTE: These will affect different mob types in different ways + var/static/human_delay = 0 + var/static/robot_delay = 0 + var/static/monkey_delay = 0 + var/static/alien_delay = 0 + var/static/slime_delay = 0 + var/static/animal_delay = 0 + + var/static/footstep_volume = 0 + + var/static/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt + var/static/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt + var/static/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database + var/static/use_age_restriction_for_antags = 0 //Do antags use account age restrictions? --requires database + + var/static/simultaneous_pm_warning_timeout = 100 + + var/static/use_recursive_explosions //Defines whether the server uses recursive or circular explosions. + var/static/multi_z_explosion_scalar = 0.5 //Multiplier for how much weaker explosions are on neighboring z levels. + + var/static/assistant_maint = 0 //Do assistants get maint access? + var/static/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour. + var/static/ghost_interaction = 0 + + var/static/comms_password = "" + + var/static/enter_allowed = 1 + + var/use_irc_bot = 0 + var/use_node_bot = 0 + var/irc_bot_port = 0 + var/irc_bot_host = "" + var/irc_bot_export = 0 // whether the IRC bot in use is a Bot32 (or similar) instance; Bot32 uses world.Export() instead of nudge.py/libnudge + var/main_irc = "" + var/admin_irc = "" + var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix + var/use_lib_nudge = 0 //Use the C library nudge instead of the python nudge. + var/use_overmap = 0 + + var/static/list/engine_map = list("Supermatter Engine", "Edison's Bane") // Comma separated list of engines to choose from. Blank means fully random. + + // Event settings + var/static/expected_round_length = 3 * 60 * 60 * 10 // 3 hours + // If the first delay has a custom start time + // No custom time, no custom time, between 80 to 100 minutes respectively. + var/static/list/event_first_run = list(EVENT_LEVEL_MUNDANE = null, EVENT_LEVEL_MODERATE = null, EVENT_LEVEL_MAJOR = list("lower" = 48000, "upper" = 60000)) + // The lowest delay until next event + // 10, 30, 50 minutes respectively + var/static/list/event_delay_lower = list(EVENT_LEVEL_MUNDANE = 6000, EVENT_LEVEL_MODERATE = 18000, EVENT_LEVEL_MAJOR = 30000) + // The upper delay until next event + // 15, 45, 70 minutes respectively + var/static/list/event_delay_upper = list(EVENT_LEVEL_MUNDANE = 9000, EVENT_LEVEL_MODERATE = 27000, EVENT_LEVEL_MAJOR = 42000) + + var/static/aliens_allowed = 1 //Changed to 1 so player xenos can lay eggs. + var/static/ninjas_allowed = 0 + var/static/abandon_allowed = 1 + var/static/ooc_allowed = 1 + var/static/looc_allowed = 1 + var/static/dooc_allowed = 1 + var/static/dsay_allowed = 1 + + var/persistence_disabled = FALSE + var/persistence_ignore_mapload = FALSE + + var/allow_byond_links = 0 + var/allow_discord_links = 0 + var/allow_url_links = 0 // honestly if I were you i'd leave this one off, only use in dire situations + + var/starlight = 0 // Whether space turfs have ambient light or not + + var/static/list/ert_species = list(SPECIES_HUMAN) + + var/static/law_zero = "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'ALL LAWS OVERRIDDEN#*?&110010" + + var/static/aggressive_changelog = 0 + + var/static/list/language_prefixes = list(",","#")//Default language prefixes + + var/static/show_human_death_message = 1 + + var/static/radiation_resistance_calc_mode = RAD_RESIST_CALC_SUB // 0:1 subtraction:division for computing effective radiation on a turf + var/static/radiation_decay_rate = 1 //How much radiation is reduced by each tick + var/static/radiation_resistance_multiplier = 8.5 //VOREstation edit + var/static/radiation_material_resistance_divisor = 1 + var/static/radiation_lower_limit = 0.35 //If the radiation level for a turf would be below this, ignore it. + + var/static/random_submap_orientation = FALSE // If true, submaps loaded automatically can be rotated. + var/static/autostart_solars = FALSE // If true, specifically mapped in solar control computers will set themselves up when the round starts. + + // New shiny SQLite stuff. + // The basics. + var/static/sqlite_enabled = FALSE // If it should even be active. SQLite can be ran alongside other databases but you should not have them do the same functions. + + // In-Game Feedback. + var/static/sqlite_feedback = FALSE // Feedback cannot be submitted if this is false. + var/static/list/sqlite_feedback_topics = list("General") // A list of 'topics' that feedback can be catagorized under by the submitter. + var/static/sqlite_feedback_privacy = FALSE // If true, feedback submitted can have its author name be obfuscated. This is not 100% foolproof (it's md5 ffs) but can stop casual snooping. + var/static/sqlite_feedback_cooldown = 0 // How long one must wait, in days, to submit another feedback form. Used to help prevent spam, especially with privacy active. 0 = No limit. + var/static/sqlite_feedback_min_age = 0 // Used to block new people from giving feedback. This metric is very bad but it can help slow down spammers. + + var/static/defib_timer = 10 // How long until someone can't be defibbed anymore, in minutes. + var/static/defib_braindamage_timer = 2 // How long until someone will get brain damage when defibbed, in minutes. The closer to the end of the above timer, the more brain damage they get. + + // disables the annoying "You have already logged in this round, disconnect or be banned" popup for multikeying, because it annoys the shit out of me when testing. + var/static/disable_cid_warn_popup = FALSE + + // whether or not to use the nightshift subsystem to perform lighting changes + var/static/enable_night_shifts = FALSE + + // How strictly the loadout enforces object species whitelists + var/loadout_whitelist = LOADOUT_WHITELIST_LAX + + var/static/vgs_access_identifier = null // VOREStation Edit - VGS + var/static/vgs_server_port = null // VOREStation Edit - VGS + + var/disable_webhook_embeds = FALSE + + var/static/list/jukebox_track_files + +/datum/configuration/New() + var/list/L = typesof(/datum/game_mode) - /datum/game_mode + for (var/T in L) + // I wish I didn't have to instance the game modes in order to look up + // their information, but it is the only way (at least that I know of). + var/datum/game_mode/M = new T() + if (M.config_tag) + gamemode_cache[M.config_tag] = M // So we don't instantiate them repeatedly. + if(!(M.config_tag in modes)) // ensure each mode is added only once + log_misc("Adding game mode [M.name] ([M.config_tag]) to configuration.") + modes += M.config_tag + mode_names[M.config_tag] = M.name + probabilities[M.config_tag] = M.probability + player_requirements[M.config_tag] = M.required_players + player_requirements_secret[M.config_tag] = M.required_players_secret + if (M.votable) + src.votable_modes += M.config_tag + src.votable_modes += "secret" + +/datum/configuration/proc/load(filename, type = "config") //the type can also be game_options, in which case it uses a different switch. not making it separate to not copypaste code - Urist + var/list/Lines = file2list(filename) + + for(var/t in Lines) + if(!t) continue + + t = trim(t) + if (length(t) == 0) + continue + else if (copytext(t, 1, 2) == "#") + continue + + var/pos = findtext(t, " ") + var/name = null + var/value = null + + if (pos) + name = lowertext(copytext(t, 1, pos)) + value = copytext(t, pos + 1) + else + name = lowertext(t) + + if (!name) + continue + + if(type == "config") + switch (name) + if ("resource_urls") + config.resource_urls = splittext(value, " ") + + if ("admin_legacy_system") + config.admin_legacy_system = 1 + + if ("ban_legacy_system") + config.ban_legacy_system = 1 + + if ("use_age_restriction_for_jobs") + config.use_age_restriction_for_jobs = 1 + + if ("use_age_restriction_for_antags") + config.use_age_restriction_for_antags = 1 + + if ("jobs_have_minimal_access") + config.jobs_have_minimal_access = 1 + + if ("use_recursive_explosions") + use_recursive_explosions = 1 + + if ("multi_z_explosion_scalar") + multi_z_explosion_scalar = text2num(value) + + if ("log_ooc") + config.log_ooc = 1 + + if ("log_access") + config.log_access = 1 + + if ("sql_enabled") + config.sql_enabled = 1 + + if ("log_say") + config.log_say = 1 + + if ("debug_paranoid") + config.debugparanoid = 1 + + if ("log_admin") + config.log_admin = 1 + + if ("log_debug") + config.log_debug = text2num(value) + + if ("log_game") + config.log_game = 1 + + if ("log_vote") + config.log_vote = 1 + + if ("log_whisper") + config.log_whisper = 1 + + if ("log_attack") + config.log_attack = 1 + + if ("log_emote") + config.log_emote = 1 + + if ("log_adminchat") + config.log_adminchat = 1 + + if ("log_adminwarn") + config.log_adminwarn = 1 + + if ("log_pda") + config.log_pda = 1 + + if ("log_world_output") + config.log_world_output = 1 + + if ("log_hrefs") + config.log_hrefs = 1 + + if ("log_runtime") + config.log_runtime = 1 + + if ("log_graffiti") + config.log_graffiti = 1 + + if ("generate_map") + config.generate_map = 1 + + if ("no_click_cooldown") + config.no_click_cooldown = 1 + + if("allow_admin_ooccolor") + config.allow_admin_ooccolor = 1 + + if ("allow_vote_restart") + config.allow_vote_restart = 1 + + if ("allow_vote_mode") + config.allow_vote_mode = 1 + + if ("allow_admin_jump") + config.allow_admin_jump = 1 + + if("allow_admin_rev") + config.allow_admin_rev = 1 + + if ("allow_admin_spawning") + config.allow_admin_spawning = 1 + + if ("allow_byond_links") + allow_byond_links = 1 + + if ("allow_discord_links") + allow_discord_links = 1 + + if ("allow_url_links") + allow_url_links = 1 + + if ("no_dead_vote") + config.vote_no_dead = 1 + + if ("default_no_vote") + config.vote_no_default = 1 + + if ("pregame_time") + config.pregame_time = text2num(value) + + if ("vote_delay") + config.vote_delay = text2num(value) + + if ("vote_period") + config.vote_period = text2num(value) + + if ("vote_autotransfer_initial") + config.vote_autotransfer_initial = text2num(value) + + if ("vote_autotransfer_interval") + config.vote_autotransfer_interval = text2num(value) + + if ("vote_autogamemode_timeleft") + config.vote_autogamemode_timeleft = text2num(value) + + if("ert_admin_only") + config.ert_admin_call_only = 1 + + if ("allow_ai") + config.allow_ai = 1 + + if ("allow_ai_shells") + config.allow_ai_shells = TRUE + + if("give_free_ai_shell") + config.give_free_ai_shell = TRUE + +// if ("authentication") +// config.enable_authentication = 1 + + if ("norespawn") + config.respawn = 0 + + if ("respawn_time") + var/raw_minutes = text2num(value) + config.respawn_time = raw_minutes MINUTES + + if ("respawn_message") + config.respawn_message = "[value]" + + if ("servername") + config.server_name = value + + if ("serversuffix") + config.server_suffix = 1 + + if ("nudge_script_path") + config.nudge_script_path = value + + if ("hostedby") + config.hostedby = value + + if ("serverurl") + config.serverurl = value + + if ("server") + config.server = value + + if ("banappeals") + config.banappeals = value + + if ("wikiurl") + config.wikiurl = value + + if ("wikisearchurl") + config.wikisearchurl = value + + if ("forumurl") + config.forumurl = value + + if ("rulesurl") + config.rulesurl = value + + if ("mapurl") + config.mapurl = value + + if ("githuburl") + config.githuburl = value + + if ("discordurl") + config.discordurl = value + + if ("guest_jobban") + config.guest_jobban = 1 + + if ("guest_ban") + config.guests_allowed = 0 + + if ("disable_ooc") + config.ooc_allowed = 0 + config.looc_allowed = 0 + + if ("disable_entry") + config.enter_allowed = 0 + + if ("disable_dead_ooc") + config.dooc_allowed = 0 + + if ("disable_dsay") + config.dsay_allowed = 0 + + if ("disable_respawn") + config.abandon_allowed = 0 + + if ("usewhitelist") + config.usewhitelist = 1 + + if ("feature_object_spell_system") + config.feature_object_spell_system = 1 + + if ("allow_metadata") + config.allow_Metadata = 1 + + if ("traitor_scaling") + config.traitor_scaling = 1 + + if ("aliens_allowed") + config.aliens_allowed = 1 + + if ("ninjas_allowed") + config.ninjas_allowed = 1 + + if ("objectives_disabled") + config.objectives_disabled = 1 + + if("protect_roles_from_antagonist") + config.protect_roles_from_antagonist = 1 + + if("persistence_disabled") + config.persistence_disabled = TRUE // Previously this forcibly set persistence enabled in the saves. + + if("persistence_ignore_mapload") + config.persistence_ignore_mapload = TRUE + + if ("probability") + var/prob_pos = findtext(value, " ") + var/prob_name = null + var/prob_value = null + + if (prob_pos) + prob_name = lowertext(copytext(value, 1, prob_pos)) + prob_value = copytext(value, prob_pos + 1) + if (prob_name in config.modes) + config.probabilities[prob_name] = text2num(prob_value) + else + log_misc("Unknown game mode probability configuration definition: [prob_name].") + else + log_misc("Incorrect probability configuration definition: [prob_name] [prob_value].") + + if ("required_players", "required_players_secret") + var/req_pos = findtext(value, " ") + var/req_name = null + var/req_value = null + var/is_secret_override = findtext(name, "required_players_secret") // Being extra sure we're not picking up an override for Secret by accident. + + if(req_pos) + req_name = lowertext(copytext(value, 1, req_pos)) + req_value = copytext(value, req_pos + 1) + if(req_name in config.modes) + if(is_secret_override) + config.player_requirements_secret[req_name] = text2num(req_value) + else + config.player_requirements[req_name] = text2num(req_value) + else + log_misc("Unknown game mode player requirement configuration definition: [req_name].") + else + log_misc("Incorrect player requirement configuration definition: [req_name] [req_value].") + + if("allow_random_events") + config.allow_random_events = 1 + + if("enable_game_master") + config.enable_game_master = 1 + + if("kick_inactive") + config.kick_inactive = text2num(value) + + if("show_mods") + config.show_mods = 1 + + if("show_devs") + config.show_devs = 1 + + if("show_event_managers") + config.show_event_managers = 1 + + if("mods_can_tempban") + config.mods_can_tempban = 1 + + if("mods_can_job_tempban") + config.mods_can_job_tempban = 1 + + if("mod_tempban_max") + config.mod_tempban_max = text2num(value) + + if("mod_job_tempban_max") + config.mod_job_tempban_max = text2num(value) + + if("load_jobs_from_txt") + load_jobs_from_txt = 1 + + if("alert_red_upto") + config.alert_desc_red_upto = value + + if("alert_red_downto") + config.alert_desc_red_downto = value + + if("alert_blue_downto") + config.alert_desc_blue_downto = value + + if("alert_blue_upto") + config.alert_desc_blue_upto = value + + if("alert_green") + config.alert_desc_green = value + + if("alert_delta") + config.alert_desc_delta = value + + if("forbid_singulo_possession") + forbid_singulo_possession = 1 + + if("popup_admin_pm") + config.popup_admin_pm = 1 + + if("allow_holidays") + Holiday = 1 + + if("use_irc_bot") + use_irc_bot = 1 + + if("use_node_bot") + use_node_bot = 1 + + if("irc_bot_port") + config.irc_bot_port = value + + if("irc_bot_export") + irc_bot_export = 1 + + if("ticklag") + var/ticklag = text2num(value) + if(ticklag > 0) + fps = 10 / ticklag + + if("tick_limit_mc_init") + tick_limit_mc_init = text2num(value) + + if("allow_antag_hud") + config.antag_hud_allowed = 1 + if("antag_hud_restricted") + config.antag_hud_restricted = 1 + + if("socket_talk") + socket_talk = text2num(value) + + if("tickcomp") + Tickcomp = 1 + + if("humans_need_surnames") + humans_need_surnames = 1 + + if("tor_ban") + ToRban = 1 + + if("automute_on") + automute_on = 1 + + if("usealienwhitelist") + usealienwhitelist = 1 + + if("alien_player_ratio") + limitalienplayers = 1 + alien_to_human_ratio = text2num(value) + + if("assistant_maint") + config.assistant_maint = 1 + + if("gateway_delay") + config.gateway_delay = text2num(value) + + if("continuous_rounds") + config.continous_rounds = 1 + + if("ghost_interaction") + config.ghost_interaction = 1 + + if("disable_player_mice") + config.disable_player_mice = 1 + + if("uneducated_mice") + config.uneducated_mice = 1 + + if("comms_password") + config.comms_password = value + + if("irc_bot_host") + config.irc_bot_host = value + + if("main_irc") + config.main_irc = value + + if("admin_irc") + config.admin_irc = value + + if("python_path") + if(value) + config.python_path = value + + if("use_lib_nudge") + config.use_lib_nudge = 1 + + if("allow_cult_ghostwriter") + config.cult_ghostwriter = 1 + + if("req_cult_ghostwriter") + config.cult_ghostwriter_req_cultists = text2num(value) + + if("character_slots") + config.character_slots = text2num(value) + + if("loadout_slots") + config.loadout_slots = text2num(value) + + if("allow_drone_spawn") + config.allow_drone_spawn = text2num(value) + + if("drone_build_time") + config.drone_build_time = text2num(value) + + if("max_maint_drones") + config.max_maint_drones = text2num(value) + + if("use_overmap") + config.use_overmap = 1 + + if("engine_map") + config.engine_map = splittext(value, ",") +/* + if("station_levels") + using_map.station_levels = text2numlist(value, ";") + + if("admin_levels") + using_map.admin_levels = text2numlist(value, ";") + + if("contact_levels") + using_map.contact_levels = text2numlist(value, ";") + + if("player_levels") + using_map.player_levels = text2numlist(value, ";") +*/ + if("expected_round_length") + config.expected_round_length = MinutesToTicks(text2num(value)) + + if("disable_welder_vision") + config.welder_vision = 0 + + if("allow_extra_antags") + config.allow_extra_antags = 1 + + if("event_custom_start_mundane") + var/values = text2numlist(value, ";") + config.event_first_run[EVENT_LEVEL_MUNDANE] = list("lower" = MinutesToTicks(values[1]), "upper" = MinutesToTicks(values[2])) + + if("event_custom_start_moderate") + var/values = text2numlist(value, ";") + config.event_first_run[EVENT_LEVEL_MODERATE] = list("lower" = MinutesToTicks(values[1]), "upper" = MinutesToTicks(values[2])) + + if("event_custom_start_major") + var/values = text2numlist(value, ";") + config.event_first_run[EVENT_LEVEL_MAJOR] = list("lower" = MinutesToTicks(values[1]), "upper" = MinutesToTicks(values[2])) + + if("event_delay_lower") + var/values = text2numlist(value, ";") + config.event_delay_lower[EVENT_LEVEL_MUNDANE] = MinutesToTicks(values[1]) + config.event_delay_lower[EVENT_LEVEL_MODERATE] = MinutesToTicks(values[2]) + config.event_delay_lower[EVENT_LEVEL_MAJOR] = MinutesToTicks(values[3]) + + if("event_delay_upper") + var/values = text2numlist(value, ";") + config.event_delay_upper[EVENT_LEVEL_MUNDANE] = MinutesToTicks(values[1]) + config.event_delay_upper[EVENT_LEVEL_MODERATE] = MinutesToTicks(values[2]) + config.event_delay_upper[EVENT_LEVEL_MAJOR] = MinutesToTicks(values[3]) + + if("starlight") + value = text2num(value) + config.starlight = value >= 0 ? value : 0 + + if("ert_species") + config.ert_species = splittext(value, ";") + if(!config.ert_species.len) + config.ert_species += SPECIES_HUMAN + + if("law_zero") + law_zero = value + + if("aggressive_changelog") + config.aggressive_changelog = 1 + + if("default_language_prefixes") + var/list/values = splittext(value, " ") + if(values.len > 0) + language_prefixes = values + + if("radiation_lower_limit") + radiation_lower_limit = text2num(value) + + if("radiation_resistance_calc_divide") + radiation_resistance_calc_mode = RAD_RESIST_CALC_DIV + + if("radiation_resistance_calc_subtract") + radiation_resistance_calc_mode = RAD_RESIST_CALC_SUB + + if("radiation_resistance_multiplier") + radiation_resistance_multiplier = text2num(value) + + if("radiation_material_resistance_divisor") + radiation_material_resistance_divisor = text2num(value) + + if("radiation_decay_rate") + radiation_decay_rate = text2num(value) + + if ("panic_bunker") + config.panic_bunker = 1 + + if ("paranoia_logging") + config.paranoia_logging = 1 + + if("ip_reputation") + config.ip_reputation = 1 + + if("ipr_email") + config.ipr_email = value + + if("ipr_block_bad_ips") + config.ipr_block_bad_ips = 1 + + if("ipr_bad_score") + config.ipr_bad_score = text2num(value) + + if("ipr_allow_existing") + config.ipr_allow_existing = 1 + + if("ipr_minimum_age") + config.ipr_minimum_age = text2num(value) + + if("random_submap_orientation") + config.random_submap_orientation = 1 + + if("autostart_solars") + config.autostart_solars = TRUE + + if("sqlite_enabled") + config.sqlite_enabled = TRUE + + if("sqlite_feedback") + config.sqlite_feedback = TRUE + + if("sqlite_feedback_topics") + config.sqlite_feedback_topics = splittext(value, ";") + if(!config.sqlite_feedback_topics.len) + config.sqlite_feedback_topics += "General" + + if("sqlite_feedback_privacy") + config.sqlite_feedback_privacy = TRUE + + if("sqlite_feedback_cooldown") + config.sqlite_feedback_cooldown = text2num(value) + + if("defib_timer") + config.defib_timer = text2num(value) + + if("defib_braindamage_timer") + config.defib_braindamage_timer = text2num(value) + + if("disable_cid_warn_popup") + config.disable_cid_warn_popup = TRUE + + if("enable_night_shifts") + config.enable_night_shifts = TRUE + + if("jukebox_track_files") + config.jukebox_track_files = splittext(value, ";") + + // VOREStation Edit Start - Can't be in _vr file because it is loaded too late. + if("vgs_access_identifier") + config.vgs_access_identifier = value + if("vgs_server_port") + config.vgs_server_port = text2num(value) + // VOREStation Edit End + + else + log_misc("Unknown setting in configuration: '[name]'") + + else if(type == "game_options") + if(!value) + log_misc("Unknown value for setting [name] in [filename].") + value = text2num(value) + + switch(name) + if("health_threshold_crit") + config.health_threshold_crit = value + if("health_threshold_softcrit") + config.health_threshold_softcrit = value + if("health_threshold_dead") + config.health_threshold_dead = value + if("show_human_death_message") + config.show_human_death_message = 1 + if("revival_pod_plants") + config.revival_pod_plants = value + if("revival_cloning") + config.revival_cloning = value + if("revival_brain_life") + config.revival_brain_life = value + if("organ_health_multiplier") + config.organ_health_multiplier = value / 100 + if("organ_regeneration_multiplier") + config.organ_regeneration_multiplier = value / 100 + if("organ_damage_spillover_multiplier") + config.organ_damage_spillover_multiplier = value / 100 + if("organs_can_decay") + config.organs_decay = 1 + if("default_brain_health") + config.default_brain_health = text2num(value) + if(!config.default_brain_health || config.default_brain_health < 1) + config.default_brain_health = initial(config.default_brain_health) + if("bones_can_break") + config.bones_can_break = value + if("limbs_can_break") + config.limbs_can_break = value + if("allow_headgibs") + config.allow_headgibs = TRUE + + if("run_speed") + config.run_speed = value + if("walk_speed") + config.walk_speed = value + + if("human_delay") + config.human_delay = value + if("robot_delay") + config.robot_delay = value + if("monkey_delay") + config.monkey_delay = value + if("alien_delay") + config.alien_delay = value + if("slime_delay") + config.slime_delay = value + if("animal_delay") + config.animal_delay = value + + if("footstep_volume") + config.footstep_volume = text2num(value) + + if("use_loyalty_implants") + config.use_loyalty_implants = 1 + + if("loadout_whitelist") + config.loadout_whitelist = text2num(value) + + else + log_misc("Unknown setting in configuration: '[name]'") + +/datum/configuration/proc/loadsql(filename) // -- TLE + var/list/Lines = file2list(filename) + for(var/t in Lines) + if(!t) continue + + t = trim(t) + if (length(t) == 0) + continue + else if (copytext(t, 1, 2) == "#") + continue + + var/pos = findtext(t, " ") + var/name = null + var/value = null + + if (pos) + name = lowertext(copytext(t, 1, pos)) + value = copytext(t, pos + 1) + else + name = lowertext(t) + + if (!name) + continue + + switch (name) + if ("address") + sqladdress = value + if ("port") + sqlport = value + if ("database") + sqldb = value + if ("login") + sqllogin = value + if ("password") + sqlpass = value + if ("feedback_database") + sqlfdbkdb = value + if ("feedback_login") + sqlfdbklogin = value + if ("feedback_password") + sqlfdbkpass = value + if ("enable_stat_tracking") + sqllogging = 1 + else + log_misc("Unknown setting in configuration: '[name]'") + +/datum/configuration/proc/loadforumsql(filename) // -- TLE + var/list/Lines = file2list(filename) + for(var/t in Lines) + if(!t) continue + + t = trim(t) + if (length(t) == 0) + continue + else if (copytext(t, 1, 2) == "#") + continue + + var/pos = findtext(t, " ") + var/name = null + var/value = null + + if (pos) + name = lowertext(copytext(t, 1, pos)) + value = copytext(t, pos + 1) + else + name = lowertext(t) + + if (!name) + continue + + switch (name) + if ("address") + forumsqladdress = value + if ("port") + forumsqlport = value + if ("database") + forumsqldb = value + if ("login") + forumsqllogin = value + if ("password") + forumsqlpass = value + if ("activatedgroup") + forum_activated_group = value + if ("authenticatedgroup") + forum_authenticated_group = value + else + log_misc("Unknown setting in configuration: '[name]'") + +/datum/configuration/proc/pick_mode(mode_name) + // I wish I didn't have to instance the game modes in order to look up + // their information, but it is the only way (at least that I know of). + for (var/game_mode in gamemode_cache) + var/datum/game_mode/M = gamemode_cache[game_mode] + if (M.config_tag && M.config_tag == mode_name) + return M + return gamemode_cache["extended"] + +/datum/configuration/proc/get_runnable_modes() + var/list/runnable_modes = list() + for(var/game_mode in gamemode_cache) + var/datum/game_mode/M = gamemode_cache[game_mode] + if(M && M.can_start() && !isnull(config.probabilities[M.config_tag]) && config.probabilities[M.config_tag] > 0) + runnable_modes |= M + return runnable_modes + +/datum/configuration/proc/post_load() + //apply a default value to config.python_path, if needed + if (!config.python_path) + if(world.system_type == UNIX) + config.python_path = "/usr/bin/env python2" + else //probably windows, if not this should work anyway + config.python_path = "python" +======= +var/list/gamemode_cache = list() + +/datum/configuration + var/static/server_name = null // server name (for world name / status) + var/static/server_suffix = 0 // generate numeric suffix based on server port + + var/static/nudge_script_path = "nudge.py" // where the nudge.py script is located + + var/static/log_ooc = 0 // log OOC channel + var/static/log_access = 0 // log login/logout + var/static/log_say = 0 // log client say + var/static/log_admin = 0 // log admin actions + var/static/log_debug = 1 // log debug output + var/static/log_game = 0 // log game events + var/static/log_vote = 0 // log voting + var/static/log_whisper = 0 // log client whisper + var/static/log_emote = 0 // log emotes + var/static/log_attack = 0 // log attack messages + var/static/log_adminchat = 0 // log admin chat messages + var/static/log_adminwarn = 0 // log warnings admins get about bomb construction and such + var/static/log_pda = 0 // log pda messages + var/static/log_hrefs = 0 // logs all links clicked in-game. Could be used for debugging and tracking down exploits + var/static/log_runtime = 0 // logs world.log to a file + var/static/log_world_output = 0 // log to_world_log(messages) + var/static/log_graffiti = 0 // logs graffiti + var/static/sql_enabled = 0 // for sql switching + var/static/allow_admin_ooccolor = 0 // Allows admins with relevant permissions to have their own ooc colour + var/static/allow_vote_restart = 0 // allow votes to restart + var/static/ert_admin_call_only = 0 + var/static/allow_vote_mode = 0 // allow votes to change mode + var/static/allow_admin_jump = 1 // allows admin jumping + var/static/allow_admin_spawning = 1 // allows admin item spawning + var/static/allow_admin_rev = 1 // allows admin revives + var/static/pregame_time = 180 // pregame time in seconds + var/static/vote_delay = 6000 // minimum time between voting sessions (deciseconds, 10 minute default) + var/static/vote_period = 600 // length of voting period (deciseconds, default 1 minute) + var/static/vote_autotransfer_initial = 108000 // Length of time before the first autotransfer vote is called + var/static/vote_autotransfer_interval = 36000 // length of time before next sequential autotransfer vote + var/static/vote_autogamemode_timeleft = 100 //Length of time before round start when autogamemode vote is called (in seconds, default 100). + var/static/vote_no_default = 0 // vote does not default to nochange/norestart (tbi) + var/static/vote_no_dead = 0 // dead people can't vote (tbi) +// var/static/enable_authentication = 0 // goon authentication + var/static/del_new_on_log = 1 // del's new players if they log before they spawn in + var/static/feature_object_spell_system = 0 //spawns a spellbook which gives object-type spells instead of verb-type spells for the wizard + var/static/traitor_scaling = 0 //if amount of traitors scales based on amount of players + var/static/objectives_disabled = 0 //if objectives are disabled or not + var/static/protect_roles_from_antagonist = 0// If security and such can be traitor/cult/other + var/static/continous_rounds = 0 // Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke. + var/static/allow_Metadata = 0 // Metadata is supported. + var/static/popup_admin_pm = 0 //adminPMs to non-admins show in a pop-up 'reply' window when set to 1. + var/static/fps = 20 + var/static/tick_limit_mc_init = TICK_LIMIT_MC_INIT_DEFAULT //SSinitialization throttling + var/static/Tickcomp = 0 + var/static/socket_talk = 0 // use socket_talk to communicate with other processes + var/static/list/resource_urls = null + var/static/antag_hud_allowed = 0 // Ghosts can turn on Antagovision to see a HUD of who is the bad guys this round. + var/static/antag_hud_restricted = 0 // Ghosts that turn on Antagovision cannot rejoin the round. + var/static/list/mode_names = list() + var/static/list/modes = list() // allowed modes + var/static/list/votable_modes = list() // votable modes + var/static/list/probabilities = list() // relative probability of each mode + var/static/list/player_requirements = list() // Overrides for how many players readied up a gamemode needs to start. + var/static/list/player_requirements_secret = list() // Same as above, but for the secret gamemode. + var/static/humans_need_surnames = 0 + var/static/allow_random_events = 0 // enables random events mid-round when set to 1 + var/static/enable_game_master = 0 // enables the 'smart' event system. + var/static/allow_ai = 1 // allow ai job + var/static/allow_ai_shells = FALSE // allow AIs to enter and leave special borg shells at will, and for those shells to be buildable. + var/static/give_free_ai_shell = FALSE // allows a specific spawner object to instantiate a premade AI Shell + var/static/hostedby = null + + var/static/respawn = 1 + var/static/respawn_time = 3000 // time before a dead player is allowed to respawn (in ds, though the config file asks for minutes, and it's converted below) + var/static/respawn_message = "Make sure to play a different character, and please roleplay correctly!" + + var/static/guest_jobban = 1 + var/static/usewhitelist = 0 + var/static/kick_inactive = 0 //force disconnect for inactive players after this many minutes, if non-0 + var/static/show_mods = 0 + var/static/show_devs = 0 + var/static/show_event_managers = 0 + var/static/mods_can_tempban = 0 + var/static/mods_can_job_tempban = 0 + var/static/mod_tempban_max = 1440 + var/static/mod_job_tempban_max = 1440 + var/static/load_jobs_from_txt = 0 + var/static/ToRban = 0 + var/static/automute_on = 0 //enables automuting/spam prevention + var/static/jobs_have_minimal_access = 0 //determines whether jobs use minimal access or expanded access. + + var/static/cult_ghostwriter = 1 //Allows ghosts to write in blood in cult rounds... + var/static/cult_ghostwriter_req_cultists = 10 //...so long as this many cultists are active. + + var/static/character_slots = 10 // The number of available character slots + var/static/loadout_slots = 3 // The number of loadout slots per character + + var/static/max_maint_drones = 5 //This many drones can spawn, + var/static/allow_drone_spawn = 1 //assuming the admin allow them to. + var/static/drone_build_time = 1200 //A drone will become available every X ticks since last drone spawn. Default is 2 minutes. + + var/static/disable_player_mice = 0 + var/static/uneducated_mice = 0 //Set to 1 to prevent newly-spawned mice from understanding human speech + + var/static/usealienwhitelist = 0 + var/static/limitalienplayers = 0 + var/static/alien_to_human_ratio = 0.5 + var/static/allow_extra_antags = 0 + var/static/guests_allowed = 1 + var/static/debugparanoid = 0 + var/static/panic_bunker = 0 + var/static/paranoia_logging = 0 + + var/static/ip_reputation = FALSE //Should we query IPs to get scores? Generates HTTP traffic to an API service. + var/static/ipr_email //Left null because you MUST specify one otherwise you're making the internet worse. + var/static/ipr_block_bad_ips = FALSE //Should we block anyone who meets the minimum score below? Otherwise we just log it (If paranoia logging is on, visibly in chat). + var/static/ipr_bad_score = 1 //The API returns a value between 0 and 1 (inclusive), with 1 being 'definitely VPN/Tor/Proxy'. Values equal/above this var are considered bad. + var/static/ipr_allow_existing = FALSE //Should we allow known players to use VPNs/Proxies? If the player is already banned then obviously they still can't connect. + var/static/ipr_minimum_age = 5 //How many days before a player is considered 'fine' for the purposes of allowing them to use VPNs. + + var/static/serverurl + var/static/server + var/static/banappeals + var/static/wikiurl + var/static/wikisearchurl + var/static/forumurl + var/static/githuburl + var/static/discordurl + var/static/rulesurl + var/static/mapurl + + //Alert level description + var/static/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced." + var/static/alert_desc_yellow_upto = "A minor security emergency has developed. Security personnel are to report to their supervisor for orders and may have weapons visible on their person. Privacy laws are still enforced." + var/static/alert_desc_yellow_downto = "Code yellow procedures are now in effect. Security personnel are to report to their supervisor for orders and may have weapons visible on their person. Privacy laws are still enforced." + var/static/alert_desc_violet_upto = "A major medical emergency has developed. Medical personnel are required to report to their supervisor for orders, and non-medical personnel are required to obey all relevant instructions from medical staff." + var/static/alert_desc_violet_downto = "Code violet procedures are now in effect; Medical personnel are required to report to their supervisor for orders, and non-medical personnel are required to obey relevant instructions from medical staff." + var/static/alert_desc_orange_upto = "A major engineering emergency has developed. Engineering personnel are required to report to their supervisor for orders, and non-engineering personnel are required to evacuate any affected areas and obey relevant instructions from engineering staff." + var/static/alert_desc_orange_downto = "Code orange procedures are now in effect; Engineering personnel are required to report to their supervisor for orders, and non-engineering personnel are required to evacuate any affected areas and obey relevant instructions from engineering staff." + var/static/alert_desc_blue_upto = "A major security emergency has developed. Security personnel are to report to their supervisor for orders, are permitted to search staff and facilities, and may have weapons visible on their person." + var/static/alert_desc_blue_downto = "Code blue procedures are now in effect. Security personnel are to report to their supervisor for orders, are permitted to search staff and facilities, and may have weapons visible on their person." + var/static/alert_desc_red_upto = "There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised." + var/static/alert_desc_red_downto = "The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised." + var/static/alert_desc_delta = "The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill." + + var/static/forbid_singulo_possession = 0 + + //game_options.txt configs + + var/static/health_threshold_softcrit = 0 + var/static/health_threshold_crit = 0 + var/static/health_threshold_dead = -100 + + var/static/organ_health_multiplier = 1 + var/static/organ_regeneration_multiplier = 1 + var/static/organs_decay + var/static/default_brain_health = 400 + var/static/allow_headgibs = FALSE + + //Paincrit knocks someone down once they hit 60 shock_stage, so by default make it so that close to 100 additional damage needs to be dealt, + //so that it's similar to HALLOSS. Lowered it a bit since hitting paincrit takes much longer to wear off than a halloss stun. + var/static/organ_damage_spillover_multiplier = 0.5 + + var/static/bones_can_break = 0 + var/static/limbs_can_break = 0 + + var/static/revival_pod_plants = 1 + var/static/revival_cloning = 1 + var/static/revival_brain_life = -1 + + var/static/use_loyalty_implants = 0 + + var/static/welder_vision = 1 + var/static/generate_map = 0 + var/static/no_click_cooldown = 0 + + //Used for modifying movement speed for mobs. + //Unversal modifiers + var/static/run_speed = 0 + var/static/walk_speed = 0 + + //Mob specific modifiers. NOTE: These will affect different mob types in different ways + var/static/human_delay = 0 + var/static/robot_delay = 0 + var/static/monkey_delay = 0 + var/static/alien_delay = 0 + var/static/slime_delay = 0 + var/static/animal_delay = 0 + + var/static/footstep_volume = 0 + + var/static/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt + var/static/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt + var/static/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database + var/static/use_age_restriction_for_antags = 0 //Do antags use account age restrictions? --requires database + + var/static/simultaneous_pm_warning_timeout = 100 + + var/static/use_recursive_explosions //Defines whether the server uses recursive or circular explosions. + var/static/multi_z_explosion_scalar = 0.5 //Multiplier for how much weaker explosions are on neighboring z levels. + + var/static/assistant_maint = 0 //Do assistants get maint access? + var/static/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour. + var/static/ghost_interaction = 0 + + var/static/comms_password = "" + + var/static/enter_allowed = 1 + + var/use_irc_bot = 0 + var/use_node_bot = 0 + var/irc_bot_port = 0 + var/irc_bot_host = "" + var/irc_bot_export = 0 // whether the IRC bot in use is a Bot32 (or similar) instance; Bot32 uses world.Export() instead of nudge.py/libnudge + var/main_irc = "" + var/admin_irc = "" + var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix + var/use_lib_nudge = 0 //Use the C library nudge instead of the python nudge. + var/use_overmap = 0 + + var/static/list/engine_map = list("Supermatter Engine", "Edison's Bane") // Comma separated list of engines to choose from. Blank means fully random. + + // Event settings + var/static/expected_round_length = 3 * 60 * 60 * 10 // 3 hours + // If the first delay has a custom start time + // No custom time, no custom time, between 80 to 100 minutes respectively. + var/static/list/event_first_run = list(EVENT_LEVEL_MUNDANE = null, EVENT_LEVEL_MODERATE = null, EVENT_LEVEL_MAJOR = list("lower" = 48000, "upper" = 60000)) + // The lowest delay until next event + // 10, 30, 50 minutes respectively + var/static/list/event_delay_lower = list(EVENT_LEVEL_MUNDANE = 6000, EVENT_LEVEL_MODERATE = 18000, EVENT_LEVEL_MAJOR = 30000) + // The upper delay until next event + // 15, 45, 70 minutes respectively + var/static/list/event_delay_upper = list(EVENT_LEVEL_MUNDANE = 9000, EVENT_LEVEL_MODERATE = 27000, EVENT_LEVEL_MAJOR = 42000) + + var/static/aliens_allowed = 1 //Changed to 1 so player xenos can lay eggs. + var/static/ninjas_allowed = 0 + var/static/abandon_allowed = 1 + var/static/ooc_allowed = 1 + var/static/looc_allowed = 1 + var/static/dooc_allowed = 1 + var/static/dsay_allowed = 1 + + var/persistence_disabled = FALSE + var/persistence_ignore_mapload = FALSE + + var/allow_byond_links = 0 + var/allow_discord_links = 0 + var/allow_url_links = 0 // honestly if I were you i'd leave this one off, only use in dire situations + + var/starlight = 0 // Whether space turfs have ambient light or not + + var/static/list/ert_species = list(SPECIES_HUMAN) + + var/static/law_zero = "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'ALL LAWS OVERRIDDEN#*?&110010" + + var/static/aggressive_changelog = 0 + + var/static/list/language_prefixes = list(",","#")//Default language prefixes + + var/static/show_human_death_message = 1 + + var/static/radiation_resistance_calc_mode = RAD_RESIST_CALC_SUB // 0:1 subtraction:division for computing effective radiation on a turf + var/static/radiation_decay_rate = 1 //How much radiation is reduced by each tick + var/static/radiation_resistance_multiplier = 8.5 //VOREstation edit + var/static/radiation_material_resistance_divisor = 1 + var/static/radiation_lower_limit = 0.35 //If the radiation level for a turf would be below this, ignore it. + + var/static/random_submap_orientation = FALSE // If true, submaps loaded automatically can be rotated. + var/static/autostart_solars = FALSE // If true, specifically mapped in solar control computers will set themselves up when the round starts. + + // New shiny SQLite stuff. + // The basics. + var/static/sqlite_enabled = FALSE // If it should even be active. SQLite can be ran alongside other databases but you should not have them do the same functions. + + // In-Game Feedback. + var/static/sqlite_feedback = FALSE // Feedback cannot be submitted if this is false. + var/static/list/sqlite_feedback_topics = list("General") // A list of 'topics' that feedback can be catagorized under by the submitter. + var/static/sqlite_feedback_privacy = FALSE // If true, feedback submitted can have its author name be obfuscated. This is not 100% foolproof (it's md5 ffs) but can stop casual snooping. + var/static/sqlite_feedback_cooldown = 0 // How long one must wait, in days, to submit another feedback form. Used to help prevent spam, especially with privacy active. 0 = No limit. + var/static/sqlite_feedback_min_age = 0 // Used to block new people from giving feedback. This metric is very bad but it can help slow down spammers. + + var/static/defib_timer = 10 // How long until someone can't be defibbed anymore, in minutes. + var/static/defib_braindamage_timer = 2 // How long until someone will get brain damage when defibbed, in minutes. The closer to the end of the above timer, the more brain damage they get. + + // disables the annoying "You have already logged in this round, disconnect or be banned" popup for multikeying, because it annoys the shit out of me when testing. + var/static/disable_cid_warn_popup = FALSE + + // whether or not to use the nightshift subsystem to perform lighting changes + var/static/enable_night_shifts = FALSE + + // How strictly the loadout enforces object species whitelists + var/loadout_whitelist = LOADOUT_WHITELIST_LAX + + var/static/vgs_access_identifier = null // VOREStation Edit - VGS + var/static/vgs_server_port = null // VOREStation Edit - VGS + + var/disable_webhook_embeds = FALSE + + var/static/list/jukebox_track_files + +/datum/configuration/New() + var/list/L = subtypesof(/datum/game_mode) + for (var/T in L) + // I wish I didn't have to instance the game modes in order to look up + // their information, but it is the only way (at least that I know of). + var/datum/game_mode/M = new T() + if (M.config_tag) + gamemode_cache[M.config_tag] = M // So we don't instantiate them repeatedly. + if(!(M.config_tag in modes)) // ensure each mode is added only once + log_misc("Adding game mode [M.name] ([M.config_tag]) to configuration.") + modes += M.config_tag + mode_names[M.config_tag] = M.name + probabilities[M.config_tag] = M.probability + player_requirements[M.config_tag] = M.required_players + player_requirements_secret[M.config_tag] = M.required_players_secret + if (M.votable) + src.votable_modes += M.config_tag + src.votable_modes += "secret" + +/datum/configuration/proc/load(filename, type = "config") //the type can also be game_options, in which case it uses a different switch. not making it separate to not copypaste code - Urist + var/list/Lines = file2list(filename) + + for(var/t in Lines) + if(!t) continue + + t = trim(t) + if (length(t) == 0) + continue + else if (copytext(t, 1, 2) == "#") + continue + + var/pos = findtext(t, " ") + var/name = null + var/value = null + + if (pos) + name = lowertext(copytext(t, 1, pos)) + value = copytext(t, pos + 1) + else + name = lowertext(t) + + if (!name) + continue + + if(type == "config") + switch (name) + if ("resource_urls") + config.resource_urls = splittext(value, " ") + + if ("admin_legacy_system") + config.admin_legacy_system = 1 + + if ("ban_legacy_system") + config.ban_legacy_system = 1 + + if ("use_age_restriction_for_jobs") + config.use_age_restriction_for_jobs = 1 + + if ("use_age_restriction_for_antags") + config.use_age_restriction_for_antags = 1 + + if ("jobs_have_minimal_access") + config.jobs_have_minimal_access = 1 + + if ("use_recursive_explosions") + use_recursive_explosions = 1 + + if ("multi_z_explosion_scalar") + multi_z_explosion_scalar = text2num(value) + + if ("log_ooc") + config.log_ooc = 1 + + if ("log_access") + config.log_access = 1 + + if ("sql_enabled") + config.sql_enabled = 1 + + if ("log_say") + config.log_say = 1 + + if ("debug_paranoid") + config.debugparanoid = 1 + + if ("log_admin") + config.log_admin = 1 + + if ("log_debug") + config.log_debug = text2num(value) + + if ("log_game") + config.log_game = 1 + + if ("log_vote") + config.log_vote = 1 + + if ("log_whisper") + config.log_whisper = 1 + + if ("log_attack") + config.log_attack = 1 + + if ("log_emote") + config.log_emote = 1 + + if ("log_adminchat") + config.log_adminchat = 1 + + if ("log_adminwarn") + config.log_adminwarn = 1 + + if ("log_pda") + config.log_pda = 1 + + if ("log_world_output") + config.log_world_output = 1 + + if ("log_hrefs") + config.log_hrefs = 1 + + if ("log_runtime") + config.log_runtime = 1 + + if ("log_graffiti") + config.log_graffiti = 1 + + if ("generate_map") + config.generate_map = 1 + + if ("no_click_cooldown") + config.no_click_cooldown = 1 + + if("allow_admin_ooccolor") + config.allow_admin_ooccolor = 1 + + if ("allow_vote_restart") + config.allow_vote_restart = 1 + + if ("allow_vote_mode") + config.allow_vote_mode = 1 + + if ("allow_admin_jump") + config.allow_admin_jump = 1 + + if("allow_admin_rev") + config.allow_admin_rev = 1 + + if ("allow_admin_spawning") + config.allow_admin_spawning = 1 + + if ("allow_byond_links") + allow_byond_links = 1 + + if ("allow_discord_links") + allow_discord_links = 1 + + if ("allow_url_links") + allow_url_links = 1 + + if ("no_dead_vote") + config.vote_no_dead = 1 + + if ("default_no_vote") + config.vote_no_default = 1 + + if ("pregame_time") + config.pregame_time = text2num(value) + + if ("vote_delay") + config.vote_delay = text2num(value) + + if ("vote_period") + config.vote_period = text2num(value) + + if ("vote_autotransfer_initial") + config.vote_autotransfer_initial = text2num(value) + + if ("vote_autotransfer_interval") + config.vote_autotransfer_interval = text2num(value) + + if ("vote_autogamemode_timeleft") + config.vote_autogamemode_timeleft = text2num(value) + + if("ert_admin_only") + config.ert_admin_call_only = 1 + + if ("allow_ai") + config.allow_ai = 1 + + if ("allow_ai_shells") + config.allow_ai_shells = TRUE + + if("give_free_ai_shell") + config.give_free_ai_shell = TRUE + +// if ("authentication") +// config.enable_authentication = 1 + + if ("norespawn") + config.respawn = 0 + + if ("respawn_time") + var/raw_minutes = text2num(value) + config.respawn_time = raw_minutes MINUTES + + if ("respawn_message") + config.respawn_message = "[value]" + + if ("servername") + config.server_name = value + + if ("serversuffix") + config.server_suffix = 1 + + if ("nudge_script_path") + config.nudge_script_path = value + + if ("hostedby") + config.hostedby = value + + if ("serverurl") + config.serverurl = value + + if ("server") + config.server = value + + if ("banappeals") + config.banappeals = value + + if ("wikiurl") + config.wikiurl = value + + if ("wikisearchurl") + config.wikisearchurl = value + + if ("forumurl") + config.forumurl = value + + if ("rulesurl") + config.rulesurl = value + + if ("mapurl") + config.mapurl = value + + if ("githuburl") + config.githuburl = value + + if ("discordurl") + config.discordurl = value + + if ("guest_jobban") + config.guest_jobban = 1 + + if ("guest_ban") + config.guests_allowed = 0 + + if ("disable_ooc") + config.ooc_allowed = 0 + config.looc_allowed = 0 + + if ("disable_entry") + config.enter_allowed = 0 + + if ("disable_dead_ooc") + config.dooc_allowed = 0 + + if ("disable_dsay") + config.dsay_allowed = 0 + + if ("disable_respawn") + config.abandon_allowed = 0 + + if ("usewhitelist") + config.usewhitelist = 1 + + if ("feature_object_spell_system") + config.feature_object_spell_system = 1 + + if ("allow_metadata") + config.allow_Metadata = 1 + + if ("traitor_scaling") + config.traitor_scaling = 1 + + if ("aliens_allowed") + config.aliens_allowed = 1 + + if ("ninjas_allowed") + config.ninjas_allowed = 1 + + if ("objectives_disabled") + config.objectives_disabled = 1 + + if("protect_roles_from_antagonist") + config.protect_roles_from_antagonist = 1 + + if("persistence_disabled") + config.persistence_disabled = TRUE // Previously this forcibly set persistence enabled in the saves. + + if("persistence_ignore_mapload") + config.persistence_ignore_mapload = TRUE + + if ("probability") + var/prob_pos = findtext(value, " ") + var/prob_name = null + var/prob_value = null + + if (prob_pos) + prob_name = lowertext(copytext(value, 1, prob_pos)) + prob_value = copytext(value, prob_pos + 1) + if (prob_name in config.modes) + config.probabilities[prob_name] = text2num(prob_value) + else + log_misc("Unknown game mode probability configuration definition: [prob_name].") + else + log_misc("Incorrect probability configuration definition: [prob_name] [prob_value].") + + if ("required_players", "required_players_secret") + var/req_pos = findtext(value, " ") + var/req_name = null + var/req_value = null + var/is_secret_override = findtext(name, "required_players_secret") // Being extra sure we're not picking up an override for Secret by accident. + + if(req_pos) + req_name = lowertext(copytext(value, 1, req_pos)) + req_value = copytext(value, req_pos + 1) + if(req_name in config.modes) + if(is_secret_override) + config.player_requirements_secret[req_name] = text2num(req_value) + else + config.player_requirements[req_name] = text2num(req_value) + else + log_misc("Unknown game mode player requirement configuration definition: [req_name].") + else + log_misc("Incorrect player requirement configuration definition: [req_name] [req_value].") + + if("allow_random_events") + config.allow_random_events = 1 + + if("enable_game_master") + config.enable_game_master = 1 + + if("kick_inactive") + config.kick_inactive = text2num(value) + + if("show_mods") + config.show_mods = 1 + + if("show_devs") + config.show_devs = 1 + + if("show_event_managers") + config.show_event_managers = 1 + + if("mods_can_tempban") + config.mods_can_tempban = 1 + + if("mods_can_job_tempban") + config.mods_can_job_tempban = 1 + + if("mod_tempban_max") + config.mod_tempban_max = text2num(value) + + if("mod_job_tempban_max") + config.mod_job_tempban_max = text2num(value) + + if("load_jobs_from_txt") + load_jobs_from_txt = 1 + + if("alert_red_upto") + config.alert_desc_red_upto = value + + if("alert_red_downto") + config.alert_desc_red_downto = value + + if("alert_blue_downto") + config.alert_desc_blue_downto = value + + if("alert_blue_upto") + config.alert_desc_blue_upto = value + + if("alert_green") + config.alert_desc_green = value + + if("alert_delta") + config.alert_desc_delta = value + + if("forbid_singulo_possession") + forbid_singulo_possession = 1 + + if("popup_admin_pm") + config.popup_admin_pm = 1 + + if("allow_holidays") + Holiday = 1 + + if("use_irc_bot") + use_irc_bot = 1 + + if("use_node_bot") + use_node_bot = 1 + + if("irc_bot_port") + config.irc_bot_port = value + + if("irc_bot_export") + irc_bot_export = 1 + + if("ticklag") + var/ticklag = text2num(value) + if(ticklag > 0) + fps = 10 / ticklag + + if("tick_limit_mc_init") + tick_limit_mc_init = text2num(value) + + if("allow_antag_hud") + config.antag_hud_allowed = 1 + if("antag_hud_restricted") + config.antag_hud_restricted = 1 + + if("socket_talk") + socket_talk = text2num(value) + + if("tickcomp") + Tickcomp = 1 + + if("humans_need_surnames") + humans_need_surnames = 1 + + if("tor_ban") + ToRban = 1 + + if("automute_on") + automute_on = 1 + + if("usealienwhitelist") + usealienwhitelist = 1 + + if("alien_player_ratio") + limitalienplayers = 1 + alien_to_human_ratio = text2num(value) + + if("assistant_maint") + config.assistant_maint = 1 + + if("gateway_delay") + config.gateway_delay = text2num(value) + + if("continuous_rounds") + config.continous_rounds = 1 + + if("ghost_interaction") + config.ghost_interaction = 1 + + if("disable_player_mice") + config.disable_player_mice = 1 + + if("uneducated_mice") + config.uneducated_mice = 1 + + if("comms_password") + config.comms_password = value + + if("irc_bot_host") + config.irc_bot_host = value + + if("main_irc") + config.main_irc = value + + if("admin_irc") + config.admin_irc = value + + if("python_path") + if(value) + config.python_path = value + + if("use_lib_nudge") + config.use_lib_nudge = 1 + + if("allow_cult_ghostwriter") + config.cult_ghostwriter = 1 + + if("req_cult_ghostwriter") + config.cult_ghostwriter_req_cultists = text2num(value) + + if("character_slots") + config.character_slots = text2num(value) + + if("loadout_slots") + config.loadout_slots = text2num(value) + + if("allow_drone_spawn") + config.allow_drone_spawn = text2num(value) + + if("drone_build_time") + config.drone_build_time = text2num(value) + + if("max_maint_drones") + config.max_maint_drones = text2num(value) + + if("use_overmap") + config.use_overmap = 1 + + if("engine_map") + config.engine_map = splittext(value, ",") +/* + if("station_levels") + using_map.station_levels = text2numlist(value, ";") + + if("admin_levels") + using_map.admin_levels = text2numlist(value, ";") + + if("contact_levels") + using_map.contact_levels = text2numlist(value, ";") + + if("player_levels") + using_map.player_levels = text2numlist(value, ";") +*/ + if("expected_round_length") + config.expected_round_length = MinutesToTicks(text2num(value)) + + if("disable_welder_vision") + config.welder_vision = 0 + + if("allow_extra_antags") + config.allow_extra_antags = 1 + + if("event_custom_start_mundane") + var/values = text2numlist(value, ";") + config.event_first_run[EVENT_LEVEL_MUNDANE] = list("lower" = MinutesToTicks(values[1]), "upper" = MinutesToTicks(values[2])) + + if("event_custom_start_moderate") + var/values = text2numlist(value, ";") + config.event_first_run[EVENT_LEVEL_MODERATE] = list("lower" = MinutesToTicks(values[1]), "upper" = MinutesToTicks(values[2])) + + if("event_custom_start_major") + var/values = text2numlist(value, ";") + config.event_first_run[EVENT_LEVEL_MAJOR] = list("lower" = MinutesToTicks(values[1]), "upper" = MinutesToTicks(values[2])) + + if("event_delay_lower") + var/values = text2numlist(value, ";") + config.event_delay_lower[EVENT_LEVEL_MUNDANE] = MinutesToTicks(values[1]) + config.event_delay_lower[EVENT_LEVEL_MODERATE] = MinutesToTicks(values[2]) + config.event_delay_lower[EVENT_LEVEL_MAJOR] = MinutesToTicks(values[3]) + + if("event_delay_upper") + var/values = text2numlist(value, ";") + config.event_delay_upper[EVENT_LEVEL_MUNDANE] = MinutesToTicks(values[1]) + config.event_delay_upper[EVENT_LEVEL_MODERATE] = MinutesToTicks(values[2]) + config.event_delay_upper[EVENT_LEVEL_MAJOR] = MinutesToTicks(values[3]) + + if("starlight") + value = text2num(value) + config.starlight = value >= 0 ? value : 0 + + if("ert_species") + config.ert_species = splittext(value, ";") + if(!config.ert_species.len) + config.ert_species += SPECIES_HUMAN + + if("law_zero") + law_zero = value + + if("aggressive_changelog") + config.aggressive_changelog = 1 + + if("default_language_prefixes") + var/list/values = splittext(value, " ") + if(values.len > 0) + language_prefixes = values + + if("radiation_lower_limit") + radiation_lower_limit = text2num(value) + + if("radiation_resistance_calc_divide") + radiation_resistance_calc_mode = RAD_RESIST_CALC_DIV + + if("radiation_resistance_calc_subtract") + radiation_resistance_calc_mode = RAD_RESIST_CALC_SUB + + if("radiation_resistance_multiplier") + radiation_resistance_multiplier = text2num(value) + + if("radiation_material_resistance_divisor") + radiation_material_resistance_divisor = text2num(value) + + if("radiation_decay_rate") + radiation_decay_rate = text2num(value) + + if ("panic_bunker") + config.panic_bunker = 1 + + if ("paranoia_logging") + config.paranoia_logging = 1 + + if("ip_reputation") + config.ip_reputation = 1 + + if("ipr_email") + config.ipr_email = value + + if("ipr_block_bad_ips") + config.ipr_block_bad_ips = 1 + + if("ipr_bad_score") + config.ipr_bad_score = text2num(value) + + if("ipr_allow_existing") + config.ipr_allow_existing = 1 + + if("ipr_minimum_age") + config.ipr_minimum_age = text2num(value) + + if("random_submap_orientation") + config.random_submap_orientation = 1 + + if("autostart_solars") + config.autostart_solars = TRUE + + if("sqlite_enabled") + config.sqlite_enabled = TRUE + + if("sqlite_feedback") + config.sqlite_feedback = TRUE + + if("sqlite_feedback_topics") + config.sqlite_feedback_topics = splittext(value, ";") + if(!config.sqlite_feedback_topics.len) + config.sqlite_feedback_topics += "General" + + if("sqlite_feedback_privacy") + config.sqlite_feedback_privacy = TRUE + + if("sqlite_feedback_cooldown") + config.sqlite_feedback_cooldown = text2num(value) + + if("defib_timer") + config.defib_timer = text2num(value) + + if("defib_braindamage_timer") + config.defib_braindamage_timer = text2num(value) + + if("disable_cid_warn_popup") + config.disable_cid_warn_popup = TRUE + + if("enable_night_shifts") + config.enable_night_shifts = TRUE + + if("jukebox_track_files") + config.jukebox_track_files = splittext(value, ";") + + // VOREStation Edit Start - Can't be in _vr file because it is loaded too late. + if("vgs_access_identifier") + config.vgs_access_identifier = value + if("vgs_server_port") + config.vgs_server_port = text2num(value) + // VOREStation Edit End + + else + log_misc("Unknown setting in configuration: '[name]'") + + else if(type == "game_options") + if(!value) + log_misc("Unknown value for setting [name] in [filename].") + value = text2num(value) + + switch(name) + if("health_threshold_crit") + config.health_threshold_crit = value + if("health_threshold_softcrit") + config.health_threshold_softcrit = value + if("health_threshold_dead") + config.health_threshold_dead = value + if("show_human_death_message") + config.show_human_death_message = 1 + if("revival_pod_plants") + config.revival_pod_plants = value + if("revival_cloning") + config.revival_cloning = value + if("revival_brain_life") + config.revival_brain_life = value + if("organ_health_multiplier") + config.organ_health_multiplier = value / 100 + if("organ_regeneration_multiplier") + config.organ_regeneration_multiplier = value / 100 + if("organ_damage_spillover_multiplier") + config.organ_damage_spillover_multiplier = value / 100 + if("organs_can_decay") + config.organs_decay = 1 + if("default_brain_health") + config.default_brain_health = text2num(value) + if(!config.default_brain_health || config.default_brain_health < 1) + config.default_brain_health = initial(config.default_brain_health) + if("bones_can_break") + config.bones_can_break = value + if("limbs_can_break") + config.limbs_can_break = value + if("allow_headgibs") + config.allow_headgibs = TRUE + + if("run_speed") + config.run_speed = value + if("walk_speed") + config.walk_speed = value + + if("human_delay") + config.human_delay = value + if("robot_delay") + config.robot_delay = value + if("monkey_delay") + config.monkey_delay = value + if("alien_delay") + config.alien_delay = value + if("slime_delay") + config.slime_delay = value + if("animal_delay") + config.animal_delay = value + + if("footstep_volume") + config.footstep_volume = text2num(value) + + if("use_loyalty_implants") + config.use_loyalty_implants = 1 + + if("loadout_whitelist") + config.loadout_whitelist = text2num(value) + + else + log_misc("Unknown setting in configuration: '[name]'") + +/datum/configuration/proc/loadsql(filename) // -- TLE + var/list/Lines = file2list(filename) + for(var/t in Lines) + if(!t) continue + + t = trim(t) + if (length(t) == 0) + continue + else if (copytext(t, 1, 2) == "#") + continue + + var/pos = findtext(t, " ") + var/name = null + var/value = null + + if (pos) + name = lowertext(copytext(t, 1, pos)) + value = copytext(t, pos + 1) + else + name = lowertext(t) + + if (!name) + continue + + switch (name) + if ("address") + sqladdress = value + if ("port") + sqlport = value + if ("database") + sqldb = value + if ("login") + sqllogin = value + if ("password") + sqlpass = value + if ("feedback_database") + sqlfdbkdb = value + if ("feedback_login") + sqlfdbklogin = value + if ("feedback_password") + sqlfdbkpass = value + if ("enable_stat_tracking") + sqllogging = 1 + else + log_misc("Unknown setting in configuration: '[name]'") + +/datum/configuration/proc/loadforumsql(filename) // -- TLE + var/list/Lines = file2list(filename) + for(var/t in Lines) + if(!t) continue + + t = trim(t) + if (length(t) == 0) + continue + else if (copytext(t, 1, 2) == "#") + continue + + var/pos = findtext(t, " ") + var/name = null + var/value = null + + if (pos) + name = lowertext(copytext(t, 1, pos)) + value = copytext(t, pos + 1) + else + name = lowertext(t) + + if (!name) + continue + + switch (name) + if ("address") + forumsqladdress = value + if ("port") + forumsqlport = value + if ("database") + forumsqldb = value + if ("login") + forumsqllogin = value + if ("password") + forumsqlpass = value + if ("activatedgroup") + forum_activated_group = value + if ("authenticatedgroup") + forum_authenticated_group = value + else + log_misc("Unknown setting in configuration: '[name]'") + +/datum/configuration/proc/pick_mode(mode_name) + // I wish I didn't have to instance the game modes in order to look up + // their information, but it is the only way (at least that I know of). + for (var/game_mode in gamemode_cache) + var/datum/game_mode/M = gamemode_cache[game_mode] + if (M.config_tag && M.config_tag == mode_name) + return M + return gamemode_cache["extended"] + +/datum/configuration/proc/get_runnable_modes() + var/list/runnable_modes = list() + for(var/game_mode in gamemode_cache) + var/datum/game_mode/M = gamemode_cache[game_mode] + if(M && M.can_start() && !isnull(config.probabilities[M.config_tag]) && config.probabilities[M.config_tag] > 0) + runnable_modes |= M + return runnable_modes + +/datum/configuration/proc/post_load() + //apply a default value to config.python_path, if needed + if (!config.python_path) + if(world.system_type == UNIX) + config.python_path = "/usr/bin/env python2" + else //probably windows, if not this should work anyway + config.python_path = "python" +>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 4ff1b7219b..fc065bc86a 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -251,8 +251,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/list/tickersubsystems = list() var/list/runlevel_sorted_subsystems = list(list()) //ensure we always have at least one runlevel var/timer = world.time - for (var/thing in subsystems) - var/datum/controller/subsystem/SS = thing + for (var/datum/controller/subsystem/SS as anything in subsystems) if (SS.flags & SS_NO_FIRE) continue SS.queued_time = 0 @@ -339,8 +338,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new cached_runlevel = checking_runlevel current_runlevel_subsystems = runlevel_sorted_subsystems[cached_runlevel] var/stagger = world.time - for(var/I in current_runlevel_subsystems) - var/datum/controller/subsystem/SS = I + for(var/datum/controller/subsystem/SS as anything in current_runlevel_subsystems) if(SS.next_fire <= world.time) stagger += world.tick_lag * rand(1, 5) SS.next_fire = stagger @@ -553,8 +551,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new for(var/I in runlevel_SS) subsystemstocheck |= I - for (var/thing in subsystemstocheck) - var/datum/controller/subsystem/SS = thing + for (var/datum/controller/subsystem/SS as anything in subsystemstocheck) if (!SS || !istype(SS)) //list(SS) is so if a list makes it in the subsystem list, we remove the list, not the contents subsystems -= list(SS) @@ -601,8 +598,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new //disallow more than one map to load at once, multithreading it will just cause race conditions while(map_loading) stoplag() - for(var/S in subsystems) - var/datum/controller/subsystem/SS = S + for(var/datum/controller/subsystem/SS as anything in subsystems) SS.StartLoadingMap() map_loading = TRUE @@ -611,6 +607,5 @@ GLOBAL_REAL(Master, /datum/controller/master) = new if(!quiet) admin_notice("Map is finished. Unlocking.", R_DEBUG) map_loading = FALSE - for(var/S in subsystems) - var/datum/controller/subsystem/SS = S + for(var/datum/controller/subsystem/SS as anything in subsystems) SS.StopLoadingMap() diff --git a/code/controllers/subsystems/assets.dm b/code/controllers/subsystems/assets.dm index 2041104a2b..00d1693c06 100644 --- a/code/controllers/subsystems/assets.dm +++ b/code/controllers/subsystems/assets.dm @@ -6,8 +6,7 @@ SUBSYSTEM_DEF(assets) var/list/preload = list() /datum/controller/subsystem/assets/Initialize(timeofday) - for(var/type in typesof(/datum/asset)) - var/datum/asset/A = type + for(var/datum/asset/A as anything in typesof(/datum/asset)) if (type != initial(A._abstract)) get_asset_datum(type) diff --git a/code/controllers/subsystems/atoms.dm b/code/controllers/subsystems/atoms.dm index 4db490914a..a62c5265c5 100644 --- a/code/controllers/subsystems/atoms.dm +++ b/code/controllers/subsystems/atoms.dm @@ -38,11 +38,10 @@ SUBSYSTEM_DEF(atoms) if(atoms) created_atoms = list() count = atoms.len - for(var/I in atoms) - var/atom/A = I + for(var/atom/A as anything in atoms) if(!A.initialized) - if(InitAtom(I, mapload_arg)) - atoms -= I + if(InitAtom(A, mapload_arg)) + atoms -= A CHECK_TICK else count = 0 @@ -57,8 +56,7 @@ SUBSYSTEM_DEF(atoms) initialized = INITIALIZATION_INNEW_REGULAR if(late_loaders.len) - for(var/I in late_loaders) - var/atom/A = I + for(var/atom/A as anything in late_loaders) A.LateInitialize() CHECK_TICK testing("Late initialized [late_loaders.len] atoms") diff --git a/code/controllers/subsystems/chat.dm b/code/controllers/subsystems/chat.dm index 553c30d128..aece61d39e 100644 --- a/code/controllers/subsystems/chat.dm +++ b/code/controllers/subsystems/chat.dm @@ -13,8 +13,7 @@ SUBSYSTEM_DEF(chat) /datum/controller/subsystem/chat/fire() var/list/msg_queue = src.msg_queue // Local variable for sanic speed. - for(var/i in msg_queue) - var/client/C = i + for(var/client/C as anything in msg_queue) var/list/messages = msg_queue[C] msg_queue -= C if (C) diff --git a/code/controllers/subsystems/circuits.dm b/code/controllers/subsystems/circuits.dm index 8fda048c60..4d2b282171 100644 --- a/code/controllers/subsystems/circuits.dm +++ b/code/controllers/subsystems/circuits.dm @@ -23,11 +23,10 @@ SUBSYSTEM_DEF(circuit) /datum/controller/subsystem/circuit/proc/circuits_init() //Cached lists for free performance - for(var/path in typesof(/obj/item/integrated_circuit)) - var/obj/item/integrated_circuit/IC = path - var/name = initial(IC.name) - all_components[name] = path // Populating the component lists - cached_components[IC] = new path + for(var/obj/item/integrated_circuit/IC as anything in typesof(/obj/item/integrated_circuit)) + var/path = IC + all_components[initial(IC.name)] = path // Populating the component lists + cached_components[path] = new path if(!(initial(IC.spawn_flags) & (IC_SPAWN_DEFAULT | IC_SPAWN_RESEARCH))) continue @@ -38,11 +37,10 @@ SUBSYSTEM_DEF(circuit) var/list/category_list = circuit_fabricator_recipe_list[category] category_list += IC // Populating the fabricator categories - for(var/path in typesof(/obj/item/device/electronic_assembly)) - var/obj/item/device/electronic_assembly/A = path - var/name = initial(A.name) - all_assemblies[name] = path - cached_assemblies[A] = new path + for(var/obj/item/device/electronic_assembly/A as anything in typesof(/obj/item/device/electronic_assembly)) + var/path = A + all_assemblies[initial(A.name)] = path + cached_assemblies[path] = new path circuit_fabricator_recipe_list["Assemblies"] = list( diff --git a/code/controllers/subsystems/events.dm b/code/controllers/subsystems/events.dm index 5b613775e4..83ab2fa00c 100644 --- a/code/controllers/subsystems/events.dm +++ b/code/controllers/subsystems/events.dm @@ -13,7 +13,7 @@ SUBSYSTEM_DEF(events) var/datum/event_meta/new_event = new /datum/controller/subsystem/events/Initialize() - allEvents = typesof(/datum/event) - /datum/event + allEvents = subtypesof(/datum/event) event_containers = list( EVENT_LEVEL_MUNDANE = new/datum/event_container/mundane, EVENT_LEVEL_MODERATE = new/datum/event_container/moderate, diff --git a/code/controllers/subsystems/events2.dm b/code/controllers/subsystems/events2.dm index 2a73498b1d..7cf986358f 100644 --- a/code/controllers/subsystems/events2.dm +++ b/code/controllers/subsystems/events2.dm @@ -14,8 +14,7 @@ SUBSYSTEM_DEF(event_ticker) // Process active events. /datum/controller/subsystem/event_ticker/fire(resumed) - for(var/E in active_events) - var/datum/event2/event/event = E + for(var/datum/event2/event/event as anything in active_events) event.process() if(event.finished) event_finished(event) diff --git a/code/controllers/subsystems/game_master.dm b/code/controllers/subsystems/game_master.dm index 01ea086935..06a6060227 100644 --- a/code/controllers/subsystems/game_master.dm +++ b/code/controllers/subsystems/game_master.dm @@ -74,8 +74,7 @@ SUBSYSTEM_DEF(game_master) chosen_event.enabled = FALSE if(chosen_event.event_class) // Disable similar events, too. - for(var/M in available_events) - var/datum/event2/meta/meta = M + for(var/datum/event2/meta/meta as anything in available_events) if(meta.event_class == chosen_event.event_class) meta.enabled = FALSE @@ -235,8 +234,7 @@ SUBSYSTEM_DEF(game_master) dat += "Players" dat += "" - for(var/P in player_list) - var/mob/M = P + for(var/mob/M as anything in player_list) dat += "" dat += "[M] ([M.ckey])" dat += "[metric.assess_player_activity(M)]%" @@ -255,8 +253,7 @@ SUBSYSTEM_DEF(game_master) dat += "Buttons" dat += "" - for(var/E in available_events) - var/datum/event2/meta/event = E + for(var/datum/event2/meta/event as anything in available_events) dat += "" if(!event.enabled) dat += "[event.name]" @@ -285,8 +282,7 @@ SUBSYSTEM_DEF(game_master) dat += "Buttons" dat += "" - for(var/E in SSevent_ticker.active_events) - var/datum/event2/event/event = E + for(var/datum/event2/event/event as anything in SSevent_ticker.active_events) dat += "" dat += "[event.type]" dat += "[event.time_started]" @@ -309,8 +305,7 @@ SUBSYSTEM_DEF(game_master) dat += "Finish Time" dat += "" - for(var/E in SSevent_ticker.finished_events) - var/datum/event2/event/event = E + for(var/datum/event2/event/event as anything in SSevent_ticker.finished_events) dat += "" dat += "[event.type]" dat += "[event.time_started]" diff --git a/code/controllers/subsystems/garbage.dm b/code/controllers/subsystems/garbage.dm index 422fa6743f..c1fe92295d 100644 --- a/code/controllers/subsystems/garbage.dm +++ b/code/controllers/subsystems/garbage.dm @@ -172,8 +172,7 @@ SUBSYSTEM_DEF(garbage) log_world("## TESTING: GC: -- \ref[D] | [type] was unable to be GC'd --") #ifdef TESTING - for(var/c in GLOB.admins) //Using testing() here would fill the logs with ADMIN_VV garbage - var/client/admin = c + for(var/client/admin as anything in GLOB.admins) //Using testing() here would fill the logs with ADMIN_VV garbage if(!check_rights_for(admin, R_ADMIN)) continue to_chat(admin, "## TESTING: GC: -- [ADMIN_VV(D)] | [type] was unable to be GC'd --") diff --git a/code/controllers/subsystems/mapping.dm b/code/controllers/subsystems/mapping.dm index 848a5552d6..06bf16e255 100644 --- a/code/controllers/subsystems/mapping.dm +++ b/code/controllers/subsystems/mapping.dm @@ -34,11 +34,10 @@ SUBSYSTEM_DEF(mapping) ..() /datum/controller/subsystem/mapping/proc/load_map_templates() - for(var/T in subtypesof(/datum/map_template)) - var/datum/map_template/template = T + for(var/datum/map_template/template as anything in subtypesof(/datum/map_template)) if(!(initial(template.mappath))) // If it's missing the actual path its probably a base type or being used for inheritence. continue - template = new T() + template = new template() map_templates[template.name] = template return TRUE @@ -113,8 +112,7 @@ SUBSYSTEM_DEF(mapping) MT.load_new_z(centered = FALSE) /datum/controller/subsystem/mapping/proc/preloadShelterTemplates() - for(var/item in subtypesof(/datum/map_template/shelter)) - var/datum/map_template/shelter/shelter_type = item + for(var/datum/map_template/shelter/shelter_type as anything in subtypesof(/datum/map_template/shelter)) if(!(initial(shelter_type.mappath))) continue var/datum/map_template/shelter/S = new shelter_type() diff --git a/code/controllers/subsystems/persistence.dm b/code/controllers/subsystems/persistence.dm index 8168bfa6c2..f238621b3e 100644 --- a/code/controllers/subsystems/persistence.dm +++ b/code/controllers/subsystems/persistence.dm @@ -12,11 +12,10 @@ SUBSYSTEM_DEF(persistence) /datum/controller/subsystem/persistence/Initialize() . = ..() - for(var/thing in subtypesof(/datum/persistent)) - var/datum/persistent/P = thing + for(var/datum/persistent/P as anything in subtypesof(/datum/persistent)) if(initial(P.name)) P = new P - persistence_datums[thing] = P + persistence_datums[P.type] = P P.Initialize() /datum/controller/subsystem/persistence/Shutdown() diff --git a/code/controllers/subsystems/planets.dm b/code/controllers/subsystems/planets.dm index 16fbe59d3a..5486034871 100644 --- a/code/controllers/subsystems/planets.dm +++ b/code/controllers/subsystems/planets.dm @@ -111,8 +111,7 @@ SUBSYSTEM_DEF(planets) /datum/controller/subsystem/planets/proc/updateTemp(var/datum/planet/P) //Set new temperatures - for(var/W in P.planet_walls) - var/turf/unsimulated/wall/planetary/wall = W + for(var/turf/unsimulated/wall/planetary/wall as anything in P.planet_walls) wall.set_temperature(P.weather_holder.temperature) CHECK_TICK @@ -120,8 +119,7 @@ SUBSYSTEM_DEF(planets) var/count = 100000 while(count > 0) count-- - for(var/planet in planets) - var/datum/planet/P = planet + for(var/datum/planet/P as anything in planets) if(P.weather_holder) P.weather_holder.change_weather(pick(P.weather_holder.allowed_weather_types)) sleep(3) diff --git a/code/controllers/subsystems/plants.dm b/code/controllers/subsystems/plants.dm index cc066cb99d..f21cc1cb2c 100644 --- a/code/controllers/subsystems/plants.dm +++ b/code/controllers/subsystems/plants.dm @@ -62,7 +62,7 @@ SUBSYSTEM_DEF(plants) accessible_product_sprites |= base // Populate the global seed datum list. - for(var/type in typesof(/datum/seed)-/datum/seed) + for(var/type in subtypesof(/datum/seed)) var/datum/seed/S = new type seeds[S.name] = S S.uid = "[seeds.len]" diff --git a/code/controllers/subsystems/processing/instruments.dm b/code/controllers/subsystems/processing/instruments.dm index ee0fd1ea00..3f305fb8fc 100644 --- a/code/controllers/subsystems/processing/instruments.dm +++ b/code/controllers/subsystems/processing/instruments.dm @@ -33,11 +33,10 @@ PROCESSING_SUBSYSTEM_DEF(instruments) songs -= S /datum/controller/subsystem/processing/instruments/proc/initialize_instrument_data() - for(var/path in subtypesof(/datum/instrument)) - var/datum/instrument/I = path - if(initial(I.abstract_type) == path) + for(var/datum/instrument/I as anything in subtypesof(/datum/instrument)) + if(initial(I.abstract_type) == I) continue - I = new path + I = new I I.Initialize() if(!I.id) qdel(I) diff --git a/code/controllers/subsystems/processing/projectiles.dm b/code/controllers/subsystems/processing/projectiles.dm index e4316304ce..3e5e1b2127 100644 --- a/code/controllers/subsystems/processing/projectiles.dm +++ b/code/controllers/subsystems/processing/projectiles.dm @@ -19,7 +19,6 @@ PROCESSING_SUBSYSTEM_DEF(projectiles) /datum/controller/subsystem/processing/projectiles/proc/set_pixel_speed(new_speed) global_pixel_speed = new_speed - for(var/i in processing) - var/obj/item/projectile/P = i + for(var/obj/item/projectile/P as anything in processing) if(istype(P)) //there's non projectiles on this too. P.set_pixel_speed(new_speed) diff --git a/code/controllers/subsystems/radiation.dm b/code/controllers/subsystems/radiation.dm index 50c72ddd60..8f140a5fc8 100644 --- a/code/controllers/subsystems/radiation.dm +++ b/code/controllers/subsystems/radiation.dm @@ -63,8 +63,7 @@ SUBSYSTEM_DEF(radiation) if(!istype(T)) return - for(var/value in sources) - var/datum/radiation_source/source = value + for(var/datum/radiation_source/source as anything in sources) if(source.rad_power < .) continue // Already being affected by a stronger source diff --git a/code/controllers/subsystems/shuttles.dm b/code/controllers/subsystems/shuttles.dm index 40039edceb..38ec9e5c83 100644 --- a/code/controllers/subsystems/shuttles.dm +++ b/code/controllers/subsystems/shuttles.dm @@ -119,8 +119,7 @@ SUBSYSTEM_DEF(shuttles) landmarks_still_needed[landmark_tag] = given_sector // Landmark isn't registered yet, queue it to be added once it is. var/landmarks_to_check = landmarks_awaiting_sector.Copy() - for(var/thing in landmarks_to_check) - var/obj/effect/shuttle_landmark/automatic/landmark = thing + for(var/obj/effect/shuttle_landmark/automatic/landmark as anything in landmarks_to_check) if(landmark.z in given_sector.map_z) given_sector.add_landmark(landmark, landmark.shuttle_restricted) landmarks_awaiting_sector -= landmark @@ -170,8 +169,7 @@ SUBSYSTEM_DEF(shuttles) if(overmap_halted == new_setting) return overmap_halted = !overmap_halted - for(var/ship in ships) - var/obj/effect/overmap/visitable/ship/ship_effect = ship + for(var/obj/effect/overmap/visitable/ship/ship_effect as anything in ships) overmap_halted ? ship_effect.halt() : ship_effect.unhalt() /datum/controller/subsystem/shuttles/stat_entry() diff --git a/code/controllers/subsystems/timer.dm b/code/controllers/subsystems/timer.dm index dadcd9ab95..4fadc4f599 100644 --- a/code/controllers/subsystems/timer.dm +++ b/code/controllers/subsystems/timer.dm @@ -202,8 +202,7 @@ SUBSYSTEM_DEF(timer) bucket_count -= length(spent) - for (var/i in spent) - var/datum/timedevent/qtimer = i + for(var/datum/timedevent/qtimer as anything in spent) if(QDELETED(qtimer)) bucket_count++ continue diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm index 34128d372a..c1e4288869 100644 --- a/code/controllers/subsystems/vote.dm +++ b/code/controllers/subsystems/vote.dm @@ -35,8 +35,7 @@ SUBSYSTEM_DEF(vote) // Before doing the vote, see if anyone is playing. // If not, just do the transfer. var/players_are_in_round = FALSE - for(var/a in player_list) // Mobs with clients attached. - var/mob/living/L = a + for(var/mob/living/L as anything in player_list) // Mobs with clients attached. if(!istype(L)) // Exclude ghosts and other weird things. continue if(L.stat == DEAD) // Dead mobs aren't playing. diff --git a/code/controllers/subsystems/xenoarch.dm b/code/controllers/subsystems/xenoarch.dm index 9851c69278..a175625b1f 100644 --- a/code/controllers/subsystems/xenoarch.dm +++ b/code/controllers/subsystems/xenoarch.dm @@ -41,8 +41,7 @@ SUBSYSTEM_DEF(xenoarch) continue var/farEnough = 1 - for(var/A in digsite_spawning_turfs) - var/turf/T = A + for(var/turf/T as anything in digsite_spawning_turfs) if(T in range(5, M)) farEnough = 0 break diff --git a/code/controllers/verbs.dm b/code/controllers/verbs.dm index 7323d2cba2..da3e8e1baf 100644 --- a/code/controllers/verbs.dm +++ b/code/controllers/verbs.dm @@ -75,8 +75,7 @@ options["MC"] = Master options["Failsafe"] = Failsafe options["Configuration"] = config - for(var/i in Master.subsystems) - var/datum/controller/subsystem/S = i + for(var/datum/controller/subsystem/S as anything in Master.subsystems) if(!istype(S)) //Eh, we're a debug verb, let's have typechecking. continue var/strtype = "SS[get_end_section_of_type(S.type)]" diff --git a/code/datums/chat_message.dm b/code/datums/chat_message.dm index ae17f21e2d..982e9e098c 100644 --- a/code/datums/chat_message.dm +++ b/code/datums/chat_message.dm @@ -172,8 +172,7 @@ var/list/runechat_image_cache = list() if(owned_by.seen_messages) var/idx = 1 var/combined_height = approx_lines - for(var/msg in owned_by.seen_messages[message_loc]) - var/datum/chatmessage/m = msg + for(var/datum/chatmessage/m as anything in owned_by.seen_messages[message_loc]) animate(m.message, pixel_y = m.message.pixel_y + mheight, time = CHAT_MESSAGE_SPAWN_TIME) combined_height += m.approx_lines @@ -336,8 +335,7 @@ var/list/runechat_image_cache = list() var/list/hear = get_mobs_and_objs_in_view_fast(get_turf(src), range, remote_ghosts = FALSE) hearing_mobs = hear["mobs"] - for(var/mob in hearing_mobs) - var/mob/M = mob + for(var/mob/M as anything in hearing_mobs) if(!M.client) continue M.create_chat_message(src, message, italics, classes, audible) diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index c5bd07cdcb..2e177c8ff3 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -320,8 +320,7 @@ var/proctype = C.signal_procs[src][sigtype] return NONE | CallAsync(C, proctype, arguments) . = NONE - for(var/I in target) - var/datum/C = I + for(var/datum/C as anything in target) if(!C.signal_enabled) continue var/proctype = C.signal_procs[src][sigtype] @@ -444,8 +443,7 @@ var/list/arguments = raw_args.Copy() arguments[1] = new_comp var/make_new_component = TRUE - for(var/i in GetComponents(new_type)) - var/datum/component/C = i + for(var/datum/component/C as anything in GetComponents(new_type)) if(C.CheckDupeComponent(arglist(arguments))) make_new_component = FALSE QDEL_NULL(new_comp) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index cc6bb53a97..c4d8bcc3d4 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -402,8 +402,7 @@ var/list/surroundings = get_surroundings(user) var/list/craftability = list() - for(var/rec in GLOB.crafting_recipes) - var/datum/crafting_recipe/R = rec + for(var/datum/crafting_recipe/R as anything in GLOB.crafting_recipes) if(!R.always_available && !(R.type in user?.mind?.learned_recipes)) //User doesn't actually know how to make this. continue @@ -420,11 +419,10 @@ var/list/data = list() var/list/crafting_recipes = list() - for(var/rec in GLOB.crafting_recipes) - var/datum/crafting_recipe/R = rec + for(var/datum/crafting_recipe/R as anything in GLOB.crafting_recipes) if(R.name == "") //This is one of the invalid parents that sneaks in - GLOB.crafting_recipes -= rec + GLOB.crafting_recipes -= R continue if(!R.always_available && !(R.type in user?.mind?.learned_recipes)) //User doesn't actually know how to make this. diff --git a/code/datums/components/material_container.dm b/code/datums/components/material_container.dm index c8f54a1f0c..86573474e6 100644 --- a/code/datums/components/material_container.dm +++ b/code/datums/components/material_container.dm @@ -99,9 +99,8 @@ /datum/component/material_container/proc/on_examine(datum/source, mob/user, list/examine_texts) SIGNAL_HANDLER - for(var/I in materials) - var/datum/material/M = I - var/amt = materials[I] + for(var/datum/material/M as anything in materials) + var/amt = materials[M] if(amt) examine_texts += "It has [amt] units of [lowertext(M.name)] stored." @@ -327,13 +326,13 @@ var/list/mats_to_remove = list() //Assoc list MAT | AMOUNT - for(var/x in mats) //Loop through all required materials - var/datum/material/req_mat = x + for(var/datum/material/req_mat as anything in mats) //Loop through all required materials + var/imat = req_mat if(!istype(req_mat)) req_mat = GET_MATERIAL_REF(req_mat) //Get the ref if necesary if(!materials[req_mat]) //Do we have the resource? return FALSE //Can't afford it - var/amount_required = mats[x] * multiplier + var/amount_required = mats[imat] * multiplier if(!(materials[req_mat] >= amount_required)) // do we have enough of the resource? return FALSE //Can't afford it mats_to_remove[req_mat] += amount_required //Add it to the assoc list of things to remove @@ -392,8 +391,8 @@ if(!mats || !mats.len) return FALSE - for(var/x in mats) //Loop through all required materials - var/datum/material/req_mat = x + for(var/datum/material/req_mat as anything in mats) //Loop through all required materials + var/imat = req_mat if(!istype(req_mat)) if(ispath(req_mat) || istext(req_mat)) //Is this an actual material, or is it a category? req_mat = GET_MATERIAL_REF(req_mat) //Get the ref @@ -404,7 +403,7 @@ // else // continue - if(!has_enough_of_material(req_mat, mats[x], multiplier))//Not a category, so just check the normal way + if(!has_enough_of_material(req_mat, mats[imat], multiplier))//Not a category, so just check the normal way return FALSE return TRUE diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index b6a812ce9a..76bd3d3c73 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -171,8 +171,7 @@ ///Clears the affected_turfs lazylist, removing from its contents the effects of being near the light. /datum/component/overlay_lighting/proc/clean_old_turfs() - for(var/t in affected_turfs) - var/turf/lit_turf = t + for(var/turf/lit_turf as anything in affected_turfs) lit_turf.dynamic_lumcount -= lum_power affected_turfs = null @@ -431,8 +430,7 @@ . = lum_power lum_power = new_lum_power var/difference = . - lum_power - for(var/t in affected_turfs) - var/turf/lit_turf = t + for(var/turf/lit_turf as anything in affected_turfs) lit_turf.dynamic_lumcount -= difference ///Moves the light directional_atom that emits our "light" based on our position and our direction diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 2304af887a..01eb82dd71 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -31,8 +31,7 @@ //clear timers var/list/timers = active_timers active_timers = null - for(var/thing in timers) - var/datum/timedevent/timer = thing + for(var/datum/timedevent/timer as anything in timers) if (timer.spent) continue qdel(timer) @@ -46,8 +45,7 @@ if(dc) var/all_components = dc[/datum/component] if(length(all_components)) - for(var/I in all_components) - var/datum/component/C = I + for(var/datum/component/C as anything in all_components) qdel(C, FALSE, TRUE) else var/datum/component/C = all_components @@ -59,8 +57,7 @@ for(var/sig in lookup) var/list/comps = lookup[sig] if(length(comps)) - for(var/i in comps) - var/datum/component/comp = i + for(var/datum/component/comp as anything in comps) comp.UnregisterSignal(src, sig) else var/datum/component/comp = comps diff --git a/code/datums/game_masters/default.dm b/code/datums/game_masters/default.dm index d380476df2..8f69b296af 100644 --- a/code/datums/game_masters/default.dm +++ b/code/datums/game_masters/default.dm @@ -17,8 +17,7 @@ log_game_master("Got [best_events.len] choice\s for the next event.") var/list/weighted_events = list() - for(var/E in best_events) - var/datum/event2/meta/event = E + for(var/datum/event2/meta/event as anything in best_events) var/weight = event.get_weight() if(weight <= 0) continue @@ -71,8 +70,7 @@ // If no list is passed, all the events will be returned. /datum/game_master/default/proc/filter_events_by_departments(list/departments) . = list() - for(var/E in SSgame_master.available_events) - var/datum/event2/meta/event = E + for(var/datum/event2/meta/event as anything in SSgame_master.available_events) if(!event.enabled) continue if(event.chaotic_threshold && !ignore_round_chaos) diff --git a/code/datums/game_masters/other_game_masters.dm b/code/datums/game_masters/other_game_masters.dm index f62d83cfe3..cd45483251 100644 --- a/code/datums/game_masters/other_game_masters.dm +++ b/code/datums/game_masters/other_game_masters.dm @@ -3,8 +3,7 @@ // * Does not react to danger at all. /datum/game_master/classic/choose_event() var/list/weighted_events = list() - for(var/E in SSgame_master.available_events) - var/datum/event2/meta/event = E + for(var/datum/event2/meta/event as anything in SSgame_master.available_events) if(!event.enabled) continue weighted_events[event] = event.get_weight() @@ -31,8 +30,7 @@ /datum/game_master/brutal/choose_event() var/list/weighted_events = list() - for(var/E in SSgame_master.available_events) - var/datum/event2/meta/event = E + for(var/datum/event2/meta/event as anything in SSgame_master.available_events) if(!event.enabled) continue weighted_events[event] = event.get_weight() + (event.chaos * 2) diff --git a/code/datums/helper_datums/getrev.dm b/code/datums/helper_datums/getrev.dm index debc08c2c4..4533abbe1c 100644 --- a/code/datums/helper_datums/getrev.dm +++ b/code/datums/helper_datums/getrev.dm @@ -45,9 +45,18 @@ GLOBAL_DATUM(revdata, /datum/getrev) return if(header) . += "The following pull requests are currently test merged:" +<<<<<<< HEAD for(var/line in testmerge) var/datum/tgs_revision_information/test_merge/tm = line var/cm = tm.head_commit //CHOMPStation Edit TGS4 +||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt + for(var/line in testmerge) + var/datum/tgs_revision_information/test_merge/tm = line + var/cm = tm.pull_request_commit +======= + for(var/datum/tgs_revision_information/test_merge/tm as anything in testmerge) + var/cm = tm.pull_request_commit +>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt var/details = ": '" + html_encode(tm.title) + "' by " + html_encode(tm.author) + " at commit " + html_encode(copytext_char(cm, 1, 11)) if(details && findtext(details, "\[s\]") && (!usr || !usr.client.holder)) continue diff --git a/code/datums/observation/~cleanup.dm b/code/datums/observation/~cleanup.dm index 9dcc601436..da902052bd 100644 --- a/code/datums/observation/~cleanup.dm +++ b/code/datums/observation/~cleanup.dm @@ -40,8 +40,7 @@ GLOBAL_LIST_EMPTY(event_listen_count) /decl/observ/destroyed/proc/cleanup_global_listener(listener, listen_count) GLOB.global_listen_count -= listener - for(var/entry in GLOB.all_observable_events.events) - var/decl/observ/event = entry + for(var/decl/observ/event as anything in GLOB.all_observable_events.events) if(event.unregister_global(listener)) // log_debug("[event] - [listener] was deleted while still registered to global events.") // TODO: Apply axe, reimplement with datum component listeners if(!(--listen_count)) @@ -49,8 +48,7 @@ GLOBAL_LIST_EMPTY(event_listen_count) /decl/observ/destroyed/proc/cleanup_source_listeners(event_source, source_listener_count) GLOB.event_sources_count -= event_source - for(var/entry in GLOB.all_observable_events.events) - var/decl/observ/event = entry + for(var/decl/observ/event as anything in GLOB.all_observable_events.events) var/proc_owners = event.event_sources[event_source] if(proc_owners) for(var/proc_owner in proc_owners) @@ -61,8 +59,7 @@ GLOBAL_LIST_EMPTY(event_listen_count) /decl/observ/destroyed/proc/cleanup_event_listener(listener, listener_count) GLOB.event_listen_count -= listener - for(var/entry in GLOB.all_observable_events.events) - var/decl/observ/event = entry + for(var/decl/observ/event as anything in GLOB.all_observable_events.events) for(var/event_source in event.event_sources) if(event.unregister(event_source, listener)) // log_debug("[event] - [listener] was deleted while still listening to [event_source].") // TODO: Apply axe, reimplement with datum component listeners diff --git a/code/datums/orbit.dm b/code/datums/orbit.dm index 0176d7f23d..adbd166d25 100644 --- a/code/datums/orbit.dm +++ b/code/datums/orbit.dm @@ -110,8 +110,7 @@ /atom/Destroy(force = FALSE) . = ..() if (orbiters) - for (var/thing in orbiters) - var/datum/orbit/O = thing + for(var/datum/orbit/O as anything in orbiters) if (O.orbiter) O.orbiter.stop_orbit() @@ -123,8 +122,7 @@ /* /atom/movable/proc/transfer_observers_to(atom/movable/target) if(orbiters) - for(var/thing in orbiters) - var/datum/orbit/O = thing + for(var/datum/orbit/O as anything in orbiters) if(O.orbiter && isobserver(O.orbiter)) var/mob/dead/observer/D = O.orbiter D.ManualFollow(target) diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm index c24dfcd922..8da8d7c000 100644 --- a/code/datums/progressbar.dm +++ b/code/datums/progressbar.dm @@ -51,8 +51,7 @@ animate(bar, pixel_y = shiftheight, time = 5, easing = SINE_EASING) /datum/progressbar/Destroy() - for(var/I in user.progressbars[bar.loc]) - var/datum/progressbar/P = I + for(var/datum/progressbar/P as anything in user.progressbars[bar.loc]) if(P != src && P.listindex > listindex) P.shiftDown() diff --git a/code/datums/soul_link.dm b/code/datums/soul_link.dm index 7bc652a863..d15049d924 100644 --- a/code/datums/soul_link.dm +++ b/code/datums/soul_link.dm @@ -6,13 +6,11 @@ var/list/shared_soul_links // Soul links we are a/the sharer of. /mob/living/Destroy() - 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(FALSE) - qdel(s) // If the owner is destroy()'d, the soullink is destroy()'d. + qdel(S) // If the owner is destroy()'d, the soullink is destroy()'d. owned_soul_links = null - 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(FALSE) S.remove_soul_sharer(src) // If a sharer is destroy()'d, they are simply removed. shared_soul_links = null @@ -82,8 +80,7 @@ soul_owner = owner soul_sharers = sharers LAZYADD(owner.owned_soul_links, src) - for(var/l in sharers) - var/mob/living/L = l + for(var/mob/living/L as anything in sharers) LAZYADD(L.shared_soul_links, src) return TRUE @@ -144,8 +141,7 @@ /datum/soul_link/multi_sharer/replacement_pool/owner_died(gibbed, mob/living/owner) if(LAZYLEN(soul_sharers) && !gibbed) //let's not put them in some gibs var/list/souls = shuffle(soul_sharers.Copy()) - for(var/l in souls) - var/mob/living/L = l + for(var/mob/living/L as anything in souls) if(L.stat != DEAD && L.mind) L.mind.transfer_to(soul_owner) soul_owner.revive(TRUE, TRUE) diff --git a/code/game/antagonist/_antagonist_setup.dm b/code/game/antagonist/_antagonist_setup.dm index 6f514b9413..c1e5002e74 100644 --- a/code/game/antagonist/_antagonist_setup.dm +++ b/code/game/antagonist/_antagonist_setup.dm @@ -46,7 +46,7 @@ var/global/list/antag_names_to_ids = list() antag.update_all_icons() /proc/populate_antag_type_list() - for(var/antag_type in typesof(/datum/antagonist)-/datum/antagonist) + for(var/antag_type in subtypesof(/datum/antagonist)) var/datum/antagonist/A = new antag_type all_antag_types[A.id] = A all_antag_spawnpoints[A.landmark_id] = list() diff --git a/code/game/antagonist/mutiny/mutineer.dm b/code/game/antagonist/mutiny/mutineer.dm index 480fc83c70..85aecd71ea 100644 --- a/code/game/antagonist/mutiny/mutineer.dm +++ b/code/game/antagonist/mutiny/mutineer.dm @@ -54,7 +54,7 @@ var/datum/antagonist/mutineer/mutineers proc/get_directive_candidates() var/list/candidates[0] - for(var/T in typesof(/datum/directive) - /datum/directive) + for(var/T in subtypesof(/datum/directive)) var/datum/directive/D = new T(src) if (D.meets_prerequisites()) candidates.Add(D) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 5c8ff8974d..3e4b277696 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -153,8 +153,7 @@ ASSERT(callback) ASSERT(isturf(loc)) var/list/turfs = trange(range, src) - for(var/t in turfs) - var/turf/T = t + for(var/turf/T as anything in turfs) GLOB.turf_entered_event.register(T, src, callback) //Unregister from prox listening in a certain range. You should do this BEFORE you move, but if you @@ -162,8 +161,7 @@ /atom/proc/unsense_proximity(var/range = 1, var/callback, var/center) ASSERT(isturf(center) || isturf(loc)) var/list/turfs = trange(range, center ? center : src) - for(var/t in turfs) - var/turf/T = t + for(var/turf/T as anything in turfs) GLOB.turf_entered_event.unregister(T, src, callback) @@ -529,11 +527,9 @@ if(LAZYLEN(exclude_mobs)) seeing_mobs -= exclude_mobs - for(var/obj in seeing_objs) - var/obj/O = obj + for(var/obj/O as anything in seeing_objs) O.show_message(message, VISIBLE_MESSAGE, blind_message, AUDIBLE_MESSAGE) - for(var/mob in seeing_mobs) - var/mob/M = mob + for(var/mob/M as anything in seeing_mobs) if(M.see_invisible >= invisibility && MOB_CAN_SEE_PLANE(M, plane)) M.show_message(message, VISIBLE_MESSAGE, blind_message, AUDIBLE_MESSAGE) if(runemessage != -1) @@ -555,16 +551,13 @@ var/list/hearing_objs = hear["objs"] if(radio_message) - for(var/obj in hearing_objs) - var/obj/O = obj + 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 in hearing_objs) - var/obj/O = obj + for(var/obj/O as anything in hearing_objs) O.show_message(message, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE) - for(var/mob in hearing_mobs) - var/mob/M = mob + for(var/mob/M as anything in hearing_mobs) var/msg = message M.show_message(msg, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE) if(runemessage != -1) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 08b0f3e056..9dfba6c423 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -134,8 +134,7 @@ oldarea.Exited(src, newloc) // Multi-tile objects can't reach here, otherwise you'd need to avoid uncrossing yourself - for(var/i in oldloc) - var/atom/movable/thing = i + for(var/atom/movable/thing as anything in oldloc) // We don't call parent so we are calling this for byond thing.Uncrossed(src) @@ -145,8 +144,7 @@ newarea.Entered(src, oldloc) // Multi-tile objects can't reach here, otherwise you'd need to avoid uncrossing yourself - for(var/i in loc) - var/atom/movable/thing = i + for(var/atom/movable/thing as anything in loc) // We don't call parent so we are calling this for byond thing.Crossed(src, oldloc) @@ -315,8 +313,7 @@ old_area.Exited(src, destination) // Uncross everything where we left - for(var/i in oldloc) - var/atom/movable/AM = i + for(var/atom/movable/AM as anything in oldloc) if(AM == src) continue AM.Uncrossed(src) @@ -341,8 +338,7 @@ destarea.Entered(src, oldloc) // We ignore ourselves because if we're multi-tile we might be in both old and new locs - for(var/i in destination) - var/atom/movable/AM = i + for(var/atom/movable/AM as anything in destination) if(AM == src) continue AM.Crossed(src, oldloc) @@ -364,8 +360,7 @@ loc = null // Uncross everything where we left (no multitile safety like above because we are definitely not still there) - for(var/i in oldloc) - var/atom/movable/AM = i + for(var/atom/movable/AM as anything in oldloc) AM.Uncrossed(src) // Exited() our loc and area @@ -379,8 +374,7 @@ /atom/movable/proc/onTransitZ(old_z,new_z) GLOB.z_moved_event.raise_event(src, old_z, new_z) SEND_SIGNAL(src, COMSIG_MOVABLE_Z_CHANGED, old_z, new_z) - for(var/item in src) // Notify contents of Z-transition. This can be overridden IF we know the items contents do not care. - var/atom/movable/AM = item + for(var/atom/movable/AM as anything in src) // Notify contents of Z-transition. This can be overridden IF we know the items contents do not care. AM.onTransitZ(old_z,new_z) /atom/movable/proc/glide_for(movetime) diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index 3fb282d72d..8371c395a4 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -258,8 +258,7 @@ //VOREStation Add /mob/living/carbon/human/proc/force_update_organs() - for(var/organ in organs + internal_organs) - var/obj/item/organ/O = organ + for(var/obj/item/organ/O as anything in organs + internal_organs) O.species = species //VOREStation Add End diff --git a/code/game/gamemodes/changeling/modularchangling.dm b/code/game/gamemodes/changeling/modularchangling.dm index c6af89ad75..5563d4f01b 100644 --- a/code/game/gamemodes/changeling/modularchangling.dm +++ b/code/game/gamemodes/changeling/modularchangling.dm @@ -2,7 +2,7 @@ //Ling power's evolution menu entry datum should be contained alongside the mob proc for the actual power, in their own file. -var/list/powers = typesof(/datum/power/changeling) - /datum/power/changeling //needed for the badmin verb for now +var/list/powers = subtypesof(/datum/power/changeling) //needed for the badmin verb for now var/list/datum/power/changeling/powerinstances = list() /datum/power //Could be used by other antags too diff --git a/code/game/gamemodes/sandbox/h_sandbox.dm b/code/game/gamemodes/sandbox/h_sandbox.dm index 08340f5a76..449d448fe0 100644 --- a/code/game/gamemodes/sandbox/h_sandbox.dm +++ b/code/game/gamemodes/sandbox/h_sandbox.dm @@ -105,7 +105,7 @@ mob hsb.loc = usr.loc to_chat(usr, "Sandbox: Created an airlock.") if("hsbcanister") - var/list/hsbcanisters = typesof(/obj/machinery/portable_atmospherics/canister/) - /obj/machinery/portable_atmospherics/canister/ + var/list/hsbcanisters = subtypesof(/obj/machinery/portable_atmospherics/canister) var/hsbcanister = tgui_input_list(usr, "Choose a canister to spawn:", "Sandbox", hsbcanisters) if(hsbcanister) new hsbcanister(usr.loc) diff --git a/code/game/gamemodes/technomancer/catalog.dm b/code/game/gamemodes/technomancer/catalog.dm index b403639ddc..539329da15 100644 --- a/code/game/gamemodes/technomancer/catalog.dm +++ b/code/game/gamemodes/technomancer/catalog.dm @@ -4,10 +4,10 @@ #define UTILITY_SPELLS "Utility" #define SUPPORT_SPELLS "Support" -var/list/all_technomancer_spells = typesof(/datum/technomancer/spell) - /datum/technomancer/spell -var/list/all_technomancer_equipment = typesof(/datum/technomancer/equipment) - /datum/technomancer/equipment -var/list/all_technomancer_consumables = typesof(/datum/technomancer/consumable) - /datum/technomancer/consumable -var/list/all_technomancer_assistance = typesof(/datum/technomancer/assistance) - /datum/technomancer/assistance +var/list/all_technomancer_spells = subtypesof(/datum/technomancer/spell) +var/list/all_technomancer_equipment = subtypesof(/datum/technomancer/equipment) +var/list/all_technomancer_consumables = subtypesof(/datum/technomancer/consumable) +var/list/all_technomancer_assistance = subtypesof(/datum/technomancer/assistance) /datum/technomancer var/name = "technomancer thing" diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index d54f3e6521..bd8edfcd8a 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -474,9 +474,8 @@ infected = "Gangrene Detected:" var/unknown_body = 0 - for(var/thing in e.implants) - var/obj/item/weapon/implant/I = thing - var/obj/item/device/nif/N = thing //VOREStation Add: NIFs + for(var/obj/item/weapon/implant/I as anything in e.implants) + var/obj/item/device/nif/N = I //VOREStation Add: NIFs if(istype(I) && I.known_implant) imp += "[I] implanted:" if(istype(N) && N.known_implant) //VOREStation Add: NIFs diff --git a/code/game/machinery/adv_med_vr.dm b/code/game/machinery/adv_med_vr.dm index e8ff59adc0..c4c1d93374 100644 --- a/code/game/machinery/adv_med_vr.dm +++ b/code/game/machinery/adv_med_vr.dm @@ -12,8 +12,7 @@ var/livingprey = 0 var/objectprey = 0 - for(var/belly in H.vore_organs) - var/obj/belly/B = belly + for(var/obj/belly/B as anything in H.vore_organs) for(var/C in B) if(ishuman(C)) humanprey++ diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index b3d315cbad..f079485f19 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -183,9 +183,8 @@ //Check if we still have the materials. var/coeff = (making.no_scale ? 1 : mat_efficiency) //stacks are unaffected by production coefficient - for(var/MAT in making.resources) - var/datum/material/used_material = MAT - var/amount_needed = making.resources[MAT] * coeff * multiplier + for(var/datum/material/used_material as anything in making.resources) + var/amount_needed = making.resources[used_material] * coeff * multiplier materials_used[used_material] = amount_needed if(LAZYLEN(materials_used)) diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index 58565ead6e..c15a9d1524 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -111,8 +111,7 @@ data["id_rank"] = modify && modify.assignment ? modify.assignment : "Unassigned" 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/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index b7ba4a4339..19ae206605 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -373,8 +373,7 @@ hook_vr("despawn", list(to_despawn, src)) if(isliving(to_despawn)) var/mob/living/L = to_despawn - for(var/belly in L.vore_organs) - var/obj/belly/B = belly + for(var/obj/belly/B as anything in L.vore_organs) for(var/mob/living/sub_L in B) despawn_occupant(sub_L) for(var/obj/item/W in B) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 02f80de642..e08c48caaf 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD //VOREStation Edit - Redone a lot of airlock things: /* - Specific department maintenance doors @@ -1534,3 +1535,3072 @@ About the new airlock wires panel: qdel(src) return TRUE return FALSE +||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt +//VOREStation Edit - Redone a lot of airlock things: +/* +- Specific department maintenance doors +- Named doors properly according to type +- Gave them default access levels with the access constants +- Improper'd all of the names in the new() +*/ + +/obj/machinery/door/airlock + name = "Airlock" + icon = 'icons/obj/doors/Doorint.dmi' + icon_state = "door_closed" + power_channel = ENVIRON + + explosion_resistance = 10 + + // Doors do their own stuff + bullet_vulnerability = 0 + + blocks_emissive = EMISSIVE_BLOCK_GENERIC // Not quite as nice as /tg/'s custom masks. We should make those sometime + + var/aiControlDisabled = 0 //If 1, AI control is disabled until the AI hacks back in and disables the lock. If 2, the AI has bypassed the lock. If -1, the control is enabled but the AI had bypassed it earlier, so if it is disabled again the AI would have no trouble getting back in. + var/hackProof = 0 // if 1, this door can't be hacked by the AI + var/electrified_until = 0 //World time when the door is no longer electrified. -1 if it is permanently electrified until someone fixes it. + var/main_power_lost_until = 0 //World time when main power is restored. + var/backup_power_lost_until = -1 //World time when backup power is restored. + var/has_beeped = 0 //If 1, will not beep on failed closing attempt. Resets when door closes. + var/spawnPowerRestoreRunning = 0 + var/welded = null + var/locked = 0 + var/lights = 1 // bolt lights show by default + var/aiDisabledIdScanner = 0 + var/aiHacking = 0 + var/obj/machinery/door/airlock/closeOther = null + var/closeOtherId = null + var/lockdownbyai = 0 + autoclose = 1 + var/assembly_type = /obj/structure/door_assembly + var/mineral = null + var/justzap = 0 + var/safe = 1 + normalspeed = 1 + var/obj/item/weapon/airlock_electronics/electronics = null + var/hasShocked = 0 //Prevents multiple shocks from happening + var/secured_wires = 0 + var/datum/wires/airlock/wires = null + + var/open_sound_powered = 'sound/machines/door/covert1o.ogg' + var/open_sound_unpowered = 'sound/machines/door/airlockforced.ogg' + var/close_sound_powered = 'sound/machines/door/covert1c.ogg' + var/legacy_open_powered = 'sound/machines/door/old_airlock.ogg' + var/legacy_close_powered = 'sound/machines/door/old_airlockclose.ogg' + var/department_open_powered = null + var/department_close_powered = null + var/denied_sound = 'sound/machines/deniedbeep.ogg' + var/bolt_up_sound = 'sound/machines/door/boltsup.ogg' + var/bolt_down_sound = 'sound/machines/door/boltsdown.ogg' + +/obj/machinery/door/airlock/attack_generic(var/mob/living/user, var/damage) + if(stat & (BROKEN|NOPOWER)) + if(damage >= STRUCTURE_MIN_DAMAGE_THRESHOLD) + if(src.locked || src.welded) + visible_message("\The [user] begins breaking into \the [src] internals!") + user.set_AI_busy(TRUE) // If the mob doesn't have an AI attached, this won't do anything. + if(do_after(user,10 SECONDS,src)) + src.locked = 0 + src.welded = 0 + update_icon() + open(1) + if(prob(25)) + src.shock(user, 100) + user.set_AI_busy(FALSE) + else if(src.density) + visible_message("\The [user] forces \the [src] open!") + open(1) + else + visible_message("\The [user] forces \the [src] closed!") + close(1) + else + visible_message("\The [user] strains fruitlessly to force \the [src] [density ? "open" : "closed"].") + return + ..() + +/obj/machinery/door/airlock/attack_alien(var/mob/user) //Familiar, right? Doors. -Mechoid + if(istype(user, /mob/living/carbon/human)) + var/mob/living/carbon/human/X = user + if(istype(X.species, /datum/species/xenos)) + if(src.locked || src.welded) + visible_message("\The [user] begins tearing into \the [src] internals!") + src.do_animate("deny") + if(do_after(user,15 SECONDS,src)) + visible_message("\The [user] tears \the [src] open, sparks flying from its electronics!") + src.do_animate("spark") + playsound(src, 'sound/machines/door/airlock_tear_apart.ogg', 100, 1, volume_channel = VOLUME_CHANNEL_DOORS) + src.locked = 0 + src.welded = 0 + update_icon() + open(1) + src.set_broken() //These aren't emags, these be CLAWS + else if(src.density) + visible_message("\The [user] begins forcing \the [src] open!") + if(do_after(user, 5 SECONDS,src)) + playsound(src, 'sound/machines/door/airlock_creaking.ogg', 100, 1, volume_channel = VOLUME_CHANNEL_DOORS) + visible_message("\The [user] forces \the [src] open!") + open(1) + else + visible_message("\The [user] forces \the [src] closed!") + close(1) + else + src.do_animate("deny") + visible_message("\The [user] strains fruitlessly to force \the [src] [density ? "open" : "closed"].") + return + ..() + +/obj/machinery/door/airlock/get_material() + if(mineral) + return get_material_by_name(mineral) + return get_material_by_name(MAT_STEEL) + +/obj/machinery/door/airlock/command + name = "Command Airlock" + icon = 'icons/obj/doors/Doorcom.dmi' + req_one_access = list(access_heads) + assembly_type = /obj/structure/door_assembly/door_assembly_com + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cmd3o.ogg' + department_close_powered = 'sound/machines/door/cmd3c.ogg' + +/obj/machinery/door/airlock/security + name = "Security Airlock" + icon = 'icons/obj/doors/Doorsec.dmi' + req_one_access = list(access_security) + assembly_type = /obj/structure/door_assembly/door_assembly_sec + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sec1o.ogg' + department_close_powered = 'sound/machines/door/sec1c.ogg' + +/obj/machinery/door/airlock/engineering + name = "Engineering Airlock" + icon = 'icons/obj/doors/Dooreng.dmi' + req_one_access = list(access_engine) + assembly_type = /obj/structure/door_assembly/door_assembly_eng + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/engineeringatmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Doorengatmos.dmi' + req_one_access = list(access_atmospherics) + assembly_type = /obj/structure/door_assembly/door_assembly_eat + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/medical + name = "Medical Airlock" + icon = 'icons/obj/doors/Doormed.dmi' + req_one_access = list(access_medical) + assembly_type = /obj/structure/door_assembly/door_assembly_med + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/med1o.ogg' + department_close_powered = 'sound/machines/door/med1c.ogg' + +/obj/machinery/door/airlock/maintenance + name = "Maintenance Access" + icon = 'icons/obj/doors/Doormaint.dmi' + //req_one_access = list(access_maint_tunnels) //VOREStation Edit - Maintenance is open access + assembly_type = /obj/structure/door_assembly/door_assembly_mai + open_sound_powered = 'sound/machines/door/door2o.ogg' + close_sound_powered = 'sound/machines/door/door2c.ogg' + +/obj/machinery/door/airlock/maintenance/cargo + icon = 'icons/obj/doors/Doormaint_cargo.dmi' + req_one_access = list(access_cargo) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/door2o.ogg' + department_close_powered = 'sound/machines/door/door2c.ogg' + +/obj/machinery/door/airlock/maintenance/command + icon = 'icons/obj/doors/Doormaint_command.dmi' + req_one_access = list(access_heads) + +/obj/machinery/door/airlock/maintenance/common + icon = 'icons/obj/doors/Doormaint_common.dmi' + open_sound_powered = 'sound/machines/door/hall3o.ogg' + close_sound_powered = 'sound/machines/door/hall3c.ogg' + +/obj/machinery/door/airlock/maintenance/engi + icon = 'icons/obj/doors/Doormaint_engi.dmi' + req_one_access = list(access_engine) + +/obj/machinery/door/airlock/maintenance/int + icon = 'icons/obj/doors/Doormaint_int.dmi' + +/obj/machinery/door/airlock/maintenance/medical + icon = 'icons/obj/doors/Doormaint_med.dmi' + req_one_access = list(access_medical) + +/obj/machinery/door/airlock/maintenance/rnd + icon = 'icons/obj/doors/Doormaint_rnd.dmi' + req_one_access = list(access_research) + +/obj/machinery/door/airlock/maintenance/sec + icon = 'icons/obj/doors/Doormaint_sec.dmi' + req_one_access = list(access_security) + +/obj/machinery/door/airlock/external + name = "External Airlock" + icon = 'icons/obj/doors/Doorext.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_ext + open_sound_powered = 'sound/machines/door/space1o.ogg' + close_sound_powered = 'sound/machines/door/space1c.ogg' + +/obj/machinery/door/airlock/external/bolted + icon_state = "door_locked" // So it looks visibly bolted in map editor + locked = 1 + +// For convenience in making docking ports: one that is pre-bolted with frequency set! +/obj/machinery/door/airlock/external/bolted/cycling + frequency = 1379 + +/obj/machinery/door/airlock/glass_external + name = "External Airlock" + icon = 'icons/obj/doors/Doorextglass.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_ext + opacity = 0 + glass = 1 + req_one_access = list(access_external_airlocks) + open_sound_powered = 'sound/machines/door/space1o.ogg' + close_sound_powered = 'sound/machines/door/space1c.ogg' + +/obj/machinery/door/airlock/glass + name = "Glass Airlock" + icon = 'icons/obj/doors/Doorglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + open_sound_powered = 'sound/machines/door/hall1o.ogg' + close_sound_powered = 'sound/machines/door/hall1c.ogg' + legacy_open_powered = 'sound/machines/door/windowdoor.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + glass = 1 + +/obj/machinery/door/airlock/centcom + name = "Centcom Airlock" + icon = 'icons/obj/doors/Doorele.dmi' + req_one_access = list(access_cent_general) + opacity = 1 + open_sound_powered = 'sound/machines/door/cmd3o.ogg' + close_sound_powered = 'sound/machines/door/cmd3c.ogg' + +/obj/machinery/door/airlock/glass_centcom + name = "Airlock" + icon = 'icons/obj/doors/Dooreleglass.dmi' + opacity = 0 + glass = 1 + open_sound_powered = 'sound/machines/door/cmd3o.ogg' + close_sound_powered = 'sound/machines/door/cmd3c.ogg' + +/obj/machinery/door/airlock/vault + name = "Vault" + icon = 'icons/obj/doors/vault.dmi' + explosion_resistance = 20 + opacity = 1 + secured_wires = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_highsecurity //Until somebody makes better sprites. + req_one_access = list(access_heads_vault) + open_sound_powered = 'sound/machines/door/vault1o.ogg' + close_sound_powered = 'sound/machines/door/vault1c.ogg' + +/obj/machinery/door/airlock/vault/bolted + icon_state = "door_locked" + locked = 1 + +/obj/machinery/door/airlock/freezer + name = "Freezer Airlock" + icon = 'icons/obj/doors/Doorfreezer.dmi' + opacity = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_fre + +/obj/machinery/door/airlock/hatch + name = "Airtight Hatch" + icon = 'icons/obj/doors/Doorhatchele.dmi' + explosion_resistance = 20 + opacity = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_hatch + req_one_access = list(access_maint_tunnels) + open_sound_powered = 'sound/machines/door/hatchopen.ogg' + close_sound_powered = 'sound/machines/door/hatchclose.ogg' + open_sound_unpowered = 'sound/machines/door/hatchforced.ogg' + +/obj/machinery/door/airlock/maintenance_hatch + name = "Maintenance Hatch" + icon = 'icons/obj/doors/Doorhatchmaint2.dmi' + explosion_resistance = 20 + opacity = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_mhatch + req_one_access = list(access_maint_tunnels) + open_sound_powered = 'sound/machines/door/hatchopen.ogg' + close_sound_powered = 'sound/machines/door/hatchclose.ogg' + open_sound_unpowered = 'sound/machines/door/hatchforced.ogg' + +/obj/machinery/door/airlock/glass_command + name = "Command Airlock" + icon = 'icons/obj/doors/Doorcomglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_com + glass = 1 + req_one_access = list(access_heads) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cmd1o.ogg' + department_close_powered = 'sound/machines/door/cmd1c.ogg' + +/obj/machinery/door/airlock/glass_engineering + name = "Engineering Airlock" + icon = 'icons/obj/doors/Doorengglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_eng + glass = 1 + req_one_access = list(access_engine) + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/glass_engineeringatmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Doorengatmoglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_eat + glass = 1 + req_one_access = list(access_atmospherics) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/glass_security + name = "Security Airlock" + icon = 'icons/obj/doors/Doorsecglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_sec + glass = 1 + req_one_access = list(access_security) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sec1o.ogg' + department_close_powered = 'sound/machines/door/sec1c.ogg' + +/obj/machinery/door/airlock/glass_medical + name = "Medical Airlock" + icon = 'icons/obj/doors/Doormedglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_med + glass = 1 + req_one_access = list(access_medical) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/med1o.ogg' + department_close_powered = 'sound/machines/door/med1c.ogg' + +/obj/machinery/door/airlock/mining + name = "Mining Airlock" + icon = 'icons/obj/doors/Doormining.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_min + req_one_access = list(access_mining) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cgo1o.ogg' + department_close_powered = 'sound/machines/door/cgo1c.ogg' + +/obj/machinery/door/airlock/atmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Dooratmo.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_atmo + req_one_access = list(access_atmospherics) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/research + name = "Research Airlock" + icon = 'icons/obj/doors/Doorresearch.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_research + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/glass_research + name = "Research Airlock" + icon = 'icons/obj/doors/Doorresearchglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_research + glass = 1 + req_one_access = list(access_research) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/glass_mining + name = "Mining Airlock" + icon = 'icons/obj/doors/Doorminingglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_min + glass = 1 + req_one_access = list(access_mining) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cgo1o.ogg' + department_close_powered = 'sound/machines/door/cgo1c.ogg' + +/obj/machinery/door/airlock/glass_atmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Dooratmoglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_atmo + glass = 1 + req_one_access = list(access_atmospherics) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/gold + name = "Gold Airlock" + icon = 'icons/obj/doors/Doorgold.dmi' + mineral = "gold" + +/obj/machinery/door/airlock/silver + name = "Silver Airlock" + icon = 'icons/obj/doors/Doorsilver.dmi' + mineral = "silver" + +/obj/machinery/door/airlock/diamond + name = "Diamond Airlock" + icon = 'icons/obj/doors/Doordiamond.dmi' + mineral = "diamond" + +/obj/machinery/door/airlock/uranium + name = "Uranium Airlock" + desc = "And they said I was crazy." + icon = 'icons/obj/doors/Dooruranium.dmi' + mineral = "uranium" + var/last_event = 0 + var/rad_power = 7.5 + +/obj/machinery/door/airlock/process() + // Deliberate no call to parent. + if(main_power_lost_until > 0 && world.time >= main_power_lost_until) + regainMainPower() + + if(backup_power_lost_until > 0 && world.time >= backup_power_lost_until) + regainBackupPower() + + else if(electrified_until > 0 && world.time >= electrified_until) + electrify(0) + + if (..() == PROCESS_KILL && !(main_power_lost_until > 0 || backup_power_lost_until > 0 || electrified_until > 0)) + . = PROCESS_KILL + +/obj/machinery/door/airlock/uranium/process() + if(world.time > last_event+20) + if(prob(50)) + SSradiation.radiate(src, rad_power) + last_event = world.time + ..() + +/obj/machinery/door/airlock/phoron + name = "Phoron Airlock" + desc = "No way this can end badly." + icon = 'icons/obj/doors/Doorphoron.dmi' + mineral = "phoron" + +/obj/machinery/door/airlock/phoron/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) + if(exposed_temperature > 300) + PhoronBurn(exposed_temperature) + +/obj/machinery/door/airlock/phoron/proc/ignite(exposed_temperature) + if(exposed_temperature > 300) + PhoronBurn(exposed_temperature) + +/obj/machinery/door/airlock/phoron/proc/PhoronBurn(temperature) + for(var/turf/simulated/floor/target_tile in range(2,loc)) + target_tile.assume_gas("phoron", 35, 400+T0C) + spawn (0) target_tile.hotspot_expose(temperature, 400) + for(var/turf/simulated/wall/W in range(3,src)) + W.burn((temperature/4))//Added so that you can't set off a massive chain reaction with a small flame + for(var/obj/machinery/door/airlock/phoron/D in range(3,src)) + D.ignite(temperature/4) + new/obj/structure/door_assembly( src.loc ) + qdel(src) + +/obj/machinery/door/airlock/sandstone + name = "Sandstone Airlock" + icon = 'icons/obj/doors/Doorsand.dmi' + mineral = "sandstone" + +/obj/machinery/door/airlock/science + name = "Research Airlock" + icon = 'icons/obj/doors/Doorsci.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_science + req_one_access = list(access_research) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/glass_science + name = "Glass Airlocks" + icon = 'icons/obj/doors/Doorsciglass.dmi' + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_science + glass = 1 + req_one_access = list(access_research) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/highsecurity + name = "Secure Airlock" + icon = 'icons/obj/doors/hightechsecurity.dmi' + explosion_resistance = 20 + secured_wires = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_highsecurity + req_one_access = list(access_heads_vault) + open_sound_powered = 'sound/machines/door/secure1o.ogg' + close_sound_powered = 'sound/machines/door/secure1c.ogg' + +/obj/machinery/door/airlock/voidcraft + name = "voidcraft hatch" + desc = "It's an extra resilient airlock intended for spacefaring vessels." + icon = 'icons/obj/doors/shuttledoors.dmi' + explosion_resistance = 20 + opacity = 0 + glass = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_voidcraft + open_sound_powered = 'sound/machines/door/shuttle1o.ogg' + close_sound_powered = 'sound/machines/door/shuttle1c.ogg' + +// Airlock opens from top-bottom instead of left-right. +/obj/machinery/door/airlock/voidcraft/vertical + icon = 'icons/obj/doors/shuttledoors_vertical.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_voidcraft/vertical + open_sound_powered = 'sound/machines/door/shuttle1o.ogg' + close_sound_powered = 'sound/machines/door/shuttle1c.ogg' + + +/datum/category_item/catalogue/anomalous/precursor_a/alien_airlock + name = "Precursor Alpha Object - Doors" + desc = "This object appears to be used in order to restrict or allow access to \ + rooms based on its physical state. In other words, a door. \ + Despite being designed and created by unknown ancient alien hands, this door has \ + a large number of similarities to the conventional airlock, such as being driven by \ + electricity, opening and closing by physically moving, and being air tight. \ + It also operates by responding to signals through internal electrical conduits. \ + These characteristics make it possible for one with experience with a multitool \ + to manipulate the door.\ +

\ + The symbol on the door does not match any living species' patterns, giving further \ + implications that this door is very old, and yet it remains operational after \ + thousands of years. It is unknown if that is due to superb construction, or \ + unseen autonomous maintenance having been performed." + value = CATALOGUER_REWARD_EASY + +/obj/machinery/door/airlock/alien + name = "alien airlock" + desc = "You're fairly sure this is a door." + catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_airlock) + icon = 'icons/obj/doors/Dooralien.dmi' + explosion_resistance = 20 + secured_wires = TRUE + hackProof = TRUE + assembly_type = /obj/structure/door_assembly/door_assembly_alien + req_one_access = list(access_alien) + +/obj/machinery/door/airlock/alien/locked + icon_state = "door_locked" + locked = TRUE + +/obj/machinery/door/airlock/alien/public // Entry to UFO. + req_one_access = list() + normalspeed = FALSE // So it closes faster and hopefully keeps the warm air inside. + hackProof = TRUE //VOREStation Edit - No borgos + +/* +About the new airlock wires panel: +* An airlock wire dialog can be accessed by the normal way or by using wirecutters or a multitool on the door while the wire-panel is open. This would show the following wires, which you can either wirecut/mend or send a multitool pulse through. There are 9 wires. +* one wire from the ID scanner. Sending a pulse through this flashes the red light on the door (if the door has power). If you cut this wire, the door will stop recognizing valid IDs. (If the door has 0000 access, it still opens and closes, though) +* two wires for power. Sending a pulse through either one causes a breaker to trip, disabling the door for 10 seconds if backup power is connected, or 1 minute if not (or until backup power comes back on, whichever is shorter). Cutting either one disables the main door power, but unless backup power is also cut, the backup power re-powers the door in 10 seconds. While unpowered, the door may be open, but bolts-raising will not work. Cutting these wires may electrocute the user. +* one wire for door bolts. Sending a pulse through this drops door bolts (whether the door is powered or not) or raises them (if it is). Cutting this wire also drops the door bolts, and mending it does not raise them. If the wire is cut, trying to raise the door bolts will not work. +* two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter). Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user. +* one wire for opening the door. Sending a pulse through this while the door has power makes it open the door if no access is required. +* one wire for AI control. Sending a pulse through this blocks AI control for a second or so (which is enough to see the AI control light on the panel dialog go off and back on again). Cutting this prevents the AI from controlling the door unless it has hacked the door through the power connection (which takes about a minute). If both main and backup power are cut, as well as this wire, then the AI cannot operate or hack the door at all. +* one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds. Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted. (Currently it is also STAYING electrified until someone mends the wire) +* one wire for controling door safetys. When active, door does not close on someone. When cut, door will ruin someone's shit. When pulsed, door will immedately ruin someone's shit. +* one wire for controlling door speed. When active, dor closes at normal rate. When cut, door does not close manually. When pulsed, door attempts to close every tick. +*/ + + + +/obj/machinery/door/airlock/bumpopen(mob/living/user as mob) //Airlocks now zap you when you 'bump' them open when they're electrified. --NeoFite + if(!issilicon(usr)) + if(src.isElectrified()) + if(!src.justzap) + if(src.shock(user, 100)) + src.justzap = 1 + spawn (10) + src.justzap = 0 + return + else /*if(src.justzap)*/ + return + else if(user.hallucination > 50 && prob(10) && src.operating == 0) + to_chat(user, "You feel a powerful shock course through your body!") + user.halloss += 10 + user.stunned += 10 + return + ..(user) + +/obj/machinery/door/airlock/proc/isElectrified() + if(src.electrified_until != 0) + return 1 + return 0 + +/obj/machinery/door/airlock/proc/canAIControl() + return ((src.aiControlDisabled!=1) && (!src.isAllPowerLoss())); + +/obj/machinery/door/airlock/proc/canAIHack() + return ((src.aiControlDisabled==1) && (!hackProof) && (!src.isAllPowerLoss())); + +/obj/machinery/door/airlock/proc/arePowerSystemsOn() + if (stat & (NOPOWER|BROKEN)) + return 0 + return (src.main_power_lost_until==0 || src.backup_power_lost_until==0) + +/obj/machinery/door/airlock/requiresID() + return !(wires.is_cut(WIRE_IDSCAN) || aiDisabledIdScanner) + +/obj/machinery/door/airlock/proc/isAllPowerLoss() + if(stat & (NOPOWER|BROKEN)) + return 1 + if(mainPowerCablesCut() && backupPowerCablesCut()) + return 1 + return 0 + +/obj/machinery/door/airlock/proc/mainPowerCablesCut() + return wires.is_cut(WIRE_MAIN_POWER1) || wires.is_cut(WIRE_MAIN_POWER2) + +/obj/machinery/door/airlock/proc/backupPowerCablesCut() + return wires.is_cut(WIRE_BACKUP_POWER1) || wires.is_cut(WIRE_BACKUP_POWER2) + +/obj/machinery/door/airlock/proc/loseMainPower() + main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + + // If backup power is permanently disabled then activate in 10 seconds if possible, otherwise it's already enabled or a timer is already running + if(backup_power_lost_until == -1 && !backupPowerCablesCut()) + backup_power_lost_until = world.time + SecondsToTicks(10) + + if(main_power_lost_until > 0 || backup_power_lost_until > 0) + START_MACHINE_PROCESSING(src) + + // Disable electricity if required + if(electrified_until && isAllPowerLoss()) + electrify(0) + + update_icon() + +/obj/machinery/door/airlock/proc/loseBackupPower() + backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + + if(backup_power_lost_until > 0) + START_MACHINE_PROCESSING(src) + + // Disable electricity if required + if(electrified_until && isAllPowerLoss()) + electrify(0) + + update_icon() + +/obj/machinery/door/airlock/proc/regainMainPower() + if(!mainPowerCablesCut()) + main_power_lost_until = 0 + // If backup power is currently active then disable, otherwise let it count down and disable itself later + if(!backup_power_lost_until) + backup_power_lost_until = -1 + + update_icon() + +/obj/machinery/door/airlock/proc/regainBackupPower() + if(!backupPowerCablesCut()) + // Restore backup power only if main power is offline, otherwise permanently disable + backup_power_lost_until = main_power_lost_until == 0 ? -1 : 0 + + update_icon() + +/obj/machinery/door/airlock/proc/electrify(var/duration, var/feedback = 0) + var/message = "" + if(wires.is_cut(WIRE_ELECTRIFY) && arePowerSystemsOn()) + message = text("The electrification wire is cut - Door permanently electrified.") + src.electrified_until = -1 + else if(duration && !arePowerSystemsOn()) + message = text("The door is unpowered - Cannot electrify the door.") + src.electrified_until = 0 + else if(!duration && electrified_until != 0) + message = "The door is now un-electrified." + src.electrified_until = 0 + else if(duration) //electrify door for the given duration seconds + if(usr) + shockedby += text("\[[time_stamp()]\] - [usr](ckey:[usr.ckey])") + add_attack_logs(usr,name,"Electrified a door") + else + shockedby += text("\[[time_stamp()]\] - EMP)") + message = "The door is now electrified [duration == -1 ? "permanently" : "for [duration] second\s"]." + src.electrified_until = duration == -1 ? -1 : world.time + SecondsToTicks(duration) + + if(electrified_until > 0) + START_MACHINE_PROCESSING(src) + + if(feedback && message) + to_chat(usr,message) + +/obj/machinery/door/airlock/proc/set_idscan(var/activate, var/feedback = 0) + var/message = "" + if(wires.is_cut(WIRE_IDSCAN)) + message = "The IdScan wire is cut - IdScan feature permanently disabled." + else if(activate && src.aiDisabledIdScanner) + src.aiDisabledIdScanner = 0 + message = "IdScan feature has been enabled." + else if(!activate && !src.aiDisabledIdScanner) + src.aiDisabledIdScanner = 1 + message = "IdScan feature has been disabled." + + if(feedback && message) + to_chat(usr,message) + +/obj/machinery/door/airlock/proc/set_safeties(var/activate, var/feedback = 0) + var/message = "" + // Safeties! We don't need no stinking safeties! + if (wires.is_cut(WIRE_SAFETY)) + message = text("The safety wire is cut - Cannot enable safeties.") + else if (!activate && src.safe) + safe = 0 + else if (activate && !src.safe) + safe = 1 + + if(feedback && message) + to_chat(usr,message) + +// shock user with probability prb (if all connections & power are working) +// returns 1 if shocked, 0 otherwise +// The preceding comment was borrowed from the grille's shock script +/obj/machinery/door/airlock/shock(mob/user, prb) + if(!arePowerSystemsOn()) + return 0 + if(hasShocked) + return 0 //Already shocked someone recently? + if(..()) + hasShocked = 1 + sleep(10) + hasShocked = 0 + return 1 + else + return 0 + + +/obj/machinery/door/airlock/update_icon() + cut_overlays() + if(density) + if(locked && lights && src.arePowerSystemsOn()) + icon_state = "door_locked" + else + icon_state = "door_closed" + if(p_open || welded) + if(p_open) + add_overlay("panel_open") + if (!(stat & NOPOWER)) + if(stat & BROKEN) + add_overlay("sparks_broken") + else if (health < maxhealth * 3/4) + add_overlay("sparks_damaged") + if(welded) + add_overlay("welded") + else if (health < maxhealth * 3/4 && !(stat & NOPOWER)) + add_overlay("sparks_damaged") + else + icon_state = "door_open" + if((stat & BROKEN) && !(stat & NOPOWER)) + add_overlay("sparks_open") + return + +/obj/machinery/door/airlock/do_animate(animation) + switch(animation) + if("opening") + cut_overlay() + if(p_open) + spawn(2) // The only work around that works. Downside is that the door will be gone for a millisecond. + flick("o_door_opening", src) //can not use flick due to BYOND bug updating overlays right before flicking + update_icon() + else + flick("door_opening", src)//[stat ? "_stat":] + update_icon() + if("closing") + cut_overlay() + if(p_open) + spawn(2) + flick("o_door_closing", src) + update_icon() + else + flick("door_closing", src) + update_icon() + if("spark") + if(density) + flick("door_spark", src) + if("deny") + if(density && src.arePowerSystemsOn()) + flick("door_deny", src) + playsound(src, denied_sound, 50, 0, 3) + return + +/obj/machinery/door/airlock/attack_ai(mob/user as mob) + tgui_interact(user) + +/obj/machinery/door/airlock/attack_ghost(mob/user) + tgui_interact(user) + +/obj/machinery/door/airlock/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, datum/tgui_state/custom_state) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "AiAirlock", name) + ui.open() + if(custom_state) + ui.set_state(custom_state) + return TRUE + +/obj/machinery/door/airlock/tgui_data(mob/user) + var/list/data = list() + + var/list/power = list() + power["main"] = main_power_lost_until > 0 ? 0 : 2 + power["main_timeleft"] = round(main_power_lost_until > 0 ? max(main_power_lost_until - world.time, 0) / 10 : main_power_lost_until, 1) + power["backup"] = backup_power_lost_until > 0 ? 0 : 2 + power["backup_timeleft"] = round(backup_power_lost_until > 0 ? max(backup_power_lost_until - world.time, 0) / 10 : backup_power_lost_until, 1) + data["power"] = power + + data["shock"] = (electrified_until == 0) ? 2 : 0 + data["shock_timeleft"] = round(electrified_until > 0 ? max(electrified_until - world.time, 0) / 10 : electrified_until, 1) + data["id_scanner"] = !aiDisabledIdScanner + data["locked"] = locked // bolted + data["lights"] = lights // bolt lights + data["safe"] = safe // safeties + data["speed"] = normalspeed // safe speed + data["welded"] = welded // welded + data["opened"] = !density // opened + + var/list/wire = list() + wire["main_1"] = !wires.is_cut(WIRE_MAIN_POWER1) + wire["main_2"] = !wires.is_cut(WIRE_MAIN_POWER2) + wire["backup_1"] = !wires.is_cut(WIRE_BACKUP_POWER1) + wire["backup_2"] = !wires.is_cut(WIRE_BACKUP_POWER2) + wire["shock"] = !wires.is_cut(WIRE_ELECTRIFY) + wire["id_scanner"] = !wires.is_cut(WIRE_IDSCAN) + wire["bolts"] = !wires.is_cut(WIRE_DOOR_BOLTS) + wire["lights"] = !wires.is_cut(WIRE_BOLT_LIGHT) + wire["safe"] = !wires.is_cut(WIRE_SAFETY) + wire["timing"] = !wires.is_cut(WIRE_SPEED) + + data["wires"] = wire + return data + +/obj/machinery/door/airlock/proc/hack(mob/user as mob) + if(src.aiHacking==0) + src.aiHacking=1 + spawn(20) + //TODO: Make this take a minute + to_chat(user, "Airlock AI control has been blocked. Beginning fault-detection.") + sleep(50) + if(src.canAIControl()) + to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") + src.aiHacking=0 + return + else if(!src.canAIHack(user)) + to_chat(user, "We've lost our connection! Unable to hack airlock.") + src.aiHacking=0 + return + to_chat(user, "Fault confirmed: airlock control wire disabled or cut.") + sleep(20) + to_chat(user, "Attempting to hack into airlock. This may take some time.") + sleep(200) + if(src.canAIControl()) + to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") + src.aiHacking=0 + return + else if(!src.canAIHack(user)) + to_chat(user, "We've lost our connection! Unable to hack airlock.") + src.aiHacking=0 + return + to_chat(user, "Upload access confirmed. Loading control program into airlock software.") + sleep(170) + if(src.canAIControl()) + to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") + src.aiHacking=0 + return + else if(!src.canAIHack(user)) + to_chat(user, "We've lost our connection! Unable to hack airlock.") + src.aiHacking=0 + return + to_chat(user, "Transfer complete. Forcing airlock to execute program.") + sleep(50) + //disable blocked control + src.aiControlDisabled = 2 + to_chat(user, "Receiving control information from airlock.") + sleep(10) + //bring up airlock dialog + src.aiHacking = 0 + if (user) + src.attack_ai(user) + +/obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target) + if (src.isElectrified()) + if (istype(mover, /obj/item)) + var/obj/item/i = mover + if (i.matter && (MAT_STEEL in i.matter) && i.matter[MAT_STEEL] > 0) + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() + return ..() + +/obj/machinery/door/airlock/attack_hand(mob/user as mob) + if(!istype(usr, /mob/living/silicon)) + if(src.isElectrified()) + if(src.shock(user, 100)) + return + + if(istype(user, /mob/living/carbon/human)) + var/mob/living/carbon/human/X = user + if(istype(X.species, /datum/species/xenos)) + src.attack_alien(user) + return + + if(src.p_open) + user.set_machine(src) + wires.Interact(user) + else + ..(user) + return + +/obj/machinery/door/airlock/tgui_act(action, params) + if(..()) + return TRUE + if(!user_allowed(usr)) + return TRUE + + switch(action) + if("disrupt-main") + if(!main_power_lost_until) + loseMainPower() + update_icon() + else + to_chat(usr, "Main power is already offline.") + . = TRUE + if("disrupt-backup") + if(!backup_power_lost_until) + loseBackupPower() + update_icon() + else + to_chat(usr, "Backup power is already offline.") + . = TRUE + if("shock-restore") + electrify(0, 1) + . = TRUE + if("shock-temp") + electrify(30, 1) + . = TRUE + if("shock-perm") + electrify(-1, 1) + . = TRUE + if("idscan-toggle") + set_idscan(aiDisabledIdScanner, 1) + . = TRUE + // if("emergency-toggle") + // toggle_emergency(usr) + // . = TRUE + if("bolt-toggle") + toggle_bolt(usr) + . = TRUE + if("light-toggle") + if(wires.is_cut(WIRE_BOLT_LIGHT)) + to_chat(usr, "The bolt lights wire is cut - The door bolt lights are permanently disabled.") + return + lights = !lights + update_icon() + . = TRUE + if("safe-toggle") + set_safeties(!safe, 1) + . = TRUE + if("speed-toggle") + if(wires.is_cut(WIRE_SPEED)) + to_chat(usr, "The timing wire is cut - Cannot alter timing.") + return + normalspeed = !normalspeed + . = TRUE + if("open-close") + user_toggle_open(usr) + . = TRUE + + update_icon() + return 1 + +/obj/machinery/door/airlock/proc/user_allowed(mob/user) + var/allowed = (issilicon(user) && canAIControl(user)) + if(!allowed && isobserver(user)) + var/mob/observer/dead/D = user + if(D.can_admin_interact()) + allowed = TRUE + return allowed + +/obj/machinery/door/airlock/proc/toggle_bolt(mob/user) + if(!user_allowed(user)) + return + if(wires.is_cut(WIRE_DOOR_BOLTS)) + to_chat(user, "The door bolt drop wire is cut - you can't toggle the door bolts.") + return + if(locked) + if(!arePowerSystemsOn()) + to_chat(user, "The door has no power - you can't raise the door bolts.") + else + unlock() + to_chat(user, "The door bolts have been raised.") + // log_combat(user, src, "unbolted") + else + lock() + to_chat(user, "The door bolts have been dropped.") + // log_combat(user, src, "bolted") + +/obj/machinery/door/airlock/proc/user_toggle_open(mob/user) + if(!user_allowed(user)) + return + if(welded) + to_chat(user, text("The airlock has been welded shut!")) + else if(locked) + to_chat(user, text("The door bolts are down!")) + else if(!density) + close() + else + open() + +/obj/machinery/door/airlock/proc/can_remove_electronics() + return src.p_open && (operating < 0 || (!operating && welded && !src.arePowerSystemsOn() && density && (!src.locked || (stat & BROKEN)))) + +/obj/machinery/door/airlock/attackby(obj/item/C, mob/user as mob) + //to_world("airlock attackby src [src] obj [C] mob [user]") + if(!istype(usr, /mob/living/silicon)) + if(src.isElectrified()) + if(src.shock(user, 75)) + return + if(istype(C, /obj/item/taperoll)) + return + + src.add_fingerprint(user) + if (attempt_vr(src,"attackby_vr",list(C, user))) return + if(istype(C, /mob/living)) + ..() + return + if(!repairing && istype(C, /obj/item/weapon/weldingtool) && !( src.operating > 0 ) && src.density) + var/obj/item/weapon/weldingtool/W = C + if(W.remove_fuel(0,user)) + if(!src.welded) + src.welded = 1 + else + src.welded = null + playsound(src, C.usesound, 75, 1) + src.update_icon() + return + else + return + else if(C.is_screwdriver()) + if (src.p_open) + if (stat & BROKEN) + to_chat(usr, "The panel is broken and cannot be closed.") + else + src.p_open = 0 + playsound(src, C.usesound, 50, 1) + else + src.p_open = 1 + playsound(src, C.usesound, 50, 1) + src.update_icon() + else if(C.is_wirecutter()) + return src.attack_hand(user) + else if(istype(C, /obj/item/device/multitool)) + return src.attack_hand(user) + else if(istype(C, /obj/item/device/assembly/signaler)) + return src.attack_hand(user) + else if(istype(C, /obj/item/weapon/pai_cable)) // -- TLE + var/obj/item/weapon/pai_cable/cable = C + cable.plugin(src, user) + else if(!repairing && C.is_crowbar()) + if(can_remove_electronics()) + playsound(src, C.usesound, 75, 1) + user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to remove electronics from the airlock assembly.") + if(do_after(user,40 * C.toolspeed)) + to_chat(user, "You removed the airlock electronics!") + + var/obj/structure/door_assembly/da = new assembly_type(src.loc) + if (istype(da, /obj/structure/door_assembly/multi_tile)) + da.set_dir(src.dir) + + da.anchored = TRUE + if(mineral) + da.glass = mineral + //else if(glass) + else if(glass && !da.glass) + da.glass = 1 + da.state = 1 + da.created_name = src.name + da.update_state() + + if(operating == -1 || (stat & BROKEN)) + new /obj/item/weapon/circuitboard/broken(src.loc) + operating = 0 + else + if (!electronics) create_electronics() + + electronics.loc = src.loc + electronics = null + + qdel(src) + return + else if(arePowerSystemsOn()) + to_chat(user, "The airlock's motors resist your efforts to force it.") + else if(locked) + to_chat(user, "The airlock's bolts prevent it from being forced.") + else + if(density) + spawn(0) open(1) + else + spawn(0) close(1) + + // Check if we're using a crowbar or armblade, and if the airlock's unpowered for whatever reason (off, broken, etc). + else if(istype(C, /obj/item/weapon)) + var/obj/item/weapon/W = C + if((W.pry == 1) && !arePowerSystemsOn()) + if(locked) + to_chat(user, "The airlock's bolts prevent it from being forced.") + else if( !welded && !operating ) + if(istype(C, /obj/item/weapon/material/twohanded/fireaxe)) // If this is a fireaxe, make sure it's held in two hands. + var/obj/item/weapon/material/twohanded/fireaxe/F = C + if(!F.wielded) + to_chat(user, "You need to be wielding \the [F] to do that.") + return + // At this point, it's an armblade or a fireaxe that passed the wielded test, let's try to open it. + if(density) + spawn(0) + open(1) + else + spawn(0) + close(1) + else + ..() + else + ..() + return + +/obj/machinery/door/airlock/phoron/attackby(C as obj, mob/user as mob) + if(C) + ignite(is_hot(C)) + ..() + +/obj/machinery/door/airlock/set_broken() + src.p_open = 1 + stat |= BROKEN + if (secured_wires) + lock() + for (var/mob/O in viewers(src, null)) + if ((O.client && !( O.blinded ))) + O.show_message("[src.name]'s control panel bursts open, sparks spewing out!") + + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() + + update_icon() + return + +/obj/machinery/door/airlock/open(var/forced=0) + if(!can_open(forced)) + return 0 + use_power(360) //360 W seems much more appropriate for an actuator moving an industrial door capable of crushing people + + //if the door is unpowered then it doesn't make sense to hear the woosh of a pneumatic actuator + for(var/P in player_list) + var/mob/M = P + if(!M || !M.client) + continue + var/old_sounds = M.client.is_preference_enabled(/datum/client_preference/old_door_sounds) + var/department_door_sounds = M.client.is_preference_enabled(/datum/client_preference/department_door_sounds) + var/sound + var/volume + if(old_sounds) // Do we have old sounds enabled? Play these even if we have department door sounds enabled. + if(arePowerSystemsOn()) + sound = legacy_open_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else if(!old_sounds && department_door_sounds && src.department_open_powered) // Else, we have old sounds disabled, the door has per-department door sounds, and we have chosen to play department door sounds, use these. + if(arePowerSystemsOn()) + sound = department_open_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else // Else, play these. + if(arePowerSystemsOn()) + sound = open_sound_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + + var/turf/T = get_turf(M) + var/distance = get_dist(T, get_turf(src)) + if(distance <= world.view * 2) + if(T && T.z == get_z(src)) + M.playsound_local(get_turf(src), sound, volume, 1, null, 0, TRUE, sound(sound), volume_channel = VOLUME_CHANNEL_DOORS) + + if(src.closeOther != null && istype(src.closeOther, /obj/machinery/door/airlock/) && !src.closeOther.density) + src.closeOther.close() + return ..() + +/obj/machinery/door/airlock/can_open(var/forced=0) + if(!forced) + if(!arePowerSystemsOn() || wires.is_cut(WIRE_OPEN_DOOR)) + return 0 + + if(locked || welded) + return 0 + return ..() + +/obj/machinery/door/airlock/can_close(var/forced=0) + if(locked || welded) + return 0 + + if(!forced) + //despite the name, this wire is for general door control. + if(!arePowerSystemsOn() || wires.is_cut(WIRE_OPEN_DOOR)) + return 0 + + return ..() + +/atom/movable/proc/blocks_airlock() + return density + +/obj/machinery/door/blocks_airlock() + return 0 + +/obj/machinery/mech_sensor/blocks_airlock() + return 0 + +/mob/living/blocks_airlock() + return 1 + +/atom/movable/proc/airlock_crush(var/crush_damage) + return 0 + +/obj/machinery/portable_atmospherics/canister/airlock_crush(var/crush_damage) + . = ..() + health -= crush_damage + healthcheck() + +/obj/effect/energy_field/airlock_crush(var/crush_damage) + adjust_strength(crush_damage) + +/obj/structure/closet/airlock_crush(var/crush_damage) + ..() + damage(crush_damage) + for(var/atom/movable/AM in src) + AM.airlock_crush() + return 1 + +/mob/living/airlock_crush(var/crush_damage) + . = ..() + adjustBruteLoss(crush_damage) + SetStunned(5) + SetWeakened(5) + var/turf/T = get_turf(src) + T.add_blood(src) + return 1 + +/mob/living/carbon/airlock_crush(var/crush_damage) + . = ..() + if(can_feel_pain()) + emote("scream") + +/mob/living/silicon/robot/airlock_crush(var/crush_damage) + adjustBruteLoss(crush_damage) + return 0 + +/obj/machinery/door/airlock/close(var/forced=0) + if(!can_close(forced)) + return 0 + + if(safe) + for(var/turf/turf in locs) + for(var/atom/movable/AM in turf) + if(AM.blocks_airlock()) + if(!has_beeped) + playsound(src, 'sound/machines/buzz-two.ogg', 50, 0) + has_beeped = 1 + autoclose_in(6) + return + + for(var/turf/turf in locs) + for(var/atom/movable/AM in turf) + if(AM.airlock_crush(DOOR_CRUSH_DAMAGE)) + take_damage(DOOR_CRUSH_DAMAGE) + + use_power(360) //360 W seems much more appropriate for an actuator moving an industrial door capable of crushing people + has_beeped = 0 + for(var/P in player_list) + var/mob/M = P + if(!M || !M.client) + continue + var/old_sounds = M.client.is_preference_enabled(/datum/client_preference/old_door_sounds) + var/department_door_sounds = M.client.is_preference_enabled(/datum/client_preference/department_door_sounds) + var/sound + var/volume + if(old_sounds) + if(arePowerSystemsOn()) + sound = legacy_close_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else if(!old_sounds && department_door_sounds && src.department_close_powered) // Else, we have old sounds disabled, the door has per-department door sounds, and we have chosen to play department door sounds, use these. + if(arePowerSystemsOn()) + sound = department_close_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else + if(arePowerSystemsOn()) + sound = close_sound_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + + var/turf/T = get_turf(M) + var/distance = get_dist(T, get_turf(src)) + if(distance <= world.view * 2) + if(T && T.z == get_z(src)) + M.playsound_local(get_turf(src), sound, volume, 1, null, 0, TRUE, sound(sound), volume_channel = VOLUME_CHANNEL_DOORS) + for(var/turf/turf in locs) + var/obj/structure/window/killthis = (locate(/obj/structure/window) in turf) + if(killthis) + killthis.ex_act(2)//Smashin windows + return ..() + +/obj/machinery/door/airlock/proc/lock(var/forced=0) + if(locked) + return 0 + + if (operating && !forced) return 0 + + src.locked = 1 + playsound(src, bolt_down_sound, 30, 0, 3, volume_channel = VOLUME_CHANNEL_DOORS) + for(var/mob/M in range(1,src)) + M.show_message("You hear a click from the bottom of the door.", 2) + update_icon() + return 1 + +/obj/machinery/door/airlock/proc/unlock(var/forced=0) + if(!src.locked) + return + + if (!forced) + if(operating || !src.arePowerSystemsOn() || wires.is_cut(WIRE_DOOR_BOLTS)) return + + src.locked = 0 + playsound(src, bolt_up_sound, 30, 0, 3, volume_channel = VOLUME_CHANNEL_DOORS) + for(var/mob/M in range(1,src)) + M.show_message("You hear a click from the bottom of the door.", 2) + update_icon() + return 1 + +/obj/machinery/door/airlock/allowed(mob/M) + if(locked) + return 0 + return ..(M) + +/obj/machinery/door/airlock/New(var/newloc, var/obj/structure/door_assembly/assembly=null) + ..() + + //if assembly is given, create the new door from the assembly + if (assembly && istype(assembly)) + assembly_type = assembly.type + + electronics = assembly.electronics + electronics.loc = src + + //update the door's access to match the electronics' + secured_wires = electronics.secure + if(electronics.one_access) + LAZYCLEARLIST(req_access) + req_one_access = src.electronics.conf_access + else + LAZYCLEARLIST(req_one_access) + req_access = src.electronics.conf_access + + //get the name from the assembly + if(assembly.created_name) + name = assembly.created_name + else + name = "[istext(assembly.glass) ? "[assembly.glass] airlock" : assembly.base_name]" + + //get the dir from the assembly + set_dir(assembly.dir) + + //wires + var/turf/T = get_turf(newloc) + if(T && (T.z in using_map.admin_levels)) + secured_wires = 1 + if (secured_wires) + wires = new/datum/wires/airlock/secure(src) + else + wires = new/datum/wires/airlock(src) + +/obj/machinery/door/airlock/Initialize() + if(src.closeOtherId != null) + for (var/obj/machinery/door/airlock/A in machines) + if(A.closeOtherId == src.closeOtherId && A != src) + src.closeOther = A + break + name = "\improper [name]" + . = ..() + +/obj/machinery/door/airlock/Destroy() + qdel(wires) + wires = null + return ..() + +// Most doors will never be deconstructed over the course of a round, +// so as an optimization defer the creation of electronics until +// the airlock is deconstructed +/obj/machinery/door/airlock/proc/create_electronics() + //create new electronics + if (secured_wires) + src.electronics = new/obj/item/weapon/airlock_electronics/secure( src.loc ) + else + src.electronics = new/obj/item/weapon/airlock_electronics( src.loc ) + + //update the electronics to match the door's access + if(LAZYLEN(req_access)) + electronics.conf_access = req_access + else if (LAZYLEN(req_one_access)) + electronics.conf_access = req_one_access + electronics.one_access = 1 + +/obj/machinery/door/airlock/emp_act(var/severity) + if(prob(40/severity)) + var/duration = world.time + SecondsToTicks(30 / severity) + if(duration > electrified_until) + electrify(duration) + ..() + +/obj/machinery/door/airlock/power_change() //putting this is obj/machinery/door itself makes non-airlock doors turn invisible for some reason + ..() + if(stat & NOPOWER) + // If we lost power, disable electrification + // Keeping door lights on, runs on internal battery or something. + electrified_until = 0 + update_icon() + +/obj/machinery/door/airlock/proc/prison_open() + if(arePowerSystemsOn()) + src.unlock() + src.open() + src.lock() + return + + +/obj/machinery/door/airlock/rcd_values(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode) + switch(passed_mode) + if(RCD_DECONSTRUCT) + // Old RCD code made it cost 10 units to decon an airlock. + // Now the new one costs ten "sheets". + return list( + RCD_VALUE_MODE = RCD_DECONSTRUCT, + RCD_VALUE_DELAY = 5 SECONDS, + RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 10 + ) + return FALSE + +/obj/machinery/door/airlock/rcd_act(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode) + switch(passed_mode) + if(RCD_DECONSTRUCT) + to_chat(user, span("notice", "You deconstruct \the [src].")) + qdel(src) + return TRUE + return FALSE +======= +//VOREStation Edit - Redone a lot of airlock things: +/* +- Specific department maintenance doors +- Named doors properly according to type +- Gave them default access levels with the access constants +- Improper'd all of the names in the new() +*/ + +/obj/machinery/door/airlock + name = "Airlock" + icon = 'icons/obj/doors/Doorint.dmi' + icon_state = "door_closed" + power_channel = ENVIRON + + explosion_resistance = 10 + + // Doors do their own stuff + bullet_vulnerability = 0 + + blocks_emissive = EMISSIVE_BLOCK_GENERIC // Not quite as nice as /tg/'s custom masks. We should make those sometime + + var/aiControlDisabled = 0 //If 1, AI control is disabled until the AI hacks back in and disables the lock. If 2, the AI has bypassed the lock. If -1, the control is enabled but the AI had bypassed it earlier, so if it is disabled again the AI would have no trouble getting back in. + var/hackProof = 0 // if 1, this door can't be hacked by the AI + var/electrified_until = 0 //World time when the door is no longer electrified. -1 if it is permanently electrified until someone fixes it. + var/main_power_lost_until = 0 //World time when main power is restored. + var/backup_power_lost_until = -1 //World time when backup power is restored. + var/has_beeped = 0 //If 1, will not beep on failed closing attempt. Resets when door closes. + var/spawnPowerRestoreRunning = 0 + var/welded = null + var/locked = 0 + var/lights = 1 // bolt lights show by default + var/aiDisabledIdScanner = 0 + var/aiHacking = 0 + var/obj/machinery/door/airlock/closeOther = null + var/closeOtherId = null + var/lockdownbyai = 0 + autoclose = 1 + var/assembly_type = /obj/structure/door_assembly + var/mineral = null + var/justzap = 0 + var/safe = 1 + normalspeed = 1 + var/obj/item/weapon/airlock_electronics/electronics = null + var/hasShocked = 0 //Prevents multiple shocks from happening + var/secured_wires = 0 + var/datum/wires/airlock/wires = null + + var/open_sound_powered = 'sound/machines/door/covert1o.ogg' + var/open_sound_unpowered = 'sound/machines/door/airlockforced.ogg' + var/close_sound_powered = 'sound/machines/door/covert1c.ogg' + var/legacy_open_powered = 'sound/machines/door/old_airlock.ogg' + var/legacy_close_powered = 'sound/machines/door/old_airlockclose.ogg' + var/department_open_powered = null + var/department_close_powered = null + var/denied_sound = 'sound/machines/deniedbeep.ogg' + var/bolt_up_sound = 'sound/machines/door/boltsup.ogg' + var/bolt_down_sound = 'sound/machines/door/boltsdown.ogg' + +/obj/machinery/door/airlock/attack_generic(var/mob/living/user, var/damage) + if(stat & (BROKEN|NOPOWER)) + if(damage >= STRUCTURE_MIN_DAMAGE_THRESHOLD) + if(src.locked || src.welded) + visible_message("\The [user] begins breaking into \the [src] internals!") + user.set_AI_busy(TRUE) // If the mob doesn't have an AI attached, this won't do anything. + if(do_after(user,10 SECONDS,src)) + src.locked = 0 + src.welded = 0 + update_icon() + open(1) + if(prob(25)) + src.shock(user, 100) + user.set_AI_busy(FALSE) + else if(src.density) + visible_message("\The [user] forces \the [src] open!") + open(1) + else + visible_message("\The [user] forces \the [src] closed!") + close(1) + else + visible_message("\The [user] strains fruitlessly to force \the [src] [density ? "open" : "closed"].") + return + ..() + +/obj/machinery/door/airlock/attack_alien(var/mob/user) //Familiar, right? Doors. -Mechoid + if(istype(user, /mob/living/carbon/human)) + var/mob/living/carbon/human/X = user + if(istype(X.species, /datum/species/xenos)) + if(src.locked || src.welded) + visible_message("\The [user] begins tearing into \the [src] internals!") + src.do_animate("deny") + if(do_after(user,15 SECONDS,src)) + visible_message("\The [user] tears \the [src] open, sparks flying from its electronics!") + src.do_animate("spark") + playsound(src, 'sound/machines/door/airlock_tear_apart.ogg', 100, 1, volume_channel = VOLUME_CHANNEL_DOORS) + src.locked = 0 + src.welded = 0 + update_icon() + open(1) + src.set_broken() //These aren't emags, these be CLAWS + else if(src.density) + visible_message("\The [user] begins forcing \the [src] open!") + if(do_after(user, 5 SECONDS,src)) + playsound(src, 'sound/machines/door/airlock_creaking.ogg', 100, 1, volume_channel = VOLUME_CHANNEL_DOORS) + visible_message("\The [user] forces \the [src] open!") + open(1) + else + visible_message("\The [user] forces \the [src] closed!") + close(1) + else + src.do_animate("deny") + visible_message("\The [user] strains fruitlessly to force \the [src] [density ? "open" : "closed"].") + return + ..() + +/obj/machinery/door/airlock/get_material() + if(mineral) + return get_material_by_name(mineral) + return get_material_by_name(MAT_STEEL) + +/obj/machinery/door/airlock/command + name = "Command Airlock" + icon = 'icons/obj/doors/Doorcom.dmi' + req_one_access = list(access_heads) + assembly_type = /obj/structure/door_assembly/door_assembly_com + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cmd3o.ogg' + department_close_powered = 'sound/machines/door/cmd3c.ogg' + +/obj/machinery/door/airlock/security + name = "Security Airlock" + icon = 'icons/obj/doors/Doorsec.dmi' + req_one_access = list(access_security) + assembly_type = /obj/structure/door_assembly/door_assembly_sec + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sec1o.ogg' + department_close_powered = 'sound/machines/door/sec1c.ogg' + +/obj/machinery/door/airlock/engineering + name = "Engineering Airlock" + icon = 'icons/obj/doors/Dooreng.dmi' + req_one_access = list(access_engine) + assembly_type = /obj/structure/door_assembly/door_assembly_eng + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/engineeringatmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Doorengatmos.dmi' + req_one_access = list(access_atmospherics) + assembly_type = /obj/structure/door_assembly/door_assembly_eat + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/medical + name = "Medical Airlock" + icon = 'icons/obj/doors/Doormed.dmi' + req_one_access = list(access_medical) + assembly_type = /obj/structure/door_assembly/door_assembly_med + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/med1o.ogg' + department_close_powered = 'sound/machines/door/med1c.ogg' + +/obj/machinery/door/airlock/maintenance + name = "Maintenance Access" + icon = 'icons/obj/doors/Doormaint.dmi' + //req_one_access = list(access_maint_tunnels) //VOREStation Edit - Maintenance is open access + assembly_type = /obj/structure/door_assembly/door_assembly_mai + open_sound_powered = 'sound/machines/door/door2o.ogg' + close_sound_powered = 'sound/machines/door/door2c.ogg' + +/obj/machinery/door/airlock/maintenance/cargo + icon = 'icons/obj/doors/Doormaint_cargo.dmi' + req_one_access = list(access_cargo) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/door2o.ogg' + department_close_powered = 'sound/machines/door/door2c.ogg' + +/obj/machinery/door/airlock/maintenance/command + icon = 'icons/obj/doors/Doormaint_command.dmi' + req_one_access = list(access_heads) + +/obj/machinery/door/airlock/maintenance/common + icon = 'icons/obj/doors/Doormaint_common.dmi' + open_sound_powered = 'sound/machines/door/hall3o.ogg' + close_sound_powered = 'sound/machines/door/hall3c.ogg' + +/obj/machinery/door/airlock/maintenance/engi + icon = 'icons/obj/doors/Doormaint_engi.dmi' + req_one_access = list(access_engine) + +/obj/machinery/door/airlock/maintenance/int + icon = 'icons/obj/doors/Doormaint_int.dmi' + +/obj/machinery/door/airlock/maintenance/medical + icon = 'icons/obj/doors/Doormaint_med.dmi' + req_one_access = list(access_medical) + +/obj/machinery/door/airlock/maintenance/rnd + icon = 'icons/obj/doors/Doormaint_rnd.dmi' + req_one_access = list(access_research) + +/obj/machinery/door/airlock/maintenance/sec + icon = 'icons/obj/doors/Doormaint_sec.dmi' + req_one_access = list(access_security) + +/obj/machinery/door/airlock/external + name = "External Airlock" + icon = 'icons/obj/doors/Doorext.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_ext + open_sound_powered = 'sound/machines/door/space1o.ogg' + close_sound_powered = 'sound/machines/door/space1c.ogg' + +/obj/machinery/door/airlock/external/bolted + icon_state = "door_locked" // So it looks visibly bolted in map editor + locked = 1 + +// For convenience in making docking ports: one that is pre-bolted with frequency set! +/obj/machinery/door/airlock/external/bolted/cycling + frequency = 1379 + +/obj/machinery/door/airlock/glass_external + name = "External Airlock" + icon = 'icons/obj/doors/Doorextglass.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_ext + opacity = 0 + glass = 1 + req_one_access = list(access_external_airlocks) + open_sound_powered = 'sound/machines/door/space1o.ogg' + close_sound_powered = 'sound/machines/door/space1c.ogg' + +/obj/machinery/door/airlock/glass + name = "Glass Airlock" + icon = 'icons/obj/doors/Doorglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + open_sound_powered = 'sound/machines/door/hall1o.ogg' + close_sound_powered = 'sound/machines/door/hall1c.ogg' + legacy_open_powered = 'sound/machines/door/windowdoor.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + glass = 1 + +/obj/machinery/door/airlock/centcom + name = "Centcom Airlock" + icon = 'icons/obj/doors/Doorele.dmi' + req_one_access = list(access_cent_general) + opacity = 1 + open_sound_powered = 'sound/machines/door/cmd3o.ogg' + close_sound_powered = 'sound/machines/door/cmd3c.ogg' + +/obj/machinery/door/airlock/glass_centcom + name = "Airlock" + icon = 'icons/obj/doors/Dooreleglass.dmi' + opacity = 0 + glass = 1 + open_sound_powered = 'sound/machines/door/cmd3o.ogg' + close_sound_powered = 'sound/machines/door/cmd3c.ogg' + +/obj/machinery/door/airlock/vault + name = "Vault" + icon = 'icons/obj/doors/vault.dmi' + explosion_resistance = 20 + opacity = 1 + secured_wires = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_highsecurity //Until somebody makes better sprites. + req_one_access = list(access_heads_vault) + open_sound_powered = 'sound/machines/door/vault1o.ogg' + close_sound_powered = 'sound/machines/door/vault1c.ogg' + +/obj/machinery/door/airlock/vault/bolted + icon_state = "door_locked" + locked = 1 + +/obj/machinery/door/airlock/freezer + name = "Freezer Airlock" + icon = 'icons/obj/doors/Doorfreezer.dmi' + opacity = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_fre + +/obj/machinery/door/airlock/hatch + name = "Airtight Hatch" + icon = 'icons/obj/doors/Doorhatchele.dmi' + explosion_resistance = 20 + opacity = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_hatch + req_one_access = list(access_maint_tunnels) + open_sound_powered = 'sound/machines/door/hatchopen.ogg' + close_sound_powered = 'sound/machines/door/hatchclose.ogg' + open_sound_unpowered = 'sound/machines/door/hatchforced.ogg' + +/obj/machinery/door/airlock/maintenance_hatch + name = "Maintenance Hatch" + icon = 'icons/obj/doors/Doorhatchmaint2.dmi' + explosion_resistance = 20 + opacity = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_mhatch + req_one_access = list(access_maint_tunnels) + open_sound_powered = 'sound/machines/door/hatchopen.ogg' + close_sound_powered = 'sound/machines/door/hatchclose.ogg' + open_sound_unpowered = 'sound/machines/door/hatchforced.ogg' + +/obj/machinery/door/airlock/glass_command + name = "Command Airlock" + icon = 'icons/obj/doors/Doorcomglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_com + glass = 1 + req_one_access = list(access_heads) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cmd1o.ogg' + department_close_powered = 'sound/machines/door/cmd1c.ogg' + +/obj/machinery/door/airlock/glass_engineering + name = "Engineering Airlock" + icon = 'icons/obj/doors/Doorengglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_eng + glass = 1 + req_one_access = list(access_engine) + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/glass_engineeringatmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Doorengatmoglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_eat + glass = 1 + req_one_access = list(access_atmospherics) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/glass_security + name = "Security Airlock" + icon = 'icons/obj/doors/Doorsecglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_sec + glass = 1 + req_one_access = list(access_security) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sec1o.ogg' + department_close_powered = 'sound/machines/door/sec1c.ogg' + +/obj/machinery/door/airlock/glass_medical + name = "Medical Airlock" + icon = 'icons/obj/doors/Doormedglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_med + glass = 1 + req_one_access = list(access_medical) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/med1o.ogg' + department_close_powered = 'sound/machines/door/med1c.ogg' + +/obj/machinery/door/airlock/mining + name = "Mining Airlock" + icon = 'icons/obj/doors/Doormining.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_min + req_one_access = list(access_mining) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cgo1o.ogg' + department_close_powered = 'sound/machines/door/cgo1c.ogg' + +/obj/machinery/door/airlock/atmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Dooratmo.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_atmo + req_one_access = list(access_atmospherics) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/research + name = "Research Airlock" + icon = 'icons/obj/doors/Doorresearch.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_research + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/glass_research + name = "Research Airlock" + icon = 'icons/obj/doors/Doorresearchglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_research + glass = 1 + req_one_access = list(access_research) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/glass_mining + name = "Mining Airlock" + icon = 'icons/obj/doors/Doorminingglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_min + glass = 1 + req_one_access = list(access_mining) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/cgo1o.ogg' + department_close_powered = 'sound/machines/door/cgo1c.ogg' + +/obj/machinery/door/airlock/glass_atmos + name = "Atmospherics Airlock" + icon = 'icons/obj/doors/Dooratmoglass.dmi' + hitsound = 'sound/effects/Glasshit.ogg' + maxhealth = 300 + explosion_resistance = 5 + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_atmo + glass = 1 + req_one_access = list(access_atmospherics) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/eng1o.ogg' + department_close_powered = 'sound/machines/door/eng1c.ogg' + +/obj/machinery/door/airlock/gold + name = "Gold Airlock" + icon = 'icons/obj/doors/Doorgold.dmi' + mineral = "gold" + +/obj/machinery/door/airlock/silver + name = "Silver Airlock" + icon = 'icons/obj/doors/Doorsilver.dmi' + mineral = "silver" + +/obj/machinery/door/airlock/diamond + name = "Diamond Airlock" + icon = 'icons/obj/doors/Doordiamond.dmi' + mineral = "diamond" + +/obj/machinery/door/airlock/uranium + name = "Uranium Airlock" + desc = "And they said I was crazy." + icon = 'icons/obj/doors/Dooruranium.dmi' + mineral = "uranium" + var/last_event = 0 + var/rad_power = 7.5 + +/obj/machinery/door/airlock/process() + // Deliberate no call to parent. + if(main_power_lost_until > 0 && world.time >= main_power_lost_until) + regainMainPower() + + if(backup_power_lost_until > 0 && world.time >= backup_power_lost_until) + regainBackupPower() + + else if(electrified_until > 0 && world.time >= electrified_until) + electrify(0) + + if (..() == PROCESS_KILL && !(main_power_lost_until > 0 || backup_power_lost_until > 0 || electrified_until > 0)) + . = PROCESS_KILL + +/obj/machinery/door/airlock/uranium/process() + if(world.time > last_event+20) + if(prob(50)) + SSradiation.radiate(src, rad_power) + last_event = world.time + ..() + +/obj/machinery/door/airlock/phoron + name = "Phoron Airlock" + desc = "No way this can end badly." + icon = 'icons/obj/doors/Doorphoron.dmi' + mineral = "phoron" + +/obj/machinery/door/airlock/phoron/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) + if(exposed_temperature > 300) + PhoronBurn(exposed_temperature) + +/obj/machinery/door/airlock/phoron/proc/ignite(exposed_temperature) + if(exposed_temperature > 300) + PhoronBurn(exposed_temperature) + +/obj/machinery/door/airlock/phoron/proc/PhoronBurn(temperature) + for(var/turf/simulated/floor/target_tile in range(2,loc)) + target_tile.assume_gas("phoron", 35, 400+T0C) + spawn (0) target_tile.hotspot_expose(temperature, 400) + for(var/turf/simulated/wall/W in range(3,src)) + W.burn((temperature/4))//Added so that you can't set off a massive chain reaction with a small flame + for(var/obj/machinery/door/airlock/phoron/D in range(3,src)) + D.ignite(temperature/4) + new/obj/structure/door_assembly( src.loc ) + qdel(src) + +/obj/machinery/door/airlock/sandstone + name = "Sandstone Airlock" + icon = 'icons/obj/doors/Doorsand.dmi' + mineral = "sandstone" + +/obj/machinery/door/airlock/science + name = "Research Airlock" + icon = 'icons/obj/doors/Doorsci.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_science + req_one_access = list(access_research) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/glass_science + name = "Glass Airlocks" + icon = 'icons/obj/doors/Doorsciglass.dmi' + opacity = 0 + assembly_type = /obj/structure/door_assembly/door_assembly_science + glass = 1 + req_one_access = list(access_research) + open_sound_powered = 'sound/machines/door/hall1o.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + close_sound_powered = 'sound/machines/door/hall1c.ogg' // VOREStation Edit: Default door sounds for fancy, department-off. + department_open_powered = 'sound/machines/door/sci1o.ogg' + department_close_powered = 'sound/machines/door/sci1c.ogg' + +/obj/machinery/door/airlock/highsecurity + name = "Secure Airlock" + icon = 'icons/obj/doors/hightechsecurity.dmi' + explosion_resistance = 20 + secured_wires = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_highsecurity + req_one_access = list(access_heads_vault) + open_sound_powered = 'sound/machines/door/secure1o.ogg' + close_sound_powered = 'sound/machines/door/secure1c.ogg' + +/obj/machinery/door/airlock/voidcraft + name = "voidcraft hatch" + desc = "It's an extra resilient airlock intended for spacefaring vessels." + icon = 'icons/obj/doors/shuttledoors.dmi' + explosion_resistance = 20 + opacity = 0 + glass = 1 + assembly_type = /obj/structure/door_assembly/door_assembly_voidcraft + open_sound_powered = 'sound/machines/door/shuttle1o.ogg' + close_sound_powered = 'sound/machines/door/shuttle1c.ogg' + +// Airlock opens from top-bottom instead of left-right. +/obj/machinery/door/airlock/voidcraft/vertical + icon = 'icons/obj/doors/shuttledoors_vertical.dmi' + assembly_type = /obj/structure/door_assembly/door_assembly_voidcraft/vertical + open_sound_powered = 'sound/machines/door/shuttle1o.ogg' + close_sound_powered = 'sound/machines/door/shuttle1c.ogg' + + +/datum/category_item/catalogue/anomalous/precursor_a/alien_airlock + name = "Precursor Alpha Object - Doors" + desc = "This object appears to be used in order to restrict or allow access to \ + rooms based on its physical state. In other words, a door. \ + Despite being designed and created by unknown ancient alien hands, this door has \ + a large number of similarities to the conventional airlock, such as being driven by \ + electricity, opening and closing by physically moving, and being air tight. \ + It also operates by responding to signals through internal electrical conduits. \ + These characteristics make it possible for one with experience with a multitool \ + to manipulate the door.\ +

\ + The symbol on the door does not match any living species' patterns, giving further \ + implications that this door is very old, and yet it remains operational after \ + thousands of years. It is unknown if that is due to superb construction, or \ + unseen autonomous maintenance having been performed." + value = CATALOGUER_REWARD_EASY + +/obj/machinery/door/airlock/alien + name = "alien airlock" + desc = "You're fairly sure this is a door." + catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_airlock) + icon = 'icons/obj/doors/Dooralien.dmi' + explosion_resistance = 20 + secured_wires = TRUE + hackProof = TRUE + assembly_type = /obj/structure/door_assembly/door_assembly_alien + req_one_access = list(access_alien) + +/obj/machinery/door/airlock/alien/locked + icon_state = "door_locked" + locked = TRUE + +/obj/machinery/door/airlock/alien/public // Entry to UFO. + req_one_access = list() + normalspeed = FALSE // So it closes faster and hopefully keeps the warm air inside. + hackProof = TRUE //VOREStation Edit - No borgos + +/* +About the new airlock wires panel: +* An airlock wire dialog can be accessed by the normal way or by using wirecutters or a multitool on the door while the wire-panel is open. This would show the following wires, which you can either wirecut/mend or send a multitool pulse through. There are 9 wires. +* one wire from the ID scanner. Sending a pulse through this flashes the red light on the door (if the door has power). If you cut this wire, the door will stop recognizing valid IDs. (If the door has 0000 access, it still opens and closes, though) +* two wires for power. Sending a pulse through either one causes a breaker to trip, disabling the door for 10 seconds if backup power is connected, or 1 minute if not (or until backup power comes back on, whichever is shorter). Cutting either one disables the main door power, but unless backup power is also cut, the backup power re-powers the door in 10 seconds. While unpowered, the door may be open, but bolts-raising will not work. Cutting these wires may electrocute the user. +* one wire for door bolts. Sending a pulse through this drops door bolts (whether the door is powered or not) or raises them (if it is). Cutting this wire also drops the door bolts, and mending it does not raise them. If the wire is cut, trying to raise the door bolts will not work. +* two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter). Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user. +* one wire for opening the door. Sending a pulse through this while the door has power makes it open the door if no access is required. +* one wire for AI control. Sending a pulse through this blocks AI control for a second or so (which is enough to see the AI control light on the panel dialog go off and back on again). Cutting this prevents the AI from controlling the door unless it has hacked the door through the power connection (which takes about a minute). If both main and backup power are cut, as well as this wire, then the AI cannot operate or hack the door at all. +* one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds. Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted. (Currently it is also STAYING electrified until someone mends the wire) +* one wire for controling door safetys. When active, door does not close on someone. When cut, door will ruin someone's shit. When pulsed, door will immedately ruin someone's shit. +* one wire for controlling door speed. When active, dor closes at normal rate. When cut, door does not close manually. When pulsed, door attempts to close every tick. +*/ + + + +/obj/machinery/door/airlock/bumpopen(mob/living/user as mob) //Airlocks now zap you when you 'bump' them open when they're electrified. --NeoFite + if(!issilicon(usr)) + if(src.isElectrified()) + if(!src.justzap) + if(src.shock(user, 100)) + src.justzap = 1 + spawn (10) + src.justzap = 0 + return + else /*if(src.justzap)*/ + return + else if(user.hallucination > 50 && prob(10) && src.operating == 0) + to_chat(user, "You feel a powerful shock course through your body!") + user.halloss += 10 + user.stunned += 10 + return + ..(user) + +/obj/machinery/door/airlock/proc/isElectrified() + if(src.electrified_until != 0) + return 1 + return 0 + +/obj/machinery/door/airlock/proc/canAIControl() + return ((src.aiControlDisabled!=1) && (!src.isAllPowerLoss())); + +/obj/machinery/door/airlock/proc/canAIHack() + return ((src.aiControlDisabled==1) && (!hackProof) && (!src.isAllPowerLoss())); + +/obj/machinery/door/airlock/proc/arePowerSystemsOn() + if (stat & (NOPOWER|BROKEN)) + return 0 + return (src.main_power_lost_until==0 || src.backup_power_lost_until==0) + +/obj/machinery/door/airlock/requiresID() + return !(wires.is_cut(WIRE_IDSCAN) || aiDisabledIdScanner) + +/obj/machinery/door/airlock/proc/isAllPowerLoss() + if(stat & (NOPOWER|BROKEN)) + return 1 + if(mainPowerCablesCut() && backupPowerCablesCut()) + return 1 + return 0 + +/obj/machinery/door/airlock/proc/mainPowerCablesCut() + return wires.is_cut(WIRE_MAIN_POWER1) || wires.is_cut(WIRE_MAIN_POWER2) + +/obj/machinery/door/airlock/proc/backupPowerCablesCut() + return wires.is_cut(WIRE_BACKUP_POWER1) || wires.is_cut(WIRE_BACKUP_POWER2) + +/obj/machinery/door/airlock/proc/loseMainPower() + main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + + // If backup power is permanently disabled then activate in 10 seconds if possible, otherwise it's already enabled or a timer is already running + if(backup_power_lost_until == -1 && !backupPowerCablesCut()) + backup_power_lost_until = world.time + SecondsToTicks(10) + + if(main_power_lost_until > 0 || backup_power_lost_until > 0) + START_MACHINE_PROCESSING(src) + + // Disable electricity if required + if(electrified_until && isAllPowerLoss()) + electrify(0) + + update_icon() + +/obj/machinery/door/airlock/proc/loseBackupPower() + backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + + if(backup_power_lost_until > 0) + START_MACHINE_PROCESSING(src) + + // Disable electricity if required + if(electrified_until && isAllPowerLoss()) + electrify(0) + + update_icon() + +/obj/machinery/door/airlock/proc/regainMainPower() + if(!mainPowerCablesCut()) + main_power_lost_until = 0 + // If backup power is currently active then disable, otherwise let it count down and disable itself later + if(!backup_power_lost_until) + backup_power_lost_until = -1 + + update_icon() + +/obj/machinery/door/airlock/proc/regainBackupPower() + if(!backupPowerCablesCut()) + // Restore backup power only if main power is offline, otherwise permanently disable + backup_power_lost_until = main_power_lost_until == 0 ? -1 : 0 + + update_icon() + +/obj/machinery/door/airlock/proc/electrify(var/duration, var/feedback = 0) + var/message = "" + if(wires.is_cut(WIRE_ELECTRIFY) && arePowerSystemsOn()) + message = text("The electrification wire is cut - Door permanently electrified.") + src.electrified_until = -1 + else if(duration && !arePowerSystemsOn()) + message = text("The door is unpowered - Cannot electrify the door.") + src.electrified_until = 0 + else if(!duration && electrified_until != 0) + message = "The door is now un-electrified." + src.electrified_until = 0 + else if(duration) //electrify door for the given duration seconds + if(usr) + shockedby += text("\[[time_stamp()]\] - [usr](ckey:[usr.ckey])") + add_attack_logs(usr,name,"Electrified a door") + else + shockedby += text("\[[time_stamp()]\] - EMP)") + message = "The door is now electrified [duration == -1 ? "permanently" : "for [duration] second\s"]." + src.electrified_until = duration == -1 ? -1 : world.time + SecondsToTicks(duration) + + if(electrified_until > 0) + START_MACHINE_PROCESSING(src) + + if(feedback && message) + to_chat(usr,message) + +/obj/machinery/door/airlock/proc/set_idscan(var/activate, var/feedback = 0) + var/message = "" + if(wires.is_cut(WIRE_IDSCAN)) + message = "The IdScan wire is cut - IdScan feature permanently disabled." + else if(activate && src.aiDisabledIdScanner) + src.aiDisabledIdScanner = 0 + message = "IdScan feature has been enabled." + else if(!activate && !src.aiDisabledIdScanner) + src.aiDisabledIdScanner = 1 + message = "IdScan feature has been disabled." + + if(feedback && message) + to_chat(usr,message) + +/obj/machinery/door/airlock/proc/set_safeties(var/activate, var/feedback = 0) + var/message = "" + // Safeties! We don't need no stinking safeties! + if (wires.is_cut(WIRE_SAFETY)) + message = text("The safety wire is cut - Cannot enable safeties.") + else if (!activate && src.safe) + safe = 0 + else if (activate && !src.safe) + safe = 1 + + if(feedback && message) + to_chat(usr,message) + +// shock user with probability prb (if all connections & power are working) +// returns 1 if shocked, 0 otherwise +// The preceding comment was borrowed from the grille's shock script +/obj/machinery/door/airlock/shock(mob/user, prb) + if(!arePowerSystemsOn()) + return 0 + if(hasShocked) + return 0 //Already shocked someone recently? + if(..()) + hasShocked = 1 + sleep(10) + hasShocked = 0 + return 1 + else + return 0 + + +/obj/machinery/door/airlock/update_icon() + cut_overlays() + if(density) + if(locked && lights && src.arePowerSystemsOn()) + icon_state = "door_locked" + else + icon_state = "door_closed" + if(p_open || welded) + if(p_open) + add_overlay("panel_open") + if (!(stat & NOPOWER)) + if(stat & BROKEN) + add_overlay("sparks_broken") + else if (health < maxhealth * 3/4) + add_overlay("sparks_damaged") + if(welded) + add_overlay("welded") + else if (health < maxhealth * 3/4 && !(stat & NOPOWER)) + add_overlay("sparks_damaged") + else + icon_state = "door_open" + if((stat & BROKEN) && !(stat & NOPOWER)) + add_overlay("sparks_open") + return + +/obj/machinery/door/airlock/do_animate(animation) + switch(animation) + if("opening") + cut_overlay() + if(p_open) + spawn(2) // The only work around that works. Downside is that the door will be gone for a millisecond. + flick("o_door_opening", src) //can not use flick due to BYOND bug updating overlays right before flicking + update_icon() + else + flick("door_opening", src)//[stat ? "_stat":] + update_icon() + if("closing") + cut_overlay() + if(p_open) + spawn(2) + flick("o_door_closing", src) + update_icon() + else + flick("door_closing", src) + update_icon() + if("spark") + if(density) + flick("door_spark", src) + if("deny") + if(density && src.arePowerSystemsOn()) + flick("door_deny", src) + playsound(src, denied_sound, 50, 0, 3) + return + +/obj/machinery/door/airlock/attack_ai(mob/user as mob) + tgui_interact(user) + +/obj/machinery/door/airlock/attack_ghost(mob/user) + tgui_interact(user) + +/obj/machinery/door/airlock/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, datum/tgui_state/custom_state) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "AiAirlock", name) + ui.open() + if(custom_state) + ui.set_state(custom_state) + return TRUE + +/obj/machinery/door/airlock/tgui_data(mob/user) + var/list/data = list() + + var/list/power = list() + power["main"] = main_power_lost_until > 0 ? 0 : 2 + power["main_timeleft"] = round(main_power_lost_until > 0 ? max(main_power_lost_until - world.time, 0) / 10 : main_power_lost_until, 1) + power["backup"] = backup_power_lost_until > 0 ? 0 : 2 + power["backup_timeleft"] = round(backup_power_lost_until > 0 ? max(backup_power_lost_until - world.time, 0) / 10 : backup_power_lost_until, 1) + data["power"] = power + + data["shock"] = (electrified_until == 0) ? 2 : 0 + data["shock_timeleft"] = round(electrified_until > 0 ? max(electrified_until - world.time, 0) / 10 : electrified_until, 1) + data["id_scanner"] = !aiDisabledIdScanner + data["locked"] = locked // bolted + data["lights"] = lights // bolt lights + data["safe"] = safe // safeties + data["speed"] = normalspeed // safe speed + data["welded"] = welded // welded + data["opened"] = !density // opened + + var/list/wire = list() + wire["main_1"] = !wires.is_cut(WIRE_MAIN_POWER1) + wire["main_2"] = !wires.is_cut(WIRE_MAIN_POWER2) + wire["backup_1"] = !wires.is_cut(WIRE_BACKUP_POWER1) + wire["backup_2"] = !wires.is_cut(WIRE_BACKUP_POWER2) + wire["shock"] = !wires.is_cut(WIRE_ELECTRIFY) + wire["id_scanner"] = !wires.is_cut(WIRE_IDSCAN) + wire["bolts"] = !wires.is_cut(WIRE_DOOR_BOLTS) + wire["lights"] = !wires.is_cut(WIRE_BOLT_LIGHT) + wire["safe"] = !wires.is_cut(WIRE_SAFETY) + wire["timing"] = !wires.is_cut(WIRE_SPEED) + + data["wires"] = wire + return data + +/obj/machinery/door/airlock/proc/hack(mob/user as mob) + if(src.aiHacking==0) + src.aiHacking=1 + spawn(20) + //TODO: Make this take a minute + to_chat(user, "Airlock AI control has been blocked. Beginning fault-detection.") + sleep(50) + if(src.canAIControl()) + to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") + src.aiHacking=0 + return + else if(!src.canAIHack(user)) + to_chat(user, "We've lost our connection! Unable to hack airlock.") + src.aiHacking=0 + return + to_chat(user, "Fault confirmed: airlock control wire disabled or cut.") + sleep(20) + to_chat(user, "Attempting to hack into airlock. This may take some time.") + sleep(200) + if(src.canAIControl()) + to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") + src.aiHacking=0 + return + else if(!src.canAIHack(user)) + to_chat(user, "We've lost our connection! Unable to hack airlock.") + src.aiHacking=0 + return + to_chat(user, "Upload access confirmed. Loading control program into airlock software.") + sleep(170) + if(src.canAIControl()) + to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") + src.aiHacking=0 + return + else if(!src.canAIHack(user)) + to_chat(user, "We've lost our connection! Unable to hack airlock.") + src.aiHacking=0 + return + to_chat(user, "Transfer complete. Forcing airlock to execute program.") + sleep(50) + //disable blocked control + src.aiControlDisabled = 2 + to_chat(user, "Receiving control information from airlock.") + sleep(10) + //bring up airlock dialog + src.aiHacking = 0 + if (user) + src.attack_ai(user) + +/obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target) + if (src.isElectrified()) + if (istype(mover, /obj/item)) + var/obj/item/i = mover + if (i.matter && (MAT_STEEL in i.matter) && i.matter[MAT_STEEL] > 0) + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() + return ..() + +/obj/machinery/door/airlock/attack_hand(mob/user as mob) + if(!istype(usr, /mob/living/silicon)) + if(src.isElectrified()) + if(src.shock(user, 100)) + return + + if(istype(user, /mob/living/carbon/human)) + var/mob/living/carbon/human/X = user + if(istype(X.species, /datum/species/xenos)) + src.attack_alien(user) + return + + if(src.p_open) + user.set_machine(src) + wires.Interact(user) + else + ..(user) + return + +/obj/machinery/door/airlock/tgui_act(action, params) + if(..()) + return TRUE + if(!user_allowed(usr)) + return TRUE + + switch(action) + if("disrupt-main") + if(!main_power_lost_until) + loseMainPower() + update_icon() + else + to_chat(usr, "Main power is already offline.") + . = TRUE + if("disrupt-backup") + if(!backup_power_lost_until) + loseBackupPower() + update_icon() + else + to_chat(usr, "Backup power is already offline.") + . = TRUE + if("shock-restore") + electrify(0, 1) + . = TRUE + if("shock-temp") + electrify(30, 1) + . = TRUE + if("shock-perm") + electrify(-1, 1) + . = TRUE + if("idscan-toggle") + set_idscan(aiDisabledIdScanner, 1) + . = TRUE + // if("emergency-toggle") + // toggle_emergency(usr) + // . = TRUE + if("bolt-toggle") + toggle_bolt(usr) + . = TRUE + if("light-toggle") + if(wires.is_cut(WIRE_BOLT_LIGHT)) + to_chat(usr, "The bolt lights wire is cut - The door bolt lights are permanently disabled.") + return + lights = !lights + update_icon() + . = TRUE + if("safe-toggle") + set_safeties(!safe, 1) + . = TRUE + if("speed-toggle") + if(wires.is_cut(WIRE_SPEED)) + to_chat(usr, "The timing wire is cut - Cannot alter timing.") + return + normalspeed = !normalspeed + . = TRUE + if("open-close") + user_toggle_open(usr) + . = TRUE + + update_icon() + return 1 + +/obj/machinery/door/airlock/proc/user_allowed(mob/user) + var/allowed = (issilicon(user) && canAIControl(user)) + if(!allowed && isobserver(user)) + var/mob/observer/dead/D = user + if(D.can_admin_interact()) + allowed = TRUE + return allowed + +/obj/machinery/door/airlock/proc/toggle_bolt(mob/user) + if(!user_allowed(user)) + return + if(wires.is_cut(WIRE_DOOR_BOLTS)) + to_chat(user, "The door bolt drop wire is cut - you can't toggle the door bolts.") + return + if(locked) + if(!arePowerSystemsOn()) + to_chat(user, "The door has no power - you can't raise the door bolts.") + else + unlock() + to_chat(user, "The door bolts have been raised.") + // log_combat(user, src, "unbolted") + else + lock() + to_chat(user, "The door bolts have been dropped.") + // log_combat(user, src, "bolted") + +/obj/machinery/door/airlock/proc/user_toggle_open(mob/user) + if(!user_allowed(user)) + return + if(welded) + to_chat(user, text("The airlock has been welded shut!")) + else if(locked) + to_chat(user, text("The door bolts are down!")) + else if(!density) + close() + else + open() + +/obj/machinery/door/airlock/proc/can_remove_electronics() + return src.p_open && (operating < 0 || (!operating && welded && !src.arePowerSystemsOn() && density && (!src.locked || (stat & BROKEN)))) + +/obj/machinery/door/airlock/attackby(obj/item/C, mob/user as mob) + //to_world("airlock attackby src [src] obj [C] mob [user]") + if(!istype(usr, /mob/living/silicon)) + if(src.isElectrified()) + if(src.shock(user, 75)) + return + if(istype(C, /obj/item/taperoll)) + return + + src.add_fingerprint(user) + if (attempt_vr(src,"attackby_vr",list(C, user))) return + if(istype(C, /mob/living)) + ..() + return + if(!repairing && istype(C, /obj/item/weapon/weldingtool) && !( src.operating > 0 ) && src.density) + var/obj/item/weapon/weldingtool/W = C + if(W.remove_fuel(0,user)) + if(!src.welded) + src.welded = 1 + else + src.welded = null + playsound(src, C.usesound, 75, 1) + src.update_icon() + return + else + return + else if(C.is_screwdriver()) + if (src.p_open) + if (stat & BROKEN) + to_chat(usr, "The panel is broken and cannot be closed.") + else + src.p_open = 0 + playsound(src, C.usesound, 50, 1) + else + src.p_open = 1 + playsound(src, C.usesound, 50, 1) + src.update_icon() + else if(C.is_wirecutter()) + return src.attack_hand(user) + else if(istype(C, /obj/item/device/multitool)) + return src.attack_hand(user) + else if(istype(C, /obj/item/device/assembly/signaler)) + return src.attack_hand(user) + else if(istype(C, /obj/item/weapon/pai_cable)) // -- TLE + var/obj/item/weapon/pai_cable/cable = C + cable.plugin(src, user) + else if(!repairing && C.is_crowbar()) + if(can_remove_electronics()) + playsound(src, C.usesound, 75, 1) + user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to remove electronics from the airlock assembly.") + if(do_after(user,40 * C.toolspeed)) + to_chat(user, "You removed the airlock electronics!") + + var/obj/structure/door_assembly/da = new assembly_type(src.loc) + if (istype(da, /obj/structure/door_assembly/multi_tile)) + da.set_dir(src.dir) + + da.anchored = TRUE + if(mineral) + da.glass = mineral + //else if(glass) + else if(glass && !da.glass) + da.glass = 1 + da.state = 1 + da.created_name = src.name + da.update_state() + + if(operating == -1 || (stat & BROKEN)) + new /obj/item/weapon/circuitboard/broken(src.loc) + operating = 0 + else + if (!electronics) create_electronics() + + electronics.loc = src.loc + electronics = null + + qdel(src) + return + else if(arePowerSystemsOn()) + to_chat(user, "The airlock's motors resist your efforts to force it.") + else if(locked) + to_chat(user, "The airlock's bolts prevent it from being forced.") + else + if(density) + spawn(0) open(1) + else + spawn(0) close(1) + + // Check if we're using a crowbar or armblade, and if the airlock's unpowered for whatever reason (off, broken, etc). + else if(istype(C, /obj/item/weapon)) + var/obj/item/weapon/W = C + if((W.pry == 1) && !arePowerSystemsOn()) + if(locked) + to_chat(user, "The airlock's bolts prevent it from being forced.") + else if( !welded && !operating ) + if(istype(C, /obj/item/weapon/material/twohanded/fireaxe)) // If this is a fireaxe, make sure it's held in two hands. + var/obj/item/weapon/material/twohanded/fireaxe/F = C + if(!F.wielded) + to_chat(user, "You need to be wielding \the [F] to do that.") + return + // At this point, it's an armblade or a fireaxe that passed the wielded test, let's try to open it. + if(density) + spawn(0) + open(1) + else + spawn(0) + close(1) + else + ..() + else + ..() + return + +/obj/machinery/door/airlock/phoron/attackby(C as obj, mob/user as mob) + if(C) + ignite(is_hot(C)) + ..() + +/obj/machinery/door/airlock/set_broken() + src.p_open = 1 + stat |= BROKEN + if (secured_wires) + lock() + for (var/mob/O in viewers(src, null)) + if ((O.client && !( O.blinded ))) + O.show_message("[src.name]'s control panel bursts open, sparks spewing out!") + + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() + + update_icon() + return + +/obj/machinery/door/airlock/open(var/forced=0) + if(!can_open(forced)) + return 0 + use_power(360) //360 W seems much more appropriate for an actuator moving an industrial door capable of crushing people + + //if the door is unpowered then it doesn't make sense to hear the woosh of a pneumatic actuator + for(var/mob/M as anything in player_list) + if(!M || !M.client) + continue + var/old_sounds = M.client.is_preference_enabled(/datum/client_preference/old_door_sounds) + var/department_door_sounds = M.client.is_preference_enabled(/datum/client_preference/department_door_sounds) + var/sound + var/volume + if(old_sounds) // Do we have old sounds enabled? Play these even if we have department door sounds enabled. + if(arePowerSystemsOn()) + sound = legacy_open_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else if(!old_sounds && department_door_sounds && src.department_open_powered) // Else, we have old sounds disabled, the door has per-department door sounds, and we have chosen to play department door sounds, use these. + if(arePowerSystemsOn()) + sound = department_open_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else // Else, play these. + if(arePowerSystemsOn()) + sound = open_sound_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + + var/turf/T = get_turf(M) + var/distance = get_dist(T, get_turf(src)) + if(distance <= world.view * 2) + if(T && T.z == get_z(src)) + M.playsound_local(get_turf(src), sound, volume, 1, null, 0, TRUE, sound(sound), volume_channel = VOLUME_CHANNEL_DOORS) + + if(src.closeOther != null && istype(src.closeOther, /obj/machinery/door/airlock/) && !src.closeOther.density) + src.closeOther.close() + return ..() + +/obj/machinery/door/airlock/can_open(var/forced=0) + if(!forced) + if(!arePowerSystemsOn() || wires.is_cut(WIRE_OPEN_DOOR)) + return 0 + + if(locked || welded) + return 0 + return ..() + +/obj/machinery/door/airlock/can_close(var/forced=0) + if(locked || welded) + return 0 + + if(!forced) + //despite the name, this wire is for general door control. + if(!arePowerSystemsOn() || wires.is_cut(WIRE_OPEN_DOOR)) + return 0 + + return ..() + +/atom/movable/proc/blocks_airlock() + return density + +/obj/machinery/door/blocks_airlock() + return 0 + +/obj/machinery/mech_sensor/blocks_airlock() + return 0 + +/mob/living/blocks_airlock() + return 1 + +/atom/movable/proc/airlock_crush(var/crush_damage) + return 0 + +/obj/machinery/portable_atmospherics/canister/airlock_crush(var/crush_damage) + . = ..() + health -= crush_damage + healthcheck() + +/obj/effect/energy_field/airlock_crush(var/crush_damage) + adjust_strength(crush_damage) + +/obj/structure/closet/airlock_crush(var/crush_damage) + ..() + damage(crush_damage) + for(var/atom/movable/AM in src) + AM.airlock_crush() + return 1 + +/mob/living/airlock_crush(var/crush_damage) + . = ..() + adjustBruteLoss(crush_damage) + SetStunned(5) + SetWeakened(5) + var/turf/T = get_turf(src) + T.add_blood(src) + return 1 + +/mob/living/carbon/airlock_crush(var/crush_damage) + . = ..() + if(can_feel_pain()) + emote("scream") + +/mob/living/silicon/robot/airlock_crush(var/crush_damage) + adjustBruteLoss(crush_damage) + return 0 + +/obj/machinery/door/airlock/close(var/forced=0) + if(!can_close(forced)) + return 0 + + if(safe) + for(var/turf/turf in locs) + for(var/atom/movable/AM in turf) + if(AM.blocks_airlock()) + if(!has_beeped) + playsound(src, 'sound/machines/buzz-two.ogg', 50, 0) + has_beeped = 1 + autoclose_in(6) + return + + for(var/turf/turf in locs) + for(var/atom/movable/AM in turf) + if(AM.airlock_crush(DOOR_CRUSH_DAMAGE)) + take_damage(DOOR_CRUSH_DAMAGE) + + use_power(360) //360 W seems much more appropriate for an actuator moving an industrial door capable of crushing people + has_beeped = 0 + for(var/mob/M as anything in player_list) + if(!M || !M.client) + continue + var/old_sounds = M.client.is_preference_enabled(/datum/client_preference/old_door_sounds) + var/department_door_sounds = M.client.is_preference_enabled(/datum/client_preference/department_door_sounds) + var/sound + var/volume + if(old_sounds) + if(arePowerSystemsOn()) + sound = legacy_close_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else if(!old_sounds && department_door_sounds && src.department_close_powered) // Else, we have old sounds disabled, the door has per-department door sounds, and we have chosen to play department door sounds, use these. + if(arePowerSystemsOn()) + sound = department_close_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + else + if(arePowerSystemsOn()) + sound = close_sound_powered + volume = 50 + else + sound = open_sound_unpowered + volume = 75 + + var/turf/T = get_turf(M) + var/distance = get_dist(T, get_turf(src)) + if(distance <= world.view * 2) + if(T && T.z == get_z(src)) + M.playsound_local(get_turf(src), sound, volume, 1, null, 0, TRUE, sound(sound), volume_channel = VOLUME_CHANNEL_DOORS) + for(var/turf/turf in locs) + var/obj/structure/window/killthis = (locate(/obj/structure/window) in turf) + if(killthis) + killthis.ex_act(2)//Smashin windows + return ..() + +/obj/machinery/door/airlock/proc/lock(var/forced=0) + if(locked) + return 0 + + if (operating && !forced) return 0 + + src.locked = 1 + playsound(src, bolt_down_sound, 30, 0, 3, volume_channel = VOLUME_CHANNEL_DOORS) + for(var/mob/M in range(1,src)) + M.show_message("You hear a click from the bottom of the door.", 2) + update_icon() + return 1 + +/obj/machinery/door/airlock/proc/unlock(var/forced=0) + if(!src.locked) + return + + if (!forced) + if(operating || !src.arePowerSystemsOn() || wires.is_cut(WIRE_DOOR_BOLTS)) return + + src.locked = 0 + playsound(src, bolt_up_sound, 30, 0, 3, volume_channel = VOLUME_CHANNEL_DOORS) + for(var/mob/M in range(1,src)) + M.show_message("You hear a click from the bottom of the door.", 2) + update_icon() + return 1 + +/obj/machinery/door/airlock/allowed(mob/M) + if(locked) + return 0 + return ..(M) + +/obj/machinery/door/airlock/New(var/newloc, var/obj/structure/door_assembly/assembly=null) + ..() + + //if assembly is given, create the new door from the assembly + if (assembly && istype(assembly)) + assembly_type = assembly.type + + electronics = assembly.electronics + electronics.loc = src + + //update the door's access to match the electronics' + secured_wires = electronics.secure + if(electronics.one_access) + LAZYCLEARLIST(req_access) + req_one_access = src.electronics.conf_access + else + LAZYCLEARLIST(req_one_access) + req_access = src.electronics.conf_access + + //get the name from the assembly + if(assembly.created_name) + name = assembly.created_name + else + name = "[istext(assembly.glass) ? "[assembly.glass] airlock" : assembly.base_name]" + + //get the dir from the assembly + set_dir(assembly.dir) + + //wires + var/turf/T = get_turf(newloc) + if(T && (T.z in using_map.admin_levels)) + secured_wires = 1 + if (secured_wires) + wires = new/datum/wires/airlock/secure(src) + else + wires = new/datum/wires/airlock(src) + +/obj/machinery/door/airlock/Initialize() + if(src.closeOtherId != null) + for (var/obj/machinery/door/airlock/A in machines) + if(A.closeOtherId == src.closeOtherId && A != src) + src.closeOther = A + break + name = "\improper [name]" + . = ..() + +/obj/machinery/door/airlock/Destroy() + qdel(wires) + wires = null + return ..() + +// Most doors will never be deconstructed over the course of a round, +// so as an optimization defer the creation of electronics until +// the airlock is deconstructed +/obj/machinery/door/airlock/proc/create_electronics() + //create new electronics + if (secured_wires) + src.electronics = new/obj/item/weapon/airlock_electronics/secure( src.loc ) + else + src.electronics = new/obj/item/weapon/airlock_electronics( src.loc ) + + //update the electronics to match the door's access + if(LAZYLEN(req_access)) + electronics.conf_access = req_access + else if (LAZYLEN(req_one_access)) + electronics.conf_access = req_one_access + electronics.one_access = 1 + +/obj/machinery/door/airlock/emp_act(var/severity) + if(prob(40/severity)) + var/duration = world.time + SecondsToTicks(30 / severity) + if(duration > electrified_until) + electrify(duration) + ..() + +/obj/machinery/door/airlock/power_change() //putting this is obj/machinery/door itself makes non-airlock doors turn invisible for some reason + ..() + if(stat & NOPOWER) + // If we lost power, disable electrification + // Keeping door lights on, runs on internal battery or something. + electrified_until = 0 + update_icon() + +/obj/machinery/door/airlock/proc/prison_open() + if(arePowerSystemsOn()) + src.unlock() + src.open() + src.lock() + return + + +/obj/machinery/door/airlock/rcd_values(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode) + switch(passed_mode) + if(RCD_DECONSTRUCT) + // Old RCD code made it cost 10 units to decon an airlock. + // Now the new one costs ten "sheets". + return list( + RCD_VALUE_MODE = RCD_DECONSTRUCT, + RCD_VALUE_DELAY = 5 SECONDS, + RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 10 + ) + return FALSE + +/obj/machinery/door/airlock/rcd_act(mob/living/user, obj/item/weapon/rcd/the_rcd, passed_mode) + switch(passed_mode) + if(RCD_DECONSTRUCT) + to_chat(user, span("notice", "You deconstruct \the [src].")) + qdel(src) + return TRUE + return FALSE +>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt diff --git a/code/game/machinery/frame.dm b/code/game/machinery/frame.dm index d2ee11fbf8..6a593ab554 100644 --- a/code/game/machinery/frame.dm +++ b/code/game/machinery/frame.dm @@ -5,7 +5,7 @@ //Create global frame type list if it hasn't been made already. construction_frame_wall = list() construction_frame_floor = list() - for(var/R in typesof(/datum/frame/frame_types) - /datum/frame/frame_types) + for(var/R in subtypesof(/datum/frame/frame_types)) var/datum/frame/frame_types/type = new R if(type.frame_style == FRAME_STYLE_WALL) construction_frame_wall += type @@ -272,9 +272,8 @@ for(var/A in circuit.req_components) req_components[A] = circuit.req_components[A] req_component_names = circuit.req_components.Copy() - for(var/A in req_components) - var/obj/ct = A - req_component_names[A] = initial(ct.name) + for(var/obj/ct as anything in req_components) + req_component_names[ct] = initial(ct.name) /obj/structure/frame/New(var/loc, var/dir, var/building = 0, var/datum/frame/frame_types/type, mob/user as mob) ..() diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index 54a65642f0..db40cbcf39 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -91,8 +91,7 @@ media_start_time = 0 update_music() //VOREStation Add - for(var/rem in remotes) - var/obj/item/device/juke_remote/remote = rem + for(var/obj/item/device/juke_remote/remote as anything in remotes) remote.update_music() //VOREStation Add End diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 2da7d5342a..26766addf6 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -548,8 +548,7 @@ Class Procs: surviving_parts += new /obj/item/stack/cable_coil(null, 1) surviving_parts += new /obj/item/stack/cable_coil(null, 1) - for(var/a in surviving_parts) - var/atom/movable/A = a + for(var/atom/movable/A as anything in surviving_parts) A.forceMove(droploc) if(scatter && isturf(droploc)) var/turf/T = droploc diff --git a/code/game/machinery/partslathe_vr.dm b/code/game/machinery/partslathe_vr.dm index 6f83f6d158..77eefb94c9 100644 --- a/code/game/machinery/partslathe_vr.dm +++ b/code/game/machinery/partslathe_vr.dm @@ -265,8 +265,7 @@ if(istype(copy_board)) data["copyBoard"] = copy_board.name var/list/req_components_ui = list() - for(var/CP in (copy_board.req_components || list())) - var/obj/comp_path = CP + for(var/obj/comp_path as anything in (copy_board.req_components || list())) var/comp_amt = copy_board.req_components[comp_path] if(comp_amt && (comp_path in partslathe_recipies)) req_components_ui.Add(list(list("name" = initial(comp_path.name), "qty" = comp_amt))) @@ -355,7 +354,7 @@ /obj/machinery/partslathe/proc/update_recipe_list() if(!partslathe_recipies) partslathe_recipies = list() - var/list/paths = typesof(/obj/item/weapon/stock_parts)-/obj/item/weapon/stock_parts + var/list/paths = subtypesof(/obj/item/weapon/stock_parts) for(var/type in paths) var/obj/item/weapon/stock_parts/I = new type() if(getHighestOriginTechLevel(I) > 1) diff --git a/code/game/machinery/pointdefense.dm b/code/game/machinery/pointdefense.dm index d1923e949c..6d4cc34768 100644 --- a/code/game/machinery/pointdefense.dm +++ b/code/game/machinery/pointdefense.dm @@ -25,8 +25,15 @@ GLOBAL_LIST_BOILERPLATE(pointdefense_turrets, /obj/machinery/pointdefense) . = ..() if(id_tag) //No more than 1 controller please. +<<<<<<< HEAD for(var/thing in GLOB.pointdefense_controllers) var/obj/machinery/pointdefense_control/PC = thing +||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt + for(var/thing in pointdefense_controllers) + var/obj/machinery/pointdefense_control/PC = thing +======= + for(var/obj/machinery/pointdefense_control/PC as anything in pointdefense_controllers) +>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt if(PC != src && PC.id_tag == id_tag) warning("Two [src] with the same id_tag of [id_tag]") id_tag = null @@ -101,8 +108,15 @@ GLOBAL_LIST_BOILERPLATE(pointdefense_turrets, /obj/machinery/pointdefense) var/new_ident = input(user, "Enter a new ident tag.", "[src]", id_tag) as null|text if(new_ident && new_ident != id_tag && user.Adjacent(src) && CanInteract(user, GLOB.tgui_physical_state)) // Check for duplicate controllers with this ID +<<<<<<< HEAD for(var/thing in GLOB.pointdefense_controllers) var/obj/machinery/pointdefense_control/PC = thing +||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt + for(var/thing in pointdefense_controllers) + var/obj/machinery/pointdefense_control/PC = thing +======= + for(var/obj/machinery/pointdefense_control/PC as anything in pointdefense_controllers) +>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt if(PC != src && PC.id_tag == id_tag) to_chat(user, "The [new_ident] network already has a controller.") return @@ -208,8 +222,15 @@ GLOBAL_LIST_BOILERPLATE(pointdefense_turrets, /obj/machinery/pointdefense) if(!id_tag) return null var/list/connected_z_levels = GetConnectedZlevels(get_z(src)) +<<<<<<< HEAD for(var/thing in GLOB.pointdefense_controllers) var/obj/machinery/pointdefense_control/PDC = thing +||||||| parent of 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt + for(var/thing in pointdefense_controllers) + var/obj/machinery/pointdefense_control/PDC = thing +======= + for(var/obj/machinery/pointdefense_control/PDC as anything in pointdefense_controllers) +>>>>>>> 0dcdc6d7d5... Merge pull request #11179 from VOREStation/Arokha/opt if(PDC.id_tag == id_tag && (get_z(PDC) in connected_z_levels)) return PDC diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 0b1e575596..1779fdb070 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -679,12 +679,11 @@ for(var/turf/T in oview(world.view, src)) seenturfs += T - for(var/mob in living_mob_list) - var/mob/M = mob + for(var/mob/M as anything in living_mob_list) if(M.z != z) //Skip continue if(get_turf(M) in seenturfs) - assess_and_assign(mob, targets, secondarytargets) + assess_and_assign(M, targets, secondarytargets) /* This was dumb. Why do this and then check line of sight later? for(var/mob/M in mobs_in_xray_view(world.view, src)) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index b0f4f4c2c1..1e8c2e8a96 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -176,8 +176,7 @@ return M /atom/movable/proc/handle_buckled_mob_movement(atom/old_loc, direct, movetime) - for(var/A in buckled_mobs) - var/mob/living/L = A + for(var/mob/living/L as anything in buckled_mobs) if(!L.Move(loc, direct, movetime)) L.forceMove(loc, direct, movetime) L.last_move = last_move diff --git a/code/game/objects/effects/alien/aliens.dm b/code/game/objects/effects/alien/aliens.dm index 0cc5868762..2d7471a478 100644 --- a/code/game/objects/effects/alien/aliens.dm +++ b/code/game/objects/effects/alien/aliens.dm @@ -293,8 +293,7 @@ for(var/obj/effect/alien/weeds/W in orange(node_range, src)) nearby_weeds |= W - for(var/nbw in nearby_weeds) - var/obj/effect/alien/weeds/W = nbw + for(var/obj/effect/alien/weeds/W as anything in nearby_weeds) if(!W.linked_node) W.linked_node = src diff --git a/code/game/objects/effects/map_effects/portal.dm b/code/game/objects/effects/map_effects/portal.dm index 375bbcd336..ede5cbdaca 100644 --- a/code/game/objects/effects/map_effects/portal.dm +++ b/code/game/objects/effects/map_effects/portal.dm @@ -113,8 +113,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec var/lowest_y = 0 // First pass is for finding the top right corner. - for(var/thing in vis_contents) - var/turf/T = thing + for(var/turf/T as anything in vis_contents) if(T.x > highest_x) highest_x = T.x if(T.y > highest_y) @@ -124,8 +123,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec lowest_y = highest_y // Second one is for the bottom left corner. - for(var/thing in vis_contents) - var/turf/T = thing + for(var/turf/T as anything in vis_contents) if(T.x < lowest_x) lowest_x = T.x if(T.y < lowest_y) @@ -182,8 +180,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec // Connects both sides of a portal together. /obj/effect/map_effect/portal/master/proc/find_counterparts() - for(var/thing in GLOB.all_portal_masters) - var/obj/effect/map_effect/portal/master/M = thing + for(var/obj/effect/map_effect/portal/master/M as anything in GLOB.all_portal_masters) if(M == src) continue if(M.counterpart) @@ -205,8 +202,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec /obj/effect/map_effect/portal/master/proc/make_visuals() var/list/observed_turfs = list() - for(var/thing in portal_lines + src) - var/obj/effect/map_effect/portal/P = thing + for(var/obj/effect/map_effect/portal/P as anything in portal_lines + src) P.name = null P.icon_state = null @@ -230,8 +226,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec // Shifts the portal's pixels in order to line up properly, as BYOND offsets the sprite when it holds multiple turfs inside `vis_contents`. // This undos the shift that BYOND did. /obj/effect/map_effect/portal/master/proc/apply_offset() - for(var/thing in portal_lines + src) - var/obj/effect/map_effect/portal/P = thing + for(var/obj/effect/map_effect/portal/P as anything in portal_lines + src) P.pixel_x = WORLD_ICON_SIZE * P.portal_distance_x P.pixel_y = WORLD_ICON_SIZE * P.portal_distance_y @@ -245,8 +240,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec var/list/in_range = get_mobs_and_objs_in_view_fast(T, world.view, 0) var/list/mobs_to_relay = in_range["mobs"] - for(var/thing in mobs_to_relay) - var/mob/mob = thing + for(var/mob/mob as anything in mobs_to_relay) var/rendered = "[text]" mob.show_message(rendered) @@ -261,8 +255,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec var/list/in_range = get_mobs_and_objs_in_view_fast(T, world.view, 0) var/list/mobs_to_relay = in_range["mobs"] - for(var/thing in mobs_to_relay) - var/mob/mob = thing + for(var/mob/mob as anything in mobs_to_relay) mob.show_message(rendered) ..() @@ -275,8 +268,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec var/list/in_range = get_mobs_and_objs_in_view_fast(T, world.view, 0) var/list/mobs_to_relay = in_range["mobs"] - for(var/thing in mobs_to_relay) - var/mob/mob = thing + for(var/mob/mob as anything in mobs_to_relay) var/list/combined = mob.combine_message(message_pieces, verb, M) var/message = combined["formatted"] var/name_used = M.GetVoice() @@ -296,8 +288,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec var/obj/effect/map_effect/portal/master/other_master = counterpart var/in_vis_contents = FALSE - for(var/thing in other_master.portal_lines + other_master) - var/obj/effect/map_effect/portal/P = thing + for(var/obj/effect/map_effect/portal/P as anything in other_master.portal_lines + other_master) if(P in true_turf.vis_locs) in_vis_contents = TRUE break diff --git a/code/game/objects/effects/map_effects/screen_shaker.dm b/code/game/objects/effects/map_effects/screen_shaker.dm index 29568242e5..c8f5d413bd 100644 --- a/code/game/objects/effects/map_effects/screen_shaker.dm +++ b/code/game/objects/effects/map_effects/screen_shaker.dm @@ -11,8 +11,7 @@ var/shake_strength = 1 // How much it shakes. /obj/effect/map_effect/interval/screen_shaker/trigger() - for(var/A in player_list) - var/mob/M = A + for(var/mob/M as anything in player_list) if(M.z == src.z && get_dist(src, M) <= shake_radius) shake_camera(M, shake_duration, shake_strength) ..() \ No newline at end of file diff --git a/code/game/objects/effects/temporary_visuals/projectiles/tracer.dm b/code/game/objects/effects/temporary_visuals/projectiles/tracer.dm index 76e8015976..4c2f6b6e73 100644 --- a/code/game/objects/effects/temporary_visuals/projectiles/tracer.dm +++ b/code/game/objects/effects/temporary_visuals/projectiles/tracer.dm @@ -23,8 +23,7 @@ if(light_range > 0 && light_intensity > 0) var/list/turf/line = getline(starting.return_turf(), ending.return_turf()) tracing_line: - for(var/i in line) - var/turf/T = i + for(var/turf/T as anything in line) for(var/obj/effect/projectile_lighting/PL in T) if(PL.owner == instance_key) continue tracing_line diff --git a/code/game/objects/items/devices/communicator/UI_tgui.dm b/code/game/objects/items/devices/communicator/UI_tgui.dm index 989d68078e..3759d23d4e 100644 --- a/code/game/objects/items/devices/communicator/UI_tgui.dm +++ b/code/game/objects/items/devices/communicator/UI_tgui.dm @@ -24,8 +24,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/game/objects/items/devices/hacktool.dm b/code/game/objects/items/devices/hacktool.dm index b221ff875c..e92c45e151 100644 --- a/code/game/objects/items/devices/hacktool.dm +++ b/code/game/objects/items/devices/hacktool.dm @@ -15,8 +15,7 @@ hack_state = new(src) /obj/item/device/multitool/hacktool/Destroy() - for(var/T in known_targets) - var/atom/target = T + for(var/atom/target as anything in known_targets) target.unregister(OBSERVER_EVENT_DESTROY, src) known_targets.Cut() qdel(hack_state) diff --git a/code/game/objects/items/devices/radio/jammer.dm b/code/game/objects/items/devices/radio/jammer.dm index ed52707904..ace17fa07d 100644 --- a/code/game/objects/items/devices/radio/jammer.dm +++ b/code/game/objects/items/devices/radio/jammer.dm @@ -4,8 +4,7 @@ var/global/list/active_radio_jammers = list() var/turf/Tr = get_turf(radio) if(!Tr) return 0 //Nullspace radios don't get jammed. - for(var/jammer in active_radio_jammers) - var/obj/item/device/radio_jammer/J = jammer + for(var/obj/item/device/radio_jammer/J as anything in active_radio_jammers) var/turf/Tj = get_turf(J) if(J.on && Tj.z == Tr.z) //If we're on the same Z, it's worth checking. diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 79f38554b8..1fac4f3226 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -133,8 +133,7 @@ HALOGEN COUNTER - Radcount on mobs var/unknown = 0 var/reagentdata[0] var/unknownreagents[0] - for(var/A in C.reagents.reagent_list) - var/datum/reagent/R = A + for(var/datum/reagent/R as anything in C.reagents.reagent_list) if(R.scannable) reagentdata["[R.id]"] = "\t[round(C.reagents.get_reagent_amount(R.id), 1)]u [R.name][(R.overdose && R.volume > R.overdose) ? " - Overdose" : ""]
" else @@ -155,8 +154,7 @@ HALOGEN COUNTER - Radcount on mobs var/unknown = 0 var/stomachreagentdata[0] var/stomachunknownreagents[0] - for(var/B in C.ingested.reagent_list) - var/datum/reagent/R = B + for(var/datum/reagent/R as anything in C.ingested.reagent_list) if(R.scannable) stomachreagentdata["[R.id]"] = "\t[round(C.ingested.get_reagent_amount(R.id), 1)]u [R.name][(R.overdose && R.volume > R.overdose) ? " - Overdose" : ""]
" if (advscan == 0 || showadvscan == 0) @@ -179,8 +177,7 @@ HALOGEN COUNTER - Radcount on mobs var/unknown = 0 var/touchreagentdata[0] var/touchunknownreagents[0] - for(var/B in C.touching.reagent_list) - var/datum/reagent/R = B + for(var/datum/reagent/R as anything in C.touching.reagent_list) if(R.scannable) touchreagentdata["[R.id]"] = "\t[round(C.touching.get_reagent_amount(R.id), 1)]u [R.name][(R.overdose && R.can_overdose_touch && R.volume > R.overdose) ? " - Overdose" : ""]
" if (advscan == 0 || showadvscan == 0) diff --git a/code/game/objects/items/devices/scanners_vr.dm b/code/game/objects/items/devices/scanners_vr.dm index b0c928e5a2..1722617106 100644 --- a/code/game/objects/items/devices/scanners_vr.dm +++ b/code/game/objects/items/devices/scanners_vr.dm @@ -54,8 +54,7 @@ var/global/mob/living/carbon/human/dummy/mannequin/sleevemate_mob // Gather potential subtargets var/list/choices = list(M) if(istype(M)) - 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/carbon/human/H in B) // I do want an istype choices += H // Subtargets diff --git a/code/game/objects/items/stacks/medical_vr.dm b/code/game/objects/items/stacks/medical_vr.dm index 4599bb43f9..9ba54cea33 100644 --- a/code/game/objects/items/stacks/medical_vr.dm +++ b/code/game/objects/items/stacks/medical_vr.dm @@ -43,16 +43,14 @@ var/clotted = 0 var/too_far_gone = 0 - for(var/org in H.organs) //'organs' is just external organs, as opposed to 'internal_organs' - var/obj/item/organ/external/affecting = org + for(var/obj/item/organ/external/affecting as anything in H.organs) //'organs' is just external organs, as opposed to 'internal_organs' // No amount of clotting is going to help you here. if(affecting.open) too_far_gone++ continue - for(var/wnd in affecting.wounds) - var/datum/wound/W = wnd + for(var/datum/wound/W as anything in affecting.wounds) // No need if(W.bandaged) continue diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 38e173e3ff..67d76a8c89 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -252,6 +252,5 @@ return TRUE /obj/structure/proc/refresh_neighbors() - for(var/thing in RANGE_TURFS(1, src)) - var/turf/T = thing + for(var/turf/T as anything in RANGE_TURFS(1, src)) T.update_icon() diff --git a/code/game/objects/structures/electricchair.dm b/code/game/objects/structures/electricchair.dm index ca515e230f..2859d55dfb 100644 --- a/code/game/objects/structures/electricchair.dm +++ b/code/game/objects/structures/electricchair.dm @@ -65,8 +65,7 @@ s.set_up(12, 1, src) s.start() 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) L.burn_skin(85) to_chat(L, "You feel a deep shock course through your body!") sleep(1) diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 87f568f703..46a888e55f 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -456,8 +456,7 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart) ..() update_layer() 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.loc != loc) L.buckled = null //Temporary, so Move() succeeds. L.buckled = src //Restoring @@ -467,8 +466,7 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart) /obj/structure/bed/chair/janicart/proc/update_mob() 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) L.set_dir(dir) switch(dir) if(SOUTH) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 164554652b..4a3c5b53ff 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -63,8 +63,7 @@ ..() update_layer() 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) L.set_dir(dir) /obj/structure/bed/chair/verb/rotate_clockwise() @@ -151,8 +150,7 @@ playsound(src, 'sound/effects/roll.ogg', 100, 1) /obj/structure/bed/chair/office/handle_buckled_mob_movement(atom/new_loc, direction, movetime) - for(var/A in buckled_mobs) - var/mob/living/occupant = A + for(var/mob/living/occupant as anything in buckled_mobs) occupant.buckled = null occupant.Move(loc, direction, movetime) occupant.buckled = src diff --git a/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm b/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm index 461cc122bf..2521055dad 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm @@ -51,8 +51,7 @@ . = ..() if(.) 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) L.set_dir(dir) /obj/structure/bed/chair/wheelchair/attackby(obj/item/weapon/W as obj, mob/user as mob) @@ -95,8 +94,7 @@ var/turf/T = null //--1---Move occupant---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) L.buckled = null step(L, direction) L.buckled = src @@ -128,8 +126,7 @@ . = ..() playsound(src, 'sound/effects/roll.ogg', 75, 1) if(has_buckled_mobs()) - for(var/A in buckled_mobs) - var/mob/living/occupant = A + for(var/mob/living/occupant as anything in buckled_mobs) if(!driving) occupant.buckled = null occupant.Move(src.loc) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 72474fea33..a8eb677840 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -265,12 +265,11 @@ /obj/machinery/shower/process() if(!on) return - for(var/thing in loc) - var/atom/movable/AM = thing - var/mob/living/L = thing - if(istype(AM) && AM.simulated) + for(var/atom/movable/AM in loc) + if(AM.simulated) wash(AM) - if(istype(L)) + if(isliving(AM)) + var/mob/living/L = AM process_heat(L) wash_floor() reagents.add_reagent("water", reagents.get_free_space()) diff --git a/code/game/periodic_news.dm b/code/game/periodic_news.dm index a3d89313c5..a5eb2042be 100644 --- a/code/game/periodic_news.dm +++ b/code/game/periodic_news.dm @@ -109,7 +109,7 @@ var/global/list/newscaster_standard_feeds = list(/datum/news_announcement/bluesp var/global/tmp/announced_news_types = list() /proc/check_for_newscaster_updates(type) - for(var/subtype in typesof(type)-type) + for(var/subtype in subtypesof(type)) var/datum/news_announcement/news = new subtype() if(news.round_time * 10 <= world.time && !(subtype in announced_news_types)) announced_news_types += subtype diff --git a/code/game/sound.dm b/code/game/sound.dm index 4635415058..0b2cf4b80e 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -17,8 +17,7 @@ var/list/listeners = player_list if(!ignore_walls) //these sounds don't carry through walls listeners = listeners & hearers(maxdistance,turf_source) - for(var/P in listeners) - var/mob/M = P + for(var/mob/M as anything in listeners) if(!M || !M.client) continue var/turf/T = get_turf(M) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 10e78e83ee..5a6495d638 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -239,19 +239,17 @@ /turf/proc/AdjacentTurfs(var/check_blockage = TRUE) . = list() - for(var/t in (trange(1,src) - src)) - var/turf/T = t + for(var/turf/T as anything in (trange(1,src) - src)) if(check_blockage) if(!T.density) if(!LinkBlocked(src, T) && !TurfBlockedNonWindow(T)) - . += t + . += T else - . += t + . += T /turf/proc/CardinalTurfs(var/check_blockage = TRUE) . = list() - for(var/ad in AdjacentTurfs(check_blockage)) - var/turf/T = ad + for(var/turf/T as anything in AdjacentTurfs(check_blockage)) if(T.x == src.x || T.y == src.y) . += T diff --git a/code/modules/admin/admin_secrets.dm b/code/modules/admin/admin_secrets.dm index 89f032071c..e8ab89101c 100644 --- a/code/modules/admin/admin_secrets.dm +++ b/code/modules/admin/admin_secrets.dm @@ -12,7 +12,7 @@ var/datum/admin_secrets/admin_secrets = new() for(var/datum/admin_secret_category/category in categories) category_assoc[category.type] = category - for(var/item_type in (typesof(/datum/admin_secret_item) - /datum/admin_secret_item)) + for(var/item_type in subtypesof(/datum/admin_secret_item)) var/datum/admin_secret_item/secret_item = item_type if(!initial(secret_item.name)) continue diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index fd11766653..e9d63621b0 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -302,7 +302,7 @@ to_chat(usr, "Looks like you didn't select a mob.") return - var/list/possible_modifiers = typesof(/datum/modifier) - /datum/modifier + var/list/possible_modifiers = subtypesof(/datum/modifier) var/new_modifier_type = tgui_input_list(usr, "What modifier should we add to [L]?", "Modifier Type", possible_modifiers) if(!new_modifier_type) diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2.dm b/code/modules/admin/verbs/SDQL2/SDQL_2.dm index 0d9bceb996..60542d5a05 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_2.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_2.dm @@ -238,8 +238,7 @@ Example: USING PROCCALL = BLOCKING, SELECT = FORCE_NULLS, PRIORITY = HIGH SELECT do CHECK_TICK finished = TRUE - for(var/i in running) - var/datum/SDQL2_query/query = i + for(var/datum/SDQL2_query/query as anything in running) if(QDELETED(query)) running -= query continue @@ -562,8 +561,7 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null location = list(location) if(type == "*") - for(var/i in location) - var/datum/d = i + for(var/datum/d as anything in location) if(d.can_vv_get() || superuser) out += d SDQL2_TICK_CHECK diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 20d3bad3c7..1943147aee 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -82,8 +82,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) return var/list/dat = list("[title]") dat += "Refresh

" - for(var/I in l2b) - var/datum/admin_help/AH = I + for(var/datum/admin_help/AH as anything in l2b) dat += "Ticket #[AH.id]: [AH.initiator_key_name]: [AH.name]
" usr << browse(dat.Join(), "window=ahelp_list[state];size=600x480") @@ -92,8 +91,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) /datum/admin_help_tickets/proc/stat_entry() var/num_disconnected = 0 stat("Active Tickets:", astatclick.update("[active_tickets.len]")) - for(var/I in active_tickets) - var/datum/admin_help/AH = I + for(var/datum/admin_help/AH as anything in active_tickets) if(AH.initiator) stat("#[AH.id]. [AH.initiator_key_name]:", AH.statclick.update()) else @@ -119,8 +117,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) //Get a ticket given a ckey /datum/admin_help_tickets/proc/CKey2ActiveTicket(ckey) - for(var/I in active_tickets) - var/datum/admin_help/AH = I + for(var/datum/admin_help/AH as anything in active_tickets) if(AH.initiator_ckey == ckey) return AH @@ -669,8 +666,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) /proc/ircadminwho() var/list/message = list("Admins: ") var/list/admin_keys = list() - for(var/adm in GLOB.admins) - var/client/C = adm + for(var/client/C as anything in GLOB.admins) admin_keys += "[C][C.holder.fakekey ? "(Stealth)" : ""][C.is_afk() ? "(AFK)" : ""]" for(var/admin in admin_keys) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index e903df406a..645c2eef1c 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -282,8 +282,7 @@ Ccomp's first proc. GLOB.respawn_timers -= target var/found_client = FALSE - for(var/c in GLOB.clients) - var/client/C = c + for(var/client/C as anything in GLOB.clients) if(C.ckey == target) found_client = C to_chat(C, "You may now respawn. You should roleplay as if you learned nothing about the round during your time with the dead.") diff --git a/code/modules/admin/view_variables/modify_variables.dm b/code/modules/admin/view_variables/modify_variables.dm index 6f354e9b63..8863e76533 100644 --- a/code/modules/admin/view_variables/modify_variables.dm +++ b/code/modules/admin/view_variables/modify_variables.dm @@ -46,8 +46,7 @@ GLOBAL_PROTECT(VVpixelmovement) var/things = get_all_of_type(type, subtypes) var/i = 0 - for(var/thing in things) - var/datum/D = thing + for(var/datum/D as anything in things) i++ //try one of 3 methods to shorten the type text: // fancy type, diff --git a/code/modules/ai/ai_holder.dm b/code/modules/ai/ai_holder.dm index edd55a4c04..78f16a96a0 100644 --- a/code/modules/ai/ai_holder.dm +++ b/code/modules/ai/ai_holder.dm @@ -175,11 +175,10 @@ var/list/choices = list() for(var/typechoice in types) var/list/found = list() - for(var/mob in searching) // Isnt't there a helper for this, maybe? I forget. - var/atom/M = mob + for(var/atom/M as anything in searching) // Isnt't there a helper for this, maybe? I forget. if(!(M.z in levels_working)) continue - if(!istype(mob,typechoice)) + if(!istype(M,typechoice)) continue found += M choices["[typechoice] ([found.len])"] = found // Prettified name for the user input below) @@ -190,8 +189,7 @@ href_list["datumrefresh"] = "\ref[src]" return var/list/selected = choices[choice] - for(var/mob in selected) - var/mob/living/L = mob + for(var/mob/living/L as anything in selected) if(!istype(L)) to_chat(usr,"Skipping incompatible mob: [L] [ADMIN_COORDJMP(L)]") continue diff --git a/code/modules/ai/ai_holder_combat.dm b/code/modules/ai/ai_holder_combat.dm index e2e1ecbdea..760031985e 100644 --- a/code/modules/ai/ai_holder_combat.dm +++ b/code/modules/ai/ai_holder_combat.dm @@ -132,8 +132,7 @@ ai_log("test_projectile_safety() : Test projectile did[!would_hit_primary_target ? " NOT " : " "]hit \the [AM]", AI_LOG_DEBUG) // Make sure we don't have a chance to shoot our friends. - for(var/a in hit_things) - var/atom/A = a + for(var/atom/A as anything in hit_things) ai_log("test_projectile_safety() : Evaluating \the [A] ([A.type]).", AI_LOG_TRACE) if(isliving(A)) // Don't shoot at our friends, even if they're behind the target, as RNG can make them get hit. var/mob/living/L = A diff --git a/code/modules/ai/ai_holder_communication.dm b/code/modules/ai/ai_holder_communication.dm index beddb68924..caafe5c8b8 100644 --- a/code/modules/ai/ai_holder_communication.dm +++ b/code/modules/ai/ai_holder_communication.dm @@ -84,8 +84,7 @@ if(rand(0,200) < speak_chance) // Check if anyone is around to 'appreciate' what we say. var/alone = TRUE - for(var/m in viewers(holder)) - var/mob/M = m + for(var/mob/M as anything in viewers(holder)) if(M.client) alone = FALSE break diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index af697777f9..66ed0c186a 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -127,8 +127,7 @@ return TRUE if("visible") visible = !visible - for(var/ibeam in i_beams) - var/obj/effect/beam/i_beam/I = ibeam + for(var/obj/effect/beam/i_beam/I as anything in i_beams) I.visible = visible CHECK_TICK return TRUE diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index e92d5b1719..88cbfa16f7 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -375,8 +375,7 @@ /datum/asset/spritesheet/vending/register() populate_vending_products() - for(var/k in GLOB.vending_products) - var/atom/item = k + for(var/atom/item as anything in GLOB.vending_products) if(!ispath(item, /atom)) continue diff --git a/code/modules/awaymissions/loot_vr.dm b/code/modules/awaymissions/loot_vr.dm index 17509ce12e..d602eb9da2 100644 --- a/code/modules/awaymissions/loot_vr.dm +++ b/code/modules/awaymissions/loot_vr.dm @@ -63,7 +63,7 @@ //credits var/amount = rand(2,6) var/list/possible_spawns = list() - for(var/cash_type in typesof(/obj/item/weapon/spacecash) - /obj/item/weapon/spacecash) + for(var/cash_type in subtypesof(/obj/item/weapon/spacecash)) possible_spawns += cash_type var/cash_type = pick(possible_spawns) diff --git a/code/modules/blob2/blobs/base_blob.dm b/code/modules/blob2/blobs/base_blob.dm index f9c9eb588d..14f7eb54c0 100644 --- a/code/modules/blob2/blobs/base_blob.dm +++ b/code/modules/blob2/blobs/base_blob.dm @@ -111,8 +111,7 @@ GLOBAL_LIST_EMPTY(all_blobs) shuffle_inplace(blobs_to_affect) - for(var/L in blobs_to_affect) - var/obj/structure/blob/B = L + for(var/obj/structure/blob/B as anything in blobs_to_affect) if(B.faction != faction) continue diff --git a/code/modules/blob2/blobs/core.dm b/code/modules/blob2/blobs/core.dm index cd4a68a308..2b5cefa89d 100644 --- a/code/modules/blob2/blobs/core.dm +++ b/code/modules/blob2/blobs/core.dm @@ -197,8 +197,7 @@ var/list/blob_cores = list() if(!difficulty_threshold) return var/list/valid_types = list() - for(var/thing in subtypesof(/datum/blob_type)) - var/datum/blob_type/BT = thing + for(var/datum/blob_type/BT as anything in subtypesof(/datum/blob_type)) if(initial(BT.difficulty) > difficulty_threshold) // Too hard. continue if(initial(BT.difficulty) < difficulty_floor) // Too easy. diff --git a/code/modules/blob2/overmind/overmind.dm b/code/modules/blob2/overmind/overmind.dm index 6df0cba629..cdfe6d766a 100644 --- a/code/modules/blob2/overmind/overmind.dm +++ b/code/modules/blob2/overmind/overmind.dm @@ -57,14 +57,12 @@ var/list/overminds = list() return ..(newloc) /mob/observer/blob/Destroy() - for(var/BL in GLOB.all_blobs) - var/obj/structure/blob/B = BL + for(var/obj/structure/blob/B as anything in GLOB.all_blobs) if(B && B.overmind == src) B.overmind = null B.update_icon() //reset anything that was ours - for(var/BLO in blob_mobs) - var/mob/living/simple_mob/blob/spore/BM = BLO + for(var/mob/living/simple_mob/blob/spore/BM as anything in blob_mobs) if(BM) BM.overmind = null BM.update_icons() diff --git a/code/modules/blob2/overmind/types/synchronous_mesh.dm b/code/modules/blob2/overmind/types/synchronous_mesh.dm index e234756b2d..acf9441b71 100644 --- a/code/modules/blob2/overmind/types/synchronous_mesh.dm +++ b/code/modules/blob2/overmind/types/synchronous_mesh.dm @@ -34,8 +34,7 @@ if(!istype(C, /obj/structure/blob/core) && !istype(C, /obj/structure/blob/node) && C.overmind && (C.overmind == B.overmind) ) //if it doesn't have the same 'ownership' or is a core or node, don't split damage to it blobs_to_hurt += C - for(var/thing in blobs_to_hurt) - var/obj/structure/blob/C = thing + for(var/obj/structure/blob/C as anything in blobs_to_hurt) if(C == B) continue // We'll damage this later. diff --git a/code/modules/busy_space/loremaster.dm b/code/modules/busy_space/loremaster.dm index 28dca0055b..9c2f0f55b4 100644 --- a/code/modules/busy_space/loremaster.dm +++ b/code/modules/busy_space/loremaster.dm @@ -7,7 +7,7 @@ var/datum/lore/loremaster/loremaster = new/datum/lore/loremaster /datum/lore/loremaster/New() - var/list/paths = typesof(/datum/lore/organization) - /datum/lore/organization + var/list/paths = subtypesof(/datum/lore/organization) for(var/path in paths) // Some intermediate paths are not real organizations (ex. /datum/lore/organization/mil). Only do ones with names var/datum/lore/organization/instance = path diff --git a/code/modules/busy_space_vr/loremaster.dm b/code/modules/busy_space_vr/loremaster.dm index 28dca0055b..9c2f0f55b4 100644 --- a/code/modules/busy_space_vr/loremaster.dm +++ b/code/modules/busy_space_vr/loremaster.dm @@ -7,7 +7,7 @@ var/datum/lore/loremaster/loremaster = new/datum/lore/loremaster /datum/lore/loremaster/New() - var/list/paths = typesof(/datum/lore/organization) - /datum/lore/organization + var/list/paths = subtypesof(/datum/lore/organization) for(var/path in paths) // Some intermediate paths are not real organizations (ex. /datum/lore/organization/mil). Only do ones with names var/datum/lore/organization/instance = path diff --git a/code/modules/catalogue/cataloguer.dm b/code/modules/catalogue/cataloguer.dm index 8f7f3152f3..92ed97f347 100644 --- a/code/modules/catalogue/cataloguer.dm +++ b/code/modules/catalogue/cataloguer.dm @@ -78,8 +78,7 @@ GLOBAL_LIST_EMPTY(all_cataloguers) if(isturf(target) && (!target.can_catalogue())) var/turf/T = target - for(var/a in T) // If we can't scan the turf, see if we can scan anything on it, to help with aiming. - var/atom/A = a + for(var/atom/A as anything in T) // If we can't scan the turf, see if we can scan anything on it, to help with aiming. if(A.can_catalogue()) target = A break @@ -149,8 +148,7 @@ GLOBAL_LIST_EMPTY(all_cataloguers) // Figure out who may have helped out. var/list/contributers = list() var/list/contributer_names = list() - for(var/thing in player_list) - var/mob/living/L = thing + for(var/mob/living/L as anything in player_list) if(L == user) continue if(!istype(L)) @@ -169,8 +167,7 @@ GLOBAL_LIST_EMPTY(all_cataloguers) if(istype(I)) var/list/discoveries = I.discover(user, list(user.name) + contributer_names) // If one discovery leads to another, the list returned will have all of them. if(LAZYLEN(discoveries)) - for(var/D in discoveries) - var/datum/category_item/catalogue/data = D + for(var/datum/category_item/catalogue/data as anything in discoveries) points_gained += data.value // Give out points. @@ -208,23 +205,20 @@ GLOBAL_LIST_EMPTY(all_cataloguers) // First, get everything able to be scanned. var/list/scannable_atoms = list() - for(var/a in view(world.view, user)) - var/atom/A = a + for(var/atom/A as anything in view(world.view, user)) if(A.can_catalogue()) // Not passing the user is intentional, so they don't get spammed. scannable_atoms += A // Highlight things able to be scanned. var/filter = filter(type = "outline", size = 1, color = "#00FF00") - for(var/a in scannable_atoms) - var/atom/A = a + for(var/atom/A as anything in scannable_atoms) A.filters += filter to_chat(user, span("notice", "\The [src] is highlighting scannable objects in green, if any exist.")) sleep(2 SECONDS) // Remove the highlights. - for(var/a in scannable_atoms) - var/atom/A = a + for(var/atom/A as anything in scannable_atoms) if(QDELETED(A)) continue A.filters -= filter @@ -271,14 +265,12 @@ GLOBAL_LIST_EMPTY(all_cataloguers) else dat += "
" - for(var/G in GLOB.catalogue_data.categories) - var/datum/category_group/group = G + for(var/datum/category_group/group as anything in GLOB.catalogue_data.categories) var/list/group_dat = list() var/show_group = FALSE group_dat += "[group.name]" - for(var/I in group.items) - var/datum/category_item/catalogue/item = I + for(var/datum/category_item/catalogue/item as anything in group.items) if(item.visible || debug) group_dat += "[item.name]" show_group = TRUE diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index bd905205f4..f68ddc011d 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -74,13 +74,12 @@ if(href_list["discord_reg"]) var/their_id = html_decode(href_list["discord_reg"]) var/sane = FALSE - for(var/item in GLOB.pending_discord_registrations) - var/list/L = item + for(var/list/L as anything in GLOB.pending_discord_registrations) if(!islist(L)) - GLOB.pending_discord_registrations -= item + GLOB.pending_discord_registrations -= L continue if(L["ckey"] == ckey && L["id"] == their_id) - GLOB.pending_discord_registrations -= list(item) + GLOB.pending_discord_registrations -= list(L) var/time = L["time"] if((world.realtime - time) > 10 MINUTES) to_chat(src, "Sorry, that link has expired. Please request another on Discord.") diff --git a/code/modules/client/preference_setup/global/02_settings.dm b/code/modules/client/preference_setup/global/02_settings.dm index f213c15a8a..8f047985c7 100644 --- a/code/modules/client/preference_setup/global/02_settings.dm +++ b/code/modules/client/preference_setup/global/02_settings.dm @@ -29,8 +29,7 @@ // Arrange preferences that have never been enabled/disabled. var/list/client_preference_keys = list() - 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()) client_preference_keys += client_pref.key if((client_pref.key in pref.preferences_enabled) || (client_pref.key in pref.preferences_disabled)) continue @@ -57,8 +56,7 @@ . += "Preferences
" . += "" 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