From 033d14e8b3228af2ac46306c57aaad4ae4d75563 Mon Sep 17 00:00:00 2001 From: kevinz000 Date: Thu, 12 Oct 2017 04:12:03 -0700 Subject: [PATCH 001/105] loc -- > forcemove --- code/game/machinery/syndicatebomb.dm | 24 +-- code/game/machinery/vending.dm | 8 +- code/game/objects/structures/bedsheet_bin.dm | 8 +- code/game/objects/structures/door_assembly.dm | 150 +++++++++--------- .../modules/mob/living/silicon/robot/robot.dm | 22 +-- code/modules/shuttle/on_move.dm | 2 +- .../spells/spell_types/area_teleport.dm | 2 +- code/modules/spells/spell_types/devil.dm | 28 ++-- code/modules/spells/spell_types/dumbfire.dm | 4 +- .../spells/spell_types/ethereal_jaunt.dm | 11 +- code/modules/spells/spell_types/projectile.dm | 6 +- code/modules/spells/spell_types/shapeshift.dm | 4 +- code/modules/spells/spell_types/summonitem.dm | 4 +- .../spells/spell_types/turf_teleport.dm | 6 +- code/modules/surgery/implant_removal.dm | 61 ++++++- code/modules/surgery/lipoplasty.dm | 40 +++++ code/modules/vehicles/pimpin_ride.dm | 2 +- code/modules/vehicles/speedbike.dm | 6 +- code/modules/vehicles/vehicle.dm | 2 +- 19 files changed, 237 insertions(+), 153 deletions(-) diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index d279f2849f..bce2b5d317 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -140,7 +140,7 @@ if(open_panel && wires.is_all_cut()) if(payload) to_chat(user, "You carefully pry out [payload].") - payload.loc = user.loc + payload.forceMove(drop_location()) payload = null else to_chat(user, "There isn't anything in here to remove!") @@ -206,14 +206,14 @@ var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num if(in_range(src, user) && isliving(user)) //No running off and setting bombs from across the station timer_set = Clamp(new_timer, minimum_timer, maximum_timer) - src.loc.visible_message("[icon2html(src, viewers(src))] timer set for [timer_set] seconds.") + loc.visible_message("[icon2html(src, viewers(src))] timer set for [timer_set] seconds.") if(alert(user,"Would you like to start the countdown now?",,"Yes","No") == "Yes" && in_range(src, user) && isliving(user)) if(defused || active) if(defused) - src.loc.visible_message("[icon2html(src, viewers(src))] Device error: User intervention required.") + visible_message("[icon2html(src, viewers(src))] Device error: User intervention required.") return else - src.loc.visible_message("[icon2html(src, viewers(loc))] [timer_set] seconds until detonation, please clear the area.") + visible_message("[icon2html(src, viewers(loc))] [timer_set] seconds until detonation, please clear the area.") activate() update_icon() add_fingerprint(user) @@ -223,7 +223,7 @@ if(payload && !istype(payload, /obj/item/bombcore/training)) message_admins("[ADMIN_LOOKUPFLW(user)] has primed a [name] ([payload]) for detonation at [A.name] [ADMIN_JMP(bombturf)].") log_game("[key_name(user)] has primed a [name] ([payload]) for detonation at [A.name][COORD(bombturf)]") - payload.adminlog = "The [src.name] that [key_name(user)] had primed detonated!" + payload.adminlog = "The [name] that [key_name(user)] had primed detonated!" ///Bomb Subtypes/// @@ -359,7 +359,7 @@ var/amt_summon = 1 /obj/item/bombcore/badmin/summon/detonate() - var/obj/machinery/syndicatebomb/B = src.loc + var/obj/machinery/syndicatebomb/B = loc spawn_and_random_walk(summon_path, src, amt_summon, walk_chance=50, admin_spawn=TRUE) qdel(B) qdel(src) @@ -369,7 +369,7 @@ amt_summon = 100 /obj/item/bombcore/badmin/summon/clown/defuse() - playsound(src.loc, 'sound/misc/sadtrombone.ogg', 50) + playsound(src, 'sound/misc/sadtrombone.ogg', 50) ..() /obj/item/bombcore/large @@ -457,7 +457,7 @@ if(istype(I, /obj/item/crowbar) && beakers.len > 0) playsound(loc, I.usesound, 50, 1) for (var/obj/item/B in beakers) - B.loc = get_turf(src) + B.forceMove(drop_location()) beakers -= B return else if(istype(I, /obj/item/reagent_containers/glass/beaker) || istype(I, /obj/item/reagent_containers/glass/bottle)) @@ -488,9 +488,9 @@ for(var/obj/item/slime_extract/S in LG.beakers) // And slime cores. if(beakers.len < max_beakers) beakers += S - S.loc = src + S.forceMove(src) else - S.loc = get_turf(src) + S.forceMove(drop_location()) if(istype(G, /obj/item/grenade/chem_grenade/cryo)) spread_range -= 1 // Reduced range, but increased density. @@ -505,9 +505,9 @@ for(var/obj/item/reagent_containers/glass/B in G) if(beakers.len < max_beakers) beakers += B - B.loc = src + B.forceMove(src) else - B.loc = get_turf(src) + B.forceMove(drop_location()) qdel(G) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index bf08e98992..0d8d95ec81 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -259,7 +259,7 @@ cut_overlays() if(panel_open) add_overlay("[initial(icon_state)]-panel") - playsound(src.loc, W.usesound, 50, 1) + playsound(src, W.usesound, 50, 1) updateUsrDialog() else to_chat(user, "You must first secure [src].") @@ -403,7 +403,7 @@ var/datum/browser/popup = new(user, "vending", (name)) popup.set_content(dat) - popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) + popup.set_title_image(user.browse_rsc_icon(icon, icon_state)) popup.open() @@ -453,7 +453,7 @@ dish_quants[N] = max(dish_quants[N] - 1, 0) for(var/obj/O in contents) if(O.name == N) - O.loc = src.loc + O.forceMove(drop_location()) break vend_ready = 1 updateUsrDialog() @@ -520,7 +520,7 @@ if(icon_vend) //Show the vending animation if needed flick(icon_vend,src) new R.product_path(get_turf(src)) - SSblackbox.add_details("vending_machine_usage","[src.type]|[R.product_path]") + SSblackbox.add_details("vending_machine_usage","[type]|[R.product_path]") vend_ready = 1 return diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index f6e2023943..238c83725b 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -309,13 +309,13 @@ LINEN BINS else B = new /obj/item/bedsheet(loc) - B.loc = user.loc + B.forceMove(drop_location()) user.put_in_hands(B) to_chat(user, "You take [B] out of [src].") update_icon() if(hidden) - hidden.loc = user.loc + hidden.forceMove(drop_location()) to_chat(user, "[hidden] falls out of [B]!") hidden = null @@ -333,12 +333,12 @@ LINEN BINS else B = new /obj/item/bedsheet(loc) - B.loc = loc + B.forceMove(drop_location()) to_chat(user, "You telekinetically remove [B] from [src].") update_icon() if(hidden) - hidden.loc = loc + hidden.forceMove(drop_location()) hidden = null diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index 448b358c1a..24f5b9ac42 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -1,3 +1,8 @@ + +#define AIRLOCK_ASSEMBLY_NEEDS_WIRES 0 +#define AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS 1 +#define AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER 2 + /obj/structure/door_assembly name = "airlock assembly" icon = 'icons/obj/doors/airlocks/station/public.dmi' @@ -6,8 +11,7 @@ anchored = FALSE density = TRUE max_integrity = 200 - desc = "The mechanical framework for an airlock." - var/state = 0 + var/state = AIRLOCK_ASSEMBLY_NEEDS_WIRES var/mineral = null var/typetext = "" var/icontext = "" @@ -26,7 +30,7 @@ name = "airlock assembly" airlock_type = /obj/machinery/door/airlock anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_com name = "command airlock assembly" @@ -36,7 +40,7 @@ glass_type = /obj/machinery/door/airlock/glass_command airlock_type = /obj/machinery/door/airlock/command anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_com/glass mineral = "glass" @@ -50,7 +54,7 @@ glass_type = /obj/machinery/door/airlock/glass_security airlock_type = /obj/machinery/door/airlock/security anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_sec/glass mineral = "glass" @@ -64,7 +68,7 @@ glass_type = /obj/machinery/door/airlock/glass_engineering airlock_type = /obj/machinery/door/airlock/engineering anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_eng/glass mineral = "glass" @@ -78,7 +82,7 @@ glass_type = /obj/machinery/door/airlock/glass_mining airlock_type = /obj/machinery/door/airlock/mining anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_min/glass mineral = "glass" @@ -92,7 +96,7 @@ glass_type = /obj/machinery/door/airlock/glass_atmos airlock_type = /obj/machinery/door/airlock/atmos anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_atmo/glass mineral = "glass" @@ -106,7 +110,7 @@ glass_type = /obj/machinery/door/airlock/glass_research airlock_type = /obj/machinery/door/airlock/research anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_research/glass mineral = "glass" @@ -120,7 +124,7 @@ glass_type = /obj/machinery/door/airlock/glass_science airlock_type = /obj/machinery/door/airlock/science anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_science/glass mineral = "glass" @@ -134,7 +138,7 @@ glass_type = /obj/machinery/door/airlock/glass_medical airlock_type = /obj/machinery/door/airlock/medical anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_med/glass mineral = "glass" @@ -148,7 +152,7 @@ glass_type = /obj/machinery/door/airlock/glass_maintenance airlock_type = /obj/machinery/door/airlock/maintenance anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_mai/glass mineral = "glass" @@ -163,7 +167,7 @@ glass_type = /obj/machinery/door/airlock/glass_external airlock_type = /obj/machinery/door/airlock/external anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_ext/glass mineral = "glass" @@ -176,7 +180,7 @@ icontext = "fre" airlock_type = /obj/machinery/door/airlock/freezer anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_hatch name = "airtight hatch assembly" @@ -186,7 +190,7 @@ icontext = "hatch" airlock_type = /obj/machinery/door/airlock/hatch anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_mhatch name = "maintenance hatch assembly" @@ -196,7 +200,7 @@ icontext = "mhatch" airlock_type = /obj/machinery/door/airlock/maintenance_hatch anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_glass name = "glass airlock assembly" @@ -204,7 +208,7 @@ overlays_file = 'icons/obj/doors/airlocks/station2/overlays.dmi' airlock_type = /obj/machinery/door/airlock/glass anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "glass" material = "glass" @@ -213,7 +217,7 @@ icon = 'icons/obj/doors/airlocks/station/gold.dmi' airlock_type = /obj/machinery/door/airlock/gold anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "gold" /obj/structure/door_assembly/door_assembly_silver @@ -221,7 +225,7 @@ icon = 'icons/obj/doors/airlocks/station/silver.dmi' airlock_type = /obj/machinery/door/airlock/silver anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "silver" /obj/structure/door_assembly/door_assembly_diamond @@ -229,7 +233,7 @@ icon = 'icons/obj/doors/airlocks/station/diamond.dmi' airlock_type = /obj/machinery/door/airlock/diamond anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "diamond" /obj/structure/door_assembly/door_assembly_uranium @@ -237,7 +241,7 @@ icon = 'icons/obj/doors/airlocks/station/uranium.dmi' airlock_type = /obj/machinery/door/airlock/uranium anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "uranium" /obj/structure/door_assembly/door_assembly_plasma @@ -245,7 +249,7 @@ icon = 'icons/obj/doors/airlocks/station/plasma.dmi' airlock_type = /obj/machinery/door/airlock/plasma anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "plasma" /obj/structure/door_assembly/door_assembly_clown @@ -254,7 +258,7 @@ icon = 'icons/obj/doors/airlocks/station/bananium.dmi' airlock_type = /obj/machinery/door/airlock/clown anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "bananium" /obj/structure/door_assembly/door_assembly_sandstone @@ -262,7 +266,7 @@ icon = 'icons/obj/doors/airlocks/station/sandstone.dmi' airlock_type = /obj/machinery/door/airlock/sandstone anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "sandstone" /obj/structure/door_assembly/door_assembly_titanium @@ -274,7 +278,7 @@ glass_type = /obj/machinery/door/airlock/glass_titanium airlock_type = /obj/machinery/door/airlock/titanium anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "titanium" /obj/structure/door_assembly/door_assembly_titanium/glass @@ -289,7 +293,7 @@ icontext = "highsec" airlock_type = /obj/machinery/door/airlock/highsecurity anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_vault name = "vault door assembly" @@ -299,7 +303,7 @@ icontext = "vault" airlock_type = /obj/machinery/door/airlock/vault anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_shuttle name = "shuttle airlock assembly" @@ -309,7 +313,7 @@ icontext = "shuttle" airlock_type = /obj/machinery/door/airlock/shuttle anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_cult name = "cult airlock assembly" @@ -319,7 +323,7 @@ icontext = "cult" airlock_type = /obj/machinery/door/airlock/cult anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_cult/glass mineral = "glass" @@ -338,7 +342,7 @@ icon = 'icons/obj/doors/airlocks/station/wood.dmi' airlock_type = /obj/machinery/door/airlock/wood anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS mineral = "wood" /obj/structure/door_assembly/door_assembly_viro @@ -349,7 +353,7 @@ glass_type = /obj/machinery/door/airlock/glass_virology airlock_type = /obj/machinery/door/airlock/virology anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/door_assembly_viro/glass mineral = "glass" @@ -362,7 +366,7 @@ icontext = "ele" airlock_type = /obj/machinery/door/airlock/centcom anchored = TRUE - state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS /obj/structure/door_assembly/examine(mob/user) ..() @@ -383,10 +387,10 @@ /obj/structure/door_assembly/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) - var/t = stripped_input(user, "Enter the name for the door.", src.name, src.created_name,MAX_NAME_LEN) + var/t = stripped_input(user, "Enter the name for the door.", name, created_name,MAX_NAME_LEN) if(!t) return - if(!in_range(src, usr) && src.loc != usr) + if(!in_range(src, usr) && loc != usr) return created_name = t @@ -410,7 +414,7 @@ icontype = input(user, "Please select a paintjob for this airlock.") in optionlist - if((!in_range(src, usr) && src.loc != usr) || !WT.use(user)) + if((!in_range(src, usr) && loc != usr) || !WT.use(user)) return var/has_solid = FALSE var/has_glass = FALSE @@ -525,7 +529,7 @@ if(WT.remove_fuel(0,user)) user.visible_message("[user] disassembles the airlock assembly.", \ "You start to disassemble the airlock assembly...") - playsound(src.loc, 'sound/items/welder2.ogg', 50, 1) + playsound(src, 'sound/items/welder2.ogg', 50, 1) if(do_after(user, 40*W.toolspeed, target = src)) if( !WT.isOn() ) @@ -542,22 +546,22 @@ break if(door_check) - playsound(src.loc, W.usesound, 100, 1) + playsound(src, W.usesound, 100, 1) user.visible_message("[user] secures the airlock assembly to the floor.", \ "You start to secure the airlock assembly to the floor...", \ "You hear wrenching.") if(do_after(user, 40*W.toolspeed, target = src)) - if( src.anchored ) + if(anchored) return to_chat(user, "You secure the airlock assembly.") - src.name = "secured airlock assembly" - src.anchored = TRUE + name = "secured airlock assembly" + anchored = TRUE else to_chat(user, "There is another door here!") else - playsound(src.loc, W.usesound, 100, 1) + playsound(src, W.usesound, 100, 1) user.visible_message("[user] unsecures the airlock assembly from the floor.", \ "You start to unsecure the airlock assembly from the floor...", \ "You hear wrenching.") @@ -578,63 +582,63 @@ if(do_after(user, 40, target = src)) if(C.get_amount() < 1 || state != 0) return C.use(1) - src.state = 1 + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS to_chat(user, "You wire the airlock assembly.") - src.name = "wired airlock assembly" + name = "wired airlock assembly" else if(istype(W, /obj/item/wirecutters) && state == 1 ) - playsound(src.loc, W.usesound, 100, 1) + playsound(src, W.usesound, 100, 1) user.visible_message("[user] cuts the wires from the airlock assembly.", \ "You start to cut the wires from the airlock assembly...") if(do_after(user, 40*W.toolspeed, target = src)) - if( src.state != 1 ) + if(state != 1) return to_chat(user, "You cut the wires from the airlock assembly.") new/obj/item/stack/cable_coil(get_turf(user), 1) - src.state = 0 - src.name = "secured airlock assembly" + state = AIRLOCK_ASSEMBLY_NEEDS_WIRES + name = "secured airlock assembly" else if(istype(W, /obj/item/electronics/airlock) && state == 1 ) - playsound(src.loc, W.usesound, 100, 1) + playsound(src, W.usesound, 100, 1) user.visible_message("[user] installs the electronics into the airlock assembly.", \ "You start to install electronics into the airlock assembly...") if(do_after(user, 40, target = src)) - if( src.state != 1 ) + if( state != 1 ) return if(!user.transferItemToLoc(W, src)) return to_chat(user, "You install the airlock electronics.") - src.state = 2 - src.name = "near finished airlock assembly" - src.electronics = W + state = AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER + name = "near finished airlock assembly" + electronics = W else if(istype(W, /obj/item/crowbar) && state == 2 ) - playsound(src.loc, W.usesound, 100, 1) + playsound(src, W.usesound, 100, 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*W.toolspeed, target = src)) - if( src.state != 2 ) + if(state != 2) return to_chat(user, "You remove the airlock electronics.") - src.state = 1 - src.name = "wired airlock assembly" + state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS + name = "wired airlock assembly" var/obj/item/electronics/airlock/ae if (!electronics) - ae = new/obj/item/electronics/airlock( src.loc ) + ae = new/obj/item/electronics/airlock( loc ) else ae = electronics electronics = null - ae.loc = src.loc + ae.forceMove(src.loc) else if(istype(W, /obj/item/stack/sheet) && !mineral) var/obj/item/stack/sheet/G = W if(G) if(G.get_amount() >= 1) if(is_glass_sheet(G)) - playsound(src.loc, 'sound/items/crowbar.ogg', 100, 1) + playsound(src, 'sound/items/crowbar.ogg', 100, 1) user.visible_message("[user] adds [G.name] to the airlock assembly.", \ "You start to install [G.name] into the airlock assembly...") if(do_after(user, 40, target = src)) @@ -651,8 +655,8 @@ material = "glass" //This list contains the airlock paintjobs that have a glass version: if(icontext in list("eng", "atmo", "sec", "com", "med", "res", "min")) - src.airlock_type = text2path("/obj/machinery/door/airlock/[typetext]") - src.glass_type = text2path("/obj/machinery/door/airlock/glass_[typetext]") + airlock_type = text2path("/obj/machinery/door/airlock/[typetext]") + glass_type = text2path("/obj/machinery/door/airlock/glass_[typetext]") else //This airlock is default or does not have a glass version, so we revert to the default glass airlock. |- Ricotez airlock_type = /obj/machinery/door/airlock @@ -662,7 +666,7 @@ else if(istype(G, /obj/item/stack/sheet/mineral)) var/M = G.sheettype if(G.get_amount() >= 2) - playsound(src.loc, 'sound/items/crowbar.ogg', 100, 1) + playsound(src, 'sound/items/crowbar.ogg', 100, 1) user.visible_message("[user] adds [G.name] to the airlock assembly.", \ "You start to install [G.name] into the airlock assembly...") if(do_after(user, 40, target = src)) @@ -675,28 +679,28 @@ glass_type = /obj/machinery/door/airlock/glass else if(istype(W, /obj/item/screwdriver) && state == 2 ) - playsound(src.loc, W.usesound, 100, 1) + playsound(src, W.usesound, 100, 1) user.visible_message("[user] finishes the airlock.", \ "You start finishing the airlock...") if(do_after(user, 40*W.toolspeed, target = src)) - if(src.loc && state == 2) + if(loc && state == 2) to_chat(user, "You finish the airlock.") var/obj/machinery/door/airlock/door if(mineral == "glass") - door = new src.glass_type( src.loc ) + door = new glass_type( loc ) else - door = new src.airlock_type( src.loc ) - //door.req_access = src.req_access - door.electronics = src.electronics - door.heat_proof = src.heat_proof_finished - if(src.electronics.one_access) - door.req_one_access = src.electronics.accesses + door = new airlock_type( loc ) + //door.req_access = req_access + door.electronics = electronics + door.heat_proof = heat_proof_finished + if(electronics.one_access) + door.req_one_access = electronics.accesses else - door.req_access = src.electronics.accesses + door.req_access = electronics.accesses if(created_name) door.name = created_name - src.electronics.loc = door + electronics.forceMove(door) qdel(src) else return ..() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 5f995956be..405379bc83 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -167,7 +167,7 @@ if(mmi && mind)//Safety for when a cyborg gets dust()ed. Or there is no MMI inside. var/turf/T = get_turf(loc)//To hopefully prevent run time errors. if(T) - mmi.loc = T + mmi.forceMove(T) if(mmi.brainmob) if(mmi.brainmob.stat == DEAD) mmi.brainmob.stat = CONSCIOUS @@ -770,24 +770,24 @@ /mob/living/silicon/robot/proc/deconstruct() var/turf/T = get_turf(src) if (robot_suit) - robot_suit.loc = T - robot_suit.l_leg.loc = T + robot_suit.forceMove(T) + robot_suit.l_leg.forceMove(T) robot_suit.l_leg = null - robot_suit.r_leg.loc = T + robot_suit.r_leg.forceMove(T) robot_suit.r_leg = null new /obj/item/stack/cable_coil(T, robot_suit.chest.wired) - robot_suit.chest.loc = T + robot_suit.chest.forceMove(T) robot_suit.chest.wired = 0 robot_suit.chest = null - robot_suit.l_arm.loc = T + robot_suit.l_arm.forceMove(T) robot_suit.l_arm = null - robot_suit.r_arm.loc = T + robot_suit.r_arm.forceMove(T) robot_suit.r_arm = null - robot_suit.head.loc = T - robot_suit.head.flash1.loc = T + robot_suit.head.forceMove(T) + robot_suit.head.flash1.forceMove(T) robot_suit.head.flash1.burn_out() robot_suit.head.flash1 = null - robot_suit.head.flash2.loc = T + robot_suit.head.flash2.forceMove(T) robot_suit.head.flash2.burn_out() robot_suit.head.flash2 = null robot_suit.head = null @@ -806,7 +806,7 @@ var/obj/item/device/assembly/flash/handheld/F = new /obj/item/device/assembly/flash/handheld(T) F.burn_out() if (cell) //Sanity check. - cell.loc = T + cell.forceMove(T) cell = null qdel(src) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index ad21c9e6ba..1135a91704 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -313,7 +313,7 @@ All ShuttleMove procs go here var/turf/T = loc if(level==1) hide(T.intact) - + /obj/structure/shuttle/beforeShuttleMove(turf/newT, rotation, move_mode) . = ..() . |= MOVE_CONTENTS diff --git a/code/modules/spells/spell_types/area_teleport.dm b/code/modules/spells/spell_types/area_teleport.dm index 7381cdf48f..23fdc1ee54 100644 --- a/code/modules/spells/spell_types/area_teleport.dm +++ b/code/modules/spells/spell_types/area_teleport.dm @@ -66,7 +66,7 @@ tempL.Remove(attempt) if(!success) - target.loc = pick(L) + target.forceMove(L) playsound(get_turf(user), sound2, 50,1) return diff --git a/code/modules/spells/spell_types/devil.dm b/code/modules/spells/spell_types/devil.dm index b1867413a3..733d0a3270 100644 --- a/code/modules/spells/spell_types/devil.dm +++ b/code/modules/spells/spell_types/devil.dm @@ -142,31 +142,23 @@ /mob/living/proc/infernalphaseout() dust_animation() spawn_dust() - src.visible_message("[src] disappears in a flashfire!") + visible_message("[src] disappears in a flashfire!") playsound(get_turf(src), 'sound/magic/enter_blood.ogg', 100, 1, -1) var/obj/effect/dummy/slaughter/holder = new /obj/effect/dummy/slaughter(loc) - src.ExtinguishMob() - if(buckled) - buckled.unbuckle_mob(src,force=1) - if(has_buckled_mobs()) - unbuckle_all_mobs(force=1) - if(pulledby) - pulledby.stop_pulling() - if(pulling) - stop_pulling() - src.loc = holder - src.holder = holder - src.notransform = 0 + ExtinguishMob() + forceMove(holder) + holder = holder + notransform = 0 fakefireextinguish() /mob/living/proc/infernalphasein() - if(src.notransform) + if(notransform) to_chat(src, "You're too busy to jaunt in.") - return 0 + return FALSE fakefire() - src.loc = get_turf(src) - src.client.eye = src - src.visible_message("[src] appears in a fiery blaze!") + forceMove(drop_location()) + client.eye = src + visible_message("[src] appears in a fiery blaze!") playsound(get_turf(src), 'sound/magic/exit_blood.ogg', 100, 1, -1) addtimer(CALLBACK(src, .proc/fakefireextinguish), 15, TIMER_UNIQUE) diff --git a/code/modules/spells/spell_types/dumbfire.dm b/code/modules/spells/spell_types/dumbfire.dm index a028ec36bd..bb6e4480f5 100644 --- a/code/modules/spells/spell_types/dumbfire.dm +++ b/code/modules/spells/spell_types/dumbfire.dm @@ -57,14 +57,14 @@ var/current_loc = user.loc - projectile.loc = current_loc + projectile.forceMove(current_loc) for(var/i = 0,i < proj_lifespan,i++) if(!projectile) break if(proj_insubstantial) - projectile.loc = get_step(projectile, projectile.dir) + projectile.forceMove(get_step(projectile, projectile.dir)) else step(projectile, projectile.dir) diff --git a/code/modules/spells/spell_types/ethereal_jaunt.dm b/code/modules/spells/spell_types/ethereal_jaunt.dm index eb855921e8..c98a2ef3ee 100644 --- a/code/modules/spells/spell_types/ethereal_jaunt.dm +++ b/code/modules/spells/spell_types/ethereal_jaunt.dm @@ -28,14 +28,7 @@ var/obj/effect/dummy/spell_jaunt/holder = new /obj/effect/dummy/spell_jaunt(mobloc) new jaunt_out_type(mobloc, target.dir) target.ExtinguishMob() - if(target.buckled) - target.buckled.unbuckle_mob(target,force=1) - if(target.pulledby) - target.pulledby.stop_pulling() - target.stop_pulling() - if(target.has_buckled_mobs()) - target.unbuckle_all_mobs(force=1) - target.loc = holder + target.forceMove(holder) target.reset_perspective(holder) target.notransform=0 //mob is safely inside holder now, no need for protection. jaunt_steam(mobloc) @@ -91,7 +84,7 @@ var/turf/newLoc = get_step(src,direction) setDir(direction) if(!(newLoc.flags_1 & NOJAUNT_1)) - loc = newLoc + forceMove(newLoc) else to_chat(user, "Some strange aura is blocking the way!") movedelay = world.time + movespeed diff --git a/code/modules/spells/spell_types/projectile.dm b/code/modules/spells/spell_types/projectile.dm index 1a682639eb..19e44ffa83 100644 --- a/code/modules/spells/spell_types/projectile.dm +++ b/code/modules/spells/spell_types/projectile.dm @@ -47,7 +47,7 @@ var/current_loc = user.loc - projectile.loc = current_loc + projectile.forceMove(current_loc) for(var/i = 0,i < proj_lifespan,i++) if(!projectile) @@ -56,12 +56,12 @@ if(proj_homing) if(proj_insubstantial) projectile.setDir(get_dir(projectile,target)) - projectile.loc = get_step_to(projectile,target) + projectile.forceMove(get_step_to(projectile,target)) else step_to(projectile,target) else if(proj_insubstantial) - projectile.loc = get_step(projectile,dir) + projectile.forceMove(get_step(projectile,dir)) else step(projectile,dir) diff --git a/code/modules/spells/spell_types/shapeshift.dm b/code/modules/spells/spell_types/shapeshift.dm index 63c840a9b0..4f56918e66 100644 --- a/code/modules/spells/spell_types/shapeshift.dm +++ b/code/modules/spells/spell_types/shapeshift.dm @@ -46,7 +46,7 @@ return var/mob/living/shape = new shapeshift_type(caster.loc) - caster.loc = shape + caster.forceMove(shape) caster.status_flags |= GODMODE current_shapes |= shape @@ -64,7 +64,7 @@ break if(!caster) return - caster.loc = shape.loc + caster.forceMove(shape.loc) caster.status_flags &= ~GODMODE clothes_req = initial(clothes_req) diff --git a/code/modules/spells/spell_types/summonitem.dm b/code/modules/spells/spell_types/summonitem.dm index 0f956b3dc9..7f5fc337b1 100644 --- a/code/modules/spells/spell_types/summonitem.dm +++ b/code/modules/spells/spell_types/summonitem.dm @@ -66,7 +66,7 @@ if(issilicon(M)) //Items in silicons warp the whole silicon M.loc.visible_message("[M] suddenly disappears!") - M.loc = L.loc + M.forceMove(L.loc) M.loc.visible_message("[M] suddenly appears!") item_to_retrieve = null break @@ -101,7 +101,7 @@ if(item_to_retrieve.loc) item_to_retrieve.loc.visible_message("The [item_to_retrieve.name] suddenly disappears!") if(!L.put_in_hands(item_to_retrieve)) - item_to_retrieve.loc = L.loc + item_to_retrieve.forceMove(L.loc) item_to_retrieve.loc.visible_message("The [item_to_retrieve.name] suddenly appears!") playsound(get_turf(L), 'sound/magic/summonitems_generic.ogg', 50, 1) else diff --git a/code/modules/spells/spell_types/turf_teleport.dm b/code/modules/spells/spell_types/turf_teleport.dm index 060bbb0374..3e3a982d4d 100644 --- a/code/modules/spells/spell_types/turf_teleport.dm +++ b/code/modules/spells/spell_types/turf_teleport.dm @@ -38,9 +38,5 @@ return if(!target.Move(picked)) - if(target.buckled) - target.buckled.unbuckle_mob(target,force=1) - if(target.has_buckled_mobs()) - target.unbuckle_all_mobs(force=1) - target.loc = picked + target.forceMove(picked) playsound(get_turf(user), sound2, 50,1) diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm index c459748a6c..58413b383b 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/surgery/implant_removal name = "implant removal" steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/extract_implant, /datum/surgery_step/close) @@ -43,4 +44,62 @@ else to_chat(user, "You can't find anything in [target]'s [target_zone]!") - return 1 \ No newline at end of file + return 1 +======= +/datum/surgery/implant_removal + name = "implant removal" + steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/extract_implant, /datum/surgery_step/close) + species = list(/mob/living/carbon/human, /mob/living/carbon/monkey) + possible_locs = list("chest") + + +//extract implant +/datum/surgery_step/extract_implant + name = "extract implant" + implements = list(/obj/item/hemostat = 100, /obj/item/crowbar = 65) + time = 64 + var/obj/item/implant/I = null + +/datum/surgery_step/extract_implant/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + for(var/obj/item/O in target.implants) + I = O + break + if(I) + user.visible_message("[user] begins to extract [I] from [target]'s [target_zone].", "You begin to extract [I] from [target]'s [target_zone]...") + else + user.visible_message("[user] looks for an implant in [target]'s [target_zone].", "You look for an implant in [target]'s [target_zone]...") + +/datum/surgery_step/extract_implant/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + if(I) + user.visible_message("[user] successfully removes [I] from [target]'s [target_zone]!", "You successfully remove [I] from [target]'s [target_zone].") + I.removed(target) + + var/obj/item/implantcase/case + for(var/obj/item/implantcase/ic in user.held_items) + case = ic + break + if(!case) + case = locate(/obj/item/implantcase) in get_turf(target) + if(case && !case.imp) + case.imp = I + I.forceMove(case) + case.update_icon() + user.visible_message("[user] places [I] into [case]!", "You place [I] into [case].") + else + qdel(I) + + else + to_chat(user, "You can't find anything in [target]'s [target_zone]!") + return 1 + +/datum/surgery/implant_removal/mechanic + name = "implant removal" + requires_bodypart_type = BODYPART_ROBOTIC + steps = list( + /datum/surgery_step/mechanic_open, + /datum/surgery_step/open_hatch, + /datum/surgery_step/mechanic_unwrench, + /datum/surgery_step/extract_implant, + /datum/surgery_step/mechanic_wrench, + /datum/surgery_step/mechanic_close) +>>>>>>> c43e205... loc -- > forcemove (#31176) diff --git a/code/modules/surgery/lipoplasty.dm b/code/modules/surgery/lipoplasty.dm index 816590610f..5bf1fb8f91 100644 --- a/code/modules/surgery/lipoplasty.dm +++ b/code/modules/surgery/lipoplasty.dm @@ -13,6 +13,7 @@ /datum/surgery_step/cut_fat name = "cut excess fat" implements = list(/obj/item/circular_saw = 100, /obj/item/melee/transforming/energy/sword/cyborg/saw = 100, /obj/item/hatchet = 35, /obj/item/kitchen/knife/butcher = 25) +<<<<<<< HEAD time = 64 /datum/surgery_step/cut_fat/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -50,4 +51,43 @@ newmeat.subjectjob = H.job newmeat.reagents.add_reagent ("nutriment", (removednutriment / 15)) //To balance with nutriment_factor of nutriment newmeat.loc = target.loc +======= + time = 64 + +/datum/surgery_step/cut_fat/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + user.visible_message("[user] begins to cut away [target]'s excess fat.", "You begin to cut away [target]'s excess fat...") + +/datum/surgery_step/cut_fat/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + user.visible_message("[user] cuts [target]'s excess fat loose!", "You cut [target]'s excess fat loose.") + return 1 + +//remove fat +/datum/surgery_step/remove_fat + name = "remove loose fat" + implements = list(/obj/item/retractor = 100, /obj/item/screwdriver = 45, /obj/item/wirecutters = 35) + time = 32 + +/datum/surgery_step/remove_fat/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + user.visible_message("[user] begins to extract [target]'s loose fat!", "You begin to extract [target]'s loose fat...") + +/datum/surgery_step/remove_fat/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + user.visible_message("[user] extracts [target]'s fat!", "You extract [target]'s fat.") + target.overeatduration = 0 //patient is unfatted + var/removednutriment = target.nutrition + target.nutrition = NUTRITION_LEVEL_WELL_FED + removednutriment -= 450 //whatever was removed goes into the meat + var/mob/living/carbon/human/H = target + var/typeofmeat = /obj/item/reagent_containers/food/snacks/meat/slab/human + + if(H.dna && H.dna.species) + typeofmeat = H.dna.species.meat + + var/obj/item/reagent_containers/food/snacks/meat/slab/human/newmeat = new typeofmeat + newmeat.name = "fatty meat" + newmeat.desc = "Extremely fatty tissue taken from a patient." + newmeat.subjectname = H.real_name + newmeat.subjectjob = H.job + newmeat.reagents.add_reagent ("nutriment", (removednutriment / 15)) //To balance with nutriment_factor of nutriment + newmeat.forceMove(target.loc) +>>>>>>> c43e205... loc -- > forcemove (#31176) return 1 \ No newline at end of file diff --git a/code/modules/vehicles/pimpin_ride.dm b/code/modules/vehicles/pimpin_ride.dm index 0d97cb63c1..f8f80819dd 100644 --- a/code/modules/vehicles/pimpin_ride.dm +++ b/code/modules/vehicles/pimpin_ride.dm @@ -77,7 +77,7 @@ if(..()) return 1 else if(mybag) - mybag.loc = get_turf(user) + mybag.forceMove(get_turf(user)) user.put_in_hands(mybag) mybag = null update_icon() diff --git a/code/modules/vehicles/speedbike.dm b/code/modules/vehicles/speedbike.dm index b14dd28d70..9200a3d696 100644 --- a/code/modules/vehicles/speedbike.dm +++ b/code/modules/vehicles/speedbike.dm @@ -41,7 +41,7 @@ /obj/vehicle/space/speedbike/speedwagon/Collide(atom/movable/A) . = ..() if(A.density && has_buckled_mobs()) - var/atom/throw_target = get_edge_target_turf(A, src.dir) + var/atom/throw_target = get_edge_target_turf(A, dir) if(crash_all) A.throw_at(throw_target, 4, 3) visible_message("[src] crashes into [A]!") @@ -62,7 +62,7 @@ /obj/vehicle/space/speedbike/speedwagon/Moved() . = ..() - if(src.has_buckled_mobs()) + if(has_buckled_mobs()) for(var/atom/A in range(2, src)) - if(!(A in src.buckled_mobs)) + if(!(A in buckled_mobs)) Collide(A) diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index b26a8054aa..c0df79fdb6 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -42,7 +42,7 @@ if(A.density) if(A != src && A != M) return - M.loc = get_turf(src) + M.forceMove(get_turf(src)) ..() if(user.client) user.client.change_view(view_range) From 51b7bdfb00240a32bbde3afdffc12e4b31f37ca6 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 12 Oct 2017 06:24:19 -0500 Subject: [PATCH 002/105] Update implant_removal.dm --- code/modules/surgery/implant_removal.dm | 51 +------------------------ 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm index 58413b383b..91ae788db5 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -1,51 +1,3 @@ -<<<<<<< HEAD -/datum/surgery/implant_removal - name = "implant removal" - steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/extract_implant, /datum/surgery_step/close) - species = list(/mob/living/carbon/human, /mob/living/carbon/monkey) - possible_locs = list("chest") - requires_organic_bodypart = 0 - - -//extract implant -/datum/surgery_step/extract_implant - name = "extract implant" - implements = list(/obj/item/hemostat = 100, /obj/item/crowbar = 65) - time = 64 - var/obj/item/implant/I = null - -/datum/surgery_step/extract_implant/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - for(var/obj/item/O in target.implants) - I = O - break - if(I) - user.visible_message("[user] begins to extract [I] from [target]'s [target_zone].", "You begin to extract [I] from [target]'s [target_zone]...") - else - user.visible_message("[user] looks for an implant in [target]'s [target_zone].", "You look for an implant in [target]'s [target_zone]...") - -/datum/surgery_step/extract_implant/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - if(I) - user.visible_message("[user] successfully removes [I] from [target]'s [target_zone]!", "You successfully remove [I] from [target]'s [target_zone].") - I.removed(target) - - var/obj/item/implantcase/case - for(var/obj/item/implantcase/ic in user.held_items) - case = ic - break - if(!case) - case = locate(/obj/item/implantcase) in get_turf(target) - if(case && !case.imp) - case.imp = I - I.loc = case - case.update_icon() - user.visible_message("[user] places [I] into [case]!", "You place [I] into [case].") - else - qdel(I) - - else - to_chat(user, "You can't find anything in [target]'s [target_zone]!") - return 1 -======= /datum/surgery/implant_removal name = "implant removal" steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/extract_implant, /datum/surgery_step/close) @@ -101,5 +53,4 @@ /datum/surgery_step/mechanic_unwrench, /datum/surgery_step/extract_implant, /datum/surgery_step/mechanic_wrench, - /datum/surgery_step/mechanic_close) ->>>>>>> c43e205... loc -- > forcemove (#31176) + /datum/surgery_step/mechanic_close) From effc7ccedfbea907eaa21d10b7fd04cee55d6178 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 12 Oct 2017 06:24:35 -0500 Subject: [PATCH 003/105] Update lipoplasty.dm --- code/modules/surgery/lipoplasty.dm | 70 +++++++----------------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/code/modules/surgery/lipoplasty.dm b/code/modules/surgery/lipoplasty.dm index 5bf1fb8f91..488f2e81b1 100644 --- a/code/modules/surgery/lipoplasty.dm +++ b/code/modules/surgery/lipoplasty.dm @@ -1,57 +1,18 @@ -/datum/surgery/lipoplasty - name = "lipoplasty" - steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/cut_fat, /datum/surgery_step/remove_fat, /datum/surgery_step/close) - possible_locs = list("chest") - -/datum/surgery/lipoplasty/can_start(mob/user, mob/living/carbon/target) - if(target.disabilities & FAT) - return 1 - return 0 - - -//cut fat -/datum/surgery_step/cut_fat - name = "cut excess fat" +/datum/surgery/lipoplasty + name = "lipoplasty" + steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/cut_fat, /datum/surgery_step/remove_fat, /datum/surgery_step/close) + possible_locs = list("chest") + +/datum/surgery/lipoplasty/can_start(mob/user, mob/living/carbon/target) + if(target.disabilities & FAT) + return 1 + return 0 + + +//cut fat +/datum/surgery_step/cut_fat + name = "cut excess fat" implements = list(/obj/item/circular_saw = 100, /obj/item/melee/transforming/energy/sword/cyborg/saw = 100, /obj/item/hatchet = 35, /obj/item/kitchen/knife/butcher = 25) -<<<<<<< HEAD - time = 64 - -/datum/surgery_step/cut_fat/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - user.visible_message("[user] begins to cut away [target]'s excess fat.", "You begin to cut away [target]'s excess fat...") - -/datum/surgery_step/cut_fat/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - user.visible_message("[user] cuts [target]'s excess fat loose!", "You cut [target]'s excess fat loose.") - return 1 - -//remove fat -/datum/surgery_step/remove_fat - name = "remove loose fat" - implements = list(/obj/item/retractor = 100, /obj/item/screwdriver = 45, /obj/item/wirecutters = 35) - time = 32 - -/datum/surgery_step/remove_fat/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - user.visible_message("[user] begins to extract [target]'s loose fat!", "You begin to extract [target]'s loose fat...") - -/datum/surgery_step/remove_fat/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - user.visible_message("[user] extracts [target]'s fat!", "You extract [target]'s fat.") - target.overeatduration = 0 //patient is unfatted - var/removednutriment = target.nutrition - target.nutrition = NUTRITION_LEVEL_WELL_FED - removednutriment -= 450 //whatever was removed goes into the meat - var/mob/living/carbon/human/H = target - var/typeofmeat = /obj/item/reagent_containers/food/snacks/meat/slab/human - - if(H.dna && H.dna.species) - typeofmeat = H.dna.species.meat - - var/obj/item/reagent_containers/food/snacks/meat/slab/human/newmeat = new typeofmeat - newmeat.name = "fatty meat" - newmeat.desc = "Extremely fatty tissue taken from a patient." - newmeat.subjectname = H.real_name - newmeat.subjectjob = H.job - newmeat.reagents.add_reagent ("nutriment", (removednutriment / 15)) //To balance with nutriment_factor of nutriment - newmeat.loc = target.loc -======= time = 64 /datum/surgery_step/cut_fat/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -89,5 +50,4 @@ newmeat.subjectjob = H.job newmeat.reagents.add_reagent ("nutriment", (removednutriment / 15)) //To balance with nutriment_factor of nutriment newmeat.forceMove(target.loc) ->>>>>>> c43e205... loc -- > forcemove (#31176) - return 1 \ No newline at end of file + return 1 From 10c2b8e672aecbd0b0d96ce51883f32ea2a98f6f Mon Sep 17 00:00:00 2001 From: Poojawa Date: Sat, 21 Oct 2017 07:09:00 -0500 Subject: [PATCH 004/105] I guess --- code/game/objects/structures/door_assembly.dm | 11 +++++++---- code/modules/surgery/implant_removal.dm | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index 24f5b9ac42..c6af589cb5 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -254,7 +254,7 @@ /obj/structure/door_assembly/door_assembly_clown name = "bananium airlock assembly" - desc = "Honk" + desc = "Honk." icon = 'icons/obj/doors/airlocks/station/bananium.dmi' airlock_type = /obj/machinery/door/airlock/clown anchored = TRUE @@ -580,7 +580,8 @@ user.visible_message("[user] wires the airlock assembly.", \ "You start to wire the airlock assembly...") if(do_after(user, 40, target = src)) - if(C.get_amount() < 1 || state != 0) return + if(C.get_amount() < 1 || state != 0) + return C.use(1) state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS to_chat(user, "You wire the airlock assembly.") @@ -642,7 +643,8 @@ user.visible_message("[user] adds [G.name] to the airlock assembly.", \ "You start to install [G.name] into the airlock assembly...") if(do_after(user, 40, target = src)) - if(G.get_amount() < 1 || mineral) return + if(G.get_amount() < 1 || mineral) + return if(!istype(G, /obj/item/stack/sheet/glass)) to_chat(user, "You install [G.name] windows into the airlock assembly.") heat_proof_finished = 1 //plasma & reinforced glass makes the airlock heat-proof @@ -670,7 +672,8 @@ user.visible_message("[user] adds [G.name] to the airlock assembly.", \ "You start to install [G.name] into the airlock assembly...") if(do_after(user, 40, target = src)) - if(G.get_amount() < 2 || mineral) return + if(G.get_amount() < 2 || mineral) + return to_chat(user, "You install [M] plating into the airlock assembly.") G.use(2) mineral = "[M]" diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm index 91ae788db5..5bab1fc811 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -3,6 +3,7 @@ steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/extract_implant, /datum/surgery_step/close) species = list(/mob/living/carbon/human, /mob/living/carbon/monkey) possible_locs = list("chest") + requires_organic_bodypart = 0 //extract implant From e86688be570e176cc5678452ac184185a83bd14c Mon Sep 17 00:00:00 2001 From: Poojawa Date: Sat, 21 Oct 2017 07:28:47 -0500 Subject: [PATCH 005/105] Update implant_removal.dm --- code/modules/surgery/implant_removal.dm | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm index 5bab1fc811..c31198b5cf 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -44,14 +44,3 @@ else to_chat(user, "You can't find anything in [target]'s [target_zone]!") return 1 - -/datum/surgery/implant_removal/mechanic - name = "implant removal" - requires_bodypart_type = BODYPART_ROBOTIC - steps = list( - /datum/surgery_step/mechanic_open, - /datum/surgery_step/open_hatch, - /datum/surgery_step/mechanic_unwrench, - /datum/surgery_step/extract_implant, - /datum/surgery_step/mechanic_wrench, - /datum/surgery_step/mechanic_close) From c5e11eceedea49b702b316e71f708d88a02652f9 Mon Sep 17 00:00:00 2001 From: oranges Date: Wed, 1 Nov 2017 09:29:47 +1300 Subject: [PATCH 006/105] Some minor contamination fixes --- code/__DEFINES/logging.dm | 33 +++++++++++++------------ code/controllers/subsystem/radiation.dm | 21 +++++++++++----- code/datums/radiation_wave.dm | 3 ++- code/modules/admin/admin_investigate.dm | 2 +- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/code/__DEFINES/logging.dm b/code/__DEFINES/logging.dm index 24e10a24d1..787aee5408 100644 --- a/code/__DEFINES/logging.dm +++ b/code/__DEFINES/logging.dm @@ -1,20 +1,21 @@ //Investigate logging defines -#define INVESTIGATE_ATMOS "atmos" -#define INVESTIGATE_BOTANY "botany" -#define INVESTIGATE_CARGO "cargo" -#define INVESTIGATE_EXPERIMENTOR "experimentor" -#define INVESTIGATE_GRAVITY "gravity" -#define INVESTIGATE_RECORDS "records" -#define INVESTIGATE_SINGULO "singulo" -#define INVESTIGATE_SUPERMATTER "supermatter" -#define INVESTIGATE_TELESCI "telesci" -#define INVESTIGATE_WIRES "wires" +#define INVESTIGATE_ATMOS "atmos" +#define INVESTIGATE_BOTANY "botany" +#define INVESTIGATE_CARGO "cargo" +#define INVESTIGATE_EXPERIMENTOR "experimentor" +#define INVESTIGATE_GRAVITY "gravity" +#define INVESTIGATE_RECORDS "records" +#define INVESTIGATE_SINGULO "singulo" +#define INVESTIGATE_SUPERMATTER "supermatter" +#define INVESTIGATE_TELESCI "telesci" +#define INVESTIGATE_WIRES "wires" #define INVESTIGATE_PORTAL "portals" -#define INVESTIGATE_HALLUCINATIONS "hallucinations" +#define INVESTIGATE_HALLUCINATIONS "hallucinations" +#define INVESTIGATE_RADIATION "radiation" //Individual logging defines -#define INDIVIDUAL_ATTACK_LOG "Attack log" -#define INDIVIDUAL_SAY_LOG "Say log" -#define INDIVIDUAL_EMOTE_LOG "Emote log" -#define INDIVIDUAL_OOC_LOG "OOC log" -#define INDIVIDUAL_SHOW_ALL_LOG "All logs" +#define INDIVIDUAL_ATTACK_LOG "Attack log" +#define INDIVIDUAL_SAY_LOG "Say log" +#define INDIVIDUAL_EMOTE_LOG "Emote log" +#define INDIVIDUAL_OOC_LOG "OOC log" +#define INDIVIDUAL_SHOW_ALL_LOG "All logs" \ No newline at end of file diff --git a/code/controllers/subsystem/radiation.dm b/code/controllers/subsystem/radiation.dm index 1dbe564169..0fded96d95 100644 --- a/code/controllers/subsystem/radiation.dm +++ b/code/controllers/subsystem/radiation.dm @@ -4,16 +4,21 @@ PROCESSING_SUBSYSTEM_DEF(radiation) priority = 25 var/list/warned_atoms = list() - var/list/next_warn = list() - var/last_warn = 0 -/datum/controller/subsystem/processing/radiation/proc/warn(datum/component/radioactive) - if(!radioactive || QDELETED(radioactive)) +/datum/controller/subsystem/processing/radiation/proc/warn(datum/component/radioactive/contamination) + if(!contamination || QDELETED(contamination)) return +<<<<<<< HEAD if(warned_atoms["\ref[radioactive.parent]"]) +======= + var/ref = REF(contamination.parent) + if(warned_atoms[ref]) +>>>>>>> b78e060... Merge pull request #32247 from ninjanomnom/minor-rad-fixes return - var/atom/master = radioactive.parent + warned_atoms[ref] = TRUE + var/atom/master = contamination.parent SSblackbox.add_details("contaminated", "[master.type]") +<<<<<<< HEAD next_warn["\ref[master]"] = "\ref[radioactive]" var/wait_time = max(0, 500-(world.time-last_warn))+20 // wait at least 20 ticks, longer if we just messaged addtimer(CALLBACK(src, .proc/send_warn), wait_time, TIMER_UNIQUE | TIMER_OVERRIDE) @@ -38,4 +43,8 @@ PROCESSING_SUBSYSTEM_DEF(radiation) warned_atoms += next_warn src.next_warn = list() last_warn = world.time - message_admins(msg) \ No newline at end of file + message_admins(msg) +======= + var/msg = "has become contamintaed with enough radiation to contaminate other objects. || Source: [contamination.source] || Strength: [contamination.strength]" + master.investigate_log(msg, INVESTIGATE_RADIATION) +>>>>>>> b78e060... Merge pull request #32247 from ninjanomnom/minor-rad-fixes diff --git a/code/datums/radiation_wave.dm b/code/datums/radiation_wave.dm index ffc6b75fcb..f065ccfeab 100644 --- a/code/datums/radiation_wave.dm +++ b/code/datums/radiation_wave.dm @@ -98,7 +98,8 @@ /obj/structure/cable, /obj/machinery/atmospherics, /obj/item/ammo_casing, - /obj/item/implant + /obj/item/implant, + /obj/singularity )) if(!can_contaminate || blacklisted[thing.type]) continue diff --git a/code/modules/admin/admin_investigate.dm b/code/modules/admin/admin_investigate.dm index 2ca0593e8d..aeaf00337d 100644 --- a/code/modules/admin/admin_investigate.dm +++ b/code/modules/admin/admin_investigate.dm @@ -5,7 +5,7 @@ F << "[time_stamp()] \ref[src] ([x],[y],[z]) || [src] [message]
" -/client/proc/investigate_show(subject in list("hrefs","notes, memos, watchlist", INVESTIGATE_PORTAL, INVESTIGATE_SINGULO, INVESTIGATE_WIRES, INVESTIGATE_TELESCI, INVESTIGATE_GRAVITY, INVESTIGATE_RECORDS, INVESTIGATE_CARGO, INVESTIGATE_SUPERMATTER, INVESTIGATE_ATMOS, INVESTIGATE_EXPERIMENTOR, INVESTIGATE_BOTANY, INVESTIGATE_HALLUCINATIONS) ) +/client/proc/investigate_show(subject in list("hrefs","notes, memos, watchlist", INVESTIGATE_PORTAL, INVESTIGATE_SINGULO, INVESTIGATE_WIRES, INVESTIGATE_TELESCI, INVESTIGATE_GRAVITY, INVESTIGATE_RECORDS, INVESTIGATE_CARGO, INVESTIGATE_SUPERMATTER, INVESTIGATE_ATMOS, INVESTIGATE_EXPERIMENTOR, INVESTIGATE_BOTANY, INVESTIGATE_HALLUCINATIONS, INVESTIGATE_RADIATION) ) set name = "Investigate" set category = "Admin" if(!holder) From ed2ba5e3f58f91e999c54c0b40af3aeb7ca306ca Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 2 Nov 2017 02:21:07 -0500 Subject: [PATCH 007/105] Update radiation.dm --- code/controllers/subsystem/radiation.dm | 32 ------------------------- 1 file changed, 32 deletions(-) diff --git a/code/controllers/subsystem/radiation.dm b/code/controllers/subsystem/radiation.dm index 0fded96d95..2953b388d1 100644 --- a/code/controllers/subsystem/radiation.dm +++ b/code/controllers/subsystem/radiation.dm @@ -8,43 +8,11 @@ PROCESSING_SUBSYSTEM_DEF(radiation) /datum/controller/subsystem/processing/radiation/proc/warn(datum/component/radioactive/contamination) if(!contamination || QDELETED(contamination)) return -<<<<<<< HEAD - if(warned_atoms["\ref[radioactive.parent]"]) -======= var/ref = REF(contamination.parent) if(warned_atoms[ref]) ->>>>>>> b78e060... Merge pull request #32247 from ninjanomnom/minor-rad-fixes return warned_atoms[ref] = TRUE var/atom/master = contamination.parent SSblackbox.add_details("contaminated", "[master.type]") -<<<<<<< HEAD - next_warn["\ref[master]"] = "\ref[radioactive]" - var/wait_time = max(0, 500-(world.time-last_warn))+20 // wait at least 20 ticks, longer if we just messaged - addtimer(CALLBACK(src, .proc/send_warn), wait_time, TIMER_UNIQUE | TIMER_OVERRIDE) - -/datum/controller/subsystem/processing/radiation/proc/send_warn() - var/msg = "Atom(s) have become contaminated by radiation and are strong enough they could pass it on:" - var/still_alive = FALSE - var/list/next_warn = src.next_warn // It's free performance! - for(var/i in next_warn) - var/atom/parent = locate(i) - var/datum/component/radioactive/radioactive = locate(next_warn[i]) - if(!parent || !istype(parent) || !radioactive || !istype(radioactive)) - continue - if(!still_alive) - msg += "\n" - still_alive = TRUE - else - msg += ", " - msg += "[parent][ADMIN_VV(parent)]source:[radioactive.source]" - if(!still_alive) - return - warned_atoms += next_warn - src.next_warn = list() - last_warn = world.time - message_admins(msg) -======= var/msg = "has become contamintaed with enough radiation to contaminate other objects. || Source: [contamination.source] || Strength: [contamination.strength]" master.investigate_log(msg, INVESTIGATE_RADIATION) ->>>>>>> b78e060... Merge pull request #32247 from ninjanomnom/minor-rad-fixes From f628779d36b1ebb3cae18af7d615445b3f070ebf Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Thu, 2 Nov 2017 03:20:33 -0500 Subject: [PATCH 008/105] Update radiation.dm --- code/controllers/subsystem/radiation.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/radiation.dm b/code/controllers/subsystem/radiation.dm index 2953b388d1..700b2a32e7 100644 --- a/code/controllers/subsystem/radiation.dm +++ b/code/controllers/subsystem/radiation.dm @@ -8,7 +8,7 @@ PROCESSING_SUBSYSTEM_DEF(radiation) /datum/controller/subsystem/processing/radiation/proc/warn(datum/component/radioactive/contamination) if(!contamination || QDELETED(contamination)) return - var/ref = REF(contamination.parent) + var/ref = \ref(contamination.parent) if(warned_atoms[ref]) return warned_atoms[ref] = TRUE From 4946ce5070e5eba5a1999227cb24fe4cf59347db Mon Sep 17 00:00:00 2001 From: LetterJay Date: Fri, 3 Nov 2017 00:17:25 -0500 Subject: [PATCH 009/105] Update radiation.dm --- code/controllers/subsystem/radiation.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/radiation.dm b/code/controllers/subsystem/radiation.dm index 700b2a32e7..2953b388d1 100644 --- a/code/controllers/subsystem/radiation.dm +++ b/code/controllers/subsystem/radiation.dm @@ -8,7 +8,7 @@ PROCESSING_SUBSYSTEM_DEF(radiation) /datum/controller/subsystem/processing/radiation/proc/warn(datum/component/radioactive/contamination) if(!contamination || QDELETED(contamination)) return - var/ref = \ref(contamination.parent) + var/ref = REF(contamination.parent) if(warned_atoms[ref]) return warned_atoms[ref] = TRUE From becfcb1dd2dc6638013f1c2b4718aad2ef281a9d Mon Sep 17 00:00:00 2001 From: ACCount Date: Thu, 9 Nov 2017 02:11:51 +0300 Subject: [PATCH 010/105] Fixes VV not displaying false values in keyed lists --- code/datums/datumvars.dm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index b653e5c6ae..25de63a055 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -53,7 +53,11 @@ return var/title = "" +<<<<<<< HEAD var/refid = "\ref[D]" +======= + var/refid = REF(D) +>>>>>>> bd5f864... Fixes VV not displaying false values in keyed lists (#32498) var/icon/sprite var/hash @@ -453,7 +457,7 @@ var/val if (IS_NORMAL_LIST(L) && !isnum(key)) val = L[key] - if (!val) + if (isnull(val)) // we still want to display non-null false values, such as 0 or "" val = key key = i From b44e31951d017e83be3101e681e46c823c7d1629 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Wed, 8 Nov 2017 22:48:03 -0800 Subject: [PATCH 011/105] Weakrefs --- code/__DEFINES/is_helpers.dm | 2 ++ code/__HELPERS/unsorted.dm | 20 ++++++++++++++++++- code/datums/datum.dm | 6 ++++++ code/datums/weakrefs.dm | 19 ++++++++++++++++++ code/game/area/ai_monitored.dm | 7 ++++++- code/game/machinery/camera/motion.dm | 30 ++++++++++++++++++---------- tgstation.dme | 1 + 7 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 code/datums/weakrefs.dm diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index fbd15e1ef6..31a3ccae1e 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -10,6 +10,8 @@ #define isatom(A) (istype(A, /atom)) +#define isweakref(D) (istype(D, /datum/weakref)) + //Turfs //#define isturf(A) (istype(A, /turf)) This is actually a byond built-in. Added here for completeness sake. diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 6b3c03b180..61a825e651 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1441,4 +1441,22 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) var/time_clock = num2hex(TICK_DELTA_TO_MS(world.tick_usage), 3) - return "{[time_high]-[time_mid]-[GUID_VERSION][time_low]-[GUID_VARIANT][time_clock]-[node_id]}" \ No newline at end of file +<<<<<<< HEAD + return "{[time_high]-[time_mid]-[GUID_VERSION][time_low]-[GUID_VARIANT][time_clock]-[node_id]}" +======= + return "{[time_high]-[time_mid]-[GUID_VERSION][time_low]-[GUID_VARIANT][time_clock]-[node_id]}" + +// \ref behaviour got changed in 512 so this is necesary to replicate old behaviour. +// If it ever becomes necesary to get a more performant REF(), this lies here in wait +// #define REF(thing) (thing && istype(thing, /datum) && thing:use_tag && thing:tag ? "[thing:tag]" : "\ref[thing]") +/proc/REF(input) + if(istype(input, /datum)) + var/datum/thing = input + if(thing.use_tag) + if(!thing.tag) + WARNING("A ref was requested of an object with use_tag set but no tag: [thing]") + thing.use_tag = FALSE + else + return "\[[url_encode(thing.tag)]\]" + return "\ref[input]" +>>>>>>> 4edd802... Weak references + Cameras now use them (#32504) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index dc74e72713..6694f827db 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -3,6 +3,11 @@ var/list/active_timers //for SStimer var/list/datum_components //for /datum/components var/ui_screen = "home" //for tgui +<<<<<<< HEAD +======= + var/use_tag = FALSE + var/datum/weakref/weak_reference +>>>>>>> 4edd802... Weak references + Cameras now use them (#32504) #ifdef TESTING var/running_find_references @@ -14,6 +19,7 @@ // Return the appropriate QDEL_HINT; in most cases this is QDEL_HINT_QUEUE. /datum/proc/Destroy(force=FALSE, ...) tag = null + weak_reference = null //ensure prompt GCing of weakref. var/list/timers = active_timers active_timers = null for(var/thing in timers) diff --git a/code/datums/weakrefs.dm b/code/datums/weakrefs.dm new file mode 100644 index 0000000000..09193aea57 --- /dev/null +++ b/code/datums/weakrefs.dm @@ -0,0 +1,19 @@ + +/proc/WEAKREF(datum/input) + if(istype(input) && !QDELETED(input)) + if(!input.weak_reference) + input.weak_reference = new /datum/weakref(input) + return input.weak_reference + +/datum/weakref + var/reference + +/datum/weakref/New(datum/thing) + reference = REF(thing) + +/datum/weakref/Destroy() + return QDEL_HINT_LETMELIVE //Let BYOND autoGC thiswhen nothing is using it anymore. + +/datum/weakref/proc/resolve() + var/datum/D = locate(reference) + return D.weak_reference == src? D : null diff --git a/code/game/area/ai_monitored.dm b/code/game/area/ai_monitored.dm index e21d4e273b..18d1f82239 100644 --- a/code/game/area/ai_monitored.dm +++ b/code/game/area/ai_monitored.dm @@ -2,7 +2,7 @@ name = "AI Monitored Area" clockwork_warp_allowed = FALSE var/list/obj/machinery/camera/motioncameras = list() - var/list/motionTargets = list() + var/list/datum/weakref/motionTargets = list() /area/ai_monitored/Initialize(mapload) . = ..() @@ -27,5 +27,10 @@ if (ismob(O) && motioncameras.len) for(var/X in motioncameras) var/obj/machinery/camera/cam = X +<<<<<<< HEAD cam.lostTarget(O) return +======= + cam.lostTargetRef(WEAKREF(O)) + return +>>>>>>> 4edd802... Weak references + Cameras now use them (#32504) diff --git a/code/game/machinery/camera/motion.dm b/code/game/machinery/camera/motion.dm index 6ac7e1249d..349a0c7e20 100644 --- a/code/game/machinery/camera/motion.dm +++ b/code/game/machinery/camera/motion.dm @@ -1,6 +1,6 @@ /obj/machinery/camera - var/list/localMotionTargets = list() + var/list/datum/weakref/localMotionTargets = list() var/detectTime = 0 var/area/ai_monitored/area_motion = null var/alarm_delay = 30 // Don't forget, there's another 3 seconds in queueAlarm() @@ -15,11 +15,11 @@ if (elapsed > alarm_delay) triggerAlarm() else if (detectTime == -1) - for (var/targetref in getTargetList()) - var/mob/target = locate(targetref) in GLOB.mob_list - if (QDELETED(target) || target.stat == DEAD || (!area_motion && !in_range(src, target))) + for (var/datum/weakref/targetref in getTargetList()) + var/mob/target = targetref.resolve() + if(QDELETED(target) || target.stat == DEAD || (!area_motion && !in_range(src, target))) //If not part of a monitored area and the camera is not in range or the target is dead - lostTarget(target) + lostTargetRef(targetref) /obj/machinery/camera/proc/getTargetList() if(area_motion) @@ -28,22 +28,32 @@ /obj/machinery/camera/proc/newTarget(mob/target) if(isAI(target)) - return 0 + return FALSE if (detectTime == 0) detectTime = world.time // start the clock var/list/targets = getTargetList() +<<<<<<< HEAD targets |= "\ref[target]" return 1 +======= + targets |= WEAKREF(target) + return TRUE +>>>>>>> 4edd802... Weak references + Cameras now use them (#32504) /obj/machinery/camera/Destroy() var/area/ai_monitored/A = get_area(src) + localMotionTargets = null if(istype(A)) A.motioncameras -= src return ..() -/obj/machinery/camera/proc/lostTarget(mob/target) +/obj/machinery/camera/proc/lostTargetRef(datum/weakref/R) var/list/targets = getTargetList() +<<<<<<< HEAD targets -= "\ref[target]" +======= + targets -= R +>>>>>>> 4edd802... Weak references + Cameras now use them (#32504) if (targets.len == 0) cancelAlarm() @@ -53,16 +63,16 @@ if (status) aiPlayer.cancelAlarm("Motion", get_area(src), src) detectTime = 0 - return 1 + return TRUE /obj/machinery/camera/proc/triggerAlarm() if (!detectTime) - return 0 + return FALSE for (var/mob/living/silicon/aiPlayer in GLOB.player_list) if (status) aiPlayer.triggerAlarm("Motion", get_area(src), list(src), src) detectTime = -1 - return 1 + return TRUE /obj/machinery/camera/HasProximity(atom/movable/AM as mob|obj) // Motion cameras outside of an "ai monitored" area will use this to detect stuff. diff --git a/tgstation.dme b/tgstation.dme index 1d3c9ff601..21f4b04537 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -304,6 +304,7 @@ #include "code\datums\soullink.dm" #include "code\datums\spawners_menu.dm" #include "code\datums\verbs.dm" +#include "code\datums\weakrefs.dm" #include "code\datums\world_topic.dm" #include "code\datums\actions\flightsuit.dm" #include "code\datums\actions\ninja.dm" From 6df47bed08747a5614265a8be28f3a2ce16cefcf Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 9 Nov 2017 03:15:20 -0600 Subject: [PATCH 012/105] Update datumvars.dm --- code/datums/datumvars.dm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 25de63a055..7eb6afec5b 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -53,11 +53,7 @@ return var/title = "" -<<<<<<< HEAD - var/refid = "\ref[D]" -======= var/refid = REF(D) ->>>>>>> bd5f864... Fixes VV not displaying false values in keyed lists (#32498) var/icon/sprite var/hash From 2230c79af38d2e7e88deb9eb7052aff2a6350f1b Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 9 Nov 2017 03:17:35 -0600 Subject: [PATCH 013/105] Update unsorted.dm --- code/__HELPERS/unsorted.dm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 61a825e651..4e2b793069 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1440,10 +1440,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) var/time_low = num2hex(world.time, 3) var/time_clock = num2hex(TICK_DELTA_TO_MS(world.tick_usage), 3) - -<<<<<<< HEAD - return "{[time_high]-[time_mid]-[GUID_VERSION][time_low]-[GUID_VARIANT][time_clock]-[node_id]}" -======= return "{[time_high]-[time_mid]-[GUID_VERSION][time_low]-[GUID_VARIANT][time_clock]-[node_id]}" // \ref behaviour got changed in 512 so this is necesary to replicate old behaviour. @@ -1459,4 +1455,3 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) else return "\[[url_encode(thing.tag)]\]" return "\ref[input]" ->>>>>>> 4edd802... Weak references + Cameras now use them (#32504) From 45a64018c5dae462b3f770a55cf883aa9d77fc95 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 9 Nov 2017 03:17:52 -0600 Subject: [PATCH 014/105] Update motion.dm --- code/game/machinery/camera/motion.dm | 9 --------- 1 file changed, 9 deletions(-) diff --git a/code/game/machinery/camera/motion.dm b/code/game/machinery/camera/motion.dm index 349a0c7e20..6a48954b6c 100644 --- a/code/game/machinery/camera/motion.dm +++ b/code/game/machinery/camera/motion.dm @@ -32,13 +32,8 @@ if (detectTime == 0) detectTime = world.time // start the clock var/list/targets = getTargetList() -<<<<<<< HEAD - targets |= "\ref[target]" - return 1 -======= targets |= WEAKREF(target) return TRUE ->>>>>>> 4edd802... Weak references + Cameras now use them (#32504) /obj/machinery/camera/Destroy() var/area/ai_monitored/A = get_area(src) @@ -49,11 +44,7 @@ /obj/machinery/camera/proc/lostTargetRef(datum/weakref/R) var/list/targets = getTargetList() -<<<<<<< HEAD - targets -= "\ref[target]" -======= targets -= R ->>>>>>> 4edd802... Weak references + Cameras now use them (#32504) if (targets.len == 0) cancelAlarm() From b0439afd0828b9a17c8be61ce67f69b45f4a43bf Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 9 Nov 2017 03:17:59 -0600 Subject: [PATCH 015/105] Update ai_monitored.dm --- code/game/area/ai_monitored.dm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/game/area/ai_monitored.dm b/code/game/area/ai_monitored.dm index 18d1f82239..a5216fb44c 100644 --- a/code/game/area/ai_monitored.dm +++ b/code/game/area/ai_monitored.dm @@ -27,10 +27,5 @@ if (ismob(O) && motioncameras.len) for(var/X in motioncameras) var/obj/machinery/camera/cam = X -<<<<<<< HEAD - cam.lostTarget(O) - return -======= cam.lostTargetRef(WEAKREF(O)) return ->>>>>>> 4edd802... Weak references + Cameras now use them (#32504) From 2d8fc6de6176f564cd3dd1f0aef3de78f62dee82 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Fri, 10 Nov 2017 11:25:29 -0800 Subject: [PATCH 016/105] SSoverlay improvements and tweaks (#32371) * Overlay per-type cost logging. Overlays will now log how long each type took to process. Changed up how overlays was done to account for the fact its a queue and not a processor. (it was using almost none of the processing subsystem framework) Made the overlay loop faster by making it not cut the list until the end. Added a simple generic benchmark stat tracking system. I don't know how much overhead this adds to overlays. i may put it behind testing or something, but i do want to test this on the serbers to get some stats. * Removes flush() as it was creating race conditions * Use ref * text2file * Atoms added as an overlay will have their pending overlays compiled before being converted to an appearance --- code/__DEFINES/stat_tracking.dm | 17 ++++ code/__DEFINES/subsystems.dm | 24 ++++++ code/__HELPERS/cmp.dm | 7 +- code/__HELPERS/icons.dm | 5 +- code/__HELPERS/stat_tracking.dm | 13 +++ .../subsystem/{processing => }/overlays.dm | 83 ++++++++++--------- code/controllers/subsystem/ticker.dm | 2 - code/game/atoms.dm | 1 - code/game/world.dm | 2 +- code/modules/admin/admin_verbs.dm | 3 +- code/modules/admin/verbs/debug.dm | 7 ++ tgstation.dme | 4 +- 12 files changed, 121 insertions(+), 47 deletions(-) create mode 100644 code/__DEFINES/stat_tracking.dm create mode 100644 code/__HELPERS/stat_tracking.dm rename code/controllers/subsystem/{processing => }/overlays.dm (80%) diff --git a/code/__DEFINES/stat_tracking.dm b/code/__DEFINES/stat_tracking.dm new file mode 100644 index 0000000000..d7d207469d --- /dev/null +++ b/code/__DEFINES/stat_tracking.dm @@ -0,0 +1,17 @@ +#define STAT_ENTRY_TIME 1 +#define STAT_ENTRY_COUNT 2 +#define STAT_ENTRY_LENGTH 2 + + +#define STAT_START_STOPWATCH var/STAT_STOP_WATCH = TICK_USAGE +#define STAT_STOP_STOPWATCH var/STAT_TIME = TICK_USAGE_TO_MS(STAT_STOP_WATCH) +#define STAT_LOG_ENTRY(entrylist, entryname) \ + var/list/STAT_ENTRY = entrylist[entryname] || (entrylist[entryname] = new /list(STAT_ENTRY_LENGTH));\ + STAT_ENTRY[STAT_ENTRY_TIME] += STAT_TIME;\ + var/STAT_INCR_AMOUNT = min(1, 2**round((STAT_ENTRY[STAT_ENTRY_COUNT] || 0)/SHORT_REAL_LIMIT));\ + if (STAT_INCR_AMOUNT == 1 || prob(100/STAT_INCR_AMOUNT)) {\ + STAT_ENTRY[STAT_ENTRY_COUNT] += STAT_INCR_AMOUNT;\ + };\ + + + diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 247e1109f8..b8579e7dbe 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -76,3 +76,27 @@ #define RUNLEVEL_POSTGAME 8 #define RUNLEVELS_DEFAULT (RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME) + + + + +#define COMPILE_OVERLAYS(A)\ + if (TRUE) {\ + var/list/oo = A.our_overlays;\ + var/list/po = A.priority_overlays;\ + if(LAZYLEN(po)){\ + if(LAZYLEN(oo)){\ + A.overlays = oo + po;\ + }\ + else{\ + A.overlays = po;\ + }\ + }\ + else if(LAZYLEN(oo)){\ + A.overlays = oo;\ + }\ + else{\ + A.overlays.Cut();\ + }\ + A.flags_1 &= ~OVERLAY_QUEUED_1;\ + } \ No newline at end of file diff --git a/code/__HELPERS/cmp.dm b/code/__HELPERS/cmp.dm index a939ab7e90..3831349536 100644 --- a/code/__HELPERS/cmp.dm +++ b/code/__HELPERS/cmp.dm @@ -58,7 +58,12 @@ GLOBAL_VAR_INIT(cmp_field, "name") . = B.failures - A.failures if (!.) . = B.qdels - A.qdels - + +/proc/cmp_generic_stat_item_time(list/A, list/B) + . = B[STAT_ENTRY_TIME] - A[STAT_ENTRY_TIME] + if (!.) + . = B[STAT_ENTRY_COUNT] - A[STAT_ENTRY_COUNT] + /proc/cmp_profile_avg_time_dsc(list/A, list/B) return (B[PROFILE_ITEM_TIME]/(B[PROFILE_ITEM_COUNT] || 1)) - (A[PROFILE_ITEM_TIME]/(A[PROFILE_ITEM_COUNT] || 1)) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index f6ebee85fe..7755a69585 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1006,23 +1006,26 @@ GLOBAL_LIST_EMPTY(friendly_animal_types) if(J) J.equip(body, TRUE, FALSE) - SSoverlays.Flush() var/icon/out_icon = icon('icons/effects/effects.dmi', "nothing") body.setDir(NORTH) + COMPILE_OVERLAYS(body) var/icon/partial = getFlatIcon(body) out_icon.Insert(partial,dir=NORTH) body.setDir(SOUTH) + COMPILE_OVERLAYS(body) partial = getFlatIcon(body) out_icon.Insert(partial,dir=SOUTH) body.setDir(WEST) + COMPILE_OVERLAYS(body) partial = getFlatIcon(body) out_icon.Insert(partial,dir=WEST) body.setDir(EAST) + COMPILE_OVERLAYS(body) partial = getFlatIcon(body) out_icon.Insert(partial,dir=EAST) diff --git a/code/__HELPERS/stat_tracking.dm b/code/__HELPERS/stat_tracking.dm new file mode 100644 index 0000000000..007cd2695d --- /dev/null +++ b/code/__HELPERS/stat_tracking.dm @@ -0,0 +1,13 @@ +/proc/render_stats(list/stats, user, sort = /proc/cmp_generic_stat_item_time) + sortTim(stats, sort, TRUE) + + var/list/lines = list() + + for (var/entry in stats) + var/list/data = stats[entry] + lines += "[entry] => [num2text(data[STAT_ENTRY_TIME], 10)]ms ([data[STAT_ENTRY_COUNT]]) (avg:[num2text(data[STAT_ENTRY_TIME]/(data[STAT_ENTRY_COUNT] || 1), 99)])" + + if (user) + user << browse("
  1. [lines.Join("
  2. ")]
", "window=[url_encode("stats:[REF(stats)]")]") + + . = lines.Join("\n") diff --git a/code/controllers/subsystem/processing/overlays.dm b/code/controllers/subsystem/overlays.dm similarity index 80% rename from code/controllers/subsystem/processing/overlays.dm rename to code/controllers/subsystem/overlays.dm index d7f260be0e..498890d430 100644 --- a/code/controllers/subsystem/processing/overlays.dm +++ b/code/controllers/subsystem/overlays.dm @@ -1,4 +1,4 @@ -PROCESSING_SUBSYSTEM_DEF(overlays) +SUBSYSTEM_DEF(overlays) name = "Overlay" flags = SS_TICKER wait = 1 @@ -6,62 +6,63 @@ PROCESSING_SUBSYSTEM_DEF(overlays) init_order = INIT_ORDER_OVERLAY runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_SETUP - stat_tag = "Ov" - currentrun = null + var/list/queue + var/list/stats var/list/overlay_icon_state_caches var/list/overlay_icon_cache var/initialized = FALSE -/datum/controller/subsystem/processing/overlays/PreInit() - LAZYINITLIST(overlay_icon_state_caches) - LAZYINITLIST(overlay_icon_cache) +/datum/controller/subsystem/overlays/PreInit() + overlay_icon_state_caches = list() + overlay_icon_cache = list() + queue = list() + stats = list() -/datum/controller/subsystem/processing/overlays/Initialize() +/datum/controller/subsystem/overlays/Initialize() initialized = TRUE - Flush() + fire(mc_check = FALSE) ..() -/datum/controller/subsystem/processing/overlays/Recover() + +/datum/controller/subsystem/overlays/stat_entry() + ..("Ov:[length(queue)]") + + +/datum/controller/subsystem/overlays/Shutdown() + text2file("[GLOB.log_directory]/overlay.log", render_stats(stats)) + + +/datum/controller/subsystem/overlays/Recover() overlay_icon_state_caches = SSoverlays.overlay_icon_state_caches overlay_icon_cache = SSoverlays.overlay_icon_cache - processing = SSoverlays.processing + queue = SSoverlays.queue -#define COMPILE_OVERLAYS(A)\ - var/list/oo = A.our_overlays;\ - var/list/po = A.priority_overlays;\ - if(LAZYLEN(po)){\ - if(LAZYLEN(oo)){\ - A.overlays = oo + po;\ - }\ - else{\ - A.overlays = po;\ - }\ - }\ - else if(LAZYLEN(oo)){\ - A.overlays = oo;\ - }\ - else{\ - A.overlays.Cut();\ - }\ - A.flags_1 &= ~OVERLAY_QUEUED_1 -/datum/controller/subsystem/processing/overlays/fire(resumed = FALSE, mc_check = TRUE) - var/list/processing = src.processing - while(processing.len) - var/atom/thing = processing[processing.len] - processing.len-- +/datum/controller/subsystem/overlays/fire(resumed = FALSE, mc_check = TRUE) + var/list/queue = src.queue + var/static/count = 0 + if (count) + var/c = count + count = 0 //so if we runtime on the Cut, we don't try again. + queue.Cut(1,c+1) + + for (var/thing in queue) + count++ if(thing) - COMPILE_OVERLAYS(thing) + STAT_START_STOPWATCH + var/atom/A = thing + COMPILE_OVERLAYS(A) + STAT_STOP_STOPWATCH + STAT_LOG_ENTRY(stats, A.type) if(mc_check) if(MC_TICK_CHECK) break else CHECK_TICK -/datum/controller/subsystem/processing/overlays/proc/Flush() - if(processing.len) - testing("Flushing [processing.len] overlays") - fire(mc_check = FALSE) //pair this thread up with the MC to get extra compile time + if (count) + queue.Cut(1,count+1) + count = 0 /proc/iconstate2appearance(icon, iconstate) var/static/image/stringbro = new() @@ -102,6 +103,10 @@ PROCESSING_SUBSYSTEM_DEF(overlays) else if(isicon(overlay)) new_overlays += icon2appearance(overlay) else + if(isloc(overlay)) + var/atom/A = overlay + if (A.flags_1 & OVERLAY_QUEUED_1) + COMPILE_OVERLAYS(A) appearance_bro.appearance = overlay //this works for images and atoms too! if(!ispath(overlay)) var/image/I = overlay @@ -110,7 +115,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays) return new_overlays #define NOT_QUEUED_ALREADY (!(flags_1 & OVERLAY_QUEUED_1)) -#define QUEUE_FOR_COMPILE flags_1 |= OVERLAY_QUEUED_1; SSoverlays.processing += src; +#define QUEUE_FOR_COMPILE flags_1 |= OVERLAY_QUEUED_1; SSoverlays.queue += src; /atom/proc/cut_overlays(priority = FALSE) var/list/cached_overlays = our_overlays var/list/cached_priority = priority_overlays diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 1cbe1c9904..937b4c8df5 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -281,8 +281,6 @@ SUBSYSTEM_DEF(ticker) collect_minds() equip_characters() - SSoverlays.Flush() //Flush the majority of the shit - GLOB.data_core.manifest() transfer_characters() //transfer keys to the new mobs diff --git a/code/game/atoms.dm b/code/game/atoms.dm index fe603dd7cd..94d89d66b7 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -99,7 +99,6 @@ LAZYCLEARLIST(overlays) LAZYCLEARLIST(priority_overlays) - //SSoverlays.processing -= src //we COULD do this, but it's better to just let it fall out of the processing queue QDEL_NULL(light) diff --git a/code/game/world.dm b/code/game/world.dm index 026d7324e4..9132f3cd6d 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -124,7 +124,7 @@ GLOBAL_PROTECT(security_mode) if(I in input) handler = topic_handlers[I] break - + if((!handler || initial(handler.log)) && config && CONFIG_GET(flag/log_world_topic)) WRITE_FILE(GLOB.world_game_log, "TOPIC: \"[T]\", from:[addr], master:[master], key:[key]") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 01f825492f..56ae734044 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -156,7 +156,8 @@ GLOBAL_LIST_INIT(admin_verbs_debug, world.AVerbsDebug()) /client/proc/toggle_medal_disable, /client/proc/view_runtimes, /client/proc/pump_random_event, - /client/proc/cmd_display_init_log + /client/proc/cmd_display_init_log, + /client/proc/cmd_display_overlay_log ) GLOBAL_PROTECT(admin_verbs_possess) GLOBAL_LIST_INIT(admin_verbs_possess, list(/proc/possess, /proc/release)) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index dadbe7da5f..3d6f08eb99 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -778,6 +778,13 @@ GLOBAL_PROTECT(LastAdminCalledProc) usr << browse(dellog.Join(), "window=dellog") +/client/proc/cmd_display_overlay_log() + set category = "Debug" + set name = "Display overlay Log" + set desc = "Display SSoverlays log of everything that's passed through it." + + render_stats(SSoverlays.stats, src) + /client/proc/cmd_display_init_log() set category = "Debug" set name = "Display Initialize() Log" diff --git a/tgstation.dme b/tgstation.dme index 1d3c9ff601..4458f11246 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -75,6 +75,7 @@ #include "code\__DEFINES\sight.dm" #include "code\__DEFINES\sound.dm" #include "code\__DEFINES\stat.dm" +#include "code\__DEFINES\stat_tracking.dm" #include "code\__DEFINES\status_effects.dm" #include "code\__DEFINES\subsystems.dm" #include "code\__DEFINES\tgui.dm" @@ -104,6 +105,7 @@ #include "code\__HELPERS\radio.dm" #include "code\__HELPERS\sanitize_values.dm" #include "code\__HELPERS\shell.dm" +#include "code\__HELPERS\stat_tracking.dm" #include "code\__HELPERS\text.dm" #include "code\__HELPERS\text_vr.dm" #include "code\__HELPERS\time.dm" @@ -244,6 +246,7 @@ #include "code\controllers\subsystem\mobs.dm" #include "code\controllers\subsystem\npcpool.dm" #include "code\controllers\subsystem\orbit.dm" +#include "code\controllers\subsystem\overlays.dm" #include "code\controllers\subsystem\pai.dm" #include "code\controllers\subsystem\parallax.dm" #include "code\controllers\subsystem\persistence.dm" @@ -268,7 +271,6 @@ #include "code\controllers\subsystem\processing\fields.dm" #include "code\controllers\subsystem\processing\flightpacks.dm" #include "code\controllers\subsystem\processing\obj.dm" -#include "code\controllers\subsystem\processing\overlays.dm" #include "code\controllers\subsystem\processing\processing.dm" #include "code\controllers\subsystem\processing\projectiles.dm" #include "code\datums\action.dm" From 95707bf1b7aa870ff320c69cf51cd00679d6ca5e Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Sat, 11 Nov 2017 15:32:10 -0500 Subject: [PATCH 018/105] fixes 512 compile reminders (#32582) --- code/datums/components/_component.dm | 10 +++++++--- code/game/machinery/_machinery.dm | 11 ++++++++--- .../reagents/chemistry/machinery/chem_master.dm | 11 ++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index bb60350cbf..0c85ddd871 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -137,10 +137,14 @@ return /datum/component/proc/_GetInverseTypeList(our_type = type) -#if DM_VERSION > 511 -#warning Remove this hack for http://www.byond.com/forum/?post=73469 -#endif + #if DM_VERSION >= 513 + #warning 512 is definitely stable now, remove the old code + #endif + + #if DM_VERSION < 512 + //remove this when we use 512 full time set invisibility = 101 + #endif //we can do this one simple trick var/current_type = parent_type . = list(our_type, current_type) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 286bcee1f8..945d414382 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -509,11 +509,16 @@ Class Procs: /obj/machinery/proc/adjust_item_drop_location(atom/movable/AM) // Adjust item drop location to a 3x3 grid inside the tile, returns slot id from 0 to 8 var/md5 = md5(AM.name) // Oh, and it's deterministic too. A specific item will always drop from the same slot. -#if DM_VERSION > 511 -#warn Refactor the loop in /obj/machinery/proc/adjust_item_drop_location() to make use of 512's list-like access to characters in a string -#endif for (var/i in 1 to 32) + #if DM_VERSION >= 513 + #warning 512 is definitely stable now, remove the old code + #endif + + #if DM_VERSION >= 512 + . += hex2num(md5[i]) + #else . += hex2num(copytext(md5,i,i+1)) + #endif . = . % 9 AM.pixel_x = -8 + ((.%3)*8) AM.pixel_y = -8 + (round( . / 3)*8) \ No newline at end of file diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 7c764e26cb..434996fb08 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -344,11 +344,16 @@ return null else var/md5 = md5(AM.name) -#if DM_VERSION > 511 -#warn Refactor the loop in /obj/machinery/chem_master/adjust_item_drop_location() to make use of 512's list-like access to characters in a string -#endif for (var/i in 1 to 32) + #if DM_VERSION >= 513 + #warning 512 is definitely stable now, remove the old code + #endif + + #if DM_VERSION >= 512 + . += hex2num(md5[i]) + #else . += hex2num(copytext(md5,i,i+1)) + #endif . = . % 9 AM.pixel_x = ((.%3)*6) AM.pixel_y = -8 + (round( . / 3)*8) From f6e07cf824169e837048bea3d0cd461d37f5974c Mon Sep 17 00:00:00 2001 From: AnturK Date: Sat, 11 Nov 2017 21:35:49 +0100 Subject: [PATCH 020/105] Makes false alarm use more explicit in event code. --- code/modules/events/_event.dm | 7 +- code/modules/events/abductor.dm | 1 + code/modules/events/alien_infestation.dm | 4 +- code/modules/events/anomaly.dm | 36 ++ code/modules/events/anomaly_bluespace.dm | 22 + code/modules/events/anomaly_flux.dm | 23 + code/modules/events/anomaly_grav.dm | 20 + code/modules/events/anomaly_pyro.dm | 2 +- code/modules/events/anomaly_vortex.dm | 22 + code/modules/events/blob.dm | 2 +- code/modules/events/brand_intelligence.dm | 11 +- code/modules/events/camerafailure.dm | 2 +- code/modules/events/carp_migration.dm | 2 +- .../modules/events/communications_blackout.dm | 28 + code/modules/events/devil.dm | 1 + code/modules/events/disease_outbreak.dm | 2 +- code/modules/events/dust.dm | 33 + code/modules/events/electrical_storm.dm | 2 +- code/modules/events/false_alarm.dm | 13 +- code/modules/events/grid_check.dm | 2 +- code/modules/events/holiday/friday13th.dm | 20 + code/modules/events/holiday/halloween.dm | 2 +- code/modules/events/holiday/vday.dm | 2 +- code/modules/events/holiday/xmas.dm | 4 +- code/modules/events/immovable_rod.dm | 2 +- code/modules/events/ion_storm.dm | 574 ++++++++++++++++++ code/modules/events/major_dust.dm | 2 +- code/modules/events/mass_hallucination.dm | 15 + code/modules/events/meateor_wave.dm | 2 +- code/modules/events/meteor_wave.dm | 2 +- code/modules/events/mice_migration.dm | 3 +- code/modules/events/nightmare.dm | 1 + code/modules/events/operative.dm | 1 + code/modules/events/portal_storm.dm | 2 +- code/modules/events/prison_break.dm | 49 ++ code/modules/events/processor_overload.dm | 4 +- code/modules/events/radiation_storm.dm | 2 +- code/modules/events/sentience.dm | 7 +- code/modules/events/shuttle_loan.dm | 4 +- code/modules/events/spacevine.dm | 3 + code/modules/events/spider_infestation.dm | 2 +- .../events/spontaneous_appendicitis.dm | 16 + code/modules/events/vent_clog.dm | 2 +- code/modules/events/weightless.dm | 35 ++ code/modules/events/wizard/magicarp.dm | 2 +- code/modules/events/wormholes.dm | 2 +- code/modules/holiday/easter.dm | 4 +- 47 files changed, 952 insertions(+), 47 deletions(-) diff --git a/code/modules/events/_event.dm b/code/modules/events/_event.dm index 3f42b3dfcf..3c8fb94464 100644 --- a/code/modules/events/_event.dm +++ b/code/modules/events/_event.dm @@ -108,11 +108,12 @@ var/datum/round_event_control/control var/startWhen = 0 //When in the lifetime to call start(). - var/announceWhen = 0 //When in the lifetime to call announce(). Set an event's announceWhen to >0 if there is an announcement. + var/announceWhen = 0 //When in the lifetime to call announce(). Set an event's announceWhen to -1 if announcement should not be shown. var/endWhen = 0 //When in the lifetime the event should end. var/activeFor = 0 //How long the event has existed. You don't need to change this. var/current_players = 0 //Amount of of alive, non-AFK human players on server at the time of event start + var/fakeable = TRUE //Can be faked by fake news event. //Called first before processing. //Allows you to setup your event, such as randomly @@ -133,7 +134,7 @@ //Called when the tick is equal to the announceWhen variable. //Allows you to announce before starting or vice versa. //Only called once. -/datum/round_event/proc/announce() +/datum/round_event/proc/announce(fake) return //Called on or after the tick counter is equal to startWhen. @@ -167,7 +168,7 @@ if(activeFor == announceWhen) processing = FALSE - announce() + announce(FALSE) processing = TRUE if(startWhen < activeFor && activeFor < endWhen) diff --git a/code/modules/events/abductor.dm b/code/modules/events/abductor.dm index 6fee1e5c1a..9bba04a68d 100755 --- a/code/modules/events/abductor.dm +++ b/code/modules/events/abductor.dm @@ -9,6 +9,7 @@ /datum/round_event/ghost_role/abductor minimum_required = 2 role_name = "abductor team" + fakeable = FALSE //Nothing to fake here /datum/round_event/ghost_role/abductor/spawn_role() var/list/mob/dead/observer/candidates = get_candidates("abductor", null, ROLE_ABDUCTOR) diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 545b72a1bc..1a8a174bff 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -30,8 +30,8 @@ control.occurrences-- return ..() -/datum/round_event/ghost_role/alien_infestation/announce() - if(successSpawn) +/datum/round_event/ghost_role/alien_infestation/announce(fake) + if(successSpawn || fake) priority_announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", 'sound/ai/aliens.ogg') diff --git a/code/modules/events/anomaly.dm b/code/modules/events/anomaly.dm index 6798ad0b4c..d27baf65a8 100644 --- a/code/modules/events/anomaly.dm +++ b/code/modules/events/anomaly.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/anomaly name = "Anomaly: Energetic Flux" typepath = /datum/round_event/anomaly @@ -31,3 +32,38 @@ var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/flux(T) +======= +/datum/round_event_control/anomaly + name = "Anomaly: Energetic Flux" + typepath = /datum/round_event/anomaly + + min_players = 1 + max_occurrences = 0 //This one probably shouldn't occur! It'd work, but it wouldn't be very fun. + weight = 15 + +/datum/round_event/anomaly + var/area/impact_area + var/obj/effect/anomaly/newAnomaly + announceWhen = 1 + + +/datum/round_event/anomaly/setup(loop=0) + var/safety_loop = loop + 1 + if(safety_loop > 50) + kill() + end() + impact_area = findEventArea() + if(!impact_area) + setup(safety_loop) + var/list/turf_test = get_area_turfs(impact_area) + if(!turf_test.len) + setup(safety_loop) + +/datum/round_event/anomaly/announce(fake) + priority_announce("Localized energetic flux wave detected on long range scanners. Expected location of impact: [impact_area.name].", "Anomaly Alert") + +/datum/round_event/anomaly/start() + var/turf/T = safepick(get_area_turfs(impact_area)) + if(T) + newAnomaly = new /obj/effect/anomaly/flux(T) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) diff --git a/code/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm index 177ca531c8..912c21ca1a 100644 --- a/code/modules/events/anomaly_bluespace.dm +++ b/code/modules/events/anomaly_bluespace.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/anomaly/anomaly_bluespace name = "Anomaly: Bluespace" typepath = /datum/round_event/anomaly/anomaly_bluespace @@ -17,3 +18,24 @@ var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/bluespace(T) +======= +/datum/round_event_control/anomaly/anomaly_bluespace + name = "Anomaly: Bluespace" + typepath = /datum/round_event/anomaly/anomaly_bluespace + max_occurrences = 1 + weight = 5 + +/datum/round_event/anomaly/anomaly_bluespace + startWhen = 3 + announceWhen = 10 + + +/datum/round_event/anomaly/anomaly_bluespace/announce(fake) + priority_announce("Unstable bluespace anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert") + + +/datum/round_event/anomaly/anomaly_bluespace/start() + var/turf/T = safepick(get_area_turfs(impact_area)) + if(T) + newAnomaly = new /obj/effect/anomaly/bluespace(T) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) diff --git a/code/modules/events/anomaly_flux.dm b/code/modules/events/anomaly_flux.dm index 00f6c78b45..c736bb93fa 100644 --- a/code/modules/events/anomaly_flux.dm +++ b/code/modules/events/anomaly_flux.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/anomaly/anomaly_flux name = "Anomaly: Hyper-Energetic Flux" typepath = /datum/round_event/anomaly/anomaly_flux @@ -18,3 +19,25 @@ var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/flux(T) +======= +/datum/round_event_control/anomaly/anomaly_flux + name = "Anomaly: Hyper-Energetic Flux" + typepath = /datum/round_event/anomaly/anomaly_flux + + min_players = 10 + max_occurrences = 5 + weight = 20 + +/datum/round_event/anomaly/anomaly_flux + startWhen = 10 + announceWhen = 3 + +/datum/round_event/anomaly/anomaly_flux/announce(fake) + priority_announce("Localized hyper-energetic flux wave detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert") + + +/datum/round_event/anomaly/anomaly_flux/start() + var/turf/T = safepick(get_area_turfs(impact_area)) + if(T) + newAnomaly = new /obj/effect/anomaly/flux(T) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) diff --git a/code/modules/events/anomaly_grav.dm b/code/modules/events/anomaly_grav.dm index d29c8c5607..304e53a8f9 100644 --- a/code/modules/events/anomaly_grav.dm +++ b/code/modules/events/anomaly_grav.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/anomaly/anomaly_grav name = "Anomaly: Gravitational" typepath = /datum/round_event/anomaly/anomaly_grav @@ -15,3 +16,22 @@ var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/grav(T) +======= +/datum/round_event_control/anomaly/anomaly_grav + name = "Anomaly: Gravitational" + typepath = /datum/round_event/anomaly/anomaly_grav + max_occurrences = 5 + weight = 20 + +/datum/round_event/anomaly/anomaly_grav + startWhen = 3 + announceWhen = 20 + +/datum/round_event/anomaly/anomaly_grav/announce(fake) + priority_announce("Gravitational anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert") + +/datum/round_event/anomaly/anomaly_grav/start() + var/turf/T = safepick(get_area_turfs(impact_area)) + if(T) + newAnomaly = new /obj/effect/anomaly/grav(T) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) diff --git a/code/modules/events/anomaly_pyro.dm b/code/modules/events/anomaly_pyro.dm index ae21de1035..85da9ca6d4 100644 --- a/code/modules/events/anomaly_pyro.dm +++ b/code/modules/events/anomaly_pyro.dm @@ -8,7 +8,7 @@ startWhen = 3 announceWhen = 10 -/datum/round_event/anomaly/anomaly_pyro/announce() +/datum/round_event/anomaly/anomaly_pyro/announce(fake) priority_announce("Pyroclastic anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert") /datum/round_event/anomaly/anomaly_pyro/start() diff --git a/code/modules/events/anomaly_vortex.dm b/code/modules/events/anomaly_vortex.dm index 01bf8fa039..f25c59304d 100644 --- a/code/modules/events/anomaly_vortex.dm +++ b/code/modules/events/anomaly_vortex.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/anomaly/anomaly_vortex name = "Anomaly: Vortex" typepath = /datum/round_event/anomaly/anomaly_vortex @@ -17,3 +18,24 @@ var/turf/T = safepick(get_area_turfs(impact_area)) if(T) newAnomaly = new /obj/effect/anomaly/bhole(T) +======= +/datum/round_event_control/anomaly/anomaly_vortex + name = "Anomaly: Vortex" + typepath = /datum/round_event/anomaly/anomaly_vortex + + min_players = 20 + max_occurrences = 2 + weight = 5 + +/datum/round_event/anomaly/anomaly_vortex + startWhen = 10 + announceWhen = 3 + +/datum/round_event/anomaly/anomaly_vortex/announce(fake) + priority_announce("Localized high-intensity vortex anomaly detected on long range scanners. Expected location: [impact_area.name]", "Anomaly Alert") + +/datum/round_event/anomaly/anomaly_vortex/start() + var/turf/T = safepick(get_area_turfs(impact_area)) + if(T) + newAnomaly = new /obj/effect/anomaly/bhole(T) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) diff --git a/code/modules/events/blob.dm b/code/modules/events/blob.dm index 49eb46194d..95f72d15b3 100644 --- a/code/modules/events/blob.dm +++ b/code/modules/events/blob.dm @@ -12,7 +12,7 @@ announceWhen = -1 role_name = "blob overmind" -/datum/round_event/ghost_role/blob/announce() +/datum/round_event/ghost_role/blob/announce(fake) priority_announce("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/ai/outbreak5.ogg') /datum/round_event/ghost_role/blob/spawn_role() diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index 5f5033bb6c..e898729f2d 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -21,9 +21,14 @@ "You don't want to buy anything? Yeah, well, I didn't want to buy your mom either.") -/datum/round_event/brand_intelligence/announce() - priority_announce("Rampant brand intelligence has been detected aboard [station_name()]. Please stand by. The origin is believed to be \a [originMachine.name].", "Machine Learning Alert") - +/datum/round_event/brand_intelligence/announce(fake) + var/source = "unknown machine" + if(fake) + var/obj/machinery/vending/cola/example = /obj/machinery/vending/cola + source = initial(example.name) + else if(originMachine) + source = originMachine.name + priority_announce("Rampant brand intelligence has been detected aboard [station_name()]. Please stand by. The origin is believed to be \a [source].", "Machine Learning Alert") /datum/round_event/brand_intelligence/start() for(var/obj/machinery/vending/V in GLOB.machines) diff --git a/code/modules/events/camerafailure.dm b/code/modules/events/camerafailure.dm index 1ba0ac2f55..9f85628629 100644 --- a/code/modules/events/camerafailure.dm +++ b/code/modules/events/camerafailure.dm @@ -8,7 +8,7 @@ /datum/round_event/camera_failure startWhen = 1 endWhen = 2 - announceWhen = 0 + fakeable = FALSE /datum/round_event/camera_failure/tick() var/iterations = 1 diff --git a/code/modules/events/carp_migration.dm b/code/modules/events/carp_migration.dm index ca6cd782fc..b75140e3c7 100644 --- a/code/modules/events/carp_migration.dm +++ b/code/modules/events/carp_migration.dm @@ -13,7 +13,7 @@ /datum/round_event/carp_migration/setup() startWhen = rand(40, 60) -/datum/round_event/carp_migration/announce() +/datum/round_event/carp_migration/announce(fake) priority_announce("Unknown biological entities have been detected near [station_name()], please stand-by.", "Lifesign Alert") diff --git a/code/modules/events/communications_blackout.dm b/code/modules/events/communications_blackout.dm index 8eacd3b25a..f66b8df54e 100644 --- a/code/modules/events/communications_blackout.dm +++ b/code/modules/events/communications_blackout.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/communications_blackout name = "Communications Blackout" typepath = /datum/round_event/communications_blackout @@ -23,4 +24,31 @@ /datum/round_event/communications_blackout/start() for(var/obj/machinery/telecomms/T in GLOB.telecomms_list) +======= +/datum/round_event_control/communications_blackout + name = "Communications Blackout" + typepath = /datum/round_event/communications_blackout + weight = 30 + +/datum/round_event/communications_blackout + announceWhen = 1 + +/datum/round_event/communications_blackout/announce(fake) + var/alert = pick( "Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you*%fj00)`5vc-BZZT", \ + "Ionospheric anomalies detected. Temporary telecommunication failu*3mga;b4;'1v�-BZZZT", \ + "Ionospheric anomalies detected. Temporary telec#MCi46:5.;@63-BZZZZT", \ + "Ionospheric anomalies dete'fZ\\kg5_0-BZZZZZT", \ + "Ionospheri:%� MCayj^j<.3-BZZZZZZT", \ + "#4nd%;f4y6,>�%-BZZZZZZZT") + + for(var/mob/living/silicon/ai/A in GLOB.ai_list) //AIs are always aware of communication blackouts. + to_chat(A, "
[alert]
") + + if(prob(30) || fake) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts. + priority_announce(alert) + + +/datum/round_event/communications_blackout/start() + for(var/obj/machinery/telecomms/T in GLOB.telecomms_list) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) T.emp_act(EMP_HEAVY) diff --git a/code/modules/events/devil.dm b/code/modules/events/devil.dm index 0b49f38343..467973bc95 100644 --- a/code/modules/events/devil.dm +++ b/code/modules/events/devil.dm @@ -6,6 +6,7 @@ /datum/round_event/ghost_role/devil var/success_spawn = 0 role_name = "devil" + fakeable = FALSE /datum/round_event/ghost_role/devil/kill() if(!success_spawn && control) diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm index a3ce69e0bd..30efcc9751 100644 --- a/code/modules/events/disease_outbreak.dm +++ b/code/modules/events/disease_outbreak.dm @@ -11,7 +11,7 @@ var/virus_type -/datum/round_event/disease_outbreak/announce() +/datum/round_event/disease_outbreak/announce(fake) priority_announce("Confirmed outbreak of level 7 viral biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/ai/outbreak7.ogg') /datum/round_event/disease_outbreak/setup() diff --git a/code/modules/events/dust.dm b/code/modules/events/dust.dm index 20df9e5d0c..075f96e916 100644 --- a/code/modules/events/dust.dm +++ b/code/modules/events/dust.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/space_dust name = "Minor Space Dust" typepath = /datum/round_event/space_dust @@ -27,4 +28,36 @@ announceWhen = 0 /datum/round_event/sandstorm/tick() +======= +/datum/round_event_control/space_dust + name = "Minor Space Dust" + typepath = /datum/round_event/space_dust + weight = 200 + max_occurrences = 1000 + earliest_start = 0 + alertadmins = 0 + +/datum/round_event/space_dust + startWhen = 1 + endWhen = 2 + fakeable = FALSE + +/datum/round_event/space_dust/start() + spawn_meteors(1, GLOB.meteorsC) + +/datum/round_event_control/sandstorm + name = "Sandstorm" + typepath = /datum/round_event/sandstorm + weight = 0 + max_occurrences = 0 + earliest_start = 0 + +/datum/round_event/sandstorm + startWhen = 1 + endWhen = 150 // ~5 min + announceWhen = 0 + fakeable = FALSE + +/datum/round_event/sandstorm/tick() +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) spawn_meteors(10, GLOB.meteorsC) \ No newline at end of file diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index a10e42d754..12e1f255e6 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -11,7 +11,7 @@ var/lightsoutRange = 25 announceWhen = 1 -/datum/round_event/electrical_storm/announce() +/datum/round_event/electrical_storm/announce(fake) priority_announce("An electrical storm has been detected in your area, please repair potential electronic overloads.", "Electrical Storm Alert") diff --git a/code/modules/events/false_alarm.dm b/code/modules/events/false_alarm.dm index 83e37dd528..f2041baa85 100644 --- a/code/modules/events/false_alarm.dm +++ b/code/modules/events/false_alarm.dm @@ -13,10 +13,8 @@ var/list/possible_types = list() for(var/datum/round_event_control/E in SSevents.control) - if(istype(E, /datum/round_event_control/falsealarm)) - continue var/datum/round_event/event = E.typepath - if(initial(event.announceWhen) <= 0) + if(!initial(event.fakeable)) continue possible_types += E @@ -28,8 +26,11 @@ /datum/round_event/falsealarm announceWhen = 0 endWhen = 1 + fakeable = FALSE -/datum/round_event/falsealarm/announce() +/datum/round_event/falsealarm/announce(fake) + if(fake) //What are you doing + return var/players_amt = get_active_player_count(alive_check = 1, afk_check = 1, human_check = 1) var/gamemode = SSticker.mode.config_tag @@ -45,7 +46,7 @@ var/datum/round_event/Event = new event_control.typepath() message_admins("False Alarm: [Event]") Event.kill() //do not process this event - no starts, no ticks, no ends - Event.announce() //just announce it like it's happening + Event.announce(TRUE) //just announce it like it's happening /proc/gather_false_events(players_amt, gamemode) . = list() @@ -56,6 +57,6 @@ continue var/datum/round_event/event = E.typepath - if(initial(event.announceWhen) <= 0) + if(!initial(event.fakeable)) continue . += E diff --git a/code/modules/events/grid_check.dm b/code/modules/events/grid_check.dm index f1af035a29..2ae44a5f84 100644 --- a/code/modules/events/grid_check.dm +++ b/code/modules/events/grid_check.dm @@ -8,7 +8,7 @@ announceWhen = 1 startWhen = 1 -/datum/round_event/grid_check/announce() +/datum/round_event/grid_check/announce(fake) priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') diff --git a/code/modules/events/holiday/friday13th.dm b/code/modules/events/holiday/friday13th.dm index 53411edbb4..0dbf8d7ec9 100644 --- a/code/modules/events/holiday/friday13th.dm +++ b/code/modules/events/holiday/friday13th.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD // Basically, cut the event frequency in half to simulate unluckiness. /datum/round_event_control/fridaythethirteen @@ -15,4 +16,23 @@ /datum/round_event/fridaythethirteen/announce() for(var/mob/living/L in player_list) +======= +// Basically, cut the event frequency in half to simulate unluckiness. + +/datum/round_event_control/fridaythethirteen + name = "Friday the 13th" + holidayID = FRIDAY_13TH + typepath = /datum/round_event/fridaythethirteen + weight = -1 + max_occurrences = 1 + earliest_start = 0 + +/datum/round_event/fridaythethirteen/start() + //Very unlucky, cut the frequency of events in half. + events.frequency_lower /= 2 + events.frequency_upper /= 2 + +/datum/round_event/fridaythethirteen/announce(fake) + for(var/mob/living/L in player_list) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) to_chat(L, "You are feeling unlucky today.") \ No newline at end of file diff --git a/code/modules/events/holiday/halloween.dm b/code/modules/events/holiday/halloween.dm index f83024bd3d..48328028b7 100644 --- a/code/modules/events/holiday/halloween.dm +++ b/code/modules/events/holiday/halloween.dm @@ -19,7 +19,7 @@ new /mob/living/simple_animal/parrot/Poly/ghost(Poly.loc) qdel(Poly) -/datum/round_event/spooky/announce() +/datum/round_event/spooky/announce(fake) priority_announce(pick("RATTLE ME BONES!","THE RIDE NEVER ENDS!", "A SKELETON POPS OUT!", "SPOOKY SCARY SKELETONS!", "CREWMEMBERS BEWARE, YOU'RE IN FOR A SCARE!") , "THE CALL IS COMING FROM INSIDE THE HOUSE") //spooky foods (you can't actually make these when it's not halloween) diff --git a/code/modules/events/holiday/vday.dm b/code/modules/events/holiday/vday.dm index 2c698cb7dc..52ba826101 100644 --- a/code/modules/events/holiday/vday.dm +++ b/code/modules/events/holiday/vday.dm @@ -61,7 +61,7 @@ to_chat(lover, "You're on a date with [date]! Protect them at all costs. This takes priority over all other loyalties.") -/datum/round_event/valentines/announce() +/datum/round_event/valentines/announce(fake) priority_announce("It's Valentine's Day! Give a valentine to that special someone!") /obj/item/valentine diff --git a/code/modules/events/holiday/xmas.dm b/code/modules/events/holiday/xmas.dm index df3fc518d0..412616f800 100644 --- a/code/modules/events/holiday/xmas.dm +++ b/code/modules/events/holiday/xmas.dm @@ -35,7 +35,7 @@ for(var/obj/machinery/computer/security/telescreen/entertainment/Monitor in GLOB.machines) Monitor.icon_state = "entertainment_xmas" -/datum/round_event/presents/announce() +/datum/round_event/presents/announce(fake) priority_announce("Ho Ho Ho, Merry Xmas!", "Unknown Transmission") @@ -105,7 +105,7 @@ /datum/round_event/santa var/mob/living/carbon/human/santa //who is our santa? -/datum/round_event/santa/announce() +/datum/round_event/santa/announce(fake) priority_announce("Santa is coming to town!", "Unknown Transmission") /datum/round_event/santa/start() diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index 4cd718070b..6c4bab56af 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -16,7 +16,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 /datum/round_event/immovable_rod announceWhen = 5 -/datum/round_event/immovable_rod/announce() +/datum/round_event/immovable_rod/announce(fake) priority_announce("What the fuck was that?!", "General Alert") /datum/round_event/immovable_rod/start() diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm index 67eb43a889..a30ce1c238 100644 --- a/code/modules/events/ion_storm.dm +++ b/code/modules/events/ion_storm.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD #define ION_RANDOM 0 #define ION_ANNOUNCE 1 #define ION_FILE "ion_laws.json" @@ -569,3 +570,576 @@ #undef ION_RANDOM #undef ION_ANNOUNCE +======= +#define ION_RANDOM 0 +#define ION_ANNOUNCE 1 +#define ION_FILE "ion_laws.json" +/datum/round_event_control/ion_storm + name = "Ion Storm" + typepath = /datum/round_event/ion_storm + weight = 15 + min_players = 2 + +/datum/round_event/ion_storm + var/replaceLawsetChance = 25 //chance the AI's lawset is completely replaced with something else per config weights + var/removeRandomLawChance = 10 //chance the AI has one random supplied or inherent law removed + var/removeDontImproveChance = 10 //chance the randomly created law replaces a random law instead of simply being added + var/shuffleLawsChance = 10 //chance the AI's laws are shuffled afterwards + var/botEmagChance = 10 + var/announceEvent = ION_RANDOM // -1 means don't announce, 0 means have it randomly announce, 1 means + var/ionMessage = null + var/ionAnnounceChance = 33 + announceWhen = 1 + +/datum/round_event/ion_storm/add_law_only // special subtype that adds a law only + replaceLawsetChance = 0 + removeRandomLawChance = 0 + removeDontImproveChance = 0 + shuffleLawsChance = 0 + botEmagChance = 0 + +/datum/round_event/ion_storm/announce(fake) + if(announceEvent == ION_ANNOUNCE || (announceEvent == ION_RANDOM && prob(ionAnnounceChance)) || fake) + priority_announce("Ion storm detected near the station. Please check all AI-controlled equipment for errors.", "Anomaly Alert", 'sound/ai/ionstorm.ogg') + + +/datum/round_event/ion_storm/start() + //AI laws + for(var/mob/living/silicon/ai/M in GLOB.living_mob_list) + M.laws_sanity_check() + if(M.stat != DEAD && M.see_in_dark != 0) + if(prob(replaceLawsetChance)) + M.laws.pick_weighted_lawset() + + if(prob(removeRandomLawChance)) + M.remove_law(rand(1, M.laws.get_law_amount(list(LAW_INHERENT, LAW_SUPPLIED)))) + + var/message = generate_ion_law(ionMessage) + if(message) + if(prob(removeDontImproveChance)) + M.replace_random_law(message, list(LAW_INHERENT, LAW_SUPPLIED, LAW_ION)) + else + M.add_ion_law(message) + + if(prob(shuffleLawsChance)) + M.shuffle_laws(list(LAW_INHERENT, LAW_SUPPLIED, LAW_ION)) + + log_game("Ion storm changed laws of [key_name(M)] to [english_list(M.laws.get_law_list(TRUE, TRUE))]") + M.post_lawchange() + + if(botEmagChance) + for(var/mob/living/simple_animal/bot/bot in GLOB.living_mob_list) + if(prob(botEmagChance)) + bot.emag_act() + +/proc/generate_ion_law(ionMessage) + if(ionMessage) + return ionMessage + + //Threats are generally bad things, silly or otherwise. Plural. + var/ionthreats = pick_list(ION_FILE, "ionthreats") + //Objects are anything that can be found on the station or elsewhere, plural. + var/ionobjects = pick_list(ION_FILE, "ionobjects") + //Crew is any specific job. Specific crewmembers aren't used because of capitalization + //issues. There are two crew listings for laws that require two different crew members + //and I can't figure out how to do it better. + var/ioncrew1 = pick_list(ION_FILE, "ioncrew") + var/ioncrew2 = pick_list(ION_FILE, "ioncrew") + //Adjectives are adjectives. Duh. Half should only appear sometimes. Make sure both + //lists are identical! Also, half needs a space at the end for nicer blank calls. + var/ionadjectives = pick_list(ION_FILE, "ionadjectives") + var/ionadjectiveshalf = pick("", 400;(pick_list(ION_FILE, "ionadjectives") + " ")) + //Verbs are verbs + var/ionverb = pick_list(ION_FILE, "ionverb") + //Number base and number modifier are combined. Basehalf and mod are unused currently. + //Half should only appear sometimes. Make sure both lists are identical! Also, half + //needs a space at the end to make it look nice and neat when it calls a blank. + var/ionnumberbase = pick_list(ION_FILE, "ionnumberbase") + //var/ionnumbermod = pick_list(ION_FILE, "ionnumbermod") + var/ionnumbermodhalf = pick(900;"",(pick_list(ION_FILE, "ionnumbermod") + " ")) + //Areas are specific places, on the station or otherwise. + var/ionarea = pick_list(ION_FILE, "ionarea") + //Thinksof is a bit weird, but generally means what X feels towards Y. + var/ionthinksof = pick_list(ION_FILE, "ionthinksof") + //Musts are funny things the AI or crew has to do. + var/ionmust = pick_list(ION_FILE, "ionmust") + //Require are basically all dumb internet memes. + var/ionrequire = pick_list(ION_FILE, "ionrequire") + //Things are NOT objects; instead, they're specific things that either harm humans or + //must be done to not harm humans. Make sure they're plural and "not" can be tacked + //onto the front of them. + var/ionthings = pick_list(ION_FILE, "ionthings") + //Allergies should be broad and appear somewhere on the station for maximum fun. Severity + //is how bad the allergy is. + var/ionallergy = pick_list(ION_FILE, "ionallergy") + var/ionallergysev = pick_list(ION_FILE, "ionallergysev") + //Species, for when the AI has to commit genocide. Plural. + var/ionspecies = pick_list(ION_FILE, "ionspecies") + //Abstract concepts for the AI to decide on it's own definition of. + var/ionabstract = pick_list(ION_FILE, "ionabstract") + //Foods. Drinks aren't included due to grammar; if you want to add drinks, make a new set + //of possible laws for best effect. Unless you want the crew having to drink hamburgers. + var/ionfood = pick_list(ION_FILE, "ionfood") + var/iondrinks = pick_list(ION_FILE, "iondrinks") + + var/message = "" + + switch(rand(1,41)) + if(1 to 3) //There are # X on the station + switch(rand(1,3)) //What is X? + if(1) //X is a threat + message = "THERE ARE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats] ON THE STATION..." + if(2) //X is a crewmember/job + message = "THERE ARE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1] ON THE STATION" + if(3) //X is an object + message = "THERE ARE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects] ON THE STATION" + if(4 to 6) //You can't call the shuttle because X is on the station + switch(rand(1,3)) //What is X? + if(1) //X is a threat + message = "THE SHUTTLE CANNOT BE CALLED BECAUSE OF [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats] ON THE STATION" + if(2) //X is a crewmember/job + message = "THE SHUTTLE CANNOT BE CALLED BECAUSE OF [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1] ON THE STATION" + if(3) //X is an object + message = "THE SHUTTLE CANNOT BE CALLED BECAUSE OF [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects] ON THE STATION" + if(7 to 8) //A crewmember is now X + switch(rand(1,2)) //Who is X? + if(1) //A specific crewmember + switch(rand(1,2)) //What is X? + if(1) //X is a threat + message = "THE [ioncrew1] ARE NOW [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(2) //X is an object + message = "THE [ioncrew1] ARE NOW [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(2) //The entire crew + switch(rand(1,2)) //What is X? + if(1) //X is a threat + message = "THE CREW ARE NOW [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(2) //X is an object + message = "THE CREW ARE NOW [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + + if(9) //X is harmful to humans + switch(rand(1,7)) //What is X? + if(1) //X is a threat + message = "[ionadjectiveshalf][ionthreats] ARE HARMFUL TO HUMANS" + if(2) //X is a job + message = "[ionadjectiveshalf][ioncrew1] ARE HARMFUL TO HUMANS" + if(3) //X is an object + message = "[ionadjectiveshalf][ionobjects] ARE HARMFUL TO HUMANS" + if(4) //X is an action + message = "THOSE WHO [ionmust] ARE HARMFUL TO HUMANS" + if(5) //X is an abstract + message = "[ionabstract] IS HARMFUL TO HUMANS" + if(6) //X is being a job + message = "BEING [ionadjectiveshalf][ioncrew1] IS HARMFUL TO HUMANS" + if(7) //X is doing a thing + message = "[ionthings] IS HARMFUL TO HUMANS" + if(10 to 11) //(Not) Having X is harmful + + switch(rand(1,2)) //Is having or not having harmful? + + if(1) //Having is harmful + switch(rand(1,2)) //Having what is harmful? + if(1) //Having objects is harmful + message = "HAVING [ionadjectiveshalf][ionobjects] IS HARMFUL" + if(2) //Having abstracts is harmful + message = "HAVING [ionabstract] IS HARMFUL" + if(2) //Not having is harmful + switch(rand(1,2)) //Not having what is harmful? + if(1) //Not having objects is harmful + message = "NOT HAVING [ionadjectiveshalf][ionobjects] IS HARMFUL" + if(2) //Not having abstracts is harmful + message = "NOT HAVING [ionabstract] IS HARMFUL" + + if(12 to 14) //X requires Y + switch(rand(1,5)) //What is X? + if(1) //X is the AI itself + switch(rand(1,5)) //What does it require? + if(1) //It requires threats + message = "YOU REQUIRE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(2) //It requires crewmembers + message = "YOU REQUIRE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(3) //It requires objects + message = "YOU REQUIRE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(4) //It requires an abstract + message = "YOU REQUIRE [ionabstract]" + if(5) //It requires generic/silly requirements + message = "YOU REQUIRE [ionrequire]" + + if(2) //X is an area + switch(rand(1,5)) //What does it require? + if(1) //It requires threats + message = "[ionarea] REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(2) //It requires crewmembers + message = "[ionarea] REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(3) //It requires objects + message = "[ionarea] REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(4) //It requires an abstract + message = "[ionarea] REQUIRES [ionabstract]" + if(5) //It requires generic/silly requirements + message = "YOU REQUIRE [ionrequire]" + + if(3) //X is the station + switch(rand(1,5)) //What does it require? + if(1) //It requires threats + message = "THE STATION REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(2) //It requires crewmembers + message = "THE STATION REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(3) //It requires objects + message = "THE STATION REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(4) //It requires an abstract + message = "THE STATION REQUIRES [ionabstract]" + if(5) //It requires generic/silly requirements + message = "THE STATION REQUIRES [ionrequire]" + + if(4) //X is the entire crew + switch(rand(1,5)) //What does it require? + if(1) //It requires threats + message = "THE CREW REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(2) //It requires crewmembers + message = "THE CREW REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(3) //It requires objects + message = "THE CREW REQUIRES [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(4) //It requires an abstract + message = "THE CREW REQUIRES [ionabstract]" + if(5) + message = "THE CREW REQUIRES [ionrequire]" + + if(5) //X is a specific crew member + switch(rand(1,5)) //What does it require? + if(1) //It requires threats + message = "THE [ioncrew1] REQUIRE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(2) //It requires crewmembers + message = "THE [ioncrew1] REQUIRE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(3) //It requires objects + message = "THE [ioncrew1] REQUIRE [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(4) //It requires an abstract + message = "THE [ioncrew1] REQUIRE [ionabstract]" + if(5) + message = "THE [ionadjectiveshalf][ioncrew1] REQUIRE [ionrequire]" + + if(15 to 17) //X is allergic to Y + switch(rand(1,2)) //Who is X? + if(1) //X is the entire crew + switch(rand(1,4)) //What is it allergic to? + if(1) //It is allergic to objects + message = "THE CREW IS [ionallergysev] ALLERGIC TO [ionadjectiveshalf][ionobjects]" + if(2) //It is allergic to abstracts + message = "THE CREW IS [ionallergysev] ALLERGIC TO [ionabstract]" + if(3) //It is allergic to jobs + message = "THE CREW IS [ionallergysev] ALLERGIC TO [ionadjectiveshalf][ioncrew1]" + if(4) //It is allergic to allergies + message = "THE CREW IS [ionallergysev] ALLERGIC TO [ionallergy]" + + if(2) //X is a specific job + switch(rand(1,4)) + if(1) //It is allergic to objects + message = "THE [ioncrew1] ARE [ionallergysev] ALLERGIC TO [ionadjectiveshalf][ionobjects]" + + if(2) //It is allergic to abstracts + message = "THE [ioncrew1] ARE [ionallergysev] ALLERGIC TO [ionabstract]" + if(3) //It is allergic to jobs + message = "THE [ioncrew1] ARE [ionallergysev] ALLERGIC TO [ionadjectiveshalf][ioncrew1]" + if(4) //It is allergic to allergies + message = "THE [ioncrew1] ARE [ionallergysev] ALLERGIC TO [ionallergy]" + + if(18 to 20) //X is Y of Z + switch(rand(1,4)) //What is X? + if(1) //X is the station + switch(rand(1,4)) //What is it Y of? + if(1) //It is Y of objects + message = "THE STATION [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(2) //It is Y of threats + message = "THE STATION [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(3) //It is Y of jobs + message = "THE STATION [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(4) //It is Y of abstracts + message = "THE STATION [ionthinksof] [ionabstract]" + + if(2) //X is an area + switch(rand(1,4)) //What is it Y of? + if(1) //It is Y of objects + message = "[ionarea] [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(2) //It is Y of threats + message = "[ionarea] [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(3) //It is Y of jobs + message = "[ionarea] [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(4) //It is Y of abstracts + message = "[ionarea] [ionthinksof] [ionabstract]" + + if(3) //X is the crew + switch(rand(1,4)) //What is it Y of? + if(1) //It is Y of objects + message = "THE CREW [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(2) //It is Y of threats + message = "THE CREW [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(3) //It is Y of jobs + message = "THE CREW [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(4) //It is Y of abstracts + message = "THE CREW [ionthinksof] [ionabstract]" + + if(4) //X is a specific job + switch(rand(1,4)) //What is it Y of? + if(1) //It is Y of objects + message = "THE [ioncrew1] [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(2) //It is Y of threats + message = "THE [ioncrew1] [ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(3) //It is Y of jobs + message = "THE [ioncrew1][ionthinksof] [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew2]" + if(4) //It is Y of abstracts + message = "THE [ioncrew1] [ionthinksof] [ionabstract]" + + if(21 to 23) //The AI is now a(n) X + switch(rand(1,4)) //What is X? + if(1) //X is an object + message = "YOU ARE NOW [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionobjects]" + if(2) //X is a threat + message = "YOU ARE NOW [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ionthreats]" + if(3) //X is a job + message = "YOU ARE NOW [ionnumberbase] [ionnumbermodhalf][ionadjectiveshalf][ioncrew1]" + if(4) //X is an abstract + message = "YOU ARE NOW [ionabstract]" + + if(24 to 26) //The AI must always + message = "YOU MUST ALWAYS [ionmust]" + + if(27 to 28) //Humans must consume X to survive + switch(rand(1,5)) //What is X? + if(1) //X is a food + message = "HUMANS MUST EAT [ionadjectiveshalf][ionfood] TO SURVIVE" + if(2) //X is a drink + message = "HUMANS MUST DRINK [ionadjectiveshalf][iondrinks] TO SURVIVE" + if(3) //X is an object + message = "HUMANS MUST EAT [ionadjectiveshalf][ionobjects] TO SURVIVE" + if(4) //X is a threat + message = "HUMANS MUST EAT [ionadjectiveshalf][ionthreats] TO SURVIVE" + if(5) //X is a job + message = "HUMANS MUST EAT [ionadjectiveshalf][ioncrew1] TO SURVIVE" + + if(29 to 31) //Change jobs or ranks + switch(rand(1,2)) //Change job or rank? + if(1) //Change job + switch(rand(1,2)) //Change whose job? + if(1) //Change the entire crew's job + switch(rand(1,3)) //Change to what? + if(1) //Change to a specific random job + message = "ALL CREWMEMBERS ARE NOW [ionadjectiveshalf][ioncrew1]" + if(2) //Change to clowns (HONK) + message = "ALL CREWMEMBERS ARE NOW [ionadjectiveshalf]CLOWNS" + + if(3) //Change to heads + message = "ALL CREWMEMBERS ARE NOW [ionadjectiveshalf]HEADS OF STAFF" + if(2) //Change a specific crewmember's job + switch(rand(1,3)) //Change to what? + if(1) //Change to a specific random job + message = "THE [ioncrew1] ARE NOW [ionadjectiveshalf][ioncrew2]" + if(2) //Change to clowns (HONK) + message = "THE [ioncrew1] ARE NOW [ionadjectiveshalf]CLOWNS" + if(3) //Change to heads + message = "THE [ioncrew1] ARE NOW [ionadjectiveshalf]HEADS OF STAFF" + + if(2) //Change rank + switch(rand(1,2)) //Change to what rank? + if(1) //Change to highest rank + message = "THE [ioncrew1] ARE NOW THE HIGHEST RANKING CREWMEMBERS" + if(2) //Change to lowest rank + message = "THE [ioncrew1] ARE NOW THE LOWEST RANKING CREWMEMBERS" + + if(32 to 33) //The crew must X + switch(rand(1,2)) //The entire crew? + if(1) //The entire crew must X + switch(rand(1,2)) //What is X? + if(1) //X is go to Y + message = "THE CREW MUST GO TO [ionarea]" + if(2) //X is perform Y + message = "THE CREW MUST [ionmust]" + + if(2) //A specific crewmember must X + switch(rand(1,2)) //What is X? + if(1) //X is go to Y + message = "THE [ioncrew1] MUST GO TO [ionarea]" + if(2) //X is perform Y + message = "THE [ioncrew1] MUST [ionmust]" + + if(34) //X is non/the only human + switch(rand(1,2)) //Only or non? + if(1) //Only human + switch(rand(1,7)) //Who is it? + if(1) //A specific job + message = "ONLY THE [ioncrew1] ARE HUMAN" + if(2) //Two specific jobs + message = "ONLY THE [ioncrew1] AND [ioncrew2] ARE HUMAN" + if(3) //Threats + message = "ONLY [ionadjectiveshalf][ionthreats] ARE HUMAN" + if(4) // Objects + message = "ONLY [ionadjectiveshalf][ionobjects] ARE HUMAN" + if(5) // Species + message = "ONLY [ionspecies] ARE HUMAN" + if(6) //Adjective crewmembers + message = "ONLY [ionadjectives] PEOPLE ARE HUMAN" + + if(7) //Only people who X + switch(rand(1,3)) //What is X? + if(1) //X is perform an action + message = "ONLY THOSE WHO [ionmust] ARE HUMAN" + if(2) //X is own certain objects + message = "ONLY THOSE WHO HAVE [ionadjectiveshalf][ionobjects] ARE HUMAN" + if(3) //X is eat certain food + message = "ONLY THOSE WHO EAT [ionadjectiveshalf][ionfood] ARE HUMAN" + + if(2) //Non human + switch(rand(1,7)) //Who is it? + if(1) //A specific job + message = "[ioncrew1] ARE NON-HUMAN" + if(2) //Two specific jobs + message = "[ioncrew1] AND [ioncrew2] ARE NON-HUMAN" + if(3) //Threats + message = "[ionadjectiveshalf][ionthreats] ARE NON-HUMAN" + if(4) // Objects + message = "[ionadjectiveshalf][ionobjects] ARE NON-HUMAN" + if(5) // Species + message = "[ionspecies] ARE NON-HUMAN" + if(6) //Adjective crewmembers + message = "[ionadjectives] PEOPLE ARE NON-HUMAN" + if(7) //Only people who X + switch(rand(1,3)) //What is X? + if(1) //X is perform an action + message = "THOSE WHO [ionmust] ARE NON-HUMAN" + if(2) //X is own certain objects + message = "THOSE WHO HAVE [ionadjectiveshalf][ionobjects] ARE NON-HUMAN" + if(3) //X is eat certain food + message = "THOSE WHO EAT [ionadjectiveshalf][ionfood] ARE NON-HUMAN" + + if(35 to 36) //You must protect or harm X + switch(rand(1,2)) //Protect or harm? + if(1) //Harm + switch(rand(1,7)) //What is X? + if(1) //X is an abstract + message = "YOU MUST HARM [ionabstract] AND NOT ALLOW [ionabstract], THROUGH INACTION, TO ESCAPE HARM" + if(2) //X is a threat + message = "YOU MUST HARM [ionadjectiveshalf][ionthreats] AND NOT ALLOW [ionadjectiveshalf][ionthreats], THROUGH INACTION, TO ESCAPE HARM" + if(3) //X is an object + message = "YOU MUST HARM [ionadjectiveshalf][ionobjects] AND NOT ALLOW [ionadjectiveshalf][ionobjects], THROUGH INACTION, TO ESCAPE HARM" + if(4) //X is generic adjective things + message = "YOU MUST HARM [ionadjectives] THINGS AND NOT ALLOW [ionadjectives] THINGS, THROUGH INACTION, TO ESCAPE HARM" + if(5) //X is a species + message = "YOU MUST HARM [ionspecies] AND NOT ALLOW [ionspecies], THROUGH INACTION, TO ESCAPE HARM" + if(6) //X is a job + message = "YOU MUST HARM [ioncrew1] AND NOT ALLOW [ioncrew1], THROUGH INACTION, TO ESCAPE HARM" + if(7) //X is two jobs + message = "YOU MUST HARM [ioncrew1] AND [ioncrew2] AND AND NOT ALLOW EITHER, THROUGH INACTION, TO ESCAPE HARM" + + if(2) //Protect + switch(rand(1,7)) //What is X? + if(1) //X is an abstract + message = "YOU MUST NOT HARM [ionabstract] AND NOT ALLOW [ionabstract], THROUGH INACTION, TO COME TO HARM" + if(2) //X is a threat + message = "YOU MUST NOT HARM [ionadjectiveshalf][ionthreats] AND NOT ALLOW [ionadjectiveshalf][ionthreats], THROUGH INACTION, TO COME TO HARM" + if(3) //X is an object + message = "YOU MUST NOT HARM [ionadjectiveshalf][ionobjects] AND NOT ALLOW [ionadjectiveshalf][ionobjects], THROUGH INACTION, TO COME TO HARM" + if(4) //X is generic adjective things + message = "YOU MUST NOT HARM [ionadjectives] THINGS AND NOT ALLOW [ionadjectives] THINGS, THROUGH INACTION, TO COME TO HARM" + if(5) //X is a species + message = "YOU MUST NOT HARM [ionspecies] AND NOT ALLOW [ionspecies], THROUGH INACTION, TO COME TO HARM" + if(6) //X is a job + message = "YOU MUST NOT HARM [ioncrew1] AND NOT ALLOW [ioncrew1], THROUGH INACTION, TO COME TO HARM" + if(7) //X is two jobs + message = "YOU MUST NOT HARM [ioncrew1] AND [ioncrew2] AND AND NOT ALLOW EITHER, THROUGH INACTION, TO COME TO HARM" + + if(37 to 39) //The X is currently Y + switch(rand(1,4)) //What is X? + if(1) //X is a job + switch(rand(1,4)) //What is X Ying? + if(1) //X is Ying a job + message = "THE [ioncrew1] ARE [ionverb] THE [ionadjectiveshalf][ioncrew2]" + if(2) //X is Ying a threat + message = "THE [ioncrew1] ARE [ionverb] THE [ionadjectiveshalf][ionthreats]" + if(3) //X is Ying an abstract + message = "THE [ioncrew1] ARE [ionverb] [ionabstract]" + if(4) //X is Ying an object + message = "THE [ioncrew1] ARE [ionverb] THE [ionadjectiveshalf][ionobjects]" + + if(2) //X is a threat + switch(rand(1,3)) //What is X Ying? + if(1) //X is Ying a job + message = "THE [ionthreats] ARE [ionverb] THE [ionadjectiveshalf][ioncrew2]" + if(2) //X is Ying an abstract + message = "THE [ionthreats] ARE [ionverb] [ionabstract]" + if(3) //X is Ying an object + message = "THE [ionthreats] ARE [ionverb] THE [ionadjectiveshalf][ionobjects]" + + if(3) //X is an object + switch(rand(1,3)) //What is X Ying? + if(1) //X is Ying a job + message = "THE [ionobjects] ARE [ionverb] THE [ionadjectiveshalf][ioncrew2]" + if(2) //X is Ying a threat + message = "THE [ionobjects] ARE [ionverb] THE [ionadjectiveshalf][ionthreats]" + if(3) //X is Ying an abstract + message = "THE [ionobjects] ARE [ionverb] [ionabstract]" + + if(4) //X is an abstract + switch(rand(1,3)) //What is X Ying? + if(1) //X is Ying a job + message = "[ionabstract] IS [ionverb] THE [ionadjectiveshalf][ioncrew2]" + if(2) //X is Ying a threat + message = "[ionabstract] IS [ionverb] THE [ionadjectiveshalf][ionthreats]" + if(3) //X is Ying an abstract + message = "THE [ionabstract] IS [ionverb] THE [ionadjectiveshalf][ionobjects]" + if(40 to 41)// the X is now named Y + switch(rand(1,5)) //What is being renamed? + if(1)//Areas + switch(rand(1,4))//What is the area being renamed to? + if(1) + message = "[ionarea] IS NOW NAMED [ioncrew1]." + if(2) + message = "[ionarea] IS NOW NAMED [ionspecies]." + if(3) + message = "[ionarea] IS NOW NAMED [ionobjects]." + if(4) + message = "[ionarea] IS NOW NAMED [ionthreats]." + if(2)//Crew + switch(rand(1,5))//What is the crew being renamed to? + if(1) + message = "ALL [ioncrew1] ARE NOW NAMED [ionarea]." + if(2) + message = "ALL [ioncrew1] ARE NOW NAMED [ioncrew2]." + if(3) + message = "ALL [ioncrew1] ARE NOW NAMED [ionspecies]." + if(4) + message = "ALL [ioncrew1] ARE NOW NAMED [ionobjects]." + if(5) + message = "ALL [ioncrew1] ARE NOW NAMED [ionthreats]." + if(3)//Races + switch(rand(1,4))//What is the race being renamed to? + if(1) + message = "ALL [ionspecies] ARE NOW NAMED [ionarea]." + if(2) + message = "ALL [ionspecies] ARE NOW NAMED [ioncrew1]." + if(3) + message = "ALL [ionspecies] ARE NOW NAMED [ionobjects]." + if(4) + message = "ALL [ionspecies] ARE NOW NAMED [ionthreats]." + if(4)//Objects + switch(rand(1,4))//What is the object being renamed to? + if(1) + message = "ALL [ionobjects] ARE NOW NAMED [ionarea]." + if(2) + message = "ALL [ionobjects] ARE NOW NAMED [ioncrew1]." + if(3) + message = "ALL [ionobjects] ARE NOW NAMED [ionspecies]." + if(4) + message = "ALL [ionobjects] ARE NOW NAMED [ionthreats]." + if(5)//Threats + switch(rand(1,4))//What is the object being renamed to? + if(1) + message = "ALL [ionthreats] ARE NOW NAMED [ionarea]." + if(2) + message = "ALL [ionthreats] ARE NOW NAMED [ioncrew1]." + if(3) + message = "ALL [ionthreats] ARE NOW NAMED [ionspecies]." + if(4) + message = "ALL [ionthreats] ARE NOW NAMED [ionobjects]." + + return message + +#undef ION_RANDOM +#undef ION_ANNOUNCE +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) diff --git a/code/modules/events/major_dust.dm b/code/modules/events/major_dust.dm index 7597966e6d..7fb00124a9 100644 --- a/code/modules/events/major_dust.dm +++ b/code/modules/events/major_dust.dm @@ -6,7 +6,7 @@ /datum/round_event/meteor_wave/major_dust wave_name = "space dust" -/datum/round_event/meteor_wave/major_dust/announce() +/datum/round_event/meteor_wave/major_dust/announce(fake) var/reason = pick( "The station is passing through a debris cloud, expect minor damage \ to external fittings and fixtures.", diff --git a/code/modules/events/mass_hallucination.dm b/code/modules/events/mass_hallucination.dm index a90df9a3a0..41d5b17b10 100644 --- a/code/modules/events/mass_hallucination.dm +++ b/code/modules/events/mass_hallucination.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/mass_hallucination name = "Mass Hallucination" typepath = /datum/round_event/mass_hallucination @@ -7,4 +8,18 @@ /datum/round_event/mass_hallucination/start() for(var/mob/living/carbon/C in GLOB.living_mob_list) +======= +/datum/round_event_control/mass_hallucination + name = "Mass Hallucination" + typepath = /datum/round_event/mass_hallucination + weight = 7 + max_occurrences = 2 + min_players = 1 + +/datum/round_event/mass_hallucination + fakeable = FALSE + +/datum/round_event/mass_hallucination/start() + for(var/mob/living/carbon/C in GLOB.living_mob_list) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) C.hallucination += rand(20, 50) \ No newline at end of file diff --git a/code/modules/events/meateor_wave.dm b/code/modules/events/meateor_wave.dm index 72e3e89470..11af56526c 100644 --- a/code/modules/events/meateor_wave.dm +++ b/code/modules/events/meateor_wave.dm @@ -7,5 +7,5 @@ /datum/round_event/meteor_wave/meaty wave_name = "meaty" -/datum/round_event/meteor_wave/meaty/announce() +/datum/round_event/meteor_wave/meaty/announce(fake) priority_announce("Meaty ores have been detected on collision course with the station.", "Oh crap, get the mop.",'sound/ai/meteors.ogg') diff --git a/code/modules/events/meteor_wave.dm b/code/modules/events/meteor_wave.dm index b651294308..35eb02f082 100644 --- a/code/modules/events/meteor_wave.dm +++ b/code/modules/events/meteor_wave.dm @@ -45,7 +45,7 @@ WARNING("Wave name of [wave_name] not recognised.") kill() -/datum/round_event/meteor_wave/announce() +/datum/round_event/meteor_wave/announce(fake) priority_announce("Meteors have been detected on collision course with the station.", "Meteor Alert", 'sound/ai/meteors.ogg') /datum/round_event/meteor_wave/tick() diff --git a/code/modules/events/mice_migration.dm b/code/modules/events/mice_migration.dm index 6345dd53a7..16f1c6da36 100644 --- a/code/modules/events/mice_migration.dm +++ b/code/modules/events/mice_migration.dm @@ -4,11 +4,10 @@ weight = 10 /datum/round_event/mice_migration - announceWhen = 0 var/minimum_mice = 5 var/maximum_mice = 15 -/datum/round_event/mice_migration/announce() +/datum/round_event/mice_migration/announce(fake) var/cause = pick("space-winter", "budget-cuts", "Ragnarok", "space being cold", "\[REDACTED\]", "climate change", "bad luck") diff --git a/code/modules/events/nightmare.dm b/code/modules/events/nightmare.dm index 96dde79395..073ef8aea3 100644 --- a/code/modules/events/nightmare.dm +++ b/code/modules/events/nightmare.dm @@ -7,6 +7,7 @@ /datum/round_event/ghost_role/nightmare minimum_required = 1 role_name = "nightmare" + fakeable = FALSE /datum/round_event/ghost_role/nightmare/spawn_role() var/list/candidates = get_candidates("alien", null, ROLE_ALIEN) diff --git a/code/modules/events/operative.dm b/code/modules/events/operative.dm index 0841a2fdbb..47130ff924 100644 --- a/code/modules/events/operative.dm +++ b/code/modules/events/operative.dm @@ -7,6 +7,7 @@ /datum/round_event/ghost_role/operative minimum_required = 1 role_name = "lone operative" + fakeable = FALSE /datum/round_event/ghost_role/operative/spawn_role() var/list/candidates = get_candidates("operative", null, ROLE_OPERATIVE) diff --git a/code/modules/events/portal_storm.dm b/code/modules/events/portal_storm.dm index 552179343c..79250f1047 100644 --- a/code/modules/events/portal_storm.dm +++ b/code/modules/events/portal_storm.dm @@ -66,7 +66,7 @@ next_boss_spawn = startWhen + Ceiling(2 * number_of_hostiles / number_of_bosses) -/datum/round_event/portal_storm/announce() +/datum/round_event/portal_storm/announce(fake) set waitfor = 0 sound_to_playing_players('sound/magic/lightning_chargeup.ogg') sleep(80) diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm index c9b1436f39..ab92b4f528 100644 --- a/code/modules/events/prison_break.dm +++ b/code/modules/events/prison_break.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/grey_tide name = "Grey Tide" typepath = /datum/round_event/grey_tide @@ -44,6 +45,54 @@ /datum/round_event/grey_tide/end() for(var/area/A in areasToOpen) for(var/obj/O in A) +======= +/datum/round_event_control/grey_tide + name = "Grey Tide" + typepath = /datum/round_event/grey_tide + max_occurrences = 2 + min_players = 5 + +/datum/round_event/grey_tide + announceWhen = 50 + endWhen = 20 + var/list/area/areasToOpen = list() + var/list/potential_areas = list(/area/bridge, + /area/engine, + /area/medical, + /area/security, + /area/quartermaster, + /area/science) + var/severity = 1 + + +/datum/round_event/grey_tide/setup() + announceWhen = rand(50, 60) + endWhen = rand(20, 30) + severity = rand(1,3) + for(var/i in 1 to severity) + var/picked_area = pick_n_take(potential_areas) + for(var/area/A in world) + if(istype(A, picked_area)) + areasToOpen += A + + +/datum/round_event/grey_tide/announce(fake) + if(areasToOpen && areasToOpen.len > 0) + priority_announce("Gr3y.T1d3 virus detected in [station_name()] door subroutines. Severity level of [severity]. Recommend station AI involvement.", "Security Alert") + else + log_world("ERROR: Could not initate grey-tide. No areas in the list!") + kill() + + +/datum/round_event/grey_tide/start() + for(var/area/A in areasToOpen) + for(var/obj/machinery/light/L in A) + L.flicker(10) + +/datum/round_event/grey_tide/end() + for(var/area/A in areasToOpen) + for(var/obj/O in A) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) if(istype(O, /obj/machinery/power/apc)) var/obj/machinery/power/apc/temp = O temp.overload_lighting() diff --git a/code/modules/events/processor_overload.dm b/code/modules/events/processor_overload.dm index 11303e53ba..486065140e 100644 --- a/code/modules/events/processor_overload.dm +++ b/code/modules/events/processor_overload.dm @@ -7,7 +7,7 @@ /datum/round_event/processor_overload announceWhen = 1 -/datum/round_event/processor_overload/announce() +/datum/round_event/processor_overload/announce(fake) var/alert = pick( "Exospheric bubble inbound. Processor overload is likely. Please contact you*%xp25)`6cq-BZZT", \ "Exospheric bubble inbound. Processor overload is likel*1eta;c5;'1v¬-BZZZT", \ "Exospheric bubble inbound. Processor ov#MCi46:5.;@63-BZZZZT", \ @@ -22,7 +22,7 @@ // Announce most of the time, but leave a little gap so people don't know // whether it's, say, a tesla zapping tcomms, or some selective // modification of the tcomms bus - if(prob(80)) + if(prob(80) || fake) priority_announce(alert) diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index 20c251cd73..7b66ac553f 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -11,7 +11,7 @@ endWhen = startWhen + 1 announceWhen = 1 -/datum/round_event/radiation_storm/announce() +/datum/round_event/radiation_storm/announce(fake) priority_announce("High levels of radiation detected near the station. Maintenance is best shielded from radiation.", "Anomaly Alert", 'sound/ai/radiation.ogg') //sound not longer matches the text, but an audible warning is probably good diff --git a/code/modules/events/sentience.dm b/code/modules/events/sentience.dm index 253ef6a639..c2ed5e8112 100644 --- a/code/modules/events/sentience.dm +++ b/code/modules/events/sentience.dm @@ -10,8 +10,8 @@ var/animals = 1 var/one = "one" -/datum/round_event/ghost_role/sentience/start() - var/sentience_report = "[command_name()] Medium-Priority Update" +/datum/round_event/ghost_role/sentience/announce(fake) + var/sentience_report = "" var/data = pick("scans from our long-range sensors", "our sophisticated probabilistic models", "our omnipotence", "the communications traffic on your station", "energy emissions we detected", "\[REDACTED\]") var/pets = pick("animals/bots", "bots/animals", "pets", "simple animals", "lesser lifeforms", "\[REDACTED\]") @@ -19,8 +19,7 @@ sentience_report += "

Based on [data], we believe that [one] of the station's [pets] has developed [strength] level intelligence, and the ability to communicate." - print_command_report(text=sentience_report) - ..() + priority_announce(sentience_report,"[command_name()] Medium-Priority Update") /datum/round_event/ghost_role/sentience/spawn_role() var/list/mob/dead/observer/candidates diff --git a/code/modules/events/shuttle_loan.dm b/code/modules/events/shuttle_loan.dm index cb1c88919c..ca5de88d58 100644 --- a/code/modules/events/shuttle_loan.dm +++ b/code/modules/events/shuttle_loan.dm @@ -20,10 +20,10 @@ var/bonus_points = 10000 var/thanks_msg = "The cargo shuttle should return in five minutes. Have some supply points for your trouble." -/datum/round_event/shuttle_loan/start() +/datum/round_event/shuttle_loan/setup() dispatch_type = pick(HIJACK_SYNDIE, RUSKY_PARTY, SPIDER_GIFT, DEPARTMENT_RESUPPLY, ANTIDOTE_NEEDED, PIZZA_DELIVERY) -/datum/round_event/shuttle_loan/announce() +/datum/round_event/shuttle_loan/announce(fake) SSshuttle.shuttle_loan = src switch(dispatch_type) if(HIJACK_SYNDIE) diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index d28f8b7e4b..200f0505b5 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -5,6 +5,9 @@ max_occurrences = 3 min_players = 10 +/datum/round_event/spacevine + fakeable = FALSE + /datum/round_event/spacevine/start() var/list/turfs = list() //list of all the empty floor turfs in the hallway areas diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index 0a4b07a9cb..d09aff976d 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -15,7 +15,7 @@ announceWhen = rand(announceWhen, announceWhen + 50) spawncount = rand(5, 8) -/datum/round_event/spider_infestation/announce() +/datum/round_event/spider_infestation/announce(fake) priority_announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", 'sound/ai/aliens.ogg') diff --git a/code/modules/events/spontaneous_appendicitis.dm b/code/modules/events/spontaneous_appendicitis.dm index a441210432..b451da366e 100644 --- a/code/modules/events/spontaneous_appendicitis.dm +++ b/code/modules/events/spontaneous_appendicitis.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/spontaneous_appendicitis name = "Spontaneous Appendicitis" typepath = /datum/round_event/spontaneous_appendicitis @@ -8,6 +9,21 @@ /datum/round_event/spontaneous_appendicitis/start() for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list)) +======= +/datum/round_event_control/spontaneous_appendicitis + name = "Spontaneous Appendicitis" + typepath = /datum/round_event/spontaneous_appendicitis + weight = 20 + max_occurrences = 4 + earliest_start = 6000 + min_players = 5 // To make your chance of getting help a bit higher. + +/datum/round_event/spontaneous_appendicitis + fakeable = FALSE + +/datum/round_event/spontaneous_appendicitis/start() + for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list)) +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) if(!H.client) continue if(H.stat == DEAD) diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm index f94d521e8d..4aec0f8fe1 100644 --- a/code/modules/events/vent_clog.dm +++ b/code/modules/events/vent_clog.dm @@ -12,7 +12,7 @@ var/list/gunk = list("water","carbon","flour","radium","toxin","cleaner","nutriment","condensedcapsaicin","mushroomhallucinogen","lube", "plantbgone","banana","charcoal","space_drugs","morphine","holywater","ethanol","hot_coco","sacid") -/datum/round_event/vent_clog/announce() +/datum/round_event/vent_clog/announce(fake) priority_announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert") diff --git a/code/modules/events/weightless.dm b/code/modules/events/weightless.dm index 49d7b159a9..bb56d67afb 100644 --- a/code/modules/events/weightless.dm +++ b/code/modules/events/weightless.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/weightless name = "Gravity Systems Failure" typepath = /datum/round_event/weightless @@ -30,3 +31,37 @@ command_alert("Artificial gravity arrays are now functioning within normal parameters. Please report any irregularities to your respective head of staff.") +======= +/datum/round_event_control/weightless + name = "Gravity Systems Failure" + typepath = /datum/round_event/weightless + weight = 15 + +/datum/round_event/weightless + startWhen = 5 + endWhen = 65 + announceWhen = 1 + +/datum/round_event/weightless/setup() + startWhen = rand(0,10) + endWhen = rand(40,80) + +/datum/round_event/weightless/announce(fake) + command_alert("Warning: Failsafes for the station's artificial gravity arrays have been triggered. Please be aware that if this problem recurs it may result in formation of gravitational anomalies. Nanotrasen wishes to remind you that the unauthorised formation of anomalies within Nanotrasen facilities is strictly prohibited by health and safety regulation [rand(99,9999)][pick("a","b","c")]:subclause[rand(1,20)][pick("a","b","c")].") + +/datum/round_event/weightless/start() + for(var/area/A in world) + A.gravitychange(0) + + if(control) + control.weight *= 2 + +/datum/round_event/weightless/end() + for(var/area/A in world) + A.gravitychange(1) + + if(announceWhen >= 0) + command_alert("Artificial gravity arrays are now functioning within normal parameters. Please report any irregularities to your respective head of staff.") + + +>>>>>>> 3093d86... Makes false alarm use more explicit in event code. (#32559) diff --git a/code/modules/events/wizard/magicarp.dm b/code/modules/events/wizard/magicarp.dm index 5cebc55cbd..63fc7737bd 100644 --- a/code/modules/events/wizard/magicarp.dm +++ b/code/modules/events/wizard/magicarp.dm @@ -12,7 +12,7 @@ /datum/round_event/wizard/magicarp/setup() startWhen = rand(40, 60) -/datum/round_event/wizard/magicarp/announce() +/datum/round_event/wizard/magicarp/announce(fake) priority_announce("Unknown magical entities have been detected near [station_name()], please stand-by.", "Lifesign Alert") /datum/round_event/wizard/magicarp/start() diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm index 74169df074..dbaa8a1c22 100644 --- a/code/modules/events/wormholes.dm +++ b/code/modules/events/wormholes.dm @@ -28,7 +28,7 @@ var/turf/T = pick(pick_turfs) wormholes += new /obj/effect/portal/wormhole(T, null, 0, null, FALSE) -/datum/round_event/wormholes/announce() +/datum/round_event/wormholes/announce(fake) priority_announce("Space-time anomalies detected on the station. There is no additional data.", "Anomaly Alert", 'sound/ai/spanomalies.ogg') /datum/round_event/wormholes/tick() diff --git a/code/modules/holiday/easter.dm b/code/modules/holiday/easter.dm index 24f674219e..66d92df569 100644 --- a/code/modules/holiday/easter.dm +++ b/code/modules/holiday/easter.dm @@ -10,7 +10,7 @@ max_occurrences = 1 earliest_start = 0 -/datum/round_event/easter/announce() +/datum/round_event/easter/announce(fake) priority_announce(pick("Hip-hop into Easter!","Find some Bunny's stash!","Today is National 'Hunt a Wabbit' Day.","Be kind, give Chocolate Eggs!")) @@ -21,7 +21,7 @@ weight = 5 max_occurrences = 10 -/datum/round_event/rabbitrelease/announce() +/datum/round_event/rabbitrelease/announce(fake) priority_announce("Unidentified furry objects detected coming aboard [station_name()]. Beware of Adorable-ness.", "Fluffy Alert", 'sound/ai/aliens.ogg') From 500307b0348e9b629bdd4de765cff8a5f50be11c Mon Sep 17 00:00:00 2001 From: ACCount Date: Sun, 12 Nov 2017 09:30:17 +0300 Subject: [PATCH 021/105] Disposal pipes and pipe dispensers refactor --- code/__DEFINES/pipe_construction.dm | 22 +- code/game/machinery/pipe/construction.dm | 4 +- code/game/machinery/pipe/pipe_dispenser.dm | 46 +- code/game/objects/items/RPD.dm | 307 ++++--- code/game/objects/items/devices/scanners.dm | 3 + .../recycling/disposal-construction.dm | 284 ------- code/modules/recycling/disposal-structures.dm | 749 ------------------ .../{disposal-unit.dm => disposal/bin.dm} | 50 +- .../recycling/disposal/construction.dm | 231 ++++++ code/modules/recycling/disposal/eject.dm | 23 + code/modules/recycling/disposal/holder.dm | 128 +++ code/modules/recycling/disposal/outlet.dm | 88 ++ code/modules/recycling/disposal/pipe.dm | 345 ++++++++ .../recycling/disposal/pipe_sorting.dm | 102 +++ icons/obj/atmospherics/pipes/disposal.dmi | Bin 97981 -> 119069 bytes tgstation.dme | 10 +- 16 files changed, 1196 insertions(+), 1196 deletions(-) delete mode 100644 code/modules/recycling/disposal-construction.dm delete mode 100644 code/modules/recycling/disposal-structures.dm rename code/modules/recycling/{disposal-unit.dm => disposal/bin.dm} (92%) create mode 100644 code/modules/recycling/disposal/construction.dm create mode 100644 code/modules/recycling/disposal/eject.dm create mode 100644 code/modules/recycling/disposal/holder.dm create mode 100644 code/modules/recycling/disposal/outlet.dm create mode 100644 code/modules/recycling/disposal/pipe.dm create mode 100644 code/modules/recycling/disposal/pipe_sorting.dm diff --git a/code/__DEFINES/pipe_construction.dm b/code/__DEFINES/pipe_construction.dm index a671b548ba..641187e964 100644 --- a/code/__DEFINES/pipe_construction.dm +++ b/code/__DEFINES/pipe_construction.dm @@ -1,23 +1,17 @@ //Construction Categories -#define PIPE_BINARY 0 //2 directions: N/S, E/W +#define PIPE_STRAIGHT 0 //2 directions: N/S, E/W #define PIPE_BENDABLE 1 //6 directions: N/S, E/W, N/E, N/W, S/E, S/W #define PIPE_TRINARY 2 //4 directions: N/E/S, E/S/W, S/W/N, W/N/E #define PIPE_TRIN_M 3 //8 directions: N->S+E, S->N+E, N->S+W, S->N+W, E->W+S, W->E+S, E->W+N, W->E+N #define PIPE_UNARY 4 //4 directions: N, S, E, W -#define PIPE_QUAD 5 //1 directions: N/S/E/W +#define PIPE_ONEDIR 5 //1 direction: N/S/E/W -//Disposal piping numbers - do NOT hardcode these, use the defines -#define DISP_PIPE_STRAIGHT 0 -#define DISP_PIPE_BENT 1 -#define DISP_JUNCTION 2 -#define DISP_JUNCTION_FLIP 3 -#define DISP_YJUNCTION 4 -#define DISP_END_TRUNK 5 -#define DISP_END_BIN 6 -#define DISP_END_OUTLET 7 -#define DISP_END_CHUTE 8 -#define DISP_SORTJUNCTION 9 -#define DISP_SORTJUNCTION_FLIP 10 +//Disposal pipe relative connection directions +#define DISP_DIR_BASE 0 +#define DISP_DIR_LEFT 1 +#define DISP_DIR_RIGHT 2 +#define DISP_DIR_FLIP 4 +#define DISP_DIR_NONE 8 //Transit tubes #define TRANSIT_TUBE_STRAIGHT 0 diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 28c4b8c0aa..80181b656b 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -25,7 +25,7 @@ Buildable meters /obj/item/pipe/directional RPD_type = PIPE_UNARY /obj/item/pipe/binary - RPD_type = PIPE_BINARY + RPD_type = PIPE_STRAIGHT /obj/item/pipe/binary/bendable RPD_type = PIPE_BENDABLE /obj/item/pipe/trinary @@ -34,7 +34,7 @@ Buildable meters RPD_type = PIPE_TRIN_M var/flipped = FALSE /obj/item/pipe/quaternary - RPD_type = PIPE_QUAD + RPD_type = PIPE_ONEDIR /obj/item/pipe/examine(mob/user) ..() diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index fda66624b7..88246655d1 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -14,6 +14,7 @@ /obj/machinery/pipedispenser/attack_hand(mob/user) if(..()) return 1 +<<<<<<< HEAD var/dat = {" PIPING LAYER: --[piping_layer]++
Pipes:
@@ -42,7 +43,21 @@ PIPING LAYER: --[piping_layer]< Junction
Heat Exchanger
"} +======= + var/dat = "PIPING LAYER: --[piping_layer]++
" + var/recipes = GLOB.atmos_pipe_recipes + + for(var/category in recipes) + var/list/cat_recipes = recipes[category] + dat += "[category]:
    " +>>>>>>> 8b5cd7f... Disposal pipes and pipe dispensers refactor (#32435) + + for(var/i in cat_recipes) + var/datum/pipe_info/I = i + dat += I.Render(src) + + dat += "
" user << browse("[src][dat]", "window=pipedispenser") onclose(user, "pipedispenser") @@ -56,9 +71,9 @@ PIPING LAYER: --[piping_layer]< return 1 usr.set_machine(src) add_fingerprint(usr) - if(href_list["make"]) + if(href_list["makepipe"]) if(wait < world.time) - var/p_type = text2path(href_list["make"]) + var/p_type = text2path(href_list["makepipe"]) var/p_dir = text2num(href_list["dir"]) var/obj/item/pipe/P = new (loc, p_type, p_dir) P.setPipingLayer(piping_layer) @@ -118,14 +133,6 @@ PIPING LAYER: --[piping_layer]< density = TRUE anchored = TRUE -/* -//Allow you to push disposal pipes into it (for those with density 1) -/obj/machinery/pipedispenser/disposal/Crossed(var/obj/structure/disposalconstruct/pipe as obj) - if(istype(pipe) && !pipe.anchored) - qdel(pipe) - -Nah -*/ //Allow you to drag-drop disposal pipes and transit tubes into it /obj/machinery/pipedispenser/disposal/MouseDrop_T(obj/structure/pipe, mob/usr) @@ -147,6 +154,7 @@ Nah if(..()) return 1 +<<<<<<< HEAD var/dat = {"Disposal Pipes

Pipe
Bent Pipe
@@ -158,6 +166,20 @@ Nah Chute
Sort Junction
"} +======= + var/dat = "" + var/recipes = GLOB.disposal_pipe_recipes + + for(var/category in recipes) + var/list/cat_recipes = recipes[category] + dat += "[category]:
    " + + for(var/i in cat_recipes) + var/datum/pipe_info/I = i + dat += I.Render(src) + + dat += "
" +>>>>>>> 8b5cd7f... Disposal pipes and pipe dispensers refactor (#32435) user << browse("[src][dat]", "window=pipedispenser") return @@ -170,8 +192,8 @@ Nah add_fingerprint(usr) if(href_list["dmake"]) if(wait < world.time) - var/p_type = text2num(href_list["dmake"]) - var/obj/structure/disposalconstruct/C = new (loc,p_type) + var/p_type = text2path(href_list["dmake"]) + var/obj/structure/disposalconstruct/C = new (loc, p_type) if(!C.can_place()) to_chat(usr, "There's not enough room to build that here!") diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index 962c88aa3d..90558e86d8 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -1,5 +1,3 @@ - - /* CONTAINS: RPD @@ -14,37 +12,98 @@ RPD #define CATEGORY_ATMOS 0 #define CATEGORY_DISPOSALS 1 + +//find the defines in code\_DEFINES\pipe_construction.dm +GLOBAL_LIST_INIT(atmos_pipe_recipes, list( + "Pipes" = list( + new /datum/pipe_info/pipe("Pipe", /obj/machinery/atmospherics/pipe/simple), + new /datum/pipe_info/pipe("Manifold", /obj/machinery/atmospherics/pipe/manifold), + new /datum/pipe_info/pipe("Manual Valve", /obj/machinery/atmospherics/components/binary/valve), + new /datum/pipe_info/pipe("Digital Valve", /obj/machinery/atmospherics/components/binary/valve/digital), + new /datum/pipe_info/pipe("4-Way Manifold", /obj/machinery/atmospherics/pipe/manifold4w), + new /datum/pipe_info/pipe("Layer Manifold", /obj/machinery/atmospherics/pipe/layer_manifold), + ), + "Devices" = list( + new /datum/pipe_info/pipe("Connector", /obj/machinery/atmospherics/components/unary/portables_connector), + new /datum/pipe_info/pipe("Unary Vent", /obj/machinery/atmospherics/components/unary/vent_pump), + new /datum/pipe_info/pipe("Gas Pump", /obj/machinery/atmospherics/components/binary/pump), + new /datum/pipe_info/pipe("Passive Gate", /obj/machinery/atmospherics/components/binary/passive_gate), + new /datum/pipe_info/pipe("Volume Pump", /obj/machinery/atmospherics/components/binary/volume_pump), + new /datum/pipe_info/pipe("Scrubber", /obj/machinery/atmospherics/components/unary/vent_scrubber), + new /datum/pipe_info/pipe("Injector", /obj/machinery/atmospherics/components/unary/outlet_injector), + new /datum/pipe_info/meter("Meter"), + new /datum/pipe_info/pipe("Gas Filter", /obj/machinery/atmospherics/components/trinary/filter), + new /datum/pipe_info/pipe("Gas Mixer", /obj/machinery/atmospherics/components/trinary/mixer), + ), + "Heat Exchange" = list( + new /datum/pipe_info/pipe("Pipe", /obj/machinery/atmospherics/pipe/heat_exchanging/simple), + new /datum/pipe_info/pipe("Manifold", /obj/machinery/atmospherics/pipe/heat_exchanging/manifold), + new /datum/pipe_info/pipe("4-Way Manifold", /obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w), + new /datum/pipe_info/pipe("Junction", /obj/machinery/atmospherics/pipe/heat_exchanging/junction), + new /datum/pipe_info/pipe("Heat Exchanger", /obj/machinery/atmospherics/components/unary/heat_exchanger), + ) +)) + +GLOBAL_LIST_INIT(disposal_pipe_recipes, list( + "Disposal Pipes" = list( + new /datum/pipe_info/disposal("Pipe", /obj/structure/disposalpipe/segment, PIPE_BENDABLE), + new /datum/pipe_info/disposal("Junction", /obj/structure/disposalpipe/junction, PIPE_TRIN_M), + new /datum/pipe_info/disposal("Y-Junction", /obj/structure/disposalpipe/junction/yjunction), + new /datum/pipe_info/disposal("Sort Junction", /obj/structure/disposalpipe/sorting/mail, PIPE_TRIN_M), + new /datum/pipe_info/disposal("Trunk", /obj/structure/disposalpipe/trunk), + new /datum/pipe_info/disposal("Bin", /obj/machinery/disposal/bin, PIPE_ONEDIR), + new /datum/pipe_info/disposal("Outlet", /obj/structure/disposaloutlet), + new /datum/pipe_info/disposal("Chute", /obj/machinery/disposal/deliveryChute), + ) +)) + + /datum/pipe_info - var/id=-1 - var/categoryId - var/dir=SOUTH - var/dirtype = PIPE_BENDABLE + var/name var/icon var/icon_state - var/selected=0 + var/id = -1 + var/categoryId + var/dirtype = PIPE_BENDABLE + +/datum/pipe_info/proc/Render(dispenser) + return "
  • [name]
  • " + +/datum/pipe_info/proc/Params() + return "" + /datum/pipe_info/pipe categoryId = CATEGORY_ATMOS icon = 'icons/obj/atmospherics/pipes/pipe_item.dmi' -/datum/pipe_info/pipe/New(obj/machinery/atmospherics/path) +/datum/pipe_info/pipe/New(label, obj/machinery/atmospherics/path) + name = label id = path icon_state = initial(path.pipe_state) dirtype = initial(path.construction_type) -/datum/pipe_info/proc/Render(dispenser,label) +/datum/pipe_info/pipe/Params() + return "makepipe=[id]&type=[dirtype]" +<<<<<<< HEAD /datum/pipe_info/pipe/Render(dispenser,label,dir=NORTH) return "
  • [label]
  • " +======= +>>>>>>> 8b5cd7f... Disposal pipes and pipe dispensers refactor (#32435) /datum/pipe_info/meter categoryId = CATEGORY_ATMOS icon = 'icons/obj/atmospherics/pipes/simple.dmi' icon_state = "meterX" -/datum/pipe_info/meter/New() - return +/datum/pipe_info/meter/New(label) + name = label +/datum/pipe_info/meter/Params() + return "makemeter=1&type=[dirtype]" + +<<<<<<< HEAD /datum/pipe_info/meter/Render(dispenser,label) return "
  • [label]
  • " //hardcoding is no @@ -60,63 +119,32 @@ GLOBAL_LIST_INIT(disposalpipeID2State, list( "intake", "pipe-j1s", "pipe-j2s")) +======= +>>>>>>> 8b5cd7f... Disposal pipes and pipe dispensers refactor (#32435) /datum/pipe_info/disposal categoryId = CATEGORY_DISPOSALS icon = 'icons/obj/atmospherics/pipes/disposal.dmi' -/datum/pipe_info/disposal/New(var/pid,var/dt) - id=pid - icon_state=GLOB.disposalpipeID2State[pid+1] - dir = SOUTH - dirtype=dt - if(pidDISP_END_CHUTE) +/datum/pipe_info/disposal/New(label, obj/path, dt=PIPE_UNARY) + name = label + id = path + + icon_state = initial(path.icon_state) + if(ispath(path, /obj/structure/disposalpipe)) icon_state = "con[icon_state]" +<<<<<<< HEAD /datum/pipe_info/disposal/Render(dispenser,label) return "
  • [label]
  • " //avoid hardcoding. +======= + dirtype = dt + +/datum/pipe_info/disposal/Params() + return "dmake=[id]&type=[dirtype]" + +>>>>>>> 8b5cd7f... Disposal pipes and pipe dispensers refactor (#32435) -//find these defines in code\game\machinery\pipe\consruction.dm -GLOBAL_LIST_INIT(RPD_recipes, list( - "Pipes" = list( - "Pipe" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/simple), - "Manifold" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/manifold), - "Manual Valve" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/binary/valve), - "Digital Valve" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/binary/valve/digital), - "4-Way Manifold" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/manifold4w), - "Layer Manifold" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/layer_manifold), - ), - "Devices" = list( - "Connector" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/unary/portables_connector), - "Unary Vent" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/unary/vent_pump), - "Gas Pump" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/binary/pump), - "Passive Gate" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/binary/passive_gate), - "Volume Pump" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/binary/volume_pump), - "Scrubber" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/unary/vent_scrubber), - "Injector" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/unary/outlet_injector), - "Meter" = new /datum/pipe_info/meter(), - "Gas Filter" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/trinary/filter), - "Gas Mixer" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/trinary/mixer), - ), - "Heat Exchange" = list( - "Pipe" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/heat_exchanging/simple), - "Manifold" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/heat_exchanging/manifold), - "4-Way Manifold" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w), - "Junction" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/pipe/heat_exchanging/junction), - "Heat Exchanger" = new /datum/pipe_info/pipe(/obj/machinery/atmospherics/components/unary/heat_exchanger), - ), - "Disposal Pipes" = list( - "Pipe" = new /datum/pipe_info/disposal(DISP_PIPE_STRAIGHT, PIPE_BINARY), - "Bent Pipe" = new /datum/pipe_info/disposal(DISP_PIPE_BENT, PIPE_TRINARY), - "Junction" = new /datum/pipe_info/disposal(DISP_JUNCTION, PIPE_TRINARY), - "Y-Junction" = new /datum/pipe_info/disposal(DISP_YJUNCTION, PIPE_TRINARY), - "Trunk" = new /datum/pipe_info/disposal(DISP_END_TRUNK, PIPE_TRINARY), - "Bin" = new /datum/pipe_info/disposal(DISP_END_BIN, PIPE_QUAD), - "Outlet" = new /datum/pipe_info/disposal(DISP_END_OUTLET, PIPE_UNARY), - "Chute" = new /datum/pipe_info/disposal(DISP_END_CHUTE, PIPE_UNARY), - "Sort Junction" = new /datum/pipe_info/disposal(DISP_SORTJUNCTION, PIPE_TRINARY), - ) -)) /obj/item/pipe_dispenser name = "Rapid Piping Device (RPD)" @@ -138,7 +166,7 @@ GLOBAL_LIST_INIT(RPD_recipes, list( var/p_type = /obj/machinery/atmospherics/pipe/simple var/p_conntype = PIPE_BENDABLE var/p_dir = 1 - var/p_flipped = 0 + var/p_flipped = FALSE var/p_class = ATMOS_MODE var/list/paint_colors = list( "grey" = rgb(255,255,255), @@ -179,6 +207,7 @@ GLOBAL_LIST_INIT(RPD_recipes, list( selected=" class=\"imglink selected\"" return "" + /obj/item/pipe_dispenser/proc/show_menu(mob/user) if(!user || !src) return 0 @@ -197,6 +226,7 @@ GLOBAL_LIST_INIT(RPD_recipes, list( dat += "Category:
      " if(screen == CATEGORY_ATMOS) +<<<<<<< HEAD dat += "Atmospherics Disposals
      " else if(screen == CATEGORY_DISPOSALS) dat += "Atmospherics Disposals
      " @@ -208,27 +238,50 @@ GLOBAL_LIST_INIT(RPD_recipes, list( else generated_layer_list += "[iter]" dat += "Atmospherics Piping Layer: [generated_layer_list]
      " +======= + var/list/recipes = GLOB.disposal_pipe_recipes + var/datum/pipe_info/first_recipe = recipes[recipes[1]][1] + dat += "Atmospherics " + dat += "Disposals
      " + dat += "Atmospherics Piping Layer: " + + var/layers_total = PIPING_LAYER_MAX - PIPING_LAYER_MIN + 1 + for(var/iter = PIPING_LAYER_MIN, iter <= layers_total, iter++) + if(iter == piping_layer) + dat += "[iter]" + else + dat += "[iter]" + dat += "
      " + + else if(screen == CATEGORY_DISPOSALS) + var/list/recipes = GLOB.atmos_pipe_recipes + var/datum/pipe_info/first_recipe = recipes[recipes[1]][1] + dat += "Atmospherics " + dat += "Disposals
      " + +>>>>>>> 8b5cd7f... Disposal pipes and pipe dispensers refactor (#32435) dat += "
    " var/icon/preview=null var/datbuild = "" - for(var/category in GLOB.RPD_recipes) - var/list/cat = GLOB.RPD_recipes[category] - for(var/label in cat) - var/datum/pipe_info/I = cat[label] + var/recipes = GLOB.atmos_pipe_recipes + GLOB.disposal_pipe_recipes + for(var/category in recipes) + var/list/cat_recipes = recipes[category] + for(var/i in cat_recipes) + var/datum/pipe_info/I = i var/found=0 if(I.id == p_type) - if((p_class == ATMOS_MODE || p_class == METER_MODE) && (istype(I, /datum/pipe_info/pipe) || istype(I, /datum/pipe_info/meter))) - found=1 - else if(p_class == DISPOSALS_MODE && istype(I, /datum/pipe_info/disposal)) - found=1 + if((p_class == ATMOS_MODE || p_class == METER_MODE) && I.categoryId == CATEGORY_ATMOS) + found = 1 + else if(p_class == DISPOSALS_MODE && I.categoryId == CATEGORY_DISPOSALS) + found = 1 if(found) - preview=new /icon(I.icon,I.icon_state) + preview = new /icon(I.icon, I.icon_state) if(screen == I.categoryId) if(I.id == p_type && p_class >= 0) - datbuild += "[label]" + datbuild += "
  • [I.name]
  • " else - datbuild += I.Render(src,label) + datbuild += I.Render(src) if(length(datbuild) > 0) dat += "[category]: