[MIRROR] Port material containers to datum components (#2562)

* Port material containers to datum components

* Fixes Rej
This commit is contained in:
CitadelStationBot
2017-09-04 04:08:42 -05:00
committed by Poojawa
parent a4c92a8155
commit 32300086d5
20 changed files with 373 additions and 363 deletions
+8 -22
View File
@@ -5,12 +5,11 @@
desc = "Lost prototype of advanced clown tech. Powered by bananium, these shoes leave a trail of chaos in their wake."
icon_state = "clown_prototype_off"
var/on = FALSE
var/datum/material_container/bananium
actions_types = list(/datum/action/item_action/toggle)
/obj/item/clothing/shoes/clown_shoes/banana_shoes/New()
..()
bananium = new/datum/material_container(src,list(MAT_BANANIUM),200000)
/obj/item/clothing/shoes/clown_shoes/banana_shoes/Initialize()
. = ..()
AddComponent(/datum/component/material_container, list(MAT_BANANIUM), 200000, TRUE)
/obj/item/clothing/shoes/clown_shoes/banana_shoes/step_action()
if(on)
@@ -21,6 +20,7 @@
footstep++
new/obj/item/grown/bananapeel/specialpeel(get_step(src,turn(usr.dir, 180))) //honk
GET_COMPONENT(bananium, /datum/component/material_container)
bananium.use_amount_type(100, MAT_BANANIUM)
if(bananium.amount(MAT_BANANIUM) < 100)
on = !on
@@ -31,33 +31,19 @@
..()
/obj/item/clothing/shoes/clown_shoes/banana_shoes/attack_self(mob/user)
GET_COMPONENT(bananium, /datum/component/material_container)
var/sheet_amount = bananium.retrieve_all()
if(sheet_amount)
to_chat(user, "<span class='notice'>You retrieve [sheet_amount] sheets of bananium from the prototype shoes.</span>")
else
to_chat(user, "<span class='notice'>You cannot retrieve any bananium from the prototype shoes.</span>")
/obj/item/clothing/shoes/clown_shoes/banana_shoes/attackby(obj/item/O, mob/user, params)
if(!bananium.get_item_material_amount(O))
to_chat(user, "<span class='notice'>This item has no bananium!</span>")
return
if(!user.dropItemToGround(O))
to_chat(user, "<span class='notice'>You can't drop [O]!</span>")
return
var/bananium_amount = bananium.insert_item(O)
if(bananium_amount)
to_chat(user, "<span class='notice'>You insert [O] into the prototype shoes.</span>")
qdel(O)
else
to_chat(user, "<span class='notice'>You are unable to insert more bananium!</span>")
/obj/item/clothing/shoes/clown_shoes/banana_shoes/examine(mob/user)
..()
var/ban_amt = bananium.amount(MAT_BANANIUM)
to_chat(user, "<span class='notice'>The shoes are [on ? "enabled" : "disabled"]. There is [ban_amt ? ban_amt : "no"] bananium left.</span>")
to_chat(user, "<span class='notice'>The shoes are [on ? "enabled" : "disabled"]</span>")
/obj/item/clothing/shoes/clown_shoes/banana_shoes/ui_action_click(mob/user)
GET_COMPONENT(bananium, /datum/component/material_container)
if(bananium.amount(MAT_BANANIUM))
on = !on
update_icon()
@@ -77,4 +63,4 @@
usr.update_inv_shoes()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
A.UpdateButtonIcon()