mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-28 11:02:08 +00:00
- Desk lamps are now just fancy flashlights. Which means you can pick them up. They have w_class set to 4 and don't have the onbelt flag, meaning you can't put them in any container and you can't put them in a pocket. Click on them to pick them up, use the toggle-light verb to turn them on or off. They are no longer affected by light switches (desk lights generally aren't anyway)
- Updated lamp type path on both uterus and 2.0.8 git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3115 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -13,18 +13,36 @@
|
||||
icon_on = "flight1"
|
||||
icon_off = "flight0"
|
||||
|
||||
/obj/item/device/flashlight/initialize()
|
||||
..()
|
||||
if (on)
|
||||
icon_state = icon_on
|
||||
src.sd_SetLuminosity(brightness_on)
|
||||
else
|
||||
icon_state = icon_off
|
||||
src.sd_SetLuminosity(0)
|
||||
|
||||
/obj/item/device/flashlight/proc/update_brightness(var/mob/user = null)
|
||||
if (on)
|
||||
icon_state = icon_on
|
||||
if(src.loc == user)
|
||||
user.total_luminosity += brightness_on
|
||||
else if (isturf(src.loc))
|
||||
src.sd_SetLuminosity(brightness_on)
|
||||
|
||||
else
|
||||
icon_state = icon_off
|
||||
if(src.loc == user)
|
||||
user.total_luminosity -= brightness_on
|
||||
else if (isturf(src.loc))
|
||||
src.sd_SetLuminosity(0)
|
||||
|
||||
/obj/item/device/flashlight/attack_self(mob/user)
|
||||
if(!isturf(user.loc))
|
||||
user << "You cannot turn the light on while in this [user.loc]" //To prevent some lighting anomalities.
|
||||
return
|
||||
on = !on
|
||||
if (on)
|
||||
icon_state = icon_on
|
||||
user.total_luminosity += brightness_on
|
||||
else
|
||||
icon_state = icon_off
|
||||
user.total_luminosity -= brightness_on
|
||||
update_brightness(user)
|
||||
return
|
||||
|
||||
|
||||
@@ -64,8 +82,8 @@
|
||||
|
||||
/obj/item/device/flashlight/pickup(mob/user)
|
||||
if(on)
|
||||
src.sd_SetLuminosity(0)
|
||||
user.total_luminosity += brightness_on
|
||||
src.sd_SetLuminosity(0)
|
||||
|
||||
|
||||
/obj/item/device/flashlight/dropped(mob/user)
|
||||
@@ -133,10 +151,41 @@
|
||||
|
||||
/obj/item/clothing/head/helmet/hardhat/pickup(mob/user)
|
||||
if(on)
|
||||
src.sd_SetLuminosity(0)
|
||||
user.total_luminosity += brightness_on
|
||||
user.UpdateLuminosity()
|
||||
src.sd_SetLuminosity(0)
|
||||
|
||||
/obj/item/clothing/head/helmet/hardhat/dropped(mob/user)
|
||||
if(on)
|
||||
user.total_luminosity -= brightness_on
|
||||
user.UpdateLuminosity()
|
||||
src.sd_SetLuminosity(brightness_on)
|
||||
|
||||
// the desk lamps are a bit special
|
||||
/obj/item/device/flashlight/lamp
|
||||
name = "desk lamp"
|
||||
desc = "A desk lamp"
|
||||
icon = 'lighting.dmi'
|
||||
icon_state = "lamp0"
|
||||
brightness_on = 5
|
||||
icon_on = "lamp1"
|
||||
icon_off = "lamp0"
|
||||
w_class = 4
|
||||
flags = FPRINT | TABLEPASS | CONDUCT
|
||||
m_amt = 0
|
||||
g_amt = 0
|
||||
on = 1
|
||||
|
||||
// green-shaded desk lamp
|
||||
/obj/item/device/flashlight/lamp/green
|
||||
icon_state = "green0"
|
||||
icon_on = "green1"
|
||||
icon_off = "green0"
|
||||
desc = "A green-shaded desk lamp"
|
||||
|
||||
/obj/item/device/flashlight/lamp/verb/toggle_light(mob/user)
|
||||
set name = "Toggle light"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
attack_self(user)
|
||||
@@ -52,23 +52,6 @@
|
||||
light_type = /obj/item/weapon/light/tube/large
|
||||
brightness = 15
|
||||
|
||||
// the desk lamp
|
||||
/obj/machinery/light/lamp
|
||||
name = "desk lamp"
|
||||
icon_state = "lamp1"
|
||||
base_state = "lamp"
|
||||
fitting = "bulb"
|
||||
brightness = 5
|
||||
desc = "A desk lamp"
|
||||
light_type = /obj/item/weapon/light/bulb
|
||||
var/switchon = 0 // independent switching for lamps - not controlled by area lightswitch
|
||||
|
||||
// green-shaded desk lamp
|
||||
/obj/machinery/light/lamp/green
|
||||
icon_state = "green1"
|
||||
base_state = "green"
|
||||
desc = "A green-shaded desk lamp"
|
||||
|
||||
|
||||
// create a new lighting fixture
|
||||
/obj/machinery/light/New()
|
||||
@@ -392,38 +375,8 @@
|
||||
|
||||
|
||||
|
||||
// special handling for desk lamps
|
||||
|
||||
|
||||
// if attack with hand, only "grab" attacks are an attempt to remove bulb
|
||||
// otherwise, switch the lamp on/off
|
||||
|
||||
/obj/machinery/light/lamp/attack_hand(mob/user)
|
||||
|
||||
if(user.a_intent == "grab")
|
||||
..() // do standard hand attack
|
||||
else
|
||||
switchon = !switchon
|
||||
user << "You switch [switchon ? "on" : "off"] the [name]."
|
||||
seton(switchon && powered(LIGHT))
|
||||
|
||||
|
||||
// called when area power state changes
|
||||
// override since lamp does not use area lightswitch
|
||||
|
||||
/obj/machinery/light/lamp/power_change()
|
||||
spawn(rand(0,15))
|
||||
var/area/A = src.loc.loc
|
||||
A = A.master
|
||||
seton(switchon && A.power_light)
|
||||
|
||||
// returns whether this lamp has power
|
||||
// true if area has power and lamp switch is on
|
||||
|
||||
/obj/machinery/light/lamp/has_power()
|
||||
var/area/A = src.loc.loc
|
||||
return switchon && A.master.power_light
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user