mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-30 07:28:53 +01:00
Stack update
This commit is contained in:
@@ -34,25 +34,29 @@
|
||||
..()
|
||||
if(istype(W,/obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/CC = W
|
||||
if(CC.amount < 5)
|
||||
user << "\b There is not enough wire in this coil. You need 5 lengths."
|
||||
if (get_amount() < 1 || CC.get_amount() < 5)
|
||||
user << "<span class='warning>You need five lengths of coil and one sheet of glass to make wired glass.</span>"
|
||||
return
|
||||
CC.use(5)
|
||||
user << "\blue You attach wire to the [name]."
|
||||
use(1)
|
||||
user << "<span class='notice'>You attach wire to the [name].</span>"
|
||||
new /obj/item/stack/light_w(user.loc)
|
||||
src.use(1)
|
||||
else if( istype(W, /obj/item/stack/rods) )
|
||||
else if(istype(W, /obj/item/stack/rods))
|
||||
var/obj/item/stack/rods/V = W
|
||||
var/obj/item/stack/sheet/rglass/RG = new (user.loc)
|
||||
RG.add_fingerprint(user)
|
||||
RG.add_to_stacks(user)
|
||||
V.use(1)
|
||||
var/obj/item/stack/sheet/glass/G = src
|
||||
src = null
|
||||
var/replace = (user.get_inactive_hand()==G)
|
||||
G.use(1)
|
||||
if (!G && !RG && replace)
|
||||
user.put_in_hands(RG)
|
||||
if (V.get_amount() >= 1 && get_amount() >= 1)
|
||||
var/obj/item/stack/sheet/rglass/RG = new (user.loc)
|
||||
RG.add_fingerprint(user)
|
||||
RG.add_to_stacks(user)
|
||||
var/obj/item/stack/sheet/glass/G = src
|
||||
src = null
|
||||
var/replace = (user.get_inactive_hand()==G)
|
||||
V.use(1)
|
||||
G.use(1)
|
||||
if (!G && replace)
|
||||
user.put_in_hands(RG)
|
||||
else
|
||||
user << "<span class='warning'>You need one rod and one sheet of glass to make reinforced glass.</span>"
|
||||
return
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
|
||||
if(istype(O,/obj/item/stack/sheet/metal))
|
||||
var/obj/item/stack/sheet/metal/M = O
|
||||
M.amount--
|
||||
if(M.amount <= 0)
|
||||
user.drop_from_inventory(M)
|
||||
del(M)
|
||||
amount--
|
||||
new/obj/item/stack/tile/light(user.loc)
|
||||
if(amount <= 0)
|
||||
user.drop_from_inventory(src)
|
||||
del(src)
|
||||
if (M.use(1))
|
||||
use(1)
|
||||
new/obj/item/stack/tile/light(user.loc)
|
||||
user << "<span class='notice'>You make a light tile.</span>"
|
||||
else
|
||||
user << "<span class='warning'>You need one metal sheet to finish the light tile.</span>"
|
||||
return
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
/*
|
||||
* Stacks
|
||||
*/
|
||||
|
||||
/obj/item/stack
|
||||
gender = PLURAL
|
||||
origin_tech = "materials=1"
|
||||
@@ -19,11 +20,11 @@
|
||||
/obj/item/stack/New(var/loc, var/amount=null)
|
||||
..()
|
||||
if (amount)
|
||||
src.amount=amount
|
||||
src.amount = amount
|
||||
return
|
||||
|
||||
/obj/item/stack/Del()
|
||||
if (src && usr && usr.machine==src)
|
||||
if (src && usr && usr.machine == src)
|
||||
usr << browse(null, "window=stack")
|
||||
..()
|
||||
|
||||
@@ -69,12 +70,6 @@
|
||||
var/title as text
|
||||
var/can_build = 1
|
||||
can_build = can_build && (max_multiplier>0)
|
||||
/*
|
||||
if (R.one_per_turf)
|
||||
can_build = can_build && !(locate(R.result_type) in usr.loc)
|
||||
if (R.on_floor)
|
||||
can_build = can_build && istype(usr.loc, /turf/simulated/floor)
|
||||
*/
|
||||
if (R.res_amount>1)
|
||||
title+= "[R.res_amount]x [R.title]\s"
|
||||
else
|
||||
@@ -181,6 +176,9 @@
|
||||
amount += extra
|
||||
return 1
|
||||
|
||||
/obj/item/stack/proc/get_amount()
|
||||
return amount
|
||||
|
||||
/obj/item/stack/proc/add_to_stacks(mob/usr as mob)
|
||||
var/obj/item/stack/oldsrc = src
|
||||
src = null
|
||||
|
||||
Reference in New Issue
Block a user