Stack update

This commit is contained in:
Kelenius
2014-09-02 09:59:32 +04:00
parent fac6666b58
commit 505f857eb8
53 changed files with 447 additions and 457 deletions

View File

@@ -102,20 +102,20 @@
if(L)
return
var/obj/item/stack/rods/R = C
user << "\blue Constructing support lattice ..."
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice()
R.use(1)
if (R.use(1))
user << "\blue Constructing support lattice ..."
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice()
return
if (istype(C, /obj/item/stack/tile/plasteel))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
var/obj/item/stack/tile/plasteel/S = C
del(L)
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1)
S.build(src)
S.use(1)
if (S.use(1))
del(L)
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1)
S.build(src)
return
else
user << "\red The plating is going to need some support."

View File

@@ -74,6 +74,6 @@ datum/directive/research_to_ripleys/get_remaining_orders()
for(var/atom/A in sold)
if(istype(A, /obj/item/stack/sheet/mineral) || istype(A, /obj/item/stack/sheet/metal))
var/obj/item/stack/S = A
D.materials_shipped += S.amount
D.materials_shipped += S.get_amount()
return 1

View File

@@ -928,8 +928,10 @@ datum
var/target_amount = 10
var/found_amount = 0.0//Always starts as zero.
for(var/obj/item/I in owner.current.get_contents())
if(!istype(I, steal_target)) continue//If it's not actually that item.
found_amount += I:amount
if(!istype(I, steal_target))
continue//If it's not actually that item.
var/obj/item/stack/sheet/diamond/D = I
found_amount += D.get_amount()
return found_amount>=target_amount
gold
@@ -957,8 +959,10 @@ datum
var/target_amount = 50
var/found_amount = 0.0//Always starts as zero.
for(var/obj/item/I in owner.current.get_contents())
if(!istype(I, steal_target)) continue//If it's not actually that item.
found_amount += I:amount
if(!istype(I, steal_target))
continue//If it's not actually that item.
var/obj/item/stack/sheet/gold/G = I
found_amount += G.get_amount()
return found_amount>=target_amount
uranium
@@ -986,8 +990,10 @@ datum
var/target_amount = 25
var/found_amount = 0.0//Always starts as zero.
for(var/obj/item/I in owner.current.get_contents())
if(!istype(I, steal_target)) continue//If it's not actually that item.
found_amount += I:amount
if(!istype(I, steal_target))
continue//If it's not actually that item.
var/obj/item/stack/sheet/uranium/U = I
found_amount += U.get_amount()
return found_amount>=target_amount

View File

@@ -894,12 +894,12 @@ datum/objective/heist/salvage
if(istype(O,/obj/item/stack/sheet))
if(O.name == target)
S = O
total_amount += S.amount
total_amount += S.get_amount()
for(var/obj/I in O.contents)
if(istype(I,/obj/item/stack/sheet))
if(I.name == target)
S = I
total_amount += S.amount
total_amount += S.get_amount()
var/datum/game_mode/heist/H = ticker.mode
for(var/datum/mind/raider in H.raiders)
@@ -908,7 +908,7 @@ datum/objective/heist/salvage
if(istype(O,/obj/item/stack/sheet))
if(O.name == target)
var/obj/item/stack/sheet/S = O
total_amount += S.amount
total_amount += S.get_amount()
if(total_amount >= target_amount) return 1
return 0

View File

@@ -1125,20 +1125,16 @@ table tr:first-child th:first-child { border: none;}
if(1)
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = W
if(coil.amount < 5)
user << "You need more cable for this!"
var/obj/item/stack/cable_coil/C = W
if (C.use(5))
user << "<span class='notice'>You wire \the [src].</span>"
buildstage = 2
update_icon()
first_run()
return
else
user << "<span class='warning'>You need 5 pieces of cable to do wire \the [src].</span>"
return
user << "You wire \the [src]!"
coil.amount -= 5
if(!coil.amount)
del(coil)
buildstage = 2
update_icon()
first_run()
return
else if(istype(W, /obj/item/weapon/crowbar))
user << "You start prying out the circuit."
@@ -1316,19 +1312,14 @@ FIRE ALARM
user.visible_message("\red [user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.")
if(1)
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = W
if(coil.amount < 5)
user << "You need more cable for this!"
var/obj/item/stack/cable_coil/C = W
if (C.use(5))
user << "<span class='notice'>You wire \the [src].</span>"
buildstage = 2
return
else
user << "<span class='warning'>You need 5 pieces of cable to do wire \the [src].</span>"
return
coil.amount -= 5
if(!coil.amount)
del(coil)
buildstage = 2
user << "You wire \the [src]!"
update_icon()
else if(istype(W, /obj/item/weapon/crowbar))
user << "You pry out the circuit!"
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)

View File

@@ -152,7 +152,7 @@
//If it's a stack, we eat multiple sheets.
if(istype(eating,/obj/item/stack))
var/obj/item/stack/stack = eating
total_material *= stack.amount
total_material *= stack.get_amount()
if(stored_material[material] + total_material > storage_capacity[material])
total_material = storage_capacity[material] - stored_material[material]

View File

@@ -959,16 +959,18 @@ Auto Patrol: []"},
icon_state = "[lasercolor]ed209_prox"
if(6)
if( istype(W, /obj/item/stack/cable_coil) )
var/obj/item/stack/cable_coil/coil = W
var/turf/T = get_turf(user)
user << "<span class='notice'>You start to wire [src]...</span>"
sleep(40)
if(get_turf(user) == T && build_step == 6)
coil.use(1)
build_step++
user << "<span class='notice'>You wire the ED-209 assembly.</span>"
name = "wired ED-209 assembly"
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
if (C.get_amount() < 1)
user << "<span class='warning'>You need one coil of wire to do wire [src].</span>"
return
user << "<span class='notice'>You start to wire [src].</span>"
if (do_after(user, 40) && build_step == 6)
if (C.use(1))
build_step++
user << "<span class='notice'>You wire the ED-209 assembly.</span>"
name = "wired ED-209 assembly"
return
if(7)
switch(lasercolor)

View File

@@ -103,7 +103,7 @@
var/obj/item/stack/tile/plasteel/T = W
if(src.amount >= 50)
return
var/loaded = min(50-src.amount, T.amount)
var/loaded = min(50-src.amount, T.get_amount())
T.use(loaded)
src.amount += loaded
user << "<span class='notice'>You load [loaded] tiles into the floorbot. He now contains [src.amount] tiles.</span>"
@@ -325,12 +325,12 @@
src.target = null
src.repairing = 0
return
if(src.amount + T.amount > 50)
if(src.amount + T.get_amount() > 50)
var/i = 50 - src.amount
src.amount += i
T.amount -= i
T.use(i)
else
src.amount += T.amount
src.amount += T.get_amount()
del(T)
src.updateicon()
src.target = null
@@ -339,7 +339,7 @@
/obj/machinery/bot/floorbot/proc/maketile(var/obj/item/stack/sheet/metal/M)
if(!istype(M, /obj/item/stack/sheet/metal))
return
if(M.amount > 1)
if(M.get_amount() > 1)
return
visible_message("\red [src] begins to create tiles.")
src.repairing = 1
@@ -400,12 +400,15 @@
return
if(user.s_active)
user.s_active.close(user)
del(T)
var/obj/item/weapon/toolbox_tiles/B = new /obj/item/weapon/toolbox_tiles
user.put_in_hands(B)
user << "<span class='notice'>You add the tiles into the empty toolbox. They protrude from the top.</span>"
user.drop_from_inventory(src)
del(src)
if (T.use(10))
var/obj/item/weapon/toolbox_tiles/B = new /obj/item/weapon/toolbox_tiles
user.put_in_hands(B)
user << "<span class='notice'>You add the tiles into the empty toolbox. They protrude from the top.</span>"
user.drop_from_inventory(src)
del(src)
else
user << "<span class='warning'>You need 10 floortiles for a floorbot.</span>"
return
/obj/item/weapon/toolbox_tiles/attackby(var/obj/item/W, mob/user as mob)
..()

View File

@@ -58,8 +58,10 @@
if(iscoil(W))
var/obj/item/stack/cable_coil/C = W
if(C.use(2))
user << "You add wires to the assembly."
user << "<span class='notice'>You add wires to the assembly.</span>"
state = 3
else
user << "<span class='warning'>You need 2 coils of wire to wire the assembly.</span>"
return
else if(iswelder(W))

View File

@@ -63,14 +63,18 @@
state = 1
icon_state = "1"
if(istype(P, /obj/item/stack/cable_coil))
if(P:amount >= 5)
playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
P:amount -= 5
if(!P:amount) del(P)
user << "\blue You add cables to the frame."
var/obj/item/stack/cable_coil/C = P
if (C.get_amount() < 5)
user << "<span class='warning'>You need five coils of wire to add them to the frame.</span>"
return
user << "<span class='notice'>You start to add cables to the frame.</span>"
playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
if (do_after(user, 20) && state == 2)
if (C.use(5))
state = 3
icon_state = "3"
user << "<span class='notice'>You add cables to the frame.</span>"
return
if(3)
if(istype(P, /obj/item/weapon/wirecutters))
if (brain)
@@ -84,15 +88,17 @@
A.amount = 5
if(istype(P, /obj/item/stack/sheet/rglass))
if(P:amount >= 2)
playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if (P)
P:amount -= 2
if(!P:amount) del(P)
user << "\blue You put in the glass panel."
state = 4
icon_state = "4"
var/obj/item/stack/sheet/rglass/RG = P
if (RG.get_amount() < 2)
user << "<span class='warning'>You need two sheets of glass to put in the glass panel.</span>"
return
user << "<span class='notice'>You start to put in the glass panel.</span>"
playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
if (do_after(user, 20) && state == 3)
if(RG.use(2))
user << "<span class='notice'>You put in the glass panel.</span>"
state = 4
icon_state = "4"
if(istype(P, /obj/item/weapon/aiModule/asimov))
laws.add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.")

View File

@@ -403,15 +403,17 @@
src.state = 1
src.icon_state = "1"
if(istype(P, /obj/item/stack/cable_coil))
if(P:amount >= 5)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if(P)
P:amount -= 5
if(!P:amount) del(P)
user << "\blue You add cables to the frame."
src.state = 3
src.icon_state = "3"
var/obj/item/stack/cable_coil/C = P
if (C.get_amount() < 5)
user << "<span class='warning'>You need five coils of wire to add them to the frame.</span>"
return
user << "<span class='notice'>You start to add cables to the frame.</span>"
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20) && state == 2)
if (C.use(5))
user << "<span class='notice'>You add cables to the frame.</span>"
state = 3
icon_state = "3"
if(3)
if(istype(P, /obj/item/weapon/wirecutters))
playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1)
@@ -422,14 +424,17 @@
A.amount = 5
if(istype(P, /obj/item/stack/sheet/glass))
if(P:amount >= 2)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if(P)
P:use(2)
user << "\blue You put in the glass panel."
src.state = 4
src.icon_state = "4"
var/obj/item/stack/sheet/glass/G = P
if (G.get_amount() < 2)
user << "<span class='warning'>You need two sheets of glass to put in the glass panel.</span>"
return
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
user << "<span class='notice'>You start to put in the glass panel.</span>"
if(do_after(user, 20) && state == 3)
if (G.use(2))
user << "<span class='notice'>You put in the glass panel.</span>"
src.state = 4
src.icon_state = "4"
if(4)
if(istype(P, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)

View File

@@ -36,16 +36,16 @@
if(1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = P
if(C.amount >= 5)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
user << "\blue You start to add cables to the frame."
if(do_after(user, 20))
if(C)
C.amount -= 5
if(!C.amount) del(C)
user << "\blue You add cables to the frame."
state = 2
icon_state = "box_1"
if (C.get_amount() < 5)
user << "<span class='warning'>You need five lengths of cable to add them to the frame.</span>"
return
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
user << "<span class='notice'>You start to add cables to the frame.</span>"
if(do_after(user, 20) && state == 1)
if(C.use(5))
user << "<span class='notice'>You add cables to the frame.</span>"
state = 2
icon_state = "box_1"
else
if(istype(P, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
@@ -134,7 +134,7 @@
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/CP = P
if(CP.amount > 1)
if(CP.get_amount() > 1)
var/camt = min(CP.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided
var/obj/item/stack/cable_coil/CC = new /obj/item/stack/cable_coil(src)
CC.amount = camt

View File

@@ -67,15 +67,17 @@ for reference:
attackby(obj/item/W as obj, mob/user as mob)
if (istype(W, /obj/item/stack/sheet/wood))
if (src.health < src.maxhealth)
visible_message("\red [user] begins to repair \the [src]!")
if(do_after(user,20))
src.health = src.maxhealth
W:use(1)
visible_message("\red [user] repairs \the [src]!")
var/obj/item/stack/sheet/wood/D = W
if (health < maxhealth)
if (D.get_amount() < 1)
user << "<span class='warning'>You need one plank of wood to repair \the [src].</span>"
return
visible_message("<span class='notice'>[user] begins to repair \the [src].</span>")
if(do_after(user,20) && health < maxhealth)
if (D.use(1))
health = maxhealth
visible_message("<span class='notice'>[user] repairs \the [src].</span>")
return
else
return
return
else
switch(W.damtype)

View File

@@ -104,9 +104,10 @@
if (contents.len>=max_n_of_items)
user << "\red This [src] is full of ingredients, you cannot put more."
return 1
if (istype(O,/obj/item/stack) && O:amount>1)
if(istype(O, /obj/item/stack) && O:get_amount() > 1) // This is bad, but I can't think of how to change it
var/obj/item/stack/S = O
new O.type (src)
O:use(1)
S.use(1)
user.visible_message( \
"\blue [user] has added one of [O] to \the [src].", \
"\blue You add one of [O] to \the [src].")

View File

@@ -707,14 +707,14 @@ Status: []<BR>"},
if(1)
if(istype(W, /obj/item/stack/sheet/metal))
if(W:amount>=2) // requires 2 metal sheets
user << "\blue You add some metal armor to the interior frame."
var/obj/item/stack/sheet/metal/M = W
if (M.use(2))
user << "<span class='notice'>You add some metal armor to the interior frame.</span>"
build_step = 2
W:amount -= 2
icon_state = "turret_frame2"
if(W:amount <= 0)
del(W)
return
else
user << "<span class='warning'>You need two sheets of metal to add armor ot the frame.</span>"
return
else if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
@@ -784,13 +784,13 @@ Status: []<BR>"},
if(6)
if(istype(W, /obj/item/stack/sheet/metal))
if(W:amount>=2)
user << "\blue You add some metal armor to the exterior frame."
var/obj/item/stack/sheet/metal/M = W
if (M.use(2))
user << "<span class='notice'>You add some metal armor to the exterior frame.</span>"
build_step = 7
W:amount -= 2
if(W:amount <= 0)
del(W)
return
else
user << "<span class='warning'>You need two sheets of metal to add armor to the frame.</span>"
return
else if(istype(W, /obj/item/weapon/screwdriver))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)

View File

@@ -13,21 +13,19 @@
/obj/machinery/robotic_fabricator/attackby(var/obj/item/O as obj, var/mob/user as mob)
if (istype(O, /obj/item/stack/sheet/metal))
var/obj/item/stack/sheet/metal/M = O
if (src.metal_amount < 150000.0)
var/count = 0
src.overlays += "fab-load-metal"
spawn(15)
if(O)
if(!O:amount)
if(M)
if(!M.get_amount())
return
while(metal_amount < 150000 && O:amount)
while(metal_amount < 150000 && M.amount)
src.metal_amount += O.matter["metal"] /*O:height * O:width * O:length * 100000.0*/
O:amount--
M.use(1)
count++
if (O:amount < 1)
del(O)
user << "You insert [count] metal sheet\s into the fabricator."
src.overlays -= "fab-load-metal"
updateDialog()

View File

@@ -36,8 +36,8 @@ obj/machinery/seed_extractor/attackby(var/obj/item/O as obj, var/mob/user as mob
//Grass.
else if(istype(O, /obj/item/stack/tile/grass))
var/obj/item/stack/tile/grass/S = O
user << "<span class='notice'>You extract some seeds from the [S.name].</span>"
S.use(1)
new /obj/item/seeds/grassseed(loc)
if (S.use(1))
user << "<span class='notice'>You extract some seeds from the [S.name].</span>"
new /obj/item/seeds/grassseed(loc)
return

View File

@@ -26,9 +26,9 @@
if(istype(P, /obj/item/stack/nanopaste))
var/obj/item/stack/nanopaste/T = P
if (integrity < 100) //Damaged, let's repair!
integrity = between(0, integrity + rand(10,20), 100)
T.use(1)
usr << "You apply the Nanopaste to [src], repairing some of the damage."
if (T.use(1))
integrity = between(0, integrity + rand(10,20), 100)
usr << "You apply the Nanopaste to [src], repairing some of the damage."
else
usr << "This machine is already in perfect condition."
return
@@ -64,14 +64,12 @@
if(3)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/A = P
if(A.amount >= 5)
user << "You insert the cables."
A.amount -= 5
if(A.amount <= 0)
user.drop_item()
del(A)
construct_op --
if (A.use(5))
user << "<span class='notice'>You insert the cables.</span>"
construct_op--
stat &= ~BROKEN // the machine's not borked anymore!
else
user << "<span class='warning'>You need five coils of wire for this.</span>"
if(istype(P, /obj/item/weapon/crowbar))
user << "You begin prying out the circuit board other components..."
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)

View File

@@ -700,8 +700,7 @@
else if(istype(W, /obj/item/stack/cable_coil))
if(state == 3 && hasInternalDamage(MECHA_INT_SHORT_CIRCUIT))
var/obj/item/stack/cable_coil/CC = W
if(CC.amount > 1)
CC.use(2)
if(CC.use(2))
clearInternalDamage(MECHA_INT_SHORT_CIRCUIT)
user << "You replace the fused wires."
else

View File

@@ -20,15 +20,14 @@
else if(istype(used_atom, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = used_atom
if(C.amount<4)
if(C.use(4))
playsound(holder, 'sound/items/Deconstruct.ogg', 50, 1)
else
user << ("There's not enough cable to finish the task.")
return 0
else
C.use(4)
playsound(holder, 'sound/items/Deconstruct.ogg', 50, 1)
else if(istype(used_atom, /obj/item/stack))
var/obj/item/stack/S = used_atom
if(S.amount < 5)
if(S.get_amount() < 5)
user << ("There's not enough material in this stack.")
return 0
else
@@ -53,15 +52,14 @@
else if(istype(used_atom, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = used_atom
if(C.amount<4)
if(C.use(4))
playsound(holder, 'sound/items/Deconstruct.ogg', 50, 1)
else
user << ("There's not enough cable to finish the task.")
return 0
else
C.use(4)
playsound(holder, 'sound/items/Deconstruct.ogg', 50, 1)
else if(istype(used_atom, /obj/item/stack))
var/obj/item/stack/S = used_atom
if(S.amount < 5)
if(S.get_amount() < 5)
user << ("There's not enough material in this stack.")
return 0
else

View File

@@ -55,10 +55,6 @@
var/uses = 0
var/emagged = 0
var/failmsg = ""
// How much to increase per each glass?
var/increment = 5
// How much to take from the glass?
var/decrement = 1
var/charge = 1
/obj/item/device/lightreplacer/New()
@@ -78,18 +74,15 @@
if(istype(W, /obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/glass/G = W
if(G.amount - decrement >= 0 && uses < max_uses)
var/remaining = max(G.amount - decrement, 0)
if(!remaining && !(G.amount - decrement) == 0)
user << "There isn't enough glass."
return
G.amount = remaining
if(!G.amount)
user.drop_item()
del(G)
AddUses(increment)
user << "You insert a piece of glass into the [src.name]. You have [uses] lights remaining."
if(uses >= max_uses)
user << "<span class='warning'>[src.name] is full."
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>"
return
else
user << "<span class='warning'>You need one sheet of glass to replace lights.</span>"
if(istype(W, /obj/item/weapon/light))
var/obj/item/weapon/light/L = W

View File

@@ -104,14 +104,17 @@
/obj/item/robot_parts/robot_suit/attackby(obj/item/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/stack/sheet/metal) && !l_arm && !r_arm && !l_leg && !r_leg && !chest && !head)
var/obj/item/weapon/ed209_assembly/B = new /obj/item/weapon/ed209_assembly
B.loc = get_turf(src)
user << "You armed the robot frame"
W:use(1)
if (user.get_inactive_hand()==src)
user.before_take_item(src)
user.put_in_inactive_hand(B)
del(src)
var/obj/item/stack/sheet/metal/M = W
if (M.use(1))
var/obj/item/weapon/ed209_assembly/B = new /obj/item/weapon/ed209_assembly
B.loc = get_turf(src)
user << "<span class='notice'>You armed the robot frame.</span>"
if (user.get_inactive_hand()==src)
user.before_take_item(src)
user.put_in_inactive_hand(B)
del(src)
else
user << "<span class='warning'>You need one sheet of metal to arm the robot frame.</span>"
if(istype(W, /obj/item/robot_parts/l_leg))
if(src.l_leg) return
user.drop_item()

View File

@@ -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 ..()

View File

@@ -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

View File

@@ -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

View File

@@ -132,13 +132,13 @@ var/last_chew = 0
..()
if(istype(I, /obj/item/stack/rods))
var/obj/item/stack/rods/R = I
var/obj/item/weapon/wirerod/W = new /obj/item/weapon/wirerod
R.use(1)
if (R.use(1))
var/obj/item/weapon/wirerod/W = new /obj/item/weapon/wirerod
user.put_in_hands(W)
user << "<span class='notice'>You wrap the cable restraint around the top of the rod.</span>"
del(src)
update_icon(user)
user.put_in_hands(W)
user << "<span class='notice'>You wrap the cable restraint around the top of the rod.</span>"
del(src)
update_icon(user)
/obj/item/weapon/handcuffs/cyborg

View File

@@ -18,13 +18,13 @@
//SN src = null
del(src)
if (istype(W, /obj/item/stack/rods))
if (W:amount >= 4)
new /obj/item/weapon/table_parts/reinforced( user.loc )
user << "\blue You reinforce the [name]."
W:use(4)
var/obj/item/stack/rods/R = W
if (R.use(4))
new /obj/item/weapon/table_parts/reinforced(user.loc)
user << "<span class='notice'>You reinforce the [name].</span>"
del(src)
else if (W:amount < 4)
user << "\red You need at least four rods to do this."
else
user << "<span class='warning'>You need at least four rods to reinforce the [name].</span>"
/obj/item/weapon/table_parts/attack_self(mob/user as mob)
new /obj/structure/table( user.loc )

View File

@@ -76,14 +76,14 @@
else if(istype(W, /obj/item/weapon/packageWrap))
return
else if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
if(rigged)
user << "<span class='notice'>[src] is already rigged!</span>"
return
user << "<span class='notice'>You rig [src].</span>"
user.drop_item()
del(W)
rigged = 1
return
if (C.use(1))
user << "<span class='notice'>You rig [src].</span>"
rigged = 1
return
else if(istype(W, /obj/item/device/radio/electropack))
if(rigged)
user << "<span class='notice'>You attach [W] to [src].</span>"

View File

@@ -184,14 +184,16 @@ obj/structure/door_assembly
user << "\blue You [anchored? "un" : ""]secured the airlock assembly!"
anchored = !anchored
else if(istype(W, /obj/item/stack/cable_coil) && state == 0 && anchored )
var/obj/item/stack/cable_coil/coil = W
else if(istype(W, /obj/item/stack/cable_coil) && state == 0 && anchored)
var/obj/item/stack/cable_coil/C = W
if (C.get_amount() < 1)
user << "<span class='warning'>You need one length of coil to wire the airlock assembly.</span>"
return
user.visible_message("[user] wires the airlock assembly.", "You start to wire the airlock assembly.")
if(do_after(user, 40))
if(!src) return
coil.use(1)
src.state = 1
user << "\blue You wire the Airlock!"
if(do_after(user, 40) && state == 0 && anchored)
if (C.use(1))
src.state = 1
user << "<span class='notice'>You wire the airlock.</span>"
else if(istype(W, /obj/item/weapon/wirecutters) && state == 1 )
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
@@ -236,23 +238,23 @@ obj/structure/door_assembly
else if(istype(W, /obj/item/stack/sheet) && !glass)
var/obj/item/stack/sheet/S = W
if (S)
if (S.amount>=1)
if (S.get_amount() >= 1)
if(istype(S, /obj/item/stack/sheet/rglass))
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40))
user << "\blue You installed reinforced glass windows into the airlock assembly!"
S.use(1)
glass = 1
if(do_after(user, 40) && !glass)
if (S.use(1))
user << "<span class='notice'>You installed reinforced glass windows into the airlock assembly.</span>"
glass = 1
else if(istype(S, /obj/item/stack/sheet/mineral) && S.sheettype)
var/M = S.sheettype
if(S.amount>=2)
if(S.get_amount() >= 2)
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40))
user << "\blue You installed [M] plating into the airlock assembly!"
S.use(2)
glass = "[M]"
if(do_after(user, 40) && !glass)
if (S.use(2))
user << "<span class='notice'>You installed [M] plating into the airlock assembly.</span>"
glass = "[M]"
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 )
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)

View File

@@ -81,55 +81,50 @@
if(/obj/item/stack/sheet/metal, /obj/item/stack/sheet/metal/cyborg)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall (src.loc)
del(src)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ChangeTurf(/turf/simulated/wall)
for(var/turf/simulated/wall/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
if(S.use(2))
user << "<span class='notice'>You create a false wall! Push on it to open or close the passage.</span>"
new /obj/structure/falsewall (src.loc)
del(src)
else
if(S.get_amount() < 2) return ..()
user << "<span class='notice'>Now adding plating...</span>"
if (do_after(user,40))
if (S.use(2))
user << "<span class='notice'>You added the plating!</span>"
var/turf/Tsrc = get_turf(src)
Tsrc.ChangeTurf(/turf/simulated/wall)
for(var/turf/simulated/wall/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/plasteel)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falserwall (src.loc)
del(src)
if(S.use(2))
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falserwall (src.loc)
del(src)
else
if (src.icon_state == "reinforced") //I cant believe someone would actually write this line of code...
if(S.amount < 1) return ..()
user << "\blue Now finalising reinforced wall."
if(S.get_amount() < 1) return ..()
user << "<span class='notice'>Now finalising reinforced wall.</span>"
if(do_after(user, 50))
if(!src || !S || S.amount < 1) return
S.use(1)
user << "\blue Wall fully reinforced!"
var/turf/Tsrc = get_turf(src)
Tsrc.ChangeTurf(/turf/simulated/wall/r_wall)
for(var/turf/simulated/wall/r_wall/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
if (S.use(1))
user << "<span class='notice'>Wall fully reinforced!</span>"
var/turf/Tsrc = get_turf(src)
Tsrc.ChangeTurf(/turf/simulated/wall/r_wall)
for(var/turf/simulated/wall/r_wall/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
else
if(S.amount < 1) return ..()
user << "\blue Now reinforcing girders"
if(S.get_amount() < 1) return ..()
user << "<span class='notice'>Now reinforcing girders...</span>"
if (do_after(user,60))
if(!src || !S || S.amount < 1) return
S.use(1)
user << "\blue Girders reinforced!"
new/obj/structure/girder/reinforced( src.loc )
del(src)
if(S.use(1))
user << "<span class='notice'>Girders reinforced!</span>"
new/obj/structure/girder/reinforced( src.loc )
del(src)
return
if(S.sheettype)

View File

@@ -121,7 +121,8 @@
return
//window placing begin
else if( istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass) )
else if(istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/ST = W
var/dir_to_set = 1
if(loc == user.loc)
dir_to_set = user.dir
@@ -146,24 +147,22 @@
return
user << "<span class='notice'>You start placing the window.</span>"
if(do_after(user,20))
if(!src) return //Grille destroyed while waiting
for(var/obj/structure/window/WINDOW in loc)
if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting.
user << "<span class='notice'>There is already a window facing this way there.</span>"
return
var/obj/structure/window/WD
if(istype(W,/obj/item/stack/sheet/rglass))
WD = new/obj/structure/window/reinforced(loc) //reinforced window
else
WD = new/obj/structure/window/basic(loc) //normal window
WD.dir = dir_to_set
WD.ini_dir = dir_to_set
WD.anchored = 0
WD.state = 0
var/obj/item/stack/ST = W
ST.use(1)
user << "<span class='notice'>You place the [WD] on [src].</span>"
WD.update_icon()
if (ST.use(1))
var/obj/structure/window/WD
if(istype(W, /obj/item/stack/sheet/rglass))
WD = new/obj/structure/window/reinforced(loc) //reinforced window
else
WD = new/obj/structure/window/basic(loc) //normal window
WD.dir = dir_to_set
WD.ini_dir = dir_to_set
WD.anchored = 0
WD.state = 0
user << "<span class='notice'>You place the [WD] on [src].</span>"
WD.update_icon()
return
//window placing end

View File

@@ -109,36 +109,33 @@ obj/structure/windoor_assembly/Del()
//Adding plasteel makes the assembly a secure windoor assembly. Step 2 (optional) complete.
else if(istype(W, /obj/item/stack/rods) && !secure)
var/obj/item/stack/rods/R = W
if(R.amount < 4)
user << "\red You need more rods to do this."
if(R.get_amount() < 4)
user << "<span class='warning'>You need more rods to do this.</span>"
return
user << "\blue You start to reinforce the windoor with rods."
user << "<span class='notice'>You start to reinforce the windoor with rods.</span>"
if(do_after(user,40))
if(!src) return
R.use(4)
user << "\blue You reinforce the windoor."
src.secure = "secure_"
if(src.anchored)
src.name = "Secure Anchored Windoor Assembly"
else
src.name = "Secure Windoor Assembly"
if(do_after(user,40) && !secure)
if (R.use(4))
user << "<span class='notice'>You reinforce the windoor.</span>"
src.secure = "secure_"
if(src.anchored)
src.name = "Secure Anchored Windoor Assembly"
else
src.name = "Secure Windoor Assembly"
//Adding cable to the assembly. Step 5 complete.
else if(istype(W, /obj/item/stack/cable_coil) && anchored)
user.visible_message("[user] wires the windoor assembly.", "You start to wire the windoor assembly.")
var/obj/item/stack/cable_coil/CC = W
if(do_after(user, 40))
if(!src) return
var/obj/item/stack/cable_coil/CC = W
CC.use(1)
user << "\blue You wire the windoor!"
src.state = "02"
if(src.secure)
src.name = "Secure Wired Windoor Assembly"
else
src.name = "Wired Windoor Assembly"
if (CC.use(1))
user << "<span class='notice'>You wire the windoor!</span>"
src.state = "02"
if(src.secure)
src.name = "Secure Wired Windoor Assembly"
else
src.name = "Wired Windoor Assembly"
else
..()

View File

@@ -213,12 +213,12 @@ var/list/mechtoys = list(
// Sell phoron
if(istype(A, /obj/item/stack/sheet/mineral/phoron))
var/obj/item/stack/sheet/mineral/phoron/P = A
phoron_count += P.amount
phoron_count += P.get_amount()
// Sell platinum
if(istype(A, /obj/item/stack/sheet/mineral/platinum))
var/obj/item/stack/sheet/mineral/platinum/P = A
plat_count += P.amount
plat_count += P.get_amount()
del(MA)

View File

@@ -490,15 +490,16 @@ turf/simulated/floor/proc/update_icon()
if(istype(C, /obj/item/stack/rods))
var/obj/item/stack/rods/R = C
if (is_plating())
if (R.amount >= 2)
user << "\blue Reinforcing the floor..."
if(do_after(user, 30) && R && R.amount >= 2 && is_plating())
if (R.get_amount() < 2)
user << "<span class='warning'>You need more rods.</span>"
return
user << "\blue Reinforcing the floor..."
if(do_after(user, 30) && is_plating())
if (R.use(2))
ChangeTurf(/turf/simulated/floor/engine)
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
R.use(2)
return
return
else
user << "\red You need more rods."
else
user << "\red You must remove the plating first."
return
@@ -507,27 +508,27 @@ turf/simulated/floor/proc/update_icon()
if(is_plating())
if(!broken && !burnt)
var/obj/item/stack/tile/T = C
floor_tile = new T.type
intact = 1
if(istype(T,/obj/item/stack/tile/light))
var/obj/item/stack/tile/light/L = T
var/obj/item/stack/tile/light/F = floor_tile
F.state = L.state
F.on = L.on
if(istype(T,/obj/item/stack/tile/grass))
for(var/direction in cardinal)
if(istype(get_step(src,direction),/turf/simulated/floor))
var/turf/simulated/floor/FF = get_step(src,direction)
FF.update_icon() //so siding gets updated properly
else if(istype(T,/obj/item/stack/tile/carpet))
for(var/direction in list(1,2,4,8,5,6,9,10))
if(istype(get_step(src,direction),/turf/simulated/floor))
var/turf/simulated/floor/FF = get_step(src,direction)
FF.update_icon() //so siding gets updated properly
T.use(1)
update_icon()
levelupdate()
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
if (T.use(1))
floor_tile = new T.type
intact = 1
if(istype(T,/obj/item/stack/tile/light))
var/obj/item/stack/tile/light/L = T
var/obj/item/stack/tile/light/F = floor_tile
F.state = L.state
F.on = L.on
if(istype(T,/obj/item/stack/tile/grass))
for(var/direction in cardinal)
if(istype(get_step(src,direction),/turf/simulated/floor))
var/turf/simulated/floor/FF = get_step(src,direction)
FF.update_icon() //so siding gets updated properly
else if(istype(T,/obj/item/stack/tile/carpet))
for(var/direction in list(1,2,4,8,5,6,9,10))
if(istype(get_step(src,direction),/turf/simulated/floor))
var/turf/simulated/floor/FF = get_step(src,direction)
FF.update_icon() //so siding gets updated properly
update_icon()
levelupdate()
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
else
user << "\blue This section is too damaged to support a tile. Use a welder to fix the damage."

View File

@@ -38,20 +38,20 @@
if(L)
return
var/obj/item/stack/rods/R = C
user << "\blue Constructing support lattice ..."
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice()
R.use(1)
if (R.use(1))
user << "\blue Constructing support lattice ..."
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice()
return
if (istype(C, /obj/item/stack/tile/plasteel))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
var/obj/item/stack/tile/plasteel/S = C
del(L)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
S.build(src)
S.use(1)
if (S.use(1))
del(L)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
S.build(src)
return
else
user << "\red The plating is going to need some support."

View File

@@ -15,7 +15,7 @@
user << "<span class='notice'>The [src] are already wired.</span>"
return
if(C.amount < 2)
if(C.get_amount() < 2)
user << "<span class='notice'>There is not enough wire to cover the [src].</span>"
return

View File

@@ -186,9 +186,9 @@ var/global/list/breach_burn_descriptors = list(
return
var/obj/item/stack/sheet/P = W
if(P.amount < 3)
P.use(P.amount)
repair_breaches(BURN, ( istype(P,/obj/item/stack/sheet/mineral/plastic) ? P.amount : (P.amount*2) ), user)
if(P.get_amount() < 3)
P.use(P.get_amount())
repair_breaches(BURN, ( istype(P,/obj/item/stack/sheet/mineral/plastic) ? P.get_amount() : (P.get_amount()*2) ), user)
else
P.use(3)
repair_breaches(BURN, ( istype(P,/obj/item/stack/sheet/mineral/plastic) ? 3 : 5), user)

View File

@@ -44,22 +44,19 @@
icon_state = "coin_adamantine"
/obj/item/weapon/coin/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W,/obj/item/stack/cable_coil) )
if(istype(W,/obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/CC = W
if(string_attached)
user << "\blue There already is a string attached to this coin."
user << "<span class='notice'>There already is a string attached to this coin.</span>"
return
if(CC.amount <= 0)
user << "\blue This cable coil appears to be empty."
del(CC)
return
overlays += image('icons/obj/items.dmi',"coin_string_overlay")
string_attached = 1
user << "\blue You attach a string to the coin."
CC.use(1)
else if(istype(W,/obj/item/weapon/wirecutters) )
if (CC.use(1))
overlays += image('icons/obj/items.dmi',"coin_string_overlay")
string_attached = 1
user << "<span class='notice'>You attach a string to the coin.</span>"
else
user << "<span class='notice'>This cable coil appears to be empty.</span>"
return
else if(istype(W,/obj/item/weapon/wirecutters))
if(!string_attached)
..()
return

View File

@@ -41,22 +41,22 @@
O = locate(/obj/item/stack/sheet, input.loc)
if(O)
if (istype(O,/obj/item/stack/sheet/mineral/gold))
amt_gold += 100 * O.amount
amt_gold += 100 * O.get_amount()
del(O)
if (istype(O,/obj/item/stack/sheet/mineral/silver))
amt_silver += 100 * O.amount
amt_silver += 100 * O.get_amount()
del(O)
if (istype(O,/obj/item/stack/sheet/mineral/diamond))
amt_diamond += 100 * O.amount
amt_diamond += 100 * O.get_amount()
del(O)
if (istype(O,/obj/item/stack/sheet/mineral/phoron))
amt_phoron += 100 * O.amount
amt_phoron += 100 * O.get_amount()
del(O)
if (istype(O,/obj/item/stack/sheet/mineral/uranium))
amt_uranium += 100 * O.amount
amt_uranium += 100 * O.get_amount()
del(O)
if (istype(O,/obj/item/stack/sheet/metal))
amt_iron += 100 * O.amount
amt_iron += 100 * O.get_amount()
del(O)
/obj/machinery/mineral/mint/attack_hand(user as mob)

View File

@@ -618,11 +618,11 @@
user << "Nothing to fix here!"
return
var/obj/item/stack/cable_coil/coil = W
adjustFireLoss(-30)
updatehealth()
coil.use(1)
for(var/mob/O in viewers(user, null))
O.show_message(text("\red [user] has fixed some of the burnt wires on [src]!"), 1)
if (coil.use(1))
adjustFireLoss(-30)
updatehealth()
for(var/mob/O in viewers(user, null))
O.show_message(text("\red [user] has fixed some of the burnt wires on [src]!"), 1)
else if (istype(W, /obj/item/weapon/crowbar)) // crowbar means open or close the cover
if(opened)

View File

@@ -351,11 +351,9 @@
if(stat != DEAD)
var/obj/item/stack/medical/MED = O
if(health < maxHealth)
if(MED.amount >= 1)
if(MED.get_amount() >= 1)
adjustBruteLoss(-MED.heal_brute)
MED.amount -= 1
if(MED.amount <= 0)
del(MED)
MED.use(1)
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\blue [user] applies the [MED] on [src]")

View File

@@ -178,7 +178,7 @@
if(istype(stomachContent,/obj/item/stack)) //converts to plasma, keeping the stack value
if(!istype(stomachContent,/obj/item/stack/sheet/mineral/phoron))
var/obj/item/stack/oldStack = stomachContent
new /obj/item/stack/sheet/mineral/phoron(src, oldStack.amount)
new /obj/item/stack/sheet/mineral/phoron(src, oldStack.get_amount())
del(oldStack)
continue
else if(istype(stomachContent,/obj/item)) //converts to plasma, keeping the w_class

View File

@@ -496,17 +496,17 @@
update_icon()
else
user << "You fail to [ locked ? "unlock" : "lock"] the APC interface."
else if (istype(W, /obj/item/stack/cable_coil) && !terminal && opened && has_electronics!=2)
else if (istype(W, /obj/item/stack/cable_coil) && !terminal && opened && has_electronics != 2)
if (src.loc:intact)
user << "\red You must remove the floor plating in front of the APC first."
return
var/obj/item/stack/cable_coil/C = W
if(C.amount < 10)
user << "\red You need more wires."
if(C.get_amount() < 10)
user << "<span class='warning'>You need more wires.</span>"
return
user << "You start adding cables to the APC frame..."
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20) && C.amount >= 10)
if(do_after(user, 20) && !terminal && opened && has_electronics != 2)
var/turf/T = get_turf(src)
var/obj/structure/cable/N = T.get_cable_node()
if (prob(50) && electrocute_mob(usr, N, N))
@@ -514,12 +514,12 @@
s.set_up(5, 1, src)
s.start()
return
C.use(10)
user.visible_message(\
"\red [user.name] has added cables to the APC frame!",\
"You add cables to the APC frame.")
make_terminal()
terminal.connect_to_network()
if (C.use(10))
user.visible_message(\
"\red [user.name] has added cables to the APC frame!",\
"You add cables to the APC frame.")
make_terminal()
terminal.connect_to_network()
else if (istype(W, /obj/item/weapon/wirecutters) && terminal && opened && has_electronics!=2)
if (src.loc:intact)
user << "\red You must remove the floor plating in front of the APC first."
@@ -1199,7 +1199,7 @@
if(cell && !shorted)
//var/cell_charge = cell.charge
var/cell_maxcharge = cell.maxcharge
// Calculate how much power the APC will try to get from the grid.
var/target_draw = lastused_total
if (src.attempt_charging())
@@ -1210,14 +1210,14 @@
var/power_drawn = 0
if (src.avail())
power_drawn = add_load(target_draw) //get some power from the powernet
//figure out how much power is left over after meeting demand
power_excess = power_drawn - lastused_total
if (power_excess < 0) //couldn't get enough power from the grid, we will need to take from the power cell.
charging = 0
var/required_power = -power_excess
if(cell.charge >= required_power*CELLRATE) // can we draw enough from cell to cover what's left over?
cell.use(required_power*CELLRATE)
@@ -1229,7 +1229,7 @@
lighting = autoset(lighting, 0)
environ = autoset(environ, 0)
autoflag = 0
//Set external power status
if (!power_drawn)
main_status = 0

View File

@@ -137,15 +137,15 @@
if(istype(W, /obj/item/stack/cable_coil))
if (src.stage != 1) return
var/obj/item/stack/cable_coil/coil = W
coil.use(1)
switch(fixture_type)
if ("tube")
src.icon_state = "tube-construct-stage2"
if("bulb")
src.icon_state = "bulb-construct-stage2"
src.stage = 2
user.visible_message("[user.name] adds wires to [src].", \
"You add wires to [src].")
if (coil.use(1))
switch(fixture_type)
if ("tube")
src.icon_state = "tube-construct-stage2"
if("bulb")
src.icon_state = "bulb-construct-stage2"
src.stage = 2
user.visible_message("[user.name] adds wires to [src].", \
"You add wires to [src].")
return
if(istype(W, /obj/item/weapon/screwdriver))

View File

@@ -217,7 +217,7 @@
if(istype(W, /obj/item/stack/cable_coil) && !terminal && !building_terminal)
building_terminal = 1
var/obj/item/stack/cable_coil/CC = W
if (CC.amount < 10)
if (CC.get_amount() < 10)
user << "<span class='warning'>You need more cables.</span>"
building_terminal = 0
return

View File

@@ -232,15 +232,16 @@ var/list/solars_list = list()
if(istype(W, /obj/item/stack/sheet/glass) || istype(W, /obj/item/stack/sheet/rglass))
var/obj/item/stack/sheet/S = W
if(S.amount >= 2)
if(S.use(2))
glass_type = W.type
S.use(2)
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] places the glass on the solar assembly.</span>")
if(tracker)
new /obj/machinery/power/tracker(get_turf(src), src)
else
new /obj/machinery/power/solar(get_turf(src), src)
else
user << "<span class='warning'>You need two sheets of glass to put them on the solar assembly.</span>"
return 1
if(!tracker)

View File

@@ -141,13 +141,13 @@
return
else if(istype(W,/obj/item/stack/rods))
var/obj/item/stack/rods/R = W
R.use(1)
in_chamber = new /obj/item/weapon/arrow/rod(src)
in_chamber.fingerprintslast = src.fingerprintslast
in_chamber.loc = src
icon_state = "crossbow-nocked"
user.visible_message("[user] jams [in_chamber] into [src].","You jam [in_chamber] into [src].")
superheat_rod(user)
if (R.use(1))
in_chamber = new /obj/item/weapon/arrow/rod(src)
in_chamber.fingerprintslast = src.fingerprintslast
in_chamber.loc = src
icon_state = "crossbow-nocked"
user.visible_message("[user] jams [in_chamber] into [src].","You jam [in_chamber] into [src].")
superheat_rod(user)
return
if(istype(W, /obj/item/weapon/cell))
@@ -210,8 +210,7 @@
if(istype(W,/obj/item/stack/rods))
if(buildstate == 0)
var/obj/item/stack/rods/R = W
if(R.amount >= 3)
R.use(3)
if(R.use(3))
user << "\blue You assemble a backbone of rods around the wooden stock."
buildstate++
update_icon()
@@ -231,8 +230,7 @@
else if(istype(W,/obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
if(buildstate == 2)
if(C.amount >= 5)
C.use(5)
if(C.use(5))
user << "\blue You wire a crude cell mount into the top of the crossbow."
buildstate++
update_icon()
@@ -240,8 +238,7 @@
user << "\blue You need at least five segments of cable coil to complete this task."
return
else if(buildstate == 4)
if(C.amount >= 5)
C.use(5)
if(C.use(5))
user << "\blue You string a steel cable across the crossbow's lath."
buildstate++
update_icon()
@@ -251,8 +248,7 @@
else if(istype(W,/obj/item/stack/sheet/mineral/plastic))
if(buildstate == 3)
var/obj/item/stack/sheet/mineral/plastic/P = W
if(P.amount >= 3)
P.use(3)
if(P.use(3))
user << "\blue You assemble and install a heavy plastic lath onto the crossbow."
buildstate++
update_icon()

View File

@@ -166,8 +166,7 @@
else if(istype(W,/obj/item/stack/sheet/metal))
if(buildstate == 2)
var/obj/item/stack/sheet/metal/M = W
if(M.amount >= 5)
M.use(5)
if(M.use(5))
user << "\blue You assemble a chassis around the cannon frame."
buildstate++
update_icon()

View File

@@ -85,9 +85,8 @@
/obj/item/weapon/reagent_containers/food/snacks/grown/potato/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/stack/cable_coil))
if(W:amount >= 5)
W:amount -= 5
if(!W:amount) del(W)
var/obj/item/stack/cable_coil/C = W
if(C.use(5))
user << "<span class='notice'>You add some cable to the potato and slide it inside the battery encasing.</span>"
var/obj/item/weapon/cell/potato/pocell = new /obj/item/weapon/cell/potato(user.loc)
pocell.maxcharge = src.potency * 10

View File

@@ -135,8 +135,8 @@ Note: Must be placed west/left of and R&D console to function.
amount = 0
if(amount == 0)
return
if(amount > stack.amount)
amount = stack.amount
if(amount > stack.get_amount())
amount = stack.get_amount()
if(max_material_storage - TotalMaterials() < (amount*stack.perunit))//Can't overfill
amount = min(stack.amount, round((max_material_storage-TotalMaterials())/stack.perunit))

View File

@@ -270,8 +270,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
M.death()
if(istype(I,/obj/item/stack/sheet))//Only deconsturcts one sheet at a time instead of the entire stack
var/obj/item/stack/sheet/S = I
if(S.amount > 1)
S.amount--
if(S.get_amount() > 1)
S.use(1)
linked_destroy.loaded_item = S
else
del(S)

View File

@@ -71,7 +71,7 @@
var/choice = alert("What do you want to do with the nanopaste?","Radiometric Scanner","Scan nanopaste","Fix seal integrity")
if(choice == "Fix seal integrity")
var/obj/item/stack/nanopaste/N = I
var/amount_used = min(N.amount, 10 - scanner_seal_integrity / 10)
var/amount_used = min(N.get_amount(), 10 - scanner_seal_integrity / 10)
N.use(amount_used)
scanner_seal_integrity = round(scanner_seal_integrity + amount_used * 10)
return

View File

@@ -301,15 +301,14 @@
else if(istype(W, /obj/item/stack/cable_coil) && malfunction && is_open)
var/obj/item/stack/cable_coil/coil = W
user << "\blue You begin to replace the wires."
user << "<span class='notice'>You begin to replace the wires.</span>"
//if(do_after(user, min(60, round( ((maxhealth/health)*10)+(malfunction*10) ))) //Take longer to repair heavier damage
if(do_after(user, 30))
if(!src || !coil) return
coil.use(1)
health = max_health
malfunction = 0
user << "\blue You repair the [src]!"
update_icon()
if (coil.use(1))
health = max_health
malfunction = 0
user << "<span class='notice'>You repair the [src]!</span>"
update_icon()
else if(istype(W, /obj/item/weapon/wrench))
if(locked)