Refactors area stuff (#52751)

-bitfielded a bunch of bools on /area, I left some untouched cus they get called a lot
-Unused vars
-Fixed a var pretending to be a fake bool
-Probably more
This commit is contained in:
TiviPlus
2020-08-10 16:31:59 -03:00
committed by GitHub
parent 896a236255
commit b4fe4f717b
42 changed files with 183 additions and 217 deletions
+3 -3
View File
@@ -93,7 +93,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
/mob/camera/blob/proc/is_valid_turf(turf/T)
var/area/A = get_area(T)
if((A && !A.blob_allowed) || !T || !is_station_level(T.z) || isspaceturf(T))
if((A && !(A.area_flags & BLOBS_ALLOWED)) || !T || !is_station_level(T.z) || isspaceturf(T))
return FALSE
return TRUE
@@ -140,7 +140,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
var/area/Ablob = get_area(T)
if(!Ablob.blob_allowed)
if(!(Ablob.area_flags & BLOBS_ALLOWED))
continue
if(!(ROLE_BLOB in L.faction))
@@ -153,7 +153,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
for(var/area/A in GLOB.sortedAreas)
if(!(A.type in GLOB.the_station_areas))
continue
if(!A.blob_allowed)
if(!(A.area_flags & BLOBS_ALLOWED))
continue
A.color = blobstrain.color
A.name = "blob"
+3 -3
View File
@@ -29,7 +29,7 @@
to_chat(src, "<span class='warning'>This spot is too dense to place a blob core on!</span>")
return 0
var/area/A = get_area(T)
if(isspaceturf(T) || A && !A.blob_allowed)
if(isspaceturf(T) || A && !(A.area_flags & BLOBS_ALLOWED))
to_chat(src, "<span class='warning'>You cannot place your core here!</span>")
return 0
for(var/obj/O in T)
@@ -93,7 +93,7 @@
return
if(needsNode)
var/area/A = get_area(src)
if(!A.blob_allowed) //factory and resource blobs must be legit
if(!(A.area_flags & BLOBS_ALLOWED)) //factory and resource blobs must be legit
to_chat(src, "<span class='warning'>This type of blob must be placed on the station!</span>")
return
if(nodes_required && !(locate(/obj/structure/blob/node) in orange(3, T)) && !(locate(/obj/structure/blob/core) in orange(4, T)))
@@ -219,7 +219,7 @@
to_chat(src, "<span class='userdanger'>You have no core and are about to die! May you rest in peace.</span>")
return
var/area/A = get_area(T)
if(isspaceturf(T) || A && !A.blob_allowed)
if(isspaceturf(T) || A && !(A.area_flags & BLOBS_ALLOWED))
to_chat(src, "<span class='warning'>You cannot relocate your core here!</span>")
return
if(!can_buy(80))
@@ -25,7 +25,7 @@
if(owner_overmind)
overmind = owner_overmind
var/area/Ablob = get_area(src)
if(Ablob.blob_allowed) //Is this area allowed for winning as blob?
if(Ablob.area_flags & BLOBS_ALLOWED) //Is this area allowed for winning as blob?
overmind.blobs_legit += src
GLOB.blobs += src //Keep track of the blob in the normal list either way
setDir(pick(GLOB.cardinals))
+3 -3
View File
@@ -361,9 +361,9 @@
..()
var/sanity = 0
while(summon_spots.len < SUMMON_POSSIBILITIES && sanity < 100)
var/area/summon = pick(GLOB.sortedAreas - summon_spots)
if(summon && is_station_level(summon.z) && summon.valid_territory)
summon_spots += summon
var/area/summon_area = pick(GLOB.sortedAreas - summon_spots)
if(summon_area && is_station_level(summon_area.z) && (summon_area.area_flags & VALID_TERRITORY))
summon_spots += summon_area
sanity++
update_explanation_text()
+2 -2
View File
@@ -74,7 +74,7 @@ This file contains the cult dagger and rune list code
A = get_area(src)
if(!src || QDELETED(src) || !Adjacent(user) || user.incapacitated() || !check_rune_turf(Turf, user))
return
if(ispath(rune_to_scribe, /obj/effect/rune/summon) && (!is_station_level(Turf.z) || A.map_name == "Space"))
if(ispath(rune_to_scribe, /obj/effect/rune/summon) && (!is_station_level(Turf.z) || initial(A.name) == "Space"))
to_chat(user, "<span class='cultitalic'><b>The veil is not weak enough here to summon a cultist, you must be on station!</b></span>")
return
if(ispath(rune_to_scribe, /obj/effect/rune/apocalypse))
@@ -113,7 +113,7 @@ This file contains the cult dagger and rune list code
if(!(A in summon_objective.summon_spots)) // Check again to make sure they didn't move
to_chat(user, "<span class='cultlarge'>The Geometer can only be summoned where the veil is weak - in [english_list(summon_objective.summon_spots)]!</span>")
return
priority_announce("Figments from an eldritch god are being summoned by [user] into [A.map_name] from an unknown dimension. Disrupt the ritual at all costs!","Central Command Higher Dimensional Affairs", 'sound/ai/spanomalies.ogg')
priority_announce("Figments from an eldritch god are being summoned by [user] into [initial(A.name)] from an unknown dimension. Disrupt the ritual at all costs!","Central Command Higher Dimensional Affairs", 'sound/ai/spanomalies.ogg')
for(var/B in spiral_range_turfs(1, user, 1))
var/obj/structure/emergency_shield/cult/narsie/N = new(B)
shields += N
+1 -1
View File
@@ -417,7 +417,7 @@ structure_check() searches for nearby cultist structures required for the invoca
actual_selected_rune.handle_portal("lava")
else
var/area/A = get_area(T)
if(A.map_name == "Space")
if(initial(A.name) == "Space")
actual_selected_rune.handle_portal("space", T)
if(movesuccess)
target.visible_message("<span class='warning'>There is a boom of outrushing air as something appears above the rune!</span>", null, "<i>You hear a boom.</i>")
@@ -426,12 +426,12 @@
. = TRUE
if("alarm")
var/area/A = get_area(src)
if(A.atmosalert(2, src))
if(A.atmosalert(TRUE, src))
post_alert(2)
. = TRUE
if("reset")
var/area/A = get_area(src)
if(A.atmosalert(0, src))
if(A.atmosalert(FALSE, src))
post_alert(0)
. = TRUE
update_icon()
@@ -705,7 +705,7 @@
var/new_area_danger_level = 0
for(var/obj/machinery/airalarm/AA in A)
if (!(AA.machine_stat & (NOPOWER|BROKEN)) && !AA.shorted)
new_area_danger_level = max(new_area_danger_level,AA.danger_level)
new_area_danger_level = clamp(max(new_area_danger_level, AA.danger_level), 0,1)
if(A.atmosalert(new_area_danger_level,src)) //if area was in normal state or if area was in alert state
post_alert(new_area_danger_level)
+1 -1
View File
@@ -242,7 +242,7 @@
/mob/living/proc/canSuicide()
var/area/A = get_area(src)
if(A.block_suicide)
if(A.area_flags & BLOCK_SUICIDE)
to_chat(src, "<span class='warning'>You can't commit suicide here! You can ghost if you'd like.</span>")
return
switch(stat)
-2
View File
@@ -18,8 +18,6 @@
var/list/head_announce = null
//Bitflags for the job
var/flag = NONE //Deprecated
var/department_flag = NONE //Deprecated
var/auto_deadmin_role_flags = NONE
//Players will be allowed to spawn in as jobs that are set to "Station"
+1 -1
View File
@@ -33,7 +33,7 @@
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
flags_1 = NONE
block_suicide = TRUE
area_flags = BLOCK_SUICIDE | UNIQUE_AREA
/datum/map_template/mafia
var/description = ""
@@ -5,7 +5,7 @@
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
valid_territory = FALSE
area_flags = BLOBS_ALLOWED | UNIQUE_AREA
flags_1 = CAN_BE_DIRTY_1
//Survival Capsule
@@ -324,7 +324,7 @@
/obj/item/warp_cube/attack_self(mob/user)
var/turf/current_location = get_turf(user)
var/area/current_area = current_location.loc
if(!linked || current_area.noteleport)
if(!linked || (current_area.area_flags & NOTELEPORT))
to_chat(user, "<span class='warning'>[src] fizzles uselessly.</span>")
return
if(teleporting)
+1 -1
View File
@@ -409,7 +409,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/list/filtered = list()
for(var/V in GLOB.sortedAreas)
var/area/A = V
if(!A.hidden)
if(!(A.area_flags & HIDDEN_AREA))
filtered += A
var/area/thearea = input("Area to jump to", "BOOYEA") as null|anything in filtered
@@ -92,12 +92,8 @@
name = "ai_multicam_room"
icon_state = "ai_camera_room"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
valid_territory = FALSE
ambientsounds = list()
blob_allowed = FALSE
noteleport = TRUE
hidden = TRUE
safe = TRUE
area_flags = NOTELEPORT | HIDDEN_AREA | UNIQUE_AREA
ambientsounds = null
flags_1 = NONE
GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room)
@@ -383,7 +383,7 @@
if(S.using_special)
return
var/area/A = get_area(S)
if(!A.valid_territory)
if(!(A.area_flags & VALID_TERRITORY))
to_chat(S, "<span class='warning'>You can't summon a rift here! Try summoning somewhere secure within the station!</span>")
return
for(var/obj/structure/carp_rift/rift in S.rift_list)
@@ -492,10 +492,10 @@
notify_ghosts("The carp rift can summon an additional carp!", source = src, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Carp Spawn Available")
if(time_charged == (max_charge - 120))
var/area/A = get_area(src)
priority_announce("A rift is causing an unnaturally large energy flux in [A.map_name]. Stop it at all costs!", "Central Command Spatial Corps", 'sound/ai/spanomalies.ogg')
priority_announce("A rift is causing an unnaturally large energy flux in [initial(A.name)]. Stop it at all costs!", "Central Command Spatial Corps", 'sound/ai/spanomalies.ogg')
if(time_charged == max_charge)
var/area/A = get_area(src)
priority_announce("Spatial object has reached peak energy charge in [A.map_name], please stand-by.", "Central Command Spatial Corps")
priority_announce("Spatial object has reached peak energy charge in [initial(A.name)], please stand-by.", "Central Command Spatial Corps")
obj_integrity = INFINITY
desc = "A rift akin to the ones space carp use to travel long distances. This one is fully charged, and is capable of bringing many carp to the station's location."
icon_state = "carp_rift_charged"
@@ -12,7 +12,7 @@
/mob/camera/ai_eye/remote/xenobio/setLoc(t)
var/area/new_area = get_area(t)
if(new_area && new_area.name == allowed_area || new_area && new_area.xenobiology_compatible)
if(new_area && new_area.name == allowed_area || new_area && (new_area.area_flags & XENOBIOLOGY_COMPATIBLE))
return ..()
else
return
@@ -397,7 +397,7 @@
var/mob/living/C = user
var/mob/camera/ai_eye/remote/xenobio/E = C.remote_control
var/area/mobarea = get_area(S.loc)
if(mobarea.name == E.allowed_area || mobarea.xenobiology_compatible)
if(mobarea.name == E.allowed_area || (mobarea & XENOBIOLOGY_COMPATIBLE))
slime_scan(S, C)
//Feeds a potion to slime
@@ -412,7 +412,7 @@
if(QDELETED(X.current_potion))
to_chat(C, "<span class='warning'>No potion loaded.</span>")
return
if(mobarea.name == E.allowed_area || mobarea.xenobiology_compatible)
if(mobarea.name == E.allowed_area ||(mobarea & XENOBIOLOGY_COMPATIBLE))
X.current_potion.attack(S, C)
//Picks up slime
@@ -424,7 +424,7 @@
var/mob/camera/ai_eye/remote/xenobio/E = C.remote_control
var/obj/machinery/computer/camera_advanced/xenobio/X = E.origin
var/area/mobarea = get_area(S.loc)
if(mobarea.name == E.allowed_area || mobarea.xenobiology_compatible)
if(mobarea.name == E.allowed_area || (mobarea & XENOBIOLOGY_COMPATIBLE))
if(X.stored_slimes.len >= X.max_slimes)
to_chat(C, "<span class='warning'>Slime storage is full.</span>")
return
@@ -446,7 +446,7 @@
var/mob/camera/ai_eye/remote/xenobio/E = C.remote_control
var/obj/machinery/computer/camera_advanced/xenobio/X = E.origin
var/area/turfarea = get_area(T)
if(turfarea.name == E.allowed_area || turfarea.xenobiology_compatible)
if(turfarea.name == E.allowed_area || (turfarea & XENOBIOLOGY_COMPATIBLE))
for(var/mob/living/simple_animal/slime/S in X.stored_slimes)
S.forceMove(T)
S.visible_message("<span class='notice'>[S] warps in!</span>")
@@ -461,7 +461,7 @@
var/mob/camera/ai_eye/remote/xenobio/E = C.remote_control
var/obj/machinery/computer/camera_advanced/xenobio/X = E.origin
var/area/turfarea = get_area(T)
if(turfarea.name == E.allowed_area || turfarea.xenobiology_compatible)
if(turfarea.name == E.allowed_area || (turfarea & XENOBIOLOGY_COMPATIBLE))
if(X.monkeys >= 1)
var/mob/living/carbon/monkey/food = new /mob/living/carbon/monkey(T, TRUE, C)
if (!QDELETED(food))
@@ -484,7 +484,7 @@
if(!X.connected_recycler)
to_chat(C, "<span class='warning'>There is no connected monkey recycler. Use a multitool to link one.</span>")
return
if(mobarea.name == E.allowed_area || mobarea.xenobiology_compatible)
if(mobarea.name == E.allowed_area || (mobarea & XENOBIOLOGY_COMPATIBLE))
if(!M.stat)
return
M.visible_message("<span class='notice'>[M] vanishes as [p_theyre()] reclaimed for recycling!</span>")
@@ -1072,5 +1072,5 @@
for(var/turf/T in A)
T.remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
T.add_atom_colour("#2956B2", FIXED_COLOUR_PRIORITY)
A.xenobiology_compatible = TRUE
A.area_flags |= XENOBIOLOGY_COMPATIBLE
qdel(src)
@@ -123,7 +123,7 @@ GLOBAL_VAR_INIT(fscpassword, generate_password())
name = "Syndicate Forgotten Vault"
icon_state = "syndie-ship"
ambientsounds = list('sound/ambience/ambitech2.ogg', 'sound/ambience/ambitech3.ogg')
noteleport = TRUE
area_flags = NOTELEPORT | UNIQUE_AREA
//Cybersun hardsuit
@@ -1,6 +1,7 @@
GLOBAL_VAR_INIT(hhStorageTurf, null)
GLOBAL_VAR_INIT(hhmysteryRoomNumber, 1337)
// Someone for the love of god kill whoever indented this with spaces
/obj/item/hilbertshotel
name = "Hilbert's Hotel"
desc = "A sphere of what appears to be an intricate network of bluespace. Observing it in detail seems to give you a headache as you try to comprehend the infinite amount of infinitesimally distinct points on its surface."
@@ -305,19 +306,17 @@ GLOBAL_VAR_INIT(hhmysteryRoomNumber, 1337)
qdel(src)
/area/hilbertshotel
name = "Hilbert's Hotel Room"
icon_state = "hilbertshotel"
requires_power = FALSE
has_gravity = TRUE
noteleport = TRUE
hidden = TRUE
unique = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
ambientsounds = list('sound/ambience/servicebell.ogg')
var/roomnumber = 0
var/obj/item/hilbertshotel/parentSphere
var/datum/turf_reservation/reservation
var/turf/storageTurf
name = "Hilbert's Hotel Room"
icon_state = "hilbertshotel"
requires_power = FALSE
has_gravity = TRUE
area_flags = NOTELEPORT | HIDDEN_AREA
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
ambientsounds = list('sound/ambience/servicebell.ogg')
var/roomnumber = 0
var/obj/item/hilbertshotel/parentSphere
var/datum/turf_reservation/reservation
var/turf/storageTurf
/area/hilbertshotel/Entered(atom/movable/AM)
. = ..()
@@ -386,9 +385,8 @@ GLOBAL_VAR_INIT(hhmysteryRoomNumber, 1337)
name = "Hilbert's Hotel Storage Room"
icon_state = "hilbertshotel"
requires_power = FALSE
area_flags = HIDDEN_AREA | NOTELEPORT | UNIQUE_AREA
has_gravity = TRUE
noteleport = TRUE
hidden = TRUE
/obj/item/abstracthotelstorage
anchored = TRUE