Enlightening Update (#9042)

* Enlightening Update

* matt's requests
This commit is contained in:
Geeves
2020-06-11 21:24:00 +02:00
committed by GitHub
parent e1dbf90bd0
commit d5b96b0fd9
18 changed files with 239 additions and 222 deletions
+11 -9
View File
@@ -7,7 +7,7 @@
icon = 'icons/obj/lighting.dmi'
force = 2
throwforce = 5
w_class = 1
w_class = ITEMSIZE_TINY
matter = list(DEFAULT_WALL_MATERIAL = 60)
var/status = 0 // LIGHT_OK, LIGHT_BURNED or LIGHT_BROKEN
var/switchcount = 0 // number of times switched
@@ -55,7 +55,7 @@
brightness_color = LIGHT_COLOR_CYAN
/obj/item/light/tube/large
w_class = 2
w_class = ITEMSIZE_SMALL
name = "large light tube"
brightness_range = 15
brightness_power = 6
@@ -150,14 +150,14 @@
if(istype(I, /obj/item/reagent_containers/syringe))
var/obj/item/reagent_containers/syringe/S = I
to_chat(user, "You inject the solution into the [src].")
to_chat(user, SPAN_NOTICE("You inject the solution into \the [src]."))
if(S.reagents.has_reagent("phoron", 5))
log_admin("LOG: [user.name] ([user.ckey]) injected a light with phoron, rigging it to explode.",ckey=key_name(user))
message_admins("LOG: [user.name] ([user.ckey]) injected a light with phoron, rigging it to explode.")
rigged = 1
rigged = TRUE
S.reagents.clear_reagents()
else
@@ -169,7 +169,8 @@
// now only shatter if the intent was harm
/obj/item/light/afterattack(atom/target, mob/user, proximity)
if(!proximity) return
if(!proximity)
return
if(istype(target, /obj/machinery/light))
return
if(user.a_intent != I_HURT)
@@ -179,9 +180,10 @@
/obj/item/light/proc/shatter()
if(status == LIGHT_OK || status == LIGHT_BURNED)
src.visible_message("<span class='warning'>[name] shatters.</span>","<span class='warning'>You hear a small glass object shatter.</span>")
visible_message(SPAN_WARNING("\The [src] shatters!"), SPAN_WARNING("You hear a small glass object shatter!"))
status = LIGHT_BROKEN
force = 5
sharp = 1
playsound(src.loc, 'sound/effects/glass_hit.ogg', 75, 1)
update()
sharp = TRUE
playsound(get_turf(src), 'sound/effects/glass_hit.ogg', 75, TRUE)
new /obj/item/material/shard(get_turf(src))
update()
+79 -101
View File
@@ -4,7 +4,7 @@
desc = "A light fixture under construction."
icon = 'icons/obj/lighting.dmi'
icon_state = "tube-construct-stage1"
anchored = 1
anchored = TRUE
layer = 5
var/stage = 1
var/fixture_type = "tube"
@@ -26,154 +26,132 @@
if(!..(user, 2))
return
switch(src.stage)
switch(stage)
if(1)
to_chat(user, "It's an empty frame.")
to_chat(user, SPAN_NOTICE("It's an empty frame."))
if(2)
to_chat(user, "It's wired.")
to_chat(user, SPAN_NOTICE("It's wired."))
if(3)
to_chat(user, "The casing is closed.")
to_chat(user, SPAN_NOTICE("The casing is closed."))
if (cell_connectors)
if (cell)
to_chat(user, "You see [cell] inside the casing.")
to_chat(user, SPAN_NOTICE("You see [cell] inside the casing."))
else
to_chat(user, "The casing has no power cell installed.")
to_chat(user, SPAN_NOTICE("The casing has no power cell installed."))
else
to_chat(user, "This casing doesn't support a backup power cell.")
to_chat(user, SPAN_WARNING("This casing doesn't support a backup power cell."))
/obj/machinery/light_construct/attackby(obj/item/W as obj, mob/user as mob)
/obj/machinery/light_construct/attackby(obj/item/W, mob/living/user)
add_fingerprint(user)
if (W.iswrench())
if (src.stage == 1)
playsound(src.loc, W.usesound, 75, 1)
to_chat(usr, "You begin deconstructing [src].")
if (!do_after(usr, 30, act_target = src))
if(W.iswrench())
switch(stage)
if(1)
playsound(get_turf(src), W.usesound, 75, TRUE)
to_chat(user, SPAN_NOTICE("You begin taking \the [src] apart..."))
if (!do_after(usr, 30, act_target = src))
return
new /obj/item/stack/material/steel(get_turf(src), sheets_refunded)
user.visible_message(SPAN_NOTICE("\The [user] takes \the [src] apart."), SPAN_WARNING("You take \the [src] apart."))
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 75, TRUE)
if(cell)
cell.forceMove(get_turf(src))
cell = null
qdel(src)
if(2)
to_chat(user, SPAN_WARNING("You have to remove the wires first."))
return
if(3)
to_chat(user, SPAN_WARNING("You have to unscrew the case first."))
return
new /obj/item/stack/material/steel(get_turf(src.loc), sheets_refunded)
user.visible_message(
"[user] deconstructs [src].",
"You deconstruct [src]."
)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 75, 1)
if (cell)
cell.forceMove(get_turf(src))
cell = null
qdel(src)
if (src.stage == 2)
to_chat(usr, "You have to remove the wires first.")
return
if (src.stage == 3)
to_chat(usr, "You have to unscrew the case first.")
return
if(W.iswirecutter())
if (src.stage != 2) return
src.stage = 1
if(stage != 2)
return
stage = 1
switch(fixture_type)
if ("tube")
src.icon_state = "tube-construct-stage1"
if("tube")
icon_state = "tube-construct-stage1"
if("bulb")
src.icon_state = "bulb-construct-stage1"
new /obj/item/stack/cable_coil(get_turf(src.loc), 1, "red")
user.visible_message(
"[user] removes the wiring from [src].",
"You remove the wiring from [src].",
"You hear something being cut."
)
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
icon_state = "bulb-construct-stage1"
new /obj/item/stack/cable_coil(get_turf(src), 1, "red")
user.visible_message(SPAN_NOTICE("\The [user] removes the wiring from \the [src]."), SPAN_NOTICE("You remove the wiring from [src]."), SPAN_WARNING("You hear something being cut."))
playsound(get_turf(src), 'sound/items/Wirecutter.ogg', 100, TRUE)
return
if(W.iscoil())
if (src.stage != 1) return
if(stage != 1)
return
var/obj/item/stack/cable_coil/coil = W
if (coil.use(1))
if(coil.use(1))
switch(fixture_type)
if ("tube")
src.icon_state = "tube-construct-stage2"
if("tube")
icon_state = "tube-construct-stage2"
if("bulb")
src.icon_state = "bulb-construct-stage2"
src.stage = 2
user.visible_message(
"[user] adds wires to [src].",
"You add wires to [src]."
)
icon_state = "bulb-construct-stage2"
stage = 2
user.visible_message(SPAN_NOTICE("\The [user] adds wires to \the [src]."), SPAN_NOTICE("You add wires to \the [src]."))
return
if(W.isscrewdriver())
if (stage == 2)
if(stage == 2)
switch(fixture_type)
if("tube")
icon_state = "tube_empty"
if("bulb")
icon_state = "bulb_empty"
stage = 3
user.visible_message(
"[user] closes [src]'s casing.",
"You close [src]'s casing.",
"You hear something being screwed in."
)
playsound(src.loc, W.usesound, 75, 1)
user.visible_message(SPAN_NOTICE("\The [user] closes \the [src]'s casing."), SPAN_NOTICE("You close \the [src]'s casing."), SPAN_WARNING("You hear something being screwed in."))
playsound(get_turf(src), W.usesound, 75, TRUE)
switch(fixture_type)
if("tube")
newlight = new /obj/machinery/light/built(src.loc)
newlight = new /obj/machinery/light/built(get_turf(src))
if("bulb")
newlight = new /obj/machinery/light/small/built(src.loc)
newlight = new /obj/machinery/light/small/built(get_turf(src))
newlight.dir = src.dir
if (cell)
if(cell)
newlight.cell = cell
cell.forceMove(newlight)
cell = null
src.transfer_fingerprints_to(newlight)
transfer_fingerprints_to(newlight)
qdel(src)
return
if (istype(W, /obj/item/cell))
if (!cell_connectors)
to_chat(user, "<span class='notice'>[src] does not have power cell connectors.</span>")
if(istype(W, /obj/item/cell))
if(!cell_connectors)
to_chat(user, SPAN_WARNING("\The [src] does not have power cell connectors."))
return
if (!user.unEquip(W))
if(!user.unEquip(W))
return
if (cell)
user.visible_message(
"<span class='notice'>[user] swaps [W] out for [src]'s cell.</span>",
"<span class='notice'>You swap out [src]'s cell out for [W].</span>"
)
if(cell)
user.visible_message(SPAN_NOTICE("\The [user] swaps \the [W] out for \the [src]'s cell."), SPAN_NOTICE("You swap out \the [src]'s cell out for \the [W]."))
user.drop_from_inventory(W, src)
cell.forceMove(get_turf(src))
user.put_in_hands(cell)
else
user.visible_message(
"<span class='notice'>[user] installs [W] in [src].</span>",
"<span class='notice'>You hook up [W] to [src]'s cell terminals.</span>"
)
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
W.forceMove(src)
cell = W
add_fingerprint(user)
return
if (W.iscrowbar())
if (!cell_connectors)
to_chat(user, "<span class='notice'>[src] does not have a power cell connector.</span>")
return
if (!cell)
to_chat(user, "<span class='notice'>[src] does not have a power cell installed.</span>")
return
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, TRUE)
visible_message(
"[user] removes [cell] from [src].",
"<span class='notice'>You remove [cell] from [src].</span>"
)
cell.forceMove(get_turf(src))
cell = null
user.visible_message(SPAN_NOTICE("\The [user] installs \the [W] into \the [src]."), SPAN_NOTICE("You hook up \the [W] to \the [src]'s cell terminals."))
user.drop_from_inventory(W, src)
cell = W
playsound(get_turf(src), 'sound/machines/click.ogg', 50, TRUE)
return
if(W.iscrowbar())
if(!cell_connectors)
to_chat(user, SPAN_WARNING("\The [src] does not have a power cell connector."))
return
if(!cell)
to_chat(user, SPAN_WARNING("\The [src] does not have a power cell installed."))
return
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, TRUE)
visible_message(SPAN_NOTICE("\The [user] removes \the [cell] from the [src]."), SPAN_NOTICE("You remove \the [cell] from \the [src]."))
cell.forceMove(get_turf(src))
user.put_in_hands(cell)
cell = null
return
..()
/obj/machinery/light_construct/small
@@ -181,8 +159,8 @@
desc = "A small light fixture under construction."
icon = 'icons/obj/lighting.dmi'
icon_state = "bulb-construct-stage1"
anchored = 1
anchored = TRUE
layer = 5
stage = 1
fixture_type = "bulb"
sheets_refunded = 1
sheets_refunded = 1
+60 -48
View File
@@ -11,7 +11,7 @@
var/base_state = "tube" // base description and icon_state
icon_state = "tube_empty"
desc = "A lighting fixture."
anchored = 1
anchored = TRUE
layer = 5 // They were appearing under mobs which is a little weird - Ostaf
use_power = 2
idle_power_usage = 2
@@ -238,7 +238,7 @@
if (!has_emergency_power(pwr))
return FALSE
if (cell.charge > 300) //it's meant to handle 120 W, ya doofus
visible_message("<span class='warning'>[src] short-circuits!</span>", "<span class='warning'>You hear glass breaking.</span>")
visible_message(SPAN_WARNING("\The [src] short-circuits!"), SPAN_WARNING("You hear glass breaking."))
broken()
return FALSE
cell.use(pwr)
@@ -259,15 +259,19 @@
/obj/machinery/light/attack_generic(var/mob/user, var/damage)
if(!damage)
return
if(status == LIGHT_EMPTY||status == LIGHT_BROKEN)
to_chat(user, "That object is useless to you.")
if(status == LIGHT_EMPTY)
to_chat(user, SPAN_WARNING("\The [src] is useless to you."))
return
if(!(status == LIGHT_OK||status == LIGHT_BURNED))
if(!(status == LIGHT_OK || status == LIGHT_BURNED))
return
visible_message("<span class='danger'>[user] smashes the light!</span>")
if(status == LIGHT_BROKEN)
user.visible_message(SPAN_WARNING("\The [user] completely shatters \the [src]!"), SPAN_WARNING("You completely shatter \the [src]!"))
shatter()
else
user.visible_message(SPAN_WARNING("\The [user] smashes \the [src]!"), SPAN_WARNING("You smash \the [src]!"))
broken()
user.do_attack_animation(src)
broken()
return 1
return TRUE
// examine verb
/obj/machinery/light/examine(mob/user)
@@ -287,7 +291,6 @@
// attack with item - insert light (if right type), otherwise try to break the light
/obj/machinery/light/attackby(obj/item/W, mob/user)
//Light replacer code
if(istype(W, /obj/item/device/lightreplacer))
var/obj/item/device/lightreplacer/LR = W
@@ -299,14 +302,14 @@
// attempt to insert light
if(istype(W, /obj/item/light))
if(status != LIGHT_EMPTY)
to_chat(user, "There is a [fitting] already inserted.")
to_chat(user, SPAN_WARNING("There's already a [fitting] inserted."))
return
else
src.add_fingerprint(user)
var/obj/item/light/L = W
if(istype(L, light_type))
status = L.status
to_chat(user, "You insert the [L.name].")
to_chat(user, SPAN_NOTICE("You insert \the [L]."))
switchcount = L.switchcount
rigged = L.rigged
brightness_range = L.brightness_range
@@ -329,43 +332,30 @@
explode()
else
to_chat(user, "This type of light requires a [fitting].")
to_chat(user, SPAN_WARNING("This type of light requires a [fitting]."))
return
// attempt to break the light
//If xenos decide they want to smash a light bulb with a toolbox, who am I to stop them? /N
else if(status != LIGHT_BROKEN && status != LIGHT_EMPTY)
if(prob(1+W.force * 5))
to_chat(user, "You hit the light, and it smashes!")
for(var/mob/M in viewers(src))
if(M == user)
continue
M.show_message("[user.name] smashes the light!", 3, "You hear a tinkle of breaking glass", 2)
if(!stat && (W.flags & CONDUCT))
//if(!user.mutations & COLD_RESISTANCE)
if (prob(12))
electrocute_mob(user, get_area(src), src, 0.3)
broken()
else
to_chat(user, "You hit the light!")
smash_check(W, user, "smashes", "smashes", TRUE)
else if(status == LIGHT_BROKEN)
smash_check(W, user, "completely shatters", "shatters completely", FALSE)
// attempt to stick weapon into light socket
else if(status == LIGHT_EMPTY)
if(W.isscrewdriver()) //If it's a screwdriver open it.
playsound(src.loc, W.usesound, 75, 1)
user.visible_message("[user.name] opens [src]'s casing.", \
"You open [src]'s casing.", "You hear a noise.")
playsound(get_turf(src), W.usesound, 75, 1)
user.visible_message(SPAN_NOTICE("\The [user] opens \the [src]'s casing."), SPAN_NOTICE("You open \the [src]'s casing."), SPAN_NOTICE("You hear a noise."))
var/obj/machinery/light_construct/newlight = null
switch(fitting)
if("tube")
newlight = new /obj/machinery/light_construct(src.loc)
newlight = new /obj/machinery/light_construct(get_turf(src))
newlight.icon_state = "tube-construct-stage2"
if("bulb")
newlight = new /obj/machinery/light_construct/small(src.loc)
newlight = new /obj/machinery/light_construct/small(get_turf(src))
newlight.icon_state = "bulb-construct-stage2"
newlight.dir = src.dir
newlight.stage = 2
@@ -379,13 +369,25 @@
qdel(src)
return
to_chat(user, "You stick \the [W] into the light socket!")
to_chat(user, SPAN_WARNING("You stick \the [W] into the light socket!"))
if(has_power() && (W.flags & CONDUCT))
spark(src, 3)
//if(!user.mutations & COLD_RESISTANCE)
if (prob(75))
if(prob(75))
electrocute_mob(user, get_area(src), src, rand(0.7,1.0))
/obj/machinery/light/proc/smash_check(var/obj/O, var/mob/living/user, var/others_text, var/self_text, var/only_break)
if(prob(1 + O.force * 5))
user.visible_message(SPAN_WARNING("\The [user] [others_text] \the [src]!"), SPAN_WARNING("You hit \the [src], and it [self_text]!"), SPAN_WARNING("You hear a tinkle of breaking glass!"))
if(!stat && (O.flags & CONDUCT))
if(prob(12))
electrocute_mob(user, get_area(src), src, 0.3)
if(only_break)
broken()
else
shatter()
else
user.visible_message(SPAN_WARNING("\The [user] hits \the [src], but it doesn't break."), SPAN_WARNING("You hit \the [src], but it doesn't break."), SPAN_WARNING("You hear something hitting against glass."))
// returns whether this light has power
// true if area has power
@@ -432,19 +434,20 @@
add_fingerprint(user)
if(status == LIGHT_EMPTY)
to_chat(user, "There is no [fitting] in this light.")
to_chat(user, SPAN_WARNING("There is no [fitting] in \the [src]."))
return
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
if(H.species.can_shred(H))
H.visible_message(
"<span class='warning'>[user] smashes [src]!</span>",
"<span class='warning'>You smash [src]!</span>",
"<span class='notice'>You hear the tinkle of breaking glass.</span>"
)
broken()
return
if(H.a_intent == I_HURT && H.species.can_shred(H))
if(status != LIGHT_BROKEN || status != LIGHT_EMPTY)
H.visible_message(SPAN_WARNING("\The [user] smashes \the [src]!"), SPAN_WARNING("You smash \the [src]!"), SPAN_WARNING("You hear the tinkle of breaking glass."))
broken()
return
else if(status == LIGHT_BROKEN)
H.visible_message(SPAN_WARNING("\The [user] completely shatters \the [src]!"), SPAN_WARNING("You shatter \the [src] completely!"), SPAN_WARNING("You hear the tinkle of breaking glass."))
shatter()
return
// make it burn hands if not wearing fire-insulated gloves
if(!stat)
@@ -462,12 +465,12 @@
prot = 1
if(prot || (COLD_RESISTANCE in user.mutations))
to_chat(user, "You remove the light [fitting]")
to_chat(user, SPAN_NOTICE("You remove the light [fitting]."))
else
to_chat(user, "You try to remove the light [fitting], but it's too hot and you don't want to burn your hand.")
to_chat(user, SPAN_WARNING("You try to remove the light [fitting], but it's too hot and you don't want to burn your hand."))
return // if burned, don't remove the light
else
to_chat(user, "You remove the light [fitting].")
to_chat(user, SPAN_NOTICE("You remove the light [fitting]."))
// create a light tube/bulb item and put it in the user's hand
if(inserted_light)
@@ -543,6 +546,15 @@
if (!skip_sound_and_sparks)
CHECK_TICK // For lights-out events.
/obj/machinery/light/proc/shatter()
if(status == LIGHT_EMPTY)
return
status = LIGHT_EMPTY
stat |= BROKEN
update()
playsound(get_turf(src), 'sound/effects/glass_hit.ogg', 75, TRUE)
new /obj/item/material/shard(get_turf(src))
/obj/machinery/light/proc/fix()
if(status == LIGHT_OK)
return
@@ -559,7 +571,7 @@
return
if(2.0)
if (prob(75))
broken()
shatter()
if(3.0)
if (prob(50))
broken()