Skip to content

Commit

Permalink
Merge branch 'fancy-lighting' of https://github.com/cmss13-devs/cmss13
Browse files Browse the repository at this point in the history
…into fancy-lighting
  • Loading branch information
morrowwolf committed Aug 26, 2023
2 parents de17e54 + 3161fb8 commit e69a266
Show file tree
Hide file tree
Showing 25 changed files with 193 additions and 229 deletions.
9 changes: 2 additions & 7 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1251,13 +1251,8 @@ var/global/image/action_purple_power_up
var/area/A = GLOB.areas_by_type[areatype]

// Fix it up with /area/var/related due to lighting shenanigans
var/list/area/LA
if(!length(A.related))
LA = list(A)
else LA = A.related
for(var/area/Ai in LA)
for(var/turf/T in Ai)
turfs += T
for(var/turf/T in A)
turfs += T

return turfs

Expand Down
6 changes: 2 additions & 4 deletions code/controllers/subsystem/weather.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ SUBSYSTEM_DEF(weather)
curr_master_turf_overlay.icon_state = weather_event_instance.turf_overlay_icon_state
curr_master_turf_overlay.alpha = weather_event_instance.turf_overlay_alpha
for(var/area/area as anything in weather_areas)
for(var/area/subarea as anything in area.related)
subarea.overlays += curr_master_turf_overlay
area.overlays += curr_master_turf_overlay

update_mobs_weather()
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_WEATHER_CHANGE)
Expand All @@ -169,8 +168,7 @@ SUBSYSTEM_DEF(weather)
message_admins(SPAN_BLUE("Weather Event of unknown type [weather_event_type] ending after [DisplayTimeText(world.time - current_event_start_time)]."))

for(var/area/area as anything in weather_areas)
for(var/area/subarea as anything in area.related)
subarea.overlays -= curr_master_turf_overlay
area.overlays -= curr_master_turf_overlay

if (map_holder.no_weather_turf_icon_state)
curr_master_turf_overlay.icon_state = map_holder.no_weather_turf_icon_state
Expand Down
97 changes: 41 additions & 56 deletions code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
var/unique = TRUE

var/has_gravity = 1
var/list/related // the other areas of the same type as this
// var/list/lights // list of all lights on this area
var/list/all_doors = list() //Added by Strumpetplaya - Alarm Change - Contains a list of doors adjacent to this area
var/air_doors_activated = 0
Expand Down Expand Up @@ -88,7 +87,6 @@
GLOB.areas_by_type[type] = src
..()

related = list(src)
initialize_power()

/area/Initialize(mapload, ...)
Expand Down Expand Up @@ -134,13 +132,12 @@
poweralm = state
if(istype(source)) //Only report power alarms on the z-level where the source is located.
var/list/cameras = list()
for (var/area/RA in related)
for (var/obj/structure/machinery/camera/C in RA)
cameras += C
if(state == 1)
C.network.Remove(CAMERA_NET_POWER_ALARMS)
else
C.network.Add(CAMERA_NET_POWER_ALARMS)
for (var/obj/structure/machinery/camera/C in src)
cameras += C
if(state == 1)
C.network.Remove(CAMERA_NET_POWER_ALARMS)
else
C.network.Add(CAMERA_NET_POWER_ALARMS)
for (var/mob/living/silicon/aiPlayer in ai_mob_list)
if(aiPlayer.z == source.z)
if (state == 1)
Expand All @@ -160,42 +157,38 @@
// return 0 //redudant

//Check all the alarms before lowering atmosalm. Raising is perfectly fine.
for (var/area/RA in related)
for (var/obj/structure/machinery/alarm/AA in RA)
if ( !(AA.inoperable()) && !AA.shorted)
danger_level = max(danger_level, AA.danger_level)
for (var/obj/structure/machinery/alarm/AA in src)
if ( !(AA.inoperable()) && !AA.shorted)
danger_level = max(danger_level, AA.danger_level)

if(danger_level != atmosalm)
if (danger_level < 1 && atmosalm >= 1)
//closing the doors on red and opening on green provides a bit of hysteresis that will hopefully prevent fire doors from opening and closing repeatedly due to noise
air_doors_open()

if (danger_level < 2 && atmosalm >= 2)
for(var/area/RA in related)
for(var/obj/structure/machinery/camera/C in RA)
C.network.Remove(CAMERA_NET_ATMOSPHERE_ALARMS)
for(var/obj/structure/machinery/camera/C in src)
C.network.Remove(CAMERA_NET_ATMOSPHERE_ALARMS)
for(var/mob/living/silicon/aiPlayer in ai_mob_list)
aiPlayer.cancelAlarm("Atmosphere", src, src)
for(var/obj/structure/machinery/computer/station_alert/a in machines)
a.cancelAlarm("Atmosphere", src, src)

if (danger_level >= 2 && atmosalm < 2)
var/list/cameras = list()
for(var/area/RA in related)
//updateicon()
for(var/obj/structure/machinery/camera/C in RA)
cameras += C
C.network.Add(CAMERA_NET_ATMOSPHERE_ALARMS)
//updateicon()
for(var/obj/structure/machinery/camera/C in src)
cameras += C
C.network.Add(CAMERA_NET_ATMOSPHERE_ALARMS)
for(var/mob/living/silicon/aiPlayer in ai_mob_list)
aiPlayer.triggerAlarm("Atmosphere", src, cameras, src)
for(var/obj/structure/machinery/computer/station_alert/a in machines)
a.triggerAlarm("Atmosphere", src, cameras, src)
air_doors_close()

atmosalm = danger_level
for(var/area/RA in related)
for (var/obj/structure/machinery/alarm/AA in RA)
AA.update_icon()
for (var/obj/structure/machinery/alarm/AA in src)
AA.update_icon()

return 1
return 0
Expand Down Expand Up @@ -225,7 +218,6 @@
if(name == "Space") //no fire alarms in space
return
if(!(flags_alarm_state & ALARM_WARNING_FIRE))
flags_alarm_state |= ALARM_WARNING_FIRE
flags_alarm_state |= ALARM_WARNING_FIRE //used for firedoor checks
updateicon()
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
Expand All @@ -236,18 +228,16 @@
else if(!D.density)
INVOKE_ASYNC(D, TYPE_PROC_REF(/obj/structure/machinery/door, close))
var/list/cameras = list()
for(var/area/RA in related)
for (var/obj/structure/machinery/camera/C in RA)
cameras.Add(C)
C.network.Add(CAMERA_NET_FIRE_ALARMS)
for (var/obj/structure/machinery/camera/C in src)
cameras.Add(C)
C.network.Add(CAMERA_NET_FIRE_ALARMS)
for (var/mob/living/silicon/ai/aiPlayer in ai_mob_list)
aiPlayer.triggerAlarm("Fire", src, cameras, src)
for (var/obj/structure/machinery/computer/station_alert/a in machines)
a.triggerAlarm("Fire", src, cameras, src)

/area/proc/firereset()
if(flags_alarm_state & ALARM_WARNING_FIRE)
flags_alarm_state &= ~ALARM_WARNING_FIRE
flags_alarm_state &= ~ALARM_WARNING_FIRE //used for firedoor checks
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
updateicon()
Expand All @@ -257,9 +247,8 @@
D.nextstate = OPEN
else if(D.density)
INVOKE_ASYNC(D, TYPE_PROC_REF(/obj/structure/machinery/door, open))
for(var/area/RA in related)
for (var/obj/structure/machinery/camera/C in RA)
C.network.Remove(CAMERA_NET_FIRE_ALARMS)
for (var/obj/structure/machinery/camera/C in src)
C.network.Remove(CAMERA_NET_FIRE_ALARMS)
for (var/mob/living/silicon/ai/aiPlayer in ai_mob_list)
aiPlayer.cancelAlarm("Fire", src, src)
for (var/obj/structure/machinery/computer/station_alert/a in machines)
Expand Down Expand Up @@ -341,12 +330,11 @@

// called when power status changes
/area/proc/power_change()
for(var/area/RA in related)
for(var/obj/structure/machinery/M in RA) // for each machine in the area
if(!M.gc_destroyed)
M.power_change() // reverify power status (to update icons etc.)
if(flags_alarm_state)
RA.updateicon()
for(var/obj/structure/machinery/M in src) // for each machine in the area
if(!M.gc_destroyed)
M.power_change() // reverify power status (to update icons etc.)
if(flags_alarm_state)
updateicon()

/area/proc/usage(chan, reset_oneoff = FALSE)
var/used = 0
Expand Down Expand Up @@ -413,24 +401,21 @@

A.has_gravity = gravitystate

for(var/area/SubA in A.related)
SubA.has_gravity = gravitystate

if(gravitystate)
for(var/mob/living/carbon/human/M in SubA)
thunk(M)
for(var/mob/M1 in SubA)
M1.make_floating(0)
else
for(var/mob/M in SubA)
if(M.Check_Dense_Object() && istype(src,/mob/living/carbon/human/))
var/mob/living/carbon/human/H = src
if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags_inventory & NOSLIPPING)) //magboots + dense_object = no floaty effect
H.make_floating(0)
else
H.make_floating(1)
if(gravitystate)
for(var/mob/living/carbon/human/M in A)
thunk(M)
for(var/mob/M1 in A)
M1.make_floating(0)
else
for(var/mob/M in A)
if(M.Check_Dense_Object() && istype(src,/mob/living/carbon/human/))
var/mob/living/carbon/human/H = src
if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags_inventory & NOSLIPPING)) //magboots + dense_object = no floaty effect
H.make_floating(0)
else
M.make_floating(1)
H.make_floating(1)
else
M.make_floating(1)

/area/proc/thunk(M)
if(istype(get_turf(M), /turf/open/space)) // Can't fall onto nothing.
Expand Down
4 changes: 0 additions & 4 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
if(pulledby)
pulledby.stop_pulling()
QDEL_NULL(launch_metadata)

if(opacity)
RemoveElement(/datum/element/light_blocking)

QDEL_NULL(em_block)

if(loc)
Expand Down
14 changes: 6 additions & 8 deletions code/game/machinery/air_alarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,10 @@
/obj/structure/machinery/alarm/proc/elect_master()
if(!alarm_area)
return 0
for (var/area/A in alarm_area.related)
for (var/obj/structure/machinery/alarm/AA in A)
if (!(AA.inoperable()))
alarm_area.master_air_alarm = AA
return 1
for (var/obj/structure/machinery/alarm/AA in alarm_area)
if (!(AA.inoperable()))
alarm_area.master_air_alarm = AA
return 1
return 0

/obj/structure/machinery/alarm/proc/get_danger_level(current_value, list/danger_levels)
Expand Down Expand Up @@ -312,9 +311,8 @@
/obj/structure/machinery/alarm/proc/apply_mode()
//propagate mode to other air alarms in the area
//TODO: make it so that players can choose between applying the new mode to the room they are in (related area) vs the entire alarm area
for (var/area/RA in alarm_area.related)
for (var/obj/structure/machinery/alarm/AA in RA)
AA.mode = mode
for (var/obj/structure/machinery/alarm/AA in alarm_area)
AA.mode = mode

switch(mode)
if(AALARM_MODE_SCRUBBING)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/hologram.dm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
var/area/holo_area = get_area(src)
var/area/eye_area = get_area(master.eyeobj)

if(eye_area in holo_area.related)
if(eye_area == holo_area)
return 1

clear_holo()//If not, we want to get rid of the hologram.
Expand Down
11 changes: 5 additions & 6 deletions code/game/machinery/lightswitch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@
/obj/structure/machinery/light_switch/attack_hand(mob/user)
on = !on

for(var/area/A in area.related)
A.lightswitch = on
A.updateicon()
area.lightswitch = on
area.updateicon()

for(var/obj/structure/machinery/light_switch/L in A)
L.on = on
L.updateicon()
for(var/obj/structure/machinery/light_switch/L in area)
L.on = on
L.updateicon()

area.power_change()

Expand Down
9 changes: 4 additions & 5 deletions code/modules/mob/living/silicon/ai/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,10 @@
var/PRP //like ERP with the code, at least this stuff is no more 4x sametext
for (PRP=1, PRP<=4, PRP++)
var/area/AIarea = get_area(src)
for(var/area/A in AIarea.related)
for (var/obj/structure/machinery/power/apc/APC in A)
if (!(APC.stat & BROKEN))
theAPC = APC
break
for (var/obj/structure/machinery/power/apc/APC in AIarea)
if (!(APC.stat & BROKEN))
theAPC = APC
break
if (!theAPC)
switch(PRP)
if (1) to_chat(src, "Unable to locate APC!")
Expand Down
9 changes: 4 additions & 5 deletions code/modules/power/apc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1314,11 +1314,10 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
if(cell && cell.charge >= 20)
cell.use(20)
spawn(0)
for(var/area/A in area.related)
for(var/obj/structure/machinery/light/L in A)
L.on = 1
L.broken()
sleep(1)
for(var/obj/structure/machinery/light/L in area)
L.on = 1
L.broken()
sleep(1)

/obj/structure/machinery/power/apc/Destroy()
area.power_light = 0
Expand Down
7 changes: 3 additions & 4 deletions code/modules/power/power.dm
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,9 @@
return null

/area/proc/get_apc()
for(var/area/RA in src.related)
var/obj/structure/machinery/power/apc/FINDME = locate() in RA
if (FINDME)
return FINDME
var/obj/structure/machinery/power/apc/FINDME = locate() in src
if (FINDME)
return FINDME


//Determines how strong could be shock, deals damage to mob, uses power.
Expand Down
7 changes: 7 additions & 0 deletions code/modules/shuttle/shuttles/dropship.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/obj/docking_port/mobile/marine_dropship
width = 11
height = 21

dwidth = 5
dheight = 10

preferred_direction = SOUTH
callTime = DROPSHIP_TRANSIT_DURATION
rechargeTime = SHUTTLE_RECHARGE
Expand Down Expand Up @@ -157,6 +161,9 @@
dir = NORTH
width = 11
height = 21
dwidth = 5
dheight = 10

var/list/landing_lights = list()
var/auto_open = FALSE
var/landing_lights_on = FALSE
Expand Down
8 changes: 4 additions & 4 deletions maps/map_files/BigRed/BigRed.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -43036,7 +43036,7 @@ aah
aah
aah
aah
aau
aah
aeh
aaf
aaf
Expand Down Expand Up @@ -44111,7 +44111,7 @@ aah
aah
aah
aah
aah
aau
aah
aah
aah
Expand Down Expand Up @@ -44438,7 +44438,7 @@ bie
bie
bie
bie
biI
bie
bsb
eWd
eWd
Expand Down Expand Up @@ -45513,7 +45513,7 @@ bie
bie
bie
bie
bie
biI
bie
bie
bie
Expand Down
Loading

0 comments on commit e69a266

Please sign in to comment.