-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makes the Light Replacer more easily attainable + Allows broken light recycling #7381
Changes from all commits
bffc355
a11f744
9f5fb0e
0dbe046
d920320
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -41,7 +41,7 @@ | |||||||||||||||
/obj/item/device/lightreplacer | ||||||||||||||||
|
||||||||||||||||
name = "light replacer" | ||||||||||||||||
desc = "A device to automatically replace lights. Refill with working lightbulbs." | ||||||||||||||||
desc = "A device to automatically replace lights. Can be refill with working lightbulbs and sheets of glass, and can recycle broken lightbulbs." | ||||||||||||||||
|
||||||||||||||||
icon = 'icons/obj/janitor.dmi' | ||||||||||||||||
icon_state = "lightreplacer0" | ||||||||||||||||
|
@@ -50,20 +50,28 @@ | |||||||||||||||
flags_atom = FPRINT|CONDUCT | ||||||||||||||||
flags_equip_slot = SLOT_WAIST | ||||||||||||||||
|
||||||||||||||||
matter = list("metal" = 20,"glass" = 50) | ||||||||||||||||
|
||||||||||||||||
var/max_uses = 50 | ||||||||||||||||
var/uses = 0 | ||||||||||||||||
var/failmsg = "" | ||||||||||||||||
var/charge = 1 | ||||||||||||||||
var/recycle = 0 | ||||||||||||||||
var/max_recycle = 3 | ||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/Initialize() | ||||||||||||||||
. = ..() | ||||||||||||||||
uses = max_uses | ||||||||||||||||
failmsg = "The [name]'s refill light blinks red." | ||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/empty/Initialize() | ||||||||||||||||
. = ..() | ||||||||||||||||
uses = 0 | ||||||||||||||||
failmsg = "The [name]'s refill light blinks red." | ||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/get_examine_text(mob/user) | ||||||||||||||||
. = ..() | ||||||||||||||||
. += "It has [uses] lights remaining." | ||||||||||||||||
. += "It has [uses] lights remaining, and [recycle] broken lights stored." | ||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/attackby(obj/item/W, mob/user) | ||||||||||||||||
if(istype(W, /obj/item/stack/sheet/glass)) | ||||||||||||||||
|
@@ -83,31 +91,34 @@ | |||||||||||||||
if(L.status == 0) // LIGHT OKAY | ||||||||||||||||
if(uses < max_uses) | ||||||||||||||||
AddUses(1) | ||||||||||||||||
to_chat(user, "You insert the [L.name] into the [src.name]. You have [uses] lights remaining.") | ||||||||||||||||
to_chat(user, SPAN_NOTICE("You insert the [L.name] into the [src.name]. You have [uses] lights remaining.")) | ||||||||||||||||
user.drop_held_item() | ||||||||||||||||
qdel(L) | ||||||||||||||||
return | ||||||||||||||||
else | ||||||||||||||||
to_chat(user, "You need a working light.") | ||||||||||||||||
Recycle() | ||||||||||||||||
to_chat(user, SPAN_NOTICE("You insert the [L.name] into the [src.name] for recycling.")) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
user.drop_held_item() | ||||||||||||||||
qdel(L) | ||||||||||||||||
return | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/attack_self(mob/user) | ||||||||||||||||
..() | ||||||||||||||||
to_chat(usr, "It has [uses] lights remaining.") | ||||||||||||||||
to_chat(usr, "It has [uses] lights remaining, and has [recycle] broken lights stored.") | ||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/update_icon() | ||||||||||||||||
icon_state = "lightreplacer0" | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/proc/Use(mob/user) | ||||||||||||||||
|
||||||||||||||||
playsound(src.loc, 'sound/machines/click.ogg', 25, 1) | ||||||||||||||||
AddUses(-1) | ||||||||||||||||
return 1 | ||||||||||||||||
|
||||||||||||||||
// Negative numbers will subtract | ||||||||||||||||
/obj/item/device/lightreplacer/proc/AddUses(amount = 1) | ||||||||||||||||
playsound(src.loc, 'sound/machines/click.ogg', 25, 1) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
uses = min(max(uses + amount, 0), max_uses) | ||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/proc/Charge(mob/user) | ||||||||||||||||
|
@@ -116,6 +127,17 @@ | |||||||||||||||
AddUses(1) | ||||||||||||||||
charge = 1 | ||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/proc/Recycle(mob/living/U) | ||||||||||||||||
if(recycle == max_recycle) | ||||||||||||||||
recycle = 0 | ||||||||||||||||
AddUses(1) | ||||||||||||||||
playsound(src.loc, 'sound/machines/ding.ogg', 5, 1) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
return | ||||||||||||||||
else | ||||||||||||||||
playsound(src.loc, 'sound/machines/click.ogg', 25, 1) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
recycle += 1 | ||||||||||||||||
return | ||||||||||||||||
Comment on lines
+136
to
+139
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
the else clause is redundant as the previous condition returns |
||||||||||||||||
|
||||||||||||||||
/obj/item/device/lightreplacer/proc/ReplaceLight(obj/structure/machinery/light/target, mob/living/U) | ||||||||||||||||
|
||||||||||||||||
if(target.status != LIGHT_OK) | ||||||||||||||||
|
@@ -125,26 +147,21 @@ | |||||||||||||||
|
||||||||||||||||
if(target.status != LIGHT_EMPTY) | ||||||||||||||||
|
||||||||||||||||
var/obj/item/light_bulb/L1 = new target.light_type(target.loc) | ||||||||||||||||
L1.status = target.status | ||||||||||||||||
L1.rigged = target.rigged | ||||||||||||||||
L1.brightness = target.brightness | ||||||||||||||||
L1.switchcount = target.switchcount | ||||||||||||||||
target.switchcount = 0 | ||||||||||||||||
L1.update() | ||||||||||||||||
|
||||||||||||||||
target.status = LIGHT_EMPTY | ||||||||||||||||
target.update() | ||||||||||||||||
|
||||||||||||||||
var/obj/item/light_bulb/L2 = new target.light_type() | ||||||||||||||||
Recycle() | ||||||||||||||||
|
||||||||||||||||
var/obj/item/light_bulb/bulb = new target.light_type() | ||||||||||||||||
|
||||||||||||||||
target.status = L2.status | ||||||||||||||||
target.switchcount = L2.switchcount | ||||||||||||||||
target.status = bulb.status | ||||||||||||||||
target.switchcount = bulb.switchcount | ||||||||||||||||
target.rigged = FALSE | ||||||||||||||||
target.brightness = L2.brightness | ||||||||||||||||
target.brightness = bulb.brightness | ||||||||||||||||
target.on = target.has_power() | ||||||||||||||||
target.update() | ||||||||||||||||
qdel(L2) | ||||||||||||||||
qdel(bulb) | ||||||||||||||||
|
||||||||||||||||
if(target.on && target.rigged) | ||||||||||||||||
target.explode() | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -758,7 +758,7 @@ | |||||
|
||||||
/obj/item/light_bulb/proc/shatter() | ||||||
if(status == LIGHT_OK || status == LIGHT_BURNED) | ||||||
src.visible_message(SPAN_DANGER("[name] shatters."),SPAN_DANGER("You hear a small glass object shatter.")) | ||||||
src.visible_message(SPAN_DANGER("The [name] shatters."),SPAN_DANGER("You hear a small glass object shatter.")) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
status = LIGHT_BROKEN | ||||||
force = 5 | ||||||
sharp = IS_SHARP_ITEM_SIMPLE | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.