Skip to content

Commit

Permalink
There you go random github user
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Sep 30, 2023
1 parent dc54d78 commit 311b510
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 32 deletions.
54 changes: 31 additions & 23 deletions code/game/machinery/floodlight.dm
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
/obj/structure/machinery/floodlight
name = "Emergency Floodlight"
name = "emergency floodlight"
desc = "A powerful light usually stationed near landing zones to provide better visibility."
icon = 'icons/obj/structures/machinery/floodlight.dmi'
icon_state = "flood00"
density = TRUE
anchored = TRUE
light_power = 2
wrenchable = TRUE
use_power = USE_POWER_IDLE
idle_power_usage = 10
idle_power_usage = 0
active_power_usage = 100

var/on_light_range = 6

///Whether or not the floodlight can be toggled on or off
var/toggleable = TRUE

///Whether or not the floodlight is turned on, disconnected from whether it has power or is lit
var/turned_on = FALSE

/obj/structure/machinery/floodlight/Initialize(mapload, ...)
. = ..()
if(light_on)
set_light(on_light_range)

turn_light(toggle_on = (operable() && turned_on))

/obj/structure/machinery/floodlight/turn_light(mob/user, toggle_on)
. = ..()
Expand All @@ -32,45 +36,49 @@

update_icon()

/obj/structure/machinery/floodlight/attack_hand(mob/user as mob)
. = ..()
if(.)
/obj/structure/machinery/floodlight/attack_hand(mob/user)
if(!toggleable)
to_chat(user, SPAN_NOTICE("[src] doesn't seem to have a switch to toggle the light."))
return

if(!toggleable)
if(user.lying || user.stat)
return

if(light_on)
to_chat(user, SPAN_NOTICE("You turn off the light."))
turn_light(user, toggle_on = FALSE)
update_use_power(USE_POWER_IDLE)
else
to_chat(user, SPAN_NOTICE("You turn on the light."))
turn_light(user, toggle_on = TRUE)
update_use_power(USE_POWER_ACTIVE)
if(!is_valid_user(user))
to_chat(user, SPAN_NOTICE("You don't have the dexterity to do this."))
return

turned_on = !turned_on

if(inoperable())
to_chat(user, SPAN_NOTICE("You turn [turned_on ? "on" : "off"] the floodlight. It seems to be inoperable."))
return

to_chat(user, SPAN_NOTICE("You turn [turned_on ? "on" : "off"] the light."))
turn_light(user, toggle_on = turned_on)
update_use_power(turned_on ? USE_POWER_ACTIVE : USE_POWER_IDLE)

/obj/structure/machinery/floodlight/update_icon()
. = ..()
icon_state = "flood0[light_on]"

/obj/structure/machinery/floodlight/power_change(area/master_area = null)
..()
if(stat & NOPOWER)
turn_light(toggle_on = FALSE)
. = ..()

turn_light(toggle_on = (!(stat & NOPOWER) && turned_on))

//Magical floodlight that cannot be destroyed or interacted with.
/obj/structure/machinery/floodlight/landing
name = "Landing Light"
desc = "A powerful light stationed near landing zones to provide better visibility."
name = "landing light"
desc = "A powerful light usually stationed near landing zones to provide better visibility. This one seems to have been bolted down and is unable to be moved."
icon_state = "flood01"
light_on = TRUE
in_use = 1
use_power = USE_POWER_NONE
needs_power = FALSE
unslashable = TRUE
unacidable = TRUE
wrenchable = FALSE
toggleable = FALSE
turned_on = TRUE

/obj/structure/machinery/floodlight/landing/floor
icon_state = "floor_flood01"
Expand Down
10 changes: 5 additions & 5 deletions maps/map_files/LV624/LV624.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@
"afu" = (
/obj/item/ammo_casing,
/obj/structure/machinery/floodlight/landing{
name = "Bolted Emergency Floodlight"
name = "bolted floodlight"
},
/turf/open/floor/plating{
dir = 9;
Expand Down Expand Up @@ -1157,7 +1157,7 @@
/area/lv624/ground/barrens/central_barrens)
"afy" = (
/obj/structure/machinery/floodlight/landing{
name = "Bolted Emergency Floodlight"
name = "bolted floodlight"
},
/turf/open/floor/plating{
dir = 5;
Expand Down Expand Up @@ -1404,7 +1404,7 @@
"agF" = (
/obj/item/ammo_casing,
/obj/structure/machinery/floodlight/landing{
name = "Bolted Emergency Floodlight"
name = "bolted floodlight"
},
/turf/open/floor/plating,
/area/lv624/ground/barrens/central_barrens)
Expand Down Expand Up @@ -1583,7 +1583,7 @@
/area/lv624/ground/barrens/west_barrens/ceiling)
"ahM" = (
/obj/structure/machinery/floodlight/landing{
name = "Bolted Emergency Floodlight"
name = "bolted floodlight"
},
/turf/open/floor/plating{
dir = 10;
Expand Down Expand Up @@ -1625,7 +1625,7 @@
/area/lv624/ground/barrens/central_barrens)
"ahT" = (
/obj/structure/machinery/floodlight/landing{
name = "Bolted Emergency Floodlight"
name = "bolted floodlight"
},
/turf/open/floor/plating{
dir = 6;
Expand Down
16 changes: 12 additions & 4 deletions maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5852,7 +5852,9 @@
},
/area/almayer/medical/morgue)
"asV" = (
/obj/structure/machinery/floodlight/landing,
/obj/structure/machinery/floodlight/landing{
name = "bolted floodlight"
},
/turf/open/floor/almayer{
icon_state = "mono"
},
Expand Down Expand Up @@ -6629,7 +6631,9 @@
},
/area/almayer/engineering/engineering_workshop/hangar)
"auJ" = (
/obj/structure/machinery/floodlight/landing,
/obj/structure/machinery/floodlight/landing{
name = "bolted floodlight"
},
/turf/open/floor/almayer{
icon_state = "mono"
},
Expand Down Expand Up @@ -49266,7 +49270,9 @@
},
/area/almayer/living/port_emb)
"lqZ" = (
/obj/structure/machinery/floodlight/landing,
/obj/structure/machinery/floodlight/landing{
name = "bolted floodlight"
},
/turf/open/floor/almayer{
icon_state = "mono"
},
Expand Down Expand Up @@ -52574,7 +52580,9 @@
},
/area/almayer/hallways/stern_hallway)
"mMu" = (
/obj/structure/machinery/floodlight/landing,
/obj/structure/machinery/floodlight/landing{
name = "bolted floodlight"
},
/turf/open/floor/almayer{
icon_state = "mono"
},
Expand Down

0 comments on commit 311b510

Please sign in to comment.