Skip to content

Commit

Permalink
Pens can now be placed on top of paper bins :shock: 🚀 (tgstation#22195)
Browse files Browse the repository at this point in the history
* pens can now be placed on top of paper bins :shock: 🚀

* refactor

* fix
  • Loading branch information
Mervill authored and optimumtact committed Dec 18, 2016
1 parent f2e96fd commit 309adf9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/onehalf.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"ci" = (/obj/structure/lattice,/obj/structure/disposalpipe/broken{tag = "icon-pipe-b (EAST)"; icon_state = "pipe-b"; dir = 4},/obj/structure/disposalpipe/broken{tag = "icon-pipe-b (WEST)"; icon_state = "pipe-b"; dir = 8},/obj/item/stack/rods,/turf/open/space,/area/ruin/onehalf/hallway)
"cj" = (/obj/structure/lattice,/obj/structure/disposalpipe/segment{dir = 4},/obj/item/weapon/shard{icon_state = "small"},/turf/open/space,/area/space)
"ck" = (/obj/structure/grille,/obj/structure/window/reinforced/fulltile,/obj/structure/disposalpipe/segment{dir = 4},/obj/machinery/door/poddoor/preopen{id = "bridge_onehalf"; name = "bridge blast door"},/turf/open/floor/plating,/area/ruin/onehalf/bridge)
"cl" = (/obj/structure/disposalpipe/segment{dir = 2; icon_state = "pipe-c"},/obj/structure/table/reinforced,/obj/item/weapon/paper_bin{amount = 12},/turf/open/floor/plasteel,/area/ruin/onehalf/bridge)
"cl" = (/obj/structure/disposalpipe/segment{dir = 2; icon_state = "pipe-c"},/obj/structure/table/reinforced,/obj/item/weapon/paper_bin{total_paper = 12},/turf/open/floor/plasteel,/area/ruin/onehalf/bridge)
"cm" = (/obj/structure/chair/office{dir = 8},/turf/open/floor/plasteel,/area/ruin/onehalf/bridge)
"cn" = (/turf/open/floor/plasteel,/area/ruin/onehalf/bridge)
"co" = (/obj/structure/chair/office{tag = "icon-chair (NORTH)"; icon_state = "chair"; dir = 1},/turf/open/floor/plasteel,/area/ruin/onehalf/bridge)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/fireplace.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
user.visible_message("<span class='notice'>[user] throws [T] into \
[src].</span>", "<span class='notice'>You add [T] to [src].\
</span>")
adjust_fuel_timer(PAPER_BURN_TIMER * paper_bin.amount)
adjust_fuel_timer(PAPER_BURN_TIMER * paper_bin.total_paper)
qdel(paper_bin)
else if(istype(T, /obj/item/weapon/paper))
user.visible_message("<span class='notice'>[user] throws [T] into \
Expand Down
56 changes: 43 additions & 13 deletions code/modules/paperwork/paperbin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@
throw_speed = 3
throw_range = 7
pressure_resistance = 8
var/amount = 30 //How much paper is in the bin.
var/list/papers = list() //List of papers put in the bin for reference.
var/total_paper = 30
var/list/papers = list()
var/obj/item/weapon/pen/bin_pen

/obj/item/weapon/paper_bin/initialize()
var/obj/item/weapon/pen/P = locate(/obj/item/weapon/pen) in src.loc
if(P && !bin_pen)
P.loc = src
bin_pen = P
update_icon()
var/static/warned = FALSE
if(!warned)
warning("one or more paperbins ate a pen duing initialize()")
warned = TRUE

/obj/item/weapon/paper_bin/fire_act(exposed_temperature, exposed_volume)
if(!amount)
if(!total_paper)
return
..()

Expand All @@ -25,8 +37,8 @@
. = ..()

/obj/item/weapon/paper_bin/fire_act(exposed_temperature, exposed_volume)
if(amount)
amount = 0
if(total_paper)
total_paper = 0
update_icon()
..()

Expand Down Expand Up @@ -56,12 +68,19 @@
if(user.lying)
return
user.changeNext_move(CLICK_CD_MELEE)
if(amount >= 1)
amount--
if(bin_pen)
var/obj/item/weapon/pen/P = bin_pen
P.loc = user.loc
user.put_in_hands(P)
user << "<span class='notice'>You take [P] out of \the [src].</span>"
bin_pen = null
update_icon()

else if(total_paper >= 1)
total_paper--
update_icon()
// If there's any custom paper on the stack, use that instead of creating a new paper.
var/obj/item/weapon/paper/P
if(papers.len > 0) //If there's any custom paper on the stack, use that instead of creating a new paper.
if(papers.len > 0)
P = papers[papers.len]
papers.Remove(P)
else
Expand Down Expand Up @@ -89,21 +108,32 @@
P.loc = src
user << "<span class='notice'>You put [P] in [src].</span>"
papers.Add(P)
amount++
total_paper++
update_icon()
else if(istype(I, /obj/item/weapon/pen))
var/obj/item/weapon/pen/P = I
if(!user.unEquip(P))
return
P.loc = src
user << "<span class='notice'>You put [P] in [src].</span>"
bin_pen = P
update_icon()
else
return ..()

/obj/item/weapon/paper_bin/examine(mob/user)
..()
if(amount)
user << "It contains " + (amount > 1 ? "[amount] papers" : " one paper")+"."
if(total_paper)
user << "It contains " + (total_paper > 1 ? "[total_paper] papers" : " one paper")+"."
else
user << "It doesn't contain anything."


/obj/item/weapon/paper_bin/update_icon()
if(amount < 1)
if(total_paper < 1)
icon_state = "paper_bin0"
else
icon_state = "paper_bin1"
cut_overlays()
if(bin_pen)
add_overlay(image(icon=bin_pen.icon,icon_state=bin_pen.icon_state))

0 comments on commit 309adf9

Please sign in to comment.