Skip to content

Commit

Permalink
0651
Browse files Browse the repository at this point in the history
  • Loading branch information
Very-Soft committed Dec 6, 2024
2 parents 216e35b + 2c6bfc4 commit ddbef21
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions code/modules/mob/living/item_storage.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
TO DO:
Figure out how often the time codes get updated, to make sure multiple store instances won't duplicate the code
*/

#define item_storage_maximum 50

var/global/list/permanent_unlockables = list(
/obj/item/weapon/gun/energy/sizegun
)

/datum/etching
var/triangles = 0 //Triangle money
var/list/item_storage = list() //Various items that are stored in the bank, these can only be stored and pulled out once
var/list/unlockables = list() //Scene items that, once stored, can be pulled once per round forever.

/datum/etching/proc/store_item(item,var/obj/machinery/item_bank/bank)
if(!isobj(item))
return
var/obj/O = item
if(O.type in permanent_unlockables && O.persist_storable)
to_world("WOW YOU GOT AN UNLOCKABLE WOAH!!!")

else if(!istool(O) && O.persist_storable)
if(item_storage.len >= item_storage_maximum)
to_chat(ourmob, "<span class='warning'>You can not store \the [O]. Your lockbox is too full.</span>")
bank.busy_bank = FALSE
return
var/choice = tgui_alert(ourmob, "If you store \the [O], anything it contains may be lost to \the [bank]. Are you sure?", "[bank]", list("Store", "Cancel"), timeout = 10 SECONDS)
if(!choice || choice == "Cancel" || !bank.Adjacent(ourmob) || bank.inoperable() || bank.panel_open)
bank.busy_bank = FALSE
return
for(var/obj/check in O.contents)
if(!check.persist_storable)
to_chat(ourmob, "<span class='warning'>\The [bank] buzzes. \The [O] contains [check], which cannot be stored. Please remove this item before attempting to store \the [O]. As a reminder, any contents of \the [O] will be lost if you store it with contents.</span>")
bank.busy_bank = FALSE
return
ourmob.visible_message("<span class='notice'>\The [ourmob] begins storing \the [O] in \the [bank].</span>","<span class='notice'>You begin storing \the [O] in \the [bank].</span>")
bank.icon_state = "item_bank_o"
if(!do_after(ourmob, 10 SECONDS, bank, exclusive = TASK_ALL_EXCLUSIVE) || bank.inoperable())
bank.busy_bank = FALSE
bank.icon_state = "item_bank"
return
save_item(O)
ourmob.visible_message("<span class='notice'>\The [ourmob] stores \the [O] in \the [bank].</span>","<span class='notice'>You stored \the [O] in \the [bank].</span>")
log_admin("[key_name_admin(ourmob)] stored [O] in the item bank.")
qdel(O)
bank.busy_bank = FALSE
bank.icon_state = "item_bank"
else
to_chat(ourmob, "<span class='warning'>You cannot store \the [O]. \The [bank] either does not accept that, or it has already been retrieved from storage this shift.</span>")
bank.busy_bank = FALSE

/datum/etching/proc/save_item(var/obj/O)
item_storage += list("[initial(O.name)] - [time2text(world.realtime, "YYYYMMDDhhmmss")]" = O.type)
needs_saving = TRUE

/datum/etching/proc/legacy_conversion(I_name,I_type)
item_storage += list("[I_name] - [time2text(world.realtime, "YYYYMMDDhhmmss")]" = I_type)
needs_saving = TRUE

/datum/etching/update_etching(mode, value)
. = ..()
switch(mode)
if("triangles")
triangles += value

/datum/etching/proc/report_money()
. = "<span class='boldnotice'>◬</span>: [triangles]\n\n"
return .

0 comments on commit ddbef21

Please sign in to comment.