mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 11:13:16 +00:00
Merge pull request #11241 from Hubblenaut/light_replacer
Amendments to light replacer
This commit is contained in:
@@ -194,13 +194,13 @@ var/list/all_supply_groups = list("Operations","Security","Hospitality","Enginee
|
||||
/datum/supply_packs/janitor
|
||||
name = "Janitorial supplies"
|
||||
contains = list(/obj/item/weapon/reagent_containers/glass/bucket,
|
||||
/obj/item/weapon/reagent_containers/glass/bucket,
|
||||
/obj/item/weapon/reagent_containers/glass/bucket,
|
||||
/obj/item/weapon/mop,
|
||||
/obj/item/weapon/caution,
|
||||
/obj/item/weapon/caution,
|
||||
/obj/item/weapon/caution,
|
||||
/obj/item/weapon/caution,
|
||||
/obj/item/weapon/storage/bag/trash,
|
||||
/obj/item/device/lightreplacer,
|
||||
/obj/item/weapon/reagent_containers/spray/cleaner,
|
||||
/obj/item/weapon/reagent_containers/glass/rag,
|
||||
/obj/item/weapon/grenade/chem_grenade/cleaner,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//
|
||||
// HOW TO REFILL THE DEVICE
|
||||
//
|
||||
// It will need to be manually refilled with lights.
|
||||
// It can be manually refilled or by clicking on a storage item containing lights.
|
||||
// If it's part of a robot module, it will charge when the Robot is inside a Recharge Station.
|
||||
//
|
||||
// EMAGGED FEATURES
|
||||
@@ -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. Refill with working lightbulbs or sheets of glass."
|
||||
|
||||
icon = 'icons/obj/janitor.dmi'
|
||||
icon_state = "lightreplacer0"
|
||||
@@ -51,14 +51,13 @@
|
||||
slot_flags = SLOT_BELT
|
||||
origin_tech = list(TECH_MAGNET = 3, TECH_MATERIAL = 2)
|
||||
|
||||
var/max_uses = 20
|
||||
var/uses = 0
|
||||
var/max_uses = 32
|
||||
var/uses = 32
|
||||
var/emagged = 0
|
||||
var/failmsg = ""
|
||||
var/charge = 0
|
||||
|
||||
/obj/item/device/lightreplacer/New()
|
||||
uses = max_uses / 2
|
||||
failmsg = "The [name]'s refill light blinks red."
|
||||
..()
|
||||
|
||||
@@ -73,8 +72,8 @@
|
||||
user << "<span class='warning'>[src.name] is full.</span>"
|
||||
return
|
||||
else if(G.use(1))
|
||||
AddUses(5)
|
||||
user << "<span class='notice'>You insert a piece of glass into the [src.name]. You have [uses] lights remaining.</span>"
|
||||
AddUses(16) //Autolathe converts 1 sheet into 16 lights.
|
||||
user << "<span class='notice'>You insert a piece of glass into \the [src.name]. You have [uses] light\s remaining.</span>"
|
||||
return
|
||||
else
|
||||
user << "<span class='warning'>You need one sheet of glass to replace lights.</span>"
|
||||
@@ -84,7 +83,7 @@
|
||||
if(L.status == 0) // LIGHT OKAY
|
||||
if(uses < max_uses)
|
||||
AddUses(1)
|
||||
user << "You insert the [L.name] into the [src.name]. You have [uses] lights remaining."
|
||||
user << "You insert \the [L.name] into \the [src.name]. You have [uses] light\s remaining."
|
||||
user.drop_item()
|
||||
qdel(L)
|
||||
return
|
||||
@@ -92,7 +91,6 @@
|
||||
user << "You need a working light."
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/lightreplacer/attack_self(mob/user)
|
||||
/* // This would probably be a bit OP. If you want it though, uncomment the code.
|
||||
if(isrobot(user))
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
//Set the stop_messages to stop it from printing messages
|
||||
/obj/item/weapon/storage/proc/can_be_inserted(obj/item/W as obj, stop_messages = 0)
|
||||
if(!istype(W)) return //Not an item
|
||||
|
||||
|
||||
if(!usr.canUnEquip(W))
|
||||
return 0
|
||||
|
||||
@@ -340,6 +340,21 @@
|
||||
if(isrobot(user))
|
||||
return //Robots can't interact with storage items.
|
||||
|
||||
if(istype(W, /obj/item/device/lightreplacer))
|
||||
var/obj/item/device/lightreplacer/LP = W
|
||||
var/amt_inserted = 0
|
||||
var/turf/T = get_turf(user)
|
||||
for(var/obj/item/weapon/light/L in src.contents)
|
||||
if(L.status == 0)
|
||||
if(LP.uses < LP.max_uses)
|
||||
LP.AddUses(1)
|
||||
amt_inserted++
|
||||
remove_from_storage(L, T)
|
||||
qdel(L)
|
||||
if(amt_inserted)
|
||||
user << "You inserted [amt_inserted] light\s into \the [LP.name]. You have [LP.uses] light\s remaining."
|
||||
return
|
||||
|
||||
if(!can_be_inserted(W))
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user